/* ==========================================================================
   Fliply — styling
   Mørkt arkadeudseende med et LCD-bagglas i ægte 80'er-Casio-stil:
   grøngrå glasplade med mørke 7-segment-tal og svage "spøgelses"-segmenter.
   ========================================================================== */

:root {
  --arcade: #0d0a1e;
  --arcade-hi: #1d1440;
  --frame: #17112e;
  --frame-hi: #3a2a55;
  --neon: #4de3ff;
  --pink: #ff4d8d;
  --amber: #f0a63c;
  --amber-hi: #ffc96b;
  --amber-lo: #b8761d;

  --cream: #fff8ea;
  --cream-dim: #f2e7d2;
  --navy: #22303c;
  --ink: #3a2c1e;
  --ink-soft: #6b5a45;
  --teal: #3f7f8c;
  --red: #c94f3f;

  --lcd-bg: #9fb09a;
  --lcd-bg-hi: #b9c8b2;
  --lcd-seg: #21281f;
  --lcd-ghost: rgba(33, 40, 31, .10);
  --lcd-frame: #2a2a2e;

  --ui: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --shadow-lg: 0 26px 60px -18px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--ui);
  color: var(--cream);
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(120, 80, 255, .22), rgba(120, 80, 255, 0) 60%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 42px),
    var(--arcade);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.sprite-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico { width: 1em; height: 1em; display: block; flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   LCD-bagglas
   -------------------------------------------------------------------------- */
.hud {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 10px 10px 6px;
  z-index: 5;
}

.lcd {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 26px);
  padding: 10px clamp(12px, 2.4vw, 22px);
  border-radius: 14px;
  border: 4px solid var(--lcd-frame);
  background: linear-gradient(180deg, var(--lcd-bg-hi), var(--lcd-bg));
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, .35),
    inset 0 -1px 0 rgba(255, 255, 255, .35),
    0 8px 22px rgba(0, 0, 0, .55);
  color: var(--lcd-seg);
}
.lcd::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(115deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 42%);
  pointer-events: none;
}

.lcd-label {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(33, 40, 31, .72);
}

.lcd-main { display: flex; flex-direction: column; gap: 4px; }
.lcd-side { display: flex; flex-direction: column; gap: 5px; }
.lcd-row { display: flex; align-items: center; gap: 8px; }
.lcd-digits { display: inline-flex; gap: 5px; }

/* --- 7-segment-tal ------------------------------------------------------- */
.seg7 { position: relative; width: 25px; height: 44px; display: block; }
.seg7--sm { width: 15px; height: 26px; }
.seg7 i { position: absolute; background: var(--lcd-ghost); border-radius: 2px; }
.seg7 i.on { background: var(--lcd-seg); box-shadow: 0 0 3px rgba(33, 40, 31, .55); }
.seg7 .sa { left: 15%; top: 0; width: 70%; height: 9%; }
.seg7 .sb { left: 86%; top: 3%; width: 14%; height: 43%; }
.seg7 .sc { left: 86%; top: 54%; width: 14%; height: 43%; }
.seg7 .sd { left: 15%; top: 91%; width: 70%; height: 9%; }
.seg7 .se { left: 0; top: 54%; width: 14%; height: 43%; }
.seg7 .sf { left: 0; top: 3%; width: 14%; height: 43%; }
.seg7 .sg { left: 12%; top: 45.5%; width: 76%; height: 9%; }

/* --- segmentbar og lamper ------------------------------------------------ */
.lcdbar { display: inline-flex; gap: 3px; }
.lcdbar i { width: 9px; height: 15px; border-radius: 2px; background: var(--lcd-ghost); }
.lcdbar i.on { background: var(--lcd-seg); }

.lamps { gap: 6px; }
.lamp {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .1em;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(33, 40, 31, .12);
  color: rgba(33, 40, 31, .45);
  transition: background .12s, color .12s, box-shadow .12s;
}
.lamp.on { background: var(--pink); color: #fff; box-shadow: 0 0 10px rgba(255, 77, 141, .85); }
.lamp--save.on { background: #8affc1; color: #14301f; box-shadow: 0 0 10px rgba(138, 255, 193, .85); }

.lcd-btns { display: flex; flex-direction: column; gap: 6px; }
.iconbtn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 2px solid var(--lcd-frame);
  background: rgba(33, 40, 31, .16);
  color: var(--lcd-seg);
  font-size: 14px;
  cursor: pointer;
}
.iconbtn:active { transform: translateY(1px); }
#btn-mute .ic-mute { display: none; }
#btn-mute.muted .ic-sound { display: none; }
#btn-mute.muted .ic-mute { display: block; }

/* --------------------------------------------------------------------------
   Bordet
   -------------------------------------------------------------------------- */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 4px 10px 8px;
}

.table-wrap {
  position: relative;
  height: 100%;
  aspect-ratio: 500 / 920;
  max-width: 100%;
  margin-inline: auto;
  border-radius: 30px;
  border: 10px solid var(--frame);
  outline: 3px solid var(--frame-hi);
  box-shadow:
    0 0 44px rgba(120, 80, 255, .35),
    0 24px 60px rgba(0, 0, 0, .6);
  background: #0b0820;
  overflow: hidden;
}

#scene { display: block; width: 100%; height: 100%; touch-action: none; }

/* --------------------------------------------------------------------------
   Level-banner
   -------------------------------------------------------------------------- */
.banner {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.banner.on { opacity: 1; }
.banner-in {
  padding: 14px 44px;
  border-radius: 20px;
  background: rgba(20, 12, 44, .82);
  border: 2px solid var(--neon);
  box-shadow: 0 0 34px rgba(77, 227, 255, .45);
}
.banner.on .banner-in { animation: banner-pop .5s cubic-bezier(.2, 1.5, .4, 1) both; }
.banner-in b {
  font-size: clamp(26px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: .08em;
  color: var(--neon);
  text-shadow: 0 0 18px rgba(77, 227, 255, .8);
}

@keyframes banner-pop {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Skærme og paneler
   -------------------------------------------------------------------------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 32px);
  overflow: auto;
  background: rgba(8, 5, 20, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.screen.on { opacity: 1; pointer-events: auto; }

.panel {
  width: min(680px, 100%);
  padding: clamp(18px, 3vw, 34px) clamp(16px, 3.4vw, 40px);
  border-radius: 28px;
  border: 3px solid var(--navy);
  background: linear-gradient(178deg, #fffdf6 0%, var(--cream) 55%, var(--cream-dim) 100%);
  box-shadow: var(--shadow-lg), 0 6px 0 rgba(0, 0, 0, .25);
  text-align: center;
  color: var(--ink);
}
.panel--small { width: min(460px, 100%); }

.kicker {
  margin: 0 0 4px;
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--teal);
}

.title {
  margin: 0 0 6px;
  font-size: clamp(44px, 8.5vw, 92px);
  line-height: .95;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--pink);
  text-shadow:
    0 3px 0 var(--navy),
    0 6px 0 rgba(34, 48, 60, .5),
    0 14px 26px rgba(10, 24, 36, .35);
}
.title--small { font-size: clamp(30px, 5vw, 48px); }

.tagline {
  margin: 0 auto 14px;
  max-width: 46ch;
  font-size: clamp(13px, 1.5vw, 16.5px);
  line-height: 1.5;
  color: var(--ink-soft);
}

.menu-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.4vw, 28px);
  margin: 14px 0 18px;
  text-align: left;
}
.menu-cols h2 {
  margin: 0 0 8px;
  font-size: clamp(11px, 1.2vw, 13px);
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red);
}
.menu-cols ul { margin: 0; padding: 0; list-style: none; }
.menu-cols li {
  margin: 0 0 8px;
  font-size: clamp(12px, 1.3vw, 14.5px);
  line-height: 1.45;
}
.score-list b {
  display: inline-block;
  min-width: 3.4em;
  color: var(--amber-lo);
  font-weight: 900;
}
.hint { margin: 6px 0 0; font-size: clamp(11px, 1.2vw, 13px); color: var(--ink-soft); }

.key {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 7px;
  border: 1.5px solid var(--navy);
  border-bottom-width: 3px;
  background: #fff;
  font-size: .86em;
  font-weight: 800;
  color: var(--navy);
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}
.menu-actions--col { flex-direction: column; align-items: stretch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .72em 1.35em;
  border-radius: 999px;
  border: 3px solid var(--navy);
  background: var(--cream);
  color: var(--navy);
  font: 800 clamp(13px, 1.4vw, 16px)/1 var(--ui);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(34, 48, 60, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(34, 48, 60, .35); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(34, 48, 60, .35); }
.btn--primary {
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  box-shadow: 0 4px 0 var(--amber-lo);
}
.btn--primary:hover { box-shadow: 0 6px 0 var(--amber-lo); }
.btn--lg { padding: .9em 1.8em; font-size: clamp(15px, 1.8vw, 20px); }

.menu-best {
  margin: 14px 0 0;
  font-size: clamp(11px, 1.2vw, 13.5px);
  font-style: italic;
  color: var(--ink-soft);
}

.statline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 4px 0 14px;
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 700;
  color: var(--ink-soft);
}
.statline b { color: var(--amber-lo); font-size: 1.2em; }

/* --------------------------------------------------------------------------
   Touch-knapper
   -------------------------------------------------------------------------- */
.touch {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: none;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  padding: 0 clamp(10px, 3vw, 26px) clamp(12px, 3vw, 24px);
  pointer-events: none;
}
.tbtn {
  pointer-events: auto;
  height: clamp(64px, 12vw, 86px);
  border-radius: 18px;
  border: 3px solid var(--frame);
  background: rgba(255, 248, 234, .92);
  color: var(--navy);
  font: 900 clamp(13px, 3.4vw, 18px)/1 var(--ui);
  letter-spacing: .06em;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .4);
  touch-action: none;
}
.tbtn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.tbtn--launch {
  width: clamp(84px, 22vw, 120px);
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
}

@media (pointer: coarse) {
  .touch { display: grid; }
  .foot { display: none; }
}

/* --------------------------------------------------------------------------
   Fod
   -------------------------------------------------------------------------- */
.foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 4px 12px 8px;
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 600;
  color: rgba(255, 252, 244, .55);
  text-align: center;
}
.foot-keys .key { background: rgba(255, 255, 255, .85); }

/* --------------------------------------------------------------------------
   Små skærme og reduceret bevægelse
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
  .menu-cols { grid-template-columns: 1fr; }
  .lcd { gap: 10px; padding: 8px 12px; }
  .seg7 { width: 19px; height: 34px; }
  .lcd-side .lcd-row:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .banner.on .banner-in { animation: none; }
  .btn, .iconbtn, .lamp, .screen, .banner { transition-duration: .01ms !important; }
}
