:root {
  --bg: #120a2b; --bg2: #1d1240; --panel: rgba(28, 16, 60, 0.92); --ink: #f4eeff; --muted: #b9a9dd;
  --gold: #ffd34d; --go: #8ef59b; --stop: #ff6b6b; --accent: #d6403a;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: radial-gradient(1200px 600px at 50% -10%, #3a2470 0%, var(--bg) 60%) fixed, var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; }
a { color: var(--gold); }
kbd { background: #2c1d58; border: 1px solid #4a3690; border-bottom-width: 3px; border-radius: 6px; padding: 0 .4em; font-family: inherit; font-size: .9em; }
code { background: #2c1d58; padding: 0 .3em; border-radius: 4px; }

.site-header { display: flex; align-items: center; justify-content: space-between; max-width: 1000px; margin: 0 auto; padding: 12px 16px; }
.brand { display: flex; gap: 8px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 900; font-size: 1.1rem; }
.brand-dot { color: var(--gold); }
.site-header nav a { color: var(--muted); text-decoration: none; margin-left: 16px; font-weight: 700; font-size: .92rem; }
.site-header nav a:hover { color: var(--ink); }

main { max-width: 1560px; margin: 0 auto; padding: 0 16px 24px; }
.stage-row { display: block; }
.stage-center { max-width: 1000px; margin: 0 auto; }
.rail { display: none; }
@media (min-width: 1280px) {
  .stage-row { display: grid; grid-template-columns: 180px minmax(0, 1000px) 320px; gap: 16px; align-items: start; justify-content: center; }
  .stage-center { margin: 0; }
  .rail { display: block; position: sticky; top: 12px; min-height: 250px; }
}
.content, .site-footer, .ad-slot { max-width: 1000px; margin-left: auto; margin-right: auto; }
.hero { text-align: center; margin: 4px 0 10px; }
.hero h1 { margin: 0; font-size: clamp(1.6rem, 4.5vw, 2.6rem); font-weight: 900; letter-spacing: -.01em;
  background: linear-gradient(180deg, #fff3b8, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { margin: 2px 0 0; color: var(--muted); font-weight: 700; }

/* Ad slots: keep visually separated from game controls (AdSense placement policy). */
.ad-slot { min-height: 0; margin: 28px auto 8px; max-width: 1000px; text-align: center; }
.ad-slot:empty { display: none; }
#adsense-slot-bottom { margin-top: 36px; }

#game-wrap { max-width: 960px; margin: 0 auto; }
#hud { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 6px; align-items: center; background: var(--bg2); border: 1px solid #34245f; border-bottom: 0; border-radius: 16px 16px 0 0; padding: 8px 10px 0; }
.stat { display: flex; flex-direction: column; line-height: 1.1; }
.stat span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.stat b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hud-btns button { background: #2c1d58; border: 1px solid #4a3690; color: var(--ink); border-radius: 10px; width: 38px; height: 34px; font-size: 1rem; cursor: pointer; margin-left: 4px; }
.progress { grid-column: 1 / -1; position: relative; height: 8px; background: #2c1d58; border-radius: 99px; margin: 6px 22px 8px 0; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--go), var(--gold)); border-radius: 99px; transition: width .1s linear; }
.progress .door { position: absolute; right: -24px; top: -9px; font-size: 16px; }

#stage { position: relative; width: 100%; height: 540px; overflow: hidden; border: 1px solid #34245f; border-top: 0; border-radius: 0 0 16px 16px; background: #120a2b;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: pointer; }
#game { display: block; width: 100%; height: 100%; }

.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(10, 4, 26, 0.35); }
.screen.show { display: flex; }
#screen-title { background: linear-gradient(90deg, rgba(10,4,26,0) 30%, rgba(10,4,26,.55) 60%); justify-content: flex-end; }
.panel { background: var(--panel); border: 1px solid #4a3690; border-radius: 20px; padding: 18px 22px; max-width: 440px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.45); text-align: center; cursor: default; }
.panel h2 { margin: 2px 0 8px; font-size: 1.6rem; font-weight: 900; }
.kicker { margin: 0; color: var(--gold); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.small { color: var(--muted); font-size: .92rem; margin: 4px 0; }
.rules { list-style: none; padding: 0; margin: 6px 0 14px; text-align: left; display: grid; gap: 6px; font-size: .98rem; }
.keys { color: var(--muted); font-size: .78rem; margin: 10px 0 0; }
.cta { appearance: none; border: 0; border-radius: 999px; padding: 12px 34px; font: 900 1.2rem var(--font); color: #1a0f38; cursor: pointer;
  background: linear-gradient(180deg, #ffe58a, var(--gold)); box-shadow: 0 6px 0 #b8860b, 0 10px 24px rgba(255,211,77,.35); transition: transform .08s; }
.cta:active { transform: translateY(3px); box-shadow: 0 3px 0 #b8860b; }
.cta:focus-visible, .opts button:focus-visible, .share-row button:focus-visible { outline: 3px solid #9ef0ff; outline-offset: 3px; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.opts button { appearance: none; border: 2px solid #5b46a6; background: #2c1d58; color: var(--ink); border-radius: 14px; padding: 12px 8px; font: 800 1rem var(--font); cursor: pointer; transition: transform .08s, background .15s; }
.opts button:hover:not(:disabled) { background: #3a2873; transform: translateY(-2px); }
.opts kbd { font-size: .7rem; margin-right: 4px; opacity: .7; }
.opts button.right { background: #1f6b3a; border-color: var(--go); }
.opts button.wrong { background: #7a2030; border-color: var(--stop); }
.result { min-height: 1.5em; font-weight: 800; color: var(--gold); margin: 6px 0 0; }

.panel.over { max-width: 760px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: center; text-align: left; }
.over .big { font-size: 3.2rem; font-weight: 900; color: var(--go); line-height: 1; font-variant-numeric: tabular-nums; }
.over .rank { font-size: 1.3rem; font-weight: 900; color: #ffe9a8; margin: 4px 0; }
.over .cta { margin-top: 10px; }
#card-img { width: 100%; height: auto; border-radius: 14px; border: 1px solid #4a3690; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.share-row button { appearance: none; border: 1px solid #4a3690; background: #2c1d58; color: var(--ink); border-radius: 999px; padding: 7px 12px; font: 800 .88rem var(--font); cursor: pointer; }
.share-row button:hover { background: #3a2873; }

.intro { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none; text-align: center; transition: opacity .25s, transform .25s; }
.intro.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.intro b { display: block; font-size: 2.6rem; font-weight: 900; color: var(--gold); text-shadow: 0 4px 0 #2a1450, 0 0 24px rgba(0,0,0,.5); }
.intro span { display: inline-block; margin-top: 4px; background: rgba(18,8,40,.8); padding: 6px 14px; border-radius: 999px; font-weight: 800; }

.toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #fff; color: #1a0f38; font-weight: 800; padding: 8px 16px; border-radius: 999px; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#hold-btn { display: none; width: 100%; margin: 12px 0 0; padding: 18px; border-radius: 18px; border: 0; font: 900 1.25rem var(--font); color: #1a0f38; background: linear-gradient(180deg, #a6f7b1, var(--go));
  box-shadow: 0 6px 0 #3f9a50; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#hold-btn.active { transform: translateY(4px); box-shadow: 0 2px 0 #3f9a50; background: linear-gradient(180deg, #ffe58a, var(--gold)); }
.hint { text-align: center; color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
@media (pointer: coarse) { #hold-btn { display: block; } }

.content { max-width: 760px; margin: 28px auto 0; }
.content h2 { font-size: 1.4rem; margin: 28px 0 8px; color: #fff3b8; }
.content p, .content li { color: #ddd3f5; }
.content ol { padding-left: 1.2em; display: grid; gap: 6px; }
details { background: var(--bg2); border: 1px solid #34245f; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 800; }
.disclaimer { font-size: .8rem; color: var(--muted) !important; border-top: 1px solid #34245f; padding-top: 12px; margin-top: 28px; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 18px; }

@media (max-width: 640px) {
  .site-header nav { display: none; }
  #hud { gap: 4px; padding: 6px 8px 0; }
  .stat span { font-size: .58rem; letter-spacing: .04em; }
  .stat b { font-size: .98rem; }
  .hud-btns button { width: 32px; height: 30px; margin-left: 2px; }
  .panel { padding: 12px 14px; max-height: 100%; overflow: auto; }
  .panel h2 { font-size: 1.2rem; margin-bottom: 4px; }
  .rules { font-size: .84rem; gap: 3px; margin-bottom: 10px; }
  .keys { display: none; }
  #screen-title { justify-content: center; background: rgba(10,4,26,.45); }
  .panel.over { grid-template-columns: 1fr; }
  #card-img { display: none; }
  .over .big { font-size: 2.3rem; }
  .opts { gap: 6px; margin: 8px 0 4px; }
  .opts button { padding: 9px 6px; font-size: .88rem; }
  .cta { padding: 10px 28px; font-size: 1.05rem; }
}

/* Embed mode (?embed=1 or inside an iframe): game only. The host page carries ads/content. */
.embed body { background: var(--bg); }
.embed .site-header, .embed .hero, .embed .ad-slot, .embed .content, .embed .site-footer, .embed .hint { display: none !important; }
.embed main { padding: 0; max-width: none; }
.embed #game-wrap { max-width: none; }
.embed #hud { border-radius: 0; }
.embed #stage { border-radius: 0; }
