:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --ink: #172018;
  --muted: #61705f;
  --panel: #ffffff;
  --line: #d9dfd4;
  --accent: #0d7f67;
  --accent-strong: #075947;
  --warn: #c0392b;
  --gold: #e4b34a;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(13, 127, 103, 0.08), transparent 38%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.counter-panel,
.settings-panel,
.alarm-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(23, 32, 24, 0.08);
}

.counter-panel {
  padding: 22px;
}

.settings-panel {
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.2rem, 12vw, 4.5rem);
}

h2 {
  font-size: 2rem;
}

.mic-state {
  min-width: 78px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #eef2eb;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 750;
}

.mic-state.active {
  background: rgba(13, 127, 103, 0.12);
  color: var(--accent-strong);
}

.count-display {
  margin: 28px 0 20px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  font-weight: 900;
  line-height: 1;
}

#currentCount {
  font-size: clamp(6rem, 34vw, 13rem);
}

.divider,
#targetCount {
  color: var(--muted);
  font-size: clamp(2.2rem, 12vw, 5rem);
}

.target-row {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  align-items: end;
  gap: 10px;
}

.target-row label,
.setting label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.target-row input,
.setting select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfa;
  font-size: 1.1rem;
  font-weight: 800;
}

.icon-button {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 8px;
  background: #e8eee4;
  color: var(--accent-strong);
  font-size: 2rem;
  font-weight: 700;
}

.meter-wrap {
  margin-top: 22px;
}

.meter-labels,
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.meter-labels {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.meter {
  height: 14px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee4;
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--warn));
  transition: width 120ms linear;
}

.signal-readout {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 76px 0.55fr;
  gap: 10px;
  margin-top: 22px;
}

.primary,
.secondary {
  min-height: 54px;
  border-radius: 8px;
  border: 0;
  font-weight: 850;
}

.primary {
  color: #fff;
  background: var(--accent);
}

.secondary {
  color: var(--accent-strong);
  background: #e8eee4;
}

.compact {
  min-height: 44px;
  padding: 0 14px;
}

.button-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(100%, 210px);
}

.setting + .setting {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.setting p {
  max-width: 34ch;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.setting input[type="range"] {
  width: min(42vw, 220px);
  accent-color: var(--accent);
}

.setting select {
  width: 118px;
}

.status-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-list div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #aab5a7;
}

.dot.live {
  background: var(--accent);
}

.dot.hot {
  background: var(--warn);
}

.alarm-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 24, 0.48);
}

.alarm-modal[hidden] {
  display: none;
}

.alarm-card {
  width: min(100%, 390px);
  padding: 24px;
}

.alarm-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 480px) {
  .app-shell {
    padding: 14px;
    align-content: stretch;
  }

  .counter-panel {
    padding: 18px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .setting {
    align-items: flex-start;
    flex-direction: column;
  }

  .setting input[type="range"],
  .setting select {
    width: 100%;
  }

  .button-pair {
    width: 100%;
  }
}
