/* Video Game Kraken – Console Challenge */
:root {
  --ink: #101216;
  --panel: #1b1f26;
  --panel-2: #232831;
  --line: #313844;
  --paper: #f2eee4;
  --muted: #9aa3b0;
  --accent: #2dd4bf;
  --accent-ink: #062a26;
  --good: #3ddc84;
  --bad: #ff5d5d;
  --radius: 14px;
  --display: "Bungee", "Rubik", system-ui, sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--paper); font-family: var(--body); }
body { min-height: 100vh; }
[hidden] { display: none !important; }

.vgk {
  max-width: 1040px; margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(1200px 400px at 50% -200px, rgba(45, 212, 191, .10), transparent 70%),
    var(--ink);
}
.screen { animation: in .25s ease-out; text-align: center; }
.screen-narrow { max-width: 640px; margin: 0 auto; }
.btn-wide { min-width: min(320px, 100%); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  font: 700 17px/1 var(--body); letter-spacing: .02em;
  border: 0; border-radius: 999px; padding: 16px 30px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.btn:focus-visible, .answer:focus-visible, 
/* ---------- start ---------- */
.brand { margin: 28px 0 18px; }
.brand-kicker { display: block; color: var(--muted); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: 13px; }
.brand-title {
  font: 400 clamp(44px, 11vw, 78px)/.95 var(--display); margin: 10px 0 0;
  color: var(--paper); text-shadow: 0 4px 0 #0a3d38, 0 8px 24px rgba(45, 212, 191, .25);
}
.lede { color: var(--muted); font-size: 17px; line-height: 1.55; max-width: 520px; margin: 18px auto 22px; }
.pool { color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 520px; margin: -10px auto 22px; }
.pool b { color: var(--accent); }
.rules { list-style: none; padding: 0; margin: 0 auto 22px; display: grid; gap: 8px; max-width: 420px; }
.rules li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 15px; }
.rules b { color: var(--accent); }
.best { color: var(--muted); margin-top: 16px; }

/* ---------- level intro ---------- */
.level-kicker { color: var(--muted); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin: 70px 0 6px; }
.level-name { font: 400 clamp(40px, 10vw, 64px)/1 var(--display); margin: 0; color: var(--accent); }
.level-points { font-size: 18px; margin: 14px 0 22px; }
.pips { display: flex; gap: 8px; justify-content: center; margin-bottom: 34px; }
.pip { width: 34px; height: 8px; border-radius: 4px; background: var(--line); }
.pip.on { background: var(--accent); }

/* ---------- HUD ---------- */
.hud { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 6px; text-align: left; }
.hud-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.hud-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.hud-value { display: block; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.hud-score .hud-value { color: var(--accent); font-family: var(--display); font-weight: 400; font-size: 20px; }
.heart { color: var(--bad); font-size: 18px; margin-right: 2px; }
.heart.lost { color: var(--line); }
.progress { height: 4px; background: var(--line); border-radius: 2px; margin: 10px 0 16px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }

/* ---------- stage ---------- */
.stage { margin: 0; }
.stage-img {
  position: relative; background: #fff; border-radius: var(--radius); aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px rgba(0, 0, 0, .35);
}
.stage-img img { max-width: 92%; max-height: 92%; object-fit: contain; opacity: 0; transition: opacity .2s; }
.stage-img img.ready { opacity: 1; }
.gain {
  position: absolute; top: 14px; right: 16px; font: 400 34px/1 var(--display); color: var(--good);
  text-shadow: 0 2px 0 #0c3a22; opacity: 0;
}
.gain.pop { animation: pop .9s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: translateY(10px) scale(.7); } 25% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }
.caption { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 8px; color: var(--muted); font-size: 13px; min-height: 18px; }
.unknown-name { font-style: italic; }
.credit a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.credit a:hover { color: var(--accent); }
.prompt { font-weight: 700; font-size: 18px; margin: 16px 0 10px; }

/* ---------- answers ---------- */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); color: var(--paper); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 14px; min-height: 64px; font: 500 16px/1.25 var(--body); cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
.answer:hover:not(:disabled) { border-color: var(--accent); background: var(--panel-2); }
.answer:active:not(:disabled) { transform: translateY(1px); }
.answer:disabled { cursor: default; }
.answer .key {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); font: 400 14px/1 var(--display); color: var(--muted);
}
.answer.correct { border-color: var(--good); background: rgba(61, 220, 132, .14); }
.answer.correct .key { background: var(--good); color: #062614; border-color: var(--good); }
.answer.wrong { border-color: var(--bad); background: rgba(255, 93, 93, .14); animation: shake .35s; }
.answer.wrong .key { background: var(--bad); color: #2a0606; border-color: var(--bad); }
.answer:disabled:not(.correct):not(.wrong) { opacity: .45; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- reveal (first mistake) ---------- */
.reveal {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--bad); border-radius: var(--radius);
  padding: 18px; animation: in .2s ease-out;
}
.reveal p { margin: 0 0 8px; font-size: 17px; }
.reveal-title { color: var(--bad); font-weight: 700; }
.reveal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

/* ---------- end ---------- */
.end-kicker { color: var(--muted); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin: 30px 0 0; }
.end-score { font: 400 clamp(64px, 18vw, 110px)/1 var(--display); margin: 8px 0 0; color: var(--accent); }
.end-score small { font-size: .32em; color: var(--paper); }
.end-rank { margin: 6px 0 0; font-size: 18px; color: var(--muted); }
.end-rank b { font: 400 20px/1 var(--display); color: var(--paper); letter-spacing: .03em; }
.end-sub { color: var(--muted); margin: 8px 0 22px; }
.missed {
  display: flex; gap: 14px; align-items: center; text-align: left; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 22px;
}
.missed img { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 10px; flex: none; }
.missed p { margin: 0; }
.missed-label { color: var(--muted); font-size: 13px; }
.missed-answer { font-weight: 700; font-size: 17px; margin: 2px 0 6px !important; }
.missed a, .link { color: var(--accent); font: 500 15px var(--body); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.share { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 24px 0; }
.share-title { font-weight: 700; margin: 0 0 12px; }
.share-lede { color: var(--muted); margin: 0 0 12px; font-size: 15px; }
.share-card { width: 100%; height: auto; border-radius: 10px; display: block; margin-bottom: 14px; aspect-ratio: 1200 / 630; background: var(--ink); }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-tools { display: flex; gap: 18px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.toast { margin: 12px 0 0; color: var(--good); font-weight: 500; }

/* ---------- difficulty ---------- */
.difficulty { border: 0; padding: 0; margin: 0 auto 22px; max-width: 460px; }
.difficulty legend { font-weight: 700; font-size: 16px; margin: 0 auto 10px; padding: 0; }
.diff-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diff {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 12px 6px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.diff:hover { border-color: var(--muted); }
.diff input { position: absolute; opacity: 0; pointer-events: none; }
.diff:has(input:checked) { border-color: var(--accent); background: rgba(45, 212, 191, .10); }
.diff:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.diff-name { font: 400 16px/1 var(--display); }
.diff-hearts { color: var(--bad); font-size: 18px; letter-spacing: 2px; min-height: 22px; }
.diff-lives { color: var(--muted); font-size: 13px; }
.level-status { color: var(--muted); margin: -14px 0 26px; font-size: 15px; }
.level-status b { color: var(--accent); }
.level-status .heart { font-size: 15px; }

/* ---------- follow us + share: round logo buttons ---------- */
.follow { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.follow-title { font: 400 15px/1 var(--display); color: var(--muted); margin: 0 0 14px; letter-spacing: .04em; }
.follow-links, .share-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ibtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 48px; height: 48px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  font: 700 14px/1 var(--body); color: #fff; text-decoration: none; border: 0;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .1s, filter .15s;
}
.ibtn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.ibtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.ibtn svg { width: 22px; height: 22px; }
/* once the logo has loaded, show only the logo in a round button; until then, the name */
.ibtn:has(svg) { width: 48px; padding: 0; }
.ibtn:has(svg) .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ibtn-facebook { background: #1877f2; box-shadow: none; }
.ibtn-x, .ibtn-threads { background: #000; box-shadow: inset 0 0 0 1px #3a3f48; }
.ibtn-bluesky { background: #1185fe; box-shadow: none; }
.ibtn-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); box-shadow: none; }
.ibtn-pinterest { background: #e60023; box-shadow: none; }
.ibtn-youtube { background: #ff0000; box-shadow: none; }
.ibtn-website { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.ibtn-more { width: 48px; padding: 0; }
.ibtn-more .dots { letter-spacing: 1px; font-size: 12px; }

/* ---------- ads ---------- */
.ad-slot { margin: 40px auto 0; max-width: 100%; text-align: center; overflow: hidden; }
.ad-slot ins { max-width: 100%; vertical-align: top; }
.ad-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; margin-bottom: 6px; }
.ad-test {
  border: 2px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 13px; line-height: 1.5;
  display: inline-grid; place-items: center; max-width: 100%; box-sizing: border-box;
}
[data-screen="end"] .ad-slot { margin-top: 0; margin-bottom: 8px; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }   /* no ad available: hide the space */
.ad-slot:has(ins:not([data-ad-status="filled"])) .ad-label { display: none; }  /* label only once an ad shows */
.ad-game { margin-top: 48px; }
.ad-game:has(ins[data-ad-status="filled"]), .ad-game:has(.ad-test) { padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- PC layout: picture left, answers right ---------- */
@media (min-width: 880px) {
  .play-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; }
  .stage-img { aspect-ratio: 1 / 1; width: min(100%, 64vh, 520px); margin: 0 auto; }
  .play-side { text-align: left; }
  .prompt { margin-top: 0; font-size: 22px; }
  .answers { grid-template-columns: 1fr; }
  .answer { min-height: 62px; font-size: 17px; }
  .reveal { text-align: center; }
}

@media (max-width: 520px) {
  .vgk { padding-top: 14px; }
  .hud { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .hud-cell { padding: 6px 8px; }
  .hud-label { font-size: 10px; letter-spacing: .08em; }
  .hud-value { font-size: 15px; }
  .hud-score .hud-value { font-size: 18px; }
  .lvl-name { display: none; }
  .answers { grid-template-columns: 1fr; }
  .answer { min-height: 54px; }
  .stage-img { aspect-ratio: 1 / 1; width: min(100%, 42vh); margin: 0 auto; }
  .brand { margin-top: 10px; }
  .lede { font-size: 16px; }
  .level-kicker { margin-top: 36px; }
  .diff { padding: 10px 4px; }
  .end-kicker { margin-top: 16px; }
  .missed img { width: 72px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
