.tool-hero {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(48px, 8vh, 96px) var(--gutter) 0;
}

.tool-hero h1 { max-width: 15em; font-size: clamp(36px, 4.6vw, 58px); }

.tool-hero .lede { margin-top: 16px; }

.tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  margin-top: clamp(28px, 5vh, 48px);
  padding: 20px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: var(--fill);
}

.tool-editor { display: flex; flex-direction: column; min-width: 0; }

.tool textarea {
  width: 100%;
  min-height: 300px;
  flex: 1;
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  resize: vertical;
}

.tool textarea:focus-visible,
.tool input:focus-visible + span,
.button:focus-visible,
.stage button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.tool-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.link-button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tool-settings { display: flex; flex-direction: column; gap: 22px; }

.tool fieldset { border: 0; }

.tool legend,
.setting-label {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.setting-label output { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.segments { display: grid; gap: 6px; }

.segments label { position: relative; cursor: pointer; }

.segments input { position: absolute; opacity: 0; }

.segments span {
  display: block;
  padding: 11px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  color: var(--body);
  font-size: 16px;
  font-weight: 500;
}

.segments input:checked + span { border-color: var(--text); background: var(--fill-strong); color: var(--text); }
.segments input:disabled + span { opacity: 0.4; cursor: not-allowed; }

.follow-note { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.4; }

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

.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.toggle input { width: 20px; height: 20px; accent-color: var(--text); }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--text-inverse);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled { opacity: 0.4; cursor: not-allowed; }

.button-quiet { background: var(--fill-strong); color: var(--text); }

.tool-start { width: 100%; margin-top: auto; }

.tool-meta-row { flex-wrap: wrap; }

.sample-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: 15px; }

.sample-row .link-button { color: var(--text); font-size: 15px; }

.sample-label,
.segments span { display: flex; align-items: center; gap: 8px; }

.sample-label { gap: 6px; }

.seg-icon,
.sample-icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sample-icon { width: 16px; height: 16px; }

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

.segments output { color: inherit; }

.result-time {
  font-size: clamp(44px, 5vw, 60px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-note,
.result-silent { margin-top: 8px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }

.result-silent strong { color: var(--text); font-weight: 600; }

.count-field { display: flex; align-items: center; gap: 8px; }

.count-field input {
  width: 96px;
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.tool-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }

.pace-how { margin-top: 8px; color: var(--muted); font-size: 16px; line-height: 1.45; }

.pace-passage {
  margin-top: 16px;
  color: var(--body);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.55;
  transition: color 0.2s linear;
}

.pace-test.is-timing .pace-passage { color: var(--text); }

.pace-controls { display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; }

.pace-status { min-height: 1.4em; color: var(--muted); font-size: 16px; line-height: 1.4; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .tool { grid-template-columns: minmax(0, 1fr); padding: 14px; border-radius: 20px; }
  .tool textarea { min-height: 220px; }
}

.tool-stack { grid-template-columns: minmax(0, 1fr); }

.timer-lines {
  grid-column: 1 / -1;
  list-style: none;
  border-top: 1px solid var(--hairline);
}

.timer-lines:empty { display: none; }

.timer-lines li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 16px;
  line-height: 1.45;
}

.timer-at { color: var(--muted); font-variant-numeric: tabular-nums; }

.timer-mark { color: var(--text); font-weight: 600; background: var(--fill-strong); border-radius: 10px; padding-inline: 10px !important; }

.answer { max-width: 36em; margin-top: 20px; color: var(--body); font-size: clamp(19px, 1.7vw, 22px); line-height: 1.45; }

.answer strong { color: var(--text); }

.sample-script {
  margin-top: 20px;
  padding: 20px 24px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--fill);
}

.sample-script p:first-child { margin-top: 0; }

.spin { justify-items: start; gap: 20px; padding: clamp(20px, 4vw, 40px); }

.spin-topic {
  min-height: 2.3em;
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-wrap: balance;
}

.spin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

.practice-row { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

.practice-light {
  width: 18px;
  height: 18px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--fill-strong);
  transition: background 0.2s linear;
}

.practice-light[data-light="green"] { background: #34c759; }
.practice-light[data-light="amber"] { background: #ff9f0a; }
.practice-light[data-light="red"] { background: #ff3b30; }

.practice-note { color: var(--muted); font-size: 15px; }

.topic-group { margin-top: 40px; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }

.prose .topic-list { margin-top: 12px; list-style: none; columns: 2 280px; column-gap: 32px; }

.prose .topic-list li { break-inside: avoid; padding: 10px 0; border-top: 1px solid var(--hairline); }

.prose > .topic-list { max-width: 900px; }

.filler-preview { margin-top: 16px; color: var(--body); font-size: 17px; line-height: 1.6; white-space: pre-wrap; }

.filler-preview mark { padding: 0 2px; border-radius: 4px; background: #ffe58a; color: #000; }

.filler-counts { display: flex; flex-direction: column; gap: 8px; list-style: none; font-size: 16px; }

.tool .mirror-input { min-height: 120px; flex: none; }

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

.mirror-value { min-height: 1.5em; font-size: 20px; line-height: 1.4; word-break: break-word; }

.mirror-glass { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; border-radius: 16px; background: #000; color: #fff; box-shadow: 0 0 0 1px var(--hairline); }

.mirror-glass .setting-label { color: #8e8e93; }

.mirror-preview { transform: scaleX(-1); align-self: stretch; text-align: right; font-size: clamp(24px, 3vw, 36px); font-weight: 600; word-break: break-word; }

.mirror-glass .button { background: #fff; color: #000; }

@media (max-width: 600px) {
  .spin-topic { min-height: 3.45em; }
}

@media (max-width: 860px) {
  .mirror-outputs { grid-template-columns: minmax(0, 1fr); }
}

.sample-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.tool-app { width: 100%; }

.button[hidden] { display: none; }
