/* HITJAHR · "Tactical Dark" (Formensprache wie das fib-Panel)
   Dunkel + Gold, Fasen statt Rundungen, Eckwinkel an Karten,
   flache Großbuchstaben-Buttons, Unterstrich-Felder und -Tabs.
   Bewusst KEIN Leuchten, KEINE Verläufe, KEIN Glas. */
@font-face { font-family: 'Barlow'; src: url('/Barlow-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/Barlow-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/Barlow-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/BarlowCondensed-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/BarlowCondensed-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Space Mono'; src: url('/SpaceMono-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --gold: #d4a017;
  --gold-hi: #e9bd3c;
  --gold-dim: rgba(212, 160, 23, 0.55);
  --gold-bg: #1a1710;
  --bg: #08090b;
  --bg2: #0e1013;
  --card: #111317;
  --card-hi: #171a1f;
  --raise: #15171b;
  --line: #23262c;
  --line2: #30343b;
  --text: #eceae4;
  --text2: #aeb0b5;
  --muted: #73767d;
  --ok: #4caf6a;
  --bad: #d9534f;
  --ink: #0a0b0d;
  --cut: 7px;
  --cut-lg: 12px;
  --fase: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  --fase-r: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  --fase-lg: polygon(var(--cut-lg) 0, 100% 0, 100% calc(100% - var(--cut-lg)), calc(100% - var(--cut-lg)) 100%, 0 100%, 0 var(--cut-lg));
  --head: 'Barlow Condensed', 'Barlow', Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 'Barlow', 'Helvetica Neue', Arial, sans-serif; }
body { min-height: 100dvh; }
::selection { background: var(--gold); color: var(--ink); }
* { scrollbar-color: #34383f transparent; }
#app { max-width: 560px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom)); }
#app.wide { max-width: 980px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; font-family: var(--head); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
h2 { font-size: 22px; }
h3 { font-size: 15px; color: var(--text); }
h3::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); margin: 0 10px 2px 2px; }
a { color: var(--gold-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Space Mono', monospace; font-size: 13px; color: var(--gold-hi); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.spacer { height: 18px; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Kopf ---------- */
.logo { font-family: var(--head); font-weight: 700; font-size: 52px; letter-spacing: 0.16em; color: var(--text); text-align: center; margin: 18px 0 0; line-height: 1; }
.logo b { color: var(--gold); font-weight: 700; }
.logo.sm { font-size: 22px; letter-spacing: 0.12em; text-align: left; margin: 0; }
.edition { text-align: center; color: var(--gold); letter-spacing: 0.24em; text-transform: uppercase; font-family: var(--head); font-weight: 600; font-size: 13px; margin: 10px 0 26px; position: relative; padding-bottom: 14px; }
.edition::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 56px; height: 2px; background: var(--gold); transform: translateX(-50%); }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); position: relative; }
.topbar::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 48px; height: 2px; background: var(--gold); }

/* ---------- Karten mit Eckwinkeln ---------- */
.card {
  background-color: var(--card); border: 1px solid var(--line); padding: 18px;
  background-image: linear-gradient(var(--gold-dim), var(--gold-dim)), linear-gradient(var(--gold-dim), var(--gold-dim)), linear-gradient(var(--gold-dim), var(--gold-dim)), linear-gradient(var(--gold-dim), var(--gold-dim));
  background-repeat: no-repeat;
  background-size: 12px 1px, 1px 12px, 12px 1px, 1px 12px;
  background-position: left top, left top, right bottom, right bottom;
}
.card + .card { margin-top: 14px; }

/* ---------- Buttons ---------- */
button, .btn {
  position: relative; overflow: hidden; appearance: none; border: 0; border-radius: 0; clip-path: var(--fase);
  padding: 13px 20px; font-family: var(--head); font-size: 15px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text); background: var(--raise); box-shadow: inset 0 -2px 0 var(--line2);
  cursor: pointer; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; justify-content: center; user-select: none;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
button:hover, .btn:hover { background: #1d2025; color: var(--gold-hi); box-shadow: inset 0 -2px 0 var(--gold); text-decoration: none; }
button:not(:disabled):active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; pointer-events: none; }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--gold); }
.btn-main { background: var(--gold); color: var(--ink); box-shadow: none; font-size: 17px; padding: 17px 22px; }
.btn-main:hover { background: var(--gold-hi); color: var(--ink); box-shadow: none; }
.btn-ok { background: color-mix(in srgb, var(--ok) 18%, var(--card)); color: #8fe0a6; box-shadow: inset 0 -2px 0 var(--ok); }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 28%, var(--card)); color: #b3f0c4; box-shadow: inset 0 -2px 0 var(--ok); }
.btn-bad { background: color-mix(in srgb, var(--bad) 18%, var(--card)); color: #f0a3a0; box-shadow: inset 0 -2px 0 var(--bad); }
.btn-bad:hover { background: color-mix(in srgb, var(--bad) 28%, var(--card)); color: #f8c4c2; box-shadow: inset 0 -2px 0 var(--bad); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line2); color: var(--text2); }
.btn-ghost:hover { background: var(--raise); box-shadow: inset 0 0 0 1px var(--gold); }
.btn-sm { padding: 8px 13px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 42px; height: 42px; font-size: 16px; }
.fx-press { position: absolute; pointer-events: none; z-index: 0; border: 1px solid currentColor; opacity: 0.55; transform: scale(0) rotate(45deg); animation: fxPress 0.55s var(--ease) forwards; }
@keyframes fxPress { to { transform: scale(1) rotate(45deg); opacity: 0; } }

/* ---------- Formulare ---------- */
input, textarea, select {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--raise);
  border: 0; border-bottom: 2px solid var(--line2); border-radius: 0; clip-path: var(--fase-r);
  padding: 12px 14px; outline: none; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
input:hover, textarea:hover, select:hover { background: #191c20; }
input:focus, textarea:focus, select:focus { background: #1a1d22; border-bottom-color: var(--gold); }
textarea { min-height: 140px; resize: vertical; }
label.lbl { display: block; font-family: var(--head); font-size: 12.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
input[type=color] { padding: 4px; height: 44px; width: 56px; cursor: pointer; }
input[type=file] { padding: 10px; }
input[type=checkbox] { appearance: none; width: 20px !important; height: 20px; padding: 0; clip-path: none; border: 1px solid var(--line2); background: var(--raise); cursor: pointer; position: relative; flex: 0 0 auto; }
input[type=checkbox]:checked { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 25%, var(--card)); }
input[type=checkbox]:checked::after { content: ''; position: absolute; inset: 4px; background: var(--gold); }

/* ---------- Kategorien ---------- */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cat {
  display: block; text-align: left; padding: 14px 14px 12px; clip-path: var(--fase-lg);
  background: var(--raise); box-shadow: inset 0 -2px 0 var(--line2); color: var(--text);
  font-family: 'Barlow', sans-serif; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 600;
}
.cat .em { font-size: 24px; display: block; margin-bottom: 8px; }
.cat .n { color: var(--muted); font-size: 12px; font-weight: 600; font-family: var(--head); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 2px; }
.cat .n::before { content: ''; display: inline-block; width: 5px; height: 5px; background: var(--c, var(--gold)); transform: rotate(45deg); margin: 0 7px 2px 1px; }
.cat:hover { color: var(--text); background: #1b1e23; box-shadow: inset 0 -2px 0 var(--gold-dim); }
.cat.on { background: var(--gold-bg); box-shadow: inset 0 -2px 0 var(--gold), inset 3px 0 0 var(--gold); color: var(--gold-hi); }

/* ---------- Spieler / Punkte ---------- */
.players .p { display: flex; gap: 8px; margin-bottom: 8px; }
.score { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.score .s { flex: 0 0 auto; background: var(--card); border: 1px solid var(--line); padding: 8px 12px; min-width: 92px; clip-path: var(--fase-r); }
.score .s.on { background: var(--gold-bg); border-color: var(--gold-dim); box-shadow: inset 0 -2px 0 var(--gold); }
.score .s b { display: block; font-family: var(--head); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.score .s.on b { color: var(--gold-hi); }
.score .s span { font-family: 'Space Mono', monospace; font-size: 20px; }

.turn { text-align: center; margin: 12px 0 22px; }
.turn .muted { font-family: var(--head); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; }
.turn .who { font-family: var(--head); font-weight: 700; font-size: 36px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Plattenspieler ---------- */
.player-view { text-align: center; }
.player-view > .muted { font-family: var(--head); font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; font-size: 12px; }
.vinyl { position: relative; width: min(72vw, 290px); aspect-ratio: 1; margin: 14px auto 22px; border-radius: 50%;
  background: repeating-radial-gradient(circle, #0b0c0f 0 3px, #14161a 3px 5px); box-shadow: 0 0 0 1px var(--line2), 0 0 0 7px var(--bg), 0 0 0 8px var(--gold-dim); }
.vinyl::after { content: ''; position: absolute; inset: 36%; border-radius: 50%; background: var(--gold); }
.vinyl::before { content: 'HITJAHR'; position: absolute; left: 0; right: 0; top: 41%; z-index: 1; font-family: var(--head); font-weight: 700; font-size: 12px; letter-spacing: 0.2em; color: var(--ink); text-align: center; }
.vinyl .hole { position: absolute; inset: 48.5%; background: var(--bg); border-radius: 50%; z-index: 3; }
.vinyl img { position: absolute; inset: 36%; width: 28%; height: 28%; border-radius: 50%; object-fit: cover; z-index: 2; }
.vinyl.spin { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cardno { font-family: 'Space Mono', monospace; color: var(--gold); letter-spacing: 0.14em; font-size: 13px; }
.prog { height: 4px; background: var(--line); overflow: hidden; margin: 6px auto 20px; max-width: 290px; }
.prog i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.25s linear; }

.reveal { animation: pop 0.3s var(--ease); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.year { font-family: var(--head); font-weight: 700; font-size: 96px; line-height: 1; color: var(--gold); letter-spacing: 0.04em; margin: 4px 0 10px; }
.song-t { font-family: var(--head); font-size: 24px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.song-a { color: var(--text2); font-size: 16px; margin-bottom: 20px; }

.timeline { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline .y { background: var(--raise); padding: 6px 10px; font-family: 'Space Mono', monospace; font-size: 15px; color: var(--gold-hi); clip-path: var(--fase-r); box-shadow: inset 0 -2px 0 var(--line2); }
.timeline .y small { display: block; font-family: 'Barlow', sans-serif; font-size: 11px; color: var(--muted); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Scanner ---------- */
.scan { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; }
.scan video { flex: 1; width: 100%; object-fit: cover; }
.scan .frame { position: absolute; left: 50%; top: 45%; width: min(70vw, 320px); aspect-ratio: 1; transform: translate(-50%, -50%); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  background-image: linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold));
  background-repeat: no-repeat;
  background-size: 36px 3px, 3px 36px, 36px 3px, 3px 36px, 36px 3px, 3px 36px, 36px 3px, 3px 36px;
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom; }
.scan .bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.scan .bar button { background: rgba(10, 11, 13, 0.85); }
.scan .hint { position: absolute; top: calc(22px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; font-family: var(--head); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 14px; color: var(--gold-hi); text-shadow: 0 2px 8px #000; }

/* ---------- Verwaltung ---------- */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; box-shadow: none; clip-path: none; padding: 11px 16px; color: var(--text2); white-space: nowrap; }
.tabs button:hover { background: var(--raise); box-shadow: none; color: var(--text); }
.tabs button.on { color: var(--gold-hi); box-shadow: inset 0 -2px 0 var(--gold); }
.songlist .it { display: grid; grid-template-columns: 56px 44px 1fr 76px 42px; gap: 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.songlist .it:hover { background: var(--raise); box-shadow: inset 3px 0 0 var(--gold); }
.songlist .it img, .songlist .it .ph { width: 44px; height: 44px; object-fit: cover; background: var(--raise); display: block; clip-path: var(--fase); }
.songlist .it .no { font-family: 'Space Mono', monospace; text-align: center; padding: 8px 4px; color: var(--gold-hi); }
.songlist .it .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.songlist .it .a { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.songlist .it input { padding: 8px 6px; text-align: center; font-family: 'Space Mono', monospace; }
.results .r { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); }
.results .r:hover { background: var(--raise); box-shadow: inset 3px 0 0 var(--gold); }
.results .r img { width: 52px; height: 52px; object-fit: cover; clip-path: var(--fase); cursor: pointer; }
.results .r .t { font-weight: 700; }
.badge { display: inline-block; font-family: var(--head); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; padding: 2px 7px; background: var(--gold-bg); color: var(--gold); margin-left: 6px; vertical-align: 2px; clip-path: var(--fase-r); }
.preview-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-cards img { width: 100%; display: block; border: 1px solid var(--line); }
.steps { padding-left: 0; margin: 8px 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 0; font-family: 'Space Mono', monospace; font-size: 13px; color: var(--gold); }
.steps li + li { margin-top: 8px; }
.barwrap { height: 6px; background: var(--line); overflow: hidden; }
.barwrap i { display: block; height: 100%; background: var(--gold); width: 0; transition: width 0.3s; }
details summary { cursor: pointer; }

/* ---------- Meldungen / Fenster ---------- */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 12px 18px; opacity: 0; pointer-events: none; transition: 0.25s var(--ease); z-index: 99; max-width: 90vw; font-weight: 600; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { border-left-color: var(--bad); }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal .box { background-color: var(--card); border-top: 2px solid var(--gold); padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px; max-height: 90dvh; overflow: auto; }
@media (min-width: 700px) { .modal { align-items: center; } .modal .box { border: 1px solid var(--line); border-top: 2px solid var(--gold); } }
@media (prefers-reduced-motion: reduce) { .vinyl.spin, .fx-press, .reveal { animation: none; } }
