:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --yellow: #ffd83d;
  --blue: #4ac7ff;
  --ink: #07102d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #03051b; }
body { display: grid; place-items: center; touch-action: none; }
button { font: inherit; }

.game-shell, .game-shell * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.game-shell {
  position: relative;
  width: min(100vw, 520px);
  height: 100dvh;
  max-height: 920px;
  overflow: hidden;
  background: #080d39;
  isolation: isolate;
}

canvas { width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.panel {
  position: absolute;
  z-index: 5;
  left: 50%; top: 50%;
  width: min(88%, 390px);
  transform: translate(-50%, -50%);
  padding: 28px 24px 24px;
  text-align: center;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(20,31,92,.96), rgba(8,12,50,.97));
  box-shadow: 0 24px 70px rgba(0,0,0,.45), inset 0 1px rgba(255,255,255,.12);
  backdrop-filter: blur(14px);
}

.panel--hero { padding: 32px 24px 24px; display: flex; flex-direction: column; align-items: center; }
.logo-badge { font-size: 46px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); }
.eyebrow { margin: 10px 0 8px; color: #83ddff; font-size: 11px; font-weight: 900; letter-spacing: .17em; }
h1, h2 { width: 100%; margin: 0 0 16px; text-align: center; font-weight: 1000; line-height: .92; text-transform: uppercase; text-shadow: 0 5px 0 rgba(0,0,0,.18); }
h1 { font-size: clamp(32px, 9vw, 44px); letter-spacing: -.035em; color: white; }
h1 span { color: var(--yellow); }
h2 { color: white; font-size: 42px; }
.lead { margin: 0 auto 24px; max-width: 300px; color: #dce9ff; line-height: 1.45; font-size: 15px; }
.hint, .wardrobe-note { margin: 16px 0 0; color: #91a2d0; font-size: 12px; }

.primary, .secondary {
  width: 100%; min-height: 56px; border-radius: 18px; border: 0; font-weight: 950; text-transform: uppercase; letter-spacing: .04em; cursor: pointer;
}
.primary { color: #17204c; background: linear-gradient(#ffe55e, #ffc928); box-shadow: 0 6px 0 #bd8017, 0 12px 24px rgba(255,191,20,.22); }
.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #bd8017; }
.secondary { margin-top: 13px; color: white; background: rgba(96,132,231,.18); border: 1px solid rgba(255,255,255,.16); }

.hud { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); left: 14px; right: 14px; display: flex; align-items: center; gap: 7px; }
.hud-pill, .lives, .icon-btn { height: 42px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.15); background: rgba(8,13,53,.72); backdrop-filter: blur(9px); box-shadow: 0 5px 16px rgba(0,0,0,.18); }
.hud-pill { min-width: 58px; gap: 5px; padding: 0 10px; border-radius: 16px; }
.hud-pill--wide { min-width: 105px; }
.lives { margin-left: auto; padding: 0 8px; border-radius: 16px; font-size: 14px; letter-spacing: -3px; }
.icon-btn { width: 42px; border-radius: 14px; color: white; font-weight: 900; }

.controls { position: absolute; z-index: 4; left: 20px; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; pointer-events: none; }
.controls button { width: 78px; height: 78px; pointer-events: auto; touch-action: none; -webkit-user-drag: none; border: 2px solid rgba(255,255,255,.23); border-radius: 28px; color: white; background: rgba(51,94,195,.34); box-shadow: inset 0 1px rgba(255,255,255,.18), 0 8px 25px rgba(0,0,0,.23); backdrop-filter: blur(8px); font-size: 30px; }
.controls button.pressed { transform: scale(.92); background: rgba(255,210,48,.54); }

.toast { position: absolute; z-index: 8; top: 78px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 88%; padding: 12px 18px; border-radius: 18px; color: #18234e; background: var(--yellow); box-shadow: 0 8px 28px rgba(0,0,0,.3); text-align: center; font-weight: 900; animation: pop .25s ease-out; }
@keyframes pop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }

.results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.results div { padding: 14px 8px; border-radius: 18px; background: rgba(255,255,255,.08); }
.results span { display: block; margin-bottom: 5px; color: #91a2d0; font-size: 12px; }
.results strong { color: var(--yellow); font-size: 23px; }

.wardrobe { max-height: 90%; padding: 20px; overflow: auto; }
.wardrobe h2 { margin-bottom: 8px; font-size: 38px; }
.close-btn { position: absolute; right: 15px; top: 13px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: white; background: rgba(255,255,255,.1); font-size: 28px; line-height: 1; }
.skin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.skin-card { position: relative; min-height: 128px; padding: 5px 6px 8px; border: 2px solid transparent; border-radius: 18px; color: white; background: rgba(255,255,255,.07); }
.skin-card.selected { border-color: var(--yellow); background: rgba(255,216,61,.13); }
.skin-card.locked { opacity: .72; }
.skin-preview { display: block; width: 60px; height: 70px; margin: 0 auto 1px; }
.skin-lock { position: absolute; top: 7px; right: 8px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 9px; background: rgba(7,12,40,.82); font-size: 12px; }
.skin-card strong { display: block; font-size: 12px; }
.skin-card small { display: block; margin-top: 4px; color: #aab8dd; font-size: 9px; }
.wardrobe-note { margin-top: 10px; }

@media (min-width: 650px) {
  .game-shell { height: min(92vh, 920px); border-radius: 30px; box-shadow: 0 30px 100px #000; }
}

@media (max-width: 620px), (pointer: coarse) {
  .panel, .hud-pill, .lives, .icon-btn, .controls button { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .hud-pill, .lives, .icon-btn { box-shadow: 0 3px 9px rgba(0,0,0,.16); }
  .controls button { box-shadow: inset 0 1px rgba(255,255,255,.16), 0 4px 12px rgba(0,0,0,.2); }
}
