/* Enter the Light: shared look. Light, warm, calm. */
:root {
  --cream: #FFF8EC; --peach: #FFE9D6; --gold: #C9A24A; --gold-deep: #A9822F; --ink: #2B2440; --soft: #6B6280;
  --sun: #F2C94C; --coral: #FF8A65; --sky: #9FD8F0; --leaf: #8CCB7E;
  --read: Lora, Georgia, serif; --ui: Outfit, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--ui); color: var(--ink); -webkit-font-smoothing: antialiased;
  background: radial-gradient(900px 640px at 50% 0%, #FFFDF6 0%, var(--cream) 45%, var(--peach) 100%) fixed;
}
body.game { height: 100%; overflow: hidden; user-select: none; -webkit-user-select: none; }
html:has(body.game) { height: 100%; overflow: hidden; }

/* game layout */
.wrap { position: relative; height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
.hud { display: flex; align-items: center; gap: 8px; }
.hud .sp { flex: 1; }
.stat { background: rgba(255,255,255,.75); border: 1px solid rgba(201,162,74,.3); border-radius: 14px; padding: 6px 12px; min-width: 0; box-shadow: 0 4px 14px rgba(169,130,47,.08); }
.stat small { display: block; font-size: .68rem; color: var(--gold-deep); font-weight: 600; }
.stat b { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat.best b { font-size: 1rem; color: var(--soft); }
.icon { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid rgba(201,162,74,.35); background: rgba(255,255,255,.8); color: var(--ink); font-size: 1rem; cursor: pointer; display: grid; place-items: center; text-decoration: none; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.note { margin: 7px 0 5px; font-size: .8rem; color: var(--soft); text-align: center; min-height: 1.2em; }
.note b { color: var(--gold-deep); font-weight: 700; }

/* overlays and panels */
.ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(255,244,228,.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 5; }
.ov[hidden] { display: none !important; }
.panel { width: 100%; max-width: 400px; text-align: center; background: linear-gradient(170deg, #FFFFFF, #FFF6E6 70%, #FFEFD9); border: 1px solid rgba(201,162,74,.5); border-radius: 28px; padding: 24px 20px 20px; box-shadow: 0 30px 80px rgba(169,130,47,.25); animation: pin .45s cubic-bezier(.2,.8,.2,1); max-height: 100%; overflow-y: auto; }
@keyframes pin { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.panel h1 { font-family: var(--read); font-weight: 700; font-size: 2.3rem; line-height: 1.05; margin: 6px 0 8px; letter-spacing: -.015em; }
.panel p { font-family: var(--read); font-size: 1.02rem; line-height: 1.5; color: var(--soft); margin: 0 auto 14px; max-width: 32ch; }
.lab { font-size: .8rem; color: var(--gold-deep); font-weight: 600; margin: 0 0 8px; }
.btn { display: block; width: 100%; font: 800 1.12rem var(--ui); border: 0; border-radius: 99px; padding: 16px; cursor: pointer; text-decoration: none; text-align: center; color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn-y { background: var(--sun); box-shadow: 0 8px 26px rgba(242,201,76,.45); }
.btn-w { background: #fff; border: 1px solid rgba(201,162,74,.45); font-size: 1rem; padding: 13px; margin-top: 10px; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.big { font-size: 3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.newbest { display: inline-block; background: var(--sun); color: var(--ink); font-weight: 800; font-size: .8rem; padding: 4px 10px; border-radius: 99px; margin-bottom: 6px; }
.near { font-size: .92rem; color: var(--soft); margin: 4px 0 12px; }
.card { text-align: left; background: #fff; border: 1px solid rgba(201,162,74,.3); border-radius: 16px; padding: 12px; margin: 0 0 12px; font-size: .88rem; color: var(--soft); }
.card b { color: var(--ink); }
.bar { height: 10px; border-radius: 99px; background: #F1E6D2; overflow: hidden; margin: 8px 0 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFD36E, #FF9F1C); border-radius: 99px; }

.toast { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); z-index: 4; pointer-events: none; text-align: center; background: rgba(255,255,255,.95); border: 1px solid rgba(201,162,74,.6); border-radius: 18px; padding: 10px 16px; min-width: 220px; max-width: 90%; opacity: 0; transition: opacity .3s, transform .3s; box-shadow: 0 12px 30px rgba(169,130,47,.2); }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.toast b { display: block; font-family: var(--read); font-size: 1.2rem; color: var(--ink); }
.toast span { font-size: .85rem; color: var(--gold-deep); }

@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }

/* ---------- painted scenery (each game sets --bg on <body class="game">) ---------- */
body.game.scenic { background: #FFF4E6 var(--bg) center / cover no-repeat fixed; }
body.game.scenic::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 45%, rgba(255,248,236,0) 40%, rgba(255,240,225,.35) 100%); z-index: 0; }
body.game.scenic .wrap { z-index: 1; }
/* desktop: the game sits in a soft frosted column on top of the scene; the space to the right is kept free for a future ad */
@media (min-width: 900px) {
  body.game.scenic .wrap { background: rgba(255,250,242,.38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 0 0 1px rgba(255,255,255,.5), 0 30px 80px rgba(120,80,40,.18); }
}
body.game.scenic .stat, body.game.scenic .icon { background: rgba(255,255,255,.85); }
/* start screens show the game's card art */
.panel .hero-art { display: block; width: 150px; aspect-ratio: 3 / 4; object-fit: cover; margin: -4px auto 12px; border-radius: 999px 999px 18px 18px; border: 3px solid #fff; box-shadow: 0 12px 30px rgba(169,130,47,.25); }
@media (max-height: 700px) { .panel .hero-art { width: 110px; } }
