/* Keystone Lookup: the Adventurer's Journal
   Layout: a dark leather bar with the search, then a parchment journal. On wide screens a lookup is an open
   book: the character sheet and equipment on the left page, the Mythic+ quest log and raids on the right.
   On phones the pages stack and the search folds into a "Change" button.
   Restyle here: every color and font comes from the tokens below. "Parchment" is the light theme,
   "night" the dark one; the leather bar and the item tooltip look the same in both. */

:root {
  /* leather around the pages */
  --leather: #1e130b;
  --bar: #150d07;
  --bar-line: #6b4a1e;
  --bar-btn: #2a1b0c;
  --gold: #c9a24a;
  --gold-2: #e9c46a;
  --cream: #f4e3b0;
  --dim-cream: #c9b27a;
  /* pages */
  --page: #e9d8ae;
  --page-lines: rgb(120 80 20 / .05);
  --page-glow: rgb(150 100 30 / .22);
  --gutter: rgb(90 60 22 / .6);
  --card: rgb(255 248 225 / .5);
  --field: rgb(255 248 225 / .7);
  --ink: #2b1a0c;
  --ink-2: #5a4326;
  --ink-3: #7a5a2a;
  --rule: #8b6b3a;
  --rule-2: rgb(90 60 22 / .3);
  --edge: #5a3c16;
  --edge-2: #b8975a;
  --edge-3: #3a2410;
  --crimson: #7a1712;
  --crimson-2: #4f0d0a;
  --heading: #7a1712;
  --guild: #2e5a1e;
  --ok: #1f6b1f;
  --bad: #8e1b14;
  --bar-ok: #2e7d32;
  --bar-bad: #a9281f;
  --chev: #8a5a00;
  --ink-sk: rgb(90 60 22 / .16);
  --ink-sk-hi: rgb(90 60 22 / .26);
  /* item quality, deepened for parchment */
  --q-poor: #6b6b6b; --q-common: #2b1a0c; --q-uncommon: #1f6b1f; --q-rare: #0a56a8;
  --q-epic: #5b1e96; --q-legendary: #a84a00; --q-artifact: #8a6a1b; --q-heirloom: #00708c;
  /* bookmarks */
  --bm-sheet: #7a1712; --bm-quests: #5a3c16; --bm-gear: #4a2b63; --bm-raids: #2e5a1e;
  --f-display: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --f-head: 'Cinzel', Georgia, serif;
  --f-body: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --f-ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
/* Night: dark pages with pale ink. Follows the system unless the theme button picked one (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #2a1f15; --page-lines: rgb(233 216 174 / .025); --page-glow: rgb(0 0 0 / .35); --gutter: rgb(0 0 0 / .55);
    --card: rgb(0 0 0 / .2); --field: rgb(0 0 0 / .25);
    --ink: #eadbb8; --ink-2: #bba57e; --ink-3: #a88b5c;
    --rule: #7a5f36; --rule-2: rgb(233 216 174 / .14); --edge: #6b4a1e; --edge-2: #4a3418; --edge-3: #120b05;
    --heading: #e8836a; --guild: #8fc77a; --ok: #7fcb7f; --bad: #f08070; --bar-ok: #4caf50; --bar-bad: #d9473b; --chev: #e9c46a;
    --ink-sk: rgb(233 216 174 / .08); --ink-sk-hi: rgb(233 216 174 / .14);
    --q-poor: #9d9d9d; --q-common: #e6e6e6; --q-uncommon: #1eff00; --q-rare: #2f9bff;
    --q-epic: #b65cff; --q-legendary: #ff8000; --q-artifact: #e6cc80; --q-heirloom: #00ccff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #2a1f15; --page-lines: rgb(233 216 174 / .025); --page-glow: rgb(0 0 0 / .35); --gutter: rgb(0 0 0 / .55);
  --card: rgb(0 0 0 / .2); --field: rgb(0 0 0 / .25);
  --ink: #eadbb8; --ink-2: #bba57e; --ink-3: #a88b5c;
  --rule: #7a5f36; --rule-2: rgb(233 216 174 / .14); --edge: #6b4a1e; --edge-2: #4a3418; --edge-3: #120b05;
  --heading: #e8836a; --guild: #8fc77a; --ok: #7fcb7f; --bad: #f08070; --bar-ok: #4caf50; --bar-bad: #d9473b; --chev: #e9c46a;
  --ink-sk: rgb(233 216 174 / .08); --ink-sk-hi: rgb(233 216 174 / .14);
  --q-poor: #9d9d9d; --q-common: #e6e6e6; --q-uncommon: #1eff00; --q-rare: #2f9bff;
  --q-epic: #b65cff; --q-legendary: #ff8000; --q-artifact: #e6cc80; --q-heirloom: #00ccff;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 86px; background: var(--leather); }
body {
  margin: 0; min-height: 100vh; background: var(--leather); color: var(--ink);
  font: 18px/1.4 var(--f-body); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--crimson); outline-offset: 2px; }
.bar :focus-visible, .chips :focus-visible, .who:focus-visible { outline-color: var(--gold-2); }
a { color: var(--heading); }
.num { font-variant-numeric: lining-nums tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 16px; top: -60px; background: var(--crimson); color: var(--cream); padding: 8px 14px; border-radius: 4px; z-index: 50; font: 700 15px var(--f-head); text-decoration: none; }
.skip:focus { top: 12px; }
kbd { font: 12px/1 var(--f-ui); padding: 3px 6px; border: 1px solid var(--edge-2); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-2); }
.lbl { font: 700 13px/1.2 var(--f-head); letter-spacing: .16em; text-transform: uppercase; color: var(--heading); }
.sub-it { margin: 0; font-style: italic; color: var(--ink-2); font-size: 20px; }
.red { color: var(--heading); }

/* ---------- the parchment ---------- */
.page {
  background-color: var(--page);
  background-image: repeating-linear-gradient(0deg, var(--page-lines) 0 1px, transparent 1px 4px);
  border: 4px solid var(--edge); border-radius: 10px; overflow: hidden;
  box-shadow: 0 20px 50px rgb(0 0 0 / .6), inset 0 0 0 2px var(--edge-2), inset 0 0 90px var(--page-glow);
}
.ribbon {
  padding: 11px 16px; background: var(--crimson); border-bottom: 2px solid var(--gold); text-align: center; color: var(--cream);
  font: 600 15px/1.3 var(--f-head); letter-spacing: .2em; text-transform: uppercase;
}
.ribbon.dim { background: #4f2a12; }

/* ---------- leather bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: var(--bar); border-bottom: 3px solid var(--bar-line); padding-top: env(safe-area-inset-top, 0px); color: var(--cream); }
.bar-in {
  max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 12px max(24px, env(safe-area-inset-right, 0px)) 12px max(24px, env(safe-area-inset-left, 0px));
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--gold-2); white-space: nowrap;
  font: 700 21px/1 var(--f-display); letter-spacing: .04em; margin-right: auto; }
.brand b { font-weight: inherit; }
.brand svg { flex: none; }

.search {
  position: relative; flex: 1 1 460px; max-width: 820px; display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr) auto; align-items: stretch;
  border: 2px solid var(--bar-line); border-radius: 4px; background: #e9d8ae; color: #2b1a0c;
}
.search select, .search input { height: 44px; border: 0; background: transparent; padding: 0 14px; min-width: 0; width: 100%; outline: none; font-size: 19px; color: #2b1a0c; }
.search input::placeholder { color: #6b5230; opacity: 1; }
.search select {
  cursor: pointer; font: 700 15px var(--f-head); border-right: 2px solid #b8975a; padding: 0 22px 0 14px;
  -webkit-appearance: none; appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%235a3c16' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 7px center / 12px;
}
.search select option { background: #e9d8ae; color: #2b1a0c; }
.search #realm { border-right: 2px solid #b8975a; }
.search input:focus-visible, .search select:focus-visible { background-color: rgb(255 248 225 / .75); }
.name-wrap { position: relative; min-width: 0; }
.name-wrap .hint { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: #5a4326; border-color: #b8975a; }
.name-wrap input:focus + .hint, .name-wrap input:not(:placeholder-shown) + .hint { display: none; }
.go {
  border: 0; border-left: 2px solid var(--bar-line); background: #7a1712; color: #f4e3b0; cursor: pointer; white-space: nowrap;
  font: 700 15px var(--f-head); letter-spacing: .04em; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.go:hover { background: #8f1d16; }
.go-ic { width: 18px; height: 18px; display: none; }
.go.loading .go-ic { display: block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 4px;
  border: 2px solid var(--bar-line); background: var(--bar-btn); color: var(--gold-2); cursor: pointer;
}
.icon-btn:hover { filter: brightness(1.2); }
.icon-btn svg { width: 20px; height: 20px; }

/* realm dropdown (both forms) */
.combo {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; margin: 0; padding: 6px; list-style: none;
  max-height: min(340px, 60vh); overflow-y: auto; overscroll-behavior: contain;
  background: #f1e4c2; color: #2b1a0c; border: 2px solid #5a3c16; border-radius: 4px;
  box-shadow: 0 14px 30px -10px rgb(0 0 0 / .6); animation: drop .14s ease-out; font-size: 18px;
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.combo li { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 3px; cursor: pointer; line-height: 1.2; color: #5a4326; }
.combo li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo li mark { background: none; color: #2b1a0c; font-weight: 700; }
.combo li .tag { font: 700 11px var(--f-head); letter-spacing: .08em; text-transform: uppercase; color: #7a1712; border: 1px solid #b8975a; border-radius: 999px; padding: 2px 8px; }
.combo li:hover { background: rgb(90 60 22 / .12); color: #2b1a0c; }
.combo li[aria-selected="true"] { background: #5a3c16; color: #f4e3b0; }
.combo li[aria-selected="true"] mark, .combo li[aria-selected="true"] .tag { color: #f4e3b0; }

/* the start page has its own big search, so the bar shows just the brand */
body.home .search { display: none; }

@media (max-width: 760px) {
  .bar-in { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .brand { font-size: 16px; gap: 8px; }
  .brand svg { width: 28px; height: 28px; }
  .icon-btn { width: 46px; height: 46px; }
  .search { order: 3; flex-basis: 100%; max-width: none; grid-template-columns: 72px minmax(0, 1fr); }
  .search #realm { border-right: 0; }
  .name-wrap { grid-column: 1 / -1; border-top: 2px solid #b8975a; }
  .go { grid-column: 1 / -1; border-left: 0; border-top: 2px solid var(--bar-line); height: 46px; }
  .name-wrap .hint { display: none; }
  /* once a lookup is on screen the search folds away behind the "Change" button */
  body:not(.search-open) .search { display: none; }
}
@media (pointer: coarse) { .hint { display: none !important; } }

/* ---------- layout ---------- */
.wrap {
  max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding: 20px max(24px, env(safe-area-inset-right, 0px)) max(48px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
}
body.home .wrap { max-width: 820px; padding-top: 40px; }
@media (max-width: 760px) { .wrap, body.home .wrap { padding: 14px 14px max(32px, env(safe-area-inset-bottom, 0px)); gap: 14px; } }

/* phone: what is on screen, tap to search another */
.who { display: none; }
@media (max-width: 760px) {
  .who:not([hidden]) {
    display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 14px; border: 2px solid var(--bar-line); border-radius: 4px;
    background: #e9d8ae; color: #2b1a0c; text-align: left; cursor: pointer; width: 100%;
  }
  .who svg { width: 20px; height: 20px; flex: none; color: #7a1712; }
  .who-txt { flex: 1 1 auto; min-width: 0; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .who-txt span { color: #5a4326; }
  .who-go { font: 700 13px var(--f-head); color: #7a1712; }
  body.search-open .who-go { visibility: hidden; }
}

/* saved and recent characters, as tags on the leather */
.chips { display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty, body.home .chips { display: none; }
.chip { flex: none; display: inline-flex; align-items: stretch; border-radius: 4px; overflow: hidden; border: 1px solid var(--bar-line); background: var(--bar-btn); color: var(--cream); font-size: 16px; }
.chip:hover { border-color: var(--gold); }
.chip.mine { border-color: var(--gold); }
.chip.active { background: #3a2410; box-shadow: inset 0 -2px 0 var(--gold); }
.chip-go { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 2px 4px 12px; border: 0; background: none; cursor: pointer; white-space: nowrap; color: inherit; }
.chip-go small { color: var(--dim-cream); font-size: 14px; }
.chip .star { color: var(--gold-2); }
.chip-x { border: 0; background: none; color: var(--dim-cream); cursor: pointer; padding: 0 11px 0 8px; font-size: 18px; line-height: 1; }
.chip-x:hover { color: #ff9a8a; }
.chips .clear { flex: none; border: 0; background: none; color: var(--dim-cream); font: 700 12px var(--f-head); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; padding: 6px; }
.chips .clear:hover { color: var(--cream); text-decoration: underline; }

.status { font-size: 16px; color: var(--dim-cream); }
.status:empty { display: none; }
.status.err { color: var(--ink); background: var(--page); border-left: 4px solid var(--bad); border-radius: 4px; padding: 10px 14px; }
#out { display: flex; flex-direction: column; min-height: 30vh; }
#out:empty { display: none; }
#out:focus { outline: none; }
#out.busy:not(:has(.skeleton)) { opacity: .6; transition: opacity .2s; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0 24px; box-sizing: border-box;
  border: 2px solid var(--edge); border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 700 15px/1 var(--f-head); letter-spacing: .02em;
}
.btn:hover { background: var(--rule-2); color: var(--ink); }
.btn.primary { background: var(--crimson); color: var(--cream); border-color: var(--edge-3); box-shadow: inset 0 -3px 0 rgb(0 0 0 / .3); }
.btn.primary:hover { background: #8f1d16; }
.btn[disabled] { cursor: default; opacity: .75; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- start page ---------- */
.home-in { padding: 36px 44px 40px; display: flex; flex-direction: column; gap: 28px; }
.home-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.home-head h1 { margin: 0; font: 900 44px/1.1 var(--f-display); color: var(--ink); }
.home-head p { margin: 0; font-size: 22px; line-height: 1.45; font-style: italic; color: var(--ink-2); max-width: 560px; }
.home-form { display: flex; flex-direction: column; gap: 18px; }
.fld { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fld.grow { flex: 1 1 220px; }
.combo-anchor { position: relative; }
.field {
  height: 50px; width: 100%; padding: 0 16px; border: 2px solid var(--edge); border-radius: 4px; background: var(--field); font-size: 21px; color: var(--ink);
  box-shadow: inset 0 2px 6px rgb(90 60 22 / .25); outline: none;
}
.field.big { height: 60px; font-size: 23px; }
.field::placeholder { color: var(--ink-3); opacity: 1; }
.field:focus-visible { outline: 3px solid var(--crimson); outline-offset: 1px; }
.opt { font: 400 16px var(--f-body); letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.home-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.seg { display: flex; border: 2px solid var(--edge); border-radius: 4px; overflow: hidden; }
.seg button { min-width: 60px; height: 46px; border: 0; background: transparent; font: 700 15px var(--f-head); cursor: pointer; color: var(--ink); }
.seg button + button { border-left: 2px solid var(--edge); }
.seg button[aria-pressed="true"] { background: var(--edge); color: var(--cream); }
.seg button:focus-visible { outline-offset: -4px; }
.home-go { flex: 1 1 160px; height: 50px; font-size: 16px; letter-spacing: .06em; }
.home-note { margin: 0; font-size: 17px; font-style: italic; color: var(--ink-2); line-height: 1.4; }
.rule { display: flex; align-items: center; gap: 12px; }
.rule::before, .rule::after { content: ""; flex: 1 1 auto; height: 2px; background: var(--rule); }
.rule .lbl { font-size: 12px; }
.entries { display: flex; flex-wrap: wrap; gap: 20px; }
.entry-box { flex: 1 1 280px; min-width: 0; padding: 16px 18px; border: 2px solid var(--rule); border-radius: 6px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.entry-box.dashed { border-style: dashed; background: none; }
.entry-box h2 { margin: 0; font: 700 19px var(--f-head); color: var(--heading); }
.entry-box p { margin: 0; font-size: 18px; line-height: 1.45; }
.entry-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.entry-h .clear { border: 0; background: none; color: var(--ink-2); font: 700 12px var(--f-head); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; padding: 4px; }
.entry-h .clear:hover { color: var(--heading); text-decoration: underline; }
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.entry { display: flex; align-items: center; gap: 4px; }
.entry-go { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 4px; border: 0; border-radius: 4px; background: none; cursor: pointer; text-align: left; color: var(--ink); }
.entry-go:hover { background: var(--rule-2); }
.entry .chip-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 20px; padding: 6px 8px; border-radius: 4px; }
.entry .chip-x:hover { color: var(--bad); background: var(--rule-2); }
.crest {
  flex: none; width: 48px; height: 48px; border: 2px solid var(--cc, var(--gold)); border-radius: 6px; background: #241636; object-fit: cover;
  display: flex; align-items: center; justify-content: center; font: 700 22px var(--f-head); color: var(--cc, var(--gold-2));
}
.entry-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.entry-name { font-size: 21px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-name .star { color: var(--heading); }
.entry-meta { font-size: 16px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-score { font: 700 20px var(--f-head); }
@media (max-width: 760px) {
  .home-in { padding: 26px 18px 28px; gap: 22px; }
  .home-head h1 { font-size: 32px; }
  .home-head p { font-size: 19px; }
  .field.big { font-size: 19px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .home-go { flex-basis: 100%; }
}

/* ---------- loading, not found, errors, name results ---------- */
.note { max-width: 760px; width: 100%; margin: 0 auto; }
.note-in { padding: 32px 36px 36px; display: flex; flex-direction: column; gap: 22px; }
.note-h { display: flex; flex-direction: column; gap: 6px; }
.note-h h2 { margin: 0; font: 700 28px/1.15 var(--f-display); color: var(--heading); }
.note-h p { margin: 0; font-size: 20px; line-height: 1.4; }
.note-h .sub-it { font-size: 19px; }
.note-foot { margin: 0; font-size: 16px; color: var(--ink-2); text-align: center; }
.ink { display: block; height: 18px; border-radius: 3px; background: linear-gradient(90deg, var(--ink-sk) 25%, var(--ink-sk-hi) 50%, var(--ink-sk) 75%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.ink.tall { height: 56px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.ink-c { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ink-c .ink:first-child { height: 22px; }
.ink-l { display: flex; flex-direction: column; gap: 12px; }
.seal.ghost { width: 150px; height: 150px; margin: 0 auto; opacity: .55; }
.try ol { list-style: none; margin: 6px 0 0; padding: 0; counter-reset: try; }
.try li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule-2); font-size: 19px; counter-increment: try; }
.try li:last-child { border-bottom: 1px solid var(--rule-2); }
.try li::before { content: counter(try); font-weight: 700; color: var(--heading); }
.warn { margin: 0; padding: 12px 14px; border-left: 4px solid var(--bad); background: var(--card); font-size: 17px; line-height: 1.45; color: var(--ink-2); }
.warn b { color: var(--bad); }
.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pick-list > li { min-width: 0; border-top: 1px solid var(--rule-2); }
.pick-list > li:last-child { border-bottom: 1px solid var(--rule-2); }
.pick { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 6px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); border-radius: 4px; }
.pick:hover { background: var(--rule-2); }
.pk-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pk-name { font-size: 21px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-realm { font-weight: 400; color: var(--ink-2); }
.pk-realm::before { content: "· "; }
.pk-meta { font-size: 16px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-stats { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.pk-score { font: 700 21px var(--f-head); }
.pk-score.none { color: var(--ink-3); }
.pk-sub { font-size: 15px; color: var(--ink-2); }
@media (max-width: 760px) {
  .note-in { padding: 24px 18px 26px; gap: 18px; }
  .note-h h2 { font-size: 24px; }
  .actions .btn { flex: 1 1 0; padding: 0 14px; }
  .pick { gap: 12px; }
  .pk-name { font-size: 19px; }
}

/* ---------- bookmarks ---------- */
.marks { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 20px; }
.bm {
  display: flex; align-items: center; justify-content: center; height: 46px; padding: 0 24px; border-radius: 8px 8px 0 0;
  border: 2px solid var(--edge-3); border-bottom: 0; color: var(--cream); cursor: pointer;
  font: 700 15px var(--f-head); letter-spacing: .06em;
}
.bm:hover { color: #fff; filter: brightness(1.15); }
.bm-sheet { background: var(--bm-sheet); } .bm-quests { background: var(--bm-quests); } .bm-gear { background: var(--bm-gear); } .bm-raids { background: var(--bm-raids); }
.bm .slim { display: none; }

/* ---------- the open book ---------- */
.book { display: flex; flex-wrap: wrap; }
.leaf { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; padding: 0 40px 28px; }
.leaf-l { box-shadow: inset -34px 0 40px -30px var(--gutter), inset 0 0 80px var(--page-glow); }
.leaf-r { padding-top: 36px; gap: 22px; border-left: 3px double var(--rule); box-shadow: inset 34px 0 40px -30px var(--gutter), inset 0 0 80px var(--page-glow); }
.folio { margin-top: auto; text-align: center; font: 14px var(--f-head); letter-spacing: .3em; color: var(--ink-3); }

/* character sheet */
.sheet { display: flex; flex-direction: column; gap: 24px; }
.sheet .ribbon { margin: 0 -40px; }
.ident { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.guild { margin: 0; font-size: 21px; font-style: italic; color: var(--guild); }
.char { margin: 0; font: 900 58px/1.05 var(--f-display); color: var(--ink); letter-spacing: .01em; overflow-wrap: anywhere; }
.ident .guild + .char { margin-top: -2px; }
.ident > :first-child { margin-top: 14px; }
.sub { margin: 0; font-size: 22px; }
.sub .cls { font-weight: 700; }
.sheet-mid { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: center; }
.seal {
  flex: none; width: 204px; height: 204px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #6a1510, #3a0907 75%); border: 5px solid var(--gold);
  box-shadow: 0 0 0 3px var(--crimson-2), 0 0 0 5px var(--gold), 0 8px 16px rgb(0 0 0 / .45), inset 0 0 30px rgb(0 0 0 / .5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #f4e3b0; text-align: center; padding: 0 12px;
}
.seal-l { font: 700 11px var(--f-head); letter-spacing: .16em; text-transform: uppercase; }
.seal-v { font: 900 38px/1.05 var(--f-display); text-shadow: 0 2px 4px rgb(0 0 0 / .6); }
.seal-s { font-size: 15px; line-height: 1.2; }
.facts { flex: 1 1 210px; min-width: 0; margin: 0; display: flex; flex-direction: column; }
.fact { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; }
.fact::after { content: ""; order: 1; flex: 1 1 auto; min-width: 12px; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.fact dt { order: 0; font-size: 19px; }
.fact dd { order: 2; margin: 0; font-size: 21px; font-weight: 700; text-align: right; }
.fact dd small { font-size: 15px; font-weight: 400; color: var(--ink-2); }
.sheet .actions { justify-content: center; }
.leader { display: flex; align-items: baseline; gap: 10px; }
.leader .dots { flex: 1 1 auto; min-width: 12px; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }

/* section headings */
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sec-h h2 { margin: 0; font: 700 25px var(--f-head); color: var(--heading); }
.sec-h .rule-line { flex: 1 1 auto; height: 2px; background: var(--rule); }
.sec-note { font-size: 19px; font-weight: 700; white-space: nowrap; }
.hint-txt { margin: 0 0 6px; font-size: 15px; color: var(--ink-2); }
.tip-hint { font-style: italic; }
h1:focus, h2:focus { outline: none; }

/* equipment */
.items { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 8px 4px; border-bottom: 1px solid var(--rule-2); cursor: default; border-radius: 2px; }
.item:hover { background: var(--rule-2); }
.item:focus-visible { outline: 3px solid var(--qc); outline-offset: -1px; }
.ic {
  position: relative; flex: none; width: 50px; height: 50px; border: 2px solid var(--qf, #7a3fc4); border-radius: 6px; overflow: hidden; background: #241636;
  box-shadow: inset 0 0 12px color-mix(in srgb, var(--qf, #a335ee) 55%, transparent);
}
.ic img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ic-ph { display: grid; place-items: center; width: 100%; height: 100%; padding-bottom: 14px; font: 700 13px var(--f-head); color: var(--qf, #e8dfc4); }
.ic .il { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 0 2px; text-align: center; font: 700 16px/1 var(--f-head); color: #e8dfc4;
  background: linear-gradient(to top, rgb(10 6 16 / .9) 45%, transparent); text-shadow: 0 1px 2px #000; }
.ic .il.best { color: #f4d27a; }
.tx { min-width: 0; display: flex; flex-direction: column; }
.item .in { font-size: 19px; font-weight: 700; line-height: 1.2; color: var(--qc); }
.item .sl { font-size: 16px; color: var(--ink-2); line-height: 1.3; }
.item .en { font-size: 15px; color: var(--ok); line-height: 1.3; }
.q-poor { --qc: var(--q-poor); --qf: #9d9d9d; } .q-common { --qc: var(--q-common); --qf: #c8c8c8; } .q-uncommon { --qc: var(--q-uncommon); --qf: #1eff00; }
.q-rare { --qc: var(--q-rare); --qf: #0070dd; } .q-epic { --qc: var(--q-epic); --qf: #a335ee; } .q-legendary { --qc: var(--q-legendary); --qf: #ff8000; }
.q-artifact { --qc: var(--q-artifact); --qf: #e6cc80; } .q-heirloom { --qc: var(--q-heirloom); --qf: #00ccff; }

/* Item tooltip: dark like the in-game one in both themes, item quality on the border and name. */
.itip {
  position: fixed; z-index: 60; width: max-content; min-width: 220px; max-width: 340px; padding: 12px 14px 13px;
  background: #0c0f17; color: #fff; border: 1px solid color-mix(in srgb, var(--tq) 45%, #2a2f3a);
  border-radius: 6px; box-shadow: 0 16px 36px -12px rgb(0 0 0 / .7);
  font: 13px/1.45 var(--f-ui); pointer-events: none; animation: tipin .12s ease-out;
}
@keyframes tipin { from { opacity: 0; transform: translateY(3px); } }
.itip { --tq: #e6e6e6; }
.itip.q-poor { --tq: #9d9d9d; } .itip.q-uncommon { --tq: #1eff00; } .itip.q-rare { --tq: #0070dd; } .itip.q-epic { --tq: #a335ee; }
.itip.q-legendary { --tq: #ff8000; } .itip.q-artifact { --tq: #e6cc80; } .itip.q-heirloom { --tq: #00ccff; }
.itip > div { white-space: pre-line; }
.itip .t-name { color: var(--tq); font-weight: 700; font-size: 15px; line-height: 1.3; margin-bottom: 2px; }
.itip .t-gold { color: #ffd100; }
.itip .t-green { color: #1eff00; }
.itip .t-grey { color: #8a8f99; }
.itip .t-pale { color: #ffffa0; }
.itip .t-pink { color: #ff80ff; margin-top: 6px; white-space: pre-line; }
.itip .t-desc { color: #ffd100; font-style: italic; }
.itip .t-ind { padding-left: 12px; }
.itip .t-gap { height: 8px; }
.itip .t-pair { display: flex; justify-content: space-between; gap: 18px; }
.itip .t-sock { display: flex; align-items: center; gap: 7px; }
.itip .t-sock i { flex: none; width: 11px; height: 11px; border-radius: 2px; transform: rotate(45deg); border: 1px solid #8a8f99; }
.itip .t-sock i.gem { border-color: #ffd36b; background: radial-gradient(circle at 35% 30%, #fff3c4, #d9862b 60%, #7a3f0e); }

/* Mythic+ quest log */
.mplus { display: flex; flex-direction: column; gap: 22px; }
.quest-h { display: flex; flex-direction: column; gap: 4px; }
.quest-h h2 { margin: 0; font: 700 34px/1.1 var(--f-display); color: var(--heading); }
.tabs { display: flex; align-self: flex-start; border: 2px solid var(--edge); border-radius: 4px; overflow: hidden; }
.tab { height: 46px; padding: 0 20px; border: 0; background: transparent; color: var(--ink); font: 700 14px var(--f-head); cursor: pointer; white-space: nowrap; }
.tab + .tab { border-left: 2px solid var(--edge); }
.tab:hover { background: var(--rule-2); }
.tab[aria-selected="true"] { background: var(--edge); color: var(--cream); }
.tab:focus-visible { outline-offset: -5px; outline-color: var(--gold-2); }
.tabpanel:focus-visible { outline-offset: 4px; }
.runs { display: flex; flex-direction: column; gap: 22px; }
.run { --edge-c: var(--rule); --st: var(--ok); --keyc: var(--heading); --fillc: var(--bar-ok);
  display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; border: 2px solid var(--edge-c); border-radius: 6px; background: var(--card); }
.run.depleted { --edge-c: var(--bad); --st: var(--bad); --keyc: var(--ink-2); --fillc: var(--bar-bad); }
.run-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.run h3 { margin: 0; font: 700 23px/1.15 var(--f-head); color: var(--ink); }
.run .key { color: var(--keyc); }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; padding: 3px 12px; border-radius: 999px; border: 2px solid var(--edge-c); color: var(--st); }
.chev { display: flex; color: var(--chev); }
.chev svg { width: 16px; height: 14px; }
.run .lbl { font-size: 12px; font-weight: 600; }
.run .lbl + .reward { margin-top: -4px; }
.obj { display: flex; align-items: baseline; gap: 10px; font-size: 19px; }
.obj .mark { flex: none; font-weight: 700; color: var(--st); }
.muted { color: var(--ink-2); }
.timer { height: 9px; border: 1px solid var(--edge); border-radius: 3px; background: var(--rule-2); overflow: hidden; }
.timer i { display: block; height: 100%; width: var(--p); background: var(--fillc); }
.reward { font-size: 18px; }
.reward b { font-size: 21px; }
.party { font-size: 17px; line-height: 1.4; }
.it { color: var(--ink-2); font-style: italic; }
.mate { border: 0; padding: 0; background: none; cursor: pointer; color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.mate:hover { color: var(--heading); text-decoration-color: currentColor; }
.mate small { font-size: 14px; color: var(--ink-2); }
.cond { font-size: 16px; line-height: 1.4; color: var(--ink-2); }
.empty-note { padding: 22px 18px; border: 2px dashed var(--rule); border-radius: 6px; text-align: center; }
.empty-note p { margin: 0; font-style: italic; color: var(--ink-2); }

/* raids */
.raid-list { display: flex; flex-direction: column; }
.raid { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.raid-nm { font-size: 21px; font-weight: 700; }
.raid .leader b { font-size: 21px; }
.raid-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 16px; color: var(--ink-2); }
.pips { display: flex; flex-wrap: wrap; gap: 5px; }
.pips i { width: 14px; height: 14px; margin: 2px; transform: rotate(45deg); border: 2px solid var(--edge); }
.pips i.on { background: var(--crimson); }

/* ---------- phones: one page, sections stacked ---------- */
@media (max-width: 1100px) {
  .leaf { flex-basis: 100%; }
  .leaf-r { border-left: 0; border-top: 3px double var(--rule); }
}
@media (max-width: 760px) {
  .marks { gap: 4px; padding: 0 8px; flex-wrap: nowrap; }
  .bm { flex: 1 1 0; padding: 0 6px; font-size: 14px; letter-spacing: .05em; }
  .bm-sheet { display: none; }
  .bm .wide { display: none; }
  .bm .slim { display: inline; }
  .page { border-radius: 8px; box-shadow: 0 14px 30px rgb(0 0 0 / .55), inset 0 0 0 2px var(--edge-2), inset 0 0 70px var(--page-glow); }
  .book { flex-direction: column; flex-wrap: nowrap; }
  .leaf { display: contents; }
  .folio { display: none; }
  .sheet { order: 1; padding: 0 18px 22px; gap: 18px; }
  .mplus { order: 2; }
  .gear { order: 3; }
  .raids { order: 4; }
  .mplus, .gear, .raids { padding: 22px 18px; border-top: 3px double var(--rule); }
  .raids { padding-bottom: 26px; }
  .gear { gap: 6px; }
  .sheet .ribbon { margin: 0 -18px; font-size: 13px; letter-spacing: .18em; padding: 10px 8px; }
  .ident { gap: 6px; }
  .ident > :first-child { margin-top: 10px; }
  .guild { font-size: 20px; }
  .char { font-size: 44px; }
  .sub { font-size: 21px; }
  .sheet-mid { flex-direction: column; align-items: stretch; gap: 18px; }
  .seal { width: 176px; height: 176px; align-self: center; }
  .seal-l { font-size: 10px; }
  .seal-v { font-size: 33px; }
  .seal-s { font-size: 14px; }
  .facts { flex-basis: auto; }
  .fact { padding: 6px 0; }
  .sheet .actions { flex-wrap: nowrap; }
  .sheet .actions .btn { height: 50px; font-size: 14px; }
  .mplus { gap: 14px; }
  .quest-h h2 { font-size: 26px; }
  .quest-h .sub-it { font-size: 18px; }
  .tab { padding: 0 14px; font-size: 13px; }
  .tab .count { display: none; }
  .runs { gap: 14px; }
  .run { padding: 14px 14px 16px; gap: 7px; }
  .run h3 { font-size: 20px; }
  .pill { font-size: 15px; padding: 2px 10px; }
  .obj { font-size: 17px; gap: 8px; }
  .party { font-size: 16px; }
  .cond { font-size: 15px; }
  .sec-h h2 { font-size: 23px; }
  .sec-h .rule-line { display: none; }
  .sec-h { justify-content: space-between; align-items: baseline; }
  .sec-note { font-size: 18px; }
  .tip-hint { display: none; }
  .ic { width: 48px; height: 48px; }
  .item { gap: 12px; }
  .item .in { font-size: 18px; }
  .item .sl { font-size: 15px; }
  .item .en { font-size: 14px; }
  .raid-nm, .raid .leader b { font-size: 20px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  background: var(--bar); color: var(--cream); border: 2px solid var(--bar-line); padding: 9px 16px; border-radius: 4px; font-size: 16px;
  box-shadow: 0 12px 32px -8px rgb(0 0 0 / .6); max-width: calc(100vw - 32px); animation: rise .2s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

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