/* core.css - shared UI shell. Each game overrides the :root variables in its own index.html. */
:root {
  --font-display: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --c1: #ff7a3d;      /* primary */
  --c2: #ffd23f;      /* accent */
  --c3: #2b2d42;      /* dark ink */
  --panel: rgba(255, 255, 255, .94);
  --scrim: rgba(20, 24, 48, .55);
  --text: #2b2d42;
  --logo-stroke: #2b2d42;
  --bg: #87c7f0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: var(--font-body); color: var(--text); user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
.stage { position: relative; width: 100%; height: 100vh; height: 100dvh; max-height: 1000px; overflow: hidden; background: var(--bg); }
.stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.ui { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.ui > * { pointer-events: auto; }
button { font-family: var(--font-display); cursor: pointer; border: 0; }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; text-align: center; }
.screen.on { display: flex; animation: fadein .25s ease; }
.screen.menu, .screen.levels, .screen.loading { background: radial-gradient(ellipse at 50% 35%, rgba(255,255,255,.18), rgba(0,0,0,.35)); }
.screen.help, .screen.pause, .screen.result { background: var(--scrim); z-index: 20; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

.logo { font-family: var(--font-display); font-weight: 700; font-size: clamp(34px, 8vw, 78px); line-height: .95; color: #fff; letter-spacing: .5px;
  -webkit-text-stroke: clamp(1.5px, .45vw, 4px) var(--logo-stroke); paint-order: stroke fill; text-shadow: 0 6px 0 var(--logo-stroke), 0 10px 24px rgba(0,0,0,.35); max-width: 94%; }
.logo small { display: block; font-size: .42em; color: var(--c2); margin-top: .25em; -webkit-text-stroke-width: clamp(1px, .3vw, 3px); text-shadow: 0 3px 0 var(--logo-stroke); }
.tag { color: #fff; font-weight: 800; font-size: clamp(14px, 2.4vw, 19px); text-shadow: 0 2px 6px rgba(0,0,0,.5); max-width: 560px; }
.sub { color: #fff; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,.5); }
.bar { width: min(320px, 70vw); height: 16px; border-radius: 10px; background: rgba(255,255,255,.35); overflow: hidden; border: 3px solid var(--c3); }
.bar i { display: block; height: 100%; width: 0; background: var(--c2); transition: width .2s; }

.btn { white-space: nowrap; background: var(--c1); color: #fff; font-size: 20px; font-weight: 700; padding: 12px 26px; border-radius: 16px; box-shadow: 0 5px 0 var(--c3); min-width: 120px; transition: transform .08s; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--c3); }
.btn.big { font-size: 28px; padding: 14px 46px; border-radius: 22px; }
.btn.ghost { background: #fff; color: var(--c3); text-shadow: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.diffs { display: flex; gap: 8px; background: rgba(0,0,0,.25); padding: 6px; border-radius: 18px; }
.pill { background: transparent; color: #fff; font-size: 17px; font-weight: 700; padding: 8px 16px; border-radius: 13px; }
.pill.on { background: var(--c2); color: var(--c3); box-shadow: 0 3px 0 var(--c3); }

.card { background: var(--panel); border-radius: 24px; padding: 22px 22px 20px; width: min(460px, 94vw); max-height: 90%; overflow: auto; box-shadow: 0 8px 0 var(--c3), 0 20px 50px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 12px; align-items: center; border: 4px solid var(--c3); }
.card .h, .levels .h { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--c3); }
.levels .h { color: #fff; -webkit-text-stroke: 2px var(--c3); paint-order: stroke fill; text-shadow: 0 3px 0 var(--c3); }
.help-body { text-align: left; font-size: 16px; line-height: 1.45; }
.help-body b { color: var(--c1); }
.help-body ul { padding-left: 20px; margin: 6px 0; }
.card .btn { width: 100%; }
.card .row .btn { width: auto; flex: 1; min-width: 90px; padding: 12px 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; width: min(620px, 94vw); max-height: 62%; overflow: auto; padding: 6px; }
.lv { background: #fff; border-radius: 14px; padding: 8px 4px 6px; box-shadow: 0 4px 0 var(--c3); display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--c3); }
.lv b { font-size: 22px; }
.lv span { font-size: 12px; color: var(--c1); letter-spacing: 1px; }
.lv.done { background: #fff8d9; }
.lv.locked { opacity: .55; cursor: default; }

.stars { display: flex; gap: 8px; font-size: 54px; }
.stars i { font-style: normal; color: rgba(0,0,0,.15); }
.stars i.on { color: var(--c2); -webkit-text-stroke: 2px var(--c3); animation: pop .45s backwards cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.result .msg { font-size: 17px; font-weight: 700; }

.hud { position: absolute; top: 0; left: 0; right: 0; display: none; justify-content: space-between; align-items: flex-start; padding: 10px 12px; gap: 8px; pointer-events: none; z-index: 6; }
.hud.on { display: flex; }
.hud > * { pointer-events: auto; }
.hud-l .lvl, .chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,.38); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 18px; padding: 6px 12px; border-radius: 14px; white-space: nowrap; }
.hud-c { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: 1; }
.hud-r { display: flex; gap: 6px; }
.ico { width: 44px; height: 44px; border-radius: 14px; background: rgba(0,0,0,.38); color: #fff; font-size: 19px; display: grid; place-items: center; padding: 0; }
.ico.floating { position: absolute; top: 10px; right: 12px; z-index: 30; }
.meter { width: 90px; height: 12px; background: rgba(255,255,255,.3); border-radius: 8px; overflow: hidden; display: inline-block; }
.meter i { display: block; height: 100%; background: var(--c2); }

.banner { position: absolute; left: 50%; top: 22%; transform: translate(-50%, -50%) scale(.6); opacity: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 6vw, 52px); color: #fff; -webkit-text-stroke: 2px var(--c3); paint-order: stroke fill; text-shadow: 0 4px 0 var(--c3); pointer-events: none; transition: all .25s cubic-bezier(.2,1.5,.4,1); white-space: nowrap; z-index: 8; text-align: center; }
.banner.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.float-text { position: absolute; transform: translate(-50%, -50%); font-family: var(--font-display); font-weight: 700; font-size: 22px; -webkit-text-stroke: 1.5px rgba(0,0,0,.6); paint-order: stroke fill; pointer-events: none; z-index: 7; white-space: nowrap; }

.joy { position: absolute; bottom: 24px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.5); touch-action: none; z-index: 7; }
.joy.left { left: 24px; } .joy.right { right: 24px; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 3px 0 rgba(0,0,0,.25); pointer-events: none; }
.tbtn { position: absolute; bottom: 34px; right: 26px; width: 92px; height: 92px; border-radius: 50%; background: var(--c1); color: #fff; font-size: 20px; font-weight: 700; box-shadow: 0 5px 0 var(--c3); touch-action: none; z-index: 7; opacity: .92; }
.tbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--c3); }

@media (max-height: 520px) {
  .logo { font-size: clamp(28px, 6vw, 56px); }
  .btn.big { font-size: 22px; padding: 10px 32px; }
  .screen { gap: 8px; }
  .stars { font-size: 40px; }
  .card { padding: 14px; gap: 8px; }
}
@media (max-width: 480px) {
  .hud-l .lvl, .chip { font-size: 15px; padding: 5px 9px; }
  .ico { width: 40px; height: 40px; }
  .pill { font-size: 15px; padding: 7px 11px; }
}

/* ---- retro pixel mode (cfg.pixelHeight) ---- */
html.pixel .stage canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
html.pixel .btn, html.pixel .card, html.pixel .lv, html.pixel .pill.on, html.pixel .ico, html.pixel .chip, html.pixel .hud-l .lvl, html.pixel .tbtn, html.pixel .bar { border-radius: 0; }
html.pixel .btn { box-shadow: 4px 4px 0 var(--c3); }
html.pixel .btn:active { box-shadow: 1px 1px 0 var(--c3); transform: translate(3px, 3px); }
html.pixel .card { box-shadow: 8px 8px 0 var(--c3); }
html.pixel .logo { text-shadow: 4px 4px 0 var(--logo-stroke); line-height: 1.15; }
html.pixel .joy, html.pixel .joy-knob { border-radius: 0; }
