/* ==========================================================
   Arcade: Spieleübersicht, Spielbühne, HUD, Overlays
   ========================================================== */
.arcade-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center;
  padding: 30px; border-radius: var(--r-xl); margin-bottom: 20px;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.arcade-hero h2 { font-size: clamp(28px, 3.4vw, 38px); }
.arcade-hero p { color: var(--text-2); margin-top: 8px; max-width: 520px; }
.arcade-stats { display: flex; gap: 12px; position: relative; z-index: 1; }
.arcade-stats div { padding: 14px 18px; border-radius: 16px; background: var(--inset); border: 1px solid var(--border); text-align: center; min-width: 100px; }
.arcade-stats b { display: block; font: 600 26px/1 var(--font-display); font-variant-numeric: lining-nums; }
.arcade-stats small { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
@media (max-width: 700px) { .arcade-hero { grid-template-columns: 1fr; padding: 22px; } .arcade-stats div { flex: 1; min-width: 0; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.game-card {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; text-decoration: none;
  border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--card); color: var(--text); box-shadow: var(--shadow);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.game-card:active { transform: scale(.98); }
.game-cover {
  position: relative; height: 118px; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--c1) 9%, var(--inset));
  border-bottom: 1px solid var(--border);
}
.game-cover::before {
  content: ""; position: absolute; width: 96px; height: 96px; border-radius: 50%;
  background: color-mix(in srgb, var(--c1) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--c1) 18%, var(--border));
}
.game-cover .glyph { position: relative; font-size: 46px; filter: saturate(.55); transition: transform .3s var(--ease); }
.game-cover .num { position: absolute; top: 10px; left: 12px; font: 600 11px/1 var(--font-mono); color: var(--text-3); }
.game-cover .play { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.game-info { padding: 14px 16px 16px; display: grid; gap: 4px; }
.game-info b { font: 600 17px/1.2 var(--font-display); }
.game-info small { color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.game-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.game-meta .chip { height: 24px; font-size: 11px; padding: 0 9px; }
@media (hover: hover) {
  .game-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
  .game-card:hover .glyph { transform: scale(1.08) rotate(-4deg); }
}

/* ---------- Spielbühne (dunkel, damit die Spiele gut lesbar bleiben) ---------- */
kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--card); border: 1px solid var(--border-strong); border-bottom-width: 2px; color: var(--text-2); }
.stage {
  /* eigene, dunkle Farbwerte nur innerhalb der Spielfläche */
  --text: #f1ece2; --text-2: #c4bcae; --text-3: #8f887c;
  --card: #2e2b27; --inset: rgba(255, 255, 255, .06); --surface-2: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .1); --border-strong: rgba(255, 255, 255, .18);
  --accent: #efe8dc; --on-accent: #2d2a26; --grad-soft: rgba(255, 255, 255, .08);
  position: relative; margin: 0 auto; border-radius: 22px; overflow: hidden; background: #1f1d1a; color: var(--text);
  border: 6px solid var(--bg-raised); outline: 1px solid rgba(140, 128, 110, .45); box-shadow: var(--shadow-lg);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.stage canvas { width: 100%; height: 100%; touch-action: none; filter: saturate(.5) sepia(.12); }
.stage kbd { background: rgba(255, 255, 255, .08); }
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 12px; pointer-events: none; z-index: 2; }
.hud-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; background: rgba(31, 29, 26, .7); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 13px; font-weight: 600; }
.hud-pill small { color: var(--text-3); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.hud-pill.score b { font: 600 15px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.hud-pill.combo { color: #e2c48e; }
.hud-btns { margin-left: auto; display: flex; gap: 8px; pointer-events: auto; }
.hud-btns button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); background: rgba(31, 29, 26, .7); color: var(--text-2); display: grid; place-items: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hud-btns .i { width: 17px; height: 17px; }
.vol-pop { position: absolute; top: 58px; right: 12px; z-index: 5; width: min(300px, calc(100% - 24px)); padding: 8px 14px 8px 6px; border-radius: 16px; background: rgba(31, 29, 26, .92); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fade-up .2s var(--ease); pointer-events: auto; }
.vol { display: flex; align-items: center; gap: 8px; }
.vol .range { flex: 1; }
.vol b { width: 42px; text-align: right; font-size: 13px; color: var(--text-2); }

.overlay {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px;
  background: rgba(31, 29, 26, .82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade-in .25s;
}
.overlay-box { text-align: center; display: grid; justify-items: center; gap: 10px; max-width: 440px; }
.overlay-box .glyph { font-size: 54px; filter: saturate(.6); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.overlay-box h2 { font-size: clamp(28px, 4vw, 40px); }
.overlay-box p { color: var(--text-2); font-size: 14.5px; }
.overlay-box .big-score { font: 600 clamp(46px, 7vw, 66px)/1 var(--font-display); font-variant-numeric: lining-nums; }
.overlay-box .record { animation: pulse 1s infinite; }
.overlay-box .row { margin-top: 8px; justify-content: center; }
.overlay-box .keys { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 12.5px; color: var(--text-3); align-items: center; }
.overlay-box .btn { height: 50px; padding: 0 24px; font-size: 15.5px; }
.board { width: min(320px, 100%); display: grid; gap: 4px; margin-top: 6px; }
.board div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.board div.me { background: rgba(255, 255, 255, .12); }
.board span:first-child { color: var(--text-3); width: 22px; }
.board span:nth-child(2) { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.banner {
  position: absolute; left: 50%; top: 42%; z-index: 2; transform: translate(-50%, -50%); pointer-events: none; text-align: center;
  font: 600 clamp(30px, 5vw, 48px)/1 var(--font-display); color: #f1ece2; text-shadow: 0 2px 20px rgba(0, 0, 0, .5);
  animation: banner 1.6s var(--ease) forwards;
}
.banner small { display: block; font: 600 13.5px/1.4 var(--font); letter-spacing: .1em; text-transform: uppercase; color: #c4bcae; margin-top: 8px; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }

.touch-pad { display: none; position: absolute; z-index: 2; bottom: 14px; left: 14px; right: 14px; justify-content: space-between; pointer-events: none; }
.touch-pad .grp { display: flex; gap: 12px; pointer-events: auto; }
.touch-pad button { width: 66px; height: 66px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .1); color: #f1ece2; font-size: 22px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: none; }
.touch-pad button:active, .touch-pad button.down { background: rgba(255, 255, 255, .28); }
@media (pointer: coarse) { .touch-pad.on { display: flex; } }

/* ==========================================================
   Plyon – Spielbildschirm
   Immer dunkel (data-theme="dark" an der Ebene), damit die
   Spielfläche in beiden Modi gut lesbar ist.
   Aufbau:  Kopfzeile (HUD)  /  [Knöpfe] Spielfläche [Knöpfe]
   ========================================================== */
.game-layer {
  position: fixed; inset: 0; z-index: 500; background: #141210; color: var(--text);
  touch-action: none; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
body.game-open { overflow: hidden; position: fixed; inset: 0; width: 100%; }
.gs { display: flex; flex-direction: column; height: 100%; }

/* ---------- Kopfzeile ---------- */
.gs-top {
  flex: none; display: flex; align-items: center; gap: 8px; min-height: 60px;
  padding: calc(6px + var(--sat)) calc(10px + var(--sar)) 6px calc(10px + var(--sal));
  background: #1d1b18; border-bottom: 1px solid #2f2b26;
}
body.has-panic .gs-top { padding-right: calc(var(--panic-space) + var(--sar)); }
.gs-ico {
  width: 46px; height: 46px; flex: none; border-radius: 12px; border: 0; cursor: pointer;
  background: #2b2723; color: var(--text); display: grid; place-items: center;
}
.gs-ico:disabled { opacity: .35; }
.gs-ico:active { background: #3a352f; }
.gs-title { flex: 1; min-width: 0; position: relative; height: 46px; display: flex; align-items: center; }
.gs-name, .gs-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 16px; transition: opacity .25s, transform .25s; }
.gs-msg { position: absolute; inset: 0; display: flex; align-items: center; color: #f0c75e; opacity: 0; transform: translateY(6px); }
.gs.flash .gs-msg { opacity: 1; transform: none; }
.gs.flash .gs-name { opacity: 0; }
.gs-hud { display: flex; gap: 6px; flex: none; }
.gs-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; height: 46px; padding: 0 8px; border-radius: 12px; background: #24211d; }
.gs-stat small { font-size: 10.5px; color: #9a8f80; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; line-height: 1.1; }
.gs-stat b { font-size: 17px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.gs-lives { color: #e4684f; letter-spacing: 1px; }
@media (max-width: 700px) { .hide-narrow { display: none; } .gs-stat { min-width: 48px; padding: 0 6px; } .gs-name { font-size: 14.5px; } }

/* ---------- Spielfläche & Knöpfe ---------- */
.gs-body { flex: 1; min-height: 0; display: grid; grid-template: "stage" minmax(0, 1fr) / minmax(0, 1fr); padding: 0 var(--sar) var(--sab) var(--sal); }
.gs-stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; }
.gs-stage canvas { position: absolute; left: 0; top: 0; display: block; touch-action: none; }

.gs.has-pads[data-orient="land"] .gs-body { grid-template: "l stage r" minmax(0, 1fr) / minmax(176px, 210px) minmax(0, 1fr) minmax(176px, 210px); }
.gs.has-pads[data-orient="port"] .gs-body { grid-template: "stage stage" minmax(0, 1fr) "l r" auto / minmax(0, 1fr) minmax(0, 1fr); }
.gs-pad-l { grid-area: l; } .gs-pad-r { grid-area: r; }
.gs-pad {
  display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-end; justify-content: center; align-items: flex-end;
  padding: 12px 10px 18px; touch-action: none; transition: opacity .2s;
}
.gs[data-orient="port"] .gs-pad { align-content: center; padding: 12px 14px 16px; }
.gs[data-orient="port"] .gs-pad-l { justify-content: flex-start; }
.gs[data-orient="port"] .gs-pad-r { justify-content: flex-end; }
.gs:not(.playing) .gs-pad { opacity: .35; pointer-events: none; }
.gs-btn {
  width: calc(82px * var(--gsb, 1)); height: calc(82px * var(--gsb, 1)); border-radius: calc(24px * var(--gsb, 1)); flex: none; cursor: pointer; touch-action: none;
  border: 2px solid rgba(239, 230, 214, .2); background: rgba(239, 230, 214, .07); color: var(--text);
  font: 700 calc(26px * var(--gsb, 1))/1 var(--font); display: grid; place-items: center; padding: 0;
  transition: background .06s, transform .06s;
}
.gs-btn.wide { width: calc(120px * var(--gsb, 1)); font-size: calc(17px * var(--gsb, 1)); }
.gs-btn.on { background: #efe6d6; color: #1c1a17; transform: scale(.95); border-color: #efe6d6; }
@media (max-height: 700px) and (orientation: landscape) { .gs-btn { width: calc(72px * var(--gsb, 1)); height: calc(72px * var(--gsb, 1)); } .gs-btn.wide { width: calc(104px * var(--gsb, 1)); } }

/* Eigene Anordnung der Knöpfe (frei verschoben) */
.gs.custom-pads .gs-body { position: relative; }
.gs.custom-pads .gs-btn { position: absolute; z-index: 3; transform: translate(-50%, -50%); }
.gs.custom-pads .gs-btn.on { transform: translate(-50%, -50%) scale(.95); }
.gs.edit-pads .gs-pad { opacity: 1; pointer-events: auto; }
.gs.edit-pads .gs-btn { cursor: grab; outline: 2px dashed rgba(239, 230, 214, .55); outline-offset: 4px; }
.gs.edit-pads .gs-btn.drag { cursor: grabbing; background: rgba(239, 230, 214, .22); }
.gs-edit-bar { position: absolute; z-index: 6; left: 50%; top: calc(64px + var(--sat)); transform: translateX(-50%); width: min(460px, calc(100% - 24px));
  display: grid; gap: 10px; padding: 12px 14px; border-radius: 16px; background: rgba(31, 29, 26, .94); border: 1px solid rgba(255, 255, 255, .14); color: var(--text); }
.gs-edit-bar .row { display: flex; align-items: center; gap: 10px; }
.gs-edit-bar .row .btn { flex: 1; }
.gs-pads-btn { margin: 12px auto 0; display: flex; }

/* ---------- Overlays (nur über der Spielfläche) ---------- */
.gs-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 18, 16, .78); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 2; }
.gs-overlay.show { display: flex; }
.gs-ov-box { width: min(460px, 100%); max-height: 100%; overflow-y: auto; text-align: center; padding: 18px 8px; touch-action: pan-y; overscroll-behavior: contain; }
.gs-ov-box h2 { font-size: 30px; margin-bottom: 6px; }
.gs-ov-box p { color: #c9bda9; margin: 6px 0; }
.gs-ov-icon { font-size: 54px; line-height: 1.1; margin-bottom: 6px; }
.gs-genre { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: #8f8576 !important; }
.gs-how { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: #26231f; border-radius: 12px; padding: 10px 12px; margin: 12px 0; font-size: 15px; color: #e3d9c8; }
.gs-how .i { margin-top: 3px; }
.gs-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; text-align: left; font-size: 14px; color: #c9bda9; margin: 0 auto 10px; max-width: 320px; align-items: center; }
.gs-key { min-width: 40px; height: 32px; border-radius: 8px; border: 1px solid #4a443d; display: grid; place-items: center; font-weight: 700; color: var(--text); padding: 0 8px; }
.gs-ov-stats { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 14px; color: #9a8f80; margin: 8px 0 14px; }
.gs-ov-stats b { color: var(--text); }
.gs-ov-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 300px; margin: 14px auto 0; }
.gs-big { font: 600 60px/1.05 var(--font-display); margin: 6px 0; }
.gs-sub { font-size: 15px; }
.gs-board { display: flex; flex-direction: column; gap: 4px; max-width: 320px; margin: 10px auto 0; text-align: left; }
.gs-board:empty { display: none; }
.gs-brow { display: flex; gap: 10px; padding: 6px 10px; border-radius: 8px; background: #24211d; font-size: 14.5px; }
.gs-brow.me { background: #efe6d6; color: #1c1a17; }

/* ---------- Lautstärke-Popover ---------- */
.gs-vol {
  position: absolute; z-index: 5; top: calc(64px + var(--sat)); right: calc(12px + var(--sar));
  width: min(300px, calc(100% - 24px)); padding: 14px 16px; border-radius: 16px;
  background: #2b2723; border: 1px solid #3d3832; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); touch-action: pan-x;
}
body.has-panic .gs-vol { right: calc(var(--panic-space) + var(--sar)); }
.gs-mute { margin-top: 4px; }

/* ---------- Arcade: Ergänzungen (Anpinnen, Favoriten, Mitbewegen) ---------- */
.game-layer {
  --text: #f1ece2; --text-2: #c4bcae; --text-3: #8f887c;
  --card: #2e2b27; --inset: rgba(255, 255, 255, .06); --surface-2: rgba(255, 255, 255, .08); --surface-3: rgba(255, 255, 255, .14);
  --border: rgba(255, 255, 255, .1); --border-strong: rgba(255, 255, 255, .18);
  --accent: #efe6d6; --on-accent: #2d2a26;
}
.game-grid { perspective: 900px; }
.game-card { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; will-change: transform; }
.game-cover { background: radial-gradient(circle at var(--mx, 50%) var(--my, 40%), color-mix(in srgb, var(--c2) 22%, transparent), transparent 70%), color-mix(in srgb, var(--c1) 16%, var(--inset)); }
.game-cover::before { background: color-mix(in srgb, var(--c1) 24%, var(--card)); border-color: color-mix(in srgb, var(--c1) 30%, var(--border)); }
.game-cover .glyph { filter: saturate(.85); }
.gc-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.game-info { flex: 1; grid-template-rows: auto auto auto 1fr; }
.game-info .gc-tools { align-self: end; }
.gi-desc { margin: 0 0 6px; line-height: 1.5; }
.gi-how { margin: 0 0 8px; line-height: 1.5; color: var(--text-2); }
.gi-keys { margin: 4px 0 8px; max-width: none; color: var(--text-2); }
.gi-keys .gs-key { border-color: var(--border-strong); }
.gi-notes { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--text-2); }
.gi-notes b { color: var(--text); margin-right: 4px; }
.gi-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.gc-tool { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: color-mix(in srgb, var(--card) 85%, transparent); color: var(--text-3); padding: 0; transition: transform .15s, color .15s; }
.gc-tool.on { color: var(--text); border-color: var(--border-strong); }
.gc-tool.on.fav { color: #e0526a; }
.gc-tool.on.fav .i { fill: currentColor; }
.gc-tool:active { transform: scale(.9); }
.arcade-sec { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); margin: 6px 0 12px; }
.game-grid.pinned { margin-bottom: 24px; }
.tiny-chip { height: 20px; font-size: 10.5px; padding: 0 7px; vertical-align: 2px; }
@media (hover: hover) {
  .game-card:hover { transform: translateY(-3px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
  .gc-tool:hover { color: var(--text); transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .game-card { transform: none !important; } }

/* ---------- Bestenliste-Dialog ---------- */
.lb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lb-head .glyph { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--c1) 22%, var(--card)); flex: none; }
.lb-head b { display: block; font-family: var(--font-display); font-size: 19px; }
.lb-head small { color: var(--text-3); font-size: 12.5px; }
.lb-me { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lb-me > div { padding: 10px 12px; border-radius: 12px; background: var(--inset); }
.lb-me small { display: block; font-size: 11.5px; color: var(--text-3); }
.lb-me b { font-size: 18px; }
.lb-sec { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); margin: 18px 0 8px; }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lb-list li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; }
.lb-list li.me { background: var(--inset); outline: 1px solid var(--border-strong); }
.lb-rank { width: 26px; text-align: center; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Demo: gesperrtes Spiel */
.game-card.locked .glyph { filter: grayscale(1) blur(1px); opacity: .45; }
.game-card.locked .lock-badge { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; color: #fff; background: rgba(0, 0, 0, .35); font-weight: 600; }
.game-card.locked .lock-badge svg { width: 34px; height: 34px; }
.game-card.locked .lock-badge small { font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, .45); }
.pin-tile.locked { opacity: .5; }
