/* Cards (js/cards.js). Mini = .bcard / .mcard, medium = .prow / .kcard, full = .pfull / .cpage. Finishes come from --frm-*-s (thin frames). */
.fin-stone { --cf: var(--frm-stone-s); } .fin-moss { --cf: var(--frm-moss-s); } .fin-ice { --cf: var(--frm-ice-s); }
.fin-violet { --cf: var(--frm-violet-s); } .fin-gold { --cf: var(--frm-gold-s); } .fin-ruby { --cf: var(--frm-ruby-s); }

.cportrait { position: relative; overflow: hidden; flex: none; background: #120e24; }
.cportrait .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 80%; image-rendering: pixelated; }
.cportrait canvas.creature { position: absolute; left: 6%; bottom: -4%; width: 88%; height: 88%; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55)); }

/* mini: the battle card */
.bcard, .mcard { position: relative; display: flex; flex-direction: column; gap: 4px; width: 112px; padding: 4px 4px 6px; text-align: center; color: var(--text); font: inherit; cursor: default;
  border: 4px solid transparent; border-image: var(--cf, var(--frm-stone-s)) 4 / 4px stretch; background-color: var(--card); background-clip: padding-box; box-shadow: 3px 3px 0 #000; }
button.bcard { cursor: pointer; } button.bcard:hover { transform: translateY(-2px); filter: brightness(1.12); } button.bcard:active { transform: translateY(2px); }
.bcard.active { box-shadow: 3px 3px 0 #000, 0 0 14px var(--accent); }
.bcard.away, .prow.away { filter: saturate(.6) brightness(.92); }
.bc-art { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border: 2px solid #000; background: #120e24; }
.bc-art .cportrait { width: 100% !important; height: 100% !important; }
.mcard .bc-art canvas.creature { position: absolute; left: 6%; bottom: -2%; width: 88%; height: 88%; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .55)) drop-shadow(0 0 6px var(--glow)); animation: bob 1s steps(2) infinite; }
.mcard .bc-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 80%; image-rendering: pixelated; }
.bc-crest { position: absolute; left: -4px; top: -4px; z-index: 3; }
.bc-class { position: absolute; right: 2px; top: 2px; z-index: 3; filter: drop-shadow(0 2px 0 #000); }
.bc-name { font-size: calc(18px * var(--ts, 1)); line-height: 1.1; min-height: 20px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-top: 2px; }
.bc-sub { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bcard .bar, .mcard .bar { height: 10px; border-width: 2px; box-shadow: none; } .bcard .bar > span, .mcard .bar > span { display: none; }
.mcard.boss { box-shadow: 3px 3px 0 #000, 0 0 12px var(--accent); } .mcard.elite { box-shadow: 3px 3px 0 #000, 0 0 10px var(--glow); }
.mc-el { justify-content: center; gap: 2px; min-height: 22px; }
.strip { display: flex; gap: 10px; flex-wrap: wrap; }

/* medium: roster row and clan card */
.prow { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; text-align: left; color: var(--text); font: inherit; cursor: default;
  border: 4px solid transparent; border-image: var(--cf, var(--frm-stone-s)) 4 / 4px stretch; background-color: var(--card); background-clip: padding-box; box-shadow: 2px 2px 0 #000; }
button.prow { cursor: pointer; } button.prow:hover { filter: brightness(1.15); }
.prow .cportrait { border: 2px solid #000; }
.pr-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pr-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pr-sub { font-size: calc(17px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .bar { height: 8px; border-width: 2px; box-shadow: none; } .prow .bar > span { display: none; }
.pr-dot { position: absolute; right: 6px; bottom: 6px; width: 8px; height: 8px; background: var(--good); border: 2px solid #000; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }

.kcard { position: relative; display: flex; flex-direction: column; width: 100%; text-align: left; color: var(--text); font: inherit; padding: 0; overflow: hidden; cursor: default;
  border: 4px solid transparent; border-image: var(--cf, var(--frm-stone-s)) 4 / 4px stretch; background-color: var(--card); background-clip: padding-box; box-shadow: 3px 3px 0 #000; }
button.kcard { cursor: pointer; } button.kcard:hover { filter: brightness(1.12); transform: translateY(-2px); }
.kc-art { position: relative; height: 96px; overflow: hidden; background: #120e24; }
.kc-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 85%; image-rendering: pixelated; }
.kc-banner { position: absolute; left: 14px; top: 6px; z-index: 2; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .6)); }
.kc-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.kc-name { font-family: var(--font-head); font-size: calc(12px * var(--ts, 1)); line-height: 1.5; }
.emblem { image-rendering: pixelated; display: block; }
.clan-mini { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.clan-mini b { font-family: var(--font-head); font-weight: normal; font-size: calc(9px * var(--ts, 1)); color: var(--accent); }

/* full: profile and clan page */
.pfull, .cpage { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.pfull .ccard.full { margin-bottom: 0; }
.pf-clan { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--well); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); }
.pf-sec { margin: 0; padding: 10px 12px; }
.pf-sec h3 { margin-bottom: 8px; }
.pf-classes { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-class { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 4px; background: var(--well); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); font-size: calc(18px * var(--ts, 1)); }
.pf-class b { font-family: var(--font-head); font-weight: normal; font-size: calc(9px * var(--ts, 1)); color: var(--accent2); }
.pf-class.on { box-shadow: 0 0 0 2px var(--accent); }
.pf-skill { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: calc(19px * var(--ts, 1)); } .pf-bar { width: 38%; } .pf-skill b { font-family: var(--font-head); font-weight: normal; font-size: calc(9px * var(--ts, 1)); min-width: 28px; text-align: right; }
.pf-gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.pf-slot { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--well); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); }
.pf-slot.empty { opacity: .55; border-style: dashed; box-shadow: none; border-color: var(--line2); text-align: center; line-height: 1; }
.pf-slot .icon { width: 40px; height: 40px; }
.pf-f { position: absolute; right: 1px; bottom: -2px; font-size: calc(14px * var(--ts, 1)); color: var(--accent); text-shadow: 1px 1px 0 #000; }
.pf-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.pf-tile { display: flex; flex-direction: column; gap: 4px; padding: 8px; text-align: center; background: var(--well); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); }
.pf-tile b { font-family: var(--font-head); font-weight: normal; font-size: calc(12px * var(--ts, 1)); color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.pf-actions { justify-content: flex-end; }
@media (max-width: 480px) { .bcard, .mcard { width: 96px; } .roster { grid-template-columns: 1fr; } }
.kc-fill { flex: 1; min-width: 40px; } .kc-body .row { gap: 8px; align-items: center; }
.lb-val { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-family: var(--font-head); font-size: calc(11px * var(--ts, 1)); } .lb-rank { color: var(--accent); font-size: calc(12px * var(--ts, 1)); } .prow.mine { box-shadow: 2px 2px 0 #000, 0 0 12px var(--good); }

/* Task tiles (screens/tasks.js) */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.ttile { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 6px; color: var(--text); font: inherit; text-align: center; cursor: pointer;
  border: 4px solid transparent; border-image: var(--frm-stone-s) 4 / 4px stretch; background-color: var(--card); background-clip: padding-box; box-shadow: 3px 3px 0 #000; transition: transform .08s steps(2); }
.ttile:hover { transform: translateY(-3px); filter: brightness(1.12); } .ttile:active { transform: translateY(1px); }
.ttile.tier-4, .ttile.tier-5, .ttile.tier-6 { border-image-source: var(--frm-moss-s); }
.ttile.tier-7, .ttile.tier-8, .ttile.tier-9 { border-image-source: var(--frm-ice-s); }
.ttile.tier-10, .ttile.tier-11, .ttile.tier-12 { border-image-source: var(--frm-violet-s); }
.ttile.tier-13, .ttile.tier-14, .ttile.tier-15 { border-image-source: var(--frm-gold-s); }
.ttile.running { border-image-source: var(--frm-gold-s); box-shadow: 3px 3px 0 #000, 0 0 16px var(--accent); }
.ttile.running .tt-icon { animation: tt-work .5s steps(2) infinite; }
.ttile.locked { cursor: pointer; } .ttile.locked .tt-art { filter: grayscale(.85) brightness(.55); } .ttile.locked .tt-name { color: var(--dim); }
.tt-art { position: relative; aspect-ratio: 3 / 2; max-width: 100%; overflow: hidden; border: 2px solid #000; background: #120e24; }
.tt-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 85%; image-rendering: pixelated; }
.tt-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tt-icon .icon { filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .6)) drop-shadow(0 0 6px rgba(255, 255, 255, .25)); }
.ttile:hover .tt-icon .icon { animation: bob .6s steps(2) infinite; }
.tt-tier { position: absolute; left: 2px; top: 2px; padding: 0 3px; font-family: var(--font-head); font-size: calc(8px * var(--ts, 1)); line-height: 12px; color: #000; background: var(--accent); box-shadow: 1px 1px 0 #000; }
.tt-badge:empty { display: none; }
.tt-badge { position: absolute; right: 2px; top: 2px; padding: 0 4px; font-family: var(--font-head); font-size: calc(8px * var(--ts, 1)); line-height: 12px; box-shadow: 1px 1px 0 #000; }
.tt-badge.now { background: var(--good); color: #000; animation: k-pulse 1s steps(2) infinite; } .tt-badge.miss { background: var(--bad); color: #fff; }
.tt-name { font-size: calc(18px * var(--ts, 1)); line-height: 1.05; min-height: 2.1em; display: flex; align-items: center; justify-content: center; }
.tt-foot { display: flex; justify-content: center; gap: 6px; font-size: calc(16px * var(--ts, 1)); color: var(--dim); }
.tt-xp { color: var(--accent); } .tt-lock { color: var(--warn, #ffb000); }
.tt-lock::before { content: ''; display: inline-block; width: 8px; height: 9px; margin-right: 4px; vertical-align: -1px; background: currentColor; clip-path: polygon(0 40%, 15% 40%, 15% 15%, 30% 0, 70% 0, 85% 15%, 85% 40%, 100% 40%, 100% 100%, 0 100%, 0 40%, 30% 40%, 30% 20%, 70% 20%, 70% 40%, 30% 40%); }
@keyframes tt-work { 50% { transform: translateY(-3px) rotate(-6deg); } }

/* Task sheet */
.tsheet { display: flex; flex-direction: column; gap: 10px; }
.ts-art { position: relative; height: 120px; overflow: hidden; border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); }
.ts-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 85%; image-rendering: pixelated; }
.ts-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ts-icon .icon { animation: bob 1s steps(2) infinite; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .6)); }
.ts-place { position: absolute; left: 6px; bottom: 4px; padding: 0 6px; background: rgba(0, 0, 0, .65); font-size: calc(17px * var(--ts, 1)); }
.ts-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.ts-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-chips .chip { cursor: pointer; padding: 2px 8px; color: var(--text); font: inherit; font-size: calc(18px * var(--ts, 1)); }
.ts-chips .chip.on { border-color: var(--accent); background: #ffd34d22; color: var(--accent); }
@media (max-width: 480px) { .tgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; } }

/* Market (screens/market.js) */
.mk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mk-search { flex: 1 1 200px; min-width: 0; }
.mk-cats { display: flex; flex-wrap: wrap; gap: 6px; } .mk-cats .chip { cursor: pointer; padding: 2px 8px; color: var(--text); font: inherit; font-size: calc(18px * var(--ts, 1)); } .mk-cats .chip.on { border-color: var(--accent); color: var(--accent); background: #ffd34d22; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mk-tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; text-align: left; color: var(--text); font: inherit; cursor: pointer;
  border: 4px solid transparent; border-image: var(--frm-stone-s) 4 / 4px stretch; background-color: var(--card); background-clip: padding-box; box-shadow: 3px 3px 0 #000; }
button.mk-tile:hover { filter: brightness(1.12); transform: translateY(-2px); }
.mk-tile-top { display: flex; gap: 8px; align-items: center; } .mk-name { font-size: calc(19px * var(--ts, 1)); line-height: 1.1; } .mk-star { color: var(--accent); }
.mk-prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; } .mk-prices > div { display: flex; flex-direction: column; background: var(--well); padding: 3px 5px; border: 2px solid #000; }
.mk-prices .gold, .pf-tile .gold { font-family: var(--font-head); font-size: calc(10px * var(--ts, 1)); color: var(--accent); }
.mk-foot { border-top: 2px dashed var(--line2); padding-top: 4px; }
.mk-head { display: flex; align-items: center; gap: 10px; } .mk-head h2 { margin: 0; }
.mk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.mk-chart { display: flex; justify-content: center; }
.mk-canvas { width: 100%; max-width: 900px; image-rendering: pixelated; border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); }
.mk-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; align-items: start; }
.mk-two > * { margin: 0; min-width: 0; }
.mk-book .empty, .mk-book .dim.center { padding: 6px; }
.mk-lvl { position: relative; display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 2px 6px; font-size: calc(18px * var(--ts, 1)); }
.mk-lvl::before { content: ''; position: absolute; right: 0; top: 1px; bottom: 1px; width: var(--w); z-index: 0; }
.mk-lvl > * { position: relative; z-index: 1; }
.mk-lvl.ask::before { background: #ff4d6d33; } .mk-lvl.bid::before { background: #5fe08a33; }
.mk-spread { text-align: center; padding: 4px; margin: 4px 0; border-top: 2px dashed var(--line2); border-bottom: 2px dashed var(--line2); font-size: calc(16px * var(--ts, 1)); color: var(--dim); }
.mk-form { display: flex; flex-direction: column; gap: 8px; }
.mk-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mk-num { width: 100%; }
.mk-check { font-size: calc(17px * var(--ts, 1)); display: flex; gap: 6px; align-items: center; }
.mk-preview { padding: 6px 8px; background: var(--well); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line2); display: flex; flex-direction: column; gap: 3px; }
.mk-trades { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow: auto; }
.mk-trade { display: grid; grid-template-columns: 90px auto auto 1fr; gap: 8px; align-items: center; font-size: calc(17px * var(--ts, 1)); padding: 1px 0; border-bottom: 1px solid var(--line2); }
.mk-order { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 2px solid var(--line2); }
.mk-fill { position: relative; height: 14px; margin: 3px 0; background: var(--well); border: 2px solid #000; font-size: calc(13px * var(--ts, 1)); line-height: 10px; }
.mk-fill::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); background: var(--accent); opacity: .6; }
.mk-fill span { position: relative; padding-left: 4px; }
.mk-box { box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 480px) { .mk-trade { grid-template-columns: 70px auto auto; } .mk-trade > :last-child { display: none; } }

/* Backpack slot grid (screens/inventory.js) */
.bag-info { min-height: 22px; margin-bottom: 6px; padding: 2px 6px; background: var(--well); border: 2px solid #000; color: var(--text); }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 4px; padding: 6px; background: #0e0a1c; border: 3px solid #000; box-shadow: inset 0 0 0 2px #2a2250; }
.bslot { position: relative; aspect-ratio: 1; max-width: 100%; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; color: var(--text); font: inherit;
  background: radial-gradient(circle at 50% 40%, #2c2452 0%, var(--card) 70%); border: 3px solid #3a3070; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .06), inset -2px -2px 0 rgba(0, 0, 0, .45); }
.bslot .icon { width: 40px; height: 40px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .6)); }
.bslot:hover:not(.empty) { border-color: var(--accent); transform: translateY(-1px); z-index: 2; box-shadow: 0 0 10px var(--accent), inset 2px 2px 0 rgba(255, 255, 255, .06); }
.bslot:hover .icon { animation: bob .6s steps(2) infinite; }
.bslot.empty { cursor: default; background: #120d24; border-style: dashed; border-color: #241d44; box-shadow: none; }
.bslot .qty { position: absolute; right: 2px; bottom: 0; font-family: var(--font-head); font-size: calc(8px * var(--ts, 1)); color: #fff; text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000; }
.bs-tier { position: absolute; left: 1px; top: 1px; font-family: var(--font-head); font-size: calc(6px * var(--ts, 1)); line-height: 9px; padding: 0 2px; background: rgba(0, 0, 0, .65); color: var(--dim); }
.bs-f { position: absolute; right: 1px; top: 1px; font-family: var(--font-head); font-size: calc(6px * var(--ts, 1)); line-height: 9px; padding: 0 2px; background: var(--accent); color: #000; }
.bs-worn { position: absolute; left: 1px; bottom: 1px; font-family: var(--font-head); font-size: calc(6px * var(--ts, 1)); line-height: 9px; padding: 0 2px; background: var(--good); color: #000; }
.bs-q { position: absolute; right: 2px; bottom: 9px; font-size: calc(11px * var(--ts, 1)); color: var(--accent); text-shadow: 1px 1px 0 #000; }
.bslot.tier-4, .bslot.tier-5, .bslot.tier-6 { border-color: #3f8a4a; } .bslot.tier-7, .bslot.tier-8, .bslot.tier-9 { border-color: #3d79b8; }
.bslot.tier-10, .bslot.tier-11, .bslot.tier-12 { border-color: #8a4fc8; } .bslot.tier-13, .bslot.tier-14, .bslot.tier-15 { border-color: #c99a1e; }
.bslot.worn { box-shadow: inset 0 0 0 2px var(--good), inset 2px 2px 0 rgba(255, 255, 255, .06); }
@media (max-width: 480px) { .bag-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; padding: 4px; } .bslot .icon { width: 32px; height: 32px; } .bs-tier { display: none; } }

/* Paper doll (screens/character.js) */
.doll { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px) minmax(0, 1fr); gap: 12px; align-items: start; margin: 8px 0; }
.doll .slot-cell { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 4px 6px; min-height: 0; }
.doll .slot-cell .slot { grid-row: 1 / 3; width: 44px; height: 44px; }
.doll .slot-cell .slot-name { align-self: end; }
.doll .doll-col.right .slot-cell { grid-template-columns: 1fr 44px; text-align: right; }
.doll .doll-col.right .slot-cell .slot { grid-column: 2; grid-row: 1 / 3; }
.doll .doll-col.right .slot-cell > :not(.slot) { grid-column: 1; }
.doll-col.under .slot-cell { grid-template-columns: 1fr; text-align: center; justify-items: center; }
.doll-col.under .slot-cell .slot { grid-row: auto; }
.doll-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.doll-col.under { flex-direction: row; justify-content: center; margin-top: 8px; }
.doll-col.under .slot-cell { flex: 1 1 0; max-width: 96px; }
.doll .slot-cell { width: 100%; }
.doll-centre { display: flex; flex-direction: column; min-width: 0; }
.doll-stage { position: relative; aspect-ratio: 1; max-width: 100%; overflow: hidden; border: 6px solid transparent; border-image: var(--frm-gold) 8 / 6px stretch; background: var(--well); box-shadow: 4px 4px 0 #000; }
.doll-stage .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 80%; image-rendering: pixelated; }
.doll-stage canvas.creature { position: absolute; left: 12%; bottom: 6%; width: 76%; height: 76%; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .5)); animation: bob 1.4s steps(2) infinite; }
.doll-plate { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; padding: 2px 10px; background: rgba(0, 0, 0, .7); border: 2px solid #000; white-space: nowrap; }
.doll-plate b { font-family: var(--font-head); font-weight: normal; font-size: calc(10px * var(--ts, 1)); color: var(--accent); }
@media (max-width: 560px) {
  .doll { grid-template-columns: 1fr 1fr; }
  .doll-centre { grid-column: 1 / -1; order: -1; }
  .doll-stage { max-width: 260px; margin: 0 auto; width: 100%; }
}

/* Skill categories (screens/skills.js) */
.skill-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.skill-cat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px; color: var(--text); font: inherit; cursor: pointer; text-align: center;
  border: 4px solid transparent; border-image: var(--frm-stone-s) 4 / 4px stretch; background: linear-gradient(var(--panel2), var(--card));   /* theme colours, so light themes like Parchment stay light */ background-clip: padding-box; box-shadow: 3px 3px 0 #000; }
.skill-cat b { font-family: var(--font-head); font-weight: normal; font-size: calc(9px * var(--ts, 1)); line-height: 1.4; }
.skill-cat:hover { filter: brightness(1.15); transform: translateY(-2px); }
.skill-cat.on { border-image-source: var(--frm-gold-s); box-shadow: 3px 3px 0 #000, 0 0 14px rgba(255, 211, 77, .45); }
.skill-cat.on b { color: var(--accent); }
@media (max-width: 480px) { .skill-cats { grid-template-columns: repeat(3, 1fr); gap: 6px; } .skill-cat { padding: 8px 2px; } .skill-cat b { font-size: calc(7px * var(--ts, 1)); } }

/* ---- skill page: banner, level ring, stat tiles, ranked perk tree, milestone road */
.skill-cat { position: relative; }
.pts-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; background: var(--accent); box-shadow: 0 0 0 2px #000, 0 0 10px var(--accent); animation: ptsPulse 1.4s steps(4) infinite; }
@keyframes ptsPulse { 50% { opacity: .35; } }
html.fx-off .pts-dot { animation: none; }
.skill-card.can-spend { box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(255, 211, 77, .35); }
.tag.pts { background: var(--accent); color: #1a1022; border-color: #000; }
.skill-page-wrap { display: flex; flex-direction: column; gap: 12px; }
.sp-banner { position: relative; overflow: hidden; min-height: 150px; padding: 0; background: var(--well); }
.sp-banner .sp-sky { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: .85; }
.sp-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(11, 8, 22, .92) 100%); pointer-events: none; }
.sp-back { position: absolute; top: 8px; left: 8px; z-index: 2; }
.sp-hero { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 12px; padding: 48px 12px 12px; }
.sp-icon { flex: none; padding: 6px; background: var(--well); border: 3px solid #000; box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(255, 211, 77, .4); }
.sp-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-title h2 { margin: 0; font-family: var(--font-head); font-size: calc(18px * var(--ts, 1)); color: #fff; text-shadow: 2px 2px 0 #000, 0 0 12px var(--accent); }
.sp-effect { color: #e9e3ff; text-shadow: 1px 1px 0 #000; }
.lvl-ring { --p: 0; flex: none; width: 74px; height: 74px; display: grid; place-items: center; border-radius: 50%;
  background: conic-gradient(var(--xp) calc(var(--p) * 360deg), var(--line2) 0); box-shadow: 0 0 0 3px #000, 0 0 16px rgba(107, 227, 255, .35); }
.lvl-ring.locked { background: var(--line2); box-shadow: 0 0 0 3px #000; }
.lvl-in { width: 56px; height: 56px; border-radius: 50%; background: var(--well); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.lvl-in b { font-family: var(--font-head); font-weight: normal; font-size: calc(18px * var(--ts, 1)); color: var(--accent); }
.sp-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sp-tiles .pf-tile.hot { box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(255, 211, 77, .45); }
@media (max-width: 520px) { .sp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sp-actions > .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-next { min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.bar.pts > i { background-color: var(--accent); }
.bar.rank { height: 10px; }
.bar.rank > i { background-color: var(--good); }
.row.wrap { flex-wrap: wrap; }
.perk-node.maxed { border-color: var(--accent); background: rgba(255, 211, 77, .08); box-shadow: 0 0 12px rgba(255, 211, 77, .25); }
.perk-node .bar { width: 100%; }
.pn-buy { gap: 6px; flex-wrap: wrap; }
.sp-road { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
.sp-mile { position: relative; display: grid; grid-template-columns: 56px 22px 1fr; align-items: center; gap: 6px; padding: 6px 4px; border-left: 3px solid var(--line2); margin-left: 10px; opacity: .7; }
.sp-mile.done { opacity: .45; border-left-color: var(--good); }
.sp-mile.next { opacity: 1; background: rgba(255, 211, 77, .08); border-left-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.sp-mlv { font-family: var(--font-head); font-size: calc(10px * var(--ts, 1)); color: var(--accent); }
.sp-mic { text-align: center; }
.sp-mile.k-unlock .sp-mic, .sp-mile.k-class .sp-mic { color: var(--accent); }
.sp-mile.k-node .sp-mic { color: var(--xp); }
.sp-mtx { min-width: 0; overflow-wrap: anywhere; }
.tree-node.maxed { border-color: var(--accent); box-shadow: 0 0 12px rgba(255, 211, 77, .25); }

/* ---- heroes (account slots) */
.hs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.hs-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; background: var(--well); min-width: 0; }
.hs-card.active { box-shadow: 0 0 16px rgba(255, 211, 77, .35); }
.hs-card input { width: 100%; }
.hs-art { width: 96px; height: 96px; display: grid; place-items: center; background: radial-gradient(circle, rgba(124, 92, 255, .35), transparent 70%); }
.hs-art canvas { width: 96px; height: 96px; image-rendering: pixelated; }
.hs-name { font-family: var(--font-head); font-size: calc(11px * var(--ts, 1)); color: var(--accent); overflow-wrap: anywhere; }
.hs-plus { width: 96px; height: 96px; display: grid; place-items: center; font-family: var(--font-head); font-size: calc(32px * var(--ts, 1)); color: var(--line); border: 3px dashed var(--line2); }
.hs-locked { opacity: .6; }

/* ---- task rates table (task sheet) */
.rates { display: flex; flex-direction: column; gap: 6px; }
.rates h3 { margin: 0; }
.rate-table { width: 100%; border-collapse: collapse; font-size: calc(15px * var(--ts, 1)); }
.rate-table th, .rate-table td { padding: 3px 6px; border-bottom: 1px dashed var(--line2); text-align: right; white-space: nowrap; }
.rate-table th:first-child { text-align: left; white-space: normal; }
.rate-table thead th { color: var(--accent); font-family: var(--font-head); font-size: calc(9px * var(--ts, 1)); }
.rate-table tr.xp td { color: var(--xp); } .rate-table tr.gold td { color: var(--accent); }
.rt-item { display: inline-flex; align-items: center; gap: 4px; }

/* ---- equipped sets in the Bag, class tabs on the Hero screen */
.worn-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line2); }
.worn-row.now .worn-who b { color: var(--accent); }
.worn-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.worn-slots { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.bslot.sm { width: 40px; height: 40px; }
@media (max-width: 520px) { .worn-row { grid-template-columns: 1fr auto; } .worn-slots { grid-column: 1 / -1; grid-row: 2; } }
.eq-tabs { flex-wrap: wrap; }
.eq-tabs button { display: inline-flex; align-items: center; gap: 4px; }
.eq-now { color: var(--good); font-size: calc(10px * var(--ts, 1)); }
.food-panel.empty { border-color: var(--bad, #ff5d73); box-shadow: 0 0 12px rgba(255, 93, 115, .35); }

/* ---- seasonal shop (Hallowed Night) */
.store-tabs .ss-tab { color: #ffb040; text-shadow: 0 0 8px rgba(255, 122, 26, .7); }
.store-tabs .ss-tab.on { box-shadow: 0 0 0 2px #ff7a1a, 0 0 16px rgba(255, 122, 26, .55); }
.season-shop { display: flex; flex-direction: column; gap: 12px; }
.ss-hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 14px;
  background: radial-gradient(circle at 82% 22%, #ffe9a8 0 14px, rgba(255, 233, 168, .25) 15px 40px, transparent 41px),
    linear-gradient(180deg, #1a0a2e 0%, #3a1450 55%, #7a2a10 100%);
  border: 3px solid #000; box-shadow: 0 0 0 2px #ff7a1a, 0 0 24px rgba(255, 122, 26, .4); }
.ss-hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 22px; pointer-events: none;
  background: linear-gradient(90deg, transparent 0 6%, #120818 6% 9%, transparent 9% 30%, #120818 30% 32%, transparent 32% 61%, #120818 61% 64%, transparent 64%); clip-path: polygon(0 100%, 0 60%, 5% 40%, 10% 60%, 30% 50%, 31% 20%, 33% 50%, 60% 55%, 62% 25%, 64% 55%, 100% 50%, 100% 100%); }
.ss-fog { position: absolute; inset: auto -20% 0 -20%; height: 40%; background: radial-gradient(ellipse at 30% 100%, rgba(200, 220, 255, .22), transparent 60%), radial-gradient(ellipse at 75% 100%, rgba(200, 220, 255, .18), transparent 60%); animation: ssFog 9s ease-in-out infinite alternate; pointer-events: none; }
@keyframes ssFog { to { transform: translateX(8%); } }
html.fx-off .ss-fog { animation: none; }
.ss-title { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ss-title h2 { margin: 0; font-family: var(--font-head); color: #ffb040; text-shadow: 2px 2px 0 #000, 0 0 12px #ff7a1a; }
.ss-limited { align-self: flex-start; font-family: var(--font-head); font-size: calc(8px * var(--ts, 1)); letter-spacing: 2px; color: #1a0a00; background: #ff7a1a; padding: 3px 6px; border: 2px solid #000; animation: ptsPulse 1.2s steps(4) infinite; }
.ss-timer { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ss-clock { font-family: var(--font-head); font-size: calc(14px * var(--ts, 1)); color: #fff; text-shadow: 0 0 8px #9b4bff; }
.ss-off { background: #7dff6a; color: #0a2a0a; border-color: #000; }
.ss-pack { border-color: #9b4bff; }
.ss-group h3 { color: #ffb040; }
.ss-draws { border-color: #ff7a1a; box-shadow: 0 0 14px rgba(255, 122, 26, .3); }
.ss-bundles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .ss-bundles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ss-bundle { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; text-align: center;
  background: linear-gradient(180deg, #2a1040, #140818); border: 3px solid #000; box-shadow: 0 0 0 2px #5a2a7a; }
.ss-bundle.best { box-shadow: 0 0 0 2px #ff7a1a, 0 0 18px rgba(255, 122, 26, .55); }
.ss-best { position: absolute; top: -10px; font-family: var(--font-head); font-size: calc(7px * var(--ts, 1)); letter-spacing: 1px; background: #ff7a1a; color: #1a0a00; padding: 3px 6px; border: 2px solid #000; }
.ss-count { font-family: var(--font-head); font-size: calc(12px * var(--ts, 1)); color: #ffb040; }
.ss-reveal .opt { animation: ssPop .35s steps(4) both; }
@keyframes ssPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
html.fx-off .ss-reveal .opt { animation: none; }
.tt-info { position: absolute; bottom: 3px; right: 3px; z-index: 2; width: 18px; height: 18px; display: grid; place-items: center; font-family: var(--font-head); font-size: calc(9px * var(--ts, 1)); color: var(--text); background: var(--well); border: 2px solid var(--line2); cursor: pointer; }
.tt-info:hover { border-color: var(--accent2); color: var(--accent2); }

/* Clan page styling (owner 2026-10-23: "full page extremely customizable profile"). The clan's colours come in as --cp1 (primary),
   --cp2 (secondary), --cpa (accent), --cpt (text), --cpbg (background); pattern, frame, font and layout are classes. */
.cpage { background: var(--cpbg); color: var(--cpt); padding: 10px; border-radius: 4px; }
.cpage .cp-sec { background: color-mix(in srgb, var(--cp2) 85%, transparent); border-color: var(--cp1); color: var(--cpt); }
.cpage .cp-sec h3 { color: var(--cpa); }
.cp-head { display: flex; gap: 12px; align-items: center; padding: 14px; background: linear-gradient(135deg, var(--cp1), var(--cp2)); border: 3px solid #000; box-shadow: 0 0 0 2px var(--cpa); }
.cp-emblem { width: 64px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 0 6px var(--cpa)); flex: none; }
.cp-titles { min-width: 0; }
.cp-name { font-size: 1.5em; color: var(--cpt); text-shadow: 2px 2px 0 #000; overflow-wrap: anywhere; }
.cp-tag { color: var(--cpa); }
.cp-motto { font-style: italic; opacity: .9; margin-top: 4px; }
.cp-about { white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-role { margin-left: auto; border-color: var(--cpa); color: var(--cpa); }
/* layouts */
.cp-lay-centered .cp-head { flex-direction: column; text-align: center; }
.cp-lay-banner .cp-head { min-height: 120px; padding: 24px 14px; }
.cp-lay-banner .cp-emblem { width: 96px; height: 96px; }
.cp-lay-split { display: grid; grid-template-columns: 1fr 1fr; }
.cp-lay-split > .cp-head, .cp-lay-split > .pf-actions { grid-column: 1 / -1; }
@media (max-width: 600px) { .cp-lay-split { grid-template-columns: 1fr; } }
/* patterns, laid over the background */
.cp-pat-stripes { background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--cp1) 25%, transparent) 0 8px, transparent 8px 16px); }
.cp-pat-diagonal { background-image: repeating-linear-gradient(45deg, color-mix(in srgb, var(--cp1) 25%, transparent) 0 6px, transparent 6px 14px); }
.cp-pat-checks { background-image: conic-gradient(color-mix(in srgb, var(--cp1) 22%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--cp1) 22%, transparent) 0 75%, transparent 0); background-size: 24px 24px; }
.cp-pat-dots { background-image: radial-gradient(color-mix(in srgb, var(--cpa) 30%, transparent) 2px, transparent 3px); background-size: 14px 14px; }
.cp-pat-chevrons { background-image: linear-gradient(135deg, color-mix(in srgb, var(--cp1) 25%, transparent) 25%, transparent 25%), linear-gradient(225deg, color-mix(in srgb, var(--cp1) 25%, transparent) 25%, transparent 25%); background-size: 20px 20px; }
.cp-pat-waves { background-image: radial-gradient(circle at 50% 100%, transparent 8px, color-mix(in srgb, var(--cp1) 22%, transparent) 9px 11px, transparent 12px); background-size: 24px 12px; }
.cp-pat-stars { background-image: radial-gradient(1px 1px at 20% 30%, var(--cpa), transparent), radial-gradient(1px 1px at 70% 60%, var(--cpt), transparent), radial-gradient(2px 2px at 40% 80%, var(--cpa), transparent); background-size: 60px 60px; }
.cp-pat-scales { background-image: radial-gradient(circle at 50% 0, transparent 9px, color-mix(in srgb, var(--cp1) 25%, transparent) 10px 11px, transparent 12px); background-size: 20px 12px; }
.cp-pat-runes { background-image: repeating-linear-gradient(0deg, transparent 0 18px, color-mix(in srgb, var(--cpa) 18%, transparent) 18px 19px), repeating-linear-gradient(60deg, transparent 0 18px, color-mix(in srgb, var(--cpa) 14%, transparent) 18px 19px); }
/* frames around the whole page */
.cp-frame-iron { box-shadow: 0 0 0 3px #000, 0 0 0 6px #7a808a; }
.cp-frame-gold { box-shadow: 0 0 0 3px #000, 0 0 0 6px #ffd34d, 0 0 14px #ffd34d88; }
.cp-frame-thorns { box-shadow: 0 0 0 3px #000, 0 0 0 6px #2a5a2a; outline: 2px dashed #6a3a2a; outline-offset: 4px; }
.cp-frame-runic { box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--cpa), 0 0 18px var(--cpa); }
.cp-frame-crystal { box-shadow: 0 0 0 3px #000, 0 0 0 6px #6be3ff, 0 0 18px #6be3ff99; }
.cp-frame-bone { box-shadow: 0 0 0 3px #000, 0 0 0 6px #e8dcbe; outline: 2px dotted #e8dcbe; outline-offset: 4px; }
.cp-frame-vines { box-shadow: 0 0 0 3px #000, 0 0 0 6px #4a8a3a; outline: 3px dotted #7bd88f; outline-offset: 3px; }
/* fonts for the clan name */
.cp-font-serif .cp-name { font-family: Georgia, 'Times New Roman', serif; }
.cp-font-gothic .cp-name { font-family: 'UnifrakturMaguntia', 'Old English Text MT', Georgia, serif; letter-spacing: 1px; }
.cp-font-runic .cp-name { font-family: 'Courier New', monospace; letter-spacing: 4px; text-transform: uppercase; }
.cp-font-script .cp-name { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-style: italic; }
/* clan management in the Social screen */
.clan-mgr .tabs { flex-wrap: wrap; }
.clan-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.clan-pick button.on { box-shadow: 0 0 0 2px var(--accent, #ffd34d); }
.clan-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.clan-edit textarea { width: 100%; min-height: 90px; }
