/* ==========================================================================
   SONS OF DAEMONHEIM
   Cold wet stone, moss, torchlight, and the long walk down.
   Evocative, not skeuomorphic. No framework, no build step.
   ========================================================================== */

:root {
  /* Stone — the dungeon walls, cold and blue-green */
  --stone-990: #05080a;
  --stone-950: #080c0e;
  --stone-900: #0b1013;
  --stone-870: #0e1519;
  --stone-850: #11191d;
  --stone-800: #151f24;
  --stone-750: #1a262c;
  --stone-700: #203038;
  --line: #263a43;
  --line-soft: #182429;

  /* Torchlight */
  --amber: #d99a3f;
  --amber-bright: #f7cd88;
  --amber-deep: #a86f22;
  --amber-glow: rgba(217, 154, 63, .13);

  /* Moss on the stonework */
  --moss: #6e9455;
  --moss-bright: #a3cd7e;

  /* Deeper floors */
  --frost: #6fa8c0;
  --shade: #9781e0;

  --danger: #e2685f;
  --warn: #e5a63f;

  --text: #e2eaeb;
  --text-dim: #96a7ac;
  --text-faint: #5d6d75;

  --radius: 13px;
  --radius-sm: 8px;
  --maxw: 1180px;

  --shadow: 0 1px 2px rgba(0,0,0,.6), 0 12px 38px rgba(0,0,0,.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5), 0 4px 14px rgba(0,0,0,.3);
  --inset-top: inset 0 1px 0 rgba(255,255,255,.045);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Cinzel', 'Inter', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, .78, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  background-color: var(--stone-900);
  background-image:
    radial-gradient(760px 340px at 50% -4%, rgba(217,154,63,.13) 0%, transparent 62%),
    radial-gradient(1250px 720px at 50% -16%, #16242e 0%, transparent 66%),
    /* cut-stone mortar joints, offset per course */
    repeating-linear-gradient(0deg, rgba(255,255,255,.016) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.011) 0 1px, transparent 1px 128px);
  background-attachment: fixed;
}

/* faint damp vignette down the sides of the shaft */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.42) 0%, transparent 14%, transparent 86%, rgba(0,0,0,.42) 100%),
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,.3) 100%);
}
main, .topbar { position: relative; z-index: 1; }

a { color: var(--amber-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

::selection { background: rgba(217,154,63,.28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Topbar ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(180deg, rgba(9,13,16,.94), rgba(9,13,16,.86));
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
/* torch-glow hairline under the header */
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217,154,63,.45), transparent);
}

.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 62px; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: .05em;
}
.brand .ring { flex: none; display: block; }
.brand .ring circle, .brand .ring path { transition: opacity .3s var(--ease); }
.brand .sub {
  font-family: var(--font);
  font-weight: 500;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: .16em;
  text-transform: uppercase;
  padding-left: 11px;
  border-left: 1px solid var(--line);
}

/* The strip scrolls horizontally once there are more tabs than fit. It gave
   no sign of that — it just looked like the list ended. The mask fades the
   trailing edge so there's a visible cue that more exists, and the active tab
   is scrolled into view on selection. */
nav.tabs {
  display: flex; gap: 3px; margin-left: auto;
  overflow-x: auto; scrollbar-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
}
nav.tabs::-webkit-scrollbar { display: none; }

/* A section that threw while rendering. Shown in place so a failure is
   visible rather than a silent blank. */
.section-error {
  padding: 12px 14px; margin-bottom: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226,104,95,.35);
  background: rgba(226,104,95,.09);
  color: var(--danger); font-size: 12.5px;
}

/* In-page jump links, for tabs that grew several sections deep. */
.jumps {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.jumps a {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-dim); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; background: var(--stone-850);
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.jumps a:hover {
  color: var(--amber-bright); border-color: rgba(217,154,63,.45); text-decoration: none;
}

nav.tabs button {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .015em;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
nav.tabs button:hover { color: var(--text); background: rgba(255,255,255,.04); }
nav.tabs button[aria-selected='true'] {
  color: var(--amber-bright);
  background: var(--amber-glow);
  border-color: rgba(217,154,63,.36);
  font-weight: 600;
  box-shadow: 0 0 18px -6px var(--amber);
}

/* ---------- Hero -------------------------------------------------------- */

/* The hero sits on the corridor art. Two layers in one property: a scrim
   gradient on top, the SVG underneath. The scrim is heaviest on the left
   because the headline is left-aligned and the left torch is the brightest
   thing in the frame — without it the title sits in a pool of amber and
   stops being readable.

   If /images/hero.svg ever 404s, the background-color and the scrim still
   paint and you get the flat dark block this used to be. Nothing breaks. */
.hero {
  position: relative;
  padding: 50px 24px 30px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  background-color: var(--stone-900);
  background-image:
    linear-gradient(90deg,
      rgba(8,12,14,.95) 0%,
      rgba(8,12,14,.84) 38%,
      rgba(8,12,14,.46) 66%,
      rgba(8,12,14,.22) 100%),
    url('/images/hero.svg');
  background-repeat: no-repeat, no-repeat;
  background-size: cover, cover;
  background-position: center, center;
}

/* Narrow screens crop `cover` to the middle of the frame, which is the
   darkest part — both torches fall outside the box and it reads as an empty
   rectangle. Anchoring left of centre keeps one torch in shot. */
@media (max-width: 700px) {
  .hero {
    padding: 38px 18px 24px;
    background-position: center, 24% center;
    background-image:
      linear-gradient(180deg,
        rgba(8,12,14,.72) 0%,
        rgba(8,12,14,.86) 55%,
        rgba(8,12,14,.94) 100%),
      url('/images/hero.svg');
  }
}

.hero .eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--moss);
  font-weight: 600;
  margin-bottom: 14px;
}
.hero .eyebrow::after {
  content: '';
  flex: 1;
  max-width: 190px;
  height: 1px;
  background: linear-gradient(90deg, rgba(110,148,85,.55), transparent);
}

.hero h1 {
  margin: 0 0 13px;
  font-family: var(--display);
  font-size: clamp(31px, 5.8vw, 55px);
  font-weight: 700;
  letter-spacing: .004em;
  line-height: 1.02;
  color: #f6efe2;
  text-shadow: 0 0 52px rgba(217,154,63,.3), 0 2px 0 rgba(0,0,0,.5);
}

.hero p { margin: 0; color: var(--text-dim); max-width: 60ch; font-size: 15.5px; }

.hero .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-850));
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  box-shadow: var(--inset-top);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
a.chip:hover { border-color: rgba(217,154,63,.5); color: var(--amber-bright); text-decoration: none; }
.chip.gold { border-color: rgba(217,154,63,.36); color: var(--amber-bright); background: var(--amber-glow); }
.chip.dot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--moss-bright);
  box-shadow: 0 0 9px var(--moss-bright);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- Views / sections -------------------------------------------- */

section.view { display: none; padding-bottom: 84px; }
section.view.active { display: block; animation: rise .26s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--stone-800) 0%, var(--stone-870) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--inset-top);
  position: relative;
}

h2.section-title {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 40px 0 15px;
}
h2.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}
h2.section-title .glyph { color: var(--moss); font-size: 8px; opacity: .9; }

/* ---------- Party cards -------------------------------------------------- */

.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.player-card { padding: 20px 22px; overflow: hidden; transition: border-color .25s var(--ease); }
.player-card:hover { border-color: var(--accent-soft, var(--line)); }
.player-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--amber)), transparent);
}
/* soft light bleed from the accent edge */
.player-card::after {
  content: '';
  position: absolute;
  top: -70px; left: 50%;
  width: 220px; height: 120px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--accent, var(--amber)), transparent);
  opacity: .13;
  pointer-events: none;
}

.player-card .who { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.player-card .who h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .025em;
}
.player-card .rsn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--stone-990);
}
.player-card .tag { color: var(--text-dim); font-size: 13px; margin: 0 0 17px; }

.stat-row { display: flex; gap: 30px; }
.stat .label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--text-faint);
  font-weight: 600;
}
.stat .value {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.28;
}
.stat .value.accent { color: var(--accent, var(--amber)); }

.lead-note {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--text-dim);
}
.lead-note strong { color: var(--text); }
.lead-note code {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--stone-990); padding: 1px 5px;
  border-radius: 4px; border: 1px solid var(--line-soft);
}

/* ---------- Since-last-visit + milestones -------------------------------- */

.since {
  margin-top: 13px; padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--moss-bright);
  font-variant-numeric: tabular-nums;
}
.since + .since { margin-top: 5px; padding-top: 0; border-top: 0; }
.since b { color: #fff; font-weight: 650; }
.since.quiet { color: var(--text-faint); }
.since-arrow { font-size: 9px; margin-right: 3px; }

.milestones { padding: 19px 22px; margin-top: 15px; }
.milestones h3 {
  margin: 0 0 14px; font-family: var(--display);
  font-size: 15px; font-weight: 700; letter-spacing: .03em;
}
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 8px; }
.ms {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.024);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent, var(--amber));
  font-size: 12.5px; min-width: 0;
}
.ms-who {
  font-size: 9px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent, var(--amber)); flex: none;
}
.ms-skill { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-xp { margin-left: auto; color: var(--moss-bright); font-family: var(--mono); font-size: 11.5px; flex: none; }
.ms-lv { color: var(--text-faint); font-family: var(--mono); font-size: 10.5px; flex: none; }

/* ---------- Activity feed (RuneMetrics) ---------------------------------- */

.qline {
  margin-top: 11px; font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.qline b { color: var(--text); font-weight: 650; }

.feed { padding: 19px 22px; margin-top: 15px; }
.feed h3 {
  margin: 0 0 14px; font-family: var(--display);
  font-size: 15px; font-weight: 700; letter-spacing: .03em;
}
.feed-none { margin: 0; font-size: 12.5px; color: var(--text-faint); }
.feed-list { display: grid; gap: 2px; }

.feed-item {
  display: grid;
  grid-template-columns: 78px 54px 1fr;
  align-items: baseline; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent, var(--amber));
  background: rgba(255,255,255,.018);
  font-size: 12.5px;
  transition: background .16s var(--ease);
}
.feed-item:hover { background: rgba(255,255,255,.04); }
.feed-when { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.feed-who {
  font-size: 9px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent, var(--amber));
}
.feed-what { color: var(--text-dim); min-width: 0; }
.feed-what b { color: var(--text); font-weight: 650; }
.feed-item.levelup .feed-what b:last-child { color: var(--moss-bright); }
.feed-note { margin-top: 12px; font-size: 11px; color: var(--text-faint); }

/* ---------- Skill board -------------------------------------------------
   NOTE: .board deliberately has NO `overflow: hidden`.
   An overflow-hidden ancestor turns .board into the scroll container for the
   sticky .board-head, which then translates down over the first rows and
   hides Attack / Defence / Strength. Corners are rounded on the first and
   last children instead so nothing clips the sticky header.
   ------------------------------------------------------------------------ */

.board {
  border-radius: var(--radius);
  /* no overflow property here — see note above */
}
.board > :first-child { border-radius: var(--radius) var(--radius) 0 0; }
.board > :last-child  { border-radius: 0 0 var(--radius) var(--radius); }

.board-head,
.board-row {
  display: grid;
  grid-template-columns: minmax(112px, 1.5fr) 1fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
}

.board-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-750), var(--stone-800));
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  position: sticky;
  top: 62px;                 /* clears the 62px topbar */
  z-index: 20;               /* above the rows it pins over */
  box-shadow: 0 6px 14px -8px rgba(0,0,0,.85);
}
.board-head .p { text-align: right; }
.board-head .p span {
  display: block;
  font-size: 9px;
  opacity: .72;
  letter-spacing: .06em;
  font-family: var(--mono);
  text-transform: none;
}

.board-row {
  border-bottom: 1px solid var(--line-soft);
  transition: background .16s var(--ease);
}
.board-row:last-child { border-bottom: 0; }
.board-row:nth-child(even) { background: rgba(255,255,255,.014); }
.board-row:hover { background: rgba(217,154,63,.06); }

.skill-name { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px; min-width: 0; }
.skill-name span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-name .pip {
  width: 6px; height: 6px; flex: none;
  border-radius: 1px;
  transform: rotate(45deg);
  background: var(--text-faint);
}
.pip.combat { background: var(--danger); box-shadow: 0 0 7px -1px var(--danger); }
.pip.gathering { background: var(--moss-bright); box-shadow: 0 0 7px -1px var(--moss-bright); }
.pip.artisan { background: var(--amber); box-shadow: 0 0 7px -1px var(--amber); }
.pip.support { background: var(--frost); box-shadow: 0 0 7px -1px var(--frost); }
.pip.elite { background: var(--shade); box-shadow: 0 0 7px -1px var(--shade); }

.cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; justify-content: flex-end; gap: 9px;
  position: relative; padding-bottom: 5px;
}
/* hairline progress toward the next level */
.tonext {
  position: absolute; right: 0; bottom: 0;
  width: 46px; height: 2px;
  background: var(--stone-990);
  border-radius: 2px; overflow: hidden;
}
.tonext > i {
  display: block; height: 100%;
  background: var(--line);
  transition: width .6s var(--ease);
}
.cell.win .tonext > i { background: rgba(217,154,63,.75); }
.board-row:hover .tonext > i { background: var(--amber); }
.cell .lv { font-size: 15px; font-weight: 650; min-width: 2.2ch; }
.cell .xp { font-size: 10.5px; color: var(--text-faint); min-width: 8ch; font-family: var(--mono); }
.cell.win .lv { color: var(--amber-bright); }
.cell.miss { color: var(--text-faint); }

.legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin-top: 12px; font-size: 11px; color: var(--text-faint);
}
.legend i { display: inline-flex; align-items: center; gap: 6px; font-style: normal; }
.legend .pip { width: 6px; height: 6px; border-radius: 1px; transform: rotate(45deg); display: inline-block; }

/* ---------- Skill detail modal ------------------------------------------ */

.board-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-faint);
}

.board-row[role='button'] { cursor: pointer; }
.board-row[role='button']:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

.sm-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 7, 9, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
  animation: fadeIn .18s var(--ease);
  overflow-y: auto;
}
.sm-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sm-panel {
  width: 100%; max-width: 860px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  animation: popIn .22s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

.sm-head-bar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 19px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-750), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
  flex: none;
}
.sm-head-bar h3 {
  margin: 0; font-family: var(--display);
  font-size: 21px; font-weight: 700; letter-spacing: .02em;
}
.sm-sub {
  font-size: 9.5px; letter-spacing: .17em; text-transform: uppercase;
  font-weight: 700; color: var(--text-faint); margin-top: 3px;
}
.sm-sub.combat { color: var(--danger); }
.sm-sub.gathering { color: var(--moss-bright); }
.sm-sub.artisan { color: var(--amber); }
.sm-sub.support { color: var(--frost); }
.sm-sub.elite { color: var(--shade); }

.sm-close {
  appearance: none; border: 1px solid var(--line);
  background: var(--stone-850); color: var(--text-dim);
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 20px; line-height: 1; cursor: pointer; flex: none;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.sm-close:hover { color: var(--amber-bright); border-color: rgba(217,154,63,.5); }

.sm-body { padding: 20px 22px 24px; overflow-y: auto; }

.sm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.sm-col {
  border-left: 2px solid var(--accent, var(--amber));
  padding-left: 14px;
}
.sm-col-head {
  display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px;
}
.sm-who {
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent, var(--amber));
}
.sm-lvl { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

.sm-now, .sm-next { margin-bottom: 13px; }
.sm-now:last-child, .sm-next:last-child { margin-bottom: 0; }
.sm-label {
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 700; color: var(--text-faint); margin-bottom: 4px;
}
.sm-now .sm-label { color: var(--moss-bright); }
.sm-head { font-size: 14px; font-weight: 650; color: var(--text); line-height: 1.35; }
.sm-detail { margin: 5px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.sm-now.muted .sm-head { color: var(--text-dim); font-weight: 550; }

.sm-why {
  margin-top: 20px; padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--amber-glow);
  border: 1px solid rgba(217,154,63,.24);
  font-size: 13px; color: var(--text-dim);
}
.sm-why-tag {
  display: block; font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 700;
  color: var(--amber); margin-bottom: 4px;
}

.sm-always { margin-top: 20px; }
.sm-always h4 {
  margin: 0 0 10px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text);
}
.sm-always ul { margin: 0; padding-left: 0; list-style: none; }
.sm-always li {
  position: relative; padding-left: 19px; margin-bottom: 8px;
  font-size: 13px; color: var(--text-dim); line-height: 1.55;
}
.sm-always li::before {
  content: ''; position: absolute; left: 3px; top: 8px;
  width: 5px; height: 5px; border-radius: 1px;
  transform: rotate(45deg); background: var(--moss);
}

.sm-foot {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  font-size: 12px;
}
.sm-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
}
.sm-badge.ok { color: var(--moss-bright); background: rgba(110,148,85,.13); border: 1px solid rgba(110,148,85,.32); }
.sm-badge.warn { color: var(--warn); background: rgba(229,166,63,.1); border: 1px solid rgba(229,166,63,.3); }

/* ---------- Floor progress ---------------------------------------------- */

.goals { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.goal-card { padding: 22px; }
.goal-card h3 { margin: 0 0 5px; font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.goal-card .goal-owner {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent, var(--amber)); font-weight: 700; margin-bottom: 7px;
}
.goal-card .blurb {
  color: var(--text-dim); font-size: 13px; margin: 0 0 20px;
  padding-bottom: 17px; border-bottom: 1px solid var(--line-soft);
}

.goal { margin-bottom: 19px; }
.goal:last-child { margin-bottom: 0; }

.goal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.goal-top .name { font-size: 13.5px; font-weight: 600; }
.goal-top .num { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--text-dim); font-family: var(--mono); }
.goal-top .num b { color: var(--text); font-weight: 650; }

.bar {
  height: 10px; border-radius: 3px;
  background: var(--stone-990);
  border: 1px solid var(--line-soft);
  overflow: hidden; position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.7);
}
.bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--amber-deep), var(--accent, var(--amber)) 55%, var(--amber-bright));
  box-shadow: 0 0 16px -2px var(--accent, var(--amber));
  transition: width .9s var(--ease);
}
.bar::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(5,8,10,.92) calc(10% - 2px) 10%);
}
.bar.done > i { background: linear-gradient(90deg, var(--moss), var(--moss-bright)); box-shadow: 0 0 16px -2px var(--moss); }

.eta {
  font-size: 11px; color: var(--amber); margin-top: 6px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.goal .note { font-size: 11.5px; color: var(--text-faint); margin-top: 7px; }
.goal .note.complete { color: var(--moss-bright); }

/* ---------- Advice / what to grind next --------------------------------- */

.advice { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.advice-card { padding: 22px; }
.advice-card > h3 {
  margin: 0 0 4px; font-family: var(--display);
  font-size: 18px; font-weight: 700; letter-spacing: .02em;
}
.advice-card .goal-owner { margin-bottom: 7px; }
.advice-card .derived {
  font-size: 11px; color: var(--text-faint); margin: 0 0 18px;
  padding-bottom: 15px; border-bottom: 1px solid var(--line-soft);
}

.tip {
  position: relative;
  padding: 13px 15px 13px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.022);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent, var(--amber));
  margin-bottom: 10px;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.tip:last-child { margin-bottom: 0; }
.tip:hover { background: rgba(255,255,255,.04); transform: translateX(2px); }

.tip .tip-tag {
  display: inline-block;
  font-size: 8.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent, var(--amber));
  margin-bottom: 5px;
}
.tip .tip-title { font-size: 13.5px; font-weight: 650; margin-bottom: 4px; color: var(--text); }
.tip .tip-body { font-size: 12.5px; color: var(--text-dim); margin: 0; line-height: 1.55; }

.group-tips { padding: 22px; }
.group-tips h3 { margin: 0 0 16px; font-family: var(--display); font-size: 17px; letter-spacing: .02em; }
.group-tips .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.group-tips .gt h4 { margin: 0 0 5px; font-size: 12.5px; font-weight: 650; }
.group-tips .gt p { margin: 0; font-size: 12.5px; color: var(--text-dim); }
.group-tips .gt { padding-left: 14px; border-left: 2px solid var(--moss); }

/* ---------- Upgrades ----------------------------------------------------- */

.upg { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.upg-card { padding: 22px; }
.upg-card h3 {
  margin: 0 0 16px; font-family: var(--display);
  font-size: 18px; font-weight: 700; letter-spacing: .02em;
}

.upg-list { list-style: none; margin: 0; padding: 0; counter-reset: upg; }

.upg-item {
  position: relative;
  padding: 12px 0 13px 0;
  border-top: 1px solid var(--line-soft);
}
.upg-item:first-child { border-top: 0; padding-top: 0; }
.upg-item.done { opacity: .5; }
.upg-item.later { opacity: .72; }
.upg-item.next {
  padding-left: 13px;
  border-left: 2px solid var(--accent, var(--amber));
  background: linear-gradient(90deg, var(--amber-glow), transparent 70%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.upg-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.upg-title { font-size: 13.5px; font-weight: 650; color: var(--text); }
.upg-item.done .upg-title { text-decoration: line-through; text-decoration-color: var(--text-faint); }

.upg-state {
  font-size: 8.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; padding: 3px 7px; border-radius: 999px;
  flex: none; border: 1px solid transparent;
}
.upg-state.done  { color: var(--moss-bright); background: rgba(110,148,85,.13); border-color: rgba(110,148,85,.3); }
.upg-state.next  { color: var(--bg, #0b1013); background: var(--amber); }
.upg-state.later { color: var(--text-faint); background: rgba(255,255,255,.04); border-color: var(--line-soft); }
.upg-state.check { color: var(--frost); background: rgba(111,168,192,.1); border-color: rgba(111,168,192,.3); }

.upg-req {
  font-size: 10.5px; color: var(--text-faint); font-family: var(--mono);
  margin-top: 4px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.upg-approx {
  font-family: var(--font); font-size: 8.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--warn);
  border: 1px solid rgba(229,166,63,.32); border-radius: 999px; padding: 2px 7px;
}

.upg-body { margin: 6px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }

/* ---------- Today + search --------------------------------------------------- */

.today { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.today-card { padding: 22px; }
.today-flag {
  display: inline-block; font-size: 8.5px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--moss-bright); background: rgba(110,148,85,.13);
  border: 1px solid rgba(110,148,85,.32);
  padding: 3px 9px; border-radius: 999px; margin-bottom: 9px;
}
.today-what {
  margin: 4px 0 9px; font-family: var(--display);
  font-size: 20px; font-weight: 700; letter-spacing: .015em; line-height: 1.25;
}
.today-why { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.6; max-width: 74ch; }
.today-src {
  margin-top: 11px; font-size: 10px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--text-faint); font-weight: 600;
}
.today-together { padding: 22px; border-color: rgba(217,154,63,.34); }

.today-alts { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.today-alts > summary {
  cursor: pointer; list-style: none; font-size: 11.5px;
  color: var(--text-faint); font-weight: 600;
}
.today-alts > summary::-webkit-details-marker { display: none; }
.today-alts[open] > summary { margin-bottom: 12px; color: var(--text-dim); }
.today-alt { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.today-alt:first-of-type { border-top: 0; }
.ta-what { font-size: 13px; font-weight: 650; color: var(--text); }
.ta-why { margin: 3px 0 0; font-size: 12.5px; color: var(--text-dim); }

.site-search {
  width: 100%; appearance: none;
  background: var(--stone-950); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text);
  font: inherit; font-size: 15px; padding: 13px 16px;
  min-height: 48px; margin-bottom: 11px;
}
.site-search::placeholder { color: var(--text-faint); }
.site-search:focus { outline: none; border-color: rgba(217,154,63,.55); }

.searchres { padding: 6px; max-height: 620px; overflow-y: auto; }
.sr-row {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 11px; align-items: start;
  padding: 10px 11px; border-radius: var(--radius-sm);
  text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line-soft);
}
.sr-row:last-child { border-bottom: 0; }
.sr-row:hover { background: rgba(255,255,255,.04); text-decoration: none; }
.sr-kind {
  font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--text-faint); margin-top: 2px;
}
.sr-kind.k-trap, .sr-kind.k-dead-end { color: var(--warn); border-color: rgba(229,166,63,.34); }
.sr-kind.k-guide { color: var(--moss-bright); border-color: rgba(110,148,85,.3); }
.sr-kind.k-skill { color: var(--frost); border-color: rgba(111,168,192,.3); }
.sr-kind.k-shop, .sr-kind.k-chase { color: var(--amber); border-color: rgba(217,154,63,.3); }
.sr-body { min-width: 0; display: grid; gap: 2px; }
.sr-title { font-size: 13.5px; color: var(--text); font-weight: 550; line-height: 1.35; }
.sr-sub { font-size: 11px; color: var(--amber); }
.sr-snip { font-size: 12px; color: var(--text-faint); line-height: 1.45; }
.sr-where {
  font-size: 10px; color: var(--text-faint); white-space: nowrap; margin-top: 3px;
}

/* ---------- Drop log + Chronicle ---------------------------------------------- */

.paste-zone {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 12px;
  text-align: center; cursor: pointer;
  color: var(--text-faint); font-size: 12.5px;
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.paste-zone:hover, .paste-zone:focus {
  border-color: rgba(217,154,63,.5); color: var(--text-dim); outline: none;
}
#paste-preview { display: block; max-width: 100%; max-height: 220px; margin: 11px auto 0; border-radius: 6px; }
.drop-img {
  display: block; max-width: 100%; margin-top: 9px;
  border-radius: 6px; border: 1px solid var(--line);
}
.drop-noimg { color: var(--warn); }
.listrow.drop .lr-skull { color: var(--amber); }

.chron-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chroncard { padding: 20px 22px; }
.chron-msg {
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--amber-glow); border: 1px solid rgba(217,154,63,.28);
  color: var(--amber-bright); font-size: 12.5px; margin-bottom: 15px;
  /* The unsaved-prose fallback puts the whole entry in here, paragraphs and
     all, so line breaks have to survive. */
  white-space: pre-wrap;
}
.chron-msg.err { background: rgba(226,104,95,.1); border-color: rgba(226,104,95,.3); color: var(--danger); }
.chron-entry { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.chron-entry:first-of-type { border-top: 0; padding-top: 0; }
.chron-period {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--amber); margin-bottom: 10px;
}
.chron-p {
  margin: 0 0 11px; font-size: 14px; line-height: 1.72;
  color: var(--text-dim); max-width: 68ch;
}
.chron-facts { margin-top: 12px; }
.chron-facts > summary {
  cursor: pointer; list-style: none; font-size: 11px;
  color: var(--text-faint); font-weight: 600;
}
.chron-facts > summary::-webkit-details-marker { display: none; }
.chron-facts ul { margin: 9px 0 0; padding-left: 18px; }
.chron-facts li { font-size: 12px; color: var(--text-faint); margin-bottom: 3px; }

@media (max-width: 780px) {
  .today { grid-template-columns: 1fr; }
  .today-card, .today-together, .chroncard { padding: 18px 16px; }
  .today-what { font-size: 18px; }
  .sr-row { grid-template-columns: auto 1fr; }
  .sr-where { grid-column: 2; margin-top: 1px; }
  .searchres { max-height: none; }
  .add-form.drop input[type='text'] { flex: 1 1 100%; }
}

/* ---------- History --------------------------------------------------------- */

.histcard { padding: 18px 20px; margin-bottom: 6px; }
.spark { width: 100%; height: 140px; display: block; color: var(--text); }
.spark-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.spark-legend i {
  font-style: normal; font-size: 11.5px; color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 7px;
  font-variant-numeric: tabular-nums;
}
.spark-legend i::before {
  content: ''; width: 12px; height: 2px; border-radius: 2px;
  background: var(--accent, var(--amber));
}

.hist-row {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px;
  padding: 11px 0; border-top: 1px solid var(--line-soft);
  align-items: start;
}
.hist-row:first-child { border-top: 0; padding-top: 0; }
.hist-date { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); padding-top: 2px; }
.hist-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hist-cell {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px;
  padding-left: 11px; border-left: 2px solid var(--accent, var(--line));
  font-size: 12.5px;
}
.hc-who {
  font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent, var(--text-faint)); width: 100%;
}
.hc-gain { color: var(--moss-bright); font-weight: 650; font-variant-numeric: tabular-nums; }
.hc-flat { color: var(--text-faint); }
.hc-lvl {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--amber); border: 1px solid rgba(217,154,63,.3);
  padding: 1px 7px; border-radius: 999px;
}
.hc-span, .hc-seed, .hc-none {
  font-size: 10.5px; color: var(--text-faint); font-style: italic;
}
.hc-abs { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.hc-skills { width: 100%; font-size: 11px; color: var(--text-dim); margin-top: 1px; }

@media (max-width: 780px) {
  .histcard { padding: 15px 14px; }
  .spark { height: 120px; }
  .hist-row { grid-template-columns: 1fr; gap: 7px; }
  .hist-cells { grid-template-columns: 1fr; gap: 9px; }
}

/* ---------- Quest planner -------------------------------------------------- */

.quest-filters { display: flex; gap: 3px; margin-bottom: 12px; }
.questlist { padding: 8px; }
.listrow.quest { align-items: flex-start; }
.listrow.quest .lr-check { margin-top: 2px; }
.q-unlocks {
  margin-top: 4px; font-size: 12px; color: var(--moss-bright);
}
.q-why {
  margin: 5px 0 0; font-size: 12.5px; color: var(--text-dim);
  line-height: 1.55; max-width: 86ch;
}
.listrow.quest.done .q-unlocks,
.listrow.quest.done .q-why { color: var(--text-faint); }

/* ---------- Time-gating --------------------------------------------------- */

.timers { display: grid; gap: 13px; }
.timer-card, .timer-lead { padding: 19px 21px; }

.timer-lead { border-color: rgba(229,166,63,.32); background: linear-gradient(180deg, rgba(229,166,63,.08), var(--stone-870)); }
.tl-flag {
  font-size: 9px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase;
  color: var(--warn); margin-bottom: 8px;
}
.timer-lead p { margin: 0 0 10px; font-size: 13.5px; color: var(--text-dim); max-width: 84ch; }

.timer-card h3 {
  margin: 0 0 13px; font-family: var(--display);
  font-size: 17px; font-weight: 700; letter-spacing: .02em;
}
.timer-card.cache { border-color: rgba(111,168,192,.3); }
.timer-card.dead { border-color: rgba(226,104,95,.28); }

.timer-list { margin: 0; padding-left: 0; list-style: none; }
.timer-list li {
  position: relative; padding-left: 18px; margin-bottom: 7px;
  font-size: 13px; color: var(--text-dim); max-width: 86ch;
}
.timer-list li::before {
  content: ''; position: absolute; left: 3px; top: 8px;
  width: 5px; height: 5px; border-radius: 1px; transform: rotate(45deg);
  background: var(--frost);
}
.timer-sowhat {
  margin: 15px 0 0; padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(111,168,192,.09);
  border-left: 2px solid var(--frost);
  font-size: 13px; color: var(--text-dim); max-width: 86ch;
}

.clockline { font-size: 14px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.clockline b { color: var(--text); font-weight: 650; }
.clock-left {
  display: inline-block; margin-left: 8px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--amber); border: 1px solid rgba(217,154,63,.3);
  padding: 2px 9px; border-radius: 999px;
}
.timer-note { margin: 11px 0 0; font-size: 12px; color: var(--text-faint); max-width: 86ch; }

.timer-row { padding: 9px 0; border-top: 1px solid var(--line-soft); }
.timer-row:first-of-type { border-top: 0; padding-top: 0; }
.tr-name { font-size: 13px; font-weight: 650; color: var(--text); }
.tr-name.dead { color: var(--danger); }
.tr-limit { margin-top: 2px; font-size: 12px; color: var(--amber); font-family: var(--mono); }
.tr-note { margin-top: 3px; font-size: 12.5px; color: var(--text-dim); max-width: 86ch; }

.timer-card.caps > summary {
  cursor: pointer; list-style: none;
  font-family: var(--display); font-size: 15px; font-weight: 700;
  letter-spacing: .02em; color: var(--moss-bright);
}
.timer-card.caps > summary::-webkit-details-marker { display: none; }
.timer-card.caps[open] > summary { margin-bottom: 13px; }
.timer-card.caps .timer-list li::before { background: var(--moss); }

@media (max-width: 780px) {
  .timer-card, .timer-lead { padding: 16px 15px; }
  .clock-left { display: block; margin: 6px 0 0; width: fit-content; }
}

/* ---------- Division of labour -------------------------------------------- */

.labour { padding: 6px 0; overflow: hidden; }

.lab-head, .lab-row {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) 46px 46px minmax(0, 1.7fr);
  gap: 12px; align-items: start;
  padding: 11px 18px;
}
.lab-head {
  font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 700; color: var(--text-faint);
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.2);
  align-items: center;
}
.lab-head .lab-p { text-align: center; }

.lab-row {
  border-bottom: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent, transparent);
  transition: background .16s var(--ease);
}
.lab-row:last-child { border-bottom: 0; }
.lab-row:hover { background: rgba(255,255,255,.022); }

.lab-title { font-size: 13.5px; font-weight: 650; color: var(--text); }
.lab-why { margin-top: 3px; font-size: 12px; color: var(--text-dim); }

.lab-lvl {
  text-align: center; font-family: var(--mono); font-size: 13px;
  color: var(--text-faint); padding-top: 1px;
}
.lab-lvl.owner {
  color: var(--accent, var(--amber)); font-weight: 700;
  position: relative;
}
.lab-lvl.owner::after {
  content: ''; display: block; width: 16px; height: 2px;
  background: var(--accent, var(--amber)); border-radius: 2px;
  margin: 3px auto 0;
}

.lab-owner-name {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent, var(--text-dim));
}
.lab-reason { margin-top: 3px; font-size: 11.5px; color: var(--text-dim); }
.lab-shared {
  margin-top: 5px; font-size: 9px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--moss-bright);
}
.lab-moves {
  grid-column: 1 / -1;
  font-size: 11px; color: var(--text-faint);
  padding-left: 0; margin-top: -2px;
}
.lab-feed { color: var(--moss); }

.blockers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.block-card { padding: 20px 21px; }
.block-card h3 {
  margin: 0 0 15px; font-family: var(--display);
  font-size: 16px; font-weight: 700; letter-spacing: .02em;
}
.blocker {
  padding: 11px 0 12px; border-top: 1px solid var(--line-soft);
}
.blocker:first-of-type { border-top: 0; padding-top: 0; }
.blocker-what { font-size: 13.5px; font-weight: 650; color: var(--accent, var(--text)); }
.blocker-why { margin: 4px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }

@media (max-width: 780px) {
  .lab-head { display: none; }
  .lab-row {
    grid-template-columns: 1fr auto;
    gap: 8px; padding: 14px 14px;
  }
  .lab-name { grid-column: 1 / -1; }
  .lab-lvl { display: none; }
  .lab-owner { grid-column: 1 / -1; }
  .lab-owner-name::before { content: 'Owner: '; color: var(--text-faint); font-weight: 600; }
  .blockers { grid-template-columns: 1fr; }
}

/* ---------- Task roulette + bounties -------------------------------------- */

.roulette { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.roul-card { padding: 19px 20px; }
.roul-none { font-size: 13px; color: var(--text-faint); margin: 6px 0 13px; }
.roul-task {
  font-family: var(--display); font-size: 19px; font-weight: 700;
  letter-spacing: .02em; margin: 5px 0 11px;
}
.roul-task.done { color: var(--moss-bright); }
.roul-detail {
  margin-top: 7px; font-family: var(--mono); font-size: 11px; color: var(--text-faint);
}
.roul-actions { display: flex; gap: 7px; margin-top: 14px; }
.roul-roll { width: 100%; }

.listrow.bounty { align-items: flex-start; }
.listrow.bounty .lr-skull { color: var(--amber); font-size: 15px; padding-top: 2px; }
.listrow.bounty.claimed { border-left-color: var(--moss); background: rgba(110,148,85,.07); }
.listrow.bounty.claimed .lr-skull { color: var(--moss-bright); }
.bounty-won { color: var(--moss-bright); font-weight: 650; }
.lr-actions { display: flex; align-items: center; gap: 5px; flex: none; }
.refresh-btn.tiny { font-size: 11px; padding: 4px 10px; }
.add-form.bounty input[type='number'] { flex: 0 1 90px; }
.add-form.bounty input[type='number'] {
  appearance: none; background: var(--stone-950);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: 14px;
  padding: 11px 13px; min-height: 44px;
}

@media (max-width: 780px) {
  .roulette { grid-template-columns: 1fr; }
  .add-form.bounty select,
  .add-form.bounty input[type='number'] { flex: 1 1 calc(50% - 4px); }
  .add-form.bounty input[type='text'] { flex: 1 1 100%; }
}

/* ---------- The Bank: shared lists ---------------------------------------
   Phone-first. Big tap targets, forms that stack, nothing that needs a
   mouse. This is the tab they'll actually use mid-session.
   ------------------------------------------------------------------------ */

.add-form {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 13px;
}
.add-form input[type='text'],
.add-form select {
  appearance: none;
  background: var(--stone-950);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit; font-size: 14px;
  padding: 11px 13px;
  min-height: 44px;                 /* comfortable thumb target */
}
.add-form input[type='text'] { flex: 1 1 220px; min-width: 0; }
.add-form select { flex: 0 1 auto; color: var(--text-dim); }
.add-form input::placeholder { color: var(--text-faint); }
.add-form input:focus, .add-form select:focus {
  outline: none; border-color: rgba(217,154,63,.55);
}
.add-form.death input[type='text'] { flex: 1 1 150px; }

.add-btn {
  appearance: none; cursor: pointer;
  border: 1px solid rgba(217,154,63,.4);
  background: var(--amber-glow);
  color: var(--amber-bright);
  font: inherit; font-size: 14px; font-weight: 650;
  padding: 11px 22px; min-height: 44px;
  border-radius: var(--radius-sm);
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.add-btn:hover { background: rgba(217,154,63,.2); border-color: rgba(217,154,63,.65); }
.add-btn:active { transform: translateY(1px); }

.listcard { padding: 8px; margin-bottom: 6px; }
.list-empty { margin: 0; padding: 26px 14px; text-align: center; color: var(--text-faint); font-size: 13px; }
.list-sub {
  font-size: 9.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); padding: 12px 10px 7px;
}

.listrow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 11px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent, var(--line));
  background: rgba(255,255,255,.018);
  margin-bottom: 3px;
  transition: background .16s var(--ease), opacity .2s var(--ease);
}
.listrow:hover { background: rgba(255,255,255,.04); }
.listrow.done { opacity: .5; }
.listrow.done .lr-text { text-decoration: line-through; text-decoration-color: var(--text-faint); }

.lr-check {
  appearance: none; cursor: pointer; flex: none;
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--stone-990);
  color: var(--moss-bright);
  font-size: 15px; line-height: 1;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.lr-check:hover:not(:disabled) { border-color: var(--moss); }
.lr-check[aria-pressed='true'] { background: rgba(110,148,85,.18); border-color: rgba(110,148,85,.45); }
.lr-check:disabled { opacity: .5; cursor: default; }

.lr-skull { font-size: 17px; color: var(--danger); width: 30px; text-align: center; flex: none; }

.lr-body { min-width: 0; }
.lr-text { font-size: 14px; color: var(--text); line-height: 1.35; }
.lr-text b { font-weight: 700; }
.lr-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  margin-top: 3px; font-size: 11px; color: var(--text-faint);
}
.lr-for {
  font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent, var(--text-faint));
}
.lr-note { margin-top: 4px; font-size: 12px; color: var(--text-dim); }

.lr-del {
  appearance: none; cursor: pointer; flex: none;
  width: 32px; height: 32px; border-radius: 7px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-faint); font-size: 19px; line-height: 1;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.lr-del:hover:not(:disabled) { color: var(--danger); border-color: rgba(226,104,95,.35); }
.lr-del:disabled { opacity: .4; cursor: default; }

/* death tally */
.deathboard { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dt-box {
  flex: 1 1 130px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent, var(--danger));
  background: linear-gradient(180deg, var(--stone-800), var(--stone-850));
}
.dt-box.wide { flex: 1 1 200px; }
.dt-n {
  font-family: var(--display); font-size: 25px; font-weight: 700;
  color: var(--accent, var(--danger)); line-height: 1.1;
}
.dt-who {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin-top: 2px;
}

@media (max-width: 780px) {
  .add-form { gap: 7px; }
  .add-form input[type='text'] { flex: 1 1 100%; }
  .add-form select { flex: 1 1 calc(50% - 4px); }
  .add-btn { flex: 1 1 100%; }
  .add-form.death input[type='text'] { flex: 1 1 100%; }
  .listrow { gap: 9px; padding: 11px 9px; }
  .lr-text { font-size: 13.5px; }
  .dt-box { flex: 1 1 calc(50% - 5px); padding: 11px 13px; }
  .dt-n { font-size: 21px; }
}

/* ---------- Reward shops -------------------------------------------------- */

.shops { display: grid; gap: 14px; }

.shop { padding: 21px 22px; }
.shop-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 9px; }
.shop-head h3 {
  margin: 0; font-family: var(--display);
  font-size: 18px; font-weight: 700; letter-spacing: .02em;
}
.shop-levels { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.shop-lvl {
  font-size: 10px; font-family: var(--mono);
  color: var(--accent, var(--text-faint));
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px; background: var(--stone-950);
}
.shop-intro { margin: 0 0 17px; font-size: 13px; color: var(--text-dim); max-width: 80ch; }

.shop-items { display: grid; gap: 2px; }

.shop-item {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  background: rgba(255,255,255,.016);
  transition: background .16s var(--ease);
}
.shop-item:hover { background: rgba(255,255,255,.035); }
.shop-item.ready { border-left-color: var(--accent, var(--moss)); background: rgba(110,148,85,.07); }
.shop-item.close { border-left-color: rgba(217,154,63,.5); }
.shop-item.later { opacity: .62; }

.si-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.si-state {
  font-size: 8px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; flex: none; border: 1px solid transparent;
}
.si-state.ready { color: var(--moss-bright); background: rgba(110,148,85,.14); border-color: rgba(110,148,85,.34); }
.si-state.close { color: var(--amber); background: var(--amber-glow); border-color: rgba(217,154,63,.34); }
.si-state.later { color: var(--text-faint); background: rgba(255,255,255,.04); border-color: var(--line-soft); }
.si-state.quest { color: var(--frost); background: rgba(111,168,192,.12); border-color: rgba(111,168,192,.34); }
.shop-item.quest { border-left-color: rgba(111,168,192,.5); }

.si-name { font-size: 13.5px; font-weight: 650; color: var(--text); }
.si-who {
  font-size: 8px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 999px;
}
.si-who.mac { color: var(--violet); border-color: rgba(157,123,255,.35); }
.si-who.billy { color: var(--emerald); border-color: rgba(62,207,142,.35); }
.si-who.both { color: var(--amber); border-color: rgba(217,154,63,.35); }
.si-cost {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--amber-bright); flex: none;
}
.si-unver {
  font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--warn); border: 1px solid rgba(229,166,63,.32);
  padding: 2px 7px; border-radius: 999px;
}
.si-gap { margin-top: 5px; font-size: 11px; font-family: var(--mono); color: var(--text-faint); }
.si-quest { margin-top: 4px; font-size: 11.5px; color: var(--frost); }
.si-why { margin: 6px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; max-width: 88ch; }

.shop-traps { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.shop-traps h4 {
  margin: 0 0 11px; font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--warn);
}
.trap { padding-left: 14px; border-left: 2px solid var(--warn); margin-bottom: 12px; }
.trap:last-child { margin-bottom: 0; }
.trap-name { font-size: 12.5px; font-weight: 650; color: var(--text); }
.trap-why { margin: 4px 0 0; font-size: 12.5px; color: var(--text-dim); max-width: 88ch; }

.shop-notes { margin-top: 18px; display: grid; gap: 8px; }
.shop-notes p { margin: 0; font-size: 12px; color: var(--text-faint); max-width: 88ch; }

.shop.deferred { opacity: .82; }

@media (max-width: 780px) {
  .shop { padding: 17px 15px; }
  .si-cost { margin-left: 0; width: 100%; }
  .shop-levels { margin-left: 0; width: 100%; }
}

/* ---------- Chase items -------------------------------------------------- */

.chase-bar {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-bottom: 13px;
}
#chase-search {
  flex: 1; min-width: 200px;
  appearance: none;
  background: var(--stone-950);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font: inherit; font-size: 13px;
  padding: 8px 16px;
  transition: border-color .18s var(--ease);
}
#chase-search::placeholder { color: var(--text-faint); }
#chase-search:focus { outline: none; border-color: rgba(217,154,63,.55); }

.chase-filters { display: flex; gap: 3px; }
.chase-f {
  appearance: none; border: 1px solid var(--line);
  background: var(--stone-850); color: var(--text-dim);
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: all .18s var(--ease);
}
.chase-f:hover { color: var(--text); }
.chase-f.active {
  color: var(--amber-bright);
  background: var(--amber-glow);
  border-color: rgba(217,154,63,.4);
  font-weight: 600;
}

.chase { padding: 6px 0; }
.chase-empty { padding: 22px; margin: 0; color: var(--text-faint); font-size: 13px; text-align: center; }

.chase-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  border-left: 2px solid transparent;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.chase-item:last-child { border-bottom: 0; }
.chase-item:hover {
  background: rgba(255,255,255,.022);
  border-left-color: var(--accent, var(--amber));
}

.chase-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chase-name { font-size: 14px; font-weight: 650; color: var(--text); }
.chase-who {
  font-size: 8.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-faint); flex: none;
}
.chase-who.mac { color: var(--violet); border-color: rgba(157,123,255,.35); }
.chase-who.billy { color: var(--emerald); border-color: rgba(62,207,142,.35); }
.chase-who.both { color: var(--amber); border-color: rgba(217,154,63,.35); }
.chase-effort {
  margin-left: auto; font-family: var(--mono);
  font-size: 10.5px; color: var(--text-faint); flex: none;
}
.chase-where { font-size: 11.5px; color: var(--moss-bright); margin-top: 4px; }
.chase-why { margin: 6px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; max-width: 88ch; }

/* ---------- The Descent — the shaft --------------------------------------
   A dungeon you move through: a vertical shaft of rooms on the left, the
   current chamber foregrounded on the right. Rooms are real buttons, so
   keyboard and screen readers work; the atmosphere is layered on top.
   ------------------------------------------------------------------------ */

.descent {
  display: grid;
  grid-template-columns: minmax(230px, 268px) 1fr;
  gap: 20px;
  align-items: start;
}

/* ---- the shaft: a vertical run of rooms you descend through ---- */

.shaft {
  position: sticky; top: 76px;
  display: flex; flex-direction: column;
  gap: 0;
  padding: 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--stone-800), var(--stone-950) 92%);
  box-shadow: var(--shadow), var(--inset-top);
  overflow: hidden;
}
/* the mineshaft rope running down behind the doors */
.shaft::before {
  content: '';
  position: absolute;
  left: 33px; top: 44px; bottom: 14px;
  width: 2px;
  background: linear-gradient(180deg, rgba(217,154,63,.4), rgba(217,154,63,.06) 60%, transparent);
}

.shaft-label {
  font-size: 9px; letter-spacing: .22em; text-transform: uppercase;
  font-weight: 700; color: var(--text-faint);
  padding: 0 4px 12px; position: relative;
}

/* "Descending as" — dims off-path floors without hiding them */
.lens { position: relative; padding: 0 2px 13px; }
.lens-label {
  display: block; font-size: 8.5px; letter-spacing: .2em;
  text-transform: uppercase; font-weight: 700;
  color: var(--text-faint); margin-bottom: 7px;
}
.lens-btns { display: flex; gap: 3px; }
.lens-b {
  appearance: none; flex: 1;
  border: 1px solid var(--line);
  background: var(--stone-950); color: var(--text-faint);
  font: inherit; font-size: 11px; font-weight: 600;
  padding: 5px 4px; border-radius: 6px; cursor: pointer;
  transition: all .18s var(--ease);
}
.lens-b:hover { color: var(--text); }
.lens-b.on {
  color: var(--amber-bright);
  background: var(--amber-glow);
  border-color: rgba(217,154,63,.4);
}

/* Trial progress, reflected in the shaft. Cosmetic — nothing is locked. */
.shaft-tally {
  font-size: 10.5px; color: var(--moss-bright);
  padding: 0 3px 12px; position: relative;
  font-variant-numeric: tabular-nums;
}
.shaft-tally.none { color: var(--text-faint); }
.shaft-tally b { color: var(--text); font-weight: 700; }
.st-flame { font-size: 8px; opacity: .9; }
.shaft-tally.none .st-flame { opacity: .4; }

/* a room whose floor challenge is cleared burns a wall torch */
.room.lit::before {
  content: '';
  position: absolute; left: -12px; top: 50%;
  width: 3px; height: 16px; transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--moss-bright), var(--moss));
  box-shadow: 0 0 12px 1px rgba(163,205,126,.5);
}
/* the current room's own torch wins if both apply */
.room.lit.here::before {
  height: 22px;
  background: linear-gradient(180deg, var(--amber-bright), var(--amber-deep));
  box-shadow: 0 0 14px 2px rgba(217,154,63,.55);
}
.room.lit .room-door { color: var(--moss); }
.room.lit.here .room-door { color: var(--amber-bright); }

.room.offpath { opacity: .34; }
.room.offpath:hover { opacity: .7; }
.room.offpath.here { opacity: 1; }

.room {
  appearance: none; border: 0; background: transparent;
  font: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr;
  align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  position: relative;
  color: var(--text-dim);
  /* deeper rooms sit in colder, darker stone */
  background: linear-gradient(
    90deg,
    rgba(8, 14, 18, calc(.25 + var(--d) * .5)),
    transparent 85%);
  transition: background .2s var(--ease), color .2s var(--ease), transform .16s var(--ease);
}
.room + .room { margin-top: 2px; }

/* torchlight pooling on the room you're hovering */
.room::after {
  content: '';
  position: absolute; inset: -2px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  background: radial-gradient(120px 46px at 18% 50%, rgba(217,154,63,.16), transparent 70%);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.room:hover::after { opacity: 1; }
.room:hover { color: var(--text); transform: translateX(2px); }

.room-door {
  width: 21px; height: 26px; flex: none;
  display: grid; place-items: center;
  color: var(--text-faint);
  transition: color .25s var(--ease), filter .25s var(--ease);
  position: relative; z-index: 1;
}
.room-door .door { width: 100%; height: 100%; display: block; }
.room.seen .room-door { color: var(--amber-deep); }
.room:hover .room-door { color: var(--amber); }

.room-meta { min-width: 0; display: grid; gap: 1px; }
.room-num {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .12em; color: var(--text-faint);
}
.room-title {
  font-size: 12.5px; font-weight: 600; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-kicker {
  font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--moss); opacity: .85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* the room you're standing in */
.room.here {
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(217,154,63,.16), rgba(217,154,63,.02) 80%);
  box-shadow: inset 0 0 0 1px rgba(217,154,63,.3);
}
.room.here::after { opacity: 1; }
.room.here .room-door { color: var(--amber-bright); filter: drop-shadow(0 0 7px rgba(217,154,63,.65)); }
.room.here .room-num { color: var(--amber); }
.room.here .room-title { font-weight: 700; }
/* the lit torch beside the current room */
.room.here::before {
  content: '';
  position: absolute; left: -12px; top: 50%;
  width: 3px; height: 22px; transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--amber-bright), var(--amber-deep));
  box-shadow: 0 0 14px 2px rgba(217,154,63,.55);
}

.room:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

/* ---- the chamber: current floor, foregrounded ---- */

.chamber { min-width: 0; }
.chamber.no-map .floor-open { margin-bottom: 14px; }

.floor-open {
  padding: 26px 28px 22px;
  animation: enterRoom .3s var(--ease);
  /* the deeper you are, the colder and heavier the room reads */
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--stone-800) calc(100% - var(--d, 0) * 45%), #060d12) 0%,
      var(--stone-870) 100%);
}
@keyframes enterRoom {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to   { opacity: 1; transform: none; }
}

.floor-head {
  padding-bottom: 15px; margin-bottom: 3px;
  border-bottom: 1px solid var(--line-soft);
}
.floor-crumbs { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 8px; }
.floor-head .fnum {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
  color: var(--amber); border: 1px solid rgba(217,154,63,.34);
  background: var(--amber-glow);
  padding: 3px 9px; border-radius: 5px;
}
.floor-head .fkicker {
  font-size: 9.5px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--moss-bright);
}
.floor-head .ftitle {
  margin: 0; font-family: var(--display);
  font-size: clamp(19px, 2.6vw, 25px); font-weight: 700;
  letter-spacing: .015em; line-height: 1.2;
}
.floor-head .ftitle:focus { outline: none; }

/* complexity pips, Dungeoneering-style */
.cx { display: inline-flex; gap: 3px; margin-left: auto; }
.cx i {
  width: 5px; height: 5px; border-radius: 1px;
  transform: rotate(45deg);
  background: var(--line);
  display: block;
}
.cx i.on { background: var(--amber); box-shadow: 0 0 6px -1px var(--amber); }

.chamber .fintro {
  color: var(--text-dim); font-size: 14px;
  max-width: 78ch; margin: 16px 0 0;
  padding-left: 14px; border-left: 2px solid var(--line);
}

/* ---- ascend / descend ---- */

.floor-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 26px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.floor-move {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-850));
  color: var(--text-dim); font: inherit;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: grid; gap: 2px; text-align: left;
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .18s var(--ease);
}
.floor-move.down { text-align: right; }
.floor-move:hover:not(:disabled) {
  color: var(--text); border-color: rgba(217,154,63,.45);
  transform: translateY(1px);
}
.floor-move.up:hover:not(:disabled) { transform: translateY(-1px); }
.floor-move:disabled { opacity: .35; cursor: default; }
.fm-dir {
  font-size: 9.5px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--amber);
}
.floor-move:disabled .fm-dir { color: var(--text-faint); }
.fm-title { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tables can overflow on narrow screens — let them scroll, not clip */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }


.block { margin-top: 21px; }
.block h4 {
  margin: 0 0 10px; font-size: 12px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--text);
  display: flex; align-items: center; gap: 9px;
}
.block h4::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-soft), transparent); }

.block ul { margin: 0; padding-left: 0; list-style: none; }
.block ul li {
  position: relative; padding-left: 20px; margin-bottom: 7px;
  color: var(--text-dim); font-size: 13.5px; max-width: 82ch;
}
.block ul li::before {
  content: ''; position: absolute; left: 3px; top: 8px;
  width: 5px; height: 5px; border-radius: 1px;
  transform: rotate(45deg); background: var(--text-faint);
}
.block.warn ul li::before { background: var(--warn); }
.block.good ul li::before { background: var(--moss-bright); }

.block p { margin: 0; color: var(--text-dim); font-size: 13.5px; max-width: 82ch; }
.block.warn > p {
  border-left: 2px solid var(--warn); padding: 2px 0 2px 14px;
  background: linear-gradient(90deg, rgba(229,166,63,.06), transparent 60%);
}

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 9.5px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--text-faint); font-weight: 600;
  padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line);
}
.tbl td {
  padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-soft);
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.tbl tbody tr { transition: background .15s var(--ease); }
.tbl tbody tr:hover { background: rgba(255,255,255,.025); }
.tbl tbody tr:hover td { color: var(--text); }
.tbl td:first-child { color: var(--text); font-weight: 500; }

.sources {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px; color: var(--text-faint);
}
.sources span { margin-right: 5px; }
.sources a { color: var(--text-dim); }
.sources a:not(:last-child)::after { content: '  ·  '; color: var(--text-faint); }


/* ---------- States ------------------------------------------------------ */

.banner {
  padding: 14px 18px; border-radius: var(--radius-sm);
  border: 1px solid rgba(217,154,63,.28);
  background: linear-gradient(180deg, rgba(217,154,63,.11), rgba(217,154,63,.05));
  color: var(--amber-bright); font-size: 13px; margin-bottom: 16px;
  box-shadow: var(--inset-top);
}
.banner b { color: #fff; }

.skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 50%, var(--line-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 4px; color: transparent !important; text-shadow: none !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.footer {
  border-top: 1px solid var(--line-soft);
  padding: 24px 0 48px; color: var(--text-faint); font-size: 12px;
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
}

.refresh-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-850));
  color: var(--text-dim);
  font: inherit; font-size: 12px; padding: 5px 14px;
  border-radius: 999px; cursor: pointer;
  box-shadow: var(--inset-top);
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.refresh-btn:hover { color: var(--amber-bright); border-color: rgba(217,154,63,.5); }
.refresh-btn:disabled { opacity: .45; cursor: default; }


/* ---------- Trials: the Warden's Grid ------------------------------------ */

.gridwrap { padding: 16px; }
.grid5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.gcell {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 11px 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--stone-850), var(--stone-950));
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color .2s var(--ease), transform .16s var(--ease);
}
.gcell:hover { border-color: var(--line); transform: translateY(-1px); }

/* progress wash rising from the floor of the tile */
.gc-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--p, 0) * 100%);
  background: linear-gradient(180deg, rgba(217,154,63,.02), rgba(217,154,63,.17));
  pointer-events: none;
  transition: height .8s var(--ease);
}

.gc-who {
  font-size: 8px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent, var(--text-faint));
  position: relative; z-index: 1; opacity: .9;
}
.gcell[data-who] .gc-who { color: var(--accent); }

.gc-label {
  font-size: 12px; font-weight: 650; line-height: 1.3;
  color: var(--text); position: relative; z-index: 1;
}

/* Manual tiles read differently from auto-verified ones — deliberately, so
   you always know which is which. Dashed edge, and a tick button. */
.gcell.manual {
  border-style: dashed;
  border-color: rgba(111,168,192,.4);
}
.gcell.manual .gc-sub { color: var(--frost); }
.gcell.manual.done { border-style: solid; }

.gc-tick {
  position: relative; z-index: 2;
  align-self: flex-start; margin-top: 6px;
  appearance: none; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--stone-950);
  color: var(--text-dim);
  font: inherit; font-size: 10px; font-weight: 650;
  letter-spacing: .06em;
  padding: 4px 11px; border-radius: 999px;
  transition: all .18s var(--ease);
}
.gc-tick:hover:not(:disabled) { color: var(--frost); border-color: rgba(111,168,192,.55); }
.gc-tick:disabled { opacity: .45; cursor: default; }
.gcell.done .gc-tick { color: var(--moss-bright); border-color: rgba(110,148,85,.4); }
.gc-sub {
  font-size: 8.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent, var(--text-faint));
  position: relative; z-index: 1;
}
.gc-detail {
  margin-top: auto;
  font-family: var(--mono); font-size: 10px;
  color: var(--text-faint); position: relative; z-index: 1;
}

.gcell.done {
  border-color: rgba(110,148,85,.45);
  background: linear-gradient(180deg, rgba(110,148,85,.14), rgba(110,148,85,.05));
}
.gcell.done .gc-fill { background: linear-gradient(180deg, rgba(110,148,85,.05), rgba(110,148,85,.2)); }
.gcell.done .gc-label { color: var(--moss-bright); }
.gcell.done::after {
  content: '✓';
  position: absolute; top: 8px; right: 10px;
  font-size: 12px; color: var(--moss-bright); z-index: 1;
}
/* tiles that form a completed line get torchlight */
.gcell.inline { box-shadow: inset 0 0 0 1px rgba(217,154,63,.5), 0 0 18px -6px var(--amber); }

.grid-score {
  margin-top: 12px; font-size: 13px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.grid-score b { color: var(--amber-bright); font-weight: 700; }

/* ---------- Trials: floor challenges ------------------------------------- */

.trial-floors { display: grid; gap: 11px; }

.tfloor {
  padding: 17px 20px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--stone-800) calc(100% - var(--d, 0) * 40%), #060d12),
    var(--stone-870));
  transition: border-color .2s var(--ease), opacity .2s var(--ease);
}
.tfloor.cleared { border-color: rgba(110,148,85,.4); }
.tfloor.current { border-color: rgba(217,154,63,.42); box-shadow: var(--shadow), 0 0 26px -14px var(--amber); }
.tfloor.locked { opacity: .5; }

.tf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.tf-num {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  color: var(--text-faint); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 5px; background: var(--stone-950);
}
.tfloor.current .tf-num { color: var(--amber); border-color: rgba(217,154,63,.4); }
.tfloor.cleared .tf-num { color: var(--moss-bright); border-color: rgba(110,148,85,.4); }
.tf-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tf-name {
  font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: .02em;
}
.tf-state {
  margin-left: auto; flex: none;
  font-size: 8.5px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent;
}
.tf-state.ok { color: var(--moss-bright); background: rgba(110,148,85,.13); border-color: rgba(110,148,85,.32); }
.tf-state.now { color: var(--bg,#0b1013); background: var(--amber); }
.tf-state.lock { color: var(--text-faint); background: rgba(255,255,255,.04); border-color: var(--line-soft); }

.tf-objs { display: grid; gap: 8px; }
.tf-obj {
  display: grid; grid-template-columns: 16px 1fr auto;
  align-items: center; gap: 10px;
  font-size: 12.5px;
}
.tf-tick { color: var(--text-faint); text-align: center; font-size: 13px; }
.tf-obj.done .tf-tick { color: var(--moss-bright); }
.tf-body { min-width: 0; display: grid; gap: 4px; }
.tf-label { color: var(--text-dim); }
.tf-obj.done .tf-label { color: var(--text); }
.tf-bar {
  height: 3px; border-radius: 2px; background: var(--stone-990);
  overflow: hidden; display: block;
}
.tf-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--amber-deep), var(--amber));
  transition: width .8s var(--ease);
}
.tf-obj.done .tf-bar > i { background: linear-gradient(90deg, var(--moss), var(--moss-bright)); }
.tf-detail {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--text-faint); flex: none;
}

@media (max-width: 780px) {
  .gridwrap { padding: 10px; }
  .grid5 { gap: 5px; }
  .gcell { min-height: 78px; padding: 8px 8px 16px; }
  .gc-label { font-size: 10.5px; line-height: 1.25; }
  .gc-sub { font-size: 7.5px; letter-spacing: .1em; }
  .gc-detail { font-size: 9px; }
  .gcell.done::after { font-size: 10px; top: 5px; right: 6px; }
  .tfloor { padding: 15px 15px; }
  .tf-obj { grid-template-columns: 14px 1fr; }
  .tf-detail { grid-column: 2; }
}

/* ---------- Responsive --------------------------------------------------- */

@media (max-width: 900px) {
  .group-tips .grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .topbar .wrap { height: 56px; gap: 10px; }
  .brand .sub { display: none; }
  .hero { padding: 32px 0 20px; }
  .hero p { font-size: 14.5px; }

  .totals, .goals, .advice, .upg { grid-template-columns: 1fr; }
  .chase-effort { margin-left: 0; width: 100%; }
  .chase-item { padding: 13px 15px; }

  /* Board: keep all three columns, just tighten. Header clears the 56px bar. */
  .board-head, .board-row {
    grid-template-columns: minmax(78px, 1.35fr) 1fr 1fr;
    padding: 9px 12px;
    gap: 8px;
  }
  .board-head { top: 56px; }
  .cell .xp { display: none; }
  .cell .lv { font-size: 14.5px; }
  .skill-name { font-size: 12.5px; gap: 8px; }

  /* The shaft turns on its side: a corridor of doors you swipe along. */
  .descent { grid-template-columns: 1fr; gap: 14px; }
  .shaft {
    position: sticky; top: 56px; z-index: 10;
    flex-direction: row;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--stone-800), var(--stone-950));
  }
  .shaft::-webkit-scrollbar { display: none; }
  /* corridor floor line instead of the vertical rope */
  .shaft::before {
    left: 12px; right: 12px; top: auto; bottom: 9px;
    width: auto; height: 2px;
    background: linear-gradient(90deg, rgba(217,154,63,.06), rgba(217,154,63,.35), rgba(217,154,63,.06));
  }
  .shaft-label { display: none; }

  .room {
    flex: none;
    grid-template-columns: auto;
    justify-items: center;
    gap: 5px;
    padding: 8px 11px 12px;
    min-width: 74px;
    background: linear-gradient(180deg, rgba(8,14,18, calc(.2 + var(--d) * .55)), transparent);
  }
  .room + .room { margin-top: 0; }
  .room-title, .room-kicker { display: none; }
  .room-meta { justify-items: center; }
  .room-num { font-size: 10px; }
  .room::before { display: none; }
  .room.here { box-shadow: inset 0 0 0 1px rgba(217,154,63,.4); }
  /* lit floor marker under the current door */
  .room.here::after {
    opacity: 1;
    background: radial-gradient(46px 22px at 50% 100%, rgba(217,154,63,.3), transparent 70%);
  }

  .floor-open { padding: 19px 16px 18px; }
  .floor-nav { grid-template-columns: 1fr; }
  .floor-move, .floor-move.down { text-align: left; }
  .chamber .fintro { font-size: 13.5px; }
  .stat-row { gap: 24px; }
  .stat .value { font-size: 23px; }

  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { padding-right: 8px; }
  .advice-card, .goal-card, .group-tips, .player-card { padding: 18px 16px; }

  /* Modal goes full-bleed sheet on phones */
  .sm-overlay { padding: 0; align-items: flex-end; }
  .sm-panel {
    max-width: none; max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
    animation: sheetUp .26s var(--ease);
  }
  @keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sm-head-bar { padding: 16px 16px 13px; position: sticky; top: 0; z-index: 2; background: var(--stone-800); }
  .sm-body { padding: 17px 16px 26px; }
  .sm-cols { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 380px) {
  .board-head, .board-row { grid-template-columns: minmax(66px, 1.3fr) 1fr 1fr; padding: 9px 10px; }
  .skill-name { font-size: 11.5px; }
}

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

/* ==========================================================================
   THE RING OF KINSHIP — identity gate
   ========================================================================== */

/* Set pre-paint by the inline script in <head>, cleared four ways (choice
   made, module loaded, 4s timeout, JS off). It only hides — it never blocks
   input — so the worst case is a blank-ish page for a moment. */
html.gate-pending body > * { opacity: 0; }
html.gated body { overflow: hidden; }

.gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
  overflow-y: auto;
  background:
    radial-gradient(680px 420px at 50% 8%, rgba(217,154,63,.16) 0%, transparent 62%),
    radial-gradient(1200px 900px at 50% -10%, #16242e 0%, transparent 70%),
    var(--stone-990);
}
.gate[hidden] { display: none; }

.gate-panel {
  width: 100%; max-width: 560px;
  text-align: center;
  animation: gate-in .34s var(--ease) both;
}
@keyframes gate-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.gate-ring { display: block; margin: 0 auto 14px; opacity: .9; }
.gate-eyebrow {
  font-size: 9.5px; font-weight: 700; letter-spacing: .22em;
  text-transform: uppercase; color: var(--amber);
}
.gate-panel h2 {
  font-family: var(--display); font-size: 27px; font-weight: 700;
  letter-spacing: .02em; margin: 8px 0 6px;
}
.gate-line { margin: 0 0 22px; color: var(--text-dim); font-size: 14px; }

.gate-choices { display: grid; gap: 10px; }

.gate-choice {
  appearance: none; cursor: pointer; text-align: left;
  display: grid; gap: 2px;
  padding: 16px 18px; min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--line));
  background: linear-gradient(180deg, var(--stone-850), var(--stone-900));
  color: var(--text); font: inherit;
  box-shadow: var(--inset-top);
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.gate-choice:hover { background: linear-gradient(180deg, var(--stone-800), var(--stone-870)); }
.gate-choice:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.gate-choice:active { transform: translateY(1px); }
.gc-name { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.gc-rsn { font-family: var(--mono); font-size: 11px; color: var(--accent, var(--amber)); }
.gc-tag { font-size: 12.5px; color: var(--text-dim); }
.gate-choice.neither { border-left-color: var(--line); opacity: .82; }
.gate-choice.neither .gc-name { font-size: 15px; }

.gate-foot { margin: 20px 0 0; font-size: 11.5px; color: var(--text-faint); }

/* topbar switcher */
.whoami {
  appearance: none; cursor: pointer; flex: none; margin-left: auto;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--stone-850); color: var(--text-dim);
  font: inherit; font-size: 11.5px; font-weight: 600;
  padding: 5px 13px; min-height: 30px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.whoami:hover, .whoami:focus-visible { color: var(--amber-bright); border-color: rgba(217,154,63,.42); }
.whoami[data-who='mac'] { border-color: rgba(151,129,224,.4); color: #c3b6f5; }
.whoami[data-who='billy'] { border-color: rgba(110,148,85,.42); color: var(--moss-bright); }

/* "this half is yours" — foregrounded, never exclusive */
.you-tag {
  font-size: 8.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--amber-bright); background: var(--amber-glow);
  border: 1px solid rgba(217,154,63,.34);
  padding: 2px 7px; border-radius: 999px; margin-left: 8px; white-space: nowrap;
}
.card.yours { border-color: var(--accent, var(--line)); box-shadow: var(--shadow), 0 0 0 1px var(--accent, transparent) inset; }
body[data-you='mac'] .card:not(.yours),
body[data-you='billy'] .card:not(.yours) { opacity: .93; }
.gcell.mine { box-shadow: 0 0 0 1px var(--accent, var(--line)) inset; }
.gcell.mine .gc-who { color: var(--accent, var(--amber)); font-weight: 700; }

/* The Ring in the top bar lights once the gate is open. */
body.gate-open .brand .ring circle { opacity: 1; }
body.gate-open .brand .ring { filter: drop-shadow(0 0 6px rgba(247,205,136,.55)); }

/* ==========================================================================
   THE DEEP — contracts, dares, titles, the gate, the puzzle door
   ========================================================================== */

.col-head { display: flex; align-items: center; margin-bottom: 10px; }
.contract-col .goal-owner,
.title-col .goal-owner,
.wg-lock .goal-owner {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent, var(--amber)); font-weight: 700;
}

.contracts, .titles { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; align-items: start; }
.contract-col, .title-col { display: grid; gap: 11px; align-content: start; }

.contract { padding: 17px 19px; }
.ct-title {
  font-family: var(--display); font-size: 17px; font-weight: 700;
  letter-spacing: .02em; margin-bottom: 4px;
}
.ct-flavour { margin: 0 0 14px; font-size: 12.5px; color: var(--text-faint); font-style: italic; }

.ct-branch {
  padding: 12px 13px; margin-bottom: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,.016);
}
.ct-bname { font-weight: 650; font-size: 14px; color: var(--text); margin-bottom: 3px; }
.ct-bline { margin: 0 0 8px; font-size: 13px; color: var(--text-dim); }
.ct-boon, .ct-stake { font-size: 11.5px; color: var(--text-faint); margin-bottom: 4px; }
.ct-stake { color: var(--warn); }
.ct-stake b { color: var(--amber-bright); }
.ct-k {
  font-size: 8.5px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-faint); margin-right: 6px;
}
.ct-sign { margin-top: 7px; font-size: 13px; padding: 9px 16px; width: 100%; }
.ct-sign:disabled { opacity: .45; cursor: not-allowed; }
.ct-refuse { margin: 4px 0 0; font-size: 11.5px; color: var(--text-faint); }

.contract.signed { border-color: var(--accent, var(--line)); }
.ct-state {
  display: inline-block; font-size: 8.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 9px;
  border: 1px solid var(--line); color: var(--text-dim);
}
.ct-state.s-met { color: var(--moss-bright); border-color: rgba(110,148,85,.4); background: rgba(110,148,85,.12); }
.ct-state.s-failed, .ct-state.s-abandoned { color: var(--danger); border-color: rgba(226,104,95,.4); background: rgba(226,104,95,.1); }
.ct-state.s-signed { color: var(--amber-bright); border-color: rgba(217,154,63,.36); background: var(--amber-glow); }

.ct-rows { display: grid; gap: 7px; margin: 11px 0 9px; }
.ct-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 9px; align-items: baseline; }
.ct-rs { font-size: 13px; color: var(--text); }
.ct-row.met .ct-rs { color: var(--moss-bright); }
.ct-rw { font-size: 10.5px; color: var(--text-faint); }
.ct-rd { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.ct-bar { grid-column: 1 / -1; display: block; height: 3px; border-radius: 3px; background: var(--stone-750); overflow: hidden; }
.ct-bar i { display: block; height: 100%; background: var(--accent, var(--amber)); transition: width .5s var(--ease); }
.ct-row.met .ct-bar i { background: var(--moss); }
.ct-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--text-faint); margin-bottom: 9px; }
.ct-mark { color: var(--danger); font-weight: 650; }

/* dares */
.add-form.dare input[type='number'] {
  flex: 0 1 90px; appearance: none; background: var(--stone-950);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: 14px; padding: 11px 13px; min-height: 44px;
}
.add-form.dare input[type='text'] { flex: 1 1 220px; }
.listrow.dare .lr-skull { font-size: 15px; color: var(--accent, var(--amber)); }
.listrow.dare.d-ducked { opacity: .8; }
.listrow.dare.d-ducked .lr-text { text-decoration: line-through; text-decoration-color: rgba(226,104,95,.5); }
.dare-state {
  font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim);
}
.dare-state.s-ducked, .dare-state.s-welched { color: var(--danger); border-color: rgba(226,104,95,.4); }
.dare-state.s-paid, .dare-state.s-won { color: var(--moss-bright); border-color: rgba(110,148,85,.4); }
.dare-state.s-open { color: var(--amber-bright); border-color: rgba(217,154,63,.36); }
.dare-jab { color: var(--danger); font-style: italic; }
.refresh-btn.duck:hover:not(:disabled) { color: var(--danger); border-color: rgba(226,104,95,.45); }
.lr-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

/* provenance badges — the honest bit */
.src-live, .src-logged {
  font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line);
}
.src-live { color: var(--frost); border-color: rgba(111,168,192,.36); background: rgba(111,168,192,.08); }
.src-logged { color: var(--warn); border-color: rgba(229,166,63,.32); background: rgba(229,166,63,.07); }

/* titles */
.epithet { padding: 14px 16px; border-left: 3px solid var(--line); }
.epithet.grim { border-left-color: var(--danger); }
.epithet.good { border-left-color: var(--moss); }
.epithet.held { opacity: .78; }
.ep-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 5px; }
.ep-name { font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.epithet.grim .ep-name { color: #f0a49d; }
.epithet.good .ep-name { color: var(--moss-bright); }
.ep-perm {
  font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px;
}
.ep-ev { margin: 0; font-size: 12.5px; color: var(--text-dim); }
.ep-foot { margin-top: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }

/* the gate */
.gatecard { padding: 22px; }
.wg-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.wg-door {
  flex: none; width: 40px; height: 56px; border-radius: 20px 20px 3px 3px;
  border: 2px solid var(--line); background: var(--stone-950);
  position: relative;
}
.wg-door::after {
  content: ''; position: absolute; left: 50%; top: 6px; bottom: 6px; width: 1px;
  background: var(--line);
}
.wg-door.open {
  border-color: var(--amber); background: linear-gradient(180deg, rgba(247,205,136,.28), rgba(217,154,63,.06));
  box-shadow: 0 0 22px rgba(217,154,63,.35);
}
.wg-door.open::after { background: rgba(247,205,136,.5); }
.wg-headtext h3 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.wg-sum { margin: 3px 0 0; font-size: 12.5px; color: var(--text-dim); }
.wg-locks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wg-lock {
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft); border-left: 3px solid var(--accent, var(--line));
  background: rgba(255,255,255,.016);
}
.wg-lock.open { background: rgba(110,148,85,.07); border-color: rgba(110,148,85,.3); }
.wg-why { margin: 0 0 10px; font-size: 12px; color: var(--text-faint); }
.wg-req { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: baseline; padding: 4px 0; font-size: 13px; }
.wg-tick { color: var(--text-faint); font-family: var(--mono); }
.wg-req.met .wg-tick { color: var(--moss-bright); }
.wg-req.met .wg-name { color: var(--moss-bright); }
.wg-detail { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.wg-verdict {
  margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft);
  font-size: 13.5px; color: var(--amber-bright); line-height: 1.65;
}
.wg-verdict.quiet { color: var(--text-faint); font-style: italic; }
.wg-when { margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

/* the puzzle door */
.puzzlecard { padding: 20px 22px; }
.pz-head { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-bottom: 16px; }
.pz-day { color: var(--text-dim); }
.pz-best { color: var(--moss-bright); }
.pz-levers { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pz-lever {
  appearance: none; cursor: pointer;
  width: 44px; height: 78px; padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-850), var(--stone-950));
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.pz-lever:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.pz-lever:disabled { cursor: default; }
.pz-stick {
  display: block; width: 4px; height: 34px; margin-top: 9px; border-radius: 3px;
  background: var(--text-faint);
  transform-origin: 50% 100%; transform: rotate(38deg);
  transition: transform .22s var(--ease), background .22s var(--ease);
}
.pz-lever.up { border-color: rgba(217,154,63,.44); background: linear-gradient(180deg, rgba(217,154,63,.14), var(--stone-950)); }
.pz-lever.up .pz-stick { transform: rotate(0deg); background: var(--amber-bright); }
.pz-num { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-bottom: 6px; }
.pz-msg { margin: 16px 0 0; font-size: 13px; color: var(--text-dim); text-align: center; }
.pz-actions { display: flex; justify-content: center; margin-top: 12px; }

@media (max-width: 780px) {
  .contracts, .titles, .wg-locks { grid-template-columns: 1fr; }
  .topbar .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .whoami { order: 2; margin-left: 0; }
  .gate-panel h2 { font-size: 23px; }
  .pz-lever { width: 38px; height: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-panel { animation: none; }
}

/* ==========================================================================
   STORE STATUS — what happened, and what is still waiting
   ========================================================================== */

.sb-head { font-size: 13.5px; margin-bottom: 5px; }
.sb-head b { color: #fff; }
.sb-why { margin: 0 0 8px; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.sb-pending { margin: 0 0 8px; font-size: 12.5px; color: var(--text); }
.sb-pending b { color: var(--amber-bright); }
.sb-ok { margin: 0 0 8px; font-size: 12.5px; color: var(--moss-bright); }
.sb-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sb-list { font-size: 12px; color: var(--text-dim); flex: 1 1 100%; }
.sb-list summary { cursor: pointer; padding: 4px 0; min-height: 30px; display: flex; align-items: center; }
.sb-item { font-family: var(--mono); font-size: 11px; color: var(--text-faint); padding: 2px 0 2px 12px; }

/* Queued writes, drawn as what they are: not saved yet. */
.listrow.ghost {
  border-left-style: dashed;
  border-left-color: var(--warn);
  background: rgba(229,166,63,.05);
  opacity: .92;
}
.listrow.ghost .lr-skull { color: var(--warn); }
.listrow.ghost .lr-text { color: var(--text-dim); }

/* Wager verdicts */
.ct-state.s-won { color: var(--moss-bright); border-color: rgba(110,148,85,.45); background: rgba(110,148,85,.14); }
.ct-state.s-lateMet { color: var(--warn); border-color: rgba(229,166,63,.4); background: rgba(229,166,63,.09); }
.ct-won { color: var(--moss-bright); font-weight: 650; }

/* The other brother's column, folded away once we know who you are. */
.other-col > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent, var(--line));
  background: rgba(255,255,255,.016);
  color: var(--text-dim);
  font-size: 13px;
  min-height: 44px;
  display: flex; align-items: center; gap: 8px;
}
.other-col > summary::-webkit-details-marker { display: none; }
.other-col > summary::after { content: '▾'; margin-left: auto; color: var(--text-faint); font-size: 11px; }
.other-col[open] > summary { margin-bottom: 11px; }
.other-col[open] > summary::after { content: '▴'; }
.other-col > summary:hover { color: var(--text); border-color: var(--accent, var(--line)); }
.other-col > summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

@media (max-width: 780px) {
  /* Brand and identity on the first line, the tab strip on its own line
     underneath where it has the full width to scroll in. */
  .topbar .wrap { flex-wrap: wrap; height: auto; row-gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .brand { order: 0; }
  .whoami { order: 1; margin-left: auto; }
  nav.tabs { order: 2; flex: 1 0 100%; margin-left: 0; }
  .sb-actions .refresh-btn { min-height: 40px; padding: 8px 16px; }
  .ct-branch { padding: 13px 12px; }
}

/* ==========================================================================
   HISTORY — chart controls, bars, and pace
   ========================================================================== */

.chartbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: space-between;
  margin: 0 0 12px;
}

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.segmented button {
  appearance: none; border: 0; cursor: pointer;
  padding: 6px 13px; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--text-dim); background: var(--stone-850);
  border-right: 1px solid var(--line-soft);
  transition: color .16s var(--ease), background .16s var(--ease);
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed='true'] { color: var(--stone-990); background: var(--amber); }
.segmented button:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: -2px; }

svg.bars { width: 100%; height: 150px; display: block; }
svg.bars .bar-lab { fill: var(--text-faint); font-size: 9px; font-family: var(--mono); }

/* Pace */
.pace { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.pacecard { border-left: 2px solid var(--accent, var(--amber)); }

.pace-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin: 12px 0 4px;
}
.pace-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  background: var(--stone-850); border: 1px solid var(--line-soft);
}
.pace-stat b { font-size: 17px; font-weight: 700; color: var(--text); font-family: var(--display); line-height: 1.1; }
.pace-stat b.up { color: var(--moss-bright); }
.pace-stat b.down { color: var(--danger); }
.pace-stat span { font-size: 10px; color: var(--text-faint); line-height: 1.25; }

.pace-projs { margin-top: 12px; display: flex; flex-direction: column; gap: 1px; }
.pace-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  align-items: baseline;
}
.pace-row:first-child { border-top: 0; }
.pr-skill { font-size: 12.5px; font-weight: 600; color: var(--text); }
.pr-eta { font-size: 12.5px; font-weight: 700; color: var(--amber-bright); font-family: var(--mono); }
.pr-left { grid-column: 2; font-size: 10.5px; color: var(--text-faint); text-align: right; }
.pr-basis { grid-column: 1 / -1; font-size: 10.5px; color: var(--text-faint); }
.pr-why { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-dim); }
.pace-clear { font-size: 12.5px; color: var(--moss-bright); margin: 0; }

@media (max-width: 700px) {
  .chartbar { gap: 6px; }
  .segmented button { padding: 6px 10px; font-size: 11px; }
  svg.bars { height: 130px; }
}
