:root {
  --bg: #FFFFFF;
  --raised: #F7F7F5;
  --text: #0A0A0A;
  --secondary: #46464B;
  --caption: #6E6E73;
  --line: #E2E2DE;
  --btn-bg: #0A0A0A;
  --btn-text: #FFFFFF;
  --error: #E5484D;
  --dot-faint: rgba(10, 10, 10, 0.08);
  --listen: #8B6BFF;
  --speak: #5B32D6;
  --sans: "Host Grotesk", "Noto Sans Ethiopic", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  color-scheme: light;
}

:root.dark {
  --bg: #0A0A0A;
  --raised: #141416;
  --text: #F2F2EF;
  --secondary: #8A8A8F;
  --caption: #8A8A8F;
  --line: #2A2A2E;
  --btn-bg: #F2F2EF;
  --btn-text: #0A0A0A;
  --dot-faint: rgba(242, 242, 239, 0.08);
  --listen: #B9A4FF;
  --speak: #8B6BFF;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: var(--tg-viewport-stable-height, 100vh);
  min-height: 100%;
  padding: var(--top) 16px var(--bottom);
}

.bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  font-size: 13px;
  color: var(--secondary);
}

.timer {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 0;
}

.wave {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 32 / 9;
}

.message {
  margin: 0;
  max-width: 320px;
  text-align: center;
  font-weight: 300;
  font-size: 16px;
  line-height: 26px;
  color: var(--secondary);
}

.message.error { color: var(--error); }

.controls {
  padding-block: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.left {
  margin: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--caption);
  font-variant-numeric: tabular-nums;
}

.buttons {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn.primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: var(--btn-bg);
  font-weight: 700;
}

.btn.danger {
  color: var(--error);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
