:root {
  --bg: #000;
  --fg: #fff;
  --dim: #888;
  --line: #333;
  --sel-bg: #fff;
  --sel-fg: #000;
}

* , *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

.field-row {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 2.5vw, 1.25rem);
  padding: clamp(0.75rem, 4vh, 2rem) 0.5rem;
  border-bottom: 1px solid var(--line);
}

#app {
  justify-content: center;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.value-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  touch-action: none;
}

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.4rem, 2vw, 1rem);
}

.stepper {
  flex: 0 0 auto;
  width: clamp(2rem, 6vw, 2.75rem);
  height: clamp(2rem, 6vw, 2.75rem);
  border-radius: 50%;
  background: #111;
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.75rem;
}

.value-big {
  font-size: clamp(2rem, 9vw, 3.5rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.value-unit {
  font-size: clamp(0.8rem, 3.5vw, 1.4rem);
  color: var(--dim);
}

.value-input {
  color-scheme: dark;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--fg);
  color: var(--fg);
  font-family: inherit;
  font-size: clamp(1.6rem, 7vw, 3rem);
  font-variant-numeric: tabular-nums;
  text-align: center;
  touch-action: manipulation;
  width: min-content;
}

.hidden {
  display: none !important;
}

#rest-summary {
  flex: 0 0 auto;
  text-align: center;
  font-size: 0.9rem;
  color: var(--dim);
  padding-bottom: 0.5rem;
}

#rest-summary span {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

#rest-row {
  display: flex;
  flex: 0 0 auto;
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--line);
}

.rest-col {
  flex: 1;
  text-align: center;
}

.rest-label {
  font-size: 0.75rem;
  color: var(--dim);
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.rest-begin, .rest-end {
  font-size: clamp(0.9rem, 4vw, 1.2rem);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 600px) {
  .field-label { font-size: 1.1rem; }
  .rest-begin, .rest-end { font-size: 1.4rem; }
}
