@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/cinzel-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-sans-3-latin.woff2") format("woff2");
}

:root {
  --burgundy: #991A08;
  --burgundy-deep: #6E1206;
  --gold: #C7A96C;
  --gold-deep: #A88842;
  --cream: #F3E6B0;
  --paper: #FFF9EF;
  --paper-2: #F6EDDC;
  --ink: #2A1A12;
  --ink-soft: #5C4A3A;
  --muted: #7A6756;
  --line: rgba(168, 136, 66, 0.35);
  --shadow: 0 18px 40px rgba(42, 26, 18, 0.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  min-height: 100svh;
}

.hud {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.7rem + var(--safe-top)) calc(1rem + var(--safe-right)) 0.5rem calc(1rem + var(--safe-left));
  pointer-events: none;
}
.hud-score, .hud-timer, .hud-meter {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.hud-timer, .hud-meter { text-align: center; margin-inline: auto; }
.hud-label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
}
.hud-value {
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.5rem, 6.5vw, 2.3rem);
  font-weight: 650;
  color: var(--ink);
}
.hud-best {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: right;
  min-width: 4.5rem;
}
body.is-start .hud-score,
body.is-start .hud-timer,
body.is-start .hud-meter,
body.is-start .hud-best { visibility: hidden; }

.scuff-track {
  width: min(9.5rem, 34vw);
  height: 0.7rem;
  margin-top: 0.45rem;
  background: rgba(42, 26, 18, 0.1);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.scuff-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--burgundy);
  border-radius: inherit;
}
.hud-meter.is-high .hud-value { color: var(--burgundy); }
.hud-meter.is-high .scuff-fill { background-color: var(--burgundy); }

.hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(0.7rem + var(--safe-bottom));
  margin: 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink);
  pointer-events: none;
  background: rgba(255, 249, 239, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  box-shadow: 0 6px 16px rgba(42, 26, 18, 0.1);
  white-space: nowrap;
}
.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;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1.2rem + var(--safe-top)) calc(1.1rem + var(--safe-right)) calc(1.2rem + var(--safe-bottom)) calc(1.1rem + var(--safe-left));
  background: linear-gradient(180deg, rgba(42, 26, 18, 0.18), rgba(42, 26, 18, 0.38));
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.overlay.hidden { display: none !important; }
.card {
  width: min(26rem, 100%);
  background: linear-gradient(180deg, #fffdf7 0%, var(--paper-2) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.6rem 1.35rem 1.35rem;
  text-align: center;
}
.logo {
  display: block;
  width: auto;
  height: clamp(88px, 22vw, 124px);
  margin: 0 auto 0.7rem;
}
.eyebrow {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--gold-deep);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1, h2 {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin: 0 0 0.65rem;
  color: var(--ink);
}
h1 { font-size: clamp(1.7rem, 6.4vw, 2.35rem); }
h2 { font-size: clamp(1.45rem, 5.5vw, 1.9rem); }
.lede, .how {
  margin: 0 0 0.7rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.lede { font-size: 1.02rem; }
.how { font-size: 0.95rem; }
.best-line {
  margin: 0.2rem 0 1.05rem;
  font-weight: 650;
  color: var(--ink);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn + .btn { margin-top: 0.65rem; }
.btn-primary { background: var(--burgundy); color: #fff; }
.btn-primary:hover { background: var(--burgundy-deep); }
.btn-quote {
  background: transparent;
  color: var(--burgundy);
  border: 2px solid var(--burgundy);
}
.btn-quote:hover { background: rgba(153, 26, 8, 0.06); }
.btn:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }
.final-score {
  margin: 0.15rem 0 0.15rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(3rem, 16vw, 4.4rem);
  font-weight: 650;
  line-height: 1;
  color: var(--burgundy);
}
.slogan {
  margin: 1.05rem 0 0;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold-deep);
  font-size: 0.98rem;
}
.home-link, .game-credit, .sources-link { margin: 0.7rem 0 0; font-size: 0.92rem; }
.home-link a, .game-credit a, .sources-link a {
  color: var(--burgundy);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.game-credit { font-size: 0.82rem; }
@media (min-width: 720px) { .card { padding: 2rem 2rem 1.6rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.playfield {
  padding: calc(4.6rem + var(--safe-top)) calc(0.7rem + var(--safe-right)) calc(3.2rem + var(--safe-bottom)) calc(0.7rem + var(--safe-left));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.stage {
  position: relative;
  width: min(420px, 100%);
  flex: 1 1 auto;
  height: auto;
  min-height: 320px;
  margin: 0 auto;
  background:
    linear-gradient(#efe3cf, #e4d3ae);
  border: 4px solid #3a3128;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
}
.items { position: absolute; inset: 0; }
.falling {
  position: absolute;
  width: 72px;
  height: 72px;
  margin-left: -36px;
  margin-top: -36px;
  padding: 0;
  border: 1px solid rgba(42,26,18,.25);
  border-radius: 8px;
  background: #fffdf7;
  cursor: pointer;
  touch-action: none;
  z-index: 2;
}
.falling:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
.falling.is-wrapped { background: #e8d09a; outline: 3px solid var(--gold-deep); }
.falling.is-broken { background: #f3d0c8; outline: 3px solid var(--burgundy); }
.falling svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.floor-line {
  position: absolute;
  left: 0; right: 0; bottom: 58px;
  height: 14px;
  background: repeating-linear-gradient(90deg, #8B5A2B 0 16px, #6B3E2A 16px 32px);
  z-index: 1;
}
.wrap-pad {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  min-width: 96px;
  min-height: 48px;
  padding: 0 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--burgundy);
  background: #fffdf7;
  color: var(--burgundy);
  font: inherit;
  font-weight: 700;
  cursor: grab;
  touch-action: none;
}
.wrap-pad.is-drag { cursor: grabbing; box-shadow: 0 8px 18px rgba(42,26,18,.2); }
.hud-timer.is-low .hud-value { color: var(--burgundy); }
