* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body, button, canvas { touch-action: manipulation; }

body {
  background: #080c18;
  color: #e0e8f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

#wrap { padding: 10px; max-width: 980px; width: 100%; }

/* ===== HEADER ===== */
header { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.back { color: #66809f; text-decoration: none; font-size: 1.3rem; line-height: 1; padding: 0 4px; }
.back:hover { color: #9ab8dd; }
#title { font-size: 1.2rem; color: #d89aff; letter-spacing: 1px; font-weight: 700; }
.hstats { display: flex; gap: 16px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.hstat { font-size: 0.9rem; color: #8aa0c0; white-space: nowrap; }
.hstat b { color: #e8eef8; }
.hstat.best b { color: #ffd45e; }
#comboWrap.hot b { color: #ff9040; }

/* ===== CANVAS ===== */
canvas {
  display: block; width: 100%;
  border: 2px solid #241d3a;
  border-radius: 8px;
  background: #0a0a1a;
}

/* ===== VOICE BAR ===== */
#voiceBar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px;
  background: #0e1628;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  padding: 8px 12px;
}
#micDot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #3ad06a; flex-shrink: 0;
  box-shadow: 0 0 8px rgba(58,208,106,0.8);
  animation: pulse 1.6s ease-in-out infinite;
}
#micDot.off { background: #555; box-shadow: none; animation: none; }
#micDot.err { background: #ff5050; box-shadow: 0 0 8px rgba(255,80,80,0.8); animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.45} }

#micMeter {
  width: 90px; height: 8px; flex-shrink: 0;
  background: #0a1020; border-radius: 4px; overflow: hidden;
}
#micLevel { height: 100%; width: 0%; background: linear-gradient(90deg, #3ad06a, #ffd45e); border-radius: 4px; }

#transcript {
  font-size: 0.8rem; color: #66809f;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; font-style: italic;
}
#transcript.hit { color: #ffd45e; font-style: normal; font-weight: 600; }

/* ===== WORD CHIPS ===== */
#chips { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.chip {
  --c: #8aa0c0;
  background: #131e38;
  color: #e0e8f0;
  border: 2px solid var(--c);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}
.chip:hover { transform: translateY(-1px); }
.chip.flash {
  box-shadow: 0 0 18px var(--c);
  transform: scale(1.08);
}
.chip.cooldown { opacity: 0.35; }
.chip .cd { font-size: 0.7rem; color: #ffd45e; margin-left: 4px; }
.chip.special { border-style: dashed; }

/* ===== BOOT OVERLAY ===== */
#bootOverlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #150d28 0%, #050510 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 20; padding: 16px;
}
#bootOverlay.hidden { display: none; }
.bootBox {
  background: linear-gradient(160deg, #1a1230 0%, #0d0a1c 100%);
  border: 1px solid #3a2a58;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  max-width: 540px; width: 100%;
  box-shadow: 0 0 80px rgba(160, 80, 255, 0.12), 0 24px 64px rgba(0,0,0,0.7);
}
.bootLogo { font-size: 3rem; margin-bottom: 6px; filter: drop-shadow(0 0 20px rgba(216,154,255,0.5)); }
.bootBox h2 {
  font-size: 2.2rem; color: #d89aff; letter-spacing: 3px; font-weight: 800;
  text-shadow: 0 0 30px rgba(216,154,255,0.35); margin-bottom: 6px;
}
.bootTag { color: #7a90b8; font-size: 0.86rem; margin-bottom: 18px; }
.bootHow {
  text-align: left;
  background: rgba(0,0,0,0.3);
  border: 1px solid #2a1e48;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 22px;
  display: flex; flex-direction: column; gap: 7px;
  font-size: 0.82rem; color: #9aa8c8; line-height: 1.4;
}
.bootHow b { color: #d8c8f0; }
#btnEnable {
  background: linear-gradient(135deg, #b060ff, #7a30d0);
  color: #fff;
  border: none;
  padding: 14px 36px;
  font-size: 1.05rem; font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 24px rgba(160, 80, 255, 0.35);
  transition: all 0.15s;
}
#btnEnable:hover { transform: translateY(-2px); box-shadow: 0 6px 32px rgba(160, 80, 255, 0.5); }
.small { margin-top: 14px; font-size: 0.72rem; color: #5a6a8a; }

/* ===== MOBILE ===== */
@media (max-width: 700px) {
  #wrap { padding: 6px; }
  #title { font-size: 1rem; }
  .hstat { font-size: 0.75rem; }
  .hstats { gap: 10px; }
  .chip { padding: 9px 13px; font-size: 0.85rem; flex: 1; text-align: center; }
  .bootBox { padding: 24px 20px; }
  .bootBox h2 { font-size: 1.7rem; }
  .bootHow { font-size: 0.74rem; }
  #btnEnable { width: 100%; padding: 14px 20px; }
}
