.confetti-piece { position: absolute; top: -10px; width: 8px; height: 14px; opacity: .9; animation: confettiFall linear forwards; }
  @keyframes confettiFall { to { transform: translateY(110vh) rotate(540deg); opacity: 0; } }

  /* ── Tray ── */
  .pb-tray-wrap { flex-shrink: 0; padding: 10px 0 4px; }
  .pb-tray { display: flex; justify-content: center; gap: 12px; }
  .pb-piece-slot {
    width: 92px; height: 92px; border-radius: 14px;
    background: var(--surface); border: 1.5px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    position: relative; touch-action: none; box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: opacity .15s; overflow: hidden;
  }
  .pb-piece-slot.empty { opacity: .25; }
  .pb-piece-slot.dragging { opacity: .3; }
  .pb-piece-slot.no-fit { opacity: .45; filter: grayscale(.85); }
  .pb-piece-slot.no-fit::after {
    content: '🔒'; position: absolute; top: 2px; right: 4px; font-size: 12px;
    filter: none; opacity: .8;
  }
  .pb-piece-grid { display: grid; pointer-events: none; }
  .pb-piece-cell {
    border-radius: 3px;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.4), inset 0 -2px 0 rgba(0,0,0,.15);
  }

  .pb-ghost {
    position: fixed; pointer-events: none; z-index: 500; display: grid;
    filter: drop-shadow(0 8px 14px rgba(0,0,0,.32));
  }
  .pb-ghost .pb-piece-cell { border-radius: 5px; }

  /* ── HUD ── */
  .hud {
    flex-shrink: 0;
    width: calc(100% - 24px); max-width: 456px;
    margin: 0 auto calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0,0,0,.13);
    border-radius: 18px;
    padding: 6px 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    overflow: hidden;
    z-index: 100;
  }
  .hud-stats { display: flex; gap: 12px; flex-shrink: 0; }
  .hud .stat { text-align: center; line-height: 1; }
  .hud .stat-val { font-size: 1rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; display: inline-block; }
  .hud .stat-val.bump { animation: statBump .32s cubic-bezier(.34,1.56,.64,1); }
  @keyframes statBump { 0% { transform: scale(1); } 45% { transform: scale(1.32); } 100% { transform: scale(1); } }
  .hud .stat-val.score { color: var(--accent); }
  .hud .stat-val.best { color: var(--success); }
  .hud .stat-lbl { font-size: 7px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 1px; }
  .hud-btns { display: flex; justify-content: flex-end; align-items: center; gap: 4px; flex-wrap: nowrap; min-width: 0; }
  .btn {
    padding: 5px 8px; border: 1px solid var(--line);
    background: var(--surface); color: var(--muted);
    font-family: 'Sora', sans-serif; font-size: 9px; font-weight: 700;
    border-radius: 999px; cursor: pointer; transition: all .15s;
    letter-spacing: .2px; text-transform: uppercase; white-space: nowrap;
  }
  .btn:hover { border-color: var(--accent); color: var(--ink); background: #fffbeb; }
  .btn:active { transform: scale(.88); }
  .btn-new { color: var(--accent2); border-color: rgba(232,93,63,.3); }

  /* ── Name gate ── */
  .namegate-overlay {
    display: none; position: fixed; inset: 0; z-index: 400;
    background: rgba(15,23,42,.72); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
  }
  .namegate-overlay.show { display: flex; }
  .namegate-card {
    background: var(--surface); border-radius: 18px; padding: 26px 22px;
    max-width: 340px; width: 100%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
  }
  .namegate-logo { max-height: 50px; margin-bottom: 10px; }
  .namegate-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
  .namegate-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
  .namegate-input {
    width: 100%; padding: 12px 14px; border-radius: 10px;
    border: 1.5px solid var(--line); font-family: 'Sora', sans-serif;
    font-size: 15px; font-weight: 700; text-align: center; color: var(--ink);
    margin-bottom: 8px;
  }
  .namegate-input:focus { outline: none; border-color: var(--accent); }
  .namegate-input.shake-input { animation: shake .3s; border-color: var(--danger); }
  .namegate-error { font-size: 12px; font-weight: 700; color: var(--danger); min-height: 16px; margin-bottom: 6px; opacity: 0; transition: opacity .2s; }
  .namegate-error.show { opacity: 1; }
  @keyframes shake { 25%{transform:translateX(-5px)} 50%{transform:translateX(5px)} 75%{transform:translateX(-3px)} }

  .board-wrap.shake { animation: boardShake .28s; }
  @keyframes boardShake { 20%{transform:translateX(-4px)} 40%{transform:translateX(4px)} 60%{transform:translateX(-3px)} 80%{transform:translateX(3px)} 100%{transform:translateX(0)} }

  @media (max-width: 640px) {
    .pb-card { --bpad: 7px; border-radius: 12px; }
    .pb-cell { border-radius: 4px; }
    .hud { border-radius: 16px; }
    .pb-piece-slot { width: 80px; height: 80px; }
  }
