:root {
  --red: #D9282F;
  --red-dark: #B01F25;
  --navy: #072539;
  --ink: #0F1921;
  --cream: #FFF9F2;
  --peach: #FFBC7D;
  --line: rgba(255, 249, 242, .14);
  --muted: rgba(255, 249, 242, .68);
  --head: 'Montserrat', system-ui, sans-serif;
  --body: 'Source Sans 3', system-ui, sans-serif;
  --gutter: clamp(16px, 5vw, 72px);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--ink); color: var(--cream); }
body { font-family: var(--body); font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
body.playing { overflow: hidden; overscroll-behavior: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--head); font-weight: 800; font-size: .86rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  padding: 16px 26px; border-radius: 2px; background: var(--red); color: #fff; transition: background .15s, transform .1s; }
.btn:hover { background: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { background: rgba(255, 249, 242, .14); color: rgba(255, 249, 242, .5); cursor: progress; }
.btn.big { font-size: 1rem; padding: 20px 32px; }
.btn.small { font-size: .74rem; padding: 10px 16px; }
.btn.ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 2px var(--cream); }
.btn.ghost:hover { background: var(--cream); color: var(--ink); }
.btn:focus-visible, .link:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; }
.link { appearance: none; background: none; border: 0; cursor: pointer; font-family: var(--head); font-weight: 700; font-size: .9rem;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255, 249, 242, .4); padding: 4px 0; }
.link:hover { text-decoration-color: var(--cream); }
.row { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; }

/* ---------- landing ---------- */
#landing { min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
h1 { overflow-wrap: anywhere; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px var(--gutter); }
.top img { height: clamp(40px, 6vw, 56px); width: auto; display: block; }
.top-link { font-family: var(--head); font-weight: 700; font-size: .8rem; letter-spacing: .04em; color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.top-link:hover { color: var(--cream); border-color: var(--cream); }
.hero { flex: 1; padding: clamp(16px, 4vw, 60px) var(--gutter) clamp(40px, 6vw, 80px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; }
.hero-copy { display: grid; gap: 26px; min-width: 0; }
.hero-bot { justify-self: end; width: min(46vw, 230px); aspect-ratio: 1 / 1.05; margin: -8px -8px -40px 0; pointer-events: none; }
.hero-bot canvas { width: 100%; height: 100%; display: block; }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: center; }
  .hero-bot { grid-column: 2; grid-row: 1; justify-self: center; width: min(100%, 460px); margin: 0; }
  .hero-copy { grid-column: 1; grid-row: 1; }
  .hero-copy h1 { font-size: clamp(3rem, 5.2vw, 6.4rem); }
}
.eyebrow { font-family: var(--head); font-weight: 700; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--peach); }
h1 { font-family: var(--head); font-weight: 900; text-transform: uppercase; line-height: .92; letter-spacing: -.02em; font-size: clamp(2rem, 9.6vw, 8.2rem); }
h1 .l { display: block; animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
h1 .l:nth-child(2) { animation-delay: .1s; }
h1 .l.soft { color: var(--peach); animation-delay: .2s; }
.smash { position: relative; display: inline-block; }
.smash::before { content: attr(data-t); position: absolute; inset: 0; color: var(--red); transform: translate(.045em, .03em); z-index: -1; animation: reg 1.3s .4s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(40%); } to { opacity: 1; transform: none; } }
@keyframes reg { 0% { transform: translate(.16em, .06em); } 35% { transform: translate(-.05em, .02em); } 100% { transform: translate(.045em, .03em); } }

form.go { max-width: 58rem; margin-top: 6px; }
.lbl { display: block; font-family: var(--head); font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.urlrow { display: flex; gap: 0; flex-wrap: wrap; }
.field { flex: 1 1 min(18rem, 100%); display: flex; align-items: center; background: var(--cream); color: var(--ink); border-radius: 2px 0 0 2px; min-width: 0; }
.field span { padding-left: 20px; font-weight: 600; color: rgba(15, 25, 33, .5); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 20px 20px 20px 4px; font-size: 1.2rem; font-weight: 600; color: var(--ink); outline: none; }
.urlrow .btn { border-radius: 0 2px 2px 0; }
.err { color: var(--peach); font-weight: 600; min-height: 1.6em; margin-top: 10px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 16px 28px; max-width: 64rem; color: var(--muted); }
.steps li { display: flex; gap: 12px; align-items: baseline; }
.steps b { font-family: var(--head); font-weight: 900; color: var(--red); font-size: 1.2rem; }
.steps strong { color: var(--cream); }
.foot { display: flex; justify-content: space-between; padding: 20px var(--gutter); border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
@media (max-width: 560px) {
  .field { border-radius: 2px 2px 0 0; }
  .urlrow .btn { width: 100%; border-radius: 0 0 2px 2px; }
}

/* ---------- gallery ---------- */
.gallery { padding: clamp(40px, 6vw, 80px) var(--gutter); border-top: 1px solid var(--line); display: grid; gap: 26px; }
.gal-head { display: grid; gap: 10px; max-width: 44rem; }
.gal-head h2 { font-family: var(--head); font-weight: 900; text-transform: uppercase; font-size: clamp(1.8rem, 5vw, 3.4rem); line-height: .95; }
.gal-head p:last-child { color: var(--muted); }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 18px; }
.gal-card { display: grid; gap: 8px; }
.gal-media { position: relative; aspect-ratio: 16 / 10; background: var(--navy); overflow: hidden; border: 1px solid var(--line); }
.gal-media button { all: unset; cursor: pointer; position: absolute; inset: 0; display: block; }
.gal-media img, .gal-media video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.gal-media video { object-fit: contain; }
.gal-media .play { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: var(--red); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.gal-media .play::after { content: ''; position: absolute; left: 23px; top: 18px; border-left: 17px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.gal-media button:hover .play, .gal-media button:focus-visible .play { background: var(--red-dark); }
.gal-media button:focus-visible { outline: 3px solid var(--peach); outline-offset: -3px; }
.gal-meta { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: .92rem; }
.gal-meta strong { font-family: var(--head); font-weight: 800; word-break: break-all; }
.gal-meta a { color: var(--peach); white-space: nowrap; font-weight: 700; font-size: .85rem; }
.gal-empty { color: var(--muted); }

/* add-to-gallery form in the result dialog */
.gal-add { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.gal-form { display: grid; gap: 8px; }
.gal-form input[type=text], .gal-form input[type=email] { width: 100%; padding: 10px 12px; background: rgba(255,249,242,.06); border: 1px solid var(--line); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--red); flex: none; }
.gal-done { color: var(--peach); font-weight: 600; }
.gal-done a { color: var(--cream); }

/* share page */
body.share { min-height: 100dvh; }
.share-main { padding: 10px var(--gutter) 60px; display: grid; gap: 20px; max-width: 70rem; }
.share-h { font-family: var(--head); font-weight: 900; text-transform: uppercase; font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 1; word-break: break-all; }
.share-h span { color: var(--peach); display: block; }
.share-main video { width: 100%; max-height: 75dvh; background: #000; }

/* ---------- loading ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--ink); padding: var(--gutter); text-align: center; }
.loader { display: grid; gap: 14px; justify-items: center; max-width: 30rem; }
.loader h2 { font-family: var(--head); font-weight: 900; text-transform: uppercase; font-size: clamp(1.4rem, 4vw, 2.2rem); line-height: 1.05; }
.loader p { color: var(--muted); }
.bolt { width: 64px; height: 64px; border: 6px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; z-index: 30; background: #050d14; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#game { position: absolute; display: block; background: var(--navy); image-rendering: auto; cursor: crosshair; }
.ready, .saving { position: absolute; inset: 0; margin: auto; width: min(34rem, calc(100% - 32px)); height: max-content; max-height: calc(100% - 32px); overflow: auto;
  background: var(--ink); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); padding: clamp(22px, 4vw, 36px); display: grid; gap: 16px; z-index: 5; }
.ready h2, .saving h2 { font-family: var(--head); font-weight: 900; text-transform: uppercase; line-height: 1.02; font-size: clamp(1.4rem, 3.4vw, 2rem); }
.ready h2 span { color: var(--peach); word-break: break-all; }
.ready p, .saving p { color: var(--muted); }
.switch { display: flex; gap: 12px; align-items: center; font-weight: 600; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--red); }
.keys { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .88rem; color: var(--muted); }
kbd { display: inline-block; min-width: 1.6em; text-align: center; font-family: var(--head); font-weight: 700; font-size: .72rem; padding: 2px 6px; margin-right: 2px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; color: var(--cream); }
.keys.touch { display: none; }
body.touch .keys.touch { display: flex; }
body.touch .keys.desk { display: none; }
.stop { position: absolute; z-index: 6; top: max(12px, env(safe-area-inset-top)); right: 12px; padding: 10px 16px; font-size: .74rem; }
.meter { height: 8px; background: var(--line); }
.meter i { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }

/* weapon rack */
.rack { position: absolute; z-index: 6; display: flex; gap: 6px; padding: 6px; background: rgba(15, 25, 33, .78); border: 1px solid var(--line); border-radius: 6px; backdrop-filter: blur(4px); }
.wbtn { appearance: none; border: 0; cursor: pointer; display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 6px 8px 5px; border-radius: 4px;
  background: transparent; color: var(--cream); font-family: var(--head); font-weight: 700; font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; position: relative; }
.wbtn svg { width: 26px; height: 26px; }
.wbtn .k { position: absolute; top: 3px; left: 5px; font-size: .58rem; color: var(--muted); }
.wbtn:hover { background: rgba(255, 249, 242, .08); }
.wbtn.on { background: var(--red); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.wbtn.on .k { color: var(--cream); }
.wbtn.sep { margin-left: 6px; border-left: 1px solid var(--line); border-radius: 0 4px 4px 0; }
.wbtn:focus-visible { outline: 2px solid var(--peach); }

/* controls cheat sheet */
.help { position: absolute; z-index: 6; width: 250px; padding: 12px 14px; background: rgba(15, 25, 33, .85); border: 1px solid var(--line); border-radius: 6px; font-size: .86rem; backdrop-filter: blur(4px); }
.help-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--head); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; margin-bottom: 6px; }
.help .x { font-size: 1.4rem; }
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.help dt { white-space: nowrap; }
.help dd { color: var(--muted); }

/* touch controls: everything floats over the full-screen game */
.pad { position: absolute; z-index: 4; width: 132px; height: 132px; border-radius: 50%; background: rgba(255, 249, 242, .08); border: 2px solid rgba(255, 249, 242, .25); pointer-events: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255, 249, 242, .5); }
.thumbs { position: absolute; z-index: 6; right: max(16px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); display: flex; gap: 14px; align-items: flex-end; }
.round { appearance: none; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--cream); }
.round svg { width: 30px; height: 30px; }
.round.jump { width: 70px; height: 70px; background: rgba(15, 25, 33, .7); border: 2px solid rgba(255, 249, 242, .35); }
.round.nade { width: 76px; height: 76px; background: var(--red); box-shadow: 0 5px 0 var(--red-dark); margin-bottom: 40px; }
.round:active { transform: translateY(3px); }
body.touch .rack { flex-direction: column; right: max(10px, env(safe-area-inset-right)); top: 50%; transform: translateY(-62%); padding: 4px; gap: 4px; }
body.touch .wbtn { min-width: 0; width: 50px; padding: 6px 0; font-size: 0; }
body.touch .wbtn .k { display: none; }
body.touch .wbtn.sep { margin: 4px 0 0; border-left: 0; border-top: 1px solid var(--line); border-radius: 4px; }
body.touch .help, body.touch .wbtn.helpbtn { display: none; }
body.touch .stop { top: 52px; bottom: auto; left: auto; right: 10px; transform: none; padding: 8px 12px; font-size: .68rem; }

/* two-thumb coaching overlay (phones only, never recorded) */
.coach { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: rgba(15,25,33,.45); animation: coachIn .3s ease both; }
.coach.out { animation: coachOut .4s ease both; }
.coach-title { position: absolute; left: 0; right: 70px; top: 26%; text-align: center; font-family: var(--head); font-weight: 900; text-transform: uppercase; font-size: 1.6rem; text-shadow: 0 3px 12px rgba(0,0,0,.7); }
.coach-l, .coach-r { position: absolute; display: grid; justify-items: center; gap: 10px; text-align: center; font-size: .92rem; line-height: 1.3; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.coach-l { left: 6%; bottom: 16%; }
.coach-r { right: 84px; top: 40%; }
.coach b { display: block; font-family: var(--head); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; color: var(--peach); }
.coach .finger { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--cream); background: rgba(255,249,242,.18); box-shadow: 0 0 0 0 rgba(255,249,242,.6); animation: tapPulse 1.2s ease-out infinite; }
.coach-l .finger { animation-name: dragHint; }
@keyframes tapPulse { 0% { box-shadow: 0 0 0 0 rgba(255,249,242,.6); transform: scale(1); } 40% { transform: scale(.88); } 100% { box-shadow: 0 0 0 26px rgba(255,249,242,0); transform: scale(1); } }
@keyframes dragHint { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(22px, 0); } 60% { transform: translate(0, -22px); } }
@keyframes coachIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes coachOut { to { opacity: 0; } }

/* ---------- result dialog ---------- */
dialog.done { margin: auto; width: min(64rem, calc(100% - 24px)); max-height: calc(100dvh - 24px); background: var(--ink); color: var(--cream); border: 1px solid var(--line); padding: clamp(18px, 3vw, 32px); overflow: auto; }
dialog.done::backdrop { background: rgba(5, 13, 20, .85); }
.done-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 18px; }
.done-head h2 { font-family: var(--head); font-weight: 900; text-transform: uppercase; font-size: clamp(1.5rem, 4vw, 2.4rem); line-height: 1; }
.x { background: none; border: 0; font-size: 2rem; line-height: 1; cursor: pointer; color: var(--muted); }
.done-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 1fr); gap: 24px; align-items: start; }
.done-body video { width: 100%; max-height: 70dvh; background: #000; display: block; }
.choices { display: grid; gap: 12px; }
.score { font-family: var(--head); font-weight: 800; font-size: 1.1rem; color: var(--peach); }
.sub { color: var(--muted); font-size: .95rem; }
.sub strong { color: var(--cream); }
.caption-wrap { display: grid; gap: 8px; justify-items: start; }
.caption-wrap textarea { width: 100%; background: rgba(255, 249, 242, .06); border: 1px solid var(--line); padding: 10px 12px; font-size: .92rem; resize: vertical; }
.btn.cta { background: var(--cream); color: var(--ink); }
.btn.cta:hover { background: var(--peach); }
.notice { margin-top: 16px; font-size: .88rem; color: var(--muted); }
@media (max-width: 760px) { .done-body { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  h1 .l, .smash::before { animation: none; }
}
