/* Übernimmt Farben, Raster, Kopf, Fuß, Hintergrundbild und Bausteine aus portal/assets/css/main.css,
   aber bewusst eckig ohne border-radius.
   Bei Änderungen am Portal-Stil hier mitziehen. */
:root {
  --bg: #121214;
  --fg: #f2f2ef;
  --muted: #c4c4bd;
  --border: rgba(255, 255, 255, 0.18);
  --accent: #fb923c;
  --accent-hover: #fdba74;
  --field: rgba(12, 12, 14, 0.75);
  --green: #4ade80;
  --red: #f87171;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 "Noto Sans", "Open Sans", system-ui, sans-serif;
}
a { color: var(--accent); }

header, main, footer {
  box-sizing: border-box;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
main { flex: 1; }

/* Spielbild als fester, stark abgedunkelter Hintergrund, unten in den Grundton auslaufend */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
}
.backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.3);
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 18, 20, 0.2) 0%, rgba(18, 18, 20, 0.85) 70%, var(--bg) 100%);
}

/* Kopf- und Fußzeile */
header { border-bottom: 1px solid var(--border); }
header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
}
header a { color: var(--fg); text-decoration: none; }
header a:hover, header a.active { color: var(--accent); }
header a.active { box-shadow: inset 0 -2px 0 var(--accent); }
.brand { font-weight: 700; margin-right: auto; }
footer {
  display: flex;
  gap: 1.25rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
}

/* Allgemeine Bausteine */
h1 { text-shadow: var(--shadow); }
h2 { font-size: 1.5rem; }
.crumb { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.crumb a { color: inherit; }
.lead { margin: 0.75rem 0 0; font-size: 1.15rem; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; }
.section-head { padding: 3.5rem 0 2rem; }
.section-head h1 { margin: 0; font-size: clamp(2.5rem, 6vw, 3.5rem); line-height: 1.1; overflow-wrap: anywhere; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  box-sizing: border-box;
  padding: 0 1.4rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.ghost {
  background: rgba(18, 18, 20, 0.5);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--fg);
  font-weight: 600;
}
.button.ghost:hover { border-color: var(--accent); color: var(--accent); }
.button.danger { background: transparent; border-color: var(--red); color: var(--red); }
.button.danger:hover { background: var(--red); color: var(--bg); }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.box {
  padding: 1.25rem;
  background: rgba(18, 18, 20, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
}
.box h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.box p { margin: 0; }
.box dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.95rem;
}
.box dt { color: var(--muted); }
.box dd { margin: 0; overflow-wrap: anywhere; }

/* Inhalt und Seitenleiste wie auf den Projektseiten, auf schmalen Bildschirmen untereinander */
.layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 2rem;
}
.layout-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.layout-aside { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.tips { margin: 0; padding-left: 1.25rem; font-size: 0.95rem; color: var(--muted); }
.tips li + li { margin-top: 0.35rem; }

/* Formulare */
.ticket-form { display: flex; flex-direction: column; gap: 1.1rem; }
.ticket-form.narrow { max-width: 24rem; }
.ticket-form label { display: flex; flex-direction: column; gap: 0.35rem; }
.ticket-form label > span { font-weight: 600; }
.ticket-form small { margin-left: 0.25rem; color: var(--muted); font-weight: 400; }
.ticket-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ticket-form .hint { margin: 0; }
.ticket-form > .button { align-self: flex-start; }
input, select, textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--fg);
  font: inherit;
}
select option, select optgroup { background: var(--bg); }
input[type="checkbox"] { width: auto; min-height: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.inline-label { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 0.5rem; color: var(--muted); }
.inline-label select { width: auto; }

/* Honeypot: für Menschen unsichtbar, Bots füllen es aus */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Hinweise */
.notice { margin-bottom: 1.5rem; padding: 0.9rem 1.1rem; border: 1px solid; backdrop-filter: blur(6px); }
.notice p { margin: 0.25rem 0; }
.notice.error { border-color: var(--red); background: rgba(60, 20, 20, 0.7); }
.notice.success { border-color: var(--green); background: rgba(16, 48, 28, 0.7); }
.notice .copy { margin-top: 0.6rem; font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* Status als Chip wie die Sprungmarken im Portal */
.status { display: inline-block; padding: 0 0.65rem; border: 1px solid; font-size: 0.85rem; font-weight: 600; }
.status-open { color: var(--accent); }
.status-answered { color: var(--green); }
.status-closed { color: var(--muted); }

/* Verlauf */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.message {
  padding: 1rem 1.25rem;
  background: rgba(18, 18, 20, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
}
.message.admin { border-color: rgba(251, 146, 60, 0.6); }
.message .who { margin: 0 0 0.4rem; font-weight: 700; }
.message.admin .who { color: var(--accent); }
.message .body { overflow-wrap: anywhere; }
time { margin-left: 0.5rem; color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.event { text-align: center; color: var(--muted); font-size: 0.9rem; }

/* Anhänge unter einer Nachricht, Bilder als kleine Vorschau */
.attachments { list-style: none; margin: 0.85rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.attachments a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  background: rgba(12, 12, 14, 0.6);
  color: var(--fg);
  font-size: 0.9rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.attachments a:hover { border-color: var(--accent); color: var(--accent); }
.attachments small { color: var(--muted); }
.attachments .image a { flex-direction: column; align-items: flex-start; padding: 0.4rem; max-width: 12rem; }
.attachments img { display: block; width: 11rem; height: 7rem; object-fit: cover; }
input[type="file"] { padding: 0.5rem; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* Admin */
.ticket-head { padding: 2rem 0 1.5rem; }
.ticket-head h1 { margin: 0; font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.15; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 1rem 0 0; font-size: 0.95rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: 2rem; }
.section-title h1 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.filters select { width: auto; }
.table-wrap { overflow-x: auto; }
.tickets { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tickets th, .tickets td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.tickets th { color: var(--muted); font-weight: 600; }
.admin-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.admin-tools form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
main > .thread + .ticket-form { margin-top: 1.5rem; }

@media (max-width: 640px) {
  .ticket-form .row { grid-template-columns: 1fr; }
  header nav { gap: 1rem; }
}

/* Spinner im Button während des Absendens, eckig wie der Rest der Seite */
.button.is-sending { pointer-events: none; opacity: 0.85; }
.button.is-sending::before {
  content: "";
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.6rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .button.is-sending::before { animation: pulse 1.2s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.3; } }
}
