* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #050507; color: #f3ece6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: manipulation; }
.hidden { display: none !important; }
body.noui .ui { display: none !important; }

#hud {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 0; right: 0;
  display: flex; justify-content: center; gap: 18px; pointer-events: none;
  font-size: 15px; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: rgba(243, 236, 230, .72);
}
#soundHint {
  position: fixed; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); text-align: center;
  font-size: 13px; color: rgba(243, 236, 230, .5); pointer-events: none;
}

#buttons {
  position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; gap: 8px;
}
button {
  font: inherit; color: #f3ece6; background: #e0533f; border: 0; border-radius: 10px;
  padding: 10px 16px; cursor: pointer; font-size: 15px;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: rgba(255, 255, 255, .08); }
button.icon {
  width: 42px; height: 42px; padding: 9px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08);
}
button.icon svg { width: 100%; height: 100%; fill: #f3ece6; display: block; }
button.icon .stroke { fill: none; stroke: #f3ece6; stroke-width: 1.8; stroke-linecap: round; }
#btnSound .off, #btnSound.muted .on { display: none; }
#btnSound.muted .off { display: block; }

#panel {
  position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 54px);
  width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - 90px); overflow-y: auto;
  background: rgba(18, 16, 18, .94); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px;
  padding: 12px 16px 14px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.panelHead { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.close { background: none; padding: 0 4px; font-size: 24px; line-height: 1; color: rgba(243, 236, 230, .6); }
.slider { margin: 10px 0 2px; }
.slider label { display: flex; justify-content: space-between; font-size: 13px; color: rgba(243, 236, 230, .8); margin-bottom: 4px; }
.slider label b { font-weight: 600; color: #ffd84a; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: #e0533f; margin: 0; height: 22px; }
.note { font-size: 12px; color: rgba(243, 236, 230, .45); margin: 10px 0; }
.row { display: flex; gap: 8px; }
.row button { flex: 1; }

#result {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
}
#result .card {
  pointer-events: auto; text-align: center; background: rgba(12, 10, 12, .82); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 18px; padding: 22px 28px; min-width: 240px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: pop .35s ease-out;
}
#result .title { font-size: 24px; font-weight: 700; color: #ffd84a; margin-bottom: 10px; }
#result .stats { font-size: 15px; line-height: 1.6; color: rgba(243, 236, 230, .85); font-variant-numeric: tabular-nums; }
#result .next { font-size: 13px; color: rgba(243, 236, 230, .5); margin: 8px 0 14px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
