:root {
  --bg: #0e0e12;
  --panel: #16161d;
  --accent: #6ee7b7;
  --accent-strong: #34d399;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --danger: #f87171;
  --found: #60a5fa;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

.app-root { display: grid; grid-template-rows: 1fr; min-height: 100%; }
.app-header { height: auto; max-height: 100px; overflow: hidden; }
.brand { display: none; }
.controls .title .logo { height: 50px; width: auto; vertical-align: middle; image-rendering: -webkit-optimize-contrast; }

/* Controls bar */
.controls { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto auto 1fr auto auto auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0)); }
.controls .title { font-weight: 800; letter-spacing: .3px; }
.home-btn { appearance: none; background: #D84672; color: white; border: none; border-radius: 10px; padding: 8px; cursor: pointer; transition: all 0.2s ease; display: grid; place-items: center; width: 36px; height: 36px; }
.home-btn:hover { background: #c23a5f; transform: translateY(-1px); }
.controls .btn { appearance: none; background: #22222c; color: var(--text); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
.controls .btn:hover { background: #262633; }
.controls .counter { font-variant-numeric: tabular-nums; opacity: .9; padding: 0 6px; }
.debug-toggle { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 6px; padding: 6px 8px; background: #22222c; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; }
.debug-toggle input { accent-color: var(--accent-strong); }

.game { display: grid; place-items: center; padding: 12px 12px 0; }

.scene { position: relative; width: 100%; max-width: 960px; aspect-ratio: 16 / 9; background: #1b1b24; border-radius: 16px 16px 8px 8px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.scene img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* scene overlays (decorative images positioned inside scene) */
.scene .scene-overlay { display: block; }
.scene .scene-overlay[src*="level1-item3"] { transform: scaleX(-1); }

/* Debug hit boxes */
.hit-box { position: absolute; border: 2px dashed rgba(255,255,255,.5); background: rgba(255,255,255,.06); border-radius: 8px; pointer-events: none; }

.hit-marker { position: absolute; width: 44px; height: 44px; border-radius: 999px; border: 3px solid var(--found); transform: translate(-50%, -50%); pointer-events: none; animation: pop .28s ease-out; box-shadow: 0 4px 12px rgba(96,165,250,.35);
  background: rgba(96,165,250,.12);
}

@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: .2; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes celebrationPop { from { transform: translate(-50%, -50%) scale(0.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

.menu-section { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.25) 8px), var(--panel); border-top: 1px solid rgba(255,255,255,.06); }
.menu-title { margin: 0; padding: 12px 12px 6px; font-family: 'Londrina Solid', cursive; font-weight: 900; font-size: 1.5rem; color: #ECA318; text-align: center; letter-spacing: 0.5px; text-transform: uppercase; }
.object-menu { display: grid; grid-auto-flow: column; gap: 10px; align-items: center; padding: 0 10px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; }
.object-menu::-webkit-scrollbar { display: none; }

.object-chip { position: relative; flex: 0 0 auto; display: grid; grid-template-columns: 48px auto; align-items: center; gap: 10px; padding: 8px 10px; background: #20202a; color: var(--text); border-radius: 12px; border: 1px solid rgba(255,255,255,.06); cursor: pointer; min-width: 140px; user-select: none; outline: none; }
.object-chip:focus-visible { box-shadow: 0 0 0 3px rgba(110,231,183,.35); }
.object-chip.selected { border-color: #D84672; box-shadow: inset 0 0 0 1px #D84672; background: #1a1f1d; }
.object-chip.found { opacity: .6; background: #18202a; border-color: rgba(96,165,250,.6); }

.object-chip .thumb { width: 48px; height: 48px; border-radius: 10px; background: #2a2a35; display: grid; place-items: center; overflow: hidden; }
.object-chip .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.object-chip[data-object-id="skateboard"] .thumb img { transform: scaleX(-1); }
.object-chip .label { font-weight: 600; letter-spacing: .2px; }
.object-chip .checkmark { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; background: #20A4AB; color: white; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: bold; z-index: 1; }

.celebration { position: absolute; inset: 0; pointer-events: none; }

.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; clip-path: inset(50%); }

/* Start Menu */
.start-menu { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.start-content { display: grid; place-items: center; gap: 50px; text-align: center; }
.logo-container { position: relative; display: grid; place-items: center; }
.start-logo { height: 300px; width: auto; image-rendering: -webkit-optimize-contrast; }
.logo-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80px; height: 80px; background: rgba(236, 163, 24, 0.9); border: none; border-radius: 50%; color: white; cursor: pointer; transition: all 0.3s ease; display: grid; place-items: center; box-shadow: 0 4px 20px rgba(236, 163, 24, 0.4); }
.logo-play-btn:hover { background: rgba(236, 163, 24, 1); transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 6px 30px rgba(236, 163, 24, 0.6); }
.logo-play-btn svg { margin-left: 4px; }
.start-buttons { display: grid; grid-auto-flow: column; gap: 20px; }
.start-btn { appearance: none; border: none; border-radius: 16px; padding: 16px 32px; font-family: 'Londrina Solid', cursive; font-weight: 900; font-size: 1.5rem; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; transition: all 0.2s ease; min-width: 200px; }
.start-btn.primary { background: #ECA318; color: white; }
.start-btn.primary:hover { background: #d4920e; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(236, 163, 24, 0.3); }
.start-btn.secondary { background: #D84672; color: white; }
.start-btn.secondary:hover { background: #c23a5f; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(216, 70, 114, 0.3); }

/* Game Screen */
.game-screen { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Start Menu Mobile */
  .start-logo { height: 200px; }
  .start-buttons { grid-auto-flow: row; gap: 12px; }
  .start-btn { min-width: 180px; font-size: 1.3rem; padding: 14px 28px; }
  .logo-play-btn { width: 60px; height: 60px; }
  .logo-play-btn svg { width: 40px; height: 40px; }
  
  /* Controls Mobile */
  .controls { grid-template-columns: auto auto 1fr auto auto; gap: 8px; padding: 8px 10px; }
  .controls .title .logo { height: 40px; }
  .home-btn { width: 32px; height: 32px; padding: 6px; }
  .home-btn svg { width: 16px; height: 16px; }
  .controls .btn { padding: 6px 10px; font-size: 0.9rem; }
  .debug-toggle { padding: 4px 6px; font-size: 0.8rem; }
  .debug-toggle span { display: none; }
  
  /* Scene Mobile */
  .scene { margin: 8px; border-radius: 12px 12px 6px 6px; }
  .hit-marker { width: 36px; height: 36px; }
  
  /* Menu Mobile */
  .menu-title { font-size: 1.2rem; padding: 10px 10px 4px; }
  .object-menu { gap: 8px; padding: 0 8px 8px; }
  .object-chip { grid-template-columns: 40px auto; min-width: 100px; padding: 6px 8px; gap: 8px; }
  .object-chip .thumb { width: 40px; height: 40px; }
  .object-chip .label { font-size: 0.9rem; }
  .object-chip .checkmark { width: 16px; height: 16px; font-size: 10px; }
}

@media (max-width: 520px) {
  /* Extra Small Mobile */
  .start-logo { height: 150px; }
  .start-btn { min-width: 160px; font-size: 1.2rem; padding: 12px 24px; }
  .logo-play-btn { width: 50px; height: 50px; }
  .logo-play-btn svg { width: 32px; height: 32px; }
  
  .controls { grid-template-columns: auto auto 1fr auto auto; gap: 6px; padding: 6px 8px; }
  .controls .title .logo { height: 35px; }
  .home-btn { width: 28px; height: 28px; padding: 4px; }
  .home-btn svg { width: 14px; height: 14px; }
  .controls .btn { padding: 5px 8px; font-size: 0.8rem; }
  .controls .counter { font-size: 0.9rem; }
  
  .scene { margin: 6px; }
  .hit-marker { width: 32px; height: 32px; }
  
  .menu-title { font-size: 1.1rem; padding: 8px 8px 3px; }
  .object-menu { gap: 6px; padding: 0 6px 6px; }
  .object-chip { grid-template-columns: 36px auto; min-width: 90px; padding: 5px 6px; gap: 6px; }
  .object-chip .thumb { width: 36px; height: 36px; }
  .object-chip .label { font-size: 0.8rem; }
  .object-chip .checkmark { width: 14px; height: 14px; font-size: 9px; }
}

@media (max-width: 360px) {
  /* Very Small Mobile */
  .start-logo { height: 120px; }
  .start-btn { min-width: 140px; font-size: 1.1rem; padding: 10px 20px; }
  
  .controls { grid-template-columns: auto auto 1fr auto; gap: 4px; padding: 4px 6px; }
  .controls .title .logo { height: 30px; }
  .home-btn { width: 24px; height: 24px; padding: 3px; }
  .home-btn svg { width: 12px; height: 12px; }
  .controls .btn { padding: 4px 6px; font-size: 0.7rem; }
  .controls .counter { font-size: 0.8rem; }
  
  .scene { margin: 4px; }
  .hit-marker { width: 28px; height: 28px; }
  
  .menu-title { font-size: 1rem; padding: 6px 6px 2px; }
  .object-menu { gap: 4px; padding: 0 4px 4px; }
  .object-chip { grid-template-columns: 32px auto; min-width: 80px; padding: 4px 5px; gap: 4px; }
  .object-chip .thumb { width: 32px; height: 32px; }
  .object-chip .label { font-size: 0.7rem; }
  .object-chip .checkmark { width: 12px; height: 12px; font-size: 8px; }
}
