:root {
  --ink: #e6dcc6;
  --ink-dim: #a39884;
  --ink-faint: #6f6656;
  --gold: #d6b066;
  --gold-dim: #8f7440;
  --blood: #9b2a22;
  --panel: #17120e;
  --panel-2: #211a14;
  --edge: #4d3d28;
  --edge-hi: #7a613b;
  --good: #7fcf6a;
  --bad: #e0624f;
  --magic: #6f8fff;
  --rare: #f0d050;
  --epic: #b060ff;
  --common: #c8c2b4;
  --serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --caps: 'Cinzel', 'Trajan Pro', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07060a; overflow: hidden; color: var(--ink); font-family: var(--serif); font-size: 16px; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: default; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > #hud, #ui > #bhud { pointer-events: none; }
#hud > *, #bhud > * { pointer-events: auto; }
[hidden] { display: none !important; }
kbd { font-family: var(--caps); font-size: 10px; color: var(--ink-faint); border: 1px solid var(--edge); border-radius: 3px; padding: 0 3px; margin-left: 4px; }
b { color: var(--gold); font-weight: 600; }

/* ---------- panels & buttons */
.frame, .panel, .modal-box, .login-box, #chat, .tip, .ctx {
  background:
    radial-gradient(ellipse at 30% 0%, rgba(120, 90, 50, 0.10), transparent 60%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  box-shadow: inset 0 0 0 1px #0a0806, inset 0 0 24px rgba(0,0,0,0.6), 0 6px 24px rgba(0,0,0,0.7);
  border-radius: 3px;
}
.btn {
  font-family: var(--caps); font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
  color: var(--gold); background: linear-gradient(180deg, #3a2c1c, #1f170f);
  border: 1px solid var(--edge-hi); border-radius: 2px; padding: 6px 12px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.12), 0 2px 4px rgba(0,0,0,0.6);
  text-shadow: 0 1px 2px #000;
}
.btn:hover:not(:disabled) { color: #ffe3a6; border-color: var(--gold); background: linear-gradient(180deg, #4a3822, #2a1f13); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.big { font-size: 15px; padding: 9px 18px; }
.btn.small { font-size: 11px; padding: 3px 8px; }
.btn.red { color: #ffb4a8; border-color: #7a2a22; background: linear-gradient(180deg, #4a1a14, #24100c); }
.btn.green { color: #c8f0b0; border-color: #3e6a2e; background: linear-gradient(180deg, #24381a, #13200e); }
input {
  font-family: var(--serif); font-size: 17px; color: var(--ink); background: #0c0a08;
  border: 1px solid var(--edge); padding: 8px 10px; outline: none; border-radius: 2px;
}
input:focus { border-color: var(--gold-dim); box-shadow: 0 0 8px rgba(214, 176, 102, 0.25); }
.err { color: var(--bad); min-height: 20px; margin-top: 10px; font-style: italic; }
.hint { color: var(--ink-faint); font-size: 14px; font-style: italic; margin-top: 8px; }
h1, h2, h3 { font-family: var(--caps); color: var(--gold); margin: 0; font-weight: 700; text-shadow: 0 2px 6px #000; }
.rar-common { color: var(--common); } .rar-magic { color: var(--magic); } .rar-rare { color: var(--rare); } .rar-epic { color: var(--epic); }

/* ---------- login */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.25), rgba(0,0,0,0.8)); }
.login-box { width: min(760px, 94vw); padding: 34px 38px 26px; text-align: center; }
.login-box h1 { font-size: 54px; font-weight: 900; letter-spacing: 0.08em; color: #d9b36a;
  text-shadow: 0 0 18px rgba(255, 120, 40, 0.35), 0 3px 0 #2a1a0c, 0 6px 12px #000; }
.login-box .sub { font-family: var(--caps); color: var(--ink-dim); letter-spacing: 0.4em; font-size: 13px; margin: 4px 0 26px; text-transform: uppercase; }
#login-name label { display: block; font-style: italic; color: var(--ink-dim); margin-bottom: 10px; font-size: 18px; }
#login-name input { width: 280px; text-align: center; font-size: 20px; }
#login-name .btn { margin-left: 8px; vertical-align: top; }
#login-class .lbl { font-size: 19px; margin-bottom: 14px; color: var(--ink-dim); font-style: italic; }
/* the testnet badge, the wallet button, and a hero to claim or begin (js/wallet.js) */
#net-badge { display: inline-block; margin: -16px 0 20px; padding: 2px 14px; font-family: var(--caps); font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase;
  color: #9fd4ff; border: 1px solid #2e4a6a; background: rgba(20, 40, 60, 0.45); }
#wallet-go { min-width: 260px; }
#wallet-msg code { font-size: 14px; color: var(--gold); }
#wallet-other { margin-top: 12px; }
#wallet-req { margin-top: 10px; }
#wallet-req input { width: 280px; text-align: center; font-size: 16px; }
#wallet-req .btn { margin-left: 6px; vertical-align: top; }
#wallet-pick { max-width: 540px; margin: 0 auto; }
.wp-h { font-family: var(--caps); color: var(--gold); letter-spacing: 0.08em; font-size: 16px; margin-bottom: 10px; }
.wp-h2 { font-family: var(--caps); color: var(--ink-faint); letter-spacing: 0.25em; font-size: 11px; text-transform: uppercase; margin: 14px 0 6px; }
.wp-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; }
.wp-w { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--edge); background: rgba(0,0,0,0.35); color: var(--ink);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer; text-decoration: none; border-radius: 3px; transition: border-color 0.15s, background 0.15s; }
.wp-w:hover { border-color: var(--edge-hi); background: rgba(60, 40, 20, 0.35); }
#wp-found .wp-w { border-color: var(--gold-dim); }
#wp-found .wp-w:hover { border-color: var(--gold); }
.wp-w img, .wp-mono { width: 26px; height: 26px; flex: none; border-radius: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); }
.wp-mono { display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-family: var(--caps); font-weight: 700; font-size: 14px; color: #fff; background: #444; }
.wp-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-w small { flex: none; color: var(--ink-faint); font-size: 12px; font-style: italic; }
.wp-none { grid-column: 1 / -1; color: var(--ink-faint); font-style: italic; font-size: 14px; text-align: center; padding: 4px 0; }
.wp-back { margin-top: 12px; }
#login-claim .lbl { font-size: 18px; margin-bottom: 12px; color: var(--ink-dim); font-style: italic; }
.claim-row { margin: 8px 0; }
.claim-row label { display: block; font-style: italic; color: var(--ink-dim); margin-bottom: 8px; font-size: 17px; }
.claim-row input { width: 240px; text-align: center; font-size: 18px; }
.claim-row .btn { margin-left: 8px; vertical-align: top; }
.claim-or { font-family: var(--caps); color: var(--ink-faint); letter-spacing: 0.3em; font-size: 12px; margin: 14px 0 6px; text-transform: uppercase; }
#class-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.ccard { padding: 10px 8px 12px; border: 1px solid var(--edge); background: rgba(0,0,0,0.35); cursor: pointer; border-radius: 3px; transition: border-color 0.15s, background 0.15s; }
.ccard:hover { border-color: var(--edge-hi); background: rgba(60, 40, 20, 0.35); }
.ccard.on { border-color: var(--gold); background: rgba(90, 60, 25, 0.35); box-shadow: 0 0 14px rgba(214,176,102,0.25); }
.ccard canvas { display: block; margin: 0 auto 6px; width: 110px; height: 120px; }
.ccard h3 { font-size: 16px; }
.ccard p { font-size: 13.5px; color: var(--ink-dim); margin: 6px 0; line-height: 1.25; min-height: 52px; }
.ccard .st { font-size: 12px; color: var(--ink-faint); font-family: var(--caps); }
.row { display: flex; gap: 10px; justify-content: center; }

/* ---------- lobby HUD */
#me-frame { position: absolute; left: 14px; top: 14px; display: flex; gap: 12px; padding: 10px 16px 10px 10px; align-items: center; min-width: 290px; }
.portrait { border-radius: 50%; border: 2px solid var(--edge-hi); background: radial-gradient(circle at 50% 35%, #3a2e22, #0e0b08); box-shadow: 0 0 0 2px #0a0806, 0 0 10px rgba(0,0,0,0.8); }
#me-frame .nm { font-family: var(--caps); font-size: 17px; color: var(--gold); }
#me-frame .cl { font-size: 14px; color: var(--ink-dim); margin-top: -2px; }
.bar { height: 7px; background: #0b0907; border: 1px solid #000; margin-top: 5px; position: relative; overflow: hidden; }
.bar > div { height: 100%; }
.bar.xp > div { background: linear-gradient(180deg, #b58a3a, #6a4c18); }
.bar.hp > div { background: linear-gradient(180deg, #c0392b, #6e1a12); }
.bar.hp.ally > div { background: linear-gradient(180deg, #4fa04a, #22501e); }
.shards { margin-top: 5px; font-size: 15px; color: #d7c7ff; }
.shards i { font-style: normal; color: #b49cff; text-shadow: 0 0 6px #7a4cff; }
.pts { color: var(--good); font-size: 13px; font-style: italic; }

#queue-banner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); padding: 8px 18px; font-family: var(--caps); color: var(--gold); display: flex; gap: 14px; align-items: center;
  background: linear-gradient(180deg, #2a1f14, #120d09); border: 1px solid var(--edge-hi); box-shadow: 0 4px 16px #000; }
#queue-banner .dots::after { content: '…'; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

#right-col { position: absolute; right: 14px; top: 14px; width: 230px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
#party-frame { display: flex; flex-direction: column; gap: 6px; }
.pm { display: flex; gap: 8px; align-items: center; padding: 6px 8px; }
.pm .nm { font-family: var(--caps); font-size: 13px; color: var(--ink); }
.pm .sub { font-size: 12.5px; color: var(--ink-dim); }
.pm.off { opacity: 0.45; }
.pm .x { margin-left: auto; cursor: pointer; color: var(--ink-faint); padding: 0 4px; }
.pm .x:hover { color: var(--bad); }
.crown { color: #f0c040; margin-right: 3px; }
#party-frame .btn { align-self: flex-end; }

#menu-btns { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px; }

/* ---------- chat */
#chat { position: absolute; left: 14px; bottom: 14px; width: min(440px, 44vw); padding: 6px; display: flex; flex-direction: column; background: rgba(12, 9, 7, 0.72); }
#chat-log { height: 150px; overflow-y: auto; font-size: 14.5px; line-height: 1.3; padding: 2px 4px 6px; scrollbar-width: thin; scrollbar-color: #4d3d28 transparent; }
#chat-log div { text-shadow: 0 1px 2px #000; }
#chat-log .sys { color: #c9a95a; font-style: italic; }
#chat-log .party { color: #8fd0ff; }
#chat-log .log { color: #9d9384; font-size: 13.5px; }
#chat-log .log b { color: #d8cbb0; }
#chat-log .who { color: var(--gold); }
#chat-in { font-size: 14px; padding: 5px 8px; background: rgba(0,0,0,0.5); }
body.in-battle #chat { bottom: 118px; }

/* ---------- battle HUD */
#b-top { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; }
#b-title { font-family: var(--caps); color: var(--gold); font-size: 15px; letter-spacing: 0.06em; text-shadow: 0 2px 4px #000; margin-bottom: 6px; }
#b-order { display: flex; gap: 5px; justify-content: center; }
.oc { width: 52px; text-align: center; padding: 3px 2px 4px; background: rgba(12,9,7,0.8); border: 1px solid var(--edge); border-radius: 2px; position: relative; }
.oc canvas { width: 40px; height: 40px; display: block; margin: 0 auto; }
.oc.t0 { border-bottom: 2px solid #4f8fd0; } .oc.t1 { border-bottom: 2px solid #c0392b; }
.oc.cur { border-color: var(--gold); box-shadow: 0 0 10px rgba(240, 200, 100, 0.55); transform: translateY(3px); }
.oc.dead { opacity: 0.3; filter: grayscale(1); }
.oc .n { font-size: 10.5px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc .bar { height: 4px; margin-top: 2px; }

#b-bar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: flex-end;
  padding: 10px 12px; background: linear-gradient(180deg, rgba(33,26,20,0.95), rgba(14,11,8,0.97)); border: 1px solid var(--edge); box-shadow: 0 6px 24px #000; }
#b-status { width: 150px; font-size: 13.5px; color: var(--ink-dim); }
#b-status .who { font-family: var(--caps); color: var(--gold); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b-status .pips { margin-top: 3px; letter-spacing: 2px; }
.pip { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #000; background: #2a241c; margin-right: 2px; }
.pip.mv { background: radial-gradient(circle at 40% 35%, #9fd0ff, #2f6a9a); }
.pip.act { background: radial-gradient(circle at 40% 35%, #ffd98a, #a8721c); }
#b-abilities { display: flex; gap: 6px; }
.ab { width: 58px; height: 58px; position: relative; cursor: pointer; border: 1px solid var(--edge-hi); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff4dc; text-shadow: 0 0 8px rgba(255,200,120,0.6), 0 2px 2px #000;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.8), 0 2px 5px #000; user-select: none; }
.ab:hover { border-color: var(--gold); }
.ab.sel { border-color: #ffe08a; box-shadow: 0 0 12px rgba(255, 220, 120, 0.7), inset 0 0 10px rgba(0,0,0,0.6); }
.ab.off { filter: grayscale(0.85) brightness(0.55); cursor: default; }
.ab .k { position: absolute; left: 3px; top: 1px; font-size: 10px; font-family: var(--caps); color: #d8c8a8; text-shadow: 0 1px 2px #000; }
.ab .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); font-family: var(--caps); font-size: 22px; color: #fff; }
.ab .cnt { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-family: var(--caps); color: #fff; text-shadow: 0 1px 2px #000; }
.ab-sep { width: 1px; background: var(--edge); margin: 0 4px; }
#b-side { display: flex; flex-direction: column; gap: 6px; }
#b-timer { height: 5px; background: #0b0907; border: 1px solid #000; }
#b-timer > div { height: 100%; background: linear-gradient(90deg, #a8721c, #ffd98a); }
#b-end.mine { color: #fff0c8; border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 210, 120, 0.4); }
#b-flee { position: absolute; right: 14px; top: 14px; }
#turn-banner { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%); font-family: var(--caps); font-size: 44px; font-weight: 900; color: #f3d38a;
  text-shadow: 0 0 20px rgba(255, 140, 40, 0.6), 0 4px 8px #000; pointer-events: none; animation: banner 1.2s ease-out forwards; letter-spacing: 0.1em; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%) scale(1.2); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- windows */
.panel { position: absolute; padding: 16px 18px 16px; min-width: 320px; max-height: 86vh; overflow: auto; }
.panel .hd { display: flex; gap: 12px; align-items: center; margin: -4px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--edge); }
.panel .hd h2 { font-size: 20px; }
.panel .hd .t { font-size: 14px; color: var(--ink-dim); font-style: italic; }
.panel .close { margin-left: auto; align-self: flex-start; cursor: pointer; color: var(--ink-faint); font-size: 22px; line-height: 1; padding: 0 4px; }
.panel .close:hover { color: var(--bad); }
.panel .greet { font-style: italic; color: #cfc2a8; font-size: 16.5px; line-height: 1.35; margin: 0 0 14px; }
.panel .opts { display: flex; flex-direction: column; gap: 8px; }
.panel .opts .btn { text-align: left; }
.panel .note { font-size: 14px; color: var(--ink-dim); font-style: italic; margin-top: 10px; }
.panel.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.sect { font-family: var(--caps); font-size: 12.5px; color: var(--gold-dim); letter-spacing: 0.12em; text-transform: uppercase; margin: 14px 0 6px; }

.shop { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: min(860px, 92vw); }
.list { display: flex; flex-direction: column; gap: 3px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid transparent; background: rgba(0,0,0,0.25); cursor: default; }
.li:hover { border-color: var(--edge); background: rgba(60, 45, 25, 0.3); }
.li .ico { width: 26px; height: 26px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px solid var(--edge); background: #0c0a08; font-size: 15px; }
.li .nm { flex: 1; font-size: 15px; }
.li .pr { font-size: 14px; color: #d7c7ff; white-space: nowrap; }
.li .rq { font-size: 12.5px; color: var(--ink-faint); }
.li .rq.bad { color: var(--bad); }

.charwin { display: grid; grid-template-columns: 300px 210px 340px; gap: 18px; }
.doll { text-align: center; }
.doll canvas { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.slot { width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--edge); background: radial-gradient(circle at 50% 40%, #1b1611, #0a0806); cursor: pointer; margin-bottom: 6px; position: relative; }
.slot:hover { border-color: var(--edge-hi); }
.slot .sl { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.slot .sl img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0.9; pointer-events: none; }
.slot .sl i { position: relative; font-style: normal; font-family: var(--caps); font-size: 9.5px; letter-spacing: 0.06em; color: var(--ink-faint); text-shadow: 0 1px 2px #000, 0 0 4px #000; align-self: flex-end; margin-bottom: 2px; }
.slot.empty { background: radial-gradient(circle at 50% 40%, #16120e, #080605); border-style: dashed; border-color: #3a2e20; }
.stats td { padding: 2px 4px; font-size: 15px; }
.stats td:first-child { color: var(--ink-dim); }
.stats td:nth-child(2) { color: var(--ink); text-align: right; font-weight: 600; }
.plus { cursor: pointer; color: var(--good); font-family: var(--caps); font-weight: 700; padding: 0 6px; border: 1px solid #3e6a2e; background: #13200e; }
.bag { display: grid; grid-template-columns: repeat(6, 52px); gap: 4px; }
.cell { width: 52px; height: 52px; border: 1px solid #2d2418; background: radial-gradient(circle at 50% 40%, #1b1611, #0a0806); display: flex; align-items: center; justify-content: center; font-size: 21px; cursor: pointer; position: relative; }
.cell.it { border-color: var(--edge-hi); }
.cell.it:hover { box-shadow: 0 0 8px rgba(214, 176, 102, 0.5); }
.cell.common { border-color: #6b665c; } .cell.magic { border-color: #3c56b8; } .cell.rare { border-color: #a8902a; } .cell.epic { border-color: #7a3cc0; }
.cell .lock { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: var(--bad); }

.dg { padding: 10px 12px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); margin-bottom: 8px; }
.dg h3 { font-size: 16px; }
.dg p { margin: 4px 0 8px; font-size: 14.5px; color: var(--ink-dim); font-style: italic; }
.dg.locked { opacity: 0.5; }
.dg .req { font-size: 13px; color: var(--ink-faint); font-family: var(--caps); }

/* ---------- tooltip & context menu */
.tip { position: fixed; z-index: 50; padding: 9px 12px; max-width: 300px; pointer-events: none; font-size: 14.5px; line-height: 1.3; }
.tip .tn { font-family: var(--caps); font-size: 15px; font-weight: 700; }
.tip .tk { color: var(--ink-faint); font-size: 13px; font-style: italic; margin-bottom: 4px; }
.tip .ta { color: var(--magic); }
.tip .tr { color: var(--bad); }
.tip .tv { color: #d7c7ff; margin-top: 4px; font-size: 13px; }
.tip .td { color: var(--ink-dim); font-style: italic; margin-top: 4px; }
.ctx { position: fixed; z-index: 40; padding: 4px; display: flex; flex-direction: column; min-width: 150px; }
.ctx .ch { font-family: var(--caps); font-size: 13px; color: var(--gold); padding: 4px 8px 6px; border-bottom: 1px solid var(--edge); margin-bottom: 3px; }
.ctx button { background: none; border: none; color: var(--ink); text-align: left; padding: 5px 8px; font-family: var(--serif); font-size: 15px; cursor: pointer; }
.ctx button:hover { background: rgba(120, 90, 50, 0.3); color: #fff; }

/* ---------- toasts & modal */
#toasts { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 60; }
.toast { padding: 7px 16px; background: rgba(14,11,8,0.92); border: 1px solid var(--edge); font-size: 15px; box-shadow: 0 4px 12px #000; animation: toast 3.2s forwards; pointer-events: auto; }
.toast.good { border-color: #3e6a2e; color: #c8f0b0; } .toast.bad { border-color: #7a2a22; color: #ffb4a8; }
.toast .row { margin-top: 6px; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
.toast.sticky { animation: none; }
#modal:empty { display: none; }
#modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); z-index: 30; }
.modal-box { padding: 24px 30px; min-width: 360px; max-width: 560px; text-align: center; }
.modal-box h2 { font-size: 34px; letter-spacing: 0.08em; margin-bottom: 6px; }
.modal-box h2.win { color: #f3d38a; text-shadow: 0 0 18px rgba(255, 180, 60, 0.5), 0 3px 6px #000; }
.modal-box h2.lose { color: #c9564a; text-shadow: 0 0 18px rgba(200, 40, 30, 0.5), 0 3px 6px #000; }
.modal-box .flav { font-style: italic; color: var(--ink-dim); margin-bottom: 14px; }
.modal-box .rw { font-size: 17px; margin: 4px 0; }
.modal-box .loot { margin: 12px auto; display: flex; flex-direction: column; gap: 4px; align-items: stretch; max-width: 360px; }
.modal-box .row { margin-top: 18px; }
#conn { position: fixed; top: 0; left: 0; right: 0; text-align: center; padding: 6px; background: #5a1a14; color: #ffd8cc; font-family: var(--caps); z-index: 90; }

.help { width: min(620px, 92vw); font-size: 15.5px; line-height: 1.45; }
.help td { padding: 3px 10px 3px 0; vertical-align: top; }
.help td:first-child { font-family: var(--caps); color: var(--gold); white-space: nowrap; font-size: 13px; }
/* the window and its table both carry .help: the table fills the window, it does not take the window's width again */
table.help { width: 100%; }

/* ---------- item icons */
.ico-wrap { position: relative; display: inline-flex; flex: none; }
.ico-wrap img { display: block; }
.upb { position: absolute; left: -2px; top: -3px; font-family: var(--caps); font-size: 11px; font-weight: 900; color: #fff; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 6px #000; }
.up4 .upb, .steps .up4 { color: #9fe4ff; } .up7 .upb, .steps .up7 { color: #ffd84a; } .up9 .upb, .steps .up9 { color: #ff9a3a; }
.ico-wrap.up7 img { animation: shimmer 2.4s ease-in-out infinite; }
.ico-wrap.up9 img { animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 50% { filter: brightness(1.25) drop-shadow(0 0 4px rgba(255, 200, 80, 0.7)); } }
.cell.rare, .slot.rare { box-shadow: inset 0 0 10px rgba(240, 200, 60, 0.25); } .cell.epic, .slot.epic { box-shadow: inset 0 0 12px rgba(176, 96, 255, 0.35); }
.slot.full.common { border-color: #6b665c; } .slot.full.magic { border-color: #3c56b8; } .slot.full.rare { border-color: #a8902a; } .slot.full.epic { border-color: #7a3cc0; }
.li .ico-wrap { border: 1px solid var(--edge); background: #0c0a08; }
.li.on { border-color: var(--gold); background: rgba(90, 60, 25, 0.35); }
.li[data-up] { cursor: pointer; }
.embers { color: #ffb070; font-size: 14px; margin-left: 8px; white-space: nowrap; }
.embers img { vertical-align: -3px; }
.embers.short { color: var(--bad); }
.tip-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.tip-head .ico-wrap { border: 1px solid var(--edge); background: #0c0a08; }
.tip .tm { color: #efe6d2; }
.tip .tup { color: #ffd84a; font-size: 13px; margin-top: 2px; }

/* ---------- paper doll: the hero in the middle, each slot by the part it dresses (placed in ui.js) */
.paper { position: relative; margin: 0 auto; background: radial-gradient(ellipse 30% 42% at 50% 52%, rgba(214, 176, 102, 0.12), transparent 72%); }
.paper .slot { position: absolute; margin: 0; z-index: 1; }

/* ---------- merchant tabs & forge */
.tabs { display: flex; gap: 4px; margin: -4px 0 12px; border-bottom: 1px solid var(--edge); }
.tab { font-family: var(--caps); font-size: 13px; color: var(--ink-dim); padding: 6px 14px; cursor: pointer; border: 1px solid transparent; border-bottom: none; margin-bottom: -1px; }
.tab:hover { color: var(--gold); }
.tab.on { color: var(--gold); border-color: var(--edge); background: linear-gradient(180deg, #2a2016, #17120e); }
.forge { text-align: center; padding: 14px; border: 1px solid var(--edge); background: radial-gradient(circle at 50% 20%, rgba(255, 140, 40, 0.10), rgba(0,0,0,0.3) 70%); }
.forge .ico-wrap { margin: 4px auto 8px; border: 1px solid var(--edge-hi); background: #0c0a08; }
.forge h3 { font-size: 17px; margin-bottom: 4px; }
.forge .steps { font-family: var(--caps); font-size: 22px; margin: 4px 0 10px; color: var(--ink); }
.forge .cmp { font-size: 15px; color: var(--ink-dim); } .forge .cmp b { color: var(--good); }
.forge .odds { margin: 10px 0 4px; font-size: 16px; }
.forge .cost { margin-bottom: 8px; }
.forge .btn.big { margin-top: 10px; min-width: 160px; }
.forge.forging .ico-wrap { animation: forge 0.32s ease-in-out infinite; }
@keyframes forge { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(-2px, 1px) rotate(-3deg); } 60% { transform: translate(2px, -1px) rotate(3deg); } }
.forge.forge-ok .ico-wrap { animation: forgeok 0.9s ease-out; }
@keyframes forgeok { 0% { box-shadow: 0 0 0 rgba(255, 210, 90, 0); } 30% { box-shadow: 0 0 30px rgba(255, 210, 90, 0.95); transform: scale(1.15); } 100% { box-shadow: 0 0 0 rgba(255, 210, 90, 0); } }
.forge.forge-bad .ico-wrap { animation: forgebad 0.5s ease-out; }
@keyframes forgebad { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); box-shadow: 0 0 20px rgba(220, 50, 30, 0.8); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } }
.forge .res { font-family: var(--caps); font-size: 20px; margin-top: 12px; }
.forge .res.ok { color: #ffd84a; text-shadow: 0 0 12px rgba(255, 200, 60, 0.7); } .forge .res.bad { color: var(--bad); }

/* ---------- settings */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; width: min(720px, 90vw); }
.set { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 15.5px; cursor: pointer; }
.set > span { flex: 1; } .set small { display: block; font-size: 12.5px; color: var(--ink-faint); font-style: italic; }
.set em { font-style: normal; width: 40px; text-align: right; color: var(--ink-dim); font-size: 13px; }
.set input[type=range] { width: 140px; accent-color: #c8963a; }
.set select { background: #0c0a08; color: var(--ink); border: 1px solid var(--edge); font-family: var(--serif); font-size: 15px; padding: 3px 6px; }
.set.tog input { display: none; }
.set.tog i { width: 38px; height: 20px; border-radius: 10px; background: #2a221a; border: 1px solid var(--edge); position: relative; flex: none; transition: background 0.15s; }
.set.tog i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #8a7a60; transition: left 0.15s, background 0.15s; }
.set.tog input:checked + i { background: #5a4220; border-color: var(--gold-dim); }
.set.tog input:checked + i::after { left: 20px; background: var(--gold); }
#b-set { position: absolute; right: 90px; top: 14px; }

/* tier badge (Roman numeral, bottom-left of an icon) */
.tb { position: absolute; left: -2px; bottom: -3px; font-style: normal; font-family: var(--caps); font-size: 10px; font-weight: 900; padding: 0 3px; line-height: 13px; min-width: 11px; text-align: center;
  background: rgba(8,6,4,0.85); border: 1px solid currentColor; border-radius: 2px; text-shadow: 0 1px 1px #000; }
.tb.t1 { color: #b88a5a; } .tb.t2 { color: #cfd6e0; } .tb.t3 { color: #f0c850; } .tb.t4 { color: #6fe0ff; box-shadow: 0 0 6px rgba(111,224,255,0.6); } .tb.t5 { color: #ff6a2a; box-shadow: 0 0 7px rgba(255,106,42,0.75); }
.tip .ttier { font-family: var(--caps); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }

/* ---------- comparison tooltip */
.tip.cards { max-width: none; padding: 0; background: none; border: none; box-shadow: none; }
.tcards { display: flex; gap: 8px; align-items: flex-start; }
.tcard { width: 280px; padding: 10px 12px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--edge); box-shadow: inset 0 0 0 1px #0a0806, 0 6px 20px rgba(0,0,0,0.8); border-radius: 3px; }
.tcard.eq { opacity: 0.93; border-color: #3a3024; }
.tcard .eqh { font-family: var(--caps); font-size: 11px; letter-spacing: 0.12em; color: var(--ink-faint); text-transform: uppercase; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--edge); }
.tdiff { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--edge); font-size: 14px; }
.tdiff .tdh { font-family: var(--caps); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-dim); text-transform: uppercase; margin-bottom: 2px; }
.tdiff .dup { color: #7fe07a; } .tdiff .ddn { color: #ff7a6a; }
/* ---------- bounties */
.qwrap { width: min(980px, 92vw); }
.quests { max-height: 64vh; overflow-y: auto; padding-right: 6px; }
.qcols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 780px) { .qcols { grid-template-columns: 1fr; } }
.qsec { --acc: #5a4a30; --acc-hi: #d6b066; }
.qsec.daily { --acc: #3f6a8e; --acc-hi: #8fc8f0; }
.qsec.weekly { --acc: #6a4c94; --acc-hi: #c9a0ff; }
.qsec.owed { --acc: #a8842a; --acc-hi: #ffe070; margin-bottom: 14px; }
.qsh { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--edge); padding: 2px 2px 5px; margin: 2px 0 9px; }
.qst { font-family: var(--caps); font-size: 15px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--acc-hi); }
.qsc { font-size: 13.5px; color: var(--ink-dim); }
.qsc.all { color: var(--good); }
.qreset { margin-left: auto; font-size: 13px; color: var(--ink-faint); font-style: italic; white-space: nowrap; }
.qreset b { font-style: normal; font-family: var(--caps); font-size: 12px; color: var(--ink-dim); font-weight: 600; }
.quest { position: relative; padding: 7px 11px 8px 12px; margin-bottom: 7px; border: 1px solid var(--edge); border-left: 3px solid var(--acc);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.24)); }
.quest.going { border-color: #5a4a30; border-left-color: var(--acc-hi); }
.quest .qh { display: flex; align-items: center; gap: 8px; }
.quest .qh b { font-family: var(--caps); font-size: 14.5px; flex: 1; }
.quest .qn { font-family: var(--caps); font-size: 12.5px; color: var(--ink-dim); }
.quest.going .qn { color: var(--acc-hi); }
.quest .qd { font-size: 13.5px; line-height: 1.25; color: var(--ink-dim); font-style: italic; margin: 1px 0 5px; }
.quest.done { opacity: 0.6; }
.quest.done .qh b { color: var(--ink-dim); }
.quest.locked { opacity: 0.42; filter: grayscale(0.7); }
.quest.owed { border-color: #6a5a20; background: rgba(90, 70, 20, 0.25); }
.qtag { font-family: var(--caps); font-size: 11px; letter-spacing: 0.05em; padding: 0 6px; border: 1px solid var(--edge); border-radius: 2px; color: var(--ink-faint); white-space: nowrap; }
.qtag.ok { color: #a8e890; border-color: #3e6a2e; background: rgba(60, 120, 40, 0.2); }
.qtag.daily { color: #8fc8f0; border-color: #3f6a8e; }
.qtag.weekly { color: #c9a0ff; border-color: #6a4c94; }
.qbar { height: 6px; background: #0b0907; border: 1px solid #000; margin: 0 0 6px; }
.qbar > div { height: 100%; background: linear-gradient(180deg, var(--acc-hi), var(--acc)); box-shadow: 0 0 6px rgba(255, 255, 255, 0.08); }
.qbar.claim > div { background: linear-gradient(180deg, #a8e890, #3e6a2e); }
.qr { display: flex; flex-wrap: wrap; gap: 4px 5px; }
.rw { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; font-size: 13px; white-space: nowrap; color: var(--ink);
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 10px; }
.rw img { display: block; }
.rw.xp { color: #bfe2ff; } .rw.xp small { font-family: var(--caps); font-size: 10px; }
.rw.sh i { color: var(--gold); font-style: normal; }
.rw.ins { color: #ffe08a; }
.rw.it { font-family: var(--caps); font-size: 11.5px; }
.rw.rar-legendary { border-color: rgba(255, 138, 26, 0.45); }
.ri { vertical-align: -3px; }
.gold { color: var(--gold); }
#quest-tracker { padding: 8px 10px; cursor: pointer; background: rgba(12, 9, 7, 0.72); border: 1px solid var(--edge); }
#quest-tracker:hover { border-color: var(--edge-hi); }
.qt-h { display: flex; align-items: center; font-family: var(--caps); font-size: 12px; color: var(--gold-dim); letter-spacing: 0.1em; margin-bottom: 5px; }
.qt-h .qt-c { margin-left: auto; font-size: 11px; letter-spacing: 0.04em; color: var(--ink-faint); }
.qt { margin-bottom: 5px; }
.qt-n { display: flex; gap: 6px; font-size: 14px; color: var(--ink); }
.qt-n span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-n em { font-style: normal; font-family: var(--caps); font-size: 11.5px; color: var(--ink-dim); align-self: center; }
.qt-b { height: 3px; margin-top: 2px; background: #0b0907; }
.qt-b > div { height: 100%; background: #8fc8f0; }
.qt-b.weekly > div { background: #c9a0ff; }
.qt.owed { font-size: 13.5px; color: #ffe070; }
.qt-p { font-size: 12.5px; color: var(--ink-dim); }
.toast.quest { animation-duration: 6s; max-width: min(620px, 92vw); text-align: center; color: var(--ink);
  border-color: #8a7030; background: linear-gradient(180deg, rgba(44, 33, 14, 0.97), rgba(16, 12, 8, 0.97)); }
.toast.quest .qr { justify-content: center; margin-top: 5px; }
.qdone-h { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15.5px; color: var(--ink); }
.qdone-h b { font-family: var(--caps); }
.qheld { margin-top: 5px; font-size: 13.5px; font-style: italic; color: #ffe070; }
.qlog { color: #ffe08a; }
.buff { margin-top: 4px; font-size: 13px; color: #ffe08a; } .buff img { vertical-align: -3px; }
.modal-box .boost { color: #ffe08a; font-size: 14px; }

/* ---------- stat help */
.stats tr.hov { cursor: help; }
.stats tr.hov:hover td { color: var(--gold); }
.tip.wide { max-width: 380px; }
.tip .you { margin-top: 6px; color: #9fd4ff; font-size: 14px; }
.tip .fit { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--edge); }
.tip .fitrow { display: grid; grid-template-columns: 62px 44px 1fr; gap: 6px; font-size: 13px; color: var(--ink-dim); align-items: baseline; }
.tip .fitrow.me { color: var(--ink); }
.tip .fitrow.me .fc { color: var(--gold); }
.tip .fc { font-family: var(--caps); font-size: 11.5px; }
.tip .stars { color: #f0c040; letter-spacing: 1px; } .tip .stars i { color: #3a3226; font-style: normal; }

/* ---------- "better than what you wear" */
.better { position: absolute; right: -4px; top: -5px; width: 16px; height: 16px; pointer-events: none; z-index: 2;
  filter: drop-shadow(0 0 3px rgba(90, 255, 120, 0.75)); animation: better 1.6s ease-in-out infinite; }
.better svg { display: block; }
@keyframes better { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.tip .tbetter { color: #62f07e; font-family: var(--caps); font-size: 12px; font-weight: 700; margin-bottom: 2px; }

/* ---------- skill tree */
.treebar { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.treebar .sp { font-family: var(--caps); font-size: 15px; color: var(--ink-dim); padding: 4px 10px; border: 1px solid var(--edge); }
.treebar .sp.has { color: #62f07e; border-color: #2e6a3a; box-shadow: 0 0 10px rgba(90, 240, 120, 0.25); }
.treebar .btn { margin-left: auto; }
.tree { display: grid; grid-template-columns: repeat(5, 150px); gap: 12px; }
.branch { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border: 1px solid var(--edge); background: rgba(0,0,0,0.28); }
.branch.passive { border-color: #5a4a2a; background: rgba(60, 45, 20, 0.2); }
.branch .bh { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 10px; text-align: center; }
.branch .bh b { font-family: var(--caps); font-size: 13px; }
.branch .bh small { color: var(--ink-faint); font-size: 12px; }
.bico { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff4dc; border: 1px solid var(--edge-hi); border-radius: 3px;
  font-family: 'Segoe UI Symbol', sans-serif; text-shadow: 0 0 8px rgba(255, 200, 120, 0.6), 0 2px 2px #000; }
.node { width: 128px; padding: 6px 6px; text-align: center; border: 1px solid #2d2418; background: #0e0b08; border-radius: 3px; cursor: default; position: relative; }
.node .nr { display: block; font-family: var(--caps); font-size: 11px; color: var(--ink-faint); }
.node .nn { display: block; font-size: 13.5px; color: var(--ink-faint); line-height: 1.15; }
.node.got { border-color: var(--gold); background: linear-gradient(180deg, #3a2c16, #1a130a); }
.node.got .nn { color: var(--gold); } .node.got .nr { color: #e8c878; }
.node.can { border-color: #3e9a52; cursor: pointer; animation: canlearn 1.6s ease-in-out infinite; }
.node.can .nn { color: #b8f0c0; } .node.can:hover { background: #13200e; }
@keyframes canlearn { 50% { box-shadow: 0 0 12px rgba(90, 240, 120, 0.45); } }
.node.next .nn { color: var(--ink-dim); }
.node.far { opacity: 0.55; }
.link { width: 2px; height: 12px; background: #3a2e20; }
.tip .was { color: var(--ink-faint); font-size: 12.5px; }
.rkt { font-family: var(--caps); font-size: 11px; color: #e8c878; border: 1px solid #6a5420; padding: 0 4px; border-radius: 2px; vertical-align: 2px; }
.ab .rk { position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font-size: 8px; color: #ffd84a; letter-spacing: 1px; text-shadow: 0 1px 1px #000; font-family: sans-serif; }

/* ---------- heroes */
.ccard .hero-tag { font-family: var(--caps); font-size: 12px; color: var(--ink-faint); margin-top: 6px; min-height: 16px; }
.ccard.has .hero-tag { color: var(--gold); }
.ccard.has { border-color: var(--edge-hi); }
#me-frame .swap { position: absolute; right: 6px; top: 6px; font-size: 10px; padding: 2px 6px; }
/* ---------- chapters */
.chps { display: flex; gap: 5px; margin: 2px 0 8px; }
.chp { font-family: var(--caps); font-size: 12px; padding: 3px 9px; border: 1px solid var(--edge); background: #0e0b08; cursor: pointer; color: var(--ink-dim); }
.chp.done { color: var(--gold); border-color: #6a5420; }
.chp.open { color: #b8f0c0; border-color: #3e9a52; }
.chp.shut { opacity: 0.45; cursor: default; }
.chp.on { box-shadow: 0 0 0 1px var(--gold), 0 0 10px rgba(214, 176, 102, 0.35); background: #2a2016; }
.modal-box .rw.opened { color: #62f07e; font-family: var(--caps); }

/* action cost dots on ability buttons */
.ab .apc { position: absolute; right: 3px; top: 1px; font-size: 8px; color: #8fd0ff; letter-spacing: 1px; text-shadow: 0 1px 1px #000; font-family: sans-serif; z-index: 2; }

/* ============================================================ the Ashen Tankard update */
.list, .scroll, .panel, .quests, .skins, .modal-box.result { scrollbar-width: thin; scrollbar-color: #4d3d28 transparent; }
.rar-legendary { color: #ff8a1a; text-shadow: 0 0 6px rgba(255, 120, 20, 0.45); }
.cell.legendary, .slot.full.legendary { border-color: #c8641a; box-shadow: inset 0 0 12px rgba(255, 130, 30, 0.4); animation: legpulse 2.6s ease-in-out infinite; }
@keyframes legpulse { 50% { box-shadow: inset 0 0 14px rgba(255, 150, 40, 0.55), 0 0 9px rgba(255, 130, 30, 0.55); border-color: #ff9a3a; } }
.tip .tleg { color: #ffb060; margin-top: 4px; font-style: italic; }

/* HUD */
#me-frame .res { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; margin-top: 5px; }
#me-frame .res .shards { margin-top: 0; }
#me-frame .res .embers { margin-left: 0; }
.keys { color: #c8c2b4; font-size: 14px; white-space: nowrap; }
.keys.ob { color: #d8a8ff; }
.keys img, .ri { vertical-align: -3px; }
#me-frame .skn { color: #ffb060; }
#emotes { position: absolute; left: 14px; bottom: 206px; display: flex; gap: 4px; }
#emotes .btn { font-size: 10.5px; padding: 2px 7px; opacity: 0.85; }
#emotes .btn:hover { opacity: 1; }
body.in-battle #emotes { display: none; }
#chat-log .whisper { color: #e8a0ff; }

/* ability icons */
.abimg { display: block; border-radius: 2px; }
.abglyph { display: flex; align-items: center; justify-content: center; color: #fff4dc; border-radius: 3px; font-family: 'Segoe UI Symbol', sans-serif;
  text-shadow: 0 0 8px rgba(255, 200, 120, 0.6), 0 2px 2px #000; }
.ab { overflow: hidden; background: #0c0907; }
.ab > .abimg, .ab > .abglyph { position: absolute; inset: 0; width: 100%; height: 100%; }
.ab .k, .ab .rk, .ab .cd, .ab .cnt { z-index: 2; }
.ab .vk { position: absolute; left: 3px; bottom: 1px; z-index: 2; font-family: var(--caps); font-size: 9px; color: #9fe4ff; text-shadow: 0 1px 2px #000; }
.ab.ult { border-color: #d8a830; box-shadow: 0 0 10px rgba(255, 190, 60, 0.35), inset 0 0 12px rgba(0,0,0,0.8); }
.ab.pot { background: radial-gradient(circle at 40% 35%, #4a1a14, #0c0907); }
.ab.pot img { display: block; }
#b-status { flex: none; min-width: 0; width: 160px; }
#b-side { flex: none; width: 128px; }
/* a narrow window: the fight's bar (six abilities and four draughts: about 990px) stays on the screen, its slots
   wrap, and the chat sits above its two rows */
@media (max-width: 1010px) {
  #b-bar { left: 8px; right: 8px; margin: 0 auto; width: fit-content; max-width: calc(100% - 16px); transform: none; }
  #b-abilities { flex-wrap: wrap; justify-content: center; row-gap: 6px; min-width: 0; }
  body.in-battle #chat { bottom: 166px; }
}
#b-end { white-space: nowrap; }
.heroic-tag { font-size: 11px; color: #d8a8ff; border: 1px solid #7a4ab0; padding: 0 5px; margin-left: 4px; text-shadow: 0 0 6px #7a30ff; }
.oc.boss { border-color: #b0782a; }
.oc.champ .n { color: #ffb060; }

/* merchants */
.chk { font-family: var(--serif); font-size: 12.5px; color: var(--ink-faint); text-transform: none; letter-spacing: 0; margin-left: 10px; cursor: pointer; }
.chk input { vertical-align: -2px; }
.sect .btn { margin-left: 8px; vertical-align: 1px; text-transform: none; letter-spacing: 0; }
.salvage { width: min(620px, 88vw); }
.li .pr.embers { margin-left: 0; }
.bag { grid-auto-rows: 52px; align-content: start; }
.bag.wide { grid-template-columns: repeat(8, 52px); }
.charwin { grid-template-columns: 400px 220px 440px; }
.panel.charp { max-width: calc(100vw - 12px); }
@media (max-width: 1180px) { .charwin { grid-template-columns: 400px 220px; } .charwin .bagcol { grid-column: 1 / -1; } }
@media (max-width: 720px) { .charwin { grid-template-columns: 444px; } }
/* the pouch under the bags: four draughts, embers, two keys, the elixir and its Use: nine cells, as wide as the bags (444px) */
.pouch { display: grid; grid-template-columns: repeat(9, 46px); grid-auto-rows: 46px; gap: 3.75px; }
.pouch .cell { width: 46px; height: 46px; }
.pouch .pc { cursor: default; border-color: #3a2e20; }
.pouch .pc img { pointer-events: none; }
.pouch .pc .n { position: absolute; right: 3px; bottom: 0; font-family: var(--caps); font-size: 12px; font-weight: 900; color: #f6ecd6; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 5px #000; }
.pouch .pc.pot { border-color: #6a2a24; } .pouch .pc.mat { border-color: #7a4216; } .pouch .pc.key { border-color: #4a4452; } .pouch .pc.con { border-color: #7a6424; }
.pouch .pc:hover { box-shadow: 0 0 8px rgba(214, 176, 102, 0.45); }
.pouch .pc.none img { opacity: 0.3; filter: grayscale(0.85); }
.pouch .pc.none .n { color: var(--ink-faint); }
.pouch .use { align-self: center; justify-self: start; }
#me-frame .res.pots { margin-top: 2px; }
.pot { color: #f0b4a4; font-size: 14px; white-space: nowrap; }
.pot img { vertical-align: -3px; }
.pot.none { opacity: 0.45; }
.extras { font-size: 13px; color: #ffb060; margin-top: 6px; }
.minibar { display: flex; gap: 4px; }
.minibar .abimg, .minibar .abglyph { border: 1px solid var(--edge-hi); }

/* the Warden */
.warden { width: min(860px, 92vw); }
.keybar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; padding: 6px 10px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); margin-bottom: 10px; }
.keybar b { color: var(--ink); }
.keybar .btn:first-of-type { margin-left: auto; }
.dgwrap { display: grid; grid-template-columns: 290px 1fr; gap: 12px; }
.dglist { max-height: 54vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.dgl { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; padding: 5px 9px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); cursor: pointer; }
.dgl:hover { border-color: var(--edge-hi); }
.dgl.on { border-color: var(--gold); background: rgba(90, 60, 25, 0.35); }
.dgl.shut { opacity: 0.55; }
.dgl .dn { font-family: var(--caps); font-size: 13px; color: var(--gold); }
.dgl .dl { font-size: 12px; color: var(--ink-faint); text-align: right; }
.dgl .dp { grid-column: 1 / 3; font-size: 10px; letter-spacing: 3px; color: #d8b048; }
.dgd { padding: 12px 14px; border: 1px solid var(--edge); background: radial-gradient(ellipse at 50% 0%, rgba(120, 90, 40, 0.14), rgba(0,0,0,0.35) 70%); }
.dgd.heroic { border-color: #6a3aa0; background: radial-gradient(ellipse at 50% 0%, rgba(140, 60, 220, 0.2), rgba(0,0,0,0.4) 70%); }
.dgd h3 { font-size: 19px; margin-bottom: 4px; }
.dgd .flav { font-style: italic; color: var(--ink-dim); font-size: 15px; margin: 0 0 8px; }
.dgmeta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-dim); margin-bottom: 8px; }
.hz-lava { color: #ff8a3a; } .hz-bog { color: #a0c060; } .hz-void { color: #c080ff; } .hz-frost { color: #9fe0ff; }
.dgd .mode { display: flex; gap: 4px; margin: 6px 0 8px; }
.dgd .mode .tab { border: 1px solid var(--edge); margin: 0; }
.dgd .req { font-size: 13px; color: var(--ink-faint); font-family: var(--caps); margin-bottom: 10px; }
.dgd .descend { width: 100%; }
.dgd.heroic .descend:not(:disabled) { color: #f0d0ff; border-color: #9a5ad0; background: linear-gradient(180deg, #3a1a5a, #1a0c2a); box-shadow: 0 0 14px rgba(160, 80, 255, 0.35); }

/* Ismene's vault */
.vault { display: grid; grid-template-columns: 290px 468px; gap: 18px; }
.vault .bag { grid-template-columns: repeat(8, 52px); }
.vscroll { max-height: 30vh; overflow-y: auto; overflow-x: hidden; padding-right: 6px; }

/* the bar, the bard, the dice */
.curdrink { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid #6a5420; background: rgba(90, 70, 20, 0.2); margin-bottom: 10px; font-size: 15px; }
.rumour { margin-top: 12px; font-style: italic; color: #cfc2a8; border-left: 2px solid var(--edge-hi); padding-left: 10px; }
.songs { display: flex; flex-direction: column; gap: 6px; width: min(460px, 86vw); }
.song { padding: 8px 12px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); cursor: pointer; font-size: 14.5px; color: var(--ink-dim); }
.song b { font-family: var(--caps); color: var(--gold); font-size: 14px; }
.song:hover { border-color: var(--edge-hi); }
.song.on { border-color: var(--gold); background: rgba(90, 60, 25, 0.35); }
.dice { text-align: center; }
.dice-res { min-height: 110px; padding: 10px; border: 1px solid var(--edge); background: radial-gradient(ellipse at 50% 30%, rgba(40, 80, 30, 0.35), rgba(0,0,0,0.4)); margin-bottom: 10px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 28px; }
.dice-res.win { border-color: #3e9a52; }
.dice-res.lose { border-color: #7a2a22; }
.dpair { display: flex; flex-direction: column; align-items: center; }
.dpair span { font-family: var(--caps); font-size: 12px; color: var(--ink-faint); }
.dpair b { font-size: 46px; line-height: 1; color: #f4ecd8; font-weight: 400; text-shadow: 0 2px 4px #000; letter-spacing: 2px; }
.dpair em { font-style: normal; font-family: var(--caps); color: var(--ink-dim); }
.dmsg { width: 100%; font-family: var(--caps); font-size: 18px; color: var(--gold); }
.dice-res.win .dmsg { color: #8aff8a; } .dice-res.lose .dmsg { color: #ff8a7a; }
.dice-res.rolling { animation: shake 0.12s linear infinite; }
@keyframes shake { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-2px, 1px) rotate(-0.6deg); } 50% { transform: translate(2px, -1px) rotate(0.6deg); } 75% { transform: translate(-1px, -1px); } }
.betrow { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 10px; }
.betrow label { font-family: var(--caps); font-size: 13px; color: var(--ink-dim); }
.betrow input { width: 110px; font-size: 16px; padding: 4px 6px; text-align: center; }
.dlog { margin-top: 8px; font-family: var(--caps); font-size: 12px; }
.dlog .w { color: #8aff8a; } .dlog .l { color: #ff8a7a; }

/* Vesna's looks */
.skins { display: grid; grid-template-columns: repeat(4, 172px); gap: 10px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.skin { border: 1px solid var(--edge); background: radial-gradient(ellipse at 50% 30%, rgba(90, 70, 40, 0.3), rgba(0,0,0,0.45)); padding: 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.skin canvas { width: 120px; height: 140px; }
.skin.on { border-color: var(--gold); box-shadow: 0 0 14px rgba(214, 176, 102, 0.35); }
.skin.locked canvas { filter: grayscale(0.7) brightness(0.55); }
.skin .sn { font-family: var(--caps); font-size: 13.5px; color: var(--gold); }
.skin .sb { font-size: 12.5px; color: #ffb060; min-height: 16px; }
.skin .sd { font-size: 12.5px; color: var(--ink-faint); font-style: italic; line-height: 1.2; min-height: 45px; }
.skin .wearing { font-family: var(--caps); font-size: 12px; color: #8aff8a; }
.skin .lk { font-family: var(--caps); font-size: 12px; color: var(--ink-faint); }

/* hall of fame */
.fame { width: min(520px, 88vw); display: flex; flex-direction: column; gap: 3px; }
.fr { display: flex; align-items: center; gap: 10px; padding: 4px 10px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); }
.fr.me { border-color: var(--gold); background: rgba(90, 60, 25, 0.35); }
.fr .fk { width: 26px; text-align: center; font-family: var(--caps); color: var(--gold); }
.fr .fn { font-family: var(--caps); font-size: 14px; color: var(--ink); flex: 1; }
.fr .fc { font-size: 13px; color: var(--ink-faint); }
.fr .fv { font-family: var(--caps); color: var(--gold); min-width: 56px; text-align: right; }

/* skill window: the class tree */
.panel.skills { max-height: 95vh; padding: 12px 16px 14px; }
.panel.skills .hd { margin-bottom: 8px; padding-bottom: 6px; }
.sktop { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.spbox { display: flex; gap: 8px; align-items: center; padding: 4px 12px 4px 10px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); min-width: 170px; }
.spbox > b { font-family: var(--caps); font-size: 28px; color: var(--ink-dim); line-height: 1; }
.spbox span { display: flex; flex-direction: column; font-family: var(--caps); font-size: 12px; color: var(--ink-dim); line-height: 1.2; }
.spbox small { font-family: var(--serif); font-size: 12px; color: var(--ink-faint); }
.spbox.has { border-color: #2e6a3a; box-shadow: 0 0 12px rgba(90, 240, 120, 0.22); }
.spbox.has > b, .spbox.has span { color: #7af08e; }
.barwrap { display: flex; flex-direction: column; align-items: center; margin: 0 auto; }
.barlbl { font-family: var(--caps); font-size: 10.5px; letter-spacing: 0.12em; color: var(--gold-dim); text-transform: uppercase; margin-bottom: 3px; }
.barlbl small { text-transform: none; letter-spacing: 0; font-family: var(--serif); color: var(--ink-faint); font-size: 11.5px; }
.loadbar { display: flex; gap: 5px; }
.lslot { width: 48px; height: 48px; border: 1px solid var(--edge); background: radial-gradient(circle at 50% 40%, #1b1611, #0a0806); position: relative; cursor: pointer; }
.lslot.full { border-color: var(--edge-hi); }
.lslot .abimg, .lslot .abglyph { position: absolute; left: 1px; top: 1px; width: 44px; height: 44px; }
.lslot .lk { position: absolute; left: 2px; top: 0; z-index: 2; font-family: var(--caps); font-size: 10px; color: #d8c8a8; text-shadow: 0 1px 2px #000; }
.lslot.full:hover { border-color: var(--bad); }
.lslot.drop { border-color: #7af08e; box-shadow: 0 0 10px rgba(120, 240, 140, 0.5); }
.skmain { display: flex; gap: 14px; align-items: stretch; }
.tree { display: flex; flex-direction: column; gap: 8px; }
.tcore { display: flex; align-items: center; gap: 14px; padding: 7px 12px 5px; border: 1px solid #4a3c28; background: linear-gradient(180deg, rgba(90, 70, 40, 0.18), rgba(0,0,0,0.3)); }
.tch { display: flex; flex-direction: column; width: 170px; }
.tch b { font-family: var(--caps); color: var(--gold); font-size: 14px; letter-spacing: 0.08em; }
.tch small { font-size: 12px; color: var(--ink-faint); font-style: italic; line-height: 1.2; }
.tcn { display: flex; gap: 14px; }
.tcn .tnode { position: relative; }
.tbody { display: flex; gap: 8px; }
.tgut { display: flex; flex-direction: column; width: 34px; padding-top: 55px; }
.tgut .tgh { display: none; }
.tgl { height: var(--row, 64px); display: flex; flex-direction: column; align-items: center; justify-content: center; border-top: 1px dashed rgba(122, 97, 59, 0.25); font-family: var(--caps); color: var(--ink-faint); }
.tgl b { font-size: 13px; color: #5d5446; font-weight: 700; }
.tgl.on b { color: var(--gold-dim); }
.tgl small { font-size: 9.5px; font-family: var(--serif); white-space: nowrap; }
.tbr { width: 200px; border: 1px solid color-mix(in srgb, var(--bc) 35%, #2a2016); background:
  radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--bc) 14%, transparent), transparent 70%),
  repeating-linear-gradient(180deg, rgba(0,0,0,0.26) 0 var(--row, 64px), rgba(255,255,255,0.018) var(--row, 64px) calc(2 * var(--row, 64px))); }
.tbh { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid color-mix(in srgb, var(--bc) 40%, #2a2016); background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 22%, transparent), transparent); cursor: default; }
.tbh b { font-family: var(--caps); color: var(--bc); font-size: 14px; letter-spacing: 0.06em; text-shadow: 0 1px 3px #000; }
.eltag { font-family: var(--caps); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; border: 1px solid currentColor; padding: 0 3px; border-radius: 2px; }
.tbp { margin-left: auto; min-width: 24px; text-align: center; font-family: var(--caps); font-size: 12px; color: var(--ink-faint); border: 1px solid #3a2e20; border-radius: 9px; padding: 0 6px; background: #0e0b08; }
.tbp.has { color: #111; background: var(--bc, var(--gold)); border-color: transparent; font-weight: 700; }
.tgrid { position: relative; }
.tlines { position: absolute; left: 0; top: 0; pointer-events: none; }
.tlines line { stroke: #3a3024; stroke-width: 2.5; stroke-linecap: round; }
.tlines line.open { stroke: var(--bc); stroke-opacity: 0.4; stroke-dasharray: 4 4; }
.tlines line.got { stroke: var(--bc); stroke-opacity: 0.9; stroke-width: 3.5; filter: drop-shadow(0 0 3px var(--bc)); }
.tnode { position: absolute; width: 46px; cursor: pointer; }
.tnode .tic { width: 46px; height: 46px; position: relative; border-radius: 3px; box-shadow: 0 0 0 1px #000, 0 2px 6px rgba(0,0,0,0.7); transition: transform 0.1s, box-shadow 0.15s; }
.tnode .tic .abimg, .tnode .tic .abglyph { display: block; width: 46px; height: 46px; border-radius: inherit; }
.tnode.passive .tic { border-radius: 50%; }
.tnode:hover .tic { transform: translateY(-1px); box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--edge-hi), 0 3px 8px #000; }
.tnode.locked .tic .abimg { filter: grayscale(1) brightness(0.38) contrast(0.9); }
.tnode.open .tic .abimg { filter: grayscale(0.6) brightness(0.62); }
.tnode.avail .tic { box-shadow: 0 0 0 1px #000, 0 0 0 2px #3e9a52, 0 0 12px rgba(98, 240, 126, 0.55); animation: canlearn 1.6s ease-in-out infinite; }
.tnode.learned .tic { box-shadow: 0 0 0 1px #000, 0 0 0 2px color-mix(in srgb, var(--bc, var(--gold)) 80%, #000), 0 0 8px color-mix(in srgb, var(--bc, var(--gold)) 45%, transparent); }
.tnode.maxed .tic { box-shadow: 0 0 0 1px #000, 0 0 0 2px #e8c060, 0 0 12px rgba(240, 200, 90, 0.6); }
.tnode.ult.learned .tic, .tnode.ult.maxed .tic { box-shadow: 0 0 0 1px #000, 0 0 0 2px #ffd24a, 0 0 16px rgba(255, 190, 60, 0.75); }
.tnode.sel .tic { outline: 2px solid #fff4d0; outline-offset: 2px; }
.tpips { display: flex; justify-content: center; gap: 2px; margin-top: 3px; }
.tpips i { width: 7px; height: 7px; transform: rotate(45deg) scale(0.8); background: #1a140e; border: 1px solid #4a3c28; }
.tpips i.on { background: linear-gradient(135deg, #ffe89a, #c8901c); border-color: #3a2808; box-shadow: 0 0 4px rgba(255, 200, 80, 0.6); }
.tnode.maxed .tpips i.on { background: linear-gradient(135deg, #fff6c8, #ffb020); }
.tnum { display: block; text-align: center; font-family: var(--caps); font-size: 11px; color: #e8c060; margin-top: 1px; line-height: 1; text-shadow: 0 1px 2px #000; }
.tnum i { font-style: normal; color: var(--ink-faint); font-size: 10px; }
.tnode.locked .tnum, .tnode.open .tnum { color: var(--ink-faint); }
.tplus { position: absolute; right: -7px; top: -7px; width: 19px; height: 19px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #8af0a0, #2e8a44); border: 1px solid #0c2a14; color: #062010;
  font: 900 15px/17px var(--caps); text-align: center; box-shadow: 0 0 8px rgba(98, 240, 126, 0.8); z-index: 3; }
.tplus:hover { transform: scale(1.15); background: radial-gradient(circle at 40% 35%, #c8ffd0, #3ab456); }
.tslot { position: absolute; left: -5px; top: -6px; min-width: 15px; height: 15px; border-radius: 3px; background: #1e3448; border: 1px solid #6aa8d8; color: #cfe8ff; font: 700 10px/13px var(--caps); text-align: center; z-index: 3; }
.tnode.innate .tic::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 6px; height: 6px; border-radius: 50%; background: #9fd4ff; box-shadow: 0 0 4px #9fd4ff; }
.skside { width: 330px; padding: 10px 12px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); max-height: calc(8 * var(--row, 62px) + 110px); overflow-y: auto; }
.skside h3 { font-size: 16.5px; }
.skside .td { font-style: italic; color: var(--ink-dim); font-size: 14px; margin: 6px 0 4px; line-height: 1.3; }
.skside .tk { font-size: 12.5px; color: var(--ink-faint); }
.skside .sect { margin: 10px 0 5px; }
.skside .lrn { justify-content: flex-start; margin-top: 8px; }
.skside .why { font-size: 13px; color: #d88a70; font-style: italic; }
.skside .mastered { font-family: var(--caps); color: #e8c060; font-size: 13px; }
.skside .barrow { justify-content: flex-start; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.skside .onbar { font-family: var(--caps); font-size: 12px; color: #8fd0ff; }
.skside .howto { margin: 8px 0; font-size: 13px; color: var(--ink-dim); line-height: 1.35; display: flex; flex-direction: column; gap: 4px; }
.skside .plusk { color: #7af08e; }
.bsum { margin-top: 8px; padding: 6px 8px; border-left: 3px solid var(--bc); background: rgba(0,0,0,0.25); font-size: 13px; color: var(--ink-dim); }
.bsum b { font-family: var(--caps); color: var(--bc); }
.bsum .tbp { float: right; }
.rlv { display: flex; flex-wrap: wrap; gap: 4px; }
.rl { font-family: var(--caps); font-size: 11px; padding: 1px 5px; border: 1px solid #3a2e20; color: var(--ink-faint); background: #0e0b08; }
.rl.got { color: #1a1206; background: #e8c060; border-color: transparent; }
.skhead { display: flex; gap: 12px; align-items: flex-start; }
.skhead h3 { font-size: 17px; }
.skhead .vn, .tip .vn { color: #9fe4ff; font-size: 13px; }
.skside .ult { font-size: 9px; color: #ffd24a; border: 1px solid #8a6a20; padding: 0 3px; vertical-align: 2px; }
.sklines { margin-top: 6px; font-size: 13.5px; color: #efe6d2; line-height: 1.35; }
.sklines .tal, .tip .tal { color: #c8b490; font-style: italic; }
.tip .lvq { color: var(--ink-faint); font-size: 12px; }
.ranks { display: flex; align-items: center; }
.rnode { width: 48px; text-align: center; padding: 3px 0; border: 1px solid #2d2418; background: #0e0b08; border-radius: 3px; }
.rnode span { display: block; font-family: var(--caps); font-size: 13px; color: var(--ink-faint); }
.rnode small { display: block; font-size: 10.5px; color: var(--ink-faint); }
.rnode.got { border-color: var(--gold); background: linear-gradient(180deg, #3a2c16, #1a130a); }
.rnode.got span { color: var(--gold); }
.rnode.can { border-color: #3e9a52; cursor: pointer; animation: canlearn 1.6s ease-in-out infinite; }
.rnode.can span { color: #b8f0c0; }
.rnode.far { opacity: 0.5; }
.rlink { width: 8px; height: 2px; background: #3a2e20; }
.vcards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vcard { padding: 7px 9px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); font-size: 12.5px; color: var(--ink-dim); cursor: pointer; position: relative; padding-bottom: 22px; line-height: 1.25; }
.vcard b { display: block; font-family: var(--caps); color: #9fe4ff; font-size: 12.5px; margin-bottom: 3px; }
.vcard:hover { border-color: var(--edge-hi); }
.vcard.on { border-color: #4a9ac8; background: rgba(40, 80, 110, 0.3); box-shadow: 0 0 10px rgba(100, 180, 255, 0.25); }
.vcard.dim { opacity: 0.55; cursor: default; }
.vcard .vsel, .vcard .vpick { position: absolute; right: 8px; bottom: 5px; font-family: var(--caps); font-size: 11px; }
.vcard .vsel { color: #8fe0ff; }
.vcard .vpick { color: var(--ink-faint); }
/* specialisations: the strip under each branch, the tier-4 choice, the closed tiers */
.specpill { font-family: var(--caps); font-style: normal; font-size: 11.5px; color: #111; background: var(--bc, var(--gold)); padding: 0 6px; border-radius: 8px; letter-spacing: 0.04em; }
.specpill.none { background: none; color: #ffb070; border: 1px dashed #8a5a2a; }
.specask { margin: -4px 0 8px; padding: 6px 10px; border: 1px solid #3e6a2e; background: linear-gradient(90deg, rgba(60, 120, 50, 0.22), rgba(0,0,0,0.2)); color: #d8f0c8; font-size: 13.5px; }
.tspec { font-family: var(--caps); font-size: 9.5px; letter-spacing: 0.08em; color: #111; background: var(--bc); padding: 0 4px; border-radius: 2px; box-shadow: 0 0 8px var(--bc); }
.tstrip { height: 24px; display: flex; align-items: center; gap: 5px; padding: 0 8px; font-size: 12px; color: var(--ink-faint); border-bottom: 1px solid color-mix(in srgb, var(--bc) 25%, #1e1810); background: rgba(0,0,0,0.25); white-space: nowrap; overflow: hidden; }
.tstrip.choose { justify-content: space-between; cursor: pointer; }
.tstrip.choose .btn { padding: 1px 8px; font-size: 11px; }
.tstrip.choose span { color: color-mix(in srgb, var(--bc) 70%, #fff); font-family: var(--caps); font-size: 11px; }
.tstrip.mine { cursor: pointer; color: #efe6d2; background: linear-gradient(90deg, color-mix(in srgb, var(--bc) 30%, transparent), rgba(0,0,0,0.2)); }
.tstrip.mine i { font-style: normal; color: var(--bc); text-shadow: 0 0 6px var(--bc); }
.tstrip.mine b { font-family: var(--caps); font-size: 12px; color: var(--bc); }
.tstrip.mine span { font-family: var(--caps); font-size: 12px; color: #ffe8a0; }
.tstrip.mine small { margin-left: auto; font-size: 11px; color: var(--ink-faint); }
.tstrip.mine.sel, .tstrip.mine:hover { box-shadow: inset 0 0 0 1px var(--bc); }
.tstrip.side { font-style: italic; }
.tstrip.side.open { color: var(--ink-dim); }
.tbr.side { filter: saturate(0.75); }
.tbr.mine { box-shadow: 0 0 14px color-mix(in srgb, var(--bc) 35%, transparent); border-color: color-mix(in srgb, var(--bc) 70%, #2a2016); }
.tree.nospec .tbr.free:hover { box-shadow: 0 0 12px color-mix(in srgb, var(--bc) 40%, transparent); }
.tshut { position: absolute; left: 0; right: 0; z-index: 4; display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(8, 6, 4, 0.72) 0 8px, rgba(20, 16, 12, 0.72) 8px 16px); border-top: 1px dashed color-mix(in srgb, var(--bc) 45%, #3a2e20); }
.tshut span { font-family: var(--caps); font-size: 10px; white-space: nowrap; letter-spacing: 0.06em; color: color-mix(in srgb, var(--bc) 60%, #bbb); background: rgba(0,0,0,0.75); padding: 2px 7px; border: 1px solid #3a2e20; transform: rotate(-4deg); }
.tor { position: absolute; width: 26px; height: 18px; z-index: 2; border-radius: 9px; background: #0e0b08; border: 1px solid color-mix(in srgb, var(--bc) 55%, #3a2e20); color: color-mix(in srgb, var(--bc) 75%, #fff);
  font: 700 10.5px/16px var(--caps); text-align: center; letter-spacing: 0.06em; cursor: help; }
.tnode.nochoice .tic::before { content: '✕'; position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; font-size: 26px; color: rgba(255, 110, 90, 0.55); }
.tgl.deep b, .tgl.deep small { opacity: 0.8; }
.skside .role { color: #cdb88a; font-style: italic; }
.skside .choicek { color: #e8c878; margin: 4px 0; }
.speccard { margin: 8px 0; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--bc) 45%, #2a2016); border-left: 3px solid var(--bc); background: linear-gradient(90deg, color-mix(in srgb, var(--bc) 12%, transparent), rgba(0,0,0,0.3)); font-size: 12.5px; color: var(--ink-dim); line-height: 1.3; }
.speccard .sch { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.speccard .sch b { font-family: var(--caps); color: var(--bc); font-size: 14px; letter-spacing: 0.05em; }
.speccard .scs { margin-top: 4px; color: #efe6d2; cursor: help; }
.speccard .scs b, .speccard .scu b { color: var(--bc); font-weight: 400; font-family: var(--caps); font-size: 12px; }
.speccard .scu { margin-top: 2px; color: var(--ink-faint); }
.sigbox { margin: 8px 0; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--bc) 60%, #2a2016); background: linear-gradient(90deg, color-mix(in srgb, var(--bc) 18%, transparent), rgba(0,0,0,0.3)); font-size: 13px; color: #efe6d2; line-height: 1.35; cursor: pointer; }
.sigbox b { font-family: var(--caps); color: var(--bc); font-weight: 400; }
.sigbox small { color: var(--ink-faint); font-size: 12px; }
.sigicon { display: inline-block; width: 22px; text-align: center; color: var(--bc, var(--gold)); font-size: 18px; text-shadow: 0 0 8px var(--bc, var(--gold)); }
.skhead .sigicon { width: 60px; height: 60px; line-height: 60px; font-size: 40px; border: 1px solid color-mix(in srgb, var(--bc) 60%, #000); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--bc) 25%, #0e0b08), #0e0b08); }
.ranks.r10 { gap: 3px; flex-wrap: wrap; }
.ranks.r10 .rnode { width: 27px; padding: 2px 0; }
.ranks.r10 .rnode span { font-size: 12px; }
.ranks.r10 .rnode small { font-size: 9.5px; }
.rnode.deep { border-style: dashed; }
.rnode.deep.got { border-style: solid; }
.rnode.spec { opacity: 0.35; background: repeating-linear-gradient(135deg, #0e0b08 0 4px, #1a140e 4px 8px); }
.note.arenarule { border-left: 3px solid #d8a84a; padding-left: 8px; color: #efe0bc; }
@media (max-height: 830px) {
  .panel.skills { padding: 8px 14px 10px; }
  .panel.skills .hd { margin-bottom: 4px; padding-bottom: 4px; }
  .sktop { margin-bottom: 6px; }
  .tcore { padding: 4px 12px 3px; }
  .tbh { height: 26px; }
  .tstrip { height: 22px; }
  .tgut { padding-top: 49px; }
  .specask { margin: -2px 0 5px; padding: 3px 8px; font-size: 12.5px; }
  .skside { max-height: 540px; }
}

/* results: doors, shrines, the damage meter */
.modal-box.result { max-width: 680px; max-height: 92vh; overflow-y: auto; }
.bstats { margin: 10px auto 4px; border-collapse: collapse; font-size: 14px; }
.bstats th { font-family: var(--caps); font-size: 11px; color: var(--ink-faint); font-weight: 400; padding: 2px 10px; }
.bstats td { padding: 2px 10px; text-align: right; color: var(--ink-dim); }
.bstats td:first-child { text-align: left; color: var(--ink); }
.bstats tr.me td:first-child { color: var(--gold); }
.bstats td.top { color: #ffd84a; }
.doors { display: flex; gap: 10px; justify-content: center; }
.door { flex: 1; max-width: 230px; display: flex; flex-direction: column; gap: 3px; padding: 12px 12px 10px; cursor: pointer; text-align: center; font-family: var(--serif);
  color: var(--ink-dim); font-size: 13.5px; border: 1px solid var(--edge-hi); background: linear-gradient(180deg, #2a2016, #120d09); border-radius: 40px 40px 3px 3px; }
.door b { font-family: var(--caps); font-size: 15px; color: var(--gold); }
.door:hover:not(:disabled) { border-color: var(--gold); box-shadow: 0 0 14px rgba(214, 176, 102, 0.35); }
.door:disabled { opacity: 0.55; cursor: default; }
.door.elite { border-color: #8a2a22; background: linear-gradient(180deg, #3a1410, #140806); } .door.elite b { color: #ff9a8a; }
.door.treasure { border-color: #a8902a; background: linear-gradient(180deg, #3a2e10, #141006); } .door.treasure b { color: #ffe070; }
.door.boss { border-color: #7a4ab0; background: linear-gradient(180deg, #2a1440, #0e0816); } .door.boss b { color: #d8a8ff; }
.shrine { margin-top: 6px; }
.blessings { display: flex; gap: 8px; justify-content: center; }
.bless { flex: 1; max-width: 190px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; cursor: pointer; font-family: var(--serif); font-size: 12.5px; color: var(--ink-dim);
  border: 1px solid #5a6a8a; background: radial-gradient(ellipse at 50% 20%, rgba(120, 160, 255, 0.18), rgba(0,0,0,0.4)); }
.bless b { font-family: var(--caps); color: #cfe0ff; font-size: 13px; }
.bless:hover { border-color: #9fc0ff; box-shadow: 0 0 12px rgba(140, 180, 255, 0.35); }
.shrine-done { color: #cfe0ff; font-style: italic; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0; }

/* picking many items: batch sell, break, store; locked items */
.cell.picked { outline: 2px solid #62f07e; outline-offset: -2px; box-shadow: inset 0 0 14px rgba(98, 240, 126, 0.35); }
.cell.picked::after { content: '✔'; position: absolute; left: 3px; top: 1px; font-size: 12px; color: #62f07e; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.list .li.picked { background: rgba(98, 240, 126, 0.1); box-shadow: inset 3px 0 0 #62f07e; }
.list .li.locked { opacity: 0.8; }
.lk-b { position: absolute; right: 2px; bottom: 2px; line-height: 0; filter: drop-shadow(0 0 2px #000); }
.list .li .lk-b { position: static; margin: 0 4px 0 -8px; align-self: flex-start; }
.pickbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; padding: 6px; border: 1px solid #2d2418; background: rgba(10, 8, 6, 0.55); }
.pickbar.on { border-color: rgba(98, 240, 126, 0.55); }
.pickbar .btn.on { border-color: #62f07e; color: #b6ffc4; }
.pickbar kbd, .note.keys kbd { font-size: 10px; padding: 0 3px; margin-left: 2px; opacity: 0.8; }
.pickbar .pickgo { margin-left: auto; display: flex; gap: 5px; }
.note.keys { font-size: 12.5px; margin-top: 4px; }

/* ---------------------------------------------------------------- the party: frame, window, board */
#party-frame .ph { display: flex; justify-content: space-between; align-items: center; font-family: var(--caps); font-size: 11.5px; letter-spacing: 0.1em; color: var(--gold-dim); text-transform: uppercase; padding: 0 2px; }
.lfgtag { font-size: 10.5px; color: #e8d090; border: 1px solid #6a5420; padding: 0 5px; letter-spacing: 0.04em; text-transform: none; font-family: var(--serif); font-style: italic; }
.pm .pmi { min-width: 0; flex: 1; }
.pm .where { font-size: 11.5px; color: var(--ink-faint); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm .pa { display: flex; flex-direction: column; align-self: flex-start; }
.pm .x.up:hover { color: #f0c040; }
.rdy { margin-left: 5px; font-size: 13px; }
.rdy.ok { color: var(--good); } .rdy.no { color: var(--bad); } .rdy.wait { color: var(--ink-faint); }
#party-frame .prow { display: flex; gap: 4px; justify-content: flex-end; }
#party-frame .prow .btn { align-self: auto; }
.pwin { width: min(720px, 90vw); }
.pwin .pw-inv { display: flex; gap: 6px; margin-bottom: 8px; }
.pwin .pw-inv input { flex: 1; font-size: 15px; padding: 5px 8px; }
.pwl { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.lfgform { padding: 4px 10px 10px; border: 1px solid var(--edge); background: rgba(0,0,0,0.25); }
.lfgform .sect { margin-top: 6px; }
.lfrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.lfrow select, .lfrow input { background: #0c0a08; color: var(--ink); border: 1px solid var(--edge); font-family: var(--serif); font-size: 15px; padding: 4px 6px; }
.lfrow #lf-note { flex: 1; min-width: 200px; }
.lfrow .lvl { font-size: 14px; color: var(--ink-dim); }
.lfrow .lvl input { width: 56px; margin: 0 2px; }
.lfrow .chk { font-size: 14px; color: var(--ink-dim); display: flex; align-items: center; gap: 4px; cursor: pointer; }
.lfg { display: flex; gap: 10px; align-items: center; padding: 7px 9px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); }
.lfg.mine { border-color: #6a5420; background: rgba(90, 60, 25, 0.25); }
.lfg.k-duo { box-shadow: inset 3px 0 0 #c89a40; }
.lfg.k-dungeon { box-shadow: inset 3px 0 0 #8a5a4a; }
.lfg.k-arena { box-shadow: inset 3px 0 0 #b04a3a; }
.lfg .lb { flex: 1; min-width: 0; }
.lfg .lt { font-family: var(--caps); font-size: 14px; color: var(--gold); }
.lfg .lw { font-size: 13px; color: var(--ink-dim); }
.lfg .ln { font-size: 14px; font-style: italic; color: var(--ink); margin-top: 2px; }
.lfg .lr { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.lfg .tag { font-family: var(--caps); font-size: 11px; color: var(--gold); }
.seats { display: flex; gap: 3px; }
.seats i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #6a5420; background: #0e0b08; }
.seats i.on { background: radial-gradient(circle at 40% 35%, #f0d080, #a07020); border-color: #c89a40; }
.who { display: flex; gap: 9px; align-items: center; padding: 5px 8px; border: 1px solid var(--edge); background: rgba(0,0,0,0.25); }
.who.me { border-color: #6a5420; }
.who.off { opacity: 0.5; }
.who .wb { flex: 1; min-width: 0; }
.who .wn { font-family: var(--caps); font-size: 14px; color: var(--ink); }
.who .wn i { font-family: var(--serif); color: var(--ink-faint); font-size: 13px; }
.who .ws { font-size: 13px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pw-party { display: flex; flex-direction: column; gap: 5px; }

/* the Warden: the tomb above the ladder */
.dgl.duo { border-color: #8a6a28; background: linear-gradient(90deg, rgba(120, 80, 20, 0.35), rgba(30, 40, 70, 0.35)); }
.dgl.duo .dn { color: #ffe0a0; }
.dgl.duo.on { border-color: #ffd070; box-shadow: 0 0 10px rgba(255, 200, 100, 0.3); }
.dgsep { font-family: var(--caps); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin: 4px 2px 0; }
.dgd.duo { border-color: #8a6a28; background: radial-gradient(ellipse at 30% 0%, rgba(200, 150, 50, 0.18), rgba(0,0,0,0.35) 55%), radial-gradient(ellipse at 80% 100%, rgba(90, 130, 200, 0.16), transparent 60%); }
.duorules { margin: 4px 0 10px; padding-left: 18px; font-size: 14px; color: var(--ink-dim); line-height: 1.3; }
.duorules li { margin-bottom: 4px; }
.duorules b { color: #f0d090; }

/* in a fight: your companions on the left */
#b-party { position: absolute; left: 12px; top: 90px; width: 210px; display: flex; flex-direction: column; gap: 5px; }
.bpm { display: flex; gap: 7px; align-items: center; padding: 5px 7px; background: rgba(12,9,7,0.85); border: 1px solid var(--edge); cursor: pointer; }
.bpm:hover { border-color: var(--edge-hi); }
.bpm.cur { border-color: var(--gold); box-shadow: 0 0 10px rgba(240, 200, 100, 0.45); }
.bpm.bonded { box-shadow: inset 0 0 0 1px rgba(140, 200, 255, 0.45); }
.bpm.dead { opacity: 0.7; }
.bpm.dead img { filter: grayscale(1) brightness(0.6); }
.bpm img { border-radius: 50%; border: 1px solid var(--edge-hi); }
.bpm .bpi { flex: 1; min-width: 0; }
.bpm .bpn { font-family: var(--caps); font-size: 12.5px; color: #9fd4ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bpm .bpn i { font-family: var(--serif); color: var(--ink-faint); }
.bpm .bd { color: #9fd4ff; }
.bpm .bar { margin-top: 3px; height: 6px; }
.bpm .bar .sh { position: absolute; left: 0; top: 0; height: 2px; background: rgba(160, 200, 255, 0.9); }
.bpm .bps { font-size: 11.5px; color: var(--ink-dim); display: flex; justify-content: space-between; gap: 4px; margin-top: 1px; }
.bpm.dead .bps { color: #b8ffc8; font-style: italic; }
.bpm .mk i { font-style: normal; font-size: 11px; margin-left: 1px; }
#b-status .bond { color: #9fd4ff; font-family: var(--caps); font-size: 12px; }
@media (max-width: 900px) { #b-party { top: 120px; width: 170px; } }

/* a word from the keepers (the admin panel) */
.toast.announce { border-color: var(--gold); background: linear-gradient(180deg, rgba(58, 40, 20, 0.96), rgba(20, 14, 9, 0.96)); color: var(--ink); font-size: 17px; text-align: center; max-width: min(640px, 92vw); cursor: pointer; box-shadow: 0 0 18px rgba(214, 176, 102, 0.35), 0 4px 12px #000; }
.toast.announce .ah { font-family: var(--caps); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 3px; }

/* ---------- the Exchange (M): Ismene's market */
.mkwin { width: min(940px, 94vw); }
.mkwin .bad { color: var(--bad); }
.panel.mkpanel .tabs .tab i { font-style: normal; color: var(--ink-faint); font-family: var(--serif); }
.mkf { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.mkf select, .mkf input { background: #0c0a08; color: var(--ink); border: 1px solid var(--edge); font-family: var(--serif); font-size: 14.5px; padding: 4px 6px; }
.mkf #mk-text { flex: 1; min-width: 110px; }
.mkf .mklv { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--ink-dim); white-space: nowrap; }
.mkf .mklv input { width: 46px; text-align: center; }
.mkl { max-height: 46vh; }
.mkr { min-height: 50px; }
.mkr .nm { min-width: 0; }
.mkr .mks { width: 128px; flex: none; font-size: 13.5px; color: var(--ink-dim); text-align: right; line-height: 1.2; }
.mkr .mks .mkby { font-family: var(--caps); font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkr .pr { width: 104px; flex: none; text-align: right; font-size: 15px; }
.mkr .btn { min-width: 74px; }
.mkr.expired { background: rgba(60, 20, 14, 0.25); }
.mkr.expired .ico-wrap { filter: grayscale(0.6) brightness(0.8); }
.mkp { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 8px; font-size: 14px; color: var(--ink-dim); }
.mkhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14.5px; color: var(--ink-dim); }
.mksellw { display: grid; grid-template-columns: auto 1fr; gap: 20px; }
.mksellw .bag { grid-template-columns: repeat(8, 52px); }
.mksell { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; text-align: center; border: 1px solid var(--edge); background: radial-gradient(circle at 50% 15%, rgba(180, 156, 255, 0.08), rgba(0,0,0,0.3) 70%); }
.mksell .ico-wrap { border: 1px solid var(--edge-hi); background: #0c0a08; }
.mksell h3 { font-size: 17px; }
.mksell .rq { font-size: 13.5px; color: var(--ink-faint); }
.mkprice { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-family: var(--caps); font-size: 13px; color: var(--gold-dim); letter-spacing: 0.06em; }
.mkprice i { font-style: normal; color: #b49cff; text-shadow: 0 0 6px #7a4cff; }
.mkprice input { width: 160px; font-size: 19px; text-align: right; padding: 5px 8px; }
.mkcut { margin: 2px 0 4px; }
.mkcut td { font-size: 14px; }
.mkcut td:nth-child(2) { color: #d7c7ff; }
.mkwhy { min-height: 18px; color: var(--bad); font-size: 13.5px; font-style: italic; }
.cell.mksel { outline: 2px solid var(--gold); outline-offset: -2px; box-shadow: 0 0 12px rgba(214, 176, 102, 0.65), inset 0 0 12px rgba(214, 176, 102, 0.3); }
.mkn .mkc { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #b49cff; text-shadow: 0 0 8px #7a4cff; border: 1px solid var(--edge); background: #0c0a08; }
@media (max-width: 900px) { .mksellw { grid-template-columns: 1fr; } .mkr .mks { width: 96px; } .mkr .pr { width: 80px; } }
/* its top edge stays put: centred, the window moved with every tab and every pick
   (a double click in the bags then landed on the item below). It sits where its
   tallest page (30 rows) would be centred, and at least 6vh from the top. */
.panel.center.mkpanel { top: max(6vh, calc(50vh - 340px)); transform: translateX(-50%); }
/* toasts stack over the top of it: while it is open they let the mouse through to the
   rows under them (the toasts with buttons are sticky and keep theirs) */
body:has(.mkpanel) .toast:not(.sticky) { pointer-events: none; }
/* a question box (flee, sell, buy …) is answered by clicking through any plain toast stacked over it */
body:has(#modal:not(:empty)) .toast:not(.sticky) { pointer-events: none; }
.mkprice input:disabled { opacity: 0.45; cursor: not-allowed; }
/* the form keeps the height of a priced item, so listing one does not pull the window's
   bottom edge up from under the pointer (a double click's second half could fall into the town) */
.mksell { min-height: 356px; justify-content: center; }
/* eight buttons in the bottom bar: below 1400 px they close up, below 1320 px they drop
   their key hints, and the bar never runs under the chat box (it wraps first) */
#menu-btns { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - min(440px, 44vw) - 44px); }
@media (max-width: 1400px) { #menu-btns { gap: 5px; } #menu-btns .btn { padding: 6px 9px; } }
@media (max-width: 1320px) { #menu-btns kbd { display: none; } }
@media (max-width: 1120px) { #menu-btns { gap: 4px; } #menu-btns .btn { padding: 6px 7px; } }

/* a newer version of the game is running: offer a refresh (main.js 'build') */
#update { position: fixed; top: 0; left: 0; right: 0; text-align: center; padding: 8px 12px; background: #4a3a12; color: #ffe9b0; font-family: var(--caps); z-index: 95; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
#update[hidden] { display: none; }
#update .btn { margin-left: 10px; vertical-align: middle; }

/* ---------- the endgame: mail (N), deeds and titles (Y), paragon */
/* the title a hero wears, and a paragon level after the level */
#me-frame .mttl { font-size: 13px; font-style: italic; color: #e0bc6a; margin: -3px 0 1px; }
.para { font-family: var(--caps); font-weight: 700; color: #ffd27a; text-shadow: 0 0 6px rgba(255, 190, 80, 0.55); }
#me-frame .bar.xp.para > div { background: linear-gradient(180deg, #ffe08a, #b8862a); }
.panel .hd .hdttl { font-family: var(--serif); font-size: 15px; color: #e0bc6a; margin-left: 6px; letter-spacing: 0; }
.tip .ttl-tip { font-style: italic; color: #e0bc6a; margin-top: -2px; }
.mailed { color: #e0bc6a; }

/* the Mail button's badge: how many letters wait; it glows while some are new */
#menu-btns .mailbtn { position: relative; }
.mbadge { position: absolute; top: -8px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #5a4630; color: #f4e2b0;
  font: 700 11px/18px var(--serif); text-align: center; border: 1px solid #0b0806; box-shadow: 0 1px 3px #000; pointer-events: none; }
.mbadge.new { background: #b0361f; color: #fff; animation: mbadge 1.6s ease-in-out infinite; }
.mbadge[hidden] { display: none; }
@keyframes mbadge { 50% { box-shadow: 0 0 10px 2px rgba(255, 110, 70, 0.75), 0 1px 3px #000; } }

/* the mail window */
.mlpanel .mlhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-dim); margin: -2px 0 8px; }
.mlpanel .mlhead .bad, .mlr .bad { color: var(--bad); }
.mll { width: min(620px, 90vw); max-height: min(56vh, 520px); overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.mlr .mls { width: 170px; font-size: 13.5px; color: var(--ink-dim); text-align: right; }
.mlr.fresh { border-color: rgba(224, 188, 106, 0.5); background: rgba(90, 64, 25, 0.32); }

/* the deeds window */
.achwin { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; width: min(990px, 94vw); }
.achmain { min-width: 0; }
.achpanel .tabs { flex-wrap: wrap; gap: 2px; }
.achpanel .tabs .tab { padding: 6px 9px; font-size: 12.5px; }
.achpanel .tabs .tab i { font-style: normal; font-family: var(--serif); color: var(--ink-faint); margin-left: 2px; }
.achl { max-height: min(60vh, 560px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.ach { display: flex; gap: 10px; padding: 7px 10px; border: 1px solid #2c2318; background: rgba(0, 0, 0, 0.28); opacity: 0.88; }
.ach.done { border-color: #6a5430; background: linear-gradient(90deg, rgba(90, 64, 25, 0.38), rgba(0, 0, 0, 0.25)); opacity: 1; }
.achg { width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--ink-faint);
  border: 1px solid var(--edge); background: radial-gradient(circle at 40% 30%, #2a2016, #0c0a08); border-radius: 50%; }
.ach.done .achg { color: #ffd98a; border-color: var(--gold); text-shadow: 0 0 8px rgba(255, 200, 100, 0.7); box-shadow: 0 0 10px rgba(214, 176, 102, 0.3); }
.ach.rare.done .achg { color: #ffb070; border-color: #ff9a40; }
.achb { flex: 1; min-width: 0; }
.achh { display: flex; align-items: center; gap: 8px; font-size: 15.5px; }
.achh b { font-family: var(--caps); font-size: 14px; color: var(--ink); }
.ach.done .achh b { color: var(--gold); }
.achr { font-family: var(--caps); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: #ffb070; border: 1px solid #7a4a1a; padding: 0 4px; }
.achp { margin-left: auto; font-family: var(--caps); font-size: 13px; color: #ffd98a; min-width: 30px; text-align: right; }
.achp::after { content: ' pts'; font-family: var(--serif); font-size: 11px; color: var(--ink-faint); }
.achd { font-size: 14px; color: var(--ink-dim); }
.achbar { height: 6px; background: #0b0907; border: 1px solid #000; margin: 4px 0 2px; }
.achbar > div { height: 100%; background: linear-gradient(180deg, #d6b066, #7a5a26); }
.achc, .achw { font-size: 12.5px; color: var(--ink-faint); }
.achw { color: var(--good); }
.acht { font-size: 12.5px; color: var(--ink-faint); }
.acht i { color: #e0bc6a; }
.achon { font-family: var(--caps); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--good); margin-left: 4px; }
.achside { border-left: 1px solid var(--edge); padding-left: 14px; min-width: 0; }
.achside .sect:first-of-type { margin-top: 10px; }
.achme { text-align: center; padding: 8px 6px 10px; border: 1px solid var(--edge); background: rgba(0, 0, 0, 0.3); }
.achme .nm { font-family: var(--caps); font-size: 17px; color: var(--gold); }
.achme .mttl { font-style: italic; color: #e0bc6a; font-size: 15px; }
.achme .none { color: var(--ink-faint); font-size: 13px; }
.ttls { display: flex; flex-wrap: wrap; gap: 4px; }
.ttl { font-family: var(--serif); font-size: 13px; font-style: italic; color: #e0bc6a; background: #1d160f; border: 1px solid var(--edge); padding: 2px 8px; border-radius: 10px; cursor: pointer; }
.ttl:hover { border-color: var(--gold); color: #ffe3a6; }
.ttl.on { border-color: var(--gold); background: linear-gradient(180deg, #4a3822, #2a1f13); color: #ffe3a6; box-shadow: 0 0 6px rgba(214, 176, 102, 0.4); }
.ttl.off { color: var(--ink-faint); border-style: dashed; cursor: help; opacity: 0.7; }
.qtag.achtag { background: #6a4a1a; color: #ffe0a0; }
@media (max-width: 860px) { .achwin { grid-template-columns: 1fr; } .achside { border-left: none; padding-left: 0; } }

/* the Hall of Fame: more lists, and a title under each name */
.famep .tabs { flex-wrap: wrap; width: min(560px, 88vw); }
.fr .fn .ftl { display: block; font-family: var(--serif); font-size: 12.5px; font-style: italic; color: #e0bc6a; margin-top: -2px; letter-spacing: 0; }
/* ---------- the social layer: guild chat and tags, the player menu, friends, inspect, reports (social.js) */
#chat-log .guild { color: #7fe0a8; }
#chat-log .guild.sys { font-style: italic; color: #5fbf88; }
.gtag { font-family: var(--caps); color: #7fe0a8; letter-spacing: 0.04em; }
.ctx .cxsep { height: 1px; background: var(--edge); margin: 3px 4px; }
.ctx button.cxbad { color: #ffb4a8; }
.frdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: #3a3128; border: 1px solid #5a4c3a; }
.frdot.on { background: radial-gradient(circle at 40% 35%, #b6ffb0, #3e9a2e); border-color: #6ad05a; box-shadow: 0 0 5px rgba(106, 208, 90, 0.6); }
.frcap { font-family: var(--serif); text-transform: none; letter-spacing: 0; color: var(--ink-faint); }
.who .x { cursor: pointer; color: var(--ink-faint); padding: 0 4px; font-size: 15px; }
.who .x:hover { color: var(--bad); }
.who .frx { width: 34px; text-align: center; font-size: 20px; color: var(--ink-faint); }
.who.ign { opacity: 0.75; }
.pwl > .sect:first-child { margin-top: 2px; }
/* the inspect window: the paper doll, then what it makes of the hero */
.inspwin { display: grid; grid-template-columns: 400px 270px; gap: 18px; }
.inspwin .icol .sect:first-child { margin-top: 0; }
.panel.inspect .hd h2 .gtag { font-size: 17px; }
.ititle { font-family: var(--caps); font-size: 12.5px; color: #e8c878; letter-spacing: 0.06em; }
.iguild { font-size: 15px; }
.iguild .none { color: var(--ink-faint); font-style: italic; }
.ipct { color: var(--ink-faint); font-weight: 400; }
@media (max-width: 760px) { .inspwin { grid-template-columns: 400px; } }
/* the report box */
.modal-box.report .rpn { font-size: 14.5px; color: var(--ink-dim); font-style: italic; margin-bottom: 10px; }
.modal-box.report input { width: 100%; font-size: 16px; padding: 6px 8px; }
/* the guild window (G) */
.gwin { width: min(760px, 92vw); }
.gbanner { width: 56px; height: 64px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--caps); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; color: #dff8e8;
  background: linear-gradient(180deg, #2e6a48, #173a26); border: 1px solid #5fbf88; clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%); text-shadow: 0 1px 2px #000; padding-bottom: 8px; }
.gbanner.none { background: linear-gradient(180deg, #3a2c1c, #1f170f); border-color: var(--edge-hi); color: var(--gold); font-size: 22px; }
.ginv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; margin-bottom: 6px; border: 1px solid #5fbf88; background: rgba(40, 90, 60, 0.18); font-size: 15px; }
.gfound { display: grid; grid-template-columns: 1fr 120px; gap: 8px 12px; align-items: end; }
.gfound label { display: flex; flex-direction: column; gap: 3px; font-family: var(--caps); font-size: 11.5px; color: var(--gold-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.gfound input { font-size: 16px; padding: 5px 8px; text-transform: none; letter-spacing: 0; }
.gfound #gd-tag { text-transform: uppercase; }
.gfound .gprev, .gfound .lfrow { grid-column: 1 / -1; }
.gprev { display: flex; align-items: baseline; gap: 14px; padding: 8px 10px; background: rgba(0, 0, 0, 0.35); border: 1px dashed var(--edge); min-height: 38px; }
.gplate { font-weight: 600; font-size: 15px; color: #e6dcc6; text-shadow: 0 0 3px #000, 0 1px 2px #000; }
.gpn { font-family: var(--caps); color: var(--gold); font-size: 14px; }
.gwhy { font-size: 14px; color: var(--bad); font-style: italic; }
.gros { max-height: 52vh; }
.gros .who .btn { flex: none; }
.grank { font-family: var(--caps); font-size: 11px; letter-spacing: 0.06em; padding: 1px 6px; margin-right: 4px; border: 1px solid var(--edge); color: var(--ink-dim); vertical-align: 1px; }
.grank.r-leader { color: #f0c040; border-color: #8a6a20; background: rgba(120, 90, 20, 0.25); }
.grank.r-officer { color: #9fd4ff; border-color: #3c6a8a; background: rgba(40, 80, 120, 0.2); }
.gwin .pw-inv { display: flex; gap: 6px; margin-bottom: 8px; }
.gwin .pw-inv input { flex: 1; font-size: 15px; padding: 5px 8px; }
/* the chat's speaker names are spans of class "who", like the party window's rows: inline, not boxed */
#chat-log span.who { display: inline; padding: 0; border: 0; background: none; }

/* ================================================================ phones and tablets (touch.js)
   Everything here hangs off html.touch, which touch.js sets on a device whose main pointer is
   a finger (or at the first touch): a mouse never sees any of it. Bigger targets, room for the
   notch, the chat folded behind a button, buttons for the keys, and on a phone (narrower than
   700 px, or lower than 500 px) windows that fill the screen and scroll inside. */
html.touch {
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --kb: 0px;
}
/* no page zoom, no pull to refresh, no text picked up by a long press; the canvas takes every gesture */
html.touch, html.touch body { overscroll-behavior: none; touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; }
html.touch body { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
html.touch canvas#game { touch-action: none; }
html.touch input, html.touch textarea { -webkit-user-select: text; user-select: text; }
/* Safari zooms into a text box whose letters are smaller than 16 px */
html.touch input:not([type=checkbox]):not([type=range]), html.touch select, html.touch textarea { font-size: max(16px, 1em); }
html.touch [draggable="true"] { -webkit-user-drag: none; }
#tsafe { position: fixed; left: 0; top: 0; width: 0; height: env(safe-area-inset-top, 0px); visibility: hidden; pointer-events: none; }
html.touch .panel, html.touch .list, html.touch .scroll, html.touch .quests, html.touch #chat-log, html.touch .modal-box { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* targets a finger can hit (about 40 px) */
html.touch .btn { min-height: 40px; }
html.touch .btn.small { min-height: 38px; padding: 6px 10px; font-size: 12px; }
html.touch .tab { padding: 10px 13px; }
html.touch .panel .close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; margin: -10px -10px -6px auto; font-size: 26px; }
html.touch .ctx button { min-height: 42px; font-size: 16px; }
html.touch .plus { display: inline-block; min-width: 36px; padding: 6px 8px; text-align: center; }
html.touch .chp { padding: 8px 12px; }
html.touch .dgl { padding: 8px 10px; }
html.touch .pm .x, html.touch .who .x { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; }
html.touch .tplus::before { content: ''; position: absolute; inset: -10px; }
html.touch .chk input, html.touch .lfrow .chk input { width: 20px; height: 20px; }
html.touch .lfrow select, html.touch .mkf select, html.touch .set select { min-height: 40px; }
html.touch .song, html.touch .vcard, html.touch .ttl { min-height: 40px; }
html.touch #emotes .btn { min-height: 36px; font-size: 11px; padding: 4px 9px; }
/* key hints: a finger has no keys */
html.touch #menu-btns kbd, html.touch #b-end kbd, html.touch .pickbar kbd, html.touch #party-frame kbd, html.touch .qt-h kbd { display: none; }
html.touch .note.keys { display: none; }
/* a plain toast lets the finger through to what is under it */
html.touch .toast:not(.sticky) { pointer-events: none; }
html.touch #toasts { top: calc(70px + var(--sat)); max-width: calc(100vw - 16px); }

/* tooltips: never wider than the screen (touch.js places them over the finger and shrinks a tall
   one); a finger goes through them (#ui > * would catch it: a tall one can sit under the finger) */
html.touch #tip { pointer-events: none; }
html.touch .tip { max-width: min(300px, calc(100vw - 12px)); }
html.touch .tip.wide { max-width: min(380px, calc(100vw - 12px)); }
html.touch .tip.cards { max-width: calc(100vw - 12px); }
@media (max-width: 640px) {
  html.touch .tcards { flex-direction: column; gap: 6px; }
  html.touch .tcard { width: min(300px, calc(100vw - 12px)); }
}

/* the chat: folded behind its button (it still takes the focus, so a whisper from a menu opens it) */
html.touch:not(.chat-open) #chat { opacity: 0; pointer-events: none; }
html.touch:not(.chat-open) #emotes { display: none; }
html.touch #chat .chat-row { display: flex; gap: 6px; align-items: stretch; }
html.touch #chat .chat-row #chat-in { flex: 1; min-width: 0; }
html.touch #chat-send { flex: none; padding: 0 12px; }
.tchat-n { position: absolute; top: -8px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #b0361f; color: #fff;
  font: 700 11px/18px var(--serif); text-align: center; border: 1px solid #0b0806; box-shadow: 0 1px 3px #000; pointer-events: none; }
.tchat-n[hidden] { display: none; }
#menu-btns .tmenu-chat { position: relative; }

/* the buttons for the keys: a column on the right (in a fight: Mark, Cancel, Help, Chat; full screen) */
#tbar, #tturn { display: none; }
html.touch #tbar { display: flex; flex-direction: column; gap: 6px; position: absolute; right: calc(8px + var(--sar)); top: 50%; transform: translateY(-50%); z-index: 15; }
html.touch #tbar .btn { min-width: 64px; min-height: 40px; padding: 4px 6px; font-size: 11px; letter-spacing: 0.02em; position: relative; background: linear-gradient(180deg, rgba(58, 44, 28, 0.92), rgba(31, 23, 15, 0.92)); }
html.touch #tbar .tb-fight { display: none; }
html.touch body.in-battle #tbar .tb-fight { display: block; }
html.touch #tbar .btn.on { color: #fff0c8; border-color: #ffd870; box-shadow: 0 0 12px rgba(255, 216, 112, 0.6); }
html.touch #tbar .tb-full { font-size: 18px; min-width: 44px; align-self: flex-end; }
html.touch body:has(#login:not([hidden])) #tbar, html.touch body:has(#hud[hidden]):not(.in-battle) #tbar, html.touch body:has(#panels .panel) #tbar { display: none; }
/* upright phone, in a fight: a word that sideways is better */
html.touch #tturn:not([hidden]) { display: flex; position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); top: calc(118px + var(--sat)); z-index: 16; gap: 10px; align-items: center;
  padding: 6px 6px 6px 12px; font-size: 14px; font-style: italic; color: var(--ink); background: rgba(20, 15, 10, 0.9); border: 1px solid var(--edge-hi); box-shadow: 0 4px 12px #000; }
html.touch #tturn span { flex: 1; }

/* ---------------------------------------------------------------- the name and the class cards */
html.touch #login { overflow-y: auto; align-items: flex-start; padding: calc(10px + var(--sat)) calc(8px + var(--sar)) calc(10px + var(--sab)) calc(8px + var(--sal)); }
html.touch .login-box { margin: auto; }
@media (max-width: 599px) {
  html.touch .login-box { padding: 20px 14px 16px; }
  html.touch .login-box h1 { font-size: 40px; }
  html.touch .login-box .sub { letter-spacing: 0.25em; font-size: 11px; margin-bottom: 18px; }
  html.touch #login-name input { width: 100%; }
  html.touch #login-name .btn { margin: 10px 0 0; }
  html.touch .claim-row input { width: 100%; }
  html.touch .claim-row .btn { margin: 10px 0 0; }
  html.touch #wallet-go { min-width: 0; width: 100%; }
  html.touch .wp-list { grid-template-columns: 1fr; }
  html.touch #wallet-req input { width: 100%; }
  html.touch #wallet-req .btn { margin: 8px 0 0; }
  html.touch #class-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  html.touch .ccard canvas { width: 88px; height: 96px; }
  html.touch .ccard p { min-height: 0; font-size: 13.5px; }
}
@media (max-height: 499px) {
  html.touch .login-box { padding: 12px 18px 10px; width: min(820px, 100%); }
  html.touch .login-box h1 { font-size: 30px; }
  html.touch .login-box .sub { margin: 2px 0 10px; font-size: 11px; }
  html.touch #login-name label { margin-bottom: 6px; }
  html.touch #login-class .lbl { margin-bottom: 8px; font-size: 16px; }
  html.touch #class-cards { gap: 8px; margin-bottom: 10px; }
  html.touch .ccard { padding: 6px 6px 8px; }
  html.touch .ccard canvas { width: 66px; height: 72px; margin-bottom: 2px; }
  html.touch .ccard p { min-height: 0; font-size: 12.5px; margin: 3px 0; }
}

/* ---------------------------------------------------------------- town HUD on a phone */
@media (max-width: 699px), (max-height: 499px) {
  html.touch #quest-tracker { display: none; }
  html.touch #menu-btns { left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); bottom: calc(6px + var(--sab)); max-width: none;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  html.touch #menu-btns .btn { min-height: 40px; padding: 0 2px; font-size: 10px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.touch #menu-btns .mailbtn, html.touch #menu-btns .tmenu-chat { overflow: visible; }
  html.touch #me-frame { left: calc(6px + var(--sal)); top: calc(6px + var(--sat)); min-width: 0; zoom: 0.72; }
  html.touch #right-col { right: calc(6px + var(--sar)); top: calc(6px + var(--sat)); width: 200px; zoom: 0.85; }
  html.touch #queue-banner { top: auto; bottom: calc(104px + var(--sab)); font-size: 13px; padding: 6px 10px; }
  html.touch #chat { left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); width: auto; bottom: calc(146px + var(--sab)); }
  html.touch #chat-log { height: 24vh; }
  html.touch #emotes { left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); bottom: calc(100px + var(--sab)); overflow-x: auto; }
  html.touch #emotes .btn { flex: 1; }
}
/* upright: the party in the top right corner, beside the hero's frame; the bar of windows two rows at the bottom */
@media (max-width: 599px) {
  html.touch #right-col { width: 172px; }
  html.touch #menu-btns .btn { padding: 0 1px; font-size: 9.5px; letter-spacing: -0.02em; }
}
/* sideways: the bar of windows in two rows on the right, the chat on the left */
@media (max-height: 499px) {
  html.touch #menu-btns { left: auto; width: min(470px, 56vw); }
  html.touch #chat { right: auto; width: calc(100vw - min(470px, 56vw) - 26px - var(--sal) - var(--sar)); bottom: calc(6px + var(--sab)); }
  html.touch #chat-log { height: 34vh; }
  html.touch #emotes { right: auto; bottom: auto; top: calc(6px + var(--sat)); left: 50%; transform: translateX(-50%); }
  html.touch #me-frame { zoom: 0.6; }
  html.touch #right-col { zoom: 0.75; }
}

/* ---------------------------------------------------------------- windows on a tablet: centred, never wider than the screen
   (left 50% + translate leaves a window only half the screen to grow in; it overflowed and hid its ✕) */
@media (min-width: 700px) and (min-height: 500px) {
  html.touch .panel.center { left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); margin: 0 auto; width: fit-content; max-width: calc(100% - 12px - var(--sal) - var(--sar));
    transform: translateY(-50%); }
  html.touch .panel.center.mkpanel { transform: none; }
  html.touch .skmain { flex-wrap: wrap; }
  html.touch .skside { flex: 1 1 330px; }
  /* the header (and its ✕) stays at the top of a window scrolled down */
  html.touch .panel .hd { position: sticky; top: 0; z-index: 6; margin-left: -18px; margin-right: -18px; padding: 8px 18px 10px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel)); box-shadow: 0 6px 10px -6px rgba(0, 0, 0, 0.8); }
  html.touch .panel.skills .hd { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}

/* ---------------------------------------------------------------- windows on a phone: the whole screen */
@media (max-width: 699px), (max-height: 499px) {
  html.touch .panel.center { left: var(--sal); right: var(--sar); top: var(--sat); bottom: 0; transform: none; width: auto; min-width: 0; max-width: none; max-height: none;
    border-radius: 0; padding: 0 12px calc(14px + var(--sab)); overflow: auto; }
  html.touch .panel .hd { position: sticky; top: 0; z-index: 6; margin: 0 -12px 10px; padding: 10px 12px 8px; gap: 10px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel)); box-shadow: 0 6px 10px -6px rgba(0, 0, 0, 0.8); }
  html.touch .panel .hd .portrait { width: 40px; height: 40px; }
  html.touch .panel .hd h2 { font-size: 17px; }
  html.touch .panel .hd .t { font-size: 13px; }
  html.touch .panel .greet { font-size: 15px; margin-bottom: 10px; }
  html.touch .tabs { flex-wrap: wrap; row-gap: 2px; }
  /* the window scrolls instead of the lists in it */
  html.touch .shop, html.touch .vault, html.touch .dgwrap, html.touch .settings, html.touch .achwin, html.touch .inspwin, html.touch .mksellw { width: auto; }
  html.touch .warden, html.touch .salvage, html.touch .qwrap, html.touch .mkwin, html.touch .pwin, html.touch .gwin, html.touch .help, html.touch .fame,
  html.touch .famep .tabs, html.touch .mll, html.touch .songs { width: auto; }
  html.touch .list, html.touch .quests, html.touch .pwl, html.touch .mkl, html.touch .mll, html.touch .achl, html.touch .gros, html.touch .skins, html.touch .vscroll { max-height: none; overflow: visible; }
  html.touch .salvage .list { max-height: none !important; }   /* its 44vh is written on the element */
  html.touch .dglist { max-height: 34vh; }
  html.touch .bag, html.touch .bag.wide, html.touch .vault .bag, html.touch .mksellw .bag { grid-template-columns: repeat(auto-fill, 52px); justify-content: center; }
  html.touch .pouch { grid-template-columns: repeat(auto-fill, 46px); justify-content: center; }
  html.touch .skins { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  html.touch .settings { gap: 6px; }
  html.touch .set input[type=range] { width: 120px; }
  html.touch .mksell { min-height: 0; }
  html.touch .help td:first-child { white-space: normal; }
  html.touch .gros .who, html.touch .pwl .who { flex-wrap: wrap; }
  html.touch .gros .who .wb { flex: 1 1 calc(100% - 50px); }
  html.touch .lfrow #lf-note { min-width: 0; flex: 1 1 100%; }
  /* the skill window: the tree scrolls sideways, the chosen skill's page below it */
  html.touch .sktop { flex-wrap: wrap; gap: 8px; }
  html.touch .barwrap { margin: 0; }
  html.touch .skmain { flex-direction: column; }
  html.touch .tree { overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
  html.touch .tcore { flex-wrap: wrap; gap: 4px 14px; }
  html.touch .tch { width: 100%; }
  html.touch .skside { width: auto; max-height: none; scroll-margin-top: 78px; }
  /* question boxes and the fight's result */
  html.touch .modal-box { min-width: 0; max-width: calc(100vw - 16px); max-height: calc(100% - 16px - var(--sat) - var(--sab)); overflow-y: auto; padding: 16px 14px; }
  html.touch .modal-box h2 { font-size: 26px; }
  html.touch .modal-box.result { max-width: calc(100vw - 16px); max-height: calc(100% - 16px - var(--sat) - var(--sab)); }
  html.touch .doors, html.touch .blessings { flex-wrap: wrap; }
  html.touch .door { min-width: 140px; }
  html.touch #turn-banner { font-size: 30px; }
  /* smaller news: a toast is read at a glance and should not cover the screen */
  html.touch .toast { font-size: 13.5px; padding: 5px 10px; line-height: 1.25; }
  html.touch .toast .qdone-h { font-size: 13.5px; gap: 6px; }
  html.touch .toast.announce { font-size: 15px; }
  html.touch #toasts { gap: 4px; }
}
/* upright: one column (sideways, the windows keep their own two) */
@media (max-width: 699px) {
  html.touch .shop, html.touch .vault, html.touch .dgwrap, html.touch .settings, html.touch .achwin, html.touch .inspwin, html.touch .mksellw { grid-template-columns: minmax(0, 1fr); }
  /* the character window: the paper doll shrinks to the screen, the bags below it */
  html.touch .charwin { grid-template-columns: minmax(0, 1fr); }
  html.touch .charwin .bagcol { grid-column: auto; }
}
@media (max-width: 599px) {
  html.touch .paper { zoom: 0.88; }
  html.touch .inspwin .paper { zoom: 0.85; }
}

/* ---------------------------------------------------------------- a fight on a phone: slim bars, the map between them */
@media (max-width: 699px), (max-height: 499px) {
  html.touch #b-top { top: calc(4px + var(--sat)); }
  html.touch #b-title { font-size: 12px; margin-bottom: 3px; letter-spacing: 0.03em; }
  html.touch #b-order { gap: 3px; }
  html.touch .oc { width: 36px; padding: 2px 1px 3px; }
  html.touch .oc img { width: 28px; height: 28px; display: block; margin: 0 auto; }
  html.touch .oc .n { display: none; }
  html.touch .oc .bar { height: 3px; }
  html.touch .oc.cur { transform: translateY(2px); }
  html.touch #b-flee { top: calc(6px + var(--sat)); right: calc(8px + var(--sar)); }
  html.touch #b-set { top: calc(6px + var(--sat)); right: calc(82px + var(--sar)); }
  html.touch #b-bar { bottom: calc(4px + var(--sab)); padding: 6px 8px; gap: 8px; align-items: center;
    left: calc(4px + var(--sal)); right: calc(4px + var(--sar)); margin: 0 auto; width: fit-content; max-width: calc(100% - 8px - var(--sal) - var(--sar)); transform: none; }
  html.touch #b-abilities { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
  html.touch .ab { width: 48px; height: 48px; }
  html.touch .ab .cd { font-size: 18px; }
  html.touch #b-status { width: 128px; font-size: 12.5px; }
  html.touch #b-status .who { font-size: 12.5px; }
  html.touch #b-side { width: 112px; gap: 5px; }
  html.touch #b-end.btn.big { font-size: 13px; padding: 6px 8px; min-height: 42px; }
  html.touch #b-party { top: calc(64px + var(--sat)); left: calc(6px + var(--sal)); width: 150px; zoom: 0.9; }
  html.touch body.in-battle #chat { left: calc(6px + var(--sal)); right: auto; width: min(380px, 50vw); bottom: calc(var(--bbar, 66px) + 14px + var(--sab)); }
  html.touch body.in-battle #chat-log { height: 26vh; }
  /* the fight's result: a short screen still reaches its buttons */
  html.touch .modal-box.result { padding: 12px 14px; }
  html.touch .modal-box.result h2 { font-size: 24px; margin-bottom: 2px; }
  html.touch .modal-box.result .flav { margin-bottom: 8px; font-size: 14.5px; }
  html.touch .modal-box .rw { font-size: 14.5px; }
  html.touch .modal-box .row { margin-top: 10px; }
  html.touch .bstats { font-size: 13px; margin: 6px auto 2px; }
  html.touch .door { padding: 8px 10px; font-size: 12.5px; border-radius: 26px 26px 3px 3px; }
  html.touch .door b { font-size: 13.5px; }
}
/* upright: the title and the turn order under the two buttons, the bar across the bottom in two rows */
@media (max-width: 599px) {
  html.touch #b-top { top: calc(52px + var(--sat)); left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); transform: none; }
  html.touch #b-order { flex-wrap: wrap; }
  html.touch #b-party { top: calc(112px + var(--sat)); width: 140px; }
  html.touch #b-bar { width: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  html.touch #b-status { width: auto; grid-column: 1; grid-row: 1; }
  html.touch #b-side { grid-column: 2; grid-row: 1; width: 128px; }
  html.touch #b-abilities { grid-column: 1 / -1; grid-row: 2; }
  html.touch body.in-battle #chat { right: calc(6px + var(--sar)); width: auto; bottom: calc(var(--bbar, 130px) + 58px + var(--sab)); }
  /* the buttons for the keys in a row just over the bar, clear of the map's corners */
  html.touch body.in-battle #tbar { top: auto; transform: none; bottom: calc(var(--bbar, 130px) + 10px + var(--sab)); right: calc(4px + var(--sar)); flex-direction: row; gap: 4px; }
  html.touch body.in-battle #tbar .btn { min-width: 0; padding: 4px 9px; }
}

/* ---------------------------------------------------------------- the on-screen keyboard is up (touch.js sets kb-open and --kb,
   the part of the page it covers): the chat and a phone's window stop above it; the bars under it step aside */
html.touch.kb-open #menu-btns, html.touch.kb-open #emotes, html.touch.kb-open #tbar, html.touch.kb-open #tturn { display: none; }
html.touch.kb-open #chat, html.touch.kb-open body.in-battle #chat { bottom: calc(var(--kb) + 4px); }
html.touch.kb-open #chat-log { max-height: max(48px, calc(var(--vvh, 100vh) - 100px)); }
@media (max-width: 699px), (max-height: 499px) {
  html.touch.kb-open .panel.center { bottom: var(--kb); }
  html.touch.kb-open .modal-box { max-height: calc(var(--vvh, 100%) - 16px); }
}

/* ---------------------------------------------------------------- Season 0 armour: class and weight */
/* a worn piece the hero cannot wear any more (another class's, more Vitality than their own): a red frame, it gives nothing */
.paper .slot.unmet { border-color: var(--bad) !important; box-shadow: inset 0 0 12px rgba(224, 98, 79, 0.45), 0 0 7px rgba(224, 98, 79, 0.55); }
.slot .unmetx { position: absolute; right: 2px; bottom: 0; font-size: 11px; color: var(--bad); text-shadow: 0 0 3px #000, 0 1px 2px #000; pointer-events: none; }
.tip .toff { font-style: italic; }
/* the hero's own Vitality next to the attribute */
.stats .ownv { color: var(--ink-faint); font-size: 11.5px; }
/* Borin's wares by weight: a tab each, headers under All */
.shop .shtabs { margin: 0 0 6px; }
.shop .shtabs .tab { font-size: 11.5px; padding: 4px 9px; }
.shop .shh { font-family: var(--caps); font-size: 11.5px; color: var(--gold-dim); letter-spacing: 0.1em; text-transform: uppercase; margin: 6px 0 2px; padding-bottom: 2px; border-bottom: 1px solid var(--edge); }
.shop .shh:first-child { margin-top: 0; }
/* chapters and descents past the season's level cap */
.chp.closed { opacity: 0.35; text-decoration: line-through; }
.dgl.closed .dp i { font-style: italic; letter-spacing: 0; color: var(--ink-faint); font-size: 11px; }
.mkf .btn.on { color: #ffe3a6; border-color: var(--gold); background: linear-gradient(180deg, #4a3822, #2a1f13); }
