:root {
  color-scheme: light;
  --bg: #f3ecdc;
  --ink: #18231b;
  --muted: #5f6b5f;
  --soft: #9a9a91;
  --panel: #fffaf0;
  --line: #cdbfAA;
  --accent: #123f29;
  --accent-strong: #0c2f1e;
  --error: #a13b2d;
  --result-bg: #f1ecde;
  --shadow: 0 12px 32px rgba(47, 35, 19, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(18, 63, 41, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  display: block;
  margin-bottom: 22px;
}

.eyebrow,
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 33px;
  font-weight: 700;
  line-height: 1.08;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-mark {
  display: grid;
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  place-items: center;
  border-radius: 5px;
  background: #efe6d2;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.field span,
.pace-picker span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.section-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

.secondary-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.choice-grid,
.quick-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.choice-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span,
.quick-row button {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}

.field-after-section {
  margin-top: -7px;
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.field input:focus,
.quick-row button:focus,
.submit-button:focus,
.choice input:focus + span {
  outline: 3px solid rgba(23, 107, 77, 0.22);
  outline-offset: 2px;
}

.field input::placeholder {
  color: var(--soft);
  opacity: 0.58;
}

.quick-groups,
.pace-picker {
  display: grid;
  gap: 12px;
}

.quick-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-row[hidden],
.time-group[hidden] {
  display: none;
}

.quick-row button {
  min-height: 34px;
  color: var(--accent-strong);
}

.seconds-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.submit-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.message {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  line-height: 1.45;
}

.message b {
  font-size: 1.12em;
}

.error {
  border: 1px solid rgba(161, 59, 45, 0.28);
  background: #fff1ed;
  color: var(--error);
}

.result-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--result-bg);
  color: var(--ink);
}

.runner-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--accent-strong);
}

.runner-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.runner-icon circle {
  fill: currentColor;
  stroke: none;
}

.result-body {
  display: grid;
  gap: 7px;
  min-width: 0;
  line-height: 1.42;
}

.result-body strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
  color: var(--ink);
}

.result-body span {
  font-size: 14px;
}

.result-body b {
  font-weight: 800;
}

@media (max-width: 820px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 21px;
  }

  .tool-panel {
    padding: 16px;
    gap: 15px;
  }

  .choice-grid,
  .choice-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-row,
  .quick-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .seconds-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .choice span,
  .quick-row button {
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  .quick-row,
  .seconds-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
