:root {
  color-scheme: dark;
  --bg: #16130f;
  --panel: #201c17;
  --panel-2: #2a251e;
  --line: #3a332a;
  --ink: #ece4d6;
  --muted: #9c9283;
  --gold: #d6a84f;
  --gold-soft: rgba(214, 168, 79, .14);
  --ok: #7fb069;
  --warn: #e07a5f;
  --r-common: #c9c2b6;
  --r-uncommon: #6fcf6f;
  --r-rare: #5aa9ff;
  --r-very-rare: #c77dff;
  --r-legendary: #f2b544;
  --r-story: #ff8c5a;
  --t-save: #6fb4ff;
  --t-armour: #a9bccf;
  --t-weapon: #ef8a6b;
  --t-skill: #8fcf7a;
  --t-trait: #c99bff;
  --radius: 14px;
  /* Spacing scales with the viewport: roomy on big screens, still fits on phones. */
  --gap: clamp(16px, 1.6vw, 28px);
  --pad: clamp(18px, 1.6vw, 28px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Always reserve the scrollbar's space so the layout doesn't shift when it appears
   (content growing, a card collapsing, a modal locking scroll). */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.modal-open { overflow: hidden; }
a { color: var(--gold); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }

.wrap { padding: clamp(16px, 2.4vw, 40px) clamp(16px, 3vw, 56px) calc(56px + env(safe-area-inset-bottom)); }
.center { min-height: 60vh; display: grid; place-content: center; gap: 12px; text-align: center; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.warn { color: var(--warn); }
.foot { margin-top: 80px; font-size: .8rem; color: var(--muted); text-align: center; }

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--gold); color: #1b1408; border-color: var(--gold); font-weight: 600; }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn.tiny { padding: 5px 11px; font-size: .82rem; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.input {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); min-width: 0;
}
.input:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
/* Own chevron instead of the browser's, which sits flush against the edge. */
select, select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239c9283' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
select:disabled { cursor: default; }
select.input:disabled { opacity: .7; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--bg); }
.seg > * { padding: 9px 16px; border: 0; background: transparent; text-decoration: none; color: var(--muted); }
.seg > .on { background: var(--gold-soft); color: var(--gold); font-weight: 600; }
/* Two-way toggle (e.g. Tav / Dark Urge): equal halves, the chosen one raised. */
.seg.toggle { display: flex; padding: 3px; gap: 3px; border-radius: 10px; }
.seg.toggle > * { flex: 1; text-align: center; padding: 8px 12px; border-radius: 7px; transition: background .15s, color .15s; }
.seg.toggle > :not(.on):hover { color: var(--ink); }
.seg.toggle > .on { background: var(--panel-2); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.seg.toggle.mode { min-width: 180px; }
.seg.toggle.acts { min-width: 300px; }
.seg.toggle.tabs { min-width: 260px; }
.chip { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); background: transparent; font-size: .85rem; color: var(--muted); }
.chip.on { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.check-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: .88rem; color: var(--muted); }
.badge { font-size: .72rem; padding: 1px 7px; border-radius: 99px; background: var(--gold-soft); color: var(--gold); vertical-align: middle; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); font-size: .85rem; margin: 3px 6px 3px 0; }
.field { display: grid; gap: 8px; font-size: .9rem; }
.field > span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.field.inline { display: flex; align-items: center; gap: 12px; }
.field.inline .input { width: auto; }

/* ---------- home */
.hero { padding: clamp(40px, 8vh, 96px) 0 48px; max-width: 760px; }
.hero h1 { font-family: "Cormorant Garamond", serif; font-size: clamp(2.6rem, 9vw, 4rem); font-weight: 700; color: var(--gold); line-height: 1; }
.hero p { margin: 20px 0 32px; font-size: 1.1rem; }
.home .card { max-width: 760px; }
.plan-list { list-style: none; }
.plan-list li { display: flex; align-items: center; gap: 10px; padding: 16px var(--pad); border-top: 1px solid var(--line); }
.plan-list li:first-child { border-top: 0; }
.plan-list li > a:first-child { flex: 1; display: grid; text-decoration: none; color: var(--ink); min-width: 0; }
.copy-row { display: flex; gap: 10px; }

/* ---------- cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--gap); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 22px var(--pad); cursor: pointer; user-select: none; border-bottom: 1px solid var(--line); }
.card.closed .card-head { border-bottom: 0; }
.card-head:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: -2px; }
.card-head h2 { font-size: 1.15rem; flex: 1; }
/* Same chevron as the dropdowns; points right when collapsed. */
.chev { flex: none; width: 14px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239c9283' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 8px; transform: rotate(-90deg); transition: transform .15s; }
.chev.open { transform: none; }
.card-body { padding: var(--pad); }
/* Lists and sub-panels inside a card run their divider lines to the card's edges. */
.card-body > .lvls { margin: calc(-1 * var(--pad)); }
.card-body > .subpanel { margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
.card-body > .subpanel:first-child { margin-top: calc(-1 * var(--pad) + 6px); }
/* Character card: three columns of stacked fields, full width above the summary bar. */
.identity { padding: var(--pad); }
.id-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px clamp(24px, 3vw, 56px); align-items: start; }
.id-col { display: grid; gap: 22px; min-width: 0; }
.id-note { margin-top: 18px; }
@media (max-width: 760px) { .id-grid { grid-template-columns: minmax(0, 1fr); } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; align-items: start; }
.span2 { grid-column: 1 / -1; }

/* ---------- top bar */
.topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 4px 0 var(--gap); }
.back { font-size: 1.3rem; text-decoration: none; color: var(--muted); padding: 4px 6px; }
.plan-name { flex: 1; min-width: 140px; font-family: "Cormorant Garamond", serif; font-size: 2rem; font-weight: 700; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; color: var(--gold); }
.plan-name:hover, .plan-name:focus { border-color: var(--line); outline: none; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-synced .dot { background: var(--ok); }
.sync-saving .dot { background: var(--gold); animation: pulse 1s infinite; }
.sync-offline .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- party tabs */
.party { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: calc(var(--gap) * 1.25); }
.member { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); text-align: left; min-width: 0; }
.member.on { border-color: var(--gold); background: var(--gold-soft); }
.member.empty { border-style: dashed; color: var(--muted); }
.member-wrap { position: relative; min-width: 0; display: grid; }
.member.removable { padding-right: 52px; }
/* Subtle trash on the right of each companion tab; brightens on hover. */
.member-remove { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); opacity: .55; }
.member-remove:hover, .member-remove:focus-visible { opacity: 1; color: var(--warn); background: var(--panel-2); }
.member-text { display: grid; min-width: 0; }
.member-text b, .member-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-text small { color: var(--muted); }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); font-family: "Cormorant Garamond", serif; font-weight: 700; font-size: 1.2rem; color: var(--gold); }
.avatar-img { object-fit: cover; padding: 0; background: var(--panel-2); }
.avatar-add svg, .avatar svg { display: block; }
.member.on .avatar-img { box-shadow: 0 0 0 2px var(--gold); border-color: transparent; }

.cols { display: grid; gap: var(--gap); align-items: start; }
.cols-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-mid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-side { grid-template-columns: minmax(0, 1fr) minmax(360px, 420px); }
.cols-narrow { grid-template-columns: minmax(0, 1fr); }
.col { min-width: 0; }

/* ---------- abilities */
/* Bordered box for grouped content in the Character sheet. */
.box { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; }
.box-note { margin-top: 10px; }
.abil-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.points { font-size: .82rem; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.points strong { color: var(--ink); }
.points.done { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.points.over { border-color: var(--warn); color: var(--warn); }
.abil-scroll { overflow-x: auto; container-type: inline-size; }
/* Fixed layout: Start | Lvl N share one width; a line between every column. */
.abil { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .92rem; }
/* Ability names need less room than the Base stepper; shift 4% from the first column to the second. */
.abil .c-in { width: 22%; }
.abil col:nth-child(1) { width: 18%; }
.abil col:nth-child(2) { width: 26%; }
/* +2 and +1 radios side by side in one column, header labels aligned over them. */
.bonus { display: flex; justify-content: center; gap: 18px; }
.bonus > * { width: 18px; text-align: center; margin: 0; }
.abil th + th, .abil th + td, .abil td + td { border-left: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.abil th, .abil td { padding: 10px 6px; text-align: center; }
.abil thead th { color: var(--muted); font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.abil tbody tr + tr > * { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.abil tbody th { text-align: left; padding-left: 16px; }
/* Calculated columns: lighter band with a divider, set apart from the inputs. */
.abil .res { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.abil thead .res { background: color-mix(in srgb, var(--panel-2) 100%, var(--ink) 4%); }
.abil .res-first { border-left-color: var(--line); }
/* Fixed width (empty when no gain) keeps the Lvl 12 numbers lined up. */
.abil .gain { display: inline-block; width: 2.2em; margin-left: 4px; text-align: left; color: var(--muted); font-size: .8rem; }
.abil td.end { white-space: nowrap; }
.abil td.end::before { content: ''; display: inline-block; width: 2.2em; margin-right: 4px; font-size: .8rem; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 6px; }
.stepper span { min-width: 20px; }
/* Narrow boxes (side column, phones): compact cells so all columns fit. */
@container (max-width: 520px) {
  .abil { font-size: .88rem; }
  .abil th, .abil td { padding: 9px 2px; }
  .abil tbody th { padding-left: 12px; }
  .abil thead th { font-size: .66rem; letter-spacing: .02em; }
  .abil .stepper { gap: 2px; }
  .abil .stepper .btn.tiny { padding: 2px 6px; min-width: 22px; }
  .abil .stepper span { min-width: 16px; }
  .abil td.end::before { display: none; }
  .abil .gain { width: auto; margin-left: 2px; font-size: .72rem; }
  .bonus { gap: 10px; }
}
.abil-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 16px 0; }
.abil-pill { display: grid; text-align: center; padding: 10px 0; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.abil-pill b { font-size: 1.15rem; }
.abil-pill small { color: var(--muted); font-size: .72rem; }
/* Summary bar: level slider + the character at that level, above the panels. */
/* One row: slider | ability scores (to the right edge). */
.summary-bar { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, 1fr); align-items: center; gap: 24px clamp(24px, 3vw, 56px); padding: 22px var(--pad) 24px; }
.sb-label { display: block; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sb-level-head { margin-bottom: 10px; }
/* The thumb is 18px; ticks are inset by half of it so each stop sits under the thumb's centre. */
.sb-range { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; cursor: pointer; display: block; }
.sb-range::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(to right, var(--gold) var(--fill), var(--line) var(--fill)); }
.sb-range::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
.sb-range::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--gold); }
.sb-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--gold); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--gold); }
.sb-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--gold); }
.sb-range:focus-visible { outline: none; }
.sb-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--gold), 0 0 0 5px var(--gold-soft); }
.sb-ticks { display: flex; justify-content: space-between; padding: 0 9px; margin-top: 6px; }
/* 28px hit area, pulled in by half on each side so its centre stays on the stop. */
.sb-tick { position: relative; width: 28px; margin: 0 -14px; height: 28px; border: 0; background: none; padding: 0; color: var(--muted); }
.sb-tick::before { content: ''; position: absolute; top: 0; left: calc(50% - 1px); width: 2px; height: 6px; border-radius: 1px; background: var(--line); }
.sb-tick span { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); font-size: .78rem; font-variant-numeric: tabular-nums; }
.sb-tick.past::before { background: var(--gold); opacity: .6; }
.sb-tick.on { color: var(--gold); font-weight: 700; }
.sb-tick:hover { color: var(--ink); }
.sb-slot-text { color: var(--ink); }
.summary-bar .abil-row { margin: 0; }

/* ---------- levels */
.lvls { list-style: none; }
.lvl { border-top: 1px solid var(--line); }
.lvl:first-child { border-top: 0; }
.lvl-head { display: flex; align-items: center; gap: 12px; padding-right: var(--pad); }
.lvl-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 18px 0 18px var(--pad); background: none; border: 0; text-align: left; }
.lvl-done { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.note-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: .78rem; }
.note-btn:hover { color: var(--gold); border-color: var(--gold); }
.note-btn.has { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.gains { display: grid; gap: 8px; }
.gains .gains-label { color: var(--muted); }
.icon-tag { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; }
.icon-tag .icon { border-radius: 4px; }
.note-input { font-size: .9rem; }
.lvl-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.lvl.open .lvl-n { border-color: var(--gold); color: var(--gold); }
.lvl-title { flex: 1; min-width: 0; }
.lvl-state { font-size: .82rem; }
.lvl-state.todo { color: var(--gold); }
.lvl-body { padding: 4px var(--pad) 28px calc(var(--pad) + 48px); display: grid; gap: 18px; }
.choice { display: grid; gap: 8px; }
.choice.nested { margin-left: 16px; padding-left: 14px; border-left: 2px solid var(--line); }
.choice-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); }
.choice.done .choice-label { color: var(--muted); }
.choice.optional .choice-label { color: var(--muted); }
.pick { text-align: left; padding: 9px 12px; border-radius: 9px; border: 1px dashed var(--line); background: var(--bg); min-height: 44px; }
.choice.done .pick { border-style: solid; }
.pick:hover { border-color: var(--gold); }
.asi { display: flex; gap: 10px; }
.asi .input { width: auto; }

/* ---------- gear */
.gear { display: grid; gap: 10px; }
.gear-head, .gear-row { display: grid; grid-template-columns: 120px repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; }
.gear-head span { font-size: .75rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.gear-slot { font-size: .88rem; color: var(--muted); }
.gear-cell { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); text-align: left; min-width: 0; font-size: .85rem; }
.gear-cell.empty { justify-content: center; color: var(--muted); border-style: dashed; }
.gear-cell.inherited { color: var(--muted); border-style: dashed; }
.gear-cell:hover { border-color: var(--gold); }
.gear-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.icon { flex: none; border-radius: 6px; background: var(--panel-2); object-fit: contain; }
.icon-empty { display: inline-block; }
/* Event thumbnails are wide scene images: crop to fill rather than letterbox. */
.icon.cover { object-fit: cover; }
.r-common { color: var(--r-common); }
.r-uncommon { color: var(--r-uncommon); }
.r-rare { color: var(--r-rare); }
.r-very-rare { color: var(--r-very-rare); }
.r-legendary { color: var(--r-legendary); }
.r-story { color: var(--r-story); }

/* ---------- modal */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(620px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.15rem; }
.modal-body { padding: 20px 24px; overflow: auto; scrollbar-gutter: stable; display: grid; gap: 14px; align-content: start; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0 6px; position: sticky; bottom: -20px; background: var(--panel); }
.filters .input.area { width: auto; max-width: 100%; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.opt-list { list-style: none; display: grid; gap: 8px; }
.opt, .item-row { width: 100%; display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 11px; border: 1px solid transparent; background: var(--bg); text-align: left; }
.opt:hover, .item-row:hover { border-color: var(--line); }
/* Selected: gold border only; a tint makes text and pills hard to read. */
.opt.on, .item-row.on { border-color: var(--gold); }
.opt-text { flex: 1; display: grid; gap: 4px; min-width: 0; }
.opt-name { font-weight: 600; }
.opt-desc { font-size: .84rem; color: var(--muted); }
.opt-where { font-size: .8rem; color: var(--ink); opacity: .8; }
.check { width: 20px; color: var(--gold); font-weight: 700; }
.item-row.locked { opacity: .45; cursor: not-allowed; }
.opt-locked { font-size: .8rem; color: var(--warn); }
.sub-head { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; margin: 22px 0 10px; }
.boons { margin-top: 10px; }
.boon { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); margin-bottom: 10px; }
.boon-main { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 6px 8px; border: 0; border-radius: 7px; background: none; text-align: left; }
.boon-main:not(:disabled):hover { background: var(--panel); }
.boon-main:disabled { cursor: default; }
.boon-main b { font-size: .92rem; }
.boon-fx { font-size: .84rem; color: var(--gold); }
.boon-fx.warn { color: var(--warn); }
.boon-remove { flex: none; width: 30px; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--muted); }
.boon-remove:hover { color: var(--warn); background: var(--panel-2); }
.boost-abils { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.boost-abil { display: grid; gap: 4px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); text-align: center; }
.boost-abil small { color: var(--muted); font-size: .74rem; letter-spacing: .04em; }
.boost-abil:hover { border-color: var(--muted); }
.boost-abil.on { border-color: var(--gold); }
.boost-scores { font-size: 1.05rem; }
.boost-scores b { color: var(--gold); }
.boost-scores .arrow { color: var(--muted); }
.boost-cha { margin-top: 4px; font-size: .92rem; color: var(--ink); }
.add-boon { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; border: 1px dashed var(--line); background: transparent; color: var(--muted); text-align: left; }
.add-boon:hover { border-color: var(--gold); color: var(--ink); }
.add-plus { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--gold); line-height: 1; }
.opt.disabled { opacity: .5; cursor: not-allowed; }
.filter-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.event-opt .icon { border-radius: 8px; }
.opt-required { font-size: .8rem; color: var(--gold); }
/* Story & encounters card */
.story-act:first-child .sub-head { margin-top: 0; }
.story-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; }
.story-row + .story-row { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.story-row .icon { border-radius: 8px; }
.story-text { flex: 1; min-width: 0; display: grid; gap: 6px; }
.story-name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.story-name a:hover { color: var(--gold); }
.story-req, .entry-req { color: var(--gold); }
.story-choice { color: var(--ink); margin-top: 3px; }
.story-choice::before { content: 'Choice — '; color: var(--muted); }
.story-auto { flex: none; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 8px; border: 1px dashed var(--line); border-radius: 6px; }
.story-add { margin-top: 16px; }
.play-add { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.sb-intro { margin-bottom: 14px; }
.pgroups { display: grid; gap: 10px; margin-top: 12px; }
.pgroup { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; }
.pgroup-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 4px; display: grid; }
.pgroup-label small { text-transform: none; letter-spacing: 0; font-size: .72rem; color: var(--t-skill); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { --c: var(--muted); padding: 3px 11px; border-radius: 99px; font-size: .8rem; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 38%, transparent); }
.pill.t-core { --c: var(--ink); }
.pill.t-save { --c: var(--t-save); }
.pill.t-armour { --c: var(--t-armour); }
.pill.t-weapon { --c: var(--t-weapon); }
.pill.t-skill { --c: var(--t-skill); }
.pill.t-choice { --c: var(--t-skill); border-style: dashed; background: transparent; }
.pill.t-expert { --c: var(--gold); }
.pill.t-trait { --c: var(--t-trait); }
.pill.t-sub, .pill.t-none { --c: var(--muted); }
@media (max-width: 560px) { .pgroup { grid-template-columns: 1fr; gap: 3px; } .pgroup-label { padding-top: 0; } }
.profs { display: grid; }
.prof-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; padding: 14px 16px; }
.prof-row + .prof-row { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.prof-label { font-size: .8rem; color: var(--muted); padding-top: 4px; }
/* Narrow side column: label above its chips. */
.cols-side .col:last-child .prof-row { grid-template-columns: 1fr; gap: 6px; }
.cols-side .col:last-child .prof-label { padding-top: 0; }
.subpanel + .subpanel { border-top: 1px solid var(--line); margin-top: var(--pad); padding-top: 6px; }
.subpanel-head { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 16px 0; background: none; border: 0; text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); }
.subpanel-body { padding-bottom: 4px; }
.pick-field { text-align: left; padding-right: 32px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239c9283' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; }
.pick-field:disabled { opacity: .7; cursor: default; }
.prof-row > div { display: flex; flex-wrap: wrap; gap: 6px; }
.prof { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 7px; background: var(--panel); border: 1px solid var(--line); font-size: .84rem; }
.prof small { color: var(--muted); font-size: .7rem; }
.prof.expert { border-color: var(--gold); color: var(--gold); }
.hint { color: var(--gold); width: 100%; margin-top: 2px; }
.sb-items { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); font-size: .85rem; max-width: 100%; }
.sb-chip .icon { border-radius: 5px; }
.sb-glyph { flex: none; width: 28px; height: 28px; border-radius: 5px; display: grid; place-items: center; background: var(--panel-2); color: var(--gold); font-family: "Cormorant Garamond", serif; font-weight: 700; }
.conc { color: var(--gold); font-size: .65rem; margin-left: 2px; }
.item-row-wrap { position: relative; }
.info-btn { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-style: italic; font-family: Georgia, serif; font-weight: 700; }
.info-btn.on { border-color: var(--gold); color: var(--gold); }
.item-row-wrap .item-row { padding-right: 50px; }
.item-row-info { padding: 12px 16px 16px 70px; }
.hover-card { position: fixed; z-index: 60; width: 340px; max-height: calc(100vh - 16px); overflow: hidden; overflow-wrap: anywhere; padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--gold); box-shadow: 0 12px 40px rgba(0, 0, 0, .55); pointer-events: none; }
/* The card follows the cursor and can't be scrolled, so keep it short: flavour text gets three lines. */
.hover-card .ii-quote { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.item-info { display: grid; gap: 12px; font-size: .9rem; }
.tip { display: grid; gap: 10px; font-size: .9rem; padding: 14px 16px; }
.tip p { color: var(--ink); line-height: 1.5; }
.tip-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); margin-bottom: 4px; }
.tip-sec ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; line-height: 1.45; }
.abil-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-right: 10px; }
.q-tip { flex: none; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); font-size: .68rem; font-weight: 600; line-height: 1; cursor: default; }
.q-tip:hover { color: var(--gold); border-color: var(--gold); }
.has-tip:hover { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.ii-head { display: flex; gap: 12px; align-items: center; }
.ii-name { font-weight: 700; font-size: 1.05rem; }
.cap { text-transform: capitalize; }
.ii-stats { font-weight: 600; }
.ii-props { display: flex; flex-wrap: wrap; }
.ii-props .tag { font-size: .78rem; }
.ii-list { display: grid; gap: 2px; }
.ii-list dt { font-weight: 600; color: var(--gold); font-size: .86rem; }
.ii-list dd { color: var(--ink); font-size: .86rem; margin-bottom: 6px; }
.ii-list dd.solo::before { content: '• '; color: var(--muted); }
.ii-quote { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.02rem; color: var(--muted); line-height: 1.35; }
.item-head { display: flex; gap: 14px; align-items: flex-start; }
.item-head > div { display: grid; gap: 3px; }
.item-head .r-common, .item-head [class^="r-"] strong { text-transform: capitalize; }
.src-list { list-style: none; display: grid; gap: 8px; }
.src { display: flex; gap: 12px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); font-size: .88rem; cursor: pointer; }
.src.on { border-color: var(--gold); background: var(--gold-soft); }
.qr { width: 220px; margin: 0 auto; background: #fff; border-radius: 10px; padding: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
.code-big { text-align: center; font-size: 1.4rem; font-weight: 600; letter-spacing: .08em; color: var(--gold); }

/* ---------- play */
.play-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 20px; }
.progress { position: relative; height: 34px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; margin-bottom: 36px; }
.progress-fill { position: absolute; inset: 0 auto 0 0; background: var(--gold-soft); border-right: 2px solid var(--gold); transition: width .3s; }
.progress span { position: relative; display: block; text-align: center; line-height: 32px; font-size: .88rem; }
.stop { margin-bottom: 44px; }
.stop h3 { font-family: "Cormorant Garamond", serif; font-size: 1.7rem; color: var(--gold); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
/* Areas (or levels) flow side by side as the width allows. */
.stops { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 0 calc(var(--gap) * 1.5); align-items: start; }
.stop ul { list-style: none; display: grid; gap: 12px; }
.entry { display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.entry.done { opacity: .5; }
.entry.done .entry-name { text-decoration: line-through; }
.entry-text { flex: 1; min-width: 0; display: grid; gap: 6px; }
.entry-name { font-weight: 600; text-decoration: none; }
.tick { flex: none; width: 38px; height: 38px; border-radius: 9px; border: 2px solid var(--line); background: var(--bg); color: #1b1408; font-weight: 800; font-size: 1.1rem; }
.tick.on { background: var(--gold); border-color: var(--gold); }
.lines { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .88rem; }
.lines dt { color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 72px 0; }

@media (max-width: 1100px) {
  .summary-bar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .party { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar .sync-label { display: none; }
  .plan-name { font-size: 1.4rem; order: -1; flex-basis: calc(100% - 40px); }
  .gear-head { display: none; }
  .gear-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gear-slot { grid-column: 1 / -1; margin-top: 6px; }
  .gear-cell .icon { display: none; }
  .lvl-body { padding-left: var(--pad); }
  .note-btn { padding: 6px; } .note-btn span { display: none; }
  .play-bar .seg { flex: 1 1 100%; }
  .play-bar .seg { min-width: 0; }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 16px 18px; }
  .lvl-body { gap: 16px; }
  .abil-row { grid-template-columns: repeat(3, 1fr); }
  .abil th, .abil td { padding: 10px 3px; }
  .abil tbody th { padding-left: 10px; }
  .abil td.end::before { display: none; }
  .abil .gain { width: auto; }
  .stepper { gap: 4px; }
  .stepper .btn.tiny { padding: 4px 8px; }
  .summary-bar { grid-template-columns: minmax(0, 1fr); }
  .prof-row { grid-template-columns: 1fr; gap: 6px; }
  .prof-label { padding-top: 0; }
}

/* ---------- gear recommendations */
.recs { border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); border-radius: 12px; padding: 4px 12px 10px; margin: 6px 0 14px; background: color-mix(in srgb, var(--gold) 4%, transparent); }
.recs-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; background: none; border: 0; color: var(--gold); font-weight: 600; text-align: left; }
.recs-head .muted { font-weight: 400; }
.recs .opt-list { margin: 0; }
.rec-why { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.rec-pill { font-size: .74rem; padding: 2px 8px; border-radius: 7px; line-height: 1.4; color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent); }
@media (max-width: 560px) { .recs { padding: 2px 8px 8px; } }
.level-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tab-count { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 4px; border-radius: 9px; font-size: .7rem; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }
.step-note { margin-bottom: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; cursor: pointer; font: inherit; }
.swap-arrow { margin: 0 8px 0 2px; }
/* Scores raised by equipped gear (hover for which item). */
.abil .res.end.geared, .abil-pill.geared b { color: var(--gold); }
/* Gear the character can't use well: dimmed, with the reason in red. */
.item-row.unfit .icon, .item-row.unfit .opt-name { opacity: .55; }
.unfit-note { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--warn); }
.gear-warn { flex: none; margin-left: auto; color: var(--warn); display: inline-flex; }
