  * { box-sizing: border-box; }
  html, body { margin:0; height:100%; background:#0a0e1a; overflow:hidden; touch-action:none; -webkit-tap-highlight-color:transparent; font-family: system-ui, Arial, sans-serif; color:#e7ecf7; }
  #wrap { position:relative; width:100vw; height:100vh; height:100dvh; display:flex; flex-direction:column; background:radial-gradient(1200px 700px at 50% -10%, rgba(124,92,255,0.14), transparent 60%), #0a0e1a; }

  .home-btn { position:absolute; top:14px; left:14px; z-index:30; width:42px; height:42px; border-radius:50%; background:rgba(255,255,255,0.08); border:2px solid #7c5cff; color:#e7ecf7; font-size:19px; display:flex; align-items:center; justify-content:center; text-decoration:none; cursor:pointer; box-shadow:0 4px 10px rgba(0,0,0,0.4); }
  .home-btn:hover { filter:brightness(1.25); }

  #hud { padding: 14px 64px 6px; text-align:center; flex-shrink:0; }
  #hud .level { font-size:13px; font-weight:700; letter-spacing:0.1em; color:#93a0bf; }
  #hud .levelNum { font-size:24px; font-weight:800; color:#7c5cff; }
  #hud .category { margin-top:2px; font-size:15px; font-weight:700; color:#ffd25a; letter-spacing:0.03em; }

  #topRight { position:absolute; top:14px; right:14px; z-index:30; display:flex; gap:8px; align-items:center; }
  #mistakes { font-size:12px; font-weight:700; color:#ff8a8a; background:rgba(255,93,93,0.12); border:1px solid rgba(255,93,93,0.3); border-radius:20px; padding:6px 12px; }
  #hintBtn { width:38px; height:38px; border-radius:50%; border:2px solid #ffd25a; background:rgba(255,210,90,0.1); color:#ffd25a; font-size:17px; cursor:pointer; }
  #hintBtn:hover { filter:brightness(1.2); }

  #hintBanner { position:absolute; top:66px; left:50%; transform:translateX(-50%); max-width:min(88vw,420px); background:#1c1430; border:1px solid #7c5cff; border-radius:12px; padding:10px 16px; font-size:14px; text-align:center; color:#d8cfff; z-index:25; opacity:0; pointer-events:none; transition:opacity 0.25s; }
  #hintBanner.show { opacity:1; }

  #tray { flex:1; display:flex; flex-wrap:wrap; align-content:center; justify-content:center; gap:14px; padding: 10px 16px; min-height:0; overflow:auto; }

  .card { width:78px; height:78px; border-radius:16px; background:linear-gradient(160deg,#1c2440,#141a30); border:2px solid #2c3660; display:flex; align-items:center; justify-content:center; text-align:center; font-size:34px; line-height:1.1; padding:6px; cursor:grab; box-shadow:0 6px 14px rgba(0,0,0,0.4); user-select:none; touch-action:none; transition:transform 0.15s, box-shadow 0.15s; }
  .card.text { font-size:14px; font-weight:700; }
  .card:active { cursor:grabbing; }
  .card.dragging { box-shadow:0 14px 28px rgba(0,0,0,0.6); transform:scale(1.08); z-index:1000; }
  .card.placed { opacity:0; transform:scale(0.4); pointer-events:none; }
  .card.shake { animation: shakeCard 0.35s; }
  @keyframes shakeCard { 0%,100%{transform:translateX(0);} 20%{transform:translateX(-8px);} 40%{transform:translateX(8px);} 60%{transform:translateX(-6px);} 80%{transform:translateX(6px);} }

  #boxes { display:flex; gap:12px; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); flex-shrink:0; }
  .box { flex:1; min-height:120px; border-radius:16px; border:2px dashed #33406e; background:rgba(255,255,255,0.02); display:flex; flex-direction:column; align-items:center; padding:10px; transition:background 0.2s, border-color 0.2s; }
  .box .label { font-size:15px; font-weight:800; letter-spacing:0.06em; color:#93a0bf; margin-bottom:8px; }
  .box .solved { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; }
  .box .solved span { font-size:22px; }
  .box.hover { border-color:#7c5cff; background:rgba(124,92,255,0.08); }
  .box.flash-good { border-color:#3ddc84; background:rgba(61,220,132,0.15); }
  .box.flash-bad { border-color:#ff5d5d; background:rgba(255,93,93,0.15); }

  #overlay { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; background:rgba(10,14,26,0.92); z-index:40; padding:24px; }
  #overlay.hidden { display:none; }
  #overlay h1 { font-size:26px; margin:0 0 10px; color:#7c5cff; }
  #overlay p { max-width:360px; color:#93a0bf; font-size:15px; line-height:1.5; margin:0 0 18px; }
  #overlay .rule { font-size:20px; font-weight:800; color:#ffd25a; margin-bottom:10px; }
  #overlay .explain { max-width:380px; color:#c8d0e0; font-size:14px; line-height:1.5; margin-bottom:10px; }
  #overlay .stars { font-size:30px; margin-bottom:14px; letter-spacing:4px; }
  button.play { font-size:19px; padding:12px 32px; border-radius:40px; border:none; background:linear-gradient(135deg,#9c7bff,#7c5cff); color:#150a30; font-weight:800; cursor:pointer; box-shadow:0 6px 18px -6px rgba(124,92,255,0.7); }
