:root {
  color-scheme: dark;
  --ink: #f8f0df;
  --muted: #c9bcaa;
  --gold: #f5b942;
  --gold-bright: #ffd97a;
  --ember: #e86f2e;
  --wine: #511f2c;
  --night: #0b1218;
  --panel: rgba(15, 15, 19, 0.9);
  --line: rgba(244, 193, 88, 0.25);
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  display: grid;
  place-items: center;
  background-color: #05080b;
  background-image:
    radial-gradient(ellipse at center, rgba(103, 59, 36, .62) 0%, rgba(18, 20, 23, .82) 48%, rgba(3, 5, 7, .98) 100%),
    repeating-linear-gradient(135deg, rgba(244, 185, 73, .06) 0 1px, transparent 1px 18px);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.game-shell {
  position: relative;
  width: min(100vw, 177.777778vh);
  height: min(100vh, 56.25vw);
  width: min(100vw, 177.777778dvh);
  height: min(100dvh, 56.25vw);
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(circle at 50% 35%, #4b2e23, #0b1015 70%);
  box-shadow: 0 0 0 1px rgba(245, 185, 66, .34), 0 0 0 5px rgba(0, 0, 0, .52), 0 24px 90px rgba(0, 0, 0, .78);
}
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: none; }
.vignette { position: absolute; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at center, transparent 55%, rgba(2, 5, 8, 0.55) 100%); }
.screen { position: absolute; inset: 0; z-index: 10; }

.splash-screen { display: grid; grid-template-rows: auto 1fr auto; color: var(--ink); overflow: auto; background: #0d1013; }
.cover-art { position: absolute; inset: 0; background: url('/assets/samson-weak-v2.jpg?v=20260816-8') center center / cover no-repeat; filter: saturate(1.02) contrast(1.04); }
.cover-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7,12,16,.98) 0%, rgba(7,12,16,.88) 34%, rgba(7,12,16,.18) 68%, rgba(7,12,16,.48) 100%), linear-gradient(0deg, rgba(6,9,12,.85), transparent 35%); }
.splash-nav { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 24px clamp(24px, 5vw, 78px); }
.mini-brand { display: flex; align-items: center; gap: 10px; font-family: "Cinzel", serif; font-weight: 800; letter-spacing: .2em; font-size: 13px; }
.mini-brand span, .hud-mark { display: inline-grid; place-items: center; width: 31px; height: 31px; color: #17100a; background: linear-gradient(145deg, #ffe39a, #c47b20); clip-path: polygon(50% 0, 90% 22%, 90% 75%, 50% 100%, 10% 75%, 10% 22%); }
.language-picker select { color: var(--ink); background: rgba(8,11,15,.72); border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 9px 34px 9px 14px; outline: none; backdrop-filter: blur(12px); }
.language-picker select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,185,66,.18); }

.splash-content { position: relative; z-index: 2; width: min(690px, 51vw); margin-left: clamp(24px, 6vw, 96px); align-self: center; padding: 20px 0 42px; }
.title-lockup { width: fit-content; text-align: center; }
.eyebrow { color: var(--gold-bright); font-size: 10px; font-weight: 800; letter-spacing: .42em; text-transform: uppercase; }
h1, h2, h3 { font-family: "Cinzel", Georgia, serif; margin: 0; }
h1 { margin: 1px 0 -6px; font-size: clamp(64px, 8vw, 118px); line-height: .92; letter-spacing: -.055em; color: #fff6da; text-shadow: 0 4px 0 #5f3415, 0 12px 35px rgba(0,0,0,.7); }
.title-rule { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 8px; }
.title-rule i { width: 44%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.title-rule i:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.tagline { margin: 10px 0 0; color: #f7dba6; font-family: "Cinzel", serif; font-size: clamp(12px, 1.3vw, 17px); letter-spacing: .08em; }
.intro { max-width: 590px; margin: 20px 0; color: #ddd4c4; font-size: clamp(14px, 1.2vw, 17px); line-height: 1.55; text-shadow: 0 2px 12px #000; }

.instruction-panel { width: min(690px, 100%); padding: 16px 18px 14px; border: 1px solid rgba(238,181,75,.22); border-radius: 16px; background: linear-gradient(120deg, rgba(13,19,24,.88), rgba(24,18,17,.7)); box-shadow: 0 18px 48px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.04); backdrop-filter: blur(14px); }
.instruction-panel h2 { margin-bottom: 11px; color: var(--gold-bright); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; }
.instruction-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.instruction-grid article { display: flex; gap: 10px; min-width: 0; }
.instruction-grid article + article { border-left: 1px solid rgba(255,255,255,.1); padding-left: 14px; }
.step-icon { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(145deg, #f8c45a, #9a4b20); color: #1b1109; font-weight: 900; font-size: 12px; box-shadow: inset 0 1px #ffe9b0, 0 5px 16px rgba(0,0,0,.4); }
.blade-icon { font-size: 22px; transform: rotate(-22deg); }
.instruction-grid strong { display: block; color: #fff4dc; font-size: 12px; }
.instruction-grid p { margin: 3px 0 0; color: #bdb5aa; font-size: 10.5px; line-height: 1.35; }
.splash-actions { display: flex; align-items: center; gap: 22px; margin-top: 18px; }
.primary-button { min-height: 48px; border: 1px solid #ffd77d; border-radius: 9px; padding: 0 21px; color: #221307; background: linear-gradient(180deg, #ffd879, #e69a2e); box-shadow: inset 0 1px #fff4c9, 0 7px 24px rgba(225,125,31,.24); font-family: "Cinzel", serif; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; transition: transform .16s, filter .16s; }
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.secondary-button { min-height: 48px; padding: 0 18px; color: #f4dfb5; border: 1px solid rgba(245,185,66,.46); border-radius: 9px; background: rgba(15,16,18,.72); font-family: "Cinzel", serif; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(10px); transition: border-color .16s, background .16s, transform .16s; }
.secondary-button:hover { border-color: var(--gold-bright); background: rgba(63,39,25,.78); transform: translateY(-2px); }
#playButton { min-width: 225px; display: flex; justify-content: space-between; align-items: center; }
#playButton b { font-size: 20px; }
.game-count { display: grid; color: #9e988e; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.game-count strong { color: var(--gold-bright); font-family: "Cinzel", serif; font-size: 18px; }
.copyright { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px clamp(24px, 5vw, 78px) 18px; color: rgba(238,230,216,.56); font-size: 9px; border-top: 1px solid rgba(255,255,255,.07); background: rgba(4,7,10,.38); }

.hud { position: absolute; inset: 0 0 auto; z-index: 5; display: grid; grid-template-columns: auto auto auto minmax(200px, 340px) auto auto; gap: 12px; align-items: center; padding: 13px clamp(12px, 2.5vw, 36px); background: linear-gradient(180deg, rgba(5,9,12,.91), rgba(5,9,12,.55), transparent); pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-brand { display: flex; align-items: center; gap: 9px; font-family: "Cinzel", serif; letter-spacing: .12em; font-size: 12px; }
.hud-mark { width: 28px; height: 28px; }
.hud-stat { display: grid; min-width: 86px; padding: 7px 12px; border-left: 1px solid rgba(255,255,255,.14); }
.hud-stat span, .meter-label span, .strength-meter small { color: #a9a095; font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.hud-stat strong { color: #fff5dc; font-family: "Cinzel", serif; font-size: 20px; line-height: 1; }
.hud-stat:first-of-type strong { color: var(--gold-bright); }
.strength-meter { min-width: 0; }
.meter-label { display: flex; justify-content: space-between; margin-bottom: 5px; }
.meter-label strong { color: #ffe3a3; font-size: 10px; }
.meter-track { height: 9px; overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(0,0,0,.45); box-shadow: inset 0 2px 5px #000; }
.meter-fill { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #55b870, #e6bc45 55%, #dc492d); box-shadow: 0 0 12px #f3a539; transition: width .1s linear; }
.strength-meter small { display: block; margin-top: 4px; letter-spacing: .04em; text-transform: none; }
.icon-button, .hud-button { height: 36px; color: #f1e9da; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(8,12,16,.55); backdrop-filter: blur(8px); }
.icon-button { width: 38px; font-size: 18px; }
.hud-button { padding: 0 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.cut-coach { position: absolute; z-index: 4; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: #f5ead3; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; background: rgba(7,10,12,.65); backdrop-filter: blur(8px); font-size: 11px; animation: coachFade 6s forwards; pointer-events: none; }
.coach-knife { color: var(--gold-bright); font-size: 24px; transform: rotate(-25deg); }
@keyframes coachFade { 0%, 70% { opacity: 1 } 100% { opacity: 0 } }

.pause-screen, .results-screen, .front-leaderboard-screen { display: grid; place-items: center; padding: 20px; background: rgba(4,7,10,.7); backdrop-filter: blur(10px); }
.modal, .results-card { border: 1px solid rgba(246,194,89,.3); background: linear-gradient(150deg, rgba(29,22,19,.98), rgba(11,16,20,.98)); box-shadow: 0 30px 100px #000, inset 0 1px rgba(255,255,255,.06); }
.small-modal { width: min(430px, 100%); padding: 38px; border-radius: 20px; text-align: center; }
.modal-glyph { display: inline-grid; place-items: center; width: 60px; height: 60px; margin-bottom: 15px; border-radius: 50%; color: var(--gold); border: 1px solid rgba(245,185,66,.5); font-family: "Cinzel", serif; font-size: 22px; }
.small-modal h2 { color: #fff2d6; font-size: 25px; }
.small-modal p { color: var(--muted); }
.small-modal .primary-button { margin-top: 10px; }

.results-card { width: min(960px, 96%); max-height: 92%; display: grid; grid-template-columns: 1.05fr .95fr; overflow: auto; border-radius: 22px; }
.results-copy { padding: clamp(28px, 4vw, 54px); }
.results-copy h2 { margin: 7px 0 22px; color: #fff3d6; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; }
.final-score { display: flex; align-items: baseline; gap: 17px; margin: 18px 0; padding: 15px 0; border-block: 1px solid rgba(255,255,255,.1); }
.final-score span { color: #a8a095; font-size: 11px; letter-spacing: .17em; text-transform: uppercase; }
.final-score strong { color: var(--gold-bright); font-family: "Cinzel", serif; font-size: 44px; }
#resultText { color: #c5bcae; line-height: 1.55; }
#scoreForm label { display: block; margin: 22px 0 7px; color: #e7d9c3; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.score-entry { display: flex; gap: 9px; }
.score-entry input { min-width: 0; flex: 1; height: 48px; padding: 0 14px; color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 9px; outline: none; background: rgba(0,0,0,.32); }
.score-entry input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,185,66,.16); }
.form-status { min-height: 18px; margin: 7px 0; color: #8fd6a2; font-size: 11px; }
.text-button { padding: 8px 0; color: #d8c9b3; border: 0; background: none; font-weight: 700; }
.text-button:hover { color: var(--gold-bright); }
.leaderboard-card { padding: clamp(24px, 3vw, 38px); background: linear-gradient(145deg, rgba(88,44,31,.5), rgba(15,17,19,.92)); border-left: 1px solid rgba(245,185,66,.18); }
.front-leaderboard-screen { z-index: 20; }
.front-leaderboard-card { position: relative; width: min(510px, 94%); max-height: 88%; overflow: auto; border: 1px solid rgba(246,194,89,.3); border-radius: 20px; box-shadow: 0 30px 100px #000, inset 0 1px rgba(255,255,255,.06); }
.front-leaderboard-card h2 { margin-top: 4px; color: #fff1d4; font-size: 27px; }
.modal-close { position: absolute; z-index: 2; top: 13px; right: 14px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: #eadcc5; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: rgba(0,0,0,.28); font-size: 24px; line-height: 1; }
.modal-close:hover { color: var(--gold-bright); border-color: var(--gold); }
.leaderboard-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.leaderboard-title h3 { margin-top: 4px; color: #fff1d4; font-size: 23px; }
.laurel { color: var(--gold); font-size: 33px; }
#leaderboardList, #frontLeaderboardList { min-height: 260px; margin: 0; padding: 0; list-style: none; counter-reset: rank; }
#leaderboardList li, #frontLeaderboardList li { counter-increment: rank; display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: center; min-height: 36px; border-bottom: 1px solid rgba(255,255,255,.07); color: #d7cec0; font-size: 12px; }
#leaderboardList li::before, #frontLeaderboardList li::before { content: counter(rank); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #988c7c; font-family: "Cinzel", serif; font-size: 10px; }
#leaderboardList li:nth-child(1)::before, #frontLeaderboardList li:nth-child(1)::before { color: #1b130a; background: linear-gradient(145deg, #ffe59b, #c57a1e); }
#leaderboardList li:nth-child(2)::before, #frontLeaderboardList li:nth-child(2)::before { color: #182028; background: linear-gradient(145deg, #f1f1ee, #89939b); }
#leaderboardList li:nth-child(3)::before, #frontLeaderboardList li:nth-child(3)::before { color: #28150d; background: linear-gradient(145deg, #e3a474, #8b4728); }
#leaderboardList li strong, #frontLeaderboardList li strong { color: var(--gold-bright); font-family: "Cinzel", serif; }
#leaderboardList .empty-score, #frontLeaderboardList .empty-score { grid-template-columns: 1fr; justify-items: center; padding: 70px 10px; color: #978e82; text-align: center; }
#leaderboardList .empty-score::before, #frontLeaderboardList .empty-score::before { display: none; }
.total-games { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(245,185,66,.2); color: #a99e90; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.total-games strong { color: var(--gold-bright); font-family: "Cinzel", serif; font-size: 17px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .cover-shade { background: linear-gradient(90deg, rgba(7,12,16,.94), rgba(7,12,16,.6)), linear-gradient(0deg, #080c0f 0%, transparent 55%); }
  .splash-content { width: auto; max-width: 660px; margin: auto clamp(20px, 5vw, 54px); padding-top: 46px; }
  .instruction-grid { grid-template-columns: 1fr; }
  .instruction-grid article + article { border-left: 0; padding-left: 0; border-top: 1px solid rgba(255,255,255,.09); padding-top: 10px; }
  .hud { grid-template-columns: auto auto auto 1fr auto; }
  .hud-brand strong, .hud-button { display: none; }
  .hud .icon-button { display: none; }
  .results-card { grid-template-columns: 1fr; }
  .leaderboard-card { border-left: 0; border-top: 1px solid rgba(245,185,66,.18); }
}

@media (max-width: 560px) {
  .game-shell { min-height: 0; }
  .splash-nav { padding: 16px; }
  .mini-brand { font-size: 10px; }
  .language-picker select { max-width: 154px; }
  .splash-content { margin: auto 16px; padding-top: 18px; }
  h1 { font-size: 58px; }
  .intro { font-size: 13px; }
  .instruction-panel { padding: 13px; }
  .instruction-grid p { font-size: 10px; }
  .splash-actions { align-items: stretch; }
  #playButton { min-width: 0; flex: 1; }
  .secondary-button { flex: 1; }
  .copyright { padding: 12px 16px 18px; }
  .hud { gap: 6px; padding: 8px; grid-template-columns: auto auto 1fr auto; }
  .hud-stat.compact { display: none; }
  .hud-stat { min-width: 64px; padding: 5px 8px; }
  .hud-stat strong { font-size: 16px; }
  .strength-meter small { display: none; }
  .score-entry { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
