:root {
  --bg: #f6f2ea;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --face: #d6d0c8;
  --line: #222;
  --seg-2: #f7d774;
  --seg-3: #f5a524;
  --seg-5: #8fe3cf;
  --label-5: #0f5d4f;
  --label-other: #b7791f;
  --btn-bg: #fff;
  --btn-border: #bbb;
  --primary: #1f6f5c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1d1f;
    --text: #eee;
    --muted: #aaa;
    --face: #3a3a3c;
    --line: #ddd;
    --btn-bg: #2a2b2e;
    --btn-border: #555;
    --label-other: #6b4a12;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; text-align: center; }
h1 { margin: 0 0 12px; font-size: 1.6rem; }

#dial { width: 100%; height: auto; outline: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
/* Block page scroll/zoom on the dial only while dragging, so the page still scrolls otherwise. */
#dial.draggable { cursor: grab; touch-action: none; }
#dial.draggable:active { cursor: grabbing; }
#dial:focus-visible { outline: 2px dashed var(--primary); outline-offset: 4px; }

.face { fill: var(--face); stroke: var(--line); stroke-width: 4; }
.tick { stroke: var(--line); stroke-width: 1.5; }
.tick.major { stroke-width: 3; }
.tick-label { fill: var(--muted); font-size: 11px; text-anchor: middle; dominant-baseline: middle; }
.tick-label.major { fill: var(--text); font-size: 14px; font-weight: 600; }
.base { stroke: var(--line); stroke-width: 4; }

.seg { stroke: rgba(0, 0, 0, 0.15); stroke-width: 1; }
.seg-2 { fill: var(--seg-2); }
.seg-3 { fill: var(--seg-3); }
.seg-5 { fill: var(--seg-5); }
.seg-label { font-size: 22px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.seg-label-5 { fill: var(--label-5); }
.seg-label-3, .seg-label-2 { fill: var(--label-other); }
.needle { stroke: var(--line); stroke-width: 4; stroke-linecap: round; }
.hub { fill: var(--line); }

.readout { margin: 4px 0; font-weight: 600; }
.hint { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }

.hint-touch { display: none; }
@media (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

.nudge { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.nudge[hidden] { display: none; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
button {
  touch-action: manipulation;
  font: inherit;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
}
button:hover { filter: brightness(0.95); }
button[aria-pressed="true"] { background: var(--seg-5); color: #0b3b31; border-color: var(--primary); }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }

.result {
  margin: 24px auto 0;
  max-width: 520px;
  text-align: left;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  padding: 16px 20px;
}
.result h2 { margin: 0 0 12px; font-size: 1.1rem; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; }
.row + .row { border-top: 1px solid var(--btn-border); }
.row ul { margin: 0; padding: 0; list-style: none; line-height: 1.6; }
.side { color: var(--muted); }
.badge {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  color: #222;
}
.badge-2 { background: var(--seg-2); }
.badge-3 { background: var(--seg-3); }
.badge-5 { background: var(--seg-5); }

/* Phones: fewer, larger labels and a 2-column button grid with large tap targets. */
@media (max-width: 600px) {
  main { padding: 16px 12px 32px; }
  h1 { font-size: 1.4rem; margin-bottom: 4px; }
  .tick-label:not(.major) { display: none; }
  .tick-label.major { font-size: 24px; }
  .tick.major { stroke-width: 4; }
  .seg-label { font-size: 30px; }
  .readout { font-size: 1.1rem; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; }
  .nudge button { flex: 1; }
  button { min-height: 48px; padding: 10px 12px; }
  .result { padding: 14px 16px; }
}
