/* Layout: skill picker on top, then a sticky input column beside a stack of live result panels. */
:root {
  color-scheme: dark;
  /* Night-stone palette with a brass accent; teal marks "where you are", gold marks "where you're going". */
  --ground: #101219;
  --panel: #171a24;
  --raise: #1f2330;
  --line: #2b3040;
  --ink: #ece8dd;
  --muted: #9aa0b1;
  --faint: #687087;
  --gold: #f0b84a;
  --gold-ink: #1c1405;
  --gold-soft: rgba(240, 184, 74, 0.16);
  --gold-line: rgba(240, 184, 74, 0.45);
  --teal: #5ec3d5;
  --teal-soft: rgba(94, 195, 213, 0.15);
  --good: #74d39a;
  --lock: #737a8d;
  --badge-l: 34%;
  --badge-s: 42%;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.035) inset, 0 18px 40px -28px rgba(0, 0, 0, 0.9);

  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --c1: #d1574b; --c2: #4fae6a; --c3: #5b8fd6; --c4: #8fb33d; --c5: #8a6ee0; --c6: #e0a33a;
  --splat: #b8322a;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ground: #e8ebf1;
    --panel: #fbfbfd;
    --raise: #f0f2f6;
    --line: #d4d8e1;
    --ink: #181b24;
    --muted: #545d70;
    --faint: #858c9e;
    --gold: #9c6200;
    --gold-ink: #fff8ea;
    --gold-soft: rgba(156, 98, 0, 0.11);
    --gold-line: rgba(156, 98, 0, 0.45);
    --teal: #137489;
    --teal-soft: rgba(19, 116, 137, 0.12);
    --good: #1d8148;
    --lock: #9aa0ae;
    --badge-l: 44%;
    --badge-s: 46%;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 16px 32px -26px rgba(30, 40, 70, 0.45);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #e8ebf1;
  --panel: #fbfbfd;
  --raise: #f0f2f6;
  --line: #d4d8e1;
  --ink: #181b24;
  --muted: #545d70;
  --faint: #858c9e;
  --gold: #9c6200;
  --gold-ink: #fff8ea;
  --gold-soft: rgba(156, 98, 0, 0.11);
  --gold-line: rgba(156, 98, 0, 0.45);
  --teal: #137489;
  --teal-soft: rgba(19, 116, 137, 0.12);
  --good: #1d8148;
  --lock: #9aa0ae;
  --badge-l: 44%;
  --badge-s: 46%;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 16px 32px -26px rgba(30, 40, 70, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap {
  max-width: 1280px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1200px 220px at 12% -40%, var(--gold-soft), transparent 70%),
    var(--ground);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; }
.brand:hover h1, .brand:hover .brand-name { color: var(--gold); }
.brand-mark { width: 44px; height: 44px; flex: none; }
.bm-ring { fill: none; stroke: var(--gold-line); stroke-width: 1.5; }
.bm-gem { fill: var(--gold); }
.bm-facet { stroke: var(--gold-ink); stroke-width: 1.2; opacity: 0.45; fill: none; }
.brand h1, .brand .brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.6vw, 28px);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  flex: none;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--gold-line); }
.tt-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(90deg, var(--ink) 50%, transparent 50%);
  border: 1.5px solid var(--ink);
}

/* ---------- Skill picker ---------- */
.skills { padding-block: 20px 4px; }
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 6px;
}
.skill {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px 6px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--panel);
  cursor: pointer;
  text-align: start;
  font-size: 13.5px; font-weight: 600;
  color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}
.skill:hover { color: var(--ink); border-color: var(--line); }
.skill[aria-checked="true"] {
  color: var(--ink);
  border-color: var(--gold-line);
  background: var(--raise);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.badge {
  --h: 30;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 7px;
  /* Each skill sets --c1/--c2 (see OSRS.badgeStyle); --h is the fallback. */
  --c1: hsl(var(--h) 70% 62%);
  --c2: hsl(var(--h) 60% 26%);
  position: relative; isolation: isolate; overflow: hidden;
  background:
    /* glass sheen across the top half */
    linear-gradient(180deg, rgba(255,255,255,.28) 0%, rgba(255,255,255,.08) 40%, transparent 62%),
    /* deep corner shade for depth */
    radial-gradient(90% 90% at 100% 100%, rgba(0,0,0,.28), transparent 60%),
    linear-gradient(145deg, var(--c1), var(--c2) 78%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.22),
    inset 0 1px 0 rgba(255,255,255,.45),
    inset 0 -2px 3px rgba(0,0,0,.25),
    0 2px 6px -2px color-mix(in srgb, var(--c2) 70%, transparent);
}
.badge-lg {
  width: 46px; height: 46px; border-radius: 12px; font-size: 18px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.24),
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -3px 5px rgba(0,0,0,.25),
    0 6px 16px -6px color-mix(in srgb, var(--c2) 85%, transparent);
}
.skill-icon {
  width: 62%; height: 62%;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.45));
}
.skill .badge { transition: transform .18s, box-shadow .18s; }
.skill:hover .badge { transform: translateY(-1px) scale(1.06); }
.skill[aria-checked="true"] .badge {
  transform: scale(1.08);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.3),
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -2px 3px rgba(0,0,0,.25),
    0 0 0 2px var(--panel),
    0 0 0 3.5px color-mix(in srgb, var(--c1) 80%, transparent),
    0 4px 14px -2px color-mix(in srgb, var(--c2) 80%, transparent);
}
@media (prefers-reduced-motion: reduce) { .skill .badge { transition: none; } }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-block: 16px 32px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; letter-spacing: 0.03em; text-wrap: balance;
}
.panel-note { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Controls ---------- */
.controls {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  display: flex; flex-direction: column; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}
.controls-head { display: flex; align-items: center; gap: 12px; }
.skill-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; text-wrap: balance; }

.group {
  border: 0; margin: 0; padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.group legend {
  float: left; width: 100%; padding: 0; margin-bottom: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold);
}
.group legend + * { clear: both; }
.pair { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; }
.pair-rev { grid-template-columns: minmax(0, 1fr) 96px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raise);
  font-family: var(--font-data);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.field select { font-family: var(--font-body); font-weight: 600; cursor: pointer; }
.field input:hover, .field select:hover { border-color: var(--faint); }
.field input:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input[type=number]::-webkit-inner-spin-button { opacity: 0.4; }

.mini-progress { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini-track { height: 6px; border-radius: 99px; background: var(--raise); overflow: hidden; border: 1px solid var(--line); }
.mini-fill { height: 100%; width: 0; background: var(--teal); border-radius: inherit; transition: width .35s ease; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raise);
  font-family: var(--font-data);
  font-size: 12.5px; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.chip small { font-size: 10px; opacity: .7; }
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip[aria-pressed="true"] { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.chip-input { cursor: text; padding-right: 10px; }
.chip-input input {
  width: 34px; border: 0; background: transparent; padding: 0;
  font-family: var(--font-data); font-size: 12.5px; text-align: right;
  -moz-appearance: textfield;
}
.chip-input input::-webkit-inner-spin-button { display: none; }
.chip-input input:focus { outline: none; }
.chip-input:focus-within { border-color: var(--gold); }
.hint { font-size: 12px; color: var(--faint); }

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.summary {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  background:
    radial-gradient(420px 260px at 0% 50%, var(--gold-soft), transparent 70%),
    var(--panel);
}
.ring-wrap { position: relative; width: 220px; aspect-ratio: 1; max-width: 100%; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--raise); stroke-width: 14; }
.ring-fill {
  fill: none; stroke: var(--gold); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 0 1000;
  transition: stroke-dasharray .7s cubic-bezier(.2,.8,.2,1);
}
.ring-tick { stroke: var(--ground); stroke-width: 2; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.ring-levels {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  display: flex; align-items: baseline; gap: 6px;
  font-variant-numeric: lining-nums;
}
.ring-levels #ringCur { color: var(--teal); }
.ring-levels #ringTgt { color: var(--gold); }
.ring-levels .arrow { font-family: var(--font-body); font-size: 20px; color: var(--faint); }
.ring-pct { margin-top: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ring-pct span { font-family: var(--font-data); color: var(--ink); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stat {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line);
  min-width: 0;
}
.stat-value {
  font-family: var(--font-data);
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 600;
  line-height: 1.2;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat.done .stat-value { color: var(--good); }

/* Curve chart */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--raise); }
.seg-btn {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg-btn[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.25); }

.chart-box { position: relative; overflow-x: auto; }
.curve { display: block; width: 100%; min-width: 520px; height: auto; touch-action: pan-y; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis-label { fill: var(--faint); font-family: var(--font-data); font-size: 11px; }
.c-line { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; }
.c-area-all { fill: var(--raise); }
.c-area-goal { fill: var(--gold-soft); }
.c-line-goal { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.c-half { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 4 4; }
.c-half-label { fill: var(--muted); font-family: var(--font-body); font-size: 11.5px; font-weight: 600; }
.c-dot-cur { fill: var(--teal); stroke: var(--panel); stroke-width: 3; }
.c-dot-tgt { fill: var(--gold); stroke: var(--panel); stroke-width: 3; }
.c-tag-cur { fill: var(--teal); font-family: var(--font-data); font-size: 12px; font-weight: 600; }
.c-tag-tgt { fill: var(--gold); font-family: var(--font-data); font-size: 12px; font-weight: 600; }
.c-guide { stroke: var(--ink); stroke-width: 1; opacity: 0.35; }
.c-hover-dot { fill: var(--ink); }

.tooltip {
  position: absolute; pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  padding: 8px 10px;
  background: var(--ink); color: var(--ground);
  border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
  z-index: 2;
}
.tooltip b { font-family: var(--font-display); font-size: 13px; }

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

/* Methods */
.methods { display: flex; flex-direction: column; gap: 4px; max-height: 430px; overflow-y: auto; margin-inline: -6px; padding-inline: 6px; }
.m-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  text-align: start; cursor: pointer;
  width: 100%;
}
.m-row:hover { background: var(--raise); }
.m-row[aria-pressed="true"] { background: var(--raise); border-color: var(--gold-line); }
.m-name { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-name em { font-style: normal; font-family: var(--font-data); font-weight: 400; font-size: 11.5px; color: var(--faint); margin-left: 6px; }
.m-val { font-family: var(--font-data); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); text-align: end; }
.m-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.m-row:hover .m-bar, .m-row[aria-pressed="true"] .m-bar { background: var(--panel); }
.m-fill { height: 100%; border-radius: inherit; background: var(--teal); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.m-row[aria-pressed="true"] .m-fill { background: var(--gold); }
.m-row.locked .m-name, .m-row.locked .m-val { color: var(--lock); }
.m-row.locked .m-fill { background: var(--lock); opacity: .5; }
.lock {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 4px; border: 1px solid var(--line);
  font-family: var(--font-data); font-size: 10.5px; font-weight: 500; color: var(--muted);
  vertical-align: 1px;
}
.empty { color: var(--muted); font-size: 13.5px; padding: 12px 0; }

/* Route */
.route-bar { display: flex; height: 26px; border-radius: var(--r-sm); overflow: hidden; gap: 2px; margin-bottom: 14px; }
.route-seg { min-width: 3px; transition: flex-grow .45s cubic-bezier(.2,.8,.2,1); }
.route-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.route-item {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 4px 10px; align-items: baseline;
  padding: 9px 0; border-top: 1px dashed var(--line);
}
.route-item:first-child { border-top: 0; }
.route-sw { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.route-name { font-weight: 600; font-size: 13.5px; min-width: 0; }
.route-range { display: block; font-family: var(--font-data); font-size: 11.5px; color: var(--muted); font-weight: 400; }
.route-act { font-family: var(--font-data); font-size: 13px; text-align: end; font-variant-numeric: tabular-nums; }
.route-total {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.route-total strong { font-family: var(--font-data); color: var(--ink); font-weight: 600; }
.save { color: var(--good); font-weight: 600; }

/* Ladder */
.ladder {
  display: flex; gap: 2px; height: 46px; align-items: stretch; margin-bottom: 8px;
  border-radius: var(--r-sm); overflow: hidden;
}
.ladder-seg {
  position: relative; min-width: 1px;
  background: var(--gold); opacity: .38;
  transition: opacity .15s;
}
.ladder-seg.ten { opacity: .7; }
.ladder-seg.first { background: var(--teal); opacity: .75; }
.ladder-seg:hover { opacity: 1; }
.ladder-seg span {
  position: absolute; left: 4px; bottom: 3px;
  font-family: var(--font-data); font-size: 10.5px; font-weight: 600; color: var(--gold-ink);
}
.ladder-axis { display: flex; justify-content: space-between; font-family: var(--font-data); font-size: 11px; color: var(--faint); margin-bottom: 16px; }

.table-box { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.levels { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.levels th {
  position: sticky; top: 0; z-index: 1;
  background: var(--raise);
  text-align: end; padding: 9px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.levels th:first-child, .levels td:first-child { text-align: start; }
.levels td { padding: 7px 12px; text-align: end; font-family: var(--font-data); border-bottom: 1px solid var(--line); white-space: nowrap; }
.levels tr:last-child td { border-bottom: 0; }
.levels td:first-child { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.levels tr.ten td:first-child { color: var(--gold); }
.levels tr.unlock td { background: var(--teal-soft); }
.levels .ul { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 600; color: var(--teal); }


/* ---------- Header navigation ---------- */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--gold); color: var(--gold-ink); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 12px); }
.masthead-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top-nav a {
  padding: 6px 10px; border-radius: 999px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.top-nav a:hover { color: var(--ink); background: var(--panel); }
.top-nav a[aria-current="page"] { color: var(--ink); }

/* ---------- Home content sections ---------- */
.content { display: flex; flex-direction: column; gap: 20px; padding-block: 0 40px; }
.content-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  min-width: 0;
}
.content-block h2, .prose h2 {
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3;
  margin: 0 0 12px;
}
.content-block p, .prose p, .prose li { max-width: 72ch; color: var(--muted); }
.content-block p + p { margin-top: 10px; }
.lead { font-size: 16.5px; line-height: 1.6; color: var(--ink) !important; }
.intro-block { background: radial-gradient(520px 200px at 0% 0%, var(--gold-soft), transparent 70%), var(--panel); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.steps li {
  counter-increment: step; position: relative;
  padding: 14px 16px 14px 52px; border-radius: var(--r-md);
  background: var(--raise); border: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 13px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 13px;
}
[dir="rtl"] .steps li { padding: 14px 52px 14px 16px; }
[dir="rtl"] .steps li::before { left: auto; right: 14px; }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raise); }
.faq-item summary {
  cursor: pointer; list-style: none; padding: 13px 44px 13px 16px; position: relative;
  font-weight: 600; font-size: 15px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-data); font-size: 18px; color: var(--gold);
}
[dir="rtl"] .faq-item summary { padding: 13px 16px 13px 44px; }
[dir="rtl"] .faq-item summary::after { right: auto; left: 16px; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 16px 14px; }

/* ---------- Content pages ---------- */
.page { padding-block: 24px 40px; max-width: 880px; }
.crumbs ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-inline-end: 6px; color: var(--faint); }
.crumbs a { color: var(--muted); }
.prose {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: clamp(20px, 4vw, 36px);
}
.prose h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; margin-bottom: 14px; }
.prose h2 { margin-top: 28px; }
.prose p + p { margin-top: 10px; }
.prose ul { padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; }
.prose strong { color: var(--ink); }
.prose a, .content-block a { color: var(--gold); text-underline-offset: 3px; }
.updated { font-family: var(--font-data); font-size: 12.5px; color: var(--faint) !important; margin-bottom: 10px; }
.muted { color: var(--faint); }
.sitemap-list { list-style: none; padding: 0 !important; }
.sitemap-cols { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Contact form */
.contact-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raise); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); font: inherit; color: var(--ink); resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.contact-form [aria-invalid="true"] { border-color: #d9534f; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn {
  padding: 10px 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 14.5px;
}
.btn:disabled { opacity: .6; cursor: progress; }
.form-status { font-size: 13.5px; color: var(--muted) !important; }
.form-status.is-success { color: var(--good) !important; }
.form-status.is-error { color: #e0675f !important; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative; margin-top: 32px; overflow: hidden;
  background: linear-gradient(180deg, var(--ground), var(--panel) 55%, var(--ground));
  border-top: 1px solid var(--line);
}
.site-footer::before {
  content: ""; position: absolute; inset: -1px 0 auto; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--teal), transparent); opacity: .7;
}
.footer-top-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px 48px; flex-wrap: wrap;
  padding-block: 44px 8px;
}
.footer-logo { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.footer-logo:hover span { color: var(--gold); }
.footer-about { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 46ch; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.footer-nav a {
  display: inline-block; padding: 7px 13px; border-radius: 999px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; transition: color .15s, border-color .15s, background .15s;
}
.footer-nav a:hover { color: var(--ink); border-color: var(--line); background: var(--raise); }
.footer-nav a[aria-current="page"] { color: var(--gold-ink); background: var(--gold); }
.footer-curve-row { margin-top: 16px; }
.footer-curve { display: block; width: 100%; height: 90px; }
.fc-line { fill: none; stroke: var(--gold); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.fc-area { fill: url(#fcFill); }
.fc-stop-a { stop-color: var(--gold); stop-opacity: .22; }
.fc-stop-b { stop-color: var(--gold); stop-opacity: 0; }
.footer-facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin-top: -4px; padding-bottom: 32px;
}
.fact {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raise);
}
.fact-num { font-family: var(--font-data); font-size: clamp(16px, 2vw, 21px); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.fact-num small { font-size: 12px; color: var(--muted); font-weight: 500; }
.fact-label { font-size: 12.5px; color: var(--muted); }
.fact-max { border-color: var(--gold-line); background: var(--gold-soft); }
.fact-max .fact-num { color: var(--gold); }
.footer-bar { border-top: 1px solid var(--line); background: var(--ground); }
.footer-bar-inner {
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding-block: 14px calc(14px + env(safe-area-inset-bottom, 0px)); font-size: 12.5px; color: var(--faint);
}
.footer-bar-inner > p { margin-inline-end: auto; }
.lang-menu { position: relative; }
.lang-menu summary {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); font-size: 13px; font-weight: 600;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary svg { fill: none; stroke: currentColor; stroke-width: 1.2; color: var(--gold); }
.lang-menu .caret { color: var(--faint); font-size: 11px; }
.lang-menu[open] summary { border-color: var(--gold); }
.lang-menu nav {
  position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 5;
  width: min(420px, calc(100vw - 32px)); padding: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
}
[dir="rtl"] .lang-menu nav { right: auto; left: 0; }
.lang-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 2px; }
.lang-list a { display: block; padding: 6px 10px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-size: 13px; }
.lang-list a:hover { background: var(--raise); color: var(--ink); }
.lang-list a[aria-current="true"] { color: var(--gold); font-weight: 700; }
.footer-top { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-top:hover { color: var(--gold); }
@media (max-width: 760px) {
  .footer-nav ul { justify-content: flex-start; }
  .footer-nav a { padding-inline: 0; margin-inline-end: 14px; border: 0; }
  .footer-nav a:hover { background: transparent; }
  .footer-nav a[aria-current="page"] { background: transparent; color: var(--gold); }
  .footer-facts { grid-template-columns: minmax(0, 1fr); }
  .footer-curve { height: 60px; }
  .lang-menu nav { right: auto; left: 0; }
}
.fine { font-size: 12px; color: var(--faint); max-width: 75ch; }

/* ---------- Sub-calculator pages ---------- */
.calc-hero { padding-block: 22px 4px; display: flex; flex-direction: column; gap: 8px; }
.calc-hero h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
.calc-hero .lead { max-width: 75ch; color: var(--muted) !important; font-size: 15.5px; }
.calc-hero .crumbs ol { margin: 0; }

/* ---------- Calculator directory (More OSRS calculators) ---------- */
.calc-dir-head {
  display: flex; align-items: center; gap: 8px;
  margin: 22px 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.calc-dir-count {
  padding: 1px 8px; border-radius: 99px;
  background: var(--raise); border: 1px solid var(--line);
  font-family: var(--font-data); font-size: 11px; letter-spacing: 0; color: var(--ink);
}
.calc-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 10px;
}
.calc-grid-tools { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.calc-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; height: 100%;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel);
  color: var(--ink) !important; text-decoration: none;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
/* A faint wash of the card's own colour from the badge side. */
.calc-card::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 140% at 0% 50%, color-mix(in srgb, var(--c1, var(--gold)) 14%, transparent), transparent 55%);
  opacity: .6; transition: opacity .18s;
}
.calc-card > * { position: relative; z-index: 1; }
.calc-card:hover, .calc-card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--c1, var(--gold)) 55%, var(--line));
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--c2, #000) 90%, transparent);
}
.calc-card:hover::before, .calc-card:focus-visible::before { opacity: 1; }
.calc-badge { width: 38px; height: 38px; border-radius: 10px; }
.calc-card-tool .calc-badge { width: 44px; height: 44px; border-radius: 12px; }
.calc-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.calc-name { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.calc-tag { font-size: 12.5px; color: var(--ink); opacity: .8; }
.calc-kw { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc-card:hover .calc-name { color: var(--gold); }
.calc-card-home { border-style: dashed; }
@media (prefers-reduced-motion: reduce) { .calc-card, .calc-card::before { transition: none; } .calc-card:hover { transform: none; } }

.viz-box { overflow-x: auto; }
.viz-svg { display: block; width: 100%; min-width: 560px; height: auto; }
.tool-viz { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.tool-viz .viz-stage { flex: 1 1 320px; min-width: 0; }
.tool-viz .viz-svg { min-width: 0; max-width: 100%; }
.stats-wide { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.pair-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.controls select.tool-input, .controls .gp-row input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--raise); font-size: 14px; }
.split-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 200px; flex: 0 1 260px; }
.split-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.split-list b { margin-inline-start: auto; font-family: var(--font-data); font-weight: 600; }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.gp-head, .gp-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .8fr); gap: 6px; align-items: center; }
.gp-head { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.gp-row { margin-bottom: 6px; }
.gp-out { grid-column: 1 / -1; font-family: var(--font-data); font-size: 11.5px; color: var(--muted); margin-top: -2px; }
.btn-ghost { background: var(--raise); color: var(--ink); border: 1px solid var(--line); }
.table-tall { max-height: 520px; margin-top: 0; }
.xp-table tr.hl td { background: var(--gold-soft); }
.xp-table .muted { font-family: var(--font-body); font-size: 11px; }

/* Chart vocabulary shared by every visual */
.v-label { fill: var(--muted); font-family: var(--font-body); font-size: 12px; }
.v-strong { fill: var(--ink); font-family: var(--font-body); font-size: 12.5px; font-weight: 700; }
.v-num { fill: var(--muted); font-family: var(--font-data); font-size: 11.5px; }
.v-in { fill: var(--gold-ink); font-family: var(--font-data); font-size: 12px; font-weight: 700; }
.v-big { fill: var(--ink); font-family: var(--font-data); font-size: 28px; font-weight: 700; }
.v-big2 { fill: var(--ink); font-family: var(--font-data); font-size: 18px; font-weight: 700; }
.v-good { fill: var(--good); font-family: var(--font-body); font-size: 12px; font-weight: 700; }
.v-sel { fill: var(--gold); }
.v-open { fill: var(--teal); fill-opacity: .7; }
.v-lock { fill: var(--lock); fill-opacity: .4; }
.v-good-fill { fill: var(--good); }
.v-hit { cursor: pointer; }
.v-hit:hover { opacity: .8; }
.v-core, .v-track, .v-bark, .v-ring-out { fill: var(--raise); stroke: var(--line); }
.v-facet { fill: #fff; fill-opacity: .16; }
.v-brick, .v-ringwood { stroke: var(--panel); stroke-width: 2; }
.v-ground, .v-axis { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.v-dash { stroke: var(--faint); stroke-dasharray: 3 4; fill: none; }
.v-tick { stroke: var(--muted); stroke-width: 1.5; }
.v-grid { stroke: var(--line); fill: none; }
.v-now { stroke: var(--teal); stroke-width: 1.5; stroke-dasharray: 5 4; }
.v-now-dot { fill: var(--teal); }
.v-bubble { stroke: var(--panel); stroke-width: 2; }
.v-glass { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.v-range { fill: var(--gold); fill-opacity: .55; }
.v-range-soft { fill: var(--gold-soft); }
.v-pole { stroke: var(--muted); stroke-width: 2; }
.v-hilt { fill: var(--muted); }
.v-meter { fill: var(--gold); fill-opacity: .3; }
.v-card { fill: var(--raise); stroke: var(--line); }
.v-card-done { fill: var(--teal-soft); stroke: var(--teal); }
.v-card-sel { fill: var(--gold-soft); stroke: var(--gold); }
.v-outline { fill: none; stroke: var(--ink); stroke-width: 2; }
.v-ring-a { fill: var(--teal-soft); stroke: var(--teal); }
.v-ring-b { fill: var(--raise); stroke: var(--teal); }
.v-river { fill: none; stroke: var(--teal); stroke-opacity: .3; stroke-width: 22; stroke-linecap: round; }
.v-step { fill: none; stroke: var(--gold); stroke-width: 3; }
.v-stair { stroke: var(--panel); stroke-width: 1; }
.v-stair-line { fill: none; stroke: var(--ink); stroke-opacity: .5; }
.v-route { fill: none; stroke: var(--teal); stroke-width: 3; stroke-dasharray: 8 6; }
.v-buoy { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 2; }
.v-island { fill: var(--good); fill-opacity: .45; stroke: var(--good); }
.v-curve { fill: none; stroke: var(--gold); stroke-width: 3; }
.v-gauge-track { fill: none; stroke: var(--raise); stroke-width: 26; }
.v-gauge-fill { fill: none; stroke: var(--gold); stroke-width: 26; }
.v-needle { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.v-arrow { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.v-splat { fill: var(--splat); stroke: #000; stroke-opacity: .25; stroke-width: 2; }
.v-splat-num { fill: #fff; font-family: var(--font-data); font-size: 56px; font-weight: 700; }

/* ---------- Home: detailed English sections ---------- */
.content-block .viz-box { margin: 16px 0; }
.content-block .table-box { margin: 14px 0; max-height: none; }
.content-block > p + p, .content-block > ul + p, .content-block > ol + p { margin-top: 10px; }
.steps-5 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 10px 0 4px; }
.plain-list { margin: 8px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.plain-list strong, .content-block p strong, .faq-item strong { color: var(--ink); }
.formula {
  font-family: var(--font-data); font-size: clamp(15px, 2vw, 19px); color: var(--ink) !important;
  background: var(--raise); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: var(--r-md); padding: 14px 18px; margin: 14px 0; overflow-x: auto; max-width: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .controls { position: static; }
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .masthead-inner { flex-wrap: wrap; }
  .content-block { padding: 18px; }
  .summary { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .stats { width: 100%; }
  .ring-wrap { width: 200px; }
  .skill-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .skill { font-size: 12.5px; }
  .panel { padding: 16px; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .theme-toggle #themeLabel { display: none; }
}

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