:root {
  color-scheme: light dark;
  --ink: #24201d;
  --muted: #6b625c;
  --paper: #f7f3ed;
  --card: #fffdf9;
  --line: #ded5cb;
  --accent: #9a4d2d;
  --accent-dark: #71351f;
  --accent-soft: #f0dfd4;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

header {
  max-width: 680px;
  margin-bottom: 28px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font: 700 clamp(2rem, 5vw, 3.25rem)/1.05 Georgia, serif;
  letter-spacing: -.03em;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

a {
  color: var(--accent-dark);
}

.intro,
.hint,
.sources {
  color: var(--muted);
}

.hint,
.sources {
  font-size: .9rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 32px #4b2c1a0d;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr);
  gap: 28px;
  padding: 28px;
}

.dial-wrap {
  display: grid;
  place-items: center;
  min-height: 310px;
  background: var(--paper);
  border-radius: 14px;
}

.dial {
  --rotation: 0deg;
  --micro-rotation: 0deg;
  position: relative;
  width: min(300px, 80vw);
  aspect-ratio: 1;
  border: 18px solid #d4cbc2;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--card) 0 38%, transparent 39%),
    repeating-conic-gradient(from -140deg, #8d8178 0 1deg, transparent 1deg 7deg);
  box-shadow: inset 0 0 0 2px #b9aea5, 0 5px 12px #4b2c1a1a;
  transform: rotate(var(--rotation));
  transition: transform .25s ease;
}

.dial::before {
  position: absolute;
  inset: 23%;
  border: 10px solid var(--accent-soft);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--accent);
  content: "";
}

.dial::after {
  position: absolute;
  top: 3%;
  left: calc(50% - 4px);
  width: 8px;
  height: 48%;
  border-radius: 8px;
  background: var(--accent);
  content: "";
  transform: rotate(140deg);
  transform-origin: 50% 100%;
}

.micro-marker {
  position: absolute;
  inset: 23%;
  z-index: 1;
  transform: rotate(var(--micro-rotation));
  transition: transform .25s ease;
}

.micro-marker::after {
  position: absolute;
  top: 7%;
  left: calc(50% - 2.5px);
  width: 5px;
  height: 35%;
  border-radius: 6px;
  background: var(--accent-dark);
  content: "";
  transform-origin: 50% 100%;
}

.dial-label {
  position: absolute;
  inset: 31%;
  z-index: 2;
  display: grid;
  place-content: center;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 3px 10px #4b2c1a33;
  text-align: center;
  transform: rotate(calc(var(--rotation) * -1));
}

.dial-value {
  display: block;
  color: var(--accent-dark);
  font: 700 clamp(2rem, 8vw, 3rem)/1 Georgia, serif;
}

.controls {
  display: grid;
  align-content: center;
  gap: 22px;
}

label {
  font-weight: 700;
}

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

output {
  color: var(--accent-dark);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.next-adjustments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.next-adjustment {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.next-adjustment span {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

.next-adjustment output {
  font-size: 1.15rem;
}

.next-adjustment small {
  color: var(--muted);
  font-size: .72rem;
}

.reference {
  margin-top: 24px;
  padding: 24px 28px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

thead th {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

tbody th {
  font-weight: 650;
}

.sources {
  margin-top: 24px;
  font-size: .8rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3ece5;
    --muted: #b8aaa0;
    --paper: #211d1a;
    --card: #2d2723;
    --line: #514840;
    --accent: #dc8a65;
    --accent-dark: #f0a17d;
    --accent-soft: #56372c;
  }

  .dial {
    border-color: #5a5049;
    background:
      radial-gradient(circle, var(--card) 0 38%, transparent 39%),
      repeating-conic-gradient(from -140deg, #9c8e84 0 1deg, transparent 1deg 7deg);
    box-shadow: inset 0 0 0 2px #766960, 0 5px 12px #0008;
  }

  .dial::before {
    border-color: #70493b;
  }
}

@media (max-width: 700px) {
  main {
    padding: 28px 0;
  }

  .calculator {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .dial-wrap {
    min-height: 260px;
  }

  .next-adjustments {
    grid-template-columns: 1fr;
  }
}
