/* ============================================================
   ClassicCollection – modernes Arcade-Archiv
   Einheitliches Design-System (Dark / Neon / Glassmorphism)
   ============================================================ */

:root {
  --bg: #070a13;
  --bg2: #0c1122;
  --panel: rgba(20, 26, 48, 0.72);
  --panel-solid: #141a30;
  --line: rgba(148, 163, 255, 0.16);
  --txt: #eef1ff;
  --txt-dim: #9aa3c7;
  --txt-faint: #66709b;
  --ac: #22d3ee;
  --ac-soft: color-mix(in srgb, var(--ac) 14%, transparent);
  --ac-line: color-mix(in srgb, var(--ac) 45%, transparent);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 16px;
  --radius-s: 10px;
  --font-display: "Avenir Next Condensed", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-pop: 0 18px 50px rgba(2, 6, 18, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }

body {
  min-height: 100%;
  background:
    radial-gradient(1100px 700px at 85% -10%, color-mix(in srgb, var(--ac) 16%, transparent), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, #7c3aed 18%, transparent), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2) 55%, #05070e);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.in-game { overflow: hidden; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

a { color: var(--ac); }
button { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--ac) 35%, transparent); }

/* Klickbare Flächen ohne störende Marker */
button, [role="button"] { -webkit-tap-highlight-color: transparent; }

/* ---------- Launcher / Home ---------- */

.cc-home { max-width: 1240px; margin: 0 auto; padding: 26px 18px 80px; }

.brand {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: 8px;
}
.brand h1 {
  font-size: clamp(26px, 4.2vw, 46px);
  margin: 0;
  background: linear-gradient(90deg, var(--ac), #a78bfa 55%, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px color-mix(in srgb, var(--ac) 35%, transparent));
}
.brand .brand-logo {
  height: clamp(40px, 7.2vw, 74px);
  width: auto;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 2px 16px color-mix(in srgb, var(--ac) 28%, transparent));
}
.brand .sub { color: var(--txt-dim); font-size: clamp(14px, 1.6vw, 17px); font-weight: 600; letter-spacing: 0.04em; margin-top: 2px; }

.hero {
  margin: 6px 0 26px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  backdrop-filter: blur(6px);
}
.hero p { margin: 0 0 10px; color: var(--txt-dim); max-width: 860px; }
.hero p b { color: var(--txt); }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stat {
  font-family: var(--font-display); font-size: 13px; letter-spacing: 0.05em;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03);
  color: var(--txt-dim);
}
.stat b { color: var(--ac); }

/* Filter-Leiste */
.toolbar {
  position: sticky; top: 0; z-index: 30;
  padding: 10px 0 12px; margin-bottom: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, transparent) 55%, transparent);
  backdrop-filter: blur(8px);
}
.searchrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.search {
  flex: 1 1 260px; min-width: 220px;
  padding: 12px 16px; font-size: 16px; color: var(--txt);
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 999px; outline: none;
  font-family: var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus { border-color: var(--ac-line); box-shadow: 0 0 0 3px var(--ac-soft); }
.search::placeholder { color: var(--txt-faint); }

.sortbox { display: flex; align-items: center; gap: 8px; color: var(--txt-dim); font-weight: 600; }
.sortbox select {
  background: rgba(255,255,255,0.06); color: var(--txt);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 14px; font-size: 15px; outline: none;
  font-family: var(--font-body); font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  color: var(--txt-dim); padding: 8px 15px; border-radius: 999px;
  font-weight: 700; font-size: 14.5px; letter-spacing: 0.03em;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.chip small { opacity: 0.65; font-weight: 600; margin-left: 3px; }
.chip:hover { color: var(--txt); border-color: var(--ac-line); }
.chip.on {
  background: var(--ac-soft); color: var(--txt);
  border-color: var(--ac-line);
  box-shadow: 0 0 16px -4px var(--ac);
}
.chip.on small { color: var(--ac); opacity: 1; }

/* Spiel-Karten */
.count-line { margin: 18px 2px 10px; color: var(--txt-faint); font-weight: 600; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr));
  gap: 16px;
}
.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 100% 0%, var(--ac-soft), transparent 55%),
    linear-gradient(165deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02) 60%);
  padding: 16px 16px 13px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: cardIn 0.4s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } }
.card:hover { transform: translateY(-4px); border-color: var(--ac-line); box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--ac) 45%, transparent); }
.card:active { transform: translateY(-1px) scale(0.99); }
.card .glowbar {
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--ac), transparent);
  opacity: 0.75;
}
.card .topline { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card h3 {
  margin: 4px 0 2px; font-size: 17px; line-height: 1.25; color: var(--txt);
}
.card .orig { color: var(--txt-faint); font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.card .tagline { color: var(--txt-dim); font-size: 15px; margin: 4px 0 10px; flex: 1; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ac); border: 1px solid var(--ac-line);
  background: var(--ac-soft); border-radius: 999px; padding: 3px 10px;
}
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.diff { display: inline-flex; align-items: center; gap: 4px; color: var(--txt-faint); font-weight: 600; }
.diff i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: inline-block; }
.diff i.on { background: var(--ac); box-shadow: 0 0 6px var(--ac); }
.best { font-weight: 700; color: var(--txt-dim); font-size: 14px; }
.best b { color: var(--warn); font-family: var(--font-display); }
.star {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,0.04); color: var(--txt-faint);
  font-size: 16px; cursor: pointer; transition: all 0.15s;
}
.star:hover { border-color: var(--ac-line); color: var(--txt); }
.star.on { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); text-shadow: 0 0 8px var(--warn); }

.empty {
  grid-column: 1 / -1; text-align: center; color: var(--txt-faint);
  padding: 60px 10px; border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty b { color: var(--txt-dim); }

footer { margin-top: 44px; color: var(--txt-faint); font-size: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
footer p { margin: 4px 0; }

/* ---------- Spielansicht ---------- */

.gview {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  height: 100vh;            /* Sicherheitsnetz, falls `inset` nicht greift */
  min-height: 100vh;
  z-index: 50;
  display: flex; flex-direction: column;
  background: #04060d;
}
#view-game.gview[hidden] { display: none; }
.ghead {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(13, 17, 32, 0.96), rgba(13, 17, 32, 0.75));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  z-index: 60;
}
.ghead .titles { flex: 1; min-width: 150px; }
.ghead .titles .t { font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: 0.08em; color: var(--txt); text-transform: uppercase; }
.ghead .titles .o { font-size: 13px; color: var(--txt-faint); font-weight: 600; margin-top: -1px; }
.ghead .tools { display: flex; gap: 8px; }

.icon-btn {
  min-width: 40px; height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.05); color: var(--txt);
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: all 0.15s; user-select: none;
}
.icon-btn:hover { background: rgba(255,255,255,0.11); border-color: var(--ac-line); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.primary { background: var(--ac-soft); border-color: var(--ac-line); color: var(--ac); }
.icon-btn.muted-on { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

.stage {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.stage canvas {
  display: block; max-width: 100%; max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 0 60px -18px color-mix(in srgb, var(--ac) 55%, transparent);
  touch-action: none;
}
.stage.aim canvas { cursor: crosshair; }

/* Overlays über der Bühne */
.ov {
  position: absolute; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  background: rgba(4, 6, 14, 0.55);
  backdrop-filter: blur(2px);
  animation: ovIn 0.25s ease;
}
@keyframes ovIn { from { opacity: 0; } }
.ov-panel {
  width: min(620px, 96vw);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  border: 1px solid var(--ac-line);
  border-radius: 20px;
  background:
    radial-gradient(140% 90% at 110% -10%, var(--ac-soft), transparent 55%),
    linear-gradient(170deg, rgba(24, 30, 58, 0.96), rgba(12, 16, 33, 0.97));
  box-shadow: var(--shadow-pop), 0 0 0 1px rgba(0,0,0,0.4);
  padding: 24px 24px 20px;
  animation: panelIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes panelIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.ov-panel.center { text-align: center; }
.ov .kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ac); margin: 0 0 4px; }
.ov h2 { margin: 0 0 2px; font-size: clamp(24px, 4.6vw, 34px); line-height: 1.1; color: var(--txt); text-shadow: 0 0 22px var(--ac-soft); }
.ov .origin { color: var(--txt-dim); font-weight: 600; font-size: 15.5px; margin: 2px 0 14px; }
.ov .origin b { color: var(--txt); }
.ov .intro {
  text-align: left; color: var(--txt-dim); font-size: 15.5px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 12px 14px; margin: 4px 0 14px;
}
.ov .intro b { color: var(--ac); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .cols { grid-template-columns: 1fr; } }
.box {
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 12px 14px; text-align: left;
}
.box h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.2em; color: var(--txt-faint); text-transform: uppercase; font-family: var(--font-display); }
.box ul { margin: 0; padding-left: 17px; color: var(--txt-dim); font-size: 15px; }
.box ul li { margin: 4px 0; }
.box ul li b { color: var(--txt); }
.keychips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.kc {
  font-size: 13px; font-weight: 700; color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 9px; background: rgba(255,255,255,0.05);
}
.kc i { font-style: normal; color: var(--ac); }
.kc b { color: var(--txt-dim); font-weight: 600; }

.diffrow { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; flex-wrap: wrap; }
.diffrow > span { font-size: 12px; letter-spacing: 0.18em; color: var(--txt-faint); text-transform: uppercase; font-family: var(--font-display); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; color: var(--txt-dim);
  padding: 8px 16px; font-weight: 700; font-size: 14.5px; cursor: pointer;
  transition: all 0.15s;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ac-soft); color: var(--txt); box-shadow: inset 0 0 0 1px var(--ac-line); }

.hstable { width: 100%; border-collapse: collapse; font-size: 15.5px; text-align: left; margin-top: 4px; }
.hstable th { color: var(--txt-faint); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; padding: 4px 8px; border-bottom: 1px solid var(--line); font-family: var(--font-display); }
.hstable td { padding: 6px 8px; color: var(--txt-dim); border-bottom: 1px solid rgba(255,255,255,0.04); font-weight: 600; }
.hstable td.s { color: var(--txt); font-family: var(--font-display); }
.hstable tr.me td { color: var(--ac); }
.hstable tr.me td.s { color: var(--ac); text-shadow: 0 0 10px var(--ac-soft); }
.hstable tr.first td.s { color: var(--warn); }
.nohs { color: var(--txt-faint); font-size: 14px; text-align: center; padding: 12px; }

.btnrow { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 700; font-size: 15px;
  padding: 13px 26px; border-radius: 13px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: var(--txt);
  transition: all 0.15s; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.go {
  background: linear-gradient(135deg, var(--ac), color-mix(in srgb, var(--ac) 40%, #7c3aed));
  color: #04121a; border: 0; font-size: 17px; padding: 15px 40px;
  box-shadow: 0 10px 26px -8px var(--ac);
}
.btn.go:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--txt-dim); }
.btn.ghost:hover { color: var(--txt); border-color: var(--ac-line); }

.bigscore { font-family: var(--font-display); font-size: clamp(38px, 9vw, 62px); font-weight: 900; color: var(--txt); line-height: 1; margin: 4px 0 2px; text-shadow: 0 0 30px var(--ac-soft); }
.badgenew {
  display: inline-block; margin: 0 0 8px; padding: 6px 14px;
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent);
  color: var(--warn); border-radius: 999px; font-weight: 800;
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-display);
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse { 50% { filter: brightness(1.5); } }
.scoreline { color: var(--txt-dim); font-weight: 700; font-size: 15px; margin: 2px 0 10px; }

.nameform { display: flex; gap: 8px; justify-content: center; margin: 8px 0 2px; flex-wrap: wrap; }
.nameform input {
  background: rgba(255,255,255,0.07); border: 1px solid var(--line);
  color: var(--txt); font-size: 18px; font-weight: 700; text-align: center;
  padding: 11px 14px; border-radius: 12px; outline: none; width: 210px;
  font-family: var(--font-body); letter-spacing: 0.06em;
}
.nameform input:focus { border-color: var(--ac-line); box-shadow: 0 0 0 3px var(--ac-soft); }
.nameform button { padding: 12px 22px; }

.meta-note { font-size: 13.5px; color: var(--txt-faint); margin-top: 12px; font-weight: 600; }
.meta-note b { color: var(--txt-dim); }

/* Touch-Steuerung */
.touch-ui {
  position: absolute; inset: 0; z-index: 65; pointer-events: none;
  display: none;
}
.touch-ui.on { display: block; }
.dpad, .actbtns {
  position: absolute; bottom: max(16px, env(safe-area-inset-bottom));
  pointer-events: none; opacity: 0.92;
}
.dpad { left: max(14px, env(safe-area-inset-left)); width: 148px; height: 148px; }
.actbtns { right: max(14px, env(safe-area-inset-right)); bottom: 34px; display: flex; gap: 12px; align-items: flex-end; }
.tbtn {
  position: absolute; pointer-events: auto;
  width: 54px; height: 54px; border-radius: 16px;
  background: rgba(255,255,255,0.07); border: 1.5px solid var(--ac-line);
  color: var(--ac); font-size: 22px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; touch-action: none;
  backdrop-filter: blur(4px);
}
.tbtn:active, .tbtn.down { background: var(--ac-soft); box-shadow: 0 0 18px -2px var(--ac); }
.tbtn.big { width: 70px; height: 70px; border-radius: 50%; font-size: 15px; letter-spacing: 0.08em; font-family: var(--font-display); }
.tbtn.lbl { width: 42px; height: 42px; border-radius: 12px; font-size: 13px; font-family: var(--font-display); color: var(--txt-dim); }
.tbtn.lbl.on { color: var(--ac); background: var(--ac-soft); }
#pad-l { left: 0; top: 47px; } #pad-r { right: 0; top: 47px; }
#pad-u { left: 47px; top: 0; } #pad-d { left: 47px; bottom: 0; }

@media (pointer: coarse) { .ov-panel { width: min(600px, 98vw); } }

/* Lade- / Info-Hinweis */
.notice { position: fixed; inset: auto 0 0 0; text-align: center; padding: 8px; font-size: 13px; color: var(--txt-faint); background: rgba(4,6,14,0.85); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148,163,255,0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,255,0.4); }
