:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #17201c;
  --muted: #65726d;
  --line: #d7dfda;
  --accent: #087f5b;
  --accent-strong: #075c43;
  --surface: #e8f2ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Hiragino Sans", sans-serif;
  color: var(--text);
  background:
    linear-gradient(145deg, #eef5f2 0%, #f8faf9 46%, #e8edf5 100%);
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.meter {
  width: min(520px, 100%);
  min-height: min(720px, calc(100vh - 2rem));
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 1.5rem);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 32, 28, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.state {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--accent-strong);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 700;
}

.speed-panel {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 300px;
  border-block: 1px solid var(--line);
}

.speed-value {
  font-size: clamp(5.8rem, 28vw, 10rem);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.speed-unit {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 700;
}

.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0;
}

.details div {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

dt {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.message {
  min-height: 2.8em;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.primary-action {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.primary-action:active {
  background: var(--accent-strong);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

@media (max-width: 420px) {
  .meter {
    min-height: calc(100vh - 2rem);
  }

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

  .speed-panel {
    min-height: 260px;
  }
}
