[hidden] { display: none !important; }
:root {
  --ink: #1b1b3a;
  --muted: #6b6b85;
  --bg: #fffaf5;
  --card: #ffffff;
  --line: #ece6f5;
  --pink: #ff4d8d;
  --purple: #7b2ff7;
  --grad: linear-gradient(135deg, #ff4d8d, #7b2ff7);
  --radius: 18px;
  --fun: "Fredoka", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--fun); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; max-width: 1100px; margin: 0 auto; }
.logo { font-family: var(--fun); font-weight: 600; font-size: 1.4rem; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 18px; }
.nav a { text-decoration: none; margin-left: 18px; font-weight: 600; color: var(--muted); }
.nav a:hover { color: var(--ink); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 10px 18px; font: 600 .95rem var(--body); text-decoration: none; cursor: pointer; transition: transform .12s, box-shadow .12s, opacity .12s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(123, 47, 247, .3); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-big { padding: 14px 26px; font-size: 1.05rem; }

/* Hero */
.hero { text-align: center; padding: 48px 20px 36px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); }
.hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.hero .btn + .btn { margin-left: 10px; }

/* Sections and cards */
section { padding: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head p { color: var(--muted); margin: 0; }
.tag { display: inline-block; font: 600 .75rem var(--body); letter-spacing: .05em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: #f1edf9; color: var(--purple); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(27, 27, 58, .06); display: flex; flex-direction: column; }
.thumb { aspect-ratio: 4 / 3; overflow: hidden; position: relative; }
.thumb canvas { width: 100%; height: auto; position: absolute; top: 50%; left: 0; transform: translateY(-50%); }

.anchor-bottom canvas { top: auto; bottom: 0; transform: none; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 1.2rem; margin-bottom: .2em; }
.card-body p { color: var(--muted); font-size: .92rem; margin: 0 0 14px; flex: 1; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions .btn { padding: 8px 14px; font-size: .88rem; }
.card-premium { box-shadow: 0 0 0 2px #f0e4ff, 0 10px 30px rgba(123, 47, 247, .12); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; counter-reset: s; }
.step { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 var(--line); }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; font: 600 1rem var(--fun); margin-bottom: 10px; }
.step p { color: var(--muted); margin: 0; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 40px 20px; }
footer a { color: var(--muted); }

/* Play page */
body[data-page="play"] { background: #1b1b3a; color: #fff; min-height: 100vh; }
body[data-page="play"] .site-header .logo { color: #fff; }
#stage { display: flex; flex-direction: column; align-items: center; padding: 0 12px 24px; }
.game-wrap { position: relative; width: min(100%, calc((100vh - 110px) * 0.625), 440px); aspect-ratio: 400 / 640; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); touch-action: none; user-select: none; -webkit-user-select: none; }
.game-wrap canvas { display: block; width: 100%; height: 100%; }
.hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; font: 600 1.4rem var(--fun); color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .35); pointer-events: none; }
.is-free .hud { font-family: var(--body); }
.is-free .hud, .is-free .hud span { color: #3f3f46; text-shadow: none; }
#lives { color: #ff4d6d; letter-spacing: 2px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 12, 41, .45); backdrop-filter: blur(3px); padding: 20px; }
.overlay[hidden] { display: none; }
.panel { background: #fff; color: var(--ink); border-radius: 20px; padding: 24px 22px; text-align: center; width: 100%; max-width: 330px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.panel h1 { font-size: 1.7rem; }
.panel h2 { font-size: 1.5rem; margin-bottom: 0; }
.panel .greet { font: 600 1.15rem var(--fun); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 0 0 8px; }
.panel .muted { color: var(--muted); font-size: .92rem; }
.panel .big-score { font: 600 3.2rem var(--fun); margin: 0; line-height: 1.1; }
.panel .gift-msg { font: 500 1.05rem var(--fun); background: #fff4f8; border-radius: 12px; padding: 10px 12px; margin: 12px 0; }
.is-free .panel h1, .is-free .panel h2, .is-free .panel .big-score { font-family: var(--body); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.preview-bar { margin-top: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; font-weight: 600; }
.notice { text-align: center; max-width: 420px; padding: 60px 20px; }
.notice p { color: #c9c6e8; }
.notice .btn-ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3); }

/* Create page */
.create { display: grid; grid-template-columns: 1fr 300px; gap: 32px; align-items: start; padding: 20px 0 60px; }
.create h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 8px 0 6px; }
.pick { border: 0; border-radius: 14px; height: 74px; cursor: pointer; display: flex; align-items: flex-end; padding: 8px 10px; color: #fff; font: 600 .95rem var(--fun); text-shadow: 0 1px 3px rgba(0, 0, 0, .75), 0 0 8px rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 3px transparent; transition: transform .12s, box-shadow .12s; text-align: left; }
.pick.active { box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--purple); transform: translateY(-2px); }
#theme-blurb { color: var(--muted); min-height: 1.5em; }
.field { margin: 16px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field small { color: var(--muted); font-weight: 400; }
.field input, .field textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); font: 1rem var(--body); background: #fff; color: var(--ink); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--purple); }
.row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.row .field { margin: 0; }
.price-note { background: #f6f1ff; border-radius: 12px; padding: 12px 14px; color: var(--ink); font-size: .92rem; margin: 18px 0; }
#form-error { color: #d00045; font-weight: 600; min-height: 1.4em; }
.preview-col { position: sticky; top: 20px; }
.preview { aspect-ratio: 400 / 640; border-radius: 20px; overflow: hidden; box-shadow: 0 16px 40px rgba(27, 27, 58, .2); }
.preview canvas { width: 100%; height: 100%; display: block; }
.preview-col p { text-align: center; color: var(--muted); font-size: .85rem; }
.done { text-align: center; max-width: 520px; margin: 0 auto; padding: 30px 0 60px; }
.link-box { display: flex; gap: 8px; margin: 18px 0; }
.link-box input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); font: 600 1rem var(--body); color: var(--purple); min-width: 0; }
.done .card-actions { justify-content: center; }
@media (max-width: 760px) {
  .create { grid-template-columns: 1fr; }
  .preview-col { position: static; order: -1; max-width: 220px; margin: 0 auto; }
  .nav a { margin-left: 12px; font-size: .9rem; }
}
.ack { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: .95rem; }
.ack input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--purple); flex: none; }
.ack.needs { border-color: #d00045; background: #fff5f8; }
.secure-note, .muted-sm { color: var(--muted); font-size: .85rem; }
.done-status { font-weight: 600; color: var(--muted); }
#form-notice { color: var(--purple); font-weight: 600; }
.panel { max-height: 100%; overflow-y: auto; }
.board { text-align: left; margin: 12px 0 4px; }
.board h3 { font-size: 1.05rem; margin: 10px 0 6px; text-align: center; }
.board ol { list-style: none; counter-reset: r; margin: 0; padding: 0; }
.board li { counter-increment: r; display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; font-size: .95rem; }
.board li:not(.muted)::before { content: counter(r); font-weight: 700; color: var(--purple); width: 1.4em; }
.board li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li:nth-child(odd):not(.muted) { background: #f7f3ff; }
.board li.me { background: #ffe8f1 !important; font-weight: 700; }
.board li.muted { justify-content: center; color: var(--muted); }
.board .sample { opacity: .75; }
.score-form { display: flex; gap: 8px; }
.score-form[hidden] { display: none; }
.score-form input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 999px; border: 2px solid var(--line); font: 1rem var(--body); }
.board-msg { font-size: .85rem; color: var(--muted); text-align: center; margin: 6px 0 0; min-height: 1em; }
.top-score { font-weight: 700; color: var(--purple); min-height: 1.2em; margin: 4px 0 12px; }
.record { text-align: left; margin: 20px 0 8px; }
.record h3 { font-size: 1.05rem; }
.record p { margin: 6px 0; font-size: .92rem; }
@media print { .site-header, footer, .link-box button, .card-actions, .record button { display: none !important; } }
.legal { max-width: 760px; padding-bottom: 40px; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin-top: 10px; }
.legal h2 { font-size: 1.25rem; margin: 28px 0 8px; }
.legal p, .legal li { color: #34345a; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 6px 0; }
.legal-date { color: var(--muted); font-size: .9rem; }
.ack a { color: var(--purple); font-weight: 600; }
.play-foot { text-align: center; font-size: .8rem; color: #9a97c4; margin: 0 0 20px; }
.play-foot a { color: #c9c6e8; }
.auth-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 10px 0 16px; font-size: .95rem; }
.auth-box.ok { background: #f3fbf5; border-color: #cdebd6; }
.btn-google { display: inline-flex; align-items: center; gap: 8px; background: #fff; color: #1f1f1f; border: 1px solid #c7c7cc; border-radius: 999px; padding: 9px 16px; font: 600 .95rem var(--body); cursor: pointer; }
.btn-google:hover { background: #f6f6f8; }
.link-btn { background: none; border: 0; color: var(--purple); font-weight: 600; cursor: pointer; padding: 0; }
.remind { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 10px; font-size: .95rem; cursor: pointer; }
.remind input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--purple); flex: none; }
.remind.disabled { opacity: .55; cursor: default; }
.my-game { display: flex; gap: 16px; background: #fff; border-radius: 16px; padding: 14px; margin: 12px 0; box-shadow: 0 1px 0 var(--line); }
.my-thumb { width: 72px; height: 72px; border-radius: 12px; flex: none; }
.my-info h3 { margin: 0 0 4px; font-size: 1.15rem; }
.my-info .card-actions { margin: 8px 0; }
.remind-toggle { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.receipt { text-align: left; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 0 0 2px var(--line), 0 10px 30px rgba(27,27,58,.08); margin: 10px 0; }
.receipt-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px; color: var(--r-ink); background: linear-gradient(135deg, var(--r-from), var(--r-to)); }
.receipt-head b { display: block; font: 600 1.15rem var(--fun); }
.receipt-head small, .receipt-head a { color: var(--r-ink); opacity: .9; }
.receipt-emoji { font-size: 2rem; }
.receipt dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; padding: 16px 18px 4px; margin: 0; font-size: .92rem; }
.receipt dt { color: var(--r-accent); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
.receipt dd { margin: 0; word-break: break-word; }
.receipt .receipt-ack { margin: 8px 18px 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.receipt-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px 18px; }
.receipt-btn { background: var(--r-accent); color: #fff; }
.my-receipt { margin: 8px 0; }
@media (max-width: 520px) { .receipt dl { grid-template-columns: 1fr; } }
@media print { .receipt-actions { display: none !important; } .receipt { box-shadow: none; } }
