/* LUCKY DEFENDER, official LHT palette: gold, black, and grey. */

@font-face {
  font-family: "Bangers";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/bangers-400.woff2") format("woff2");
}

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fredoka.woff2") format("woff2");
}

:root {
  --navy: #08090d;
  --navy-2: #111216;
  --navy-3: #1e1e1e;
  --ink: #030406;
  --gold: #e8c047;
  --gold-soft: #ffd04d;
  --gold-deep: #c89f19;
  --teal: #dcab49;
  --teal-2: #f6e3a1;
  --teal-dim: #b08122;
  --purple: #7a6110;
  --purple-2: #d9ae20;
  --purple-deep: #212121;
  --cream: #e0e0e0;
  --muted: #a0a0a0;
  --danger: #ff6b6b;
  --danger-deep: #8f3a3a;
  --ok: #4caf50;
  --shadow: rgba(3, 4, 6, 0.55);
  --font-display: "Bangers", "Impact", "Haettenschweiler", "Arial Black", cursive;
  --font-ui: "Fredoka", "Segoe UI", "Trebuchet MS", sans-serif;
  --hud-h: 58px;
  --pad-h: 132px;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  height: -webkit-fill-available;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body {
  min-height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  top: var(--app-top, 0px);
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  height: 100svh;
  height: var(--app-h, 100svh);
  overscroll-behavior: none;
}

button, a, canvas, .title-card, .panel {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--teal-2); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 50;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

#app {
  width: 100%;
  height: 100%;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  height: 100svh;
  height: var(--app-h, 100svh);
  max-height: 100%;
  max-height: 100vh;
  max-height: -webkit-fill-available;
  max-height: 100dvh;
  max-height: 100svh;
  max-height: var(--app-h, 100svh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(122, 97, 16, 0.28), transparent 55%),
    radial-gradient(900px 500px at 100% 100%, rgba(220, 171, 73, 0.12), transparent 50%),
    var(--navy);
}

.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: var(--hud-h);
  padding: 8px 12px 8px max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(3, 4, 6, 0.72), rgba(8, 9, 13, 0.35));
  border-bottom: 1px solid rgba(234, 198, 82, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  line-height: 1;
}

.brand small {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0;
  font-weight: 500;
}

.hud-stats {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  min-width: 72px;
  background: rgba(17, 18, 22, 0.8);
  border: 1px solid rgba(245, 229, 176, 0.18);
  border-radius: 12px;
  padding: 4px 10px 6px;
  text-align: center;
}

.stat .label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-2);
}

.stat .value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--gold);
  line-height: 1.1;
}

.hud-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn {
  min-width: 48px;
  min-height: 48px;
  border-radius: 14px;
  background: rgba(17, 18, 22, 0.9);
  color: var(--cream);
  border: 1px solid rgba(234, 198, 82, 0.28);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0 12px;
}

.icon-btn:focus-visible,
.primary:focus-visible,
.secondary:focus-visible,
.choice:focus-visible,
.pad-btn:focus-visible,
.fire-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.stage {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  margin: 0 10px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(234, 198, 82, 0.22);
  box-shadow: 0 12px 40px var(--shadow);
  background: #06070a;
}

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

.overlay, .modal {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay { z-index: 4; }
.modal { z-index: 5; }

.overlay.hidden, .modal.hidden { display: none; }

#title-screen {
  justify-content: flex-end;
  background:
    linear-gradient(180deg, rgba(3, 4, 6, 0.18) 0%, rgba(3, 4, 6, 0.08) 38%, rgba(3, 4, 6, 0.88) 100%),
    url("../images/title-hero.jpg") center 20% / cover no-repeat;
}
@media (min-width: 780px) {
  #title-screen {
    justify-content: flex-end;
    align-items: flex-start;
    padding: 24px 28px 28px;
  }
  #title-screen .title-card {
    width: min(520px, 48%);
    margin: 0;
  }
}

.title-card, .panel {
  width: min(560px, 100%);
  margin: 0 auto;
  background: rgba(8, 9, 13, 0.88);
  border: 1px solid rgba(234, 198, 82, 0.28);
  border-radius: 20px;
  padding: 18px 18px 16px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.kicker {
  color: var(--teal-2);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
  margin: 0 0 6px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 9vw, 4.2rem);
  color: var(--gold);
  letter-spacing: 0.03em;
  margin: 0 0 6px;
  line-height: 0.95;
  text-shadow: 0 3px 0 #030406, 0 8px 18px rgba(0, 0, 0, 0.35);
}

.subtitle {
  margin: 0 0 14px;
  font-size: 1.15rem;
  color: var(--cream);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 10px;
}

.primary, .secondary {
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 1.12rem;
  font-weight: 700;
}

.primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold) 45%, var(--gold-deep));
  color: var(--ink);
  box-shadow: 0 4px 0 #896d11;
}

.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #896d11; }

.secondary {
  background: transparent;
  color: var(--cream);
  border: 2px solid rgba(245, 229, 176, 0.45);
}

.fine {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.fine a { color: var(--gold-soft); }

.eggs {
  margin: 10px 0 0;
  color: rgba(234, 198, 82, 0.45);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.modal {
  background: rgba(3, 4, 6, 0.62);
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  color: var(--gold);
  margin: 0 0 8px;
  letter-spacing: 0.03em;
  line-height: 1.05;
}

.panel p { margin: 0 0 12px; }

.howto-list {
  margin: 0 0 14px;
  padding-left: 1.15em;
}

.howto-list li { margin: 0 0 8px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 18, 22, 0.9);
  border: 1px solid rgba(245, 229, 176, 0.2);
  font-size: 0.92rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot.gold { background: var(--gold); }
.dot.red { background: var(--danger); }
.dot.purple { background: var(--purple-2); }

.fact-token {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(234, 198, 82, 0.14);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.fact-token.bad {
  background: rgba(232, 93, 76, 0.16);
  color: #ffb4b4;
}

.source {
  display: inline-block;
  margin: 0 0 14px;
  font-size: 0.95rem;
}

#choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}

.choice {
  text-align: left;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(17, 18, 22, 0.95);
  color: var(--cream);
  border: 2px solid rgba(245, 229, 176, 0.28);
  font-size: 1.05rem;
  font-weight: 600;
}

.choice[disabled] { cursor: default; }

.choice.is-correct {
  border-color: var(--ok);
  background: rgba(61, 206, 138, 0.16);
}

.choice.is-wrong {
  border-color: var(--danger);
  background: rgba(232, 93, 76, 0.16);
}

.explain {
  background: rgba(17, 18, 22, 0.8);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.big-score {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--gold);
  line-height: 1;
  margin: 4px 0 8px;
}

.toast {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 6;
  background: rgba(8, 9, 13, 0.92);
  border: 1px solid rgba(234, 198, 82, 0.35);
  color: var(--gold-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}
.toast.show { opacity: 1; }

.controls {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  min-height: var(--pad-h);
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
  padding-left: 4px;
}

.play-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.move-btns { display: flex; gap: 8px; }

.pad-btn, .fire-btn {
  border-radius: 16px;
  color: var(--cream);
  border: 1px solid rgba(234, 198, 82, 0.35);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.pad-btn {
  width: 64px;
  height: 64px;
  background: linear-gradient(180deg, #997a13, var(--purple-deep));
  font-size: 1.4rem;
  box-shadow: 0 4px 0 #0f1116;
}

.fire-btn {
  min-width: 92px;
  height: 64px;
  padding: 0 18px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold) 45%, var(--gold-deep));
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 #896d11;
}

.pad-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0f1116; }
.fire-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #896d11; }

.site-footer {
  display: none;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
  font-size: 0.92rem;
}

.footer-links a { color: var(--teal-2); text-decoration: none; }
.footer-links a:hover, .footer-links a:focus-visible { text-decoration: underline; }

@media (min-width: 780px) {
  .site-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 16px 12px;
    color: var(--muted);
    font-size: 0.92rem;
  }
  .controls { padding-bottom: 4px; min-height: 120px; }
}

@media (max-width: 640px) {
  html { font-size: 17px; }
  .brand-name, .brand small { display: none; }
  .stat { min-width: 54px; padding: 3px 7px 5px; }
  .hint { display: none; }
  .controls { grid-template-columns: 1fr; justify-items: center; }
  .footer-links { display: none; }
  h1 { font-size: clamp(2.1rem, 11vw, 3rem); }
}

@media (max-height: 700px) {
  .hud { min-height: 50px; }
  .controls { min-height: 96px; padding-top: 4px; }
  .pad-btn { width: 56px; height: 56px; }
  .fire-btn { height: 56px; min-width: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .primary, .pad-btn, .toast { transition: none; }
}

body.is-playing .site-footer { display: none; }

.banner {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 10px;
  z-index: 4;
  max-width: min(620px, calc(100% - 24px));
  margin: 0 auto;
  background: rgba(3, 4, 6, 0.96);
  border: 2px solid rgba(242, 221, 150, 0.78);
  border-radius: 14px;
  padding: 12px 16px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.banner.show { opacity: 1; transform: translateY(0); }
.banner strong { display: block; color: #ffd04d; font-size: 1.22rem; line-height: 1.25; text-shadow: 0 1px 0 #030406; }
.banner.bad { border-color: rgba(255, 180, 171, 0.8); }
.banner.bad strong { color: #ffb4b4; }
.banner.ok { border-color: rgba(245, 229, 176, 0.7); }
.banner.info { border-color: rgba(245, 229, 176, 0.55); }
.banner p { margin: 6px 0 0; font-size: 1.12rem; color: #e0e0e0; line-height: 1.4; }
#banner.show ~ #toast { top: auto; bottom: 16px; }

.lives { letter-spacing: 0.12em; }

#title-screen {
  background:
    linear-gradient(180deg, rgba(3, 4, 6, 0.18) 0%, rgba(3, 4, 6, 0.08) 38%, rgba(3, 4, 6, 0.88) 100%),
    url("../images/title-hero.jpg") center 45% / cover no-repeat;
}

#title-screen { cursor: pointer; }

.start-btn {
  min-width: min(280px, 100%);
  min-height: 64px;
  padding: 14px 28px;
  font-size: 1.35rem;
  letter-spacing: 0.03em;
}

.start-hint {
  margin: 0 0 8px;
  color: var(--gold-soft);
  font-weight: 700;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .start-btn {
    width: 100%;
    min-height: 68px;
    font-size: 1.4rem;
  }
  .play-controls {
    width: 100%;
    justify-content: space-between;
    padding: 0 4px;
  }
  .pad-btn { width: 72px; height: 72px; }
  .fire-btn { min-width: 120px; height: 72px; font-size: 1.25rem; }
}

.overlay.hidden, .modal.hidden {
  display: none !important;
  pointer-events: none;
}

@media (max-height: 700px) {
  #title-screen { justify-content: flex-end; }
  .title-card, .panel { padding: 14px 14px 12px; }
  .subtitle { margin-bottom: 10px; font-size: 1.05rem; }
}

@media (max-height: 640px) {
  #title-screen { justify-content: center; }
  .controls { min-height: 88px; }
}
