:root {
  color-scheme: light;
  --background: #f7f8f3;
  --surface: #ffffff;
  --text: #162018;
  --muted: #5d6b61;
  --border: #d9dfd4;
  --start: #2f6b4f;
  --start-active: #25583f;
  --stop: #b6483d;
  --stop-active: #96362d;
  --reset: #e5aa3a;
  --reset-active: #c89025;
  --shadow: 0 18px 48px rgba(35, 47, 38, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.12), rgba(229, 170, 58, 0.16)),
    var(--background);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans TC",
    "PingFang TC",
    sans-serif;
  letter-spacing: 0;
}

button {
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  min-height: 58px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button:focus-visible {
  outline: 3px solid rgba(47, 107, 79, 0.32);
  outline-offset: 3px;
}

.app-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100svh;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.counter-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 430px;
  padding: 30px 24px 26px;
  text-align: center;
  width: min(100%, 430px);
}

.eyebrow {
  color: var(--start);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 12vw, 3.25rem);
  line-height: 1;
  margin: 0;
}

.counter-readout {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 34px 0 8px;
  min-height: 104px;
}

#counter-value {
  font-variant-numeric: tabular-nums;
  font-size: clamp(5rem, 28vw, 7.8rem);
  font-weight: 850;
  line-height: 0.9;
  min-width: 2ch;
}

.counter-unit {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 700;
}

.status-text {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 26px;
  min-height: 1.5em;
}

.controls {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.action-button {
  font-size: 1.08rem;
  font-weight: 800;
  padding: 0 12px;
}

.start-button {
  background: var(--start);
}

.start-button:active {
  background: var(--start-active);
}

.stop-button {
  background: var(--stop);
}

.stop-button:active {
  background: var(--stop-active);
}

.reset-button {
  background: var(--reset);
  color: #211709;
}

.reset-button:active {
  background: var(--reset-active);
}

@media (max-width: 359px) {
  .counter-panel {
    padding-inline: 16px;
  }

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