/* Forever Compendium app theme, from the Quest Log landing direction (G):
   the Candlelit palette dressed as the Classic game interface. The page is
   the world; screens are gilded windows over it, with a unit frame and
   minimap up top and an action bar with the road-to-60 bar along the
   bottom. Single dark look by choice. Art lives in art/ and icons.js. */
:root {
  --night: #0c0a07;
  --panel: #19130e;
  --panel-hi: #261c13;
  --well: #0a0806;
  --parch: #ecd9aa;
  --parch-deep: #cfb27a;
  --quest-ink: #2d1b0c;
  --quest-title: #3b210d;
  --quest-soft: #574021;
  --gold: #ffd100;
  --gold-soft: #f8e7a2;
  --frame: #c9a24a;
  --bronze: #6b5126;
  --red: #8f1d13;
  --red-hi: #c2321f;
  --wax: #8f1d13;
  --text: #eadfc9;
  --text-dim: #a9977c;
  --text-faint: #948572;
  --health: #1fbf1f;
  --rage: #d0201a;
  --xp: #9b5cf0;

  /* item quality, as the game shows them on dark backgrounds */
  --q-poor: #9d9d9d;
  --q-common: #f2f2f2;
  --q-uncommon: #3be22a;
  --q-rare: #3a95ff;
  --q-epic: #b874ff;
  /* the same qualities darkened for parchment */
  --qi-poor: #6b6b6b;
  --qi-common: #3a2a18;
  --qi-uncommon: #0c5207;
  --qi-rare: #083f8f;
  --qi-epic: #5a2496;

  --tip-bg: linear-gradient(180deg, rgb(12 18 40 / 0.97), rgb(4 6 16 / 0.97));
  --tip-edge: #c3c8d4;

  --ui: "Cinzel", "Trajan Pro", Georgia, serif;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Spectral", "Iowan Old Style", Georgia, serif;

  --cursor: url("art/cursor.svg") 2 2, auto;
  --cursor-hot: url("art/cursor-hot.svg") 2 2, pointer;
  --hud-bottom: 6.6rem;

  color-scheme: dark;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--night);
  scrollbar-color: var(--bronze) var(--well);
  accent-color: var(--gold);
}
* { box-sizing: border-box; }
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 160ms ease-in both fc-fade-out; }
::view-transition-new(root) { animation: 260ms ease-out both fc-fade-in; }
@keyframes fc-fade-out { to { opacity: 0; } }
@keyframes fc-fade-in { from { opacity: 0; } }

html { cursor: var(--cursor); }
body {
  margin: 0; color: var(--text); font: 300 1rem/1.6 var(--body); min-height: 100vh;
  padding-bottom: calc(var(--hud-bottom) + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgb(140 86 32 / 0.38), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 110%, rgb(0 0 0 / 0.75), transparent 60%),
    url("art/leather.svg"),
    var(--night);
  background-attachment: fixed;
}
/* candlelight: a warm wash from above that breathes very slowly */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgb(255 170 70 / 0.08), transparent 70%);
  animation: fc-candle 7s ease-in-out infinite alternate;
}
@keyframes fc-candle { 0% { opacity: 0.6; } 40% { opacity: 1; } 55% { opacity: 0.75; } 100% { opacity: 0.95; } }
main { position: relative; z-index: 1; }
html, body { overflow-x: clip; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
a { color: var(--gold); }
a, button, [role="button"], label, select, summary, input[type="range"], input[type="checkbox"], input[type="radio"] { cursor: var(--cursor-hot); }
input[type="text"], textarea, [contenteditable="true"] { cursor: text; }
button { font: inherit; }
::selection { background: rgb(255 209 0 / 0.35); color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.goldtext { font-family: var(--ui); color: var(--gold); text-shadow: 0 1px 0 #000, 0 0 2px #000, 0 0 14px rgb(0 0 0 / 0.7); }
.label { font: 600 0.72rem/1.3 var(--ui); letter-spacing: 0.1em; color: var(--text-dim); text-transform: uppercase; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Windows: a gilded 9-slice frame laid over a leather panel */
.uiframe {
  position: relative; border-radius: 5px;
  background: linear-gradient(rgb(255 220 160 / 0.035), transparent 30%), url("art/leather.svg"), var(--panel);
  box-shadow: 0 0 0 1px #000, 0 30px 60px -24px rgb(0 0 0 / 0.9), 0 0 40px -10px rgb(0 0 0 / 0.6);
}
.uiframe::after {
  content: ""; position: absolute; inset: -8px; pointer-events: none; z-index: 3;
  border: 30px solid transparent; border-image: url("art/frame.svg") 40 / 30px stretch;
}
.panel {
  position: relative; border-radius: 4px; background: url("art/leather.svg"), var(--panel);
  box-shadow: 0 0 0 1px #000, 0 10px 30px -14px rgb(0 0 0 / 0.8);
}
.panel::after {
  content: ""; position: absolute; inset: -2px; pointer-events: none; z-index: 3;
  border: 14px solid transparent; border-image: url("art/frame-thin.svg") 20 / 14px stretch;
}
.titlebar {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 1.4rem;
  background: linear-gradient(#3a2a1a, #1c150e 70%); border-radius: 4px 4px 0 0;
  box-shadow: inset 0 -1px 0 #000, inset 0 1px 0 rgb(255 230 170 / 0.12);
}
.titlebar::after {
  content: ""; position: absolute; left: 0.75rem; right: 0.75rem; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--frame) 15%, #fff0a6 50%, var(--frame) 85%, transparent);
}
/* the round emblem that sits over a window's top-left corner */
.emblem {
  position: absolute; z-index: 4; left: -1.5rem; top: -1.5rem; width: 4.4rem; height: 4.4rem; border-radius: 50%; padding: 0.7rem;
  background: radial-gradient(circle at 42% 35%, #4a3520, #120c07 75%);
  box-shadow: 0 0 0 2px #000, 0 0 0 6px #b48a36, 0 0 0 7px #000, 0 8px 18px rgb(0 0 0 / 0.7), inset 0 0 14px #000;
}
.emblem::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 200deg, #fff0a6, #8a6a2a 20%, #e2b64c 45%, #5b3f12 70%, #fff0a6);
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5.5px));
}
.has-emblem > .titlebar { padding-left: 3.6rem; }
.titlebar h2 { font: 700 0.95rem/1.2 var(--ui); letter-spacing: 0.08em; color: var(--gold); text-shadow: 0 1px 0 #000, 0 0 2px #000; }
.parchment {
  color: var(--quest-ink);
  background:
    url("art/grain.svg"),
    radial-gradient(ellipse 40% 30% at 85% 15%, rgb(150 100 40 / 0.16), transparent 70%),
    radial-gradient(ellipse 35% 25% at 12% 80%, rgb(150 100 40 / 0.14), transparent 70%),
    linear-gradient(172deg, #f4e4b9, var(--parch) 38%, var(--parch-deep));
  background-blend-mode: multiply, normal, normal, normal;
  box-shadow: inset 0 0 0 1px rgb(80 50 20 / 0.35), inset 0 0 50px rgb(110 66 18 / 0.35), inset 0 0 8px rgb(60 30 5 / 0.35);
}
.parchment ::selection { background: rgb(143 29 19 / 0.25); }

/* Buttons: red with a gold rim, as in the game */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  font: 700 0.82rem/1 var(--ui); letter-spacing: 0.06em; text-decoration: none; color: var(--gold);
  text-shadow: 0 1px 0 #000, 0 0 2px #000; padding: 0.72rem 1.15rem; border-radius: 4px; border: 1px solid #000;
  background: linear-gradient(#d23a24, #9a2015 45%, #6a120a 55%, #4e0c06);
  box-shadow: inset 0 0 0 1px #e8c162, inset 0 0 0 2px #5a3a0e, inset 0 2px 0 2px rgb(255 255 255 / 0.15), 0 2px 0 #000, 0 4px 10px rgb(0 0 0 / 0.6);
  transition: filter 0.12s, transform 0.06s;
}
.btn:hover { filter: brightness(1.2) saturate(1.1); }
.btn:active { transform: translateY(1px); filter: brightness(0.92); box-shadow: inset 0 0 0 1px #e8c162, inset 0 0 0 2px #5a3a0e, inset 0 2px 6px rgb(0 0 0 / 0.5), 0 1px 0 #000; }
.btn:disabled { filter: grayscale(0.85) brightness(0.7); cursor: var(--cursor); }
.btn.ghost {
  color: var(--text); text-shadow: 0 1px 0 #000;
  background: linear-gradient(#33271b, #1a130d 55%, #120d09);
  box-shadow: inset 0 0 0 1px var(--bronze), inset 0 1px 0 1px rgb(255 230 170 / 0.08), 0 2px 0 #000, 0 3px 8px rgb(0 0 0 / 0.5);
}
.btn.ghost:hover { color: var(--gold); filter: none; box-shadow: inset 0 0 0 1px var(--frame), inset 0 0 12px rgb(255 209 0 / 0.12), 0 2px 0 #000; }
.btn.small { padding: 0.52rem 0.8rem; font-size: 0.72rem; }
.ink-btn {
  font: 600 0.72rem/1 var(--ui); letter-spacing: 0.06em; color: var(--quest-soft); text-decoration: none;
  background: rgb(255 255 255 / 0.12); border: 1px solid rgb(106 79 44 / 0.45); border-radius: 3px; padding: 0.48rem 0.65rem;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.35), inset 0 -1px 0 rgb(80 50 20 / 0.15);
}
.ink-btn:hover { color: var(--quest-title); border-color: var(--quest-soft); background: rgb(255 255 255 / 0.28); }

/* Tabs, as on the bottom edge of a game window */
.wintabs { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0 0.9rem; margin-top: 4px; position: relative; z-index: 0; }
.wintabs button {
  font: 600 0.75rem/1 var(--ui); letter-spacing: 0.04em; color: var(--text-dim);
  background: url("art/leather.svg"), linear-gradient(#1f1710, #120d09); border: 2px solid var(--bronze); border-top: 0;
  border-radius: 0 0 7px 7px; padding: 0.65rem 0.85rem 0.6rem; box-shadow: 0 0 0 1px #000, 0 6px 12px -6px #000;
}
.wintabs button:hover { color: var(--text); }
.wintabs button[aria-pressed="true"] {
  color: var(--gold); background: linear-gradient(#3a2a1a, var(--panel-hi)); border-color: var(--frame);
  padding-top: 0.85rem; margin-top: -4px; text-shadow: 0 1px 0 #000;
}

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid rgb(106 79 44 / 0.45); color: var(--quest-soft); background: rgb(255 255 255 / 0.18); white-space: nowrap; }
.chip.dark { border-color: var(--bronze); color: var(--text-dim); background: var(--well); }

/* Icon tiles (icons.js) */
.ico {
  display: block; flex: none; width: var(--ico, 2.6rem); height: var(--ico, 2.6rem); border-radius: 5px;
  border: 2px solid #4a4236; box-shadow: 0 0 0 1px #000, 0 2px 4px rgb(0 0 0 / 0.6); background: #000;
}
.ico.q-common { border-color: #d6d6d6; }
.ico.q-uncommon { border-color: var(--q-uncommon); box-shadow: 0 0 0 1px #000, 0 0 10px -2px rgb(59 226 42 / 0.55); }
.ico.q-rare { border-color: var(--q-rare); box-shadow: 0 0 0 1px #000, 0 0 12px -2px rgb(58 149 255 / 0.65); }
.ico.q-epic { border-color: var(--q-epic); box-shadow: 0 0 0 1px #000, 0 0 12px -2px rgb(184 116 255 / 0.65); }
.ico.empty { border-color: #2e281f; filter: grayscale(1) brightness(0.5) contrast(0.9); }
img.ico { object-fit: cover; object-view-box: inset(5%); user-select: none; }
.glyph { display: block; width: 100%; height: 100%; }
.emblem img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-view-box: inset(6%); }
.micro .micro-ico { position: relative; display: block; width: 100%; height: 100%; border-radius: 4px; object-fit: cover; object-view-box: inset(6%); box-shadow: 0 0 0 1px #000; }
.portrait-art { display: block; width: 100%; height: 100%; }

/* The round portrait in a gold ring, with a level badge */
.portrait {
  position: relative; flex: none; width: var(--pt, 4.5rem); height: var(--pt, 4.5rem); border-radius: 50%;
  background: #000; box-shadow: 0 0 0 2px #000, 0 0 0 5px var(--frame), 0 0 0 6px #000, 0 6px 16px rgb(0 0 0 / 0.7);
}
.portrait .portrait-art { border-radius: 50%; object-fit: cover; object-view-box: inset(6%); }
.portrait::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 210deg, #fff0a6, #a87a26 25%, #e2b64c 50%, #6b4a15 75%, #fff0a6);
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
}
.portrait .lvl {
  position: absolute; left: -0.35rem; bottom: -0.25rem; min-width: 1.75rem; height: 1.75rem; padding: 0 0.3rem; border-radius: 999px;
  display: grid; place-items: center; font: 700 0.8rem/1 var(--ui); color: var(--gold); text-shadow: 0 1px 0 #000;
  background: radial-gradient(circle at 40% 30%, #4a2c1c, #120a05); box-shadow: 0 0 0 1.5px #000, 0 0 0 3px var(--frame), 0 0 0 4px #000;
}
/* the plain initials crest, kept for places a portrait is too much */
.crest {
  flex: none; display: grid; place-items: center; border-radius: 50%; font-family: var(--ui); font-weight: 700; color: var(--gold);
  background: radial-gradient(circle at 40% 35%, #4a2c1c, #160d08); border: 2px solid var(--frame); box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--bronze), 0 0 0 4px #000;
  text-shadow: 0 1px 0 #000; overflow: hidden;
}

/* Status bars: health, rage and the road to 60 */
.sbar { position: relative; height: 0.85rem; border-radius: 2px; background: #050403; box-shadow: inset 0 1px 3px #000, 0 0 0 1px #000; overflow: hidden; }
.sbar > i { position: absolute; inset: 0 auto 0 0; border-radius: 1px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 -3px 4px rgb(0 0 0 / 0.35); }
.sbar.health > i { background: linear-gradient(#5cf05c, var(--health) 45%, #0b7a0b); }
.sbar.rage > i { background: linear-gradient(#ff6a5a, var(--rage) 45%, #7a0a06); }
.sbar.mana > i { background: linear-gradient(#6aa8ff, #1a5ad6 45%, #0a2a78); }
.sbar > span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 0.62rem/1 var(--body); color: #fff; text-shadow: 0 1px 1px #000, 0 0 2px #000; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

/* Top HUD: unit frame left, minimap right */
.hud-top { position: relative; z-index: 15; }
.hud-top-in { max-width: 84rem; margin: 0 auto 0.4rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-block: 0.8rem 0; }
.unitframe { display: flex; align-items: center; gap: 0.2rem; text-decoration: none; color: inherit; min-width: 0; }
.unitframe .portrait { --pt: 4.4rem; z-index: 2; }
.unitframe .uf-plate {
  display: grid; gap: 3px; min-width: 0; width: 13.5rem; padding: 0.4rem 0.6rem 0.45rem 1.1rem; margin-left: -0.9rem; border-radius: 0 6px 6px 0;
  background: linear-gradient(rgb(40 30 20 / 0.95), rgb(14 10 7 / 0.95)); box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--bronze), 0 0 0 3px #000, 0 6px 14px rgb(0 0 0 / 0.6);
}
.unitframe .uname { font: 700 0.86rem/1.15 var(--ui); color: var(--gold); text-shadow: 0 1px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unitframe:hover .uname { color: #fff3a0; }
.unitframe .sbar { height: 0.8rem; }
.hud-brand { display: grid; justify-items: center; gap: 0.25rem; padding-top: 0.35rem; text-align: center; }
.hud-brand .brand { font: 700 1.02rem/1 var(--ui); letter-spacing: 0.12em; text-decoration: none; white-space: nowrap; }
.hud-brand .brand::before, .hud-brand .brand::after { content: "◆"; font-size: 0.5rem; vertical-align: 0.35em; margin: 0 0.6rem; color: var(--frame); }
.hud-right { display: flex; align-items: flex-start; gap: 0.6rem; }
.sample-flag { font: 600 0.62rem/1 var(--ui); letter-spacing: 0.12em; color: #1a1208; background: linear-gradient(#f2d27a, var(--frame)); padding: 0.3rem 0.45rem; border-radius: 3px; box-shadow: 0 0 0 1px #000; }
.minimap { display: grid; justify-items: center; gap: 0.3rem; }
.minimap .zone { font: 600 0.72rem/1 var(--ui); letter-spacing: 0.08em; color: var(--gold); text-shadow: 0 1px 0 #000, 0 0 3px #000; white-space: nowrap; }
.minimap .disc { position: relative; width: 6.2rem; height: 6.2rem; border-radius: 50%; box-shadow: 0 0 0 2px #000, 0 0 0 7px #8a6a2a, 0 0 0 8px #000, 0 8px 20px rgb(0 0 0 / 0.7); }
.minimap .disc::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; pointer-events: none; z-index: 2;
  background: conic-gradient(from 200deg, #fff0a6, #8a6a2a 20%, #e2b64c 45%, #5b3f12 70%, #fff0a6);
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6.5px));
}
.minimap canvas { display: block; width: 100%; height: 100%; border-radius: 50%; background: #1e3a48; }
.minimap .disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 18px rgb(0 0 0 / 0.85); pointer-events: none; }
.minimap .knob {
  position: absolute; z-index: 3; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #3a2a1a, #0e0a06); box-shadow: 0 0 0 1.5px #000, 0 0 0 3px var(--frame), 0 0 0 4px #000;
  border: 0; padding: 0.25rem; color: var(--gold);
}
.minimap .knob.sound { right: -0.5rem; bottom: 0.3rem; }
.minimap .knob.sound[aria-pressed="false"] .waves { opacity: 0.15; }
.minimap .knob.clock { left: -0.5rem; bottom: 0.3rem; font: 700 0.55rem/1 var(--ui); }
.minimap .when { display: none; }

/* Bottom HUD: the road-to-60 bar over a row of micro buttons */
.hud-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(transparent, rgb(6 4 3 / 0.85) 45%);
}
.hud-bottom-in { pointer-events: none; max-width: 46rem; margin: 0 auto; padding: 0.9rem 0.75rem 0.6rem; display: grid; gap: 0.5rem; justify-items: center; }
.xpbar {
  position: relative; width: 100%; height: 0.95rem; border-radius: 2px; background: #07050a;
  box-shadow: 0 0 0 1px #000, 0 0 0 3px #6b5126, 0 0 0 4px #000, inset 0 1px 4px #000;
}
.xpbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#c79bff, var(--xp) 45%, #4a1f8a); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4); transition: width 0.6s cubic-bezier(.2,.8,.2,1); }
.xpbar .fill::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 4px; background: #fff; opacity: 0.7; filter: blur(2px); }
.xpbar .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 1.5px), #000 calc(5% - 1.5px) 5%); opacity: 0.85; }
.xpbar.setbar .fill { background: linear-gradient(#7fe07f, #2e9a2e 45%, #145a14); }
.xpbar.setbar .ticks { background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 2px), #000 calc(12.5% - 2px) 12.5%); }
.xpbar .txt { position: absolute; inset: 0; display: grid; place-items: center; font: 600 0.66rem/1 var(--body); color: #fff; text-shadow: 0 1px 1px #000, 0 0 3px #000; letter-spacing: 0.04em; }
.micro { display: flex; gap: 0.45rem; pointer-events: auto; }
.xpbar { pointer-events: auto; }
.micro a {
  position: relative; width: 3rem; height: 3rem; border-radius: 6px; padding: 0.38rem; display: block; text-decoration: none;
  background: radial-gradient(circle at 45% 35%, #3a3026, #0c0a08); box-shadow: 0 0 0 1px #000, 0 0 0 3px #5b4520, 0 0 0 4px #000, 0 6px 12px rgb(0 0 0 / 0.6);
  transition: transform 0.08s, box-shadow 0.15s;
}
.micro a::after { content: ""; position: absolute; inset: 0; border-radius: 6px; background: linear-gradient(rgb(255 255 255 / 0.18), transparent 45%, rgb(0 0 0 / 0.35)); pointer-events: none; }
.micro a:hover { box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--frame), 0 0 0 4px #000, 0 0 16px rgb(255 209 0 / 0.35); }
.micro a:active { transform: translateY(1px) scale(0.97); }
.micro a[aria-current="page"] { box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--gold), 0 0 0 4px #000, 0 0 18px rgb(255 209 0 / 0.5); }
.micro a[aria-current="page"]::before { content: ""; position: absolute; inset: 2px; border-radius: 4px; box-shadow: inset 0 0 10px rgb(255 209 0 / 0.55); z-index: 1; pointer-events: none; }
.micro .key { position: absolute; right: 3px; top: 2px; z-index: 2; font: 700 0.6rem/1 var(--body); color: #e8e8e8; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
.micro .nm { display: none; font: 600 0.62rem/1 var(--ui); letter-spacing: 0.04em; color: var(--text-dim); }
.micro a[aria-current="page"] .nm { color: var(--gold); }

/* Tooltips: one floating box, styled as the game's */
.tooltip-box {
  position: fixed; z-index: 60; left: 0; top: 0; width: max-content; max-width: min(21rem, calc(100vw - 24px));
  padding: 0.55rem 0.75rem 0.6rem; border-radius: 5px; background: var(--tip-bg); color: #fff; font: 400 0.88rem/1.4 var(--body);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px var(--tip-edge), inset 0 0 0 2px #000, 0 10px 30px rgb(0 0 0 / 0.6);
  pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity 0.1s, transform 0.1s; display: grid; gap: 0.05rem;
}
.tooltip-box.show { opacity: 1; transform: none; }
.tooltip-box .tip-ico { position: absolute; left: calc(-2.6rem - 6px); top: 0; --ico: 2.6rem; }
.tooltip-box .name { font-weight: 500; font-size: 1rem; line-height: 1.3; }
.tooltip-box .name.q-poor { color: var(--q-poor); } .tooltip-box .name.q-common { color: var(--q-common); } .tooltip-box .name.q-uncommon { color: var(--q-uncommon); }
.tooltip-box .name.q-rare { color: var(--q-rare); } .tooltip-box .name.q-epic { color: var(--q-epic); }
.tooltip-box .title { font: 700 0.9rem/1.3 var(--ui); color: var(--gold); }
.tooltip-box .row { display: flex; justify-content: space-between; gap: 1.5rem; }
.tooltip-box .meta { color: var(--gold); font-size: 0.82rem; margin-top: 0.25rem; }
.tooltip-box .was, .tooltip-box .dim { color: #b9b9b9; font-size: 0.82rem; }
.tooltip-box .green { color: var(--q-uncommon); font-size: 0.85rem; }
.tooltip-box .key { color: var(--gold); font-size: 0.82rem; }
.tooltip-box .setname { color: var(--gold); margin-top: 0.5rem; }
.tooltip-box .setpiece { color: #808080; padding-left: 0.7rem; font-size: 0.85rem; }
.tooltip-box .setpiece.on { color: #ffff98; }
.tooltip-box .setbonus { color: #808080; font-size: 0.85rem; }
.tooltip-box .setbonus.on { color: var(--q-uncommon); }
.tooltip-box .gap { height: 0.45rem; }
.tooltip-box .c-warrior { color: #c79c6e; }

/* Item links in text */
.item { position: relative; display: inline; cursor: var(--cursor-hot); border: 0; background: none; padding: 0; font: inherit; font-weight: 500; text-align: left; }
.item:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.item.q-poor { color: var(--qi-poor); } .item.q-common { color: var(--qi-common); } .item.q-uncommon { color: var(--qi-uncommon); }
.item.q-rare { color: var(--qi-rare); } .item.q-epic { color: var(--qi-epic); }
.on-dark .item.q-poor { color: var(--q-poor); } .on-dark .item.q-common { color: var(--q-common); } .on-dark .item.q-uncommon { color: var(--q-uncommon); }
.on-dark .item.q-rare { color: var(--q-rare); } .on-dark .item.q-epic { color: var(--q-epic); }
/* in chat-style lists, links get the game's brackets */
.chatlog .item::before { content: "["; } .chatlog .item::after { content: "]"; }

/* On-screen messages: yellow text centre-top, as the game prints them */
.toast {
  position: fixed; left: 50%; top: 22vh; transform: translate(-50%, 0.4rem); z-index: 70; width: max-content; max-width: calc(100vw - 32px);
  font: 600 clamp(0.95rem, 2vw, 1.15rem)/1.35 var(--ui); color: var(--gold); text-align: center; text-wrap: balance;
  text-shadow: 0 1px 0 #000, 0 0 2px #000, 0 0 2px #000, 0 0 12px rgb(0 0 0 / 0.9);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Level-up and milestone splash */
.ding-splash { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none; }
.ding-splash::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 50% 35% at 50% 50%, rgb(0 0 0 / 0.72), transparent 75%); animation: fc-glow-scrim 2.6s ease-out both; }
@keyframes fc-glow-scrim { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.ding-splash .rays {
  position: absolute; width: min(90vw, 44rem); aspect-ratio: 1; border-radius: 50%;
  background: repeating-conic-gradient(rgb(255 220 120 / 0.22) 0 6deg, transparent 6deg 18deg);
  mask: radial-gradient(circle, #000 10%, transparent 68%); animation: fc-rays 2.6s ease-out both;
}
.ding-splash .glow { position: absolute; width: min(70vw, 30rem); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgb(255 230 140 / 0.55), transparent 65%); animation: fc-glow 2.6s ease-out both; }
.ding-splash .txt { position: relative; text-align: center; animation: fc-ding 2.6s cubic-bezier(.2,.9,.25,1) both; }
.ding-splash .ding-ico { display: block; width: 4.4rem; height: 4.4rem; margin: 0 auto 0.9rem; border-radius: 8px; object-fit: cover; object-view-box: inset(5%);
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--q-epic), 0 0 30px rgb(184 116 255 / 0.7); }
.ding-splash .big { display: block; font: 700 clamp(2.4rem, 7vw, 4.6rem)/1 var(--ui); color: var(--gold); letter-spacing: 0.04em;
  text-shadow: 0 3px 0 #5a3a00, 0 0 3px #000, 0 0 30px rgb(255 200 60 / 0.8); }
.ding-splash .small { display: block; margin-top: 0.6rem; font: 600 clamp(0.95rem, 2.2vw, 1.3rem)/1.3 var(--ui); color: #fff3c4; text-shadow: 0 1px 0 #000, 0 0 3px #000, 0 0 10px #000; }
@keyframes fc-rays { 0% { opacity: 0; transform: scale(0.4) rotate(0); } 20% { opacity: 1; } 80% { opacity: 0.8; } 100% { opacity: 0; transform: scale(1.15) rotate(40deg); } }
@keyframes fc-glow { 0% { opacity: 0; transform: scale(0.3); } 15% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes fc-ding { 0% { opacity: 0; transform: scale(1.8); filter: blur(6px); } 14% { opacity: 1; transform: scale(1); filter: none; } 78% { opacity: 1; transform: scale(1.02); } 100% { opacity: 0; transform: scale(1.04) translateY(-0.5rem); } }

/* Dialogs */
.modal-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 2rem 16px; background: radial-gradient(ellipse at 50% 40%, rgb(0 0 0 / 0.55), rgb(0 0 0 / 0.8)); animation: fc-fade-in 0.18s ease-out; }
.modal-back.out { animation: fc-fade-out 0.16s ease-in both; }
.modal { width: min(32rem, 100%); max-height: calc(100vh - 4rem); display: grid; grid-template-rows: auto minmax(0, 1fr); animation: fc-pop 0.22s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(40rem, 100%); }
.modal-body { overflow-y: auto; padding: 1.1rem 1.3rem 1.3rem; }
@keyframes fc-pop { from { transform: scale(0.94); opacity: 0; } }
.closex {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; padding: 0; font: 700 0.8rem/1 var(--body); color: #ffd9c0;
  background: radial-gradient(circle at 40% 35%, #d23a24, #5a0c06); border: 0; box-shadow: 0 0 0 1.5px #000, 0 0 0 3px var(--frame), 0 0 0 4px #000; text-shadow: 0 1px 0 #000;
}
.closex:hover { filter: brightness(1.25); }

/* Loading screen */
.loading { position: fixed; inset: 0; z-index: 100; background: #000; animation: fc-fade-in 0.3s ease-out; }
.loading canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.loading::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 40%, rgb(0 0 0 / 0.75)); pointer-events: none; }
.loading-top { position: absolute; z-index: 1; top: 12vh; left: 0; right: 0; text-align: center; display: grid; gap: 0.5rem; padding: 0 16px; }
.loading-top h1 { font-size: clamp(2rem, 6vw, 3.6rem); letter-spacing: 0.04em; text-shadow: 0 3px 0 #000, 0 0 30px rgb(0 0 0 / 0.9); }
.loading-top .label { color: #e8dcc0; text-shadow: 0 1px 0 #000; }
.loading-foot { position: absolute; z-index: 1; left: 50%; bottom: calc(3rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(44rem, calc(100% - 32px)); display: grid; gap: 1rem; }
.loading .tip { text-align: center; color: #f2e8d0; font-size: 1rem; text-shadow: 0 1px 2px #000, 0 0 8px #000; text-wrap: balance; }
.loading .tip b { color: var(--gold); font-family: var(--ui); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 0.3rem; }
.loadbar { position: relative; height: 1.15rem; border-radius: 3px; background: #050403; box-shadow: 0 0 0 1px #000, 0 0 0 4px #8a6a2a, 0 0 0 5px #000, inset 0 1px 4px #000; }
.loadbar::before, .loadbar::after { content: "◆"; position: absolute; top: 50%; transform: translateY(-50%); color: var(--gold); font-size: 1.1rem; text-shadow: 0 0 0 #000, 0 1px 0 #000; }
.loadbar::before { left: -1.4rem; } .loadbar::after { right: -1.4rem; }
.loadbar .fill { position: absolute; inset: 2px auto 2px 2px; width: 0; border-radius: 2px; background: linear-gradient(#ffe58a, #e0a820 45%, #8a5a08); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 0 12px rgb(255 200 60 / 0.5); max-width: calc(100% - 4px); }

@media (max-width: 720px) {
  :root { --hud-bottom: 5.4rem; }
  .hud-top-in { padding-block: 0.6rem 0; gap: 0.5rem; }
  .unitframe .portrait { --pt: 3.4rem; }
  .unitframe .uf-plate { width: min(11rem, 44vw); padding-left: 1rem; }
  .hud-brand { display: none; }
  .minimap .disc { width: 4.8rem; height: 4.8rem; }
  .minimap .zone { font-size: 0.62rem; }
  .minimap .when { display: none; }
  .minimap .knob { width: 1.35rem; height: 1.35rem; }
  .hud-right .sample-flag { display: none; }
  .hud-bottom-in { padding-inline: 12px; gap: 0.4rem; padding-bottom: 0.45rem; }
  .micro { width: 100%; justify-content: space-between; gap: 0.3rem; }
  .micro a { width: auto; flex: 1; height: 2.9rem; display: flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.3rem; }
  .micro a .glyph { width: 1.9rem; height: 1.9rem; flex: none; }
  .micro .key { display: none; }
  .micro .nm { display: block; position: relative; z-index: 2; }
  .tooltip-box .tip-ico { display: none; }
}
/* Stands in for a 3D character while three.js and the model load: a turning
   ring of runes like the pedestal's. .failed says the view isn't available. */
.loading3d { display: grid; place-content: center; justify-items: center; gap: 0.8rem; text-align: center;
  font: 600 0.68rem/1.3 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); text-shadow: 0 1px 2px #000; }
.loading3d::before { content: ""; width: 4.6rem; aspect-ratio: 1; border-radius: 50%;
  background: repeating-conic-gradient(rgb(255 209 0 / 0.85) 0 3deg, transparent 3deg 15deg);
  mask: radial-gradient(closest-side, transparent 70%, #000 73%, #000 90%, transparent 93%);
  filter: drop-shadow(0 0 6px #ffb340); animation: loading3d-turn 4s linear infinite; }
.loading3d span { animation: loading3d-pulse 1.6s ease-in-out infinite alternate; }
.loading3d.failed::before { display: none; }
.loading3d.failed span { animation: none; max-width: 14rem; letter-spacing: 0.08em; }
@keyframes loading3d-turn { to { transform: rotate(360deg); } }
@keyframes loading3d-pulse { from { opacity: 0.45; } to { opacity: 1; } }

@media (hover: none) { html, a, button, label { cursor: auto; } }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(root), ::view-transition-new(root) { transition: none !important; animation: none !important; }
}
