* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
  background: #2a160c;
  color: #f6eee0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 70% at 50% 48%, transparent 55%, rgba(12, 5, 2, 0.55) 100%);
}

.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 18px) 20px 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  min-height: 96px;
}

.result-num {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.result-num:empty { display: none; }

.result-text {
  font-size: 17px;
  font-weight: 500;
  color: #e9d8bd;
  margin-top: 6px;
}

.result.pop .result-num { animation: pop 380ms cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.sound {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  right: 14px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(20, 9, 4, 0.45);
  color: #f6eee0;
  display: grid;
  place-items: center;
  pointer-events: auto;
  cursor: pointer;
}
.sound:focus-visible { outline: 2px solid #f6eee0; outline-offset: 2px; }
.sound .cross { display: none; }
.sound[aria-pressed="true"] .wave { display: none; }
.sound[aria-pressed="true"] .cross { display: inline; }

.bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 0 24px calc(env(safe-area-inset-bottom) + 22px);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.hint {
  font-size: 16px;
  color: #f6eee0;
  transition: opacity 400ms;
}
.hint.gone { opacity: 0; }

.history {
  font-size: 14px;
  color: #d9c4a3;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .result.pop .result-num { animation: none; }
}
