:root {
  --ink: #f6f8ed;
  --muted: #9aa49a;
  --panel: rgba(15, 25, 27, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --lime: #c8ff3d;
  --cyan: #36e4e0;
  --orange: #ff8a3d;
}

* { box-sizing: border-box; }

[hidden], .hidden { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: #071011;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button { font: inherit; }

.meter-shell {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, #152b2d 0, #0a1718 42%, #071011 72%);
  background-size: 72px 72px, 72px 72px, auto;
}

.meter-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at center, transparent 0 25%, rgba(7,16,17,.44) 72%);
  pointer-events: none;
}

.ambient {
  position: absolute;
  z-index: -1;
  width: 32rem;
  height: 32rem;
  border-radius: 999px;
  filter: blur(110px);
  opacity: .13;
  pointer-events: none;
}

.ambient-a { top: -14rem; left: -8rem; background: var(--cyan); }
.ambient-b { right: -10rem; bottom: -16rem; background: var(--lime); }

.topbar, .footer {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(24px, 4vw, 64px);
}

.topbar { border-bottom: 1px solid var(--line); }

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .16em;
}

.wordmark-dot, .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--lime);
  box-shadow: 0 0 18px rgba(200, 255, 61, .9);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: #cdd5cc;
  background: rgba(255,255,255,.035);
  font-size: 12px;
}

.status-dot { width: 7px; height: 7px; }

.status-idle .status-dot { background: #738078; box-shadow: none; }
.status-requesting .status-dot { background: var(--orange); box-shadow: 0 0 18px rgba(255,138,61,.8); animation: pulse 1s ease-in-out infinite; }
.status-measuring { border-color: rgba(200,255,61,.34); color: var(--ink); }
.status-error { border-color: rgba(255,138,61,.3); color: #ffb07b; }
.status-error .status-dot { background: var(--orange); box-shadow: 0 0 18px rgba(255,138,61,.75); }

@keyframes pulse {
  50% { opacity: .35; transform: scale(.72); }
}

.meter-stage {
  width: min(920px, calc(100% - 36px));
  margin: auto;
  padding: 44px 0 34px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(46px, 7.2vw, 96px);
  line-height: .93;
  letter-spacing: -.065em;
  font-weight: 870;
}

.lead {
  max-width: 570px;
  margin: 22px auto 30px;
  color: var(--muted);
  font-size: clamp(15px, 1.8vw, 19px);
  line-height: 1.55;
}

.meter-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(22px, 3vw, 34px);
  background: linear-gradient(150deg, rgba(26, 42, 43, .92), rgba(8, 17, 18, .88));
  box-shadow: 0 30px 90px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.055);
  transition: border-color .3s ease, box-shadow .3s ease;
}

.phase-measuring .meter-card {
  border-color: rgba(200,255,61,.32);
  box-shadow: 0 30px 100px rgba(0,0,0,.42), 0 0 70px rgba(200,255,61,.06), inset 0 1px rgba(255,255,255,.065);
}

.phase-measuring h1 { color: #f5ffd5; }

.meter-card::after {
  content: "";
  position: absolute;
  right: -20%;
  bottom: -90%;
  width: 70%;
  height: 150%;
  transform: rotate(-12deg);
  background: rgba(54, 228, 224, .045);
  pointer-events: none;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 24px;
}

.score-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
}

.score-label-right { text-align: right; }

.score { display: flex; align-items: baseline; gap: 8px; }
.score strong { font-size: clamp(44px, 6vw, 76px); line-height: 1; letter-spacing: -.06em; }
.score span { color: var(--lime); font-size: 16px; font-weight: 800; }

.bars {
  display: flex;
  height: clamp(120px, 21vw, 210px);
  align-items: end;
  justify-content: center;
  gap: clamp(4px, .72vw, 9px);
  border-bottom: 1px solid rgba(255,255,255,.14);
  padding: 0 4px 10px;
}

.bar {
  width: min(28px, 4.25%);
  height: var(--bar-height);
  min-height: 7%;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(to top, var(--cyan) 0 48%, var(--lime) 74%, #f1ff8a 100%);
  box-shadow: 0 0 18px rgba(54,228,224,.12);
  transform-origin: bottom;
  animation: breathe 1.65s ease-in-out infinite alternate;
  animation-delay: var(--bar-delay);
  transition: height 80ms linear, opacity .3s ease;
}

.phase-listening .bar,
.phase-measuring .bar,
.phase-result .bar { animation: none; }

@keyframes breathe {
  from { transform: scaleY(.72); opacity: .72; }
  to { transform: scaleY(1); opacity: 1; }
}

.scale {
  display: flex;
  justify-content: space-between;
  margin-top: 13px;
  color: #76817a;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 265px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  padding: 17px 26px;
  background: var(--lime);
  color: #0b160c;
  box-shadow: 0 15px 50px rgba(200,255,61,.18);
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.start-button:hover { transform: translateY(-2px); box-shadow: 0 18px 56px rgba(200,255,61,.27); }
.start-button:focus-visible { outline: 3px solid white; outline-offset: 4px; }

.mic-icon {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 9px;
  color: transparent;
}

.mic-icon::before { content: ""; position: absolute; left: 50%; bottom: -6px; width: 9px; height: 6px; transform: translateX(-50%); border: 2px solid #0b160c; border-top: 0; border-radius: 0 0 8px 8px; }

.privacy-note { margin: 12px 0 0; color: #6f7a73; font-size: 11px; }

.error-copy { color: #ffb07b; }

.loading-note {
  display: flex;
  min-height: 57px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  color: #cdd5cc;
  font-size: 13px;
  font-weight: 700;
}

.loading-note span {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--orange);
  box-shadow: 0 0 18px rgba(255,138,61,.8);
  animation: pulse 1s ease-in-out infinite;
}

.has-result .score-row,
.has-result .bars,
.has-result .scale { opacity: .08; }

.result-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(19,42,38,.94), rgba(7,16,17,.92));
  animation: result-in .42s cubic-bezier(.2,.85,.2,1) both;
}

@keyframes result-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

.result-kicker {
  color: var(--lime);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 0;
}

.result-score strong { font-size: clamp(62px, 9vw, 112px); line-height: 1; letter-spacing: -.075em; }
.result-score span { color: var(--lime); font-size: 18px; font-weight: 850; }
.result-panel h2 { margin: 5px 0 0; font-size: clamp(22px, 3.5vw, 38px); letter-spacing: -.035em; }
.result-panel p { margin: 7px 0 0; color: var(--muted); font-size: clamp(12px, 1.6vw, 15px); }

.reset-track {
  width: min(220px, 55%);
  height: 3px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
}

.reset-track span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  background: var(--lime);
  animation: reset-countdown 5s linear forwards;
}

@keyframes reset-countdown { to { transform: scaleX(0); } }

.footer {
  border-top: 1px solid var(--line);
  color: #667068;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.footer-mark { color: #89938c; font-weight: 800; }

@media (max-width: 640px) {
  .topbar { padding: 18px 20px; }
  .status-pill { font-size: 0; padding: 10px; }
  .meter-stage { padding-top: 32px; }
  .score-row { grid-template-columns: 1fr auto; }
  .score { justify-self: start; }
  .score-label:first-child { display: none; }
  .score-label-right { grid-column: 2; grid-row: 1; align-self: end; padding-bottom: 8px; }
  .bars { gap: 4px; }
  .bar { width: 4%; }
  .footer { padding: 18px 20px; }
  .footer > span:first-child { display: none; }
  .footer-mark { margin-left: auto; }
}

@media (max-height: 780px) and (min-width: 700px) {
  .topbar, .footer { padding-top: 18px; padding-bottom: 18px; }
  .meter-stage { padding: 22px 0; }
  h1 { font-size: clamp(44px, 6.2vw, 72px); }
  .lead { margin-top: 14px; margin-bottom: 20px; }
  .bars { height: 130px; }
  .meter-card { padding-top: 20px; padding-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar { animation: none; }
  .start-button { transition: none; }
  .result-panel, .reset-track span, .status-requesting .status-dot, .loading-note span { animation: none; }
}
