:root, :root[data-look="tavern"] {
  --bg: #f4ede1; --panel: #fffbf3; --panel2: #f1e6d2; --line: #e2d5c0; --ink: #2a1e14; --muted: #6e5c4a;
  --accent: #9c3b22; --accent-ink: #fff; --gold: #b8862f; --ok: #2f6b3d; --warn: #9a5b10; --bad: #a12a2a;
  --scene: #9c3b22; --character: #2c5d8a; --location: #3d7a3a; --shop: #a4761f; --item: #7a4c96; --faction: #5d5d5d; --quest: #b24f7c; --note: #6d6252;
  --radius: 14px; --bw: 1px; --edge: var(--line); --shadow: 0 1px 0 #e2d5c0, 0 6px 18px rgba(42,30,20,.06);
  --head: 'Fraunces', Georgia, serif; --head-w: 700; --head-scale: 1;
  --body: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: light;
}
:root[data-look="arcane"] {
  --bg: #14131c; --panel: #1e1c2a; --panel2: #262338; --line: #34304a; --ink: #edeaf5; --muted: #a9a3c2;
  --accent: #d9b45a; --accent-ink: #1a1622; --gold: #e3c477; --ok: #8fd3a8; --warn: #f0b86a; --bad: #f08a8a;
  --scene: #e0a07a; --character: #8fb4f2; --location: #8fd3a8; --shop: #e3c477; --item: #c4a8f5; --faction: #b5b0c8; --quest: #f29aae; --note: #b3aac9;
  --radius: 14px; --bw: 1px; --edge: var(--line); --shadow: 0 0 0 1px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.25);
  --head: 'Cormorant Garamond', Georgia, serif; --head-w: 700; --head-scale: 1.18;
  color-scheme: dark;
}
:root[data-look="field"] {
  --bg: #f2f5ef; --panel: #ffffff; --panel2: #e7eee6; --line: #c9d4c9; --ink: #16231c; --muted: #4a5b50;
  --accent: #1f6f54; --accent-ink: #fff; --gold: #c98a1f; --ok: #1f6f54; --warn: #8a4d0f; --bad: #b5432d;
  --scene: #b5432d; --character: #2f5fa8; --location: #1f6f54; --shop: #a8680f; --item: #6c3fa0; --faction: #4a5b50; --quest: #b2386f; --note: #5a6a5f;
  --radius: 18px; --bw: 2px; --edge: #16231c; --shadow: 4px 4px 0 #16231c;
  --head: 'Bricolage Grotesque', Inter, sans-serif; --head-w: 800; --head-scale: 1;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--head); font-weight: var(--head-w); letter-spacing: -.005em; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: calc(2rem * var(--head-scale)); } h2 { font-size: calc(1.45rem * var(--head-scale)); } h3 { font-size: calc(1.15rem * var(--head-scale)); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--panel); border: var(--bw) solid var(--line); border-radius: calc(var(--radius) - 6px); padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: var(--bw) solid var(--edge); background: var(--panel); border-radius: calc(var(--radius) - 4px); padding: 8px 14px; font-weight: 500; min-height: 38px; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; min-height: 32px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.muted { color: var(--muted); }
.card { background: var(--panel); border: var(--bw) solid var(--edge); border-radius: var(--radius); box-shadow: var(--shadow); }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; text-transform: capitalize; }
.t-scene { color: var(--scene); } .t-character { color: var(--character); } .t-location { color: var(--location); } .t-shop { color: var(--shop); }
.t-item { color: var(--item); } .t-faction { color: var(--faction); } .t-quest { color: var(--quest); } .t-note { color: var(--note); }
.err { color: var(--bad); min-height: 1.4em; font-size: 14px; }
.md p:first-child { margin-top: 0; } .md img { max-width: 100%; }
.md a.wl { text-decoration: none; border-bottom: 1px dashed var(--accent); }
.md a.wl.missing { color: var(--muted); border-bottom-color: var(--muted); }
.md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--line); padding: 4px 8px; }
.md blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--gold); color: var(--muted); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 99; font-size: 14px; }

/* Map viewer (DM and players) */
.mvStage { position: relative; width: 100%; height: 100%; overflow: hidden; background: #1b1714; touch-action: none; user-select: none; border-radius: 10px; cursor: grab; }
.mvStage:active { cursor: grabbing; }
.mvWorld { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mvImg { display: block; pointer-events: none; max-width: none; }
.mvGrid, .mvMarks, .mvFog, .mvWalls, .mvRuler { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.mvLayer { position: absolute; inset: 0; }
.mvTok { position: absolute; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; border: 3px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.5); cursor: pointer; box-sizing: border-box; font-family: var(--body, sans-serif); line-height: 1; }
.mvTok i { position: absolute; bottom: -2px; right: -2px; font-style: normal; background: #000; color: #fff; border-radius: 99px; padding: 1px 4px; }
.mvTok.hid { opacity: .45; border-style: dashed; }
.mvTok.mine { border-color: #ffd34d; }
.mvTok.sel { outline: 4px solid #ffd34d; outline-offset: 2px; }
.mvPin { position: absolute; transform-origin: 50% 100%; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.mvPinIcon { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.mvPinLbl { background: rgba(0,0,0,.72); color: #fff; font-size: 13px; padding: 1px 7px; border-radius: 99px; white-space: nowrap; margin-top: 2px; }
.mvPin.hid { opacity: .55; }
.mvPin.hid .mvPinLbl::after { content: ' 🔒'; }
.mvSel { position: absolute; border: 2px dashed #ffd34d; background: rgba(255,211,77,.15); pointer-events: none; }
.mvSel.h { border-color: #888; background: rgba(0,0,0,.35); }
.mvZoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.mvZoom button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.6); color: #fff; font-size: 18px; cursor: pointer; }
.mvEmpty { position: absolute; inset: 0; display: grid; place-items: center; color: #ddd; text-align: center; padding: 20px; }
.mvEmpty[hidden], .mvSel[hidden], .mvMove[hidden] { display: none; }
.mvTrap { position: absolute; transform-origin: 50% 50%; width: 30px; height: 30px; border-radius: 50%; background: #b3261e; color: #fff; display: grid; place-items: center; font-size: 16px; font-weight: 700; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.5); cursor: pointer; }
.mvTrap.secret { background: rgba(179,38,30,.75); box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(179,38,30,.5); }
.mvTrap.fired { background: #555; }
.mvTrapR { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed rgba(255,90,79,.8); pointer-events: none; }
.mvMove { position: absolute; z-index: 5; pointer-events: none; background: rgba(20,14,10,.88); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 13px; line-height: 1.35; max-width: 260px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.mvMove b { font-size: 15px; } .mvMove span { color: #e8b04a; } .mvMove .bad { color: #ff8a80; font-weight: 600; } .mvMove .warn { color: #ffb36b; font-weight: 600; }

/* Spell browser (DM and players) */
.spellWrap { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-height: 70vh; }
.spellWrap .itemsList { overflow: auto; padding: 14px; max-height: 80vh; }
.spellWrap .itemDetail { border-left: 1px solid var(--line); overflow: auto; padding: 16px; max-height: 80vh; }
.spellWrap .filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.spellWrap .filters select, .spellWrap .filters input { width: auto; padding: 6px 8px; }
.spellWrap .filters input[data-f=q] { flex: 1; min-width: 160px; }
.spellWrap .irow { display: grid; grid-template-columns: 30px 26px 1fr auto 76px; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.spellWrap .irow:hover { background: var(--panel2); }
.spellWrap .irow.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.spellWrap .irow .r, .spellWrap .irow .price { font-size: 12px; color: var(--muted); }
.spellWrap .crTag { display: inline-block; min-width: 26px; text-align: center; font-size: 12px; font-weight: 600; background: var(--panel2); border-radius: 6px; }
.spRit { display: flex; gap: 4px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); margin: 0; }
.spRit input { width: auto; }
.spellStats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 14px; margin: 10px 0; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spellDesc p { margin: 0 0 8px; }
@media (max-width: 860px) { .spellWrap { grid-template-columns: 1fr; } .spellWrap .itemDetail { border-left: 0; border-top: 1px solid var(--line); } .spellWrap .irow { grid-template-columns: 30px 26px 1fr auto; } .spellWrap .irow .price { display: none; } }
.mvTok.turn { box-shadow: 0 0 0 4px #ffd34d, 0 0 22px 8px rgba(255, 211, 77, .8); animation: mvPulse 1.6s ease-in-out infinite; }
@keyframes mvPulse { 50% { box-shadow: 0 0 0 4px #ffd34d, 0 0 8px 2px rgba(255, 211, 77, .4); } }
/* Dice log */
.diceLog { padding: 12px 14px; }
.dlForm { display: flex; gap: 6px; flex-wrap: wrap; }
.dlForm .dlLabel { flex: 1; min-width: 130px; }
.dlBtns { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 8px; }
.dlList { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow: auto; }
.dlRow { display: flex; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; background: var(--panel2); font-size: 14px; }
.dlRow.secret { outline: 1px dashed var(--muted); background: transparent; }
.dlTot { font-family: var(--head); font-weight: 700; font-size: 20px; min-width: 36px; text-align: center; }

:root[data-look="field"] .btn.primary, :root[data-look="field"] .btn:not(.ghost) { border-color: #16231c; }
:root[data-look="field"] .btn.primary { font-weight: 700; }
:root[data-look="field"] input, :root[data-look="field"] select, :root[data-look="field"] textarea { border-color: #8fa596; }
:root[data-look="arcane"] h1 { letter-spacing: .01em; }
/* Look picker */
.lookGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lookOpt { border: 2px solid transparent; border-radius: 16px; padding: 0; overflow: hidden; cursor: pointer; text-align: left; font: inherit; }
.lookOpt.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.lookOpt .sw { height: 72px; display: flex; gap: 6px; padding: 10px; }
.lookOpt .sw span { border-radius: 8px; }
.lookOpt .nm { padding: 8px 12px 10px; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--panel2); display: inline-grid; place-items: center; font-family: var(--head); font-weight: var(--head-w); color: var(--muted); flex: none; overflow: hidden; }
:root[data-look="field"] .avatar { border-radius: 30%; border: 2px solid #16231c; }
/* Portraits and party cards */
.ptBox { width: min(420px, 100%); max-height: 92vh; overflow: auto; padding: 18px; }
.ptFrame { position: relative; overflow: hidden; border-radius: 50%; margin: 0 auto; background: var(--panel2); touch-action: none; cursor: grab; box-shadow: 0 0 0 3px var(--accent); }
.ptFrame img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; pointer-events: none; }
.ptZoom { width: 100%; margin-top: 14px; padding: 0; }
.ptBox:has(.ptCard) { padding: 0; overflow: hidden; }
.ptCard { position: relative; }
.ptBand { height: 110px; }
.ptAva { position: absolute; left: 20px; top: 58px; }
.ptFacts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.partyRow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: var(--bw) solid var(--edge); box-shadow: var(--shadow); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.partyRow:hover { border-color: var(--accent); }
.partyRow.you { box-shadow: 0 0 0 2px var(--accent); }
.partyList { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.youTag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); margin-left: 4px; }

/* Workshop (player crafting and altered spells) */
.wsWrap { max-width: 820px; margin: 0 auto; padding: 28px 16px 80px; }
.wsRoot h1 { font-size: clamp(26px, 5vw, 36px); margin: 4px 0; }
.wsRoot h2 { font-size: 20px; margin: 28px 0 10px; }
.wsRoot .box { padding: 14px 16px; margin-bottom: 10px; }
.wsRoot .bar { height: 10px; border-radius: 99px; background: var(--panel2); overflow: hidden; margin: 8px 0 4px; }
.wsRoot .bar > div { height: 100%; background: var(--accent); transition: width .3s; }
.wsRoot .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wsRoot .row input[type=number] { width: 140px; }
.wsRoot .row label { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); margin: 0; }
.wsRoot .row label input { width: auto; }
.wsRoot .need { font-size: 14px; }
.wsRoot .need .ok { color: var(--ok); } .need .no { color: var(--bad); }
.wsRoot .log { font-size: 13px; color: var(--muted); margin-top: 8px; max-height: 180px; overflow: auto; }
.wsRoot .log div { padding: 3px 0; border-top: 1px solid var(--line); }
.wsRoot .tag { font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); }
.wsRoot .done { color: var(--ok); border-color: var(--ok); }
.wsRoot .comp { color: var(--warn); }
.wsRoot .rune { width: 100%; max-width: 360px; display: block; margin: 0 auto 8px; color: var(--ink); }
.wsRoot .mods label { display: flex; gap: 8px; align-items: flex-start; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); margin: 6px 0; }
.wsRoot .mods label input { width: auto; margin-top: 3px; }
.wsRoot .mods label.off { opacity: .45; }
.wsRoot .preview { background: var(--panel2); border-radius: 9px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.wsRoot .facts span { margin-right: 14px; display: inline-block; }
.spellRune { max-width: 280px; margin: 0 auto 8px; color: var(--ink); --rune-line: var(--ink); --rune-glyph: #7a1f2b; }
html[data-look=arcane] .spellRune { --rune-glyph: #e3b95b; }
.spellRune svg { width: 100%; height: auto; display: block; }
.mySpellsBox { padding: 10px 14px; margin-bottom: 14px; } .mySpellsBox summary { cursor: pointer; } .mySpellsBox[open] summary { margin-bottom: 8px; }

/* One tab style everywhere: a quiet row with an underline on the open tab (the main menus keep their pills). */
html .tabs:not(.mainTabs) { display: flex; flex-wrap: wrap; gap: 4px 20px; background: transparent; padding: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
html .tabs:not(.mainTabs) .tab { padding: 8px 2px 7px; border-radius: 0; border: 0; border-bottom: 3px solid transparent; background: transparent; box-shadow: none; color: var(--muted); font-weight: 500; margin-bottom: -1px; }
html .tabs:not(.mainTabs) .tab:hover { color: var(--ink); }
html .tabs:not(.mainTabs) .tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); background: transparent; box-shadow: none; }
/* Things on the map: ladders, stairs, crates, chests, levers, things to look at */
.mvObj { position: absolute; border-radius: 30%; background: rgba(28,22,17,.82); color: #f3e3c3; border: 2px solid #c9a46a; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.45); transition: transform .12s; }
.mvObj svg { width: 70%; height: 70%; }
.mvObj:hover { transform: scale(1.08); }
.mvObj.end { border-style: dashed; opacity: .9; }
.mvObj.t-ladder, .mvObj.t-stairs { border-color: #7fc4ff; color: #d6ecff; }
.mvObj.t-lever { border-color: #b9a7ff; color: #e6deff; }
.mvObj.t-note { border-color: #e8d48a; color: #fff4c8; }
.mvObj.opened { opacity: .65; }
.mvObj.hid { opacity: .5; border-style: dotted; }
.mvObj.sel { box-shadow: 0 0 0 3px #fff, 0 2px 10px rgba(0,0,0,.5); }
/* The card a player sees when using a door or a thing on the map */
.mpSheet { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; width: min(400px, calc(100vw - 24px)); background: var(--panel, #fffaf2); color: var(--ink, #2a1e14); border: 1px solid var(--line, #e5d9c5); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.35); padding: 16px 18px; animation: mpUp .18s ease-out; }
@keyframes mpUp { from { transform: translate(-50%, 16px); opacity: 0; } }
.mpSheet h4 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.mpSheet h4 svg { width: 22px; height: 22px; }
.mpSheet p { margin: 4px 0 10px; }
.mpSheet .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mpSheet .row input { width: 90px; }
.mpSheet .mpX { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 20px; color: var(--muted, #8a7a66); cursor: pointer; }
.mpSheet .loot { background: var(--panel2, #f3eadb); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }
.mpSheet.ok { border-top: 4px solid #3d7a3d; } .mpSheet.bad { border-top: 4px solid #a33a3a; }

/* Campaign cards (DM picker and players' My campaigns) */
.cpWrap { max-width: 1180px; margin: 0 auto; padding: 8px 4px 40px; }
.cpHead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 10px 0 20px; }
.cpHead h1 { margin: 0; }
.cpHead p { margin: 4px 0 0; }
.cpHead .btn { display: inline-flex; align-items: center; gap: 6px; }
.cpHead .btn .ico { width: 16px; height: 16px; }
.cpGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.cpCard { display: flex; flex-direction: column; text-align: left; text-decoration: none; color: var(--ink); background: var(--panel); border: var(--bw) solid var(--line); border-radius: 18px; overflow: hidden; font: inherit; padding: 0; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.cpCard:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,.18); border-color: var(--accent); }
.cpCover { position: relative; aspect-ratio: 16 / 8; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; }
.cpInit { font-family: var(--serif, Georgia, serif); font-size: 46px; color: rgba(255,255,255,.85); letter-spacing: .04em; }
.cpScene { position: absolute; left: 12px; bottom: 12px; background: rgba(20,16,12,.72); color: #f3e8d6; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(3px); }
.cpBody { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cpBody h3 { margin: 0; font-size: 20px; }
.cpDesc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.cpFoot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.cpAv { display: flex; }
.cpAv .avatar { border: 2px solid var(--panel); margin-left: -8px; }
.cpAv .avatar:first-child { margin-left: 0; }
.cpStats { font-size: 13px; color: var(--muted); }
.cpWhen { font-size: 12px; color: var(--muted); }
.cpAdd { border-style: dashed; }
.cpAdd .cpCover { background: var(--panel2); flex-direction: column; gap: 8px; color: var(--muted); font-size: 14px; }
.cpAdd .cpCover .ico { width: 36px; height: 36px; }
@media (max-width: 860px) { .cpGrid { grid-template-columns: 1fr; } }
.cpMine { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.cpAv:empty { display: none; }
/* ---------- Spell icons (spellicons.js) and the spell card ---------- */
.si { width: 100%; height: 100%; display: block; }
.sSchool { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 30%; color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent); }
.sSchool.sm { width: 22px; height: 22px; padding: 3px; }
.sSchool.md { width: 30px; height: 30px; padding: 4px; }
.sSchool.lg { width: 58px; height: 58px; padding: 9px; border-radius: 18px; border-width: 2px; box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 30%, transparent); }
.sTags { display: inline-flex; gap: 3px; align-items: center; flex-wrap: wrap; vertical-align: middle; }
.sTag { display: inline-flex; align-items: center; gap: 2px; height: 22px; min-width: 22px; padding: 3px; border-radius: 7px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.sTag .si { width: 16px; height: 16px; }
.sTag.save b { font-size: 10px; letter-spacing: .02em; padding-right: 2px; color: var(--ink); }
.spellCard { border-top: 4px solid var(--sc); padding-top: 12px; }
.spHead { display: flex; gap: 14px; align-items: flex-start; }
.spHead .sTags { margin-top: 8px; }
.spellCard .dice { font-weight: 700; color: var(--sc); white-space: nowrap; }
.concTag { display: inline-block; font-size: 11px; font-weight: 700; color: #b9771a; background: color-mix(in srgb, #e8a33d 18%, var(--panel)); border-radius: 6px; padding: 0 6px; margin-right: 2px; }
.spUp { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--sc) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--sc) 25%, var(--line)); }
.spUp > b { display: inline-flex; align-items: center; gap: 6px; }
.spUp p { margin: 6px 0; font-size: 14px; }
.spUpRow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.spUpRow span { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 4px 8px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.spUpRow span small { font-weight: 500; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.spUpRow span.now { border-color: var(--sc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc) 35%, transparent); }
.spFun { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--gold, #c4952a) 10%, var(--panel)); border: 1px dashed color-mix(in srgb, var(--gold, #c4952a) 45%, var(--line)); }
.spFunHead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.spFun ul { margin: 6px 0 8px; padding-left: 20px; }
.spFun li { margin: 3px 0; font-size: 14px; }
.spQuip { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--sc); font-style: italic; font-family: var(--head); font-size: 15px; }
.spFunOff { display: none; margin: 8px 0; }
.noSpellFun .spFun { display: none; }
.noSpellFun .spFunOff { display: block; }
.linkBtn { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 4px; text-decoration: underline; text-underline-offset: 2px; }
.spLegendModal { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; }
.spLegendBox { width: min(620px, 100%); max-height: 88vh; overflow: auto; padding: 18px 20px; }
.sLegend h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sLeg { display: grid; grid-template-columns: 32px 130px 1fr; gap: 8px; align-items: center; padding: 3px 0; font-size: 14px; }
.sLeg small { color: var(--muted); }
.sDmgRow { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.sDmgLeg { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; text-transform: capitalize; }
.irow .sSchool { margin-right: 6px; }
.irow .r .sTags { justify-content: flex-end; }

/* ---- pixel character builder (ShopScene.builder) ---- */
.ssB { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 8px; }
.ssBPrev { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ssBPrev canvas { width: 72px; height: 108px; image-rendering: pixelated; background: var(--bg); border-radius: 8px; padding: 6px; }
.ssBGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 10px; }
.ssBGrid label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; text-transform: none; letter-spacing: 0; margin: 0; }
.ssBGrid select { font-size: 13px; padding: 5px 6px; }
@media (max-width: 560px) { .ssB { grid-template-columns: 1fr; } }
