/* Macro cycle, restyled on the RaveGang design system.
   Dark only by doctrine: planes separate by fill, never by shadow.
   Chrome is ember; the five meaning colors are a language, not decoration.
   This file is excluded from the copy scans; everything visual lives here. */

/* ---------------------------------------------------------------- fonts */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/space-grotesk.woff2") format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/space-mono.woff2") format("woff2");
}

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: dark;

  /* chrome */
  --rg-ember: #FF6B00;
  --rg-on-ember: #1A0800;

  /* surfaces */
  --rg-bg: #0B0B0F;
  --rg-surface: #14141A;
  --rg-surface-high: #1D1D26;

  /* ink */
  --rg-text: #E8E8EC;
  --rg-text-dim: #B0B0BE;

  /* meaning */
  --rg-lime: #B4FF39;
  --rg-cyan: #6EE7F2;
  --rg-cold: #FF9D42;
  --rg-magenta: #FF4FD8;
  --rg-violet: #9D6CFF;
  --rg-error: #FF5470;

  --rg-outline: rgb(176 176 190 / 0.45);
  --rg-selected: rgb(255 107 0 / 0.14);
  --rg-dash: rgb(176 176 190 / 0.6);
  --rg-dash-soft: rgb(176 176 190 / 0.4);

  /* spacing (4px grid) */
  --rg-space-xs: 4px;
  --rg-space-sm: 8px;
  --rg-space-md: 12px;
  --rg-space-lg: 16px;
  --rg-space-xl: 24px;
  --rg-space-xxl: 32px;
  --rg-edge: 20px;
  --rg-touch: 48px;

  /* geometry */
  --rg-radius-pill: 999px;
  --rg-radius-dialog: 14px;
  --rg-radius-row: 12px;
  --rg-radius-banner: 8px;
  --rg-radius-badge: 4px;
  --rg-radius-tick: 2px;
  --rg-radius-field: 4px;

  /* type */
  --rg-font: "Space Grotesk", system-ui, sans-serif;
  --rg-font-mono: "Space Mono", ui-monospace, monospace;
  --rg-title-lg-size: 24px;
  --rg-title-lg-weight: 700;
  --rg-title-lg-tracking: 0.5px;
  --rg-title-md-size: 17px;
  --rg-title-md-weight: 600;
  --rg-title-md-tracking: 0.2px;
  --rg-title-sm-size: 14px;
  --rg-title-sm-weight: 600;
  --rg-body-lg-size: 16px;
  --rg-body-lg-line: 22px;
  --rg-body-md-size: 14px;
  --rg-body-md-line: 20px;
  --rg-body-sm-size: 12.5px;
  --rg-body-sm-line: 17px;
  --rg-label-lg-size: 14px;
  --rg-label-lg-weight: 600;
  --rg-label-lg-tracking: 0.8px;
  --rg-label-sm-size: 11px;
  --rg-label-sm-weight: 600;
  --rg-label-sm-tracking: 0.6px;
  --rg-numeric: tabular-nums slashed-zero;

  /* motion: response, not rhythm */
  --rg-dur-ui: 180ms;
  --rg-ease-ui: cubic-bezier(0.2, 0, 0, 1);
}

/* ---------------------------------------------------------------- base */

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

html { background: var(--rg-bg); }

body {
  margin: 0;
  background: var(--rg-bg);
  color: var(--rg-text);
  font-family: var(--rg-font);
  font-size: var(--rg-body-md-size);
  line-height: var(--rg-body-md-line);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

a { color: var(--rg-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
a:active { opacity: 0.7; }
::selection { background: var(--rg-ember); color: var(--rg-on-ember); }

[hidden] { display: none !important; }

.rg-num { font-variant-numeric: var(--rg-numeric); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--rg-edge);
  top: -100px;
  z-index: 10;
  padding: var(--rg-space-md) var(--rg-space-xl);
  border-radius: var(--rg-radius-pill);
  background: var(--rg-ember);
  color: var(--rg-on-ember);
  font-size: var(--rg-label-lg-size);
  font-weight: var(--rg-label-lg-weight);
  letter-spacing: var(--rg-label-lg-tracking);
}
.skip:focus { top: var(--rg-space-md); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--rg-ember);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- layout */

main, .masthead, footer {
  max-width: 520px;
  margin: 0 auto;
  padding-left: var(--rg-edge);
  padding-right: var(--rg-edge);
}

.masthead {
  display: flex;
  align-items: center;
  gap: var(--rg-space-md);
  padding-top: var(--rg-space-lg);
}
.masthead .mark { flex: none; }
.masthead h1 {
  margin: 0;
  font-size: var(--rg-title-lg-size);
  font-weight: var(--rg-title-lg-weight);
  letter-spacing: var(--rg-title-lg-tracking);
  text-transform: uppercase;
  color: var(--rg-ember);
}
.tagline {
  margin: 0;
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

main {
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xl);
  padding-top: var(--rg-space-xl);
  padding-bottom: var(--rg-space-xl);
}

section h2 {
  margin: 0 0 var(--rg-space-md);
  font-size: var(--rg-title-md-size);
  font-weight: var(--rg-title-md-weight);
  letter-spacing: var(--rg-title-md-tracking);
}

section > p { margin: 0 0 var(--rg-space-sm); }
section > p:last-child { margin-bottom: 0; }

footer {
  border-top: 1px solid var(--rg-surface-high);
  margin-top: var(--rg-space-sm);
  padding-top: var(--rg-space-lg);
  padding-bottom: 40px;
}
footer p {
  margin: 0;
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

.hint {
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}
p.hint { margin: var(--rg-space-xs) 0 0; }

.empty {
  margin: 0;
  color: var(--rg-text-dim);
}

/* ---------------------------------------------------------------- fields */

.field { margin-bottom: var(--rg-space-lg); }
.field:last-child { margin-bottom: 0; }

.field label,
.field .label,
.checkline legend,
fieldset legend {
  display: block;
  margin-bottom: var(--rg-space-xs);
  font-size: var(--rg-body-sm-size);
  color: var(--rg-text-dim);
}

input[type="number"],
input[type="text"],
input[type="date"] {
  width: 100%;
  min-height: var(--rg-touch);
  padding: 0 var(--rg-space-lg);
  background: transparent;
  border: 1px solid var(--rg-outline);
  border-radius: var(--rg-radius-field);
  color: var(--rg-text);
  font-family: var(--rg-font);
  font-size: var(--rg-body-lg-size);
  font-variant-numeric: var(--rg-numeric);
}
input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus {
  border-color: var(--rg-ember);
  outline: none;
}
input[type="number"]::placeholder,
input[type="text"]::placeholder {
  color: var(--rg-text-dim);
  opacity: 0.6;
}
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { appearance: none; margin: 0; }
input[type="date"] { color-scheme: dark; }

.row {
  display: flex;
  align-items: center;
  gap: var(--rg-space-md);
}

.m-source { margin-top: var(--rg-space-sm); }
.m-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rg-space-sm);
}
.m-cell span {
  display: block;
  margin-bottom: var(--rg-space-xs);
  font-size: var(--rg-body-sm-size);
  color: var(--rg-text-dim);
}
.m-derived { margin-top: var(--rg-space-sm); }
.row > input { flex: 1; min-width: 0; }

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--rg-space-sm);
  margin-bottom: var(--rg-space-xs);
}
.label-row label, .label-row .label { margin-bottom: 0; }
.label-row output, .label-row .hint {
  font-size: var(--rg-body-sm-size);
  color: var(--rg-text);
  font-variant-numeric: var(--rg-numeric);
}
.label-row .hint { color: var(--rg-text-dim); }
.label-tools {
  display: flex;
  align-items: center;
  gap: var(--rg-space-sm);
}

/* ---------------------------------------------------------------- chips */

fieldset.seg {
  margin: 0 0 var(--rg-space-lg);
  padding: 0;
  border: none;
  min-width: 0;
}
fieldset.seg:last-child { margin-bottom: 0; }
.seg-wrap, fieldset.seg > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rg-space-sm);
}
.seg label { position: relative; display: inline-flex; }
.seg input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.seg span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--rg-space-lg);
  border: 1px solid var(--rg-outline);
  border-radius: var(--rg-radius-pill);
  background: transparent;
  color: var(--rg-text);
  font-size: var(--rg-body-md-size);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--rg-dur-ui) var(--rg-ease-ui), color var(--rg-dur-ui) var(--rg-ease-ui);
}
.seg input:checked + span {
  border-color: transparent;
  background: var(--rg-selected);
  color: var(--rg-ember);
}
.seg input:focus-visible + span {
  outline: 2px solid var(--rg-ember);
  outline-offset: 2px;
}
.seg-compact { margin: 0; }

/* ---------------------------------------------------------------- stepper */

.stepper {
  display: flex;
  align-items: center;
  gap: var(--rg-space-lg);
}
.stepper button {
  width: var(--rg-touch);
  height: var(--rg-touch);
  border: none;
  border-radius: var(--rg-radius-pill);
  background: var(--rg-surface-high);
  color: var(--rg-text);
  font-family: var(--rg-font);
  font-size: 20px;
  cursor: pointer;
  transition: filter var(--rg-dur-ui) var(--rg-ease-ui);
}
.stepper button:hover { filter: brightness(1.12); }
.stepper button:active { opacity: 0.7; }
.stepper output {
  min-width: 28px;
  text-align: center;
  font-size: var(--rg-title-lg-size);
  font-weight: var(--rg-title-lg-weight);
  font-variant-numeric: var(--rg-numeric);
}

/* ---------------------------------------------------------------- ranges */

input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  accent-color: var(--rg-ember);
}

/* ---------------------------------------------------------------- buttons */

.btn, .btn-outline, .btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rg-space-sm);
  min-height: var(--rg-touch);
  border-radius: var(--rg-radius-pill);
  font-family: var(--rg-font);
  font-size: var(--rg-label-lg-size);
  font-weight: var(--rg-label-lg-weight);
  letter-spacing: var(--rg-label-lg-tracking);
  white-space: nowrap;
  cursor: pointer;
  transition: filter var(--rg-dur-ui) var(--rg-ease-ui), opacity var(--rg-dur-ui) var(--rg-ease-ui);
}

.btn {
  padding: 0 var(--rg-space-xl);
  border: none;
  background: var(--rg-ember);
  color: var(--rg-on-ember);
  text-transform: uppercase;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { opacity: 0.7; }

.btn-outline {
  padding: 0 var(--rg-space-xl);
  border: 1px solid var(--rg-outline);
  background: transparent;
  color: var(--rg-ember);
  text-transform: uppercase;
}
.btn-outline:hover { filter: brightness(1.12); }
.btn-outline:active { opacity: 0.7; }

.btn-text {
  padding: 0 var(--rg-space-md);
  border: none;
  background: transparent;
  color: var(--rg-text-dim);
}
.btn-text:hover { filter: brightness(1.15); }
.btn-text:active { opacity: 0.7; }
.btn-text.accent { color: var(--rg-ember); }
.btn-text.danger { color: var(--rg-error); }

/* info discs: 28px drawn, hit rect grown to touch size */
.info {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--rg-radius-pill);
  background: var(--rg-surface-high);
  color: var(--rg-text-dim);
  font-family: var(--rg-font);
  font-size: 12px;
  cursor: pointer;
  transition: filter var(--rg-dur-ui) var(--rg-ease-ui);
}
.info:hover { filter: brightness(1.15); }
.info::after {
  content: "";
  position: absolute;
  inset: -10px;
}

/* tappable values: dashed underline, transparent, tabular */
.val {
  padding: 0 0 1px;
  min-height: 40px;
  border: none;
  border-bottom: 1px dashed var(--rg-dash);
  background: transparent;
  color: var(--rg-text);
  font-family: var(--rg-font);
  font-size: var(--rg-body-md-size);
  font-variant-numeric: var(--rg-numeric);
  cursor: pointer;
  text-align: left;
}
.val:hover { border-bottom-style: solid; }

/* ---------------------------------------------------------------- checkbox */

.checkline {
  display: flex;
  align-items: flex-start;
  gap: var(--rg-space-sm);
  margin-bottom: var(--rg-space-lg);
}
.checkline .info { margin-top: 10px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--rg-space-sm);
  flex: 1;
  cursor: pointer;
}
.check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.check .box {
  width: var(--rg-touch);
  height: var(--rg-touch);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.check .box::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: var(--rg-radius-tick);
  border: 2px solid var(--rg-text-dim);
  background: transparent;
  transition: background var(--rg-dur-ui) var(--rg-ease-ui), border-color var(--rg-dur-ui) var(--rg-ease-ui);
}
.check input:checked + .box::before {
  border-color: var(--rg-ember);
  background: var(--rg-ember) center / 14px no-repeat
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%231A0800" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12.5 9.5 18 20 6.5"/></svg>');
}
.check input:focus-visible + .box::before {
  outline: 2px solid var(--rg-ember);
  outline-offset: 2px;
}
.check .check-title {
  padding-top: 12px;
  font-size: var(--rg-label-lg-size);
  font-weight: var(--rg-label-lg-weight);
  letter-spacing: var(--rg-label-lg-tracking);
  color: var(--rg-text);
}

/* ---------------------------------------------------------------- advanced */

details.advanced { margin-top: var(--rg-space-sm); }
details.advanced > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--rg-space-sm);
  min-height: var(--rg-touch);
  list-style: none;
  color: var(--rg-text-dim);
  font-size: var(--rg-label-lg-size);
  font-weight: var(--rg-label-lg-weight);
  letter-spacing: var(--rg-label-lg-tracking);
  cursor: pointer;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: -2px;
  border-right: 2px solid var(--rg-ember);
  border-bottom: 2px solid var(--rg-ember);
  transform: rotate(-45deg);
  transition: transform var(--rg-dur-ui) var(--rg-ease-ui);
}
details.advanced[open] > summary::before {
  margin-top: -4px;
  transform: rotate(45deg);
}
details.advanced > summary:hover { color: var(--rg-text); }
details.advanced > .adv-panel {
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-lg);
  padding: var(--rg-space-lg);
  background: var(--rg-surface);
  border-radius: var(--rg-radius-row);
}
.adv-panel .field, .adv-panel fieldset.seg, .adv-panel .checkline { margin-bottom: 0; }
.pmode-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--rg-space-sm);
  margin: 0;
}
.pmode-hint .hint { padding-top: 5px; }

/* ---------------------------------------------------------------- badges */

.badge, .tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--rg-radius-badge);
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  white-space: nowrap;
  --ink: var(--rg-text-dim);
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  color: var(--ink);
}
.badge[data-grade="verified"] { --ink: var(--rg-lime); }
.badge[data-grade="mechanism"] { --ink: var(--rg-cyan); }
.badge[data-grade="preference"] { --ink: var(--rg-violet); }
.badge[data-grade="extrapolation"] { --ink: var(--rg-cold); }
.badge[data-grade="practice"] { --ink: var(--rg-text-dim); }

.grade-note {
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}
.grade-note .badge { margin-right: var(--rg-space-sm); }

/* ---------------------------------------------------------------- warnings */

.warnbox {
  margin-bottom: var(--rg-space-md);
  padding: var(--rg-space-md);
  border-radius: var(--rg-radius-banner);
  --ink: var(--rg-text-dim);
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
}
.warnbox[data-severity="warn"] { --ink: var(--rg-cold); }
.warnbox p { margin: 0; font-size: var(--rg-body-sm-size); line-height: var(--rg-body-sm-line); }
.day-tag {
  font-size: var(--rg-label-sm-size);
  font-weight: var(--rg-label-sm-weight);
  letter-spacing: var(--rg-label-sm-tracking);
  text-transform: uppercase;
}
.warn-cites {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rg-space-sm);
}
.warn-cites a { font-size: var(--rg-body-sm-size); }

.blockbox {
  border: 1px solid rgb(255 84 112 / 0.6);
  border-radius: var(--rg-radius-row);
  padding: var(--rg-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
}
.blockbox p { margin: 0; font-size: var(--rg-body-sm-size); line-height: var(--rg-body-sm-line); }
.blockbox-title {
  font-size: var(--rg-title-sm-size);
  font-weight: var(--rg-title-sm-weight);
  color: var(--rg-error);
}

/* ---------------------------------------------------------------- results */

#result { display: flex; flex-direction: column; gap: var(--rg-space-md); }

.change-row {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.change-row .change-label {
  font-size: var(--rg-body-sm-size);
  color: var(--rg-text-dim);
}
.change-row .val {
  align-self: flex-start;
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
}
.aline {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: var(--rg-space-sm);
}
.aline .val { min-height: 44px; font-size: var(--rg-body-md-size); }

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--rg-space-md);
}
.day-card {
  background: var(--rg-surface);
  border-radius: var(--rg-radius-row);
  padding: var(--rg-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-sm);
}
.day-head {
  font-size: var(--rg-label-lg-size);
  font-weight: var(--rg-label-lg-weight);
  letter-spacing: var(--rg-label-lg-tracking);
  text-transform: uppercase;
  color: var(--rg-text-dim);
}
.day-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--rg-space-sm);
  min-height: 40px;
}
.day-row > span {
  font-size: var(--rg-body-md-size);
  color: var(--rg-text-dim);
}

.weekly-strip {
  background: var(--rg-surface-high);
  border-radius: var(--rg-radius-row);
  padding: var(--rg-space-md) var(--rg-space-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rg-space-xs) var(--rg-space-lg);
}
.weekly-strip .strip-label {
  flex: 1 1 100%;
  font-size: var(--rg-body-sm-size);
  color: var(--rg-text-dim);
}
.weekly-strip .w-pair {
  display: inline-flex;
  align-items: center;
  gap: var(--rg-space-xs);
}
.weekly-strip .w-pair > span {
  font-size: var(--rg-body-sm-size);
  color: var(--rg-text-dim);
}

.placement {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--rg-space-sm);
}
.placement > span {
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

.plan-actions {
  display: flex;
  align-items: center;
  gap: var(--rg-space-md);
  flex-wrap: wrap;
  margin-top: var(--rg-space-md);
}

blockquote.note {
  margin: var(--rg-space-lg) 0 0;
  padding: var(--rg-space-md) var(--rg-space-lg);
  border-left: 2px solid var(--rg-surface-high);
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

/* ---------------------------------------------------------------- verifier */

.weigh-row { flex-wrap: wrap; }
.weigh-row input[type="date"] { flex: 0 1 150px; font-size: var(--rg-body-md-size); }
.weigh-row input[type="number"] { flex: 1 1 90px; }

.w-list {
  list-style: none;
  margin: var(--rg-space-sm) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
}
.w-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rg-space-sm);
  background: var(--rg-surface);
  border-radius: var(--rg-radius-banner);
  padding: 0 var(--rg-space-xs) 0 var(--rg-space-md);
  min-height: 44px;
}
.w-list li > span {
  font-size: var(--rg-body-md-size);
  font-variant-numeric: var(--rg-numeric);
}
.w-list button {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--rg-text-dim);
  font-family: var(--rg-font);
  font-size: 16px;
  cursor: pointer;
}
.w-list button:hover { color: var(--rg-text); }

.callbox {
  margin-top: var(--rg-space-md);
  background: var(--rg-surface);
  border-radius: var(--rg-radius-row);
  padding: var(--rg-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-md);
  --ink: var(--rg-text-dim);
  border: 1px solid color-mix(in srgb, var(--ink) 55%, transparent);
}
.callbox[data-call="hold"] { --ink: var(--rg-lime); }
.callbox[data-call="adjust"] { --ink: var(--rg-cold); }
.callbox[data-call="phase-change"] { --ink: var(--rg-magenta); }
.callbox[data-call="insufficient"] { --ink: var(--rg-text-dim); }
.callbox .warnbox { margin: 0; }

.call-head { margin: 0; }
.call-btn {
  padding: 0 0 1px;
  min-height: 44px;
  border: none;
  border-bottom: 1px dashed rgb(176 176 190 / 0.5);
  background: transparent;
  color: var(--ink);
  font-family: var(--rg-font);
  font-size: var(--rg-title-md-size);
  font-weight: var(--rg-title-md-weight);
  letter-spacing: var(--rg-title-md-tracking);
  cursor: pointer;
  text-align: left;
}
.call-btn:hover { border-bottom-style: solid; }

.trend-line { margin: 0; }
.trend-line .val {
  min-height: 36px;
  color: var(--rg-text-dim);
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  border-bottom-color: var(--rg-dash-soft);
}

.offerbox {
  border: 1px solid var(--rg-surface-high);
  border-radius: var(--rg-radius-banner);
  padding: var(--rg-space-md);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
}
.offer-title { margin: 0; }
.offer-title button {
  padding: 0 0 1px;
  min-height: 36px;
  border: none;
  border-bottom: 1px dashed rgb(176 176 190 / 0.5);
  background: transparent;
  color: var(--rg-text);
  font-family: var(--rg-font);
  font-size: var(--rg-title-sm-size);
  font-weight: var(--rg-title-sm-weight);
  cursor: pointer;
  text-align: left;
}
.offer-line {
  margin: 0;
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
  font-variant-numeric: var(--rg-numeric);
}
.offer-actions {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--rg-space-sm);
}

.store-row { margin-top: var(--rg-space-lg); margin-bottom: var(--rg-space-lg); flex-wrap: wrap; gap: var(--rg-space-sm); }

.wipe-confirm {
  margin-top: var(--rg-space-md);
  border: 1px solid rgb(255 84 112 / 0.6);
  border-radius: var(--rg-radius-row);
  padding: var(--rg-space-md) var(--rg-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
}
.wipe-confirm p { margin: 0; font-size: var(--rg-body-sm-size); line-height: var(--rg-body-sm-line); }
.wipe-confirm .row { gap: var(--rg-space-md); }

.hunger { margin: var(--rg-space-md) 0 0; }

/* ---------------------------------------------------------------- ped card */

.ped-card {
  background: var(--rg-surface);
  border-radius: var(--rg-radius-row);
  padding: var(--rg-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-sm);
}
.ped-card .grade-note { flex-direction: row; }
.ped-line { margin: 0; }
.ped-text {
  margin: 0;
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

/* ---------------------------------------------------------------- legend */

#legend-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-md);
}
#legend-list dt { margin: 0; }
#legend-list dd {
  margin: var(--rg-space-xs) 0 0;
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

/* ---------------------------------------------------------------- dialog */

dialog#explain {
  width: min(352px, calc(100vw - 2 * var(--rg-edge)));
  max-height: min(560px, 82dvh);
  padding: 0;
  border: 1px solid var(--rg-surface-high);
  border-radius: var(--rg-radius-dialog);
  background: var(--rg-surface);
  color: var(--rg-text);
}
dialog#explain::backdrop { background: rgb(0 0 0 / 0.6); }

.sheet {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  overflow: hidden;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rg-space-sm);
  padding: var(--rg-space-md) var(--rg-space-lg) 0;
}
.sheet-head h3 {
  margin: 0;
  font-size: var(--rg-title-md-size);
  font-weight: var(--rg-title-md-weight);
  letter-spacing: var(--rg-title-md-tracking);
  color: var(--rg-ember);
}
.sheet-body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--rg-space-sm) var(--rg-space-lg) var(--rg-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-md);
}
.sheet-body > p { margin: 0; }
.formula {
  font-family: var(--rg-font-mono);
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  background: var(--rg-surface-high);
  border-radius: var(--rg-radius-banner);
  padding: var(--rg-space-md);
  overflow-wrap: anywhere;
  font-variant-numeric: var(--rg-numeric);
}
#explain-desc {
  font-size: var(--rg-body-sm-size);
  line-height: var(--rg-body-sm-line);
  color: var(--rg-text-dim);
}

.cite {
  border-top: 1px solid var(--rg-surface-high);
  padding-top: var(--rg-space-md);
  display: flex;
  flex-direction: column;
  gap: var(--rg-space-xs);
}
.cite p { margin: 0; font-size: var(--rg-body-sm-size); line-height: var(--rg-body-sm-line); }
.cite-src { color: var(--rg-text); }
.cite-finding { color: var(--rg-text-dim); }
.cite-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--rg-space-sm);
}
.cite-note { color: var(--rg-text-dim); }

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
