/* ==========================================================================
   MEITCraft Portal – Stylesheet (Design wie die Website: dunkle Eiswelt, Pixel-Kanten, Minecraft-Buttons, Hotbar-Navigation)
   Alles lokal: Schriften, Bilder, keine externen Ressourcen. Aufbau: 1 Fonts · 2 Tokens · 3 Basis · 4 Layout · 5 Komponenten · 6 Seiten · 7 Responsive
   ========================================================================== */

/* 1. FONTS (lokal) */
@font-face { font-family: "Press Start 2P"; src: url("/fonts/pressstart2p-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* 2. DESIGN-TOKENS (wie Website-v2/style.css) */
:root {
  --bg: #050a1f; --bg-2: #081235; --bg-3: #030717; --panel: #0b1a52; --panel-2: #0e2266; --line: #2a4fb0;
  --text: #eaf4ff; --text-2: #b7cdf0; --muted: #9db4dc;
  --blue: #2f8bff; --cyan: #37e0ff; --ice: #b8f4ff; --deep: #1237c8; --amber: #ffb340; --ok: #4dff9a; --danger: #ff5a6e;
  --grad: linear-gradient(100deg, var(--ice), var(--cyan) 45%, var(--blue));
  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --px: 4px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --hud-h: 120px;
}

/* 3. BASIS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background-color: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-bottom: 140px; }
body {
  min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--hud-h) + var(--safe-b));
  background: radial-gradient(1200px 600px at 80% -10%, #0e2a7a55, transparent 60%), radial-gradient(900px 600px at 0% 40%, #0a3a8a33, transparent 60%), var(--bg);
  color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.6; overflow-x: hidden;
}
a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--ice); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--amber); color: #1a0f00; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 400; padding: 10px 14px; background: var(--cyan); color: #00131a; font-weight: 700; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; } .nowrap { white-space: nowrap; } .mono { font-family: var(--font-mono); }
.ok { color: var(--ok); } .warn { color: var(--amber); } .bad { color: var(--danger); }

/* 4. LAYOUT */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px max(16px, 3vw); max-width: 1100px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; font-family: var(--font-pixel); font-size: 14px; color: var(--text); text-decoration: none; }
.brand img { filter: drop-shadow(0 0 10px rgba(55, 224, 255, .6)); }
.brand b { font-weight: 400; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .tag { font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--amber); border: 1px solid rgba(255, 179, 64, .5); padding: 1px 7px; }
.top__right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--text-2); font-size: .9rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 1100px; margin: 0 auto; padding: 8px max(16px, 3vw) 40px; outline: none; }
.page-head { margin: 8px 0 28px; }
.kicker { margin-bottom: 12px; font-family: var(--font-pixel); font-size: 10px; letter-spacing: 3px; color: var(--amber); }
h1 { font-family: var(--font-pixel); font-size: clamp(16px, 3.2vw, 26px); line-height: 1.6; font-weight: 400; }
h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1::after { content: ""; display: block; width: 120px; height: 8px; margin: 18px 0 0; background: repeating-linear-gradient(90deg, var(--cyan) 0 8px, transparent 8px 16px); opacity: .7; }
h2 { font-size: 1.15rem; margin: 0 0 12px; color: var(--ice); }
h3 { font-size: 1rem; margin: 0 0 6px; }
.lead { color: var(--text-2); max-width: 62ch; margin-top: 14px; }
.page-head .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }

.footer { max-width: 1100px; margin: 0 auto; padding: 0 max(16px, 3vw) 24px; display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: center; color: var(--muted); font-size: .85rem; }
.footer a { color: var(--text-2); }

/* 5. KOMPONENTEN */
/* Pixel-Rahmen: Notch-Ecken ohne clip-path, Farbe über --pc */
.card, .notice, .field-box {
  --pc: var(--line);
  margin: var(--px); background: var(--panel); padding: 20px 22px;
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--pc), 0 var(--px) 0 0 var(--pc), calc(var(--px) * -1) 0 0 0 var(--pc), var(--px) 0 0 0 var(--pc);
}
.card--link { display: block; color: inherit; text-decoration: none; transition: transform .15s, background .2s; }
.card--link:hover, .card--link:focus-visible { --pc: var(--cyan); background: var(--panel-2); transform: translateY(-3px); }
.card--amber { --pc: var(--amber); }
.card h2 { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; } .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Hinweise */
.notice { padding: 14px 18px; background: rgba(14, 34, 102, .7); --pc: rgba(55, 224, 255, .5); font-size: .95rem; }
.notice--warn { --pc: var(--amber); background: rgba(80, 50, 0, .35); }
.notice--bad { --pc: var(--danger); background: rgba(90, 10, 25, .45); }
.notice--ok { --pc: var(--ok); background: rgba(5, 70, 40, .4); }
.form-error { margin: 0; color: #ffd0d6; background: rgba(255, 90, 110, .14); border: 2px solid rgba(255, 90, 110, .6); padding: 10px 14px; }
.draft-note { margin: 0 0 22px; padding: 12px 16px; border: 2px dashed var(--amber); background: rgba(80, 50, 0, .35); color: #ffe3a3; font-size: .95rem; }

/* Minecraft-Buttons: hell oben-links, dunkel unten-rechts, schwarzer Außenrand */
.mc-btn {
  --face: #2f6fe0; --hi: #7fb4ff; --lo: #153a9c; --ink: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 14px 22px; cursor: pointer; border: 0; text-decoration: none;
  font-family: var(--font-pixel); font-size: 11px; line-height: 1.4; text-align: center; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  color: var(--ink); background: var(--face); margin: var(--px);
  box-shadow: inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo), inset var(--px) var(--px) 0 var(--hi), 0 0 0 var(--px) #02061a;
  transition: transform .08s, filter .15s;
}
.mc-btn:hover { filter: brightness(1.15); color: var(--ink); }
.mc-btn:active { transform: translateY(2px); box-shadow: inset var(--px) var(--px) 0 var(--lo), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--hi), 0 0 0 var(--px) #02061a; }
.mc-btn--amber { --face: #ffb340; --hi: #ffe3a3; --lo: #b86f0a; --ink: #2a1600; text-shadow: 2px 2px 0 rgba(255, 255, 255, .3); }
.mc-btn--grey { --face: #3b4a7a; --hi: #6f82bd; --lo: #1d2750; }
.mc-btn--red { --face: #c8334a; --hi: #ff8a99; --lo: #7a1426; }
.mc-btn--sm { min-height: 40px; padding: 10px 14px; font-size: 9px; }
.mc-btn--block { display: flex; width: calc(100% - 2 * var(--px)); }
.mc-btn:disabled, .mc-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: grayscale(.4); transform: none; }
.link-btn { background: none; border: 0; color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px 2px; }

/* Formulare */
label, .label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--text-2); font-size: .95rem; }
.hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
input[type=text], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: rgba(3, 7, 23, .85); border: 2px solid var(--line); border-radius: 0; padding: 12px 14px; min-height: 48px; min-width: 0;
}
textarea { resize: vertical; min-height: 170px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); outline: 3px solid rgba(55, 224, 255, .35); outline-offset: 0; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.code-input { font-family: var(--font-pixel); font-size: 22px; letter-spacing: 8px; text-align: center; }
.counter { text-align: right; font-size: .8rem; color: var(--muted); font-weight: 400; }
.counter.over { color: var(--danger); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--cyan); flex: none; }
.check { flex-direction: row; align-items: flex-start; gap: 12px; font-weight: 500; }
fieldset { border: 0; min-width: 0; } legend { font-weight: 600; color: var(--text-2); margin-bottom: 8px; padding: 0; }

/* Kategorie-Auswahl */
.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: block; height: 100%; padding: 12px 14px; background: rgba(3, 7, 23, .6); border: 2px solid var(--line); font-weight: 600; color: var(--text); }
.choice small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.choice input:checked + span { border-color: var(--amber); background: rgba(80, 50, 0, .35); }
.choice input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }
.choice:hover span { border-color: var(--cyan); }

/* Badges / Status */
.badge { display: inline-block; padding: 3px 10px; font-size: .75rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; border: 2px solid currentColor; white-space: nowrap; }
.badge--open { color: var(--cyan); } .badge--in_progress { color: var(--amber); } .badge--waiting_player { color: var(--ok); background: rgba(77, 255, 154, .1); } .badge--done { color: var(--muted); }
.badge--cat { color: var(--text-2); border-color: var(--line); }
.dot-new { display: inline-block; width: 10px; height: 10px; background: var(--amber); box-shadow: 0 0 8px var(--amber); flex: none; }
.pill-count { position: absolute; top: -8px; right: -6px; min-width: 22px; padding: 2px 5px; font: 700 11px/1.2 var(--font-body); text-align: center; color: #2a1600; background: var(--amber); box-shadow: 0 0 0 2px #02061a; }

/* HUD: Hotbar-Navigation */
.hud { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); z-index: 100; translate: -50% 0; width: max-content; max-width: 98vw; }
.hotbar { display: flex; gap: 4px; padding: var(--px); background: #02061a; box-shadow: 0 0 0 var(--px) #2a3f80, 0 10px 40px rgba(0, 0, 0, .6); list-style: none; }
.slot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 84px; height: 66px; text-decoration: none; color: var(--text-2);
  background: #13235c; box-shadow: inset 3px 3px 0 #0a1440, inset -3px -3px 0 #2e4aa6; transition: background .15s;
}
.slot svg { width: 26px; height: 26px; shape-rendering: crispEdges; transition: transform .15s; }
.slot span.lbl { font-size: 12px; font-weight: 700; line-height: 1; }
.slot:hover, .slot:focus-visible { background: #1b3180; color: var(--text); }
.slot:hover svg { transform: translateY(-2px); }
.slot[aria-current="page"] { background: #1b3180; color: var(--amber); box-shadow: inset 3px 3px 0 #0a1440, inset -3px -3px 0 #2e4aa6, 0 0 0 4px var(--amber), 0 0 0 7px #02061a; z-index: 1; }

/* Sitzungs-/Meldungs-Toasts */
.toasts { position: fixed; top: 16px; left: 50%; translate: -50% 0; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(92vw, 460px); pointer-events: none; }
.toast { padding: 12px 18px; font-weight: 600; color: #2a1600; background: var(--amber); box-shadow: inset 4px 4px 0 #ffe3a3, inset -4px -4px 0 #b86f0a, 0 0 0 4px #02061a; animation: slidein .25s ease-out; }
.toast.bad { color: #fff; background: #c8334a; box-shadow: inset 4px 4px 0 #ff8a99, inset -4px -4px 0 #7a1426, 0 0 0 4px #02061a; }
@keyframes slidein { from { opacity: 0; translate: 0 -12px; } to { opacity: 1; translate: 0 0; } }

dialog { margin: auto; max-width: min(92vw, 480px); padding: 0; color: var(--text); background: transparent; border: 0; }
dialog::backdrop { background: rgba(2, 6, 26, .8); }
dialog .card { margin: var(--px); }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }

/* 6. SEITEN */
/* Anmeldung */
.login-body { display: grid; place-items: center; padding: 20px 16px calc(40px + var(--safe-b)); }
.login-wrap { width: min(100%, 460px); }
.login-card { text-align: center; padding: 30px 26px; }
.login-card .brand { font-size: 18px; margin-bottom: 4px; }
.login-card form { text-align: left; display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-card .sub { font-family: var(--font-pixel); font-size: 10px; letter-spacing: 3px; color: var(--amber); margin-top: 8px; }
.steps-hint { margin-top: 18px; text-align: left; font-size: .9rem; color: var(--muted); }
.steps-hint ol { padding-left: 1.2em; margin-top: 6px; }

/* Start */
.hello { font-family: var(--font-pixel); font-size: clamp(14px, 2.6vw, 20px); line-height: 1.7; }
.big-num { font-family: var(--font-pixel); font-size: clamp(20px, 4vw, 30px); color: var(--amber); text-shadow: 3px 3px 0 #5a3500; line-height: 1.4; margin: 6px 0; }

/* Statistik */
.stat-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.stat-row { display: grid; gap: 6px; }
.stat-row .top-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
progress { width: 100%; height: 14px; appearance: none; -webkit-appearance: none; border: 0; background: #02061a; box-shadow: 0 0 0 2px #2a3f80; }
progress::-webkit-progress-bar { background: #02061a; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
progress.amber::-webkit-progress-value { background: linear-gradient(90deg, #b86f0a, var(--amber)); }
progress.amber::-moz-progress-bar { background: linear-gradient(90deg, #b86f0a, var(--amber)); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0; }
.kv > div { display: flex; flex-direction: column; } .kv dt { font-size: .8rem; color: var(--muted); } .kv dd { font-size: 1.15rem; font-weight: 700; color: var(--ice); margin: 0; }
.empty { text-align: center; padding: 34px 18px; color: var(--text-2); }
.empty .big-icon { width: 54px; height: 54px; margin: 0 auto 12px; color: var(--cyan); opacity: .8; display: block; }
.online-dot { display: inline-block; width: 12px; height: 12px; background: var(--ok); box-shadow: 0 0 8px var(--ok); margin-right: 6px; vertical-align: middle; }
.offline-dot { background: var(--muted); box-shadow: none; }

/* Tickets */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { padding: 10px 16px; min-height: 44px; cursor: pointer; border: 0; font-weight: 700; color: var(--muted); background: #13235c; box-shadow: inset 3px 3px 0 #0a1440, inset -3px -3px 0 #2e4aa6, 0 0 0 var(--px) #02061a; margin: var(--px); }
.tab:hover { color: var(--ice); }
.tab[aria-selected="true"] { color: #2a1600; background: var(--amber); box-shadow: inset 3px 3px 0 #ffe3a3, inset -3px -3px 0 #b86f0a, 0 0 0 var(--px) #02061a; }
.ticket-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.ticket-item { display: block; text-decoration: none; color: inherit; }
.ticket-item .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ticket-item .nr { font-family: var(--font-mono); color: var(--muted); }
.ticket-item h3 { font-size: 1.05rem; margin: 0; color: var(--text); overflow-wrap: anywhere; }
.ticket-item .meta { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.thread { list-style: none; display: flex; flex-direction: column; gap: 14px; margin: 0 0 22px; }
.msg { max-width: min(100%, 680px); padding: 14px 16px; border: 2px solid var(--line); background: rgba(3, 7, 23, .55); }
.msg .who-line { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.msg .who-line b { color: var(--ice); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--player { align-self: flex-end; border-color: rgba(55, 224, 255, .6); background: rgba(14, 50, 120, .5); }
.msg--team { align-self: flex-start; border-color: var(--amber); background: rgba(80, 50, 0, .3); }
.msg--team .who-line b { color: var(--amber); }
.msg--system { align-self: center; border-style: dashed; text-align: center; background: transparent; font-size: .9rem; color: var(--text-2); max-width: 100%; }
.prog-line { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tip-list { padding-left: 1.2em; } .tip-list li { margin: 4px 0; }
.session-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.session-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 2px solid var(--line); background: rgba(3, 7, 23, .5); }

/* Rechtstext */
.legal { max-width: 74ch; margin: 0 auto; }
.legal h2 { margin-top: 28px; } .legal p, .legal ul { margin: 10px 0; color: var(--text-2); } .legal ul { padding-left: 1.3em; } .legal strong { color: var(--text); }

/* 7. RESPONSIVE */
@media (max-width: 640px) {
  :root { --hud-h: 116px; }
  .top { padding-top: 10px; } .brand { font-size: 12px; } .brand .tag { display: none; }
  .card, .notice { padding: 16px; }
  .slot { width: 72px; height: 62px; } .slot span.lbl { font-size: 11px; }
  .mc-btn { padding: 12px 14px; font-size: 10px; } .mc-btn--sm { padding: 9px 11px; }
  .dialog-actions .mc-btn { flex: 1 1 100%; }
  .msg { max-width: 100%; }
  .code-input { letter-spacing: 5px; font-size: 18px; }
}
@media (max-width: 360px) { .slot { width: 64px; } .slot span.lbl { font-size: 10px; } .who { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .card, .notice, .mc-btn, .slot { border: 2px solid CanvasText; } progress { border: 1px solid CanvasText; } }
.login-foot { margin-top: 18px; }

.card h2 svg { width: 24px; height: 24px; flex: none; color: var(--cyan); shape-rendering: crispEdges; }
h1:focus, h1:focus-visible { outline: none; }
.btn-icon svg, .mc-btn svg { width: 16px; height: 16px; shape-rendering: crispEdges; }
.empty .big-icon { shape-rendering: crispEdges; }
.session-list .badge { margin-left: 10px; }
