@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;
  --burgundy-soft: #B4230E;
  --gold: #C7A96C;
  --gold-deep: #A88842;
  --gold-soft: #D4B87A;
  --cream: #F3E6B0;
  --cream-pale: #F8F1C8;
  --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%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

.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 {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.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.8rem, 8vw, 2.6rem);
  font-weight: 650;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 249, 239, 0.8);
}

.hud-best {
  margin: 0.15rem auto 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
}

.icon-btn {
  pointer-events: auto;
  touch-action: manipulation;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.88);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(42, 26, 18, 0.08);
}

.icon-btn:hover { background: #fff; }
.icon-btn:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }

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

body.is-start .hud-score,
body.is-start .hud-best {
  visibility: hidden;
}

.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none !important; }

.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.85rem, 7vw, 2.45rem); }
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; }

.preview-note {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.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;
}

.toast {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%);
  z-index: 4;
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 650;
  font-size: 1.35rem;
  color: var(--burgundy);
  text-shadow: 0 1px 0 #fff8e8, 0 8px 18px rgba(42, 26, 18, 0.12);
  pointer-events: none;
  letter-spacing: 0.04em;
}

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

@media (min-width: 720px) {
  .card { padding: 2rem 2rem 1.6rem; }
}

.home-link, .game-credit {
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
}
.home-link a, .game-credit a {
  color: var(--burgundy);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.home-link a:hover, .game-credit a:hover { color: var(--burgundy-dark, #6e1106); }
.game-credit { font-size: 0.82rem; }
