/* ============ OSRSTracker theme ============ */
:root {
  --bg:        #17130d;
  --bg-2:      #201a11;
  --panel:     #2a2114;
  --panel-2:   #332816;
  --line:      #4a3c22;
  --gold:      #e0b24c;
  --gold-dim:  #b8912f;
  --text:      #e9e0cd;
  --text-dim:  #a89877;
  --green:     #6fbf5b;
  --green-bg:  #24361c;
  --red:       #d8624b;
  --red-bg:    #3a1f18;
  --blue:      #6ea8e0;
  --shadow:    0 6px 24px rgba(0,0,0,.45);
  --radius:    8px;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -200px, #2a2013 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
em { color: var(--gold); font-style: normal; }

/* ---- buttons ---- */
.btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  border-radius: var(--radius); padding: .5rem .9rem; color: var(--text);
  background: var(--panel); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); }
.btn-primary, .btn-gold {
  background: linear-gradient(#e7bf5e, #c2952f); color: #2a1e08;
  border-color: var(--gold-dim); font-weight: 700; text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover, .btn-gold:hover { background: linear-gradient(#f0cd70, #cf9f34); }
.btn-ghost { background: transparent; }

/* ============ AUTH ============ */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 2rem;
}
.brand {
  margin: 0; text-align: center; font-size: 2rem; letter-spacing: .5px;
  color: var(--gold); text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.brand span { color: var(--text); }
.auth-sub { text-align: center; color: var(--text-dim); margin: .4rem 0 1.4rem; font-size: .92rem; }
.auth-tabs { display: flex; gap: .4rem; margin-bottom: 1.2rem; }
.auth-tab {
  flex: 1; padding: .5rem; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text-dim); border-radius: var(--radius); cursor: pointer; font: inherit;
}
.auth-tab.active { color: var(--gold); border-color: var(--gold-dim); background: var(--panel-2); }
#auth-form { display: flex; flex-direction: column; gap: .9rem; }
#auth-form label { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; color: var(--text-dim); }
#auth-form input {
  font: inherit; padding: .6rem .7rem; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text);
}
#auth-form input:focus { outline: none; border-color: var(--gold-dim); }
#auth-submit { margin-top: .4rem; padding: .65rem; }
.form-error { color: var(--red); font-size: .85rem; margin: 0; min-height: 1em; }

/* ============ TOPBAR ============ */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.1rem; background: linear-gradient(var(--panel), var(--bg-2));
  border-bottom: 2px solid var(--gold-dim);
}
.topbar-left { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.brand-mini { font-size: 1.25rem; font-weight: 700; color: var(--gold); }
.brand-mini span { color: var(--text); }
.tabs, .filters, .avail-filters { display: flex; gap: .35rem; flex-wrap: wrap; }
.tab {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-dim); padding: .35rem .3rem; cursor: pointer; font: inherit; font-weight: 600;
}
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.lookup { display: flex; gap: .35rem; }
.lookup input {
  font: inherit; padding: .45rem .6rem; width: 160px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.lookup input:focus { outline: none; border-color: var(--gold-dim); }
.user-badge { color: var(--text-dim); font-size: .88rem; }
.user-badge b { color: var(--gold); }

.lookup-msg { margin: .6rem 1.1rem 0; padding: .5rem .8rem; border-radius: var(--radius); font-size: .88rem; }
.lookup-msg.ok  { background: var(--green-bg); color: var(--green); border: 1px solid #3c5a2c; }
.lookup-msg.err { background: var(--red-bg);   color: var(--red);   border: 1px solid #5a2c22; }

/* ============ PANES ============ */
.tabpane { padding: 1rem 1.1rem 3rem; max-width: 1200px; margin: 0 auto; }

/* progress summary */
.progress-summary { margin-bottom: 1rem; }
.progress-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; flex-wrap: wrap; }
.progress-pct { color: var(--gold); font-weight: 700; }
.qp-count { color: var(--text-dim); font-size: .88rem; padding: .15rem .5rem; border: 1px solid var(--line); border-radius: 20px; }
.chk-inline { margin-left: auto; color: var(--text-dim); font-size: .88rem; display: flex; align-items: center; gap: .35rem; }
.progress-bar { height: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .3s; }

/* controls */
.controls { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.filter {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-dim);
  padding: .35rem .7rem; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: .85rem;
}
.filter.active { color: var(--gold); border-color: var(--gold-dim); background: var(--panel-2); }
.filter.toggle.active { color: var(--green); border-color: #3c5a2c; background: var(--green-bg); }
#filter-locked.active { color: var(--red); border-color: #5a2c22; background: var(--red-bg); }
.search {
  margin-left: auto; font: inherit; padding: .45rem .7rem; min-width: 220px; flex: 1 1 220px;
  max-width: 340px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text);
}
.search:focus { outline: none; border-color: var(--gold-dim); }

/* ============ CONTENT LIST ============ */
.tier-group { margin-bottom: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tier-head {
  display: flex; align-items: center; gap: .8rem; padding: .6rem .9rem; cursor: pointer;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; font-size: .95rem;
}
.tier-head .caret { transition: transform .15s; }
.tier-group.collapsed .caret { transform: rotate(-90deg); }
.tier-group.collapsed .tier-body { display: none; }
.tier-early .tier-head { background: linear-gradient(90deg, #24361c, transparent); color: var(--green); border-bottom: 1px solid #3c5a2c; }
.tier-mid   .tier-head { background: linear-gradient(90deg, #1c2c3a, transparent); color: var(--blue);  border-bottom: 1px solid #2c465a; }
.tier-late  .tier-head { background: linear-gradient(90deg, #3a1f18, transparent); color: var(--red);   border-bottom: 1px solid #5a2c22; }
.tier-count { margin-left: auto; font-size: .82rem; color: var(--text-dim); font-weight: 600; }
.mark-all { font-size: .75rem; padding: .25rem .5rem; }

.tier-body { display: block; }
.item-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: .3rem .8rem; align-items: start; padding: .6rem .9rem;
  border-bottom: 1px solid rgba(74,60,34,.5); background: var(--bg-2);
}
.item-row:nth-child(even) { background: var(--panel); }
.item-row:last-child { border-bottom: none; }
.item-row.done { opacity: .62; }
.item-row.locked .item-name { color: var(--text-dim); }
.item-row.available { box-shadow: inset 3px 0 0 var(--green); }

.item-check { width: 20px; height: 20px; accent-color: var(--gold); cursor: pointer; margin-top: 2px; }
.item-main { min-width: 0; }
.item-name-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.item-name { font-weight: 700; }
.item-row.done .item-name { text-decoration: line-through; }
.badge {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; padding: .12rem .45rem;
  border-radius: 20px; border: 1px solid var(--line); color: var(--text-dim); background: var(--bg);
}
.badge.quest { color: var(--green); border-color: #3c5a2c; }
.badge.boss { color: var(--red); border-color: #5a2c22; }
.badge.diary { color: var(--blue); border-color: #2c465a; }
.badge.unlock { color: #c58ee0; border-color: #4a2c5a; }
.badge.activity { color: var(--gold); border-color: var(--gold-dim); }
.badge.miniquest { color: #d0b48a; }
.badge.avail { color: var(--green); border-color: #3c5a2c; background: var(--green-bg); }
.badge.lock { color: var(--red); border-color: #5a2c22; background: var(--red-bg); }
.badge.f2p { color: #7ec8c0; border-color: #2c5a54; }
.badge.diff { color: var(--text-dim); }

.item-meta { font-size: .82rem; color: var(--text-dim); margin-top: .25rem; display: flex; flex-wrap: wrap; gap: .1rem 1rem; }
.item-meta .req-ok { color: var(--green); }
.item-meta .req-miss { color: var(--red); }
.item-notes { font-size: .82rem; color: var(--text-dim); font-style: italic; margin-top: .3rem; }
.item-right { text-align: right; font-size: .8rem; color: var(--text-dim); white-space: nowrap; }
.item-qp b { color: var(--gold); }

.empty-note { padding: 2rem; text-align: center; color: var(--text-dim); }

/* import modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 60; padding: 1rem; }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 14px;
  box-shadow: var(--shadow); padding: 1.6rem;
}
.modal-card h2 { margin: 0 0 .3rem; color: var(--gold); }
.modal-sub { color: var(--text-dim); font-size: .85rem; margin: 0 0 1rem; line-height: 1.45; }
.modal-sub a { color: var(--blue); }
.modal-sub code { background: var(--bg-2); padding: .05rem .3rem; border-radius: 4px; font-size: .82rem; }
.modal-x { position: absolute; top: .6rem; right: .8rem; background: none; border: none; color: var(--text-dim); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.modal-x:hover { color: var(--text); }
.import-text {
  width: 100%; min-height: 180px; resize: vertical; font: .85rem/1.4 "Consolas", monospace;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); padding: .6rem .7rem;
}
.import-text:focus { outline: none; border-color: var(--gold-dim); }
.import-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .7rem 0; }
.import-file-label { cursor: pointer; font-size: .85rem; color: var(--gold); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .7rem; }
.import-file-label:hover { background: var(--panel-2); }
.import-preview { min-height: 1.5em; margin: .3rem 0 1rem; font-size: .88rem; }
.import-preview .imp-ok { color: var(--text); }
.import-preview .imp-ok b { color: var(--gold); }
.import-preview .imp-warn { color: var(--red); font-size: .82rem; margin-top: .35rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.modal-hr { border: none; border-top: 1px solid var(--line); margin: 1.3rem 0 .8rem; }
.plugin-sync summary { cursor: pointer; color: var(--gold); font-weight: 600; font-size: .92rem; }
.plugin-field { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; font-size: .85rem; }
.plugin-field span { color: var(--text-dim); min-width: 60px; }
.plugin-field code {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px;
  padding: .35rem .55rem; font-size: .8rem; overflow-x: auto; white-space: nowrap; color: var(--text);
}
.plugin-field .btn { padding: .35rem .7rem; }
.plugin-note { color: var(--text-dim); font-size: .78rem; margin: .4rem 0 0; }

/* undo snackbar */
.snackbar {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  display: flex; align-items: center; gap: .9rem; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--gold-dim); border-radius: 10px;
  padding: .6rem .7rem .6rem 1rem; box-shadow: var(--shadow); max-width: 92vw;
}
.snackbar #snackbar-text { color: var(--text); font-size: .9rem; }
.snackbar .btn-gold { padding: .35rem .8rem; }
.snackbar-x { background: none; border: none; color: var(--text-dim); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.snackbar-x:hover { color: var(--text); }

/* ============ STATS ============ */
.stats-empty { padding: 2rem; text-align: center; color: var(--text-dim); }



.skill-cell 
.skill-cell 

.skill-cell.overall .lvl { color: var(--text); }

@media (max-width: 620px) {
  .topbar-right { width: 100%; }
  .search { max-width: none; }
  .item-row { grid-template-columns: 28px 1fr; }
  .item-right { grid-column: 2; text-align: left; margin-top: .2rem; }
}

/* ---------- "Next up" card ----------
   Deliberately the loudest thing on the page. If you open the app overwhelmed,
   this should be the only thing you have to read. */
.next-up { margin-bottom: 1rem; }

/* Two lanes: "quick win" vs "bigger payoff". Same weight visually - neither is the
   default answer, because which one is right depends on the reader's energy, not the data. */
.nextup-lanes { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.nextup-lanes.single { grid-template-columns: 1fr; }
.nextup-lane {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem 1.15rem;
  display: flex; flex-direction: column;
}
.nextup-lane .nextup-actions { margin-top: auto; padding-top: .3rem; }
.lane-quick { border-color: var(--green); }
.lane-quick .nextup-label { color: var(--green); }
.lane-big .nextup-label { color: var(--gold-dim); }
.nextup-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .35rem;
}
.nextup-label {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold-dim); font-weight: 700;
}
.nextup-skip {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: .8rem; padding: .2rem .35rem;
}
.nextup-skip:hover { color: var(--gold); }
.nextup-title {
  margin: 0 0 .2rem; font-size: 1.7rem; line-height: 1.15; color: var(--gold);
}
.nextup-why { margin: 0 0 .7rem; color: var(--text-dim); font-size: .9rem; }
.nextup-start {
  margin: 0 0 .55rem; padding: .55rem .7rem;
  background: rgba(0,0,0,.22); border-left: 3px solid var(--green);
  border-radius: 0 4px 4px 0; line-height: 1.45;
}
.nextup-start span {
  display: block; font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--green); margin-bottom: .15rem;
}
.nextup-desc { margin: 0 0 .8rem; color: var(--text-dim); font-size: .88rem; line-height: 1.5; }
.nextup-actions { display: flex; align-items: center; gap: .9rem; }
.nextup-wiki { color: var(--blue); text-decoration: none; font-size: .85rem; }
.nextup-wiki:hover { text-decoration: underline; }
.nextup-notes {
  margin: .9rem 0 0; padding: .7rem 0 0 1.1rem;
  border-top: 1px solid var(--line); color: var(--text-dim); font-size: .86rem;
}
.nextup-notes li { margin: .25rem 0; }
.nextup-notes strong { color: var(--text); }
.nextup-empty { color: var(--text-dim); text-align: center; padding: .6rem 0; }

.next-up > .nextup-notes { margin-top: .8rem; padding-left: 2.1rem; border-top: none; }

@media (max-width: 860px) {
  .nextup-lanes { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nextup-title { font-size: 1.4rem; }
}

/* Derived items: the game already told us, so the checkbox is inert. */
.badge.auto { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.item-check:disabled { opacity: .55; cursor: not-allowed; }
.item-derived { color: var(--text-dim); font-size: .78rem; font-style: italic; margin-top: .15rem; }

.brand-tag { color: var(--text-dim); font-size: .9rem; margin: .15rem 0 0; }

/* ---------- Collection log tab ----------
   Bars, not rings: at 4% overall and 0% on most pages, a ring is an indistinguishable blob.
   A bar still reads at 1% and lines up for scanning down a column. */
.collection-root { max-width: 1000px; margin: 0 auto; }

.cl-top {
  display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 1.2rem;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim); border-radius: 12px;
  padding: 1.2rem 1.3rem; margin-bottom: 1.4rem; box-shadow: var(--shadow);
}
.cl-overall-num { font-size: 2.1rem; font-weight: 700; color: var(--gold); line-height: 1; }
.cl-overall-num span { font-size: 1rem; font-weight: 400; color: var(--text-dim); }
.cl-overall-label { color: var(--text-dim); font-size: .8rem; margin: .15rem 0 .55rem; }





.cl-hint { color: var(--text-dim); font-size: .85rem; align-self: center; }

.cl-bar { height: 6px; background: rgba(0,0,0,.35); border-radius: 3px; overflow: hidden; margin-top: .3rem; }
.cl-bar > div { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 3px; }
.cl-bar.lg { height: 10px; }
.cl-bar.full > div { background: var(--green); }




.cl-rows { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.cl-row:hover { background: var(--panel-2); }
.cl-row.done .cl-name { color: var(--text-dim); }
.cl-name { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-count { color: var(--text-dim); font-size: .8rem; font-variant-numeric: tabular-nums; }
.cl-pct {
  min-width: 54px; text-align: right; font-size: .8rem; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.cl-row.done .cl-pct { color: var(--green); }





.col-note {
  color: var(--text-dim); font-size: .82rem; line-height: 1.5;
  margin-top: 1.4rem; padding-top: .8rem; border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
  .cl-top { grid-template-columns: 1fr; }
  .cl-row { grid-template-columns: 1fr auto auto; }
  .cl-row .cl-bar { grid-column: 1 / -1; }
}

/* ---------- Progression dashboard ---------- */
.dash { max-width: 1080px; margin: 0 auto; display: grid; gap: 1.4rem; }

.dash-hero {
  background:
    radial-gradient(1200px 240px at 15% -30%, rgba(224,178,76,.14), transparent 60%),
    linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem 1.5rem;
}
.dash-hero-head h2 { margin: 0; font-size: 1.5rem; color: var(--gold); }
.dash-hero-head p { margin: .2rem 0 1rem; color: var(--text-dim); font-size: .92rem; }

.time-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .55rem; }
.time-chip {
  background: rgba(0,0,0,.24); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: .6rem .5rem; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s, transform .12s;
}
.time-chip b { display: block; font-size: 1rem; }
.time-chip span { color: var(--text-dim); font-size: .74rem; }
.time-chip:hover { border-color: var(--gold-dim); transform: translateY(-1px); }
.time-chip.active { border-color: var(--gold); background: rgba(224,178,76,.13); }
.time-chip.active b { color: var(--gold); }

.dash-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .7rem; margin-top: 1.1rem; }
.pick {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: .85rem .95rem; display: flex; flex-direction: column;
}
.pick.lead { border-color: var(--green); background: linear-gradient(165deg, rgba(111,191,91,.09), var(--panel)); }
.pick-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.pick-type {
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .45rem;
}
.pick-type.quest { color: var(--green); border-color: #3c5a2c; }
.pick-type.diary { color: var(--blue); border-color: #2c465a; }
.pick-mins { color: var(--gold-dim); font-size: .76rem; font-variant-numeric: tabular-nums; }
.pick h4 { margin: 0 0 .15rem; font-size: 1.05rem; line-height: 1.2; }
.pick-why { margin: 0 0 .5rem; color: var(--text-dim); font-size: .8rem; }
.pick-start {
  margin: auto 0 0; font-size: .82rem; line-height: 1.45;
  padding: .45rem .6rem; background: rgba(0,0,0,.22);
  border-left: 2px solid var(--green); border-radius: 0 4px 4px 0;
}
.dash-empty { color: var(--text-dim); padding: .8rem 0; }

.dash-h3 {
  font-size: .74rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-dim); margin: 0 0 .6rem;
}
.track-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .65rem; }
.track-card {
  display: flex; align-items: center; gap: .9rem; text-align: left;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: .85rem .95rem; cursor: pointer;
  transition: border-color .15s, transform .12s;
}
.track-card:hover { border-color: var(--gold-dim); transform: translateY(-1px); }
.track-label { color: var(--text-dim); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.track-num { font-size: 1.35rem; font-weight: 700; color: var(--gold); line-height: 1.15; }
.track-num span { font-size: .88rem; font-weight: 400; color: var(--text-dim); }
.track-note { font-size: .72rem; color: var(--text-dim); }

@media (max-width: 560px) {
  .dash-hero { padding: 1.1rem 1rem 1.2rem; }
  .dash-hero-head h2 { font-size: 1.25rem; }
}

.col-groups {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .5rem; margin-bottom: 1rem;
}
.col-group {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .55rem .7rem;
}

/* Progress ring: conic-gradient arc with a punched-out centre. Used only for the dashboard's
   headline tracks — see the note in app.js on why the collection list uses bars. */
.ring {
  --p: 0; --sz: 46px; --c: var(--gold);
  width: var(--sz); height: var(--sz); flex: 0 0 var(--sz);
  border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.07) 0);
}
.ring::before {
  content: ''; position: absolute; inset: 4px;
  border-radius: 50%; background: var(--panel);
}
.ring span {
  position: relative; font-size: calc(var(--sz) * .27); font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ring span i { font-style: normal; font-size: .7em; color: var(--text-dim); }

.dash-nudge {
  margin: -.4rem 0 0; padding: .7rem .9rem;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-dim); font-size: .88rem;
}
.dash-nudge strong { color: var(--gold); }

/* ---------- Skill milestones (Stats tab) ---------- */
.stat-milestones { max-width: 900px; margin: 0 auto 1.6rem; }
.ms-sub { color: var(--text-dim); font-size: .85rem; margin: -.3rem 0 .7rem; }
.ms-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line);
           border-radius: var(--radius); overflow: hidden; }
.ms-row {
  display: grid; grid-template-columns: minmax(130px, 1fr) auto 2fr;
  gap: 1rem; align-items: center;
  background: var(--panel); padding: .65rem .9rem;
}
.ms-row:hover { background: var(--panel-2); }
.ms-jump { display: flex; flex-direction: column; }
.ms-skill { font-weight: 600; font-size: .92rem; }
.ms-lvl { color: var(--text-dim); font-size: .82rem; font-variant-numeric: tabular-nums; }
.ms-lvl b { color: var(--gold); }
.ms-xp {
  text-align: right; color: var(--text); font-size: .88rem; font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column;
}
.ms-xp span { color: var(--text-dim); font-size: .74rem; }
.ms-unlocks { font-size: .84rem; min-width: 0; }
.ms-unlocks b { color: var(--green); }
.ms-unlocks span {
  display: block; color: var(--text-dim); font-size: .78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .ms-row { grid-template-columns: 1fr auto; }
  .ms-unlocks { grid-column: 1 / -1; }
}

/* ---------- First-run setup ---------- */
.setup {
  background:
    radial-gradient(900px 200px at 20% -40%, rgba(224,178,76,.14), transparent 60%),
    linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim); border-radius: 12px;
  padding: 1.6rem 1.7rem; box-shadow: var(--shadow); max-width: 780px; margin: 0 auto;
}
.setup h2 { margin: 0 0 .35rem; color: var(--gold); font-size: 1.5rem; }
.setup-lede { margin: 0 0 1.3rem; color: var(--text-dim); line-height: 1.55; }
.setup-steps { margin: 0; padding-left: 1.3rem; display: grid; gap: 1.1rem; }
.setup-steps li { line-height: 1.5; }
.setup-steps li > b { color: var(--text); }
.setup-steps li > span { display: block; color: var(--text-dim); font-size: .88rem; margin-top: .15rem; }
.setup-steps code {
  background: rgba(0,0,0,.3); padding: .05rem .3rem; border-radius: 3px; font-size: .85em;
}
.setup-field {
  display: flex; align-items: center; gap: .6rem; margin-top: .5rem;
  background: rgba(0,0,0,.24); border: 1px solid var(--line);
  border-radius: 6px; padding: .45rem .6rem;
}
.setup-field > span { color: var(--text-dim); font-size: .78rem; min-width: 58px; }
.setup-field > code { flex: 1; overflow-wrap: anywhere; font-size: .82rem; }
.setup-alt {
  margin: 1.4rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: .85rem; line-height: 1.5;
}

}

/* ---------- Combat achievements tab ---------- */
.combat-root { max-width: 1000px; margin: 0 auto; }
.cm-top {
  display: grid; grid-template-columns: minmax(240px, 1fr) 1.4fr; gap: 1.4rem;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim); border-radius: 12px;
  padding: 1.2rem 1.3rem; margin-bottom: 1.1rem; box-shadow: var(--shadow);
}
.cm-points { font-size: 2rem; font-weight: 700; color: var(--gold); line-height: 1; }
.cm-points span { font-size: .95rem; font-weight: 400; color: var(--text-dim); }
.cm-sub { color: var(--text-dim); font-size: .82rem; margin: .2rem 0 .5rem; }
.cm-next { margin-top: .6rem; font-size: .85rem; color: var(--text-dim); }
.cm-next b { color: var(--gold); }
.cm-tiers { display: grid; gap: .45rem; align-content: center; }
.cm-tier-row { display: grid; grid-template-columns: 88px 1fr auto; gap: .7rem; align-items: center; font-size: .84rem; }
.cm-tier-row span { color: var(--text-dim); }
.cm-tier-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.cm-note {
  color: var(--text-dim); font-size: .84rem; line-height: 1.5; margin: 0 0 .9rem;
}
.cm-note b { color: var(--text); }
.cm-rows { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line);
           border-radius: var(--radius); overflow: hidden; }
.cm-row {
  display: grid; grid-template-columns: 1fr 190px 58px; gap: 1rem; align-items: center;
  background: var(--panel); padding: .6rem .85rem;
}
.cm-row:hover { background: var(--panel-2); }
.cm-name { font-weight: 600; font-size: .92rem; }
.cm-desc { color: var(--text-dim); font-size: .8rem; line-height: 1.4; margin-top: .1rem; }
.cm-meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cm-monster { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-type { font-size: .72rem; color: var(--text-dim); }
.cm-pct {
  text-align: right; font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--gold);
}
@media (max-width: 760px) {
  .cm-top { grid-template-columns: 1fr; }
  .cm-row { grid-template-columns: 1fr auto; }
  .cm-meta { grid-column: 1 / -1; flex-direction: row; gap: .6rem; }
}

.cm-row.done { opacity: .55; }
.cm-row.done .cm-name { text-decoration: line-through; text-decoration-color: var(--text-dim); }
.cm-tick { color: var(--green); font-weight: 700; }

/* Combat tab: tier sections, mirroring the Quests tab's grouping. */
.cm-win {
  background: linear-gradient(160deg, rgba(111,191,91,.12), var(--panel));
  border: 1px solid var(--green); border-left-width: 3px;
  border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1.1rem;
}
.cm-win-label {
  font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--green); font-weight: 700;
}
.cm-win h3 { margin: .2rem 0 .15rem; font-size: 1.25rem; color: var(--gold); }
.cm-win-desc { margin: 0 0 .4rem; line-height: 1.45; }
.cm-win-meta { margin: 0; color: var(--text-dim); font-size: .82rem; }
.cm-win-meta b { color: var(--text); }

.cm-tier { margin-bottom: .7rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cm-tier > summary {
  display: flex; align-items: baseline; gap: .8rem; cursor: pointer;
  background: var(--panel-2); padding: .6rem .9rem;
}
.cm-tier > summary::-webkit-details-marker { display: none; }
.cm-tier > summary::before { content: '▸'; color: var(--gold-dim); }
.cm-tier[open] > summary::before { content: '▾'; }
.cm-tier-name { font-weight: 600; }
.cm-tier-count { color: var(--gold); font-variant-numeric: tabular-nums; }
.cm-tier-pts { color: var(--text-dim); font-size: .78rem; margin-left: auto; }
.cm-tier .cm-rows { border: none; border-radius: 0; }

.cm-win-meta .ok { color: var(--green); }
.cm-win-blocked {
  margin: .55rem 0 0; padding-top: .5rem; border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: .8rem;
}
.cm-win-blocked b { color: var(--text); }
.cm-req { color: var(--blue); }
.cm-req.locked { color: var(--red); }
.cm-row.locked { opacity: .6; }

.cm-win-caveat { margin: .4rem 0 0; color: var(--text-dim); font-size: .76rem; line-height: 1.45; }

/* ---------- Detail panel ---------- */
.clickable { cursor: pointer; }
.detail-card { max-width: 620px; }
.dt-head { margin-bottom: 1rem; }
.dt-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .45rem; }
.dt-head h2 { margin: 0; font-size: 1.5rem; color: var(--gold); line-height: 1.2; }
.dt-desc { margin: .35rem 0 0; color: var(--text-dim); line-height: 1.5; }
.dt-start {
  padding: .6rem .8rem; margin-bottom: 1rem; line-height: 1.5;
  background: rgba(0,0,0,.22); border-left: 3px solid var(--green); border-radius: 0 4px 4px 0;
}
.dt-start span {
  display: block; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--green); margin-bottom: .15rem;
}
.dt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.dt-grid h3 {
  font-size: .72rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--gold-dim); margin: 0 0 .45rem;
}
.dt-reqs, .dt-unlocks { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.dt-reqs li, .dt-unlocks li { font-size: .87rem; line-height: 1.45; }
.dt-ok { color: var(--green); }
.dt-miss { color: var(--red); }
.dt-unknown { color: var(--text-dim); }
.dt-have { color: var(--text-dim); font-size: .8em; }
.dt-none, .dt-note { color: var(--text-dim); font-size: .82rem; line-height: 1.5; margin: .3rem 0 0; }
.dt-note b { color: var(--text); }
.dt-big { font-size: 2rem; font-weight: 700; color: var(--gold); margin: .2rem 0 0; line-height: 1; }
.dt-big span { font-size: 1rem; font-weight: 400; color: var(--text-dim); }
.dt-actions {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-top: 1.3rem; padding-top: .9rem; border-top: 1px solid var(--line);
}
@media (max-width: 560px) { .dt-grid { grid-template-columns: 1fr; } }

.dt-sub {
  font-size: .72rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--gold-dim); margin: 1.1rem 0 .45rem;
}
.dt-sub .dt-note { display: inline; text-transform: none; letter-spacing: 0; }

.dt-items li { font-size: .84rem; color: var(--text-dim); line-height: 1.5; }

.dt-items .dt-got { color: var(--green); }
.dt-items .dt-missing { color: var(--text-dim); }

/* Collection tabs — mirrors the five in-game categories instead of stacking them vertically. */
.cl-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1.1rem 0 .2rem; }
.cl-tab {
  flex: 1 1 110px; background: var(--panel); border: 1px solid var(--line);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text); padding: .5rem .6rem; cursor: pointer; text-align: center;
  transition: background .15s, border-color .15s;
}
.cl-tab b { display: block; font-size: .9rem; font-weight: 600; }
.cl-tab span { color: var(--text-dim); font-size: .76rem; font-variant-numeric: tabular-nums; }
.cl-tab:hover { border-color: var(--gold-dim); }
.cl-tab.active { background: var(--panel-2); border-color: var(--gold); }
.cl-tab.active b { color: var(--gold); }
.cl-group-bar { border: 1px solid var(--line); border-top: none; padding: .5rem .7rem; background: var(--panel-2); }
.cl-controls {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .2rem .7rem; color: var(--text-dim); font-size: .82rem;
}

.dt-rate { color: var(--gold-dim); font-size: .78em; margin-left: .35rem; font-variant-numeric: tabular-nums; }
.dt-items .dt-got .dt-rate { color: var(--text-dim); }

/* Collection rows: two lines like the quest rows, so the row itself is useful without
   opening the panel — what's missing, and how rare the worst of it is. */
.cl-row {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center;
  background: var(--panel); padding: .6rem .85rem;
}
.cl-row-main { min-width: 0; }
.cl-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; }
.cl-row-sub { margin-top: .3rem; font-size: .78rem; }
.cl-missing { color: var(--text-dim); }
.cl-done-note { color: var(--green); }
.cl-unknown { color: var(--text-dim); font-style: italic; }
.cl-row-right { text-align: right; display: flex; flex-direction: column; gap: .1rem; }
.cl-hardest {
  font-size: .76rem; color: var(--gold-dim); font-variant-numeric: tabular-nums;
}
.cl-row.done { opacity: .62; }
.dt-items a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.dt-items a:hover { color: var(--gold); }

.dt-src { color: var(--text-dim); font-size: .9em; }

.cl-rate { color: var(--gold-dim); font-variant-numeric: tabular-nums; }
.cl-more { color: var(--text-dim); }

/* Contents: one entry per cell, name and rates on separate lines. Rates make each entry too
   long to sit inline — previously a name like "Enhanced crystal weapon seed" broke mid-phrase
   and ran into its own rarities. */
.dt-items {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .5rem .9rem; max-height: 260px; overflow-y: auto;
}
.dt-items li { font-size: .84rem; line-height: 1.35; min-width: 0; }
.dt-item-name { display: block; overflow-wrap: anywhere; }
.dt-item-rate { display: block; margin-top: .1rem; }
.dt-rate { color: var(--gold-dim); font-size: .92em; margin-left: 0; font-variant-numeric: tabular-nums; }

/* "Closest to finishing" — mirrors the Combat tab's easiest-win card. */
.cl-win {
  background: linear-gradient(160deg, rgba(224,178,76,.10), var(--panel));
  border: 1px solid var(--gold-dim); border-left-width: 3px;
  border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .8rem;
}
.cl-win-label {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-dim); font-weight: 700;
}
.cl-win h3 { margin: .15rem 0 .1rem; font-size: 1.15rem; color: var(--gold); }
.cl-win-sub { margin: 0; font-size: .85rem; color: var(--text-dim); }
.cl-win-sub b { color: var(--text); }
.cl-win-items { margin: .3rem 0 0; font-size: .78rem; color: var(--text-dim); }
.cl-win-caveat { color: var(--text-dim); font-size: .92em; }

/* ---------- Stats grid: each cell answers "how close, and to what" ---------- */
.skill-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .55rem;
  max-width: 1080px; margin: 0 auto;
}
.skill-cell {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .7rem;
}
.skill-cell.overall { grid-column: 1 / -1; display: flex; align-items: center; gap: .9rem;
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); border-color: var(--gold-dim); }
.skill-cell.maxed { opacity: .72; }
.sk-top { display: flex; align-items: center; gap: .55rem; }
.skill-cell .lvl { font-size: 1.5rem; font-weight: 700; color: var(--gold); min-width: 1.6em; text-align: center; }
.sk-id { min-width: 0; }
.sk-name { font-weight: 600; font-size: .88rem; }
.sk-xp { color: var(--text-dim); font-size: .72rem; font-variant-numeric: tabular-nums; }
.sk-bar { height: 4px; background: rgba(0,0,0,.35); border-radius: 2px; overflow: hidden; margin: .45rem 0 .2rem; }
.sk-bar > div { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.sk-next { font-size: .72rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.sk-next.maxed { color: var(--green); }
.sk-unlock {
  margin-top: .4rem; padding-top: .35rem; border-top: 1px solid var(--line);
  font-size: .74rem; color: var(--green); cursor: default;
}
.sk-cost { color: var(--text-dim); }


/* ---------- Collection goal picker (reuses .next-up / .nextup-lane) ---------- */
.goal-diffs { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.goal-chips { display: flex; gap: .3rem; flex-wrap: wrap; }
.cl-diff { background: rgba(0,0,0,.24); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; cursor: pointer; }
.cl-diff:hover { border-color: var(--gold-dim); }
.cl-diff.active { background: rgba(224,178,76,.14); border-color: var(--gold); color: var(--gold); }
.goal-accessible { border-color: var(--green); }
.goal-accessible .nextup-label { color: var(--green); }
.goal-accessible .nextup-start { border-left-color: var(--green); }
.goal-accessible .nextup-start span { color: var(--green); }
.goal-challenging { border-color: var(--gold); }
.goal-endgame { border-color: var(--red); }
.goal-endgame .nextup-start { border-left-color: var(--red); }
.goal-endgame .nextup-start span { color: var(--red); }
.goal-go { color: var(--gold); font-size: .85rem; white-space: nowrap; }
.goal-lane:hover { transform: translateY(-1px); transition: transform .12s; }

/* Goal card (green cm-win style) + difficulty skulls */
.cl-goal-wrap { margin-bottom: 1rem; }
.goal-diffs { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.goal-chips { display: flex; gap: .3rem; flex-wrap: wrap; }
.cl-diff { background: rgba(0,0,0,.24); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; cursor: pointer; }
.cl-diff:hover { border-color: var(--gold-dim); }
.cl-diff.active { background: rgba(111,191,91,.14); border-color: var(--green); color: var(--green); }
.goal-win { cursor: pointer; }
.goal-win:hover { transform: translateY(-1px); transition: transform .12s; }
.goal-win-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.goal-go { color: var(--green); font-size: .85rem; white-space: nowrap; font-weight: 600; }
.goal-reqs, .dt-reqline { margin: .35rem 0 0; font-size: .82rem; color: var(--text-dim); }
.goal-still { margin: .35rem 0 0; font-size: .8rem; color: var(--text-dim); }
.skulls { letter-spacing: .08em; font-size: 1.05em; vertical-align: -.05em; }
.skulls-dim { opacity: .25; }
.req-ok { color: var(--green); }
.req-miss { color: var(--red); }
.req-or { color: var(--gold-dim); font-style: normal; text-transform: uppercase; font-size: .78em;
          letter-spacing: .06em; margin: 0 .3rem; }
.dt-mech { margin: .35rem 0 0; font-size: .82rem; color: var(--text-dim); }
.dt-difficulty { margin: .2rem 0 .5rem; font-size: .88rem; color: var(--text-dim); }
.dt-difficulty b { color: var(--text); }

.goal-time { color: var(--green); }
.goal-gated { color: var(--gold-dim); font-size: .82em; }
.dt-time { margin: .2rem 0 .5rem; font-size: .85rem; color: var(--text-dim); }
.dt-time b { color: var(--green); }

.goal-cats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.goal-cat { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-dim); cursor: pointer; }
.cat-tag { font-size: .6rem; letter-spacing: .04em; text-transform: uppercase; padding: .1rem .4rem;
  border-radius: 999px; border: 1px solid var(--line); font-weight: 700; vertical-align: middle; }
.cat-wilderness { color: var(--red); border-color: var(--red-bg); }
.cat-skilling { color: var(--blue); border-color: #2c465a; }
.cat-slayerTask { color: var(--gold); border-color: var(--gold-dim); }
.dt-basis { color: var(--text-dim); font-size: .82em; }

.style-tag { font-size: .68rem; padding: .1rem .45rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-dim); margin-right: .25rem; }
.goal-styles { margin: .2rem 0 0; }
.dt-styles { margin: .1rem 0 .4rem; font-size: .85rem; color: var(--text-dim); }
.style-icons { font-size: .82em; letter-spacing: .05em; margin-left: .15rem; }

.ready-tag { font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; padding: .1rem .45rem;
  border-radius: 999px; font-weight: 700; margin-left: .35rem; vertical-align: middle; }
.ready-comfortable { background: var(--green-bg); color: var(--green); }
.ready-ready { background: rgba(111,191,91,.12); color: var(--green); }
.ready-stretch { background: rgba(224,178,76,.15); color: var(--gold); }
.ready-above { background: var(--red-bg); color: var(--red); }
.ready-locked { background: var(--red-bg); color: var(--red); }

/* Preset-gear chart in the collection popup */
.gear-details { margin-top: 1rem; }
.gear-details > summary { cursor: pointer; color: var(--gold-dim); font-size: .74rem;
  letter-spacing: .1em; text-transform: uppercase; padding: .3rem 0; }
.gear-setup { margin: .6rem 0; }
.gear-style { font-size: .8rem; color: var(--gold); font-weight: 600; margin-bottom: .3rem; }
.gear-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.gear-table th { text-align: left; color: var(--text-dim); font-weight: 600; padding: .25rem .4rem;
  border-bottom: 1px solid var(--line); font-size: .72rem; }
.gear-table td { padding: .22rem .4rem; border-bottom: 1px solid rgba(74,60,34,.4); overflow-wrap: anywhere; }
.gear-slot { color: var(--text-dim); text-transform: capitalize; white-space: nowrap; }

/* ---- invite codes (owner-only modal) ---- */
.invites-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .8rem;
                max-height: 45vh; overflow-y: auto; }
.invite-row { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: .6rem;
              align-items: center; padding: .45rem .6rem; border: 1px solid var(--line);
              border-radius: var(--radius); font-size: .85rem; }
.invite-row code { color: var(--gold); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.invite-note { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-state { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.invite-open    { border-color: var(--green); }
.invite-open    .invite-state { color: var(--green); }
.invite-used    { opacity: .6; }
.invite-revoked { opacity: .5; text-decoration: line-through; }
.field-hint { display: block; margin-top: .25rem; font-size: .76rem; color: var(--text-dim); }
.setup-beta { display: block; margin-top: .4rem; font-size: .82rem; color: var(--gold-dim);
              border-left: 2px solid var(--gold-dim); padding-left: .6rem; }

/* ============ PUBLIC PROFILE ============ */
.pf-hero { text-align: center; padding: 1.6rem 1rem .4rem; }
.pf-hero h2 { margin: 0; font-size: 2rem; color: var(--gold); letter-spacing: .5px; }
.pf-hero p { margin: .4rem 0 0; color: var(--text-dim); font-size: .92rem; }
.pf-hero b { color: var(--text); }

.pf-section { max-width: 900px; margin: 0 auto; padding: 1.2rem 1.1rem; }
.pf-h3 { margin: 0; font-size: 1.05rem; color: var(--gold); letter-spacing: .4px; }
.pf-lede { margin: .2rem 0 .9rem; color: var(--text-dim); font-size: .86rem; }
.pf-none { color: var(--text-dim); font-size: .9rem; padding: 1rem; border: 1px dashed var(--line);
           border-radius: var(--radius); }

/* Insight cards: the reason the page exists. Green accent, matching the Next Up card in the app,
   because these are the "here is something to act on" statements. */
.pf-insights { display: flex; flex-direction: column; gap: .55rem; }
.pf-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem;
  padding: .8rem 1rem; text-decoration: none; color: inherit;
  background: linear-gradient(90deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: var(--radius); transition: transform .12s, border-color .12s;
}
.pf-card:hover { transform: translateY(-1px); border-color: var(--gold-dim); border-left-color: var(--green); }
.pf-card-icon { font-size: 1.4rem; line-height: 1; }
.pf-card-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.pf-card-body b { color: var(--gold); font-size: .96rem; }
.pf-card-body span { color: var(--text-dim); font-size: .85rem; }
.pf-card-metric {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--green);
  background: var(--green-bg); border: 1px solid #3c5a2c; border-radius: 20px;
  padding: .2rem .6rem; font-size: .82rem; white-space: nowrap;
}
.pf-close  { border-left-color: var(--green); }
.pf-unused { border-left-color: var(--gold); }
.pf-unused .pf-card-metric { color: var(--gold); background: rgba(224,178,76,.12); border-color: var(--gold-dim); }
.pf-ready  { border-left-color: var(--blue); }
.pf-ready .pf-card-metric { color: var(--blue); background: rgba(110,168,224,.12); border-color: #2c465a; }
.pf-reward { border-left-color: var(--red); }
.pf-reward .pf-card-metric { color: var(--red); background: var(--red-bg); border-color: #5a2c22; }

.pf-stats { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.pf-stat { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem;
           background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); flex: 1 1 170px; }
.pf-stat-label { color: var(--text-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.pf-stat-num { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.pf-stat-num span { color: var(--text-dim); font-weight: 400; font-size: .85em; }

.pf-pages, .pf-tiers { display: flex; flex-direction: column; }
.pf-page, .pf-tier { display: grid; grid-template-columns: minmax(120px, 1.4fr) 2fr auto;
                     gap: .8rem; align-items: center; padding: .5rem .9rem;
                     border-top: 1px solid rgba(74,60,34,.5); background: var(--bg-2);
                     text-decoration: none; color: inherit; font-size: .86rem; }
.pf-page:hover { background: var(--panel-2); }
.pf-page-name, .pf-tier-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-page-num { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }
.pf-page-num i { color: var(--text-dim); font-style: normal; font-weight: 400; }

.pf-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
             gap: .4rem; padding: .7rem; background: var(--bg-2); }
.pf-skill { display: flex; align-items: baseline; gap: .45rem; padding: .35rem .55rem;
            background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
            text-decoration: none; color: var(--text-dim); font-size: .82rem; }
.pf-skill b { color: var(--gold); font-size: 1rem; font-variant-numeric: tabular-nums; }
.pf-skill.maxed { border-color: #3c5a2c; }
.pf-skill.maxed b { color: var(--green); }

.pf-foot { text-align: center; color: var(--text-dim); font-size: .84rem; padding: 1rem 0 2.5rem; }
.pf-foot a { color: var(--gold); }

/* ---- profile detail: quests, diaries, collection ---- */
.pf-stage { border-top: 1px solid rgba(74,60,34,.5); }
.pf-stage-head { display: flex; align-items: center; gap: .6rem; padding: .45rem .9rem;
                 background: var(--panel-2); font-weight: 700; font-size: .82rem;
                 text-transform: uppercase; letter-spacing: .05em; color: var(--gold); }
.pf-quests { background: var(--bg-2); max-height: 480px; overflow-y: auto; }

.pf-quest { display: grid; grid-template-columns: 22px 1fr auto auto; gap: .6rem;
            align-items: center; padding: .38rem .9rem; text-decoration: none;
            color: var(--text); font-size: .85rem; border-top: 1px solid rgba(74,60,34,.3); }
.pf-quest:hover { background: var(--panel); }
.pf-quest.done { color: var(--text-dim); }
.pf-tick { color: var(--text-dim); }
.pf-quest.done .pf-tick { color: var(--green); }
.pf-quest-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-quest-len { color: var(--text-dim); font-size: .76rem; }
.pf-quest-qp { color: var(--gold-dim); font-size: .76rem; font-variant-numeric: tabular-nums;
               min-width: 42px; text-align: right; }

.pf-diaries { background: var(--bg-2); }
.pf-diary { display: grid; grid-template-columns: 1fr auto; align-items: center;
            padding: .4rem .9rem; border-top: 1px solid rgba(74,60,34,.3); font-size: .85rem; }
.pf-diary-tiers { display: flex; gap: .3rem; }
.pf-pill { width: 22px; height: 22px; display: grid; place-items: center; font-style: normal;
           font-size: .72rem; font-weight: 700; border-radius: 5px; color: var(--text-dim);
           background: var(--panel); border: 1px solid var(--line); }
.pf-pill.on { background: var(--green-bg); color: var(--green); border-color: #3c5a2c; }
.pf-pill.na { opacity: .3; }
.pf-legend { margin: 0; padding: .45rem .9rem; font-size: .76rem; color: var(--text-dim);
             background: var(--panel); border-top: 1px solid rgba(74,60,34,.5); }

/* ---- profile: tab shell ---- */
.pf-tabs { display: flex; gap: .3rem; justify-content: center; flex-wrap: wrap;
           max-width: 900px; margin: 0 auto; padding: .2rem 1rem 0;
           border-bottom: 2px solid var(--gold-dim); }
.pf-tab { background: transparent; border: none; border-bottom: 3px solid transparent;
          color: var(--text-dim); padding: .55rem .9rem; cursor: pointer; font: inherit;
          font-weight: 600; margin-bottom: -2px; transition: color .12s; }
.pf-tab:hover { color: var(--text); }
.pf-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.pf-pane { max-width: 900px; margin: 0 auto; padding: 1.2rem 1.1rem 0; min-height: 40vh; }
.pf-h3-sp { margin-top: 1.6rem; }
.pf-toolbar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .8rem; }
.pf-toolbar .pf-h3 { margin: 0; }
.pf-toolbar .pf-count { margin-left: 0; }
.pf-search { margin-left: auto; font: inherit; font-size: .86rem; padding: .4rem .65rem;
             min-width: 180px; background: var(--bg-2); border: 1px solid var(--line);
             border-radius: var(--radius); color: var(--text); }
.pf-search:focus { outline: none; border-color: var(--gold-dim); }
.pf-count { color: var(--gold); font-size: .82rem; font-variant-numeric: tabular-nums; }

.pf-scroll { max-height: 62vh; overflow-y: auto; border: 1px solid var(--line);
             border-radius: var(--radius); }
.pf-rows { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pf-jump { margin: .6rem 0 0; font-size: .85rem; color: var(--text-dim); }
.pf-link { background: none; border: none; color: var(--gold); cursor: pointer; font: inherit;
           text-decoration: underline; padding: 0; }
.pf-diaries { border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
              overflow: hidden; }

/* ---- profile: expandable collection items ---- */
.pf-page-wrap { border-top: 1px solid rgba(74,60,34,.5); }
.pf-page-btn { width: 100%; border: none; border-top: none; font: inherit; text-align: left;
               cursor: pointer; }
.pf-caret { font-style: normal; color: var(--text-dim); display: inline-block;
            transition: transform .12s; margin-right: .2rem; }
.pf-page-btn.open .pf-caret { transform: rotate(90deg); color: var(--gold); }
.pf-items { background: var(--bg); }
.pf-items-head { padding: .4rem .9rem; font-size: .78rem; color: var(--gold);
                 text-transform: uppercase; letter-spacing: .05em; }
.pf-items-load { padding: .6rem .9rem; color: var(--text-dim); font-size: .85rem; }
.pf-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
                gap: .25rem; padding: 0 .7rem .7rem; }
.pf-item { display: grid; grid-template-columns: 18px 1fr auto; gap: .45rem; align-items: center;
           padding: .3rem .5rem; border-radius: 5px; text-decoration: none; font-size: .82rem;
           color: var(--text-dim); background: var(--bg-2); border: 1px solid transparent; }
.pf-item:hover { border-color: var(--line); }
.pf-item.has { color: var(--text); background: rgba(111,191,91,.07); }
.pf-item-tick { color: var(--line); }
.pf-item.has .pf-item-tick { color: var(--green); }
.pf-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-item-rate { font-size: .74rem; color: var(--gold-dim); font-variant-numeric: tabular-nums; }

/* ---- profile: collection group sub-tabs + nearest-miss callout ---- */
.pf-subtabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .7rem; }
.pf-subtab { background: var(--bg-2); border: 1px solid var(--line); color: var(--text-dim);
             padding: .35rem .7rem; border-radius: var(--radius); cursor: pointer; font: inherit;
             font-size: .85rem; }
.pf-subtab i { font-style: normal; font-size: .78em; opacity: .75; margin-left: .25rem; }
.pf-subtab:hover { border-color: var(--gold-dim); }
.pf-subtab.active { background: var(--panel-2); border-color: var(--gold); color: var(--gold); }

.pf-near { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
           padding: .6rem .9rem; margin-bottom: .7rem; border-radius: var(--radius);
           background: linear-gradient(90deg, var(--green-bg), transparent);
           border: 1px solid #3c5a2c; border-left: 3px solid var(--green); }
.pf-near-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
                 color: var(--green); width: 100%; }
.pf-near b { color: var(--gold); font-size: 1rem; }
.pf-near span { color: var(--text-dim); font-size: .85rem; }

/* The row itself reuses the app's .cl-row styling; these adjust it for use as a button. */
/* color must be explicit: a <button> does not inherit it, so without this the row renders in
   the browser's default black on a dark background. */
.pf-page-btn.cl-row { width: 100%; text-align: left; font: inherit; color: var(--text);
                      cursor: pointer; background: var(--bg-2); border: none;
                      border-top: 1px solid rgba(74,60,34,.5); }
.pf-page-btn.cl-row:hover { background: var(--panel); }

/* ---- profile: combat achievements ---- */
.pf-ca-head { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.2fr);
              gap: .8rem; margin-bottom: .9rem; }
.pf-ca-score { padding: .8rem 1rem; background: var(--panel); border: 1px solid var(--line);
               border-radius: var(--radius); }
.pf-ca-score > b { font-size: 1.9rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.pf-ca-score > span { color: var(--text-dim); }
.pf-ca-sub { color: var(--text-dim); font-size: .82rem; margin: .1rem 0 .5rem; }
.pf-ca-next { margin-top: .5rem; font-size: .84rem; color: var(--text-dim); }
.pf-ca-next b { color: var(--gold); }
.pf-ca-tiers { display: flex; flex-direction: column; gap: .25rem; }
.pf-ca-tier { display: grid; grid-template-columns: 92px 1fr auto; gap: .6rem; align-items: center;
              padding: .3rem .6rem; font: inherit; font-size: .82rem; color: var(--text);
              background: var(--bg-2); border: 1px solid transparent; border-radius: var(--radius);
              cursor: pointer; text-align: left; }
.pf-ca-tier:hover { border-color: var(--line); }
.pf-ca-tier.active { border-color: var(--gold); background: var(--panel-2); }

.pf-ca { display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: center;
         padding: .45rem .9rem; border-top: 1px solid rgba(74,60,34,.4); background: var(--bg-2);
         text-decoration: none; color: var(--text); font-size: .84rem; }
.pf-ca:hover { background: var(--panel); }
.pf-ca-main { display: flex; flex-direction: column; min-width: 0; }
.pf-ca-main span { color: var(--text-dim); font-size: .8rem; overflow: hidden;
                   text-overflow: ellipsis; white-space: nowrap; }
.pf-ca-meta { display: flex; flex-direction: column; text-align: right; }
.pf-ca-monster { color: var(--gold); font-size: .8rem; }
.pf-ca-type { color: var(--text-dim); font-size: .74rem; }
.pf-ca-pct { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: .8rem;
             min-width: 44px; text-align: right; }

/* ---- profile: skills ---- */
.pf-unlocks { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem;
              overflow: hidden; }
.pf-unlocks-head { padding: .55rem .9rem; background: var(--panel-2); color: var(--gold);
                   font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.pf-unlocks-head span { display: block; text-transform: none; letter-spacing: 0;
                        color: var(--text-dim); font-size: .8rem; margin-top: .15rem; }
.pf-unlock { display: grid; grid-template-columns: 1fr auto 1.4fr; gap: .9rem; align-items: center;
             padding: .5rem .9rem; border-top: 1px solid rgba(74,60,34,.4); background: var(--bg-2);
             font-size: .85rem; }
.pf-unlock i { font-style: normal; display: block; color: var(--text-dim); font-size: .76rem; }
.pf-unlock-skill b { color: var(--text); }
.pf-unlock-xp { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }
.pf-unlock-what b { color: var(--green); }

.pf-sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.pf-sk { padding: .55rem .7rem; background: var(--panel); border: 1px solid var(--line);
         border-radius: var(--radius); text-decoration: none; color: var(--text); }
.pf-sk:hover { border-color: var(--gold-dim); }
.pf-sk-top { display: flex; align-items: center; gap: .55rem; margin-bottom: .35rem; }
.pf-sk-lvl { font-size: 1.35rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.pf-sk-lvl.maxed { color: var(--green); }
.pf-sk-name { font-size: .88rem; }
.pf-sk-xp { color: var(--text-dim); font-size: .74rem; }
.pf-sk-next { margin-top: .3rem; color: var(--text-dim); font-size: .74rem; }
.pf-sk-maxed { color: var(--green); }
