/* ===== Tokens: light = "wanted poster" parchment (bare :root) ===== */
  :root{
    /* Light "wanted-poster" parchment — same brand hues as bloodprairie.com */
    --bg:#E6DAC1; --surface:#EFE6D0; --surface-2:#F5EEDC; --sunk:#DCCEB0;
    --line:rgba(92,60,28,.22); --line-strong:rgba(92,60,28,.44);
    --ink:#2A2013; --heading:#241A0F; --muted:#6E5A3C; --faint:#8A7550; --gold:#8A6A2E;
    --accent:#8B1A1A; --accent-2:#6E1212; --accent-ink:#F5EEDC;
    --amber:#96610F; --heal:#4E6B2E; --danger:#8B1A1A;
    --shadow:0 1px 0 rgba(92,60,28,.14);
    --radius:3px;
    color-scheme:light;
  }
  @media (prefers-color-scheme:dark){
    :root:not([data-theme="light"]){
      --bg:#0D0A07; --surface:#1C1712; --surface-2:#241C14; --sunk:#0A0705;
      --line:rgba(201,169,110,.16); --line-strong:rgba(201,169,110,.36);
      --ink:#D4C5A9; --heading:#E8D5B0; --muted:#A08B63; --faint:#7C6A48; --gold:#C9A96E;
      --accent:#8B1A1A; --accent-2:#B22222; --accent-ink:#E8D5B0;
      --amber:#C9962E; --heal:#8FA857; --danger:#C4443B;
      --shadow:0 1px 0 rgba(0,0,0,.5);
      color-scheme:dark;
    }
  }
  :root[data-theme="dark"]{
    --bg:#0D0A07; --surface:#1C1712; --surface-2:#241C14; --sunk:#0A0705;
    --line:rgba(201,169,110,.16); --line-strong:rgba(201,169,110,.36);
    --ink:#D4C5A9; --heading:#E8D5B0; --muted:#A08B63; --faint:#7C6A48; --gold:#C9A96E;
    --accent:#8B1A1A; --accent-2:#B22222; --accent-ink:#E8D5B0;
    --amber:#C9962E; --heal:#8FA857; --danger:#C4443B;
    --shadow:0 1px 0 rgba(0,0,0,.5);
    color-scheme:dark;
  }

  *{box-sizing:border-box}
  html,body{margin:0}
  body{
    background:var(--bg); color:var(--ink);
    font-family:"IM Fell English",Georgia,serif; font-size:16px; line-height:1.5;
    -webkit-text-size-adjust:100%;
    padding-bottom:calc(96px + env(safe-area-inset-bottom));
    overflow-x:hidden;
  }
  .wrap{max-width:680px; margin:0 auto; padding:0 14px}

  h1,h2,h3{margin:0; text-wrap:balance}
  .lbl{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.10em; font-weight:600}
  .display{font-family:"Playfair Display",Georgia,serif; font-weight:400; letter-spacing:.01em}
  button{font-family:"Courier Prime",ui-monospace,monospace; cursor:pointer; color:inherit}
  input,select,textarea{font-family:"IM Fell English",Georgia,serif; color:inherit}
  a{color:var(--gold)}

  /* ===== Masthead / top bar ===== */
  .topbar{
    position:sticky; top:0; z-index:40; background:var(--surface);
    border-bottom:1px solid var(--line);
    box-shadow:0 1px 0 var(--line);
  }
  .topbar .wrap{display:flex; align-items:center; gap:12px; min-height:60px; padding-top:8px; padding-bottom:8px}
  .blacksun{
    width:34px; height:34px; border-radius:50%; flex:0 0 auto;
    background:radial-gradient(circle at 50% 50%, #05060a 0 52%, transparent 53%),
               radial-gradient(circle at 50% 50%, var(--accent) 0 60%, transparent 68%);
    box-shadow:0 0 14px -2px var(--accent);
  }
  .brand{display:flex; flex-direction:column; line-height:1; gap:3px}
  .brand .t{font-family:"Playfair Display",Georgia,serif; font-size:23px; font-weight:900; color:var(--heading); line-height:1}
  .brand .s{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.26em; font-size:10px; color:var(--gold); font-weight:700}
  .topbar .spacer{flex:1}
  .iconbtn{
    background:transparent; border:1px solid var(--line); border-radius:2px;
    width:40px; height:40px; display:inline-flex; align-items:center; justify-content:center;
    font-size:18px; color:var(--ink);
  }
  .iconbtn:hover{border-color:var(--line-strong)}
  .backbtn{
    background:transparent; border:none; color:var(--muted); font-size:14px;
    text-transform:uppercase; letter-spacing:.12em; font-weight:600; padding:6px 2px;
    display:inline-flex; align-items:center; gap:6px;
  }
  .backbtn:hover{color:var(--accent)}

  /* ===== Buttons ===== */
  .btn{
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    border:1px solid var(--line-strong); background:var(--surface-2); color:var(--ink);
    border-radius:2px; padding:11px 16px; font-size:14px; font-weight:600;
    text-transform:uppercase; letter-spacing:.08em;
  }
  .btn:hover{border-color:var(--accent)}
  .btn.primary{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
  .btn.primary:hover{background:var(--accent-2); border-color:var(--accent-2)}
  .btn.ghost{background:transparent; color:var(--gold); border-color:var(--gold)}
  .btn.ghost:hover{border-color:var(--gold); background:color-mix(in srgb,var(--gold) 12%,transparent)}
  .btn.danger{color:var(--danger); border-color:color-mix(in srgb, var(--danger) 50%, var(--line))}
  .btn.danger:hover{background:color-mix(in srgb, var(--danger) 14%, transparent); border-color:var(--danger)}
  .btn.block{width:100%}
  .btn.sm{padding:7px 11px; font-size:12px}

  /* ===== Roster ===== */
  .roster-head{display:flex; align-items:baseline; justify-content:space-between; margin:22px 2px 12px}
  .roster-head .count{color:var(--muted); font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.12em; font-size:12px}
  .roster{display:flex; flex-direction:column; gap:12px}
  .ccard{
    display:block; width:100%; text-align:left; background:var(--surface); border:1px solid var(--line);
    border-top:3px solid var(--accent); border-radius:var(--radius); padding:14px 16px;
    box-shadow:var(--shadow);
  }
  .ccard:hover{border-color:var(--line-strong); box-shadow:0 0 0 1px color-mix(in srgb,var(--gold) 22%,transparent)}
  .ccard .name{font-family:"Playfair Display",Georgia,serif; font-size:21px; font-weight:700; color:var(--heading); line-height:1.1}
  .ccard .meta{color:var(--muted); font-size:13px; margin-top:3px}
  .ccard .chips{display:flex; flex-wrap:wrap; gap:6px 8px; margin-top:11px}
  .minichip{
    font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; letter-spacing:.06em; text-transform:uppercase;
    background:var(--sunk); border:1px solid var(--line); border-radius:2px; padding:3px 7px; color:var(--muted);
    display:inline-flex; gap:5px; align-items:baseline; font-variant-numeric:tabular-nums;
  }
  .minichip b{color:var(--ink); font-weight:600}
  .minichip.warn{color:var(--amber); border-color:color-mix(in srgb,var(--amber) 45%,var(--line))}

  .empty{
    text-align:center; color:var(--muted); padding:48px 16px; border:1px dashed var(--line);
    border-radius:3px; margin-top:14px; background:var(--surface);
  }
  .empty .big{font-family:"Playfair Display",Georgia,serif; font-size:24px; font-weight:900; color:var(--heading); margin-bottom:8px}
  .newrow{display:flex; gap:10px; justify-content:center; flex-wrap:wrap}

  /* ===== Sheet ===== */
  .sheet{padding-top:14px; display:flex; flex-direction:column; gap:16px}
  .card{background:var(--surface); border:1px solid var(--line); border-top:2px solid var(--accent); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden}
  .card > .card-h{
    display:flex; align-items:center; gap:8px; padding:11px 14px; border-bottom:1px solid var(--line);
    background:var(--surface-2);
  }
  .card-h .ttl{font-family:"Playfair Display",Georgia,serif; letter-spacing:.01em; font-size:17px; font-weight:700; color:var(--heading)}
  .card-h .ttl .dot{color:var(--accent); margin-right:7px}
  .card-h .aside{margin-left:auto; font-family:"Courier Prime",ui-monospace,monospace; font-size:12px; letter-spacing:.06em; color:var(--muted); text-transform:uppercase}
  .card-b{padding:14px}

  /* character name display in sheet */
  .idhead{padding:16px 14px 6px}
  .idhead input.namefield{
    font-family:"Playfair Display",Georgia,serif; font-size:26px; width:100%; background:transparent; border:none;
    border-bottom:1px dashed var(--line); padding:2px 0 6px; color:var(--ink);
  }
  .idhead input.namefield:focus{outline:none; border-bottom-color:var(--accent)}

  .field{display:flex; flex-direction:column; gap:5px}
  .field > label{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.10em; font-size:11px; color:var(--muted); font-weight:600}
  .grid2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
  .grid3{display:grid; grid-template-columns:repeat(auto-fit,minmax(96px,1fr)); gap:12px}
  input[type=text], select, textarea{
    background:var(--sunk); border:1px solid var(--line); border-radius:2px; padding:9px 10px;
    font-size:15px; width:100%;
  }
  input[type=text]:focus, select, textarea:focus{outline:none}
  input[type=text]:focus, select:focus, textarea:focus{border-color:var(--accent)}
  select{-webkit-appearance:none; appearance:none;
    background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
    background-position:calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size:5px 5px,5px 5px; background-repeat:no-repeat;
    padding-right:30px;}
  textarea{resize:vertical; min-height:66px; line-height:1.45}
  textarea.quirk-para{min-height:104px; font-family:"IM Fell English",Georgia,serif; font-size:15px; line-height:1.5}

  /* ===== Ability blocks ===== */
  .abilities{display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:14px}
  @media (max-width:359px){ .abilities{grid-template-columns:1fr} }
  .abil{
    background:var(--surface-2); border:1px solid var(--line); border-radius:3px; padding:10px 11px;
    display:flex; flex-direction:column; gap:8px; position:relative; min-width:0;
    container-type:inline-size; /* so the Score/Current rows can restack when the card is narrow */
  }
  .abil .top{display:flex; align-items:center; justify-content:space-between; gap:6px; min-width:0}
  .abil .aname{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.10em; font-size:13px; font-weight:600; flex:1 1 auto; min-width:0}
  .abil .aname small{display:block; font-size:9px; letter-spacing:.08em; color:var(--faint); font-weight:400}
  .abil .mod{
    font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-size:26px; line-height:1; color:var(--accent-2);
    font-variant-numeric:tabular-nums; min-width:38px; text-align:right; flex:0 0 auto;
  }
  .abil.depleted .mod{color:var(--amber)}
  .stepper{display:flex; align-items:center; gap:0; border:1px solid var(--line); border-radius:2px; overflow:hidden; background:var(--sunk)}
  .stepper button{
    flex:0 0 auto; width:32px; height:32px; border:none; background:transparent; font-size:18px; font-weight:700; color:var(--ink); line-height:1;
    display:flex; align-items:center; justify-content:center;
  }
  .stepper button:hover{background:color-mix(in srgb,var(--accent) 18%,transparent); color:var(--accent)}
  .stepper .val{
    flex:1 1 auto; text-align:center; font-family:"Courier Prime",ui-monospace,monospace; font-weight:600; font-size:16px;
    font-variant-numeric:tabular-nums; min-width:0; border-left:1px solid var(--line); border-right:1px solid var(--line);
    padding:0 4px; line-height:32px;
  }
  .abil .row2{display:flex; align-items:center; gap:8px; justify-content:space-between; min-width:0}
  .abil .row2 .stepper{flex:1 1 auto; min-width:0}
  .abil .row2 .k{flex:0 0 auto}
  .abil .row2 .k{font-family:"Courier Prime",ui-monospace,monospace; font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted)}
  /* When the card is squeezed, flow the Score/Current label onto its own line above the control. */
  @container (max-width:182px){
    .abil .row2{flex-direction:column; align-items:stretch; gap:4px}
    .abil .row2 .stepper{width:100%}
  }
  .abil .curwrap{display:flex; align-items:center; gap:7px}
  .abil .curwrap .cur{font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-size:15px; font-variant-numeric:tabular-nums}
  .abil .curwrap .max{color:var(--faint); font-size:12px}
  .testbtn{
    margin-top:2px; width:100%; border:1px solid var(--line); background:transparent; border-radius:2px;
    padding:6px; font-size:11px; text-transform:uppercase; letter-spacing:.12em; font-weight:600; color:var(--muted);
  }
  .testbtn:hover{color:var(--accent-ink); background:var(--accent); border-color:var(--accent)}

  /* ===== conditions / status ===== */
  .toggles{display:flex; flex-wrap:wrap; gap:8px; padding:14px}
  .toggle{
    display:inline-flex; align-items:center; gap:7px; border:1px solid var(--line); background:var(--sunk);
    border-radius:2px; padding:7px 13px; font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase;
    letter-spacing:.07em; font-size:12px; font-weight:600; color:var(--muted); user-select:none;
  }
  .toggle .mk{width:12px; height:12px; border-radius:50%; border:1.5px solid var(--line-strong)}
  .toggle[aria-pressed="true"]{color:var(--accent-ink); background:var(--accent); border-color:var(--accent)}
  .toggle[aria-pressed="true"] .mk{background:var(--accent-ink); border-color:var(--accent-ink)}
  .toggle.warnmk[aria-pressed="true"]{background:var(--amber); border-color:var(--amber); color:#160b02}

  .statline{display:flex; align-items:center; gap:10px; padding:0 14px 14px; flex-wrap:wrap}
  .gauge{
    display:flex; align-items:center; gap:9px; background:var(--surface-2); border:1px solid var(--line);
    border-radius:2px; padding:8px 12px;
  }
  .gauge .g-k{font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted)}
  .gauge .g-v{font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-variant-numeric:tabular-nums}
  .gauge.enc{color:var(--amber); border-color:color-mix(in srgb,var(--amber) 45%,var(--line))}

  /* ===== weapons + gear tables ===== */
  .rows{display:flex; flex-direction:column; gap:8px; padding:14px}
  .wrow{
    background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:10px; display:flex; flex-direction:column; gap:8px;
  }
  .wrow .wtop{display:flex; gap:8px; align-items:center}
  .wrow .wtop input{font-weight:600}
  .wrow .watk{flex:0 0 auto; border:1px solid var(--line-strong); background:transparent; color:var(--gold); border-radius:2px;
    padding:0 9px; height:34px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap}
  .wrow .watk:hover{border-color:var(--gold); background:color-mix(in srgb,var(--gold) 12%,transparent)}
  .wmeta{display:flex; gap:8px; align-items:center}
  .wmeta .wslots{margin-left:auto; font-family:"Courier Prime",ui-monospace,monospace; font-size:10px; text-transform:uppercase; letter-spacing:.07em; color:var(--faint); white-space:nowrap}
  .wmeta .wslots.over{color:var(--amber)}
  .seg-mini{display:flex; border:1px solid var(--line); border-radius:2px; overflow:hidden; flex:0 0 auto}
  .seg-mini button{border:none; background:var(--sunk); padding:7px 12px; font-family:"Courier Prime",ui-monospace,monospace;
    font-size:11px; text-transform:uppercase; letter-spacing:.05em; font-weight:700; color:var(--muted); border-right:1px solid var(--line)}
  .seg-mini button:last-child{border-right:none}
  .seg-mini button[aria-pressed="true"]{background:var(--accent); color:var(--accent-ink)}
  .wpreset{flex:1; padding:7px 26px 7px 9px; font-size:13px}
  .wrow .bands{display:grid; grid-template-columns:repeat(4,1fr); gap:6px}
  .wrow .bands .field label{font-size:9px}
  .wrow .bands input{padding:6px 7px; font-size:13px; text-align:center}
  .wrow .special input{font-size:13px; padding:6px 8px}
  .delrow{flex:0 0 auto; width:34px; height:34px; border:1px solid var(--line); background:transparent; border-radius:2px; color:var(--muted); font-size:16px}
  .delrow:hover{color:var(--danger); border-color:var(--danger)}

  .gearcols{display:grid; grid-template-columns:1fr 1fr; gap:14px; padding:14px}
  .gearlist{display:flex; flex-direction:column; gap:6px}
  .gearlist .gh{display:flex; align-items:baseline; justify-content:space-between; margin-bottom:2px}
  .gearlist .gh .lbl{font-size:11px; letter-spacing:.10em; color:var(--muted)}
  .gearlist .gh .slots{font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; color:var(--faint); font-variant-numeric:tabular-nums}
  .gearlist .gh .slots.over{color:var(--amber)}
  .gitem{display:flex; gap:6px; align-items:center}
  .gitem input{padding:7px 9px; font-size:14px}
  .gitem .n{font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; color:var(--faint); width:20px; text-align:right; flex:0 0 auto; font-variant-numeric:tabular-nums}
  .gitem .rm{flex:0 0 auto; width:28px; height:28px; border:none; background:transparent; color:var(--faint); font-size:15px; border-radius:2px}
  .gitem .rm:hover{color:var(--danger)}
  .gitem .mv{flex:0 0 auto; width:28px; height:28px; border:1px solid var(--line); background:transparent; color:var(--muted); font-size:15px; font-weight:700; line-height:1; border-radius:2px}
  .gitem .mv:hover{color:var(--gold); border-color:var(--gold); background:color-mix(in srgb,var(--gold) 12%,transparent)}
  .addline{margin-top:4px}
  .addline button{width:100%; border:1px dashed var(--line); background:transparent; color:var(--muted); border-radius:2px; padding:8px; font-size:12px; text-transform:uppercase; letter-spacing:.10em; font-weight:600}
  .addline button:hover{border-color:var(--accent); color:var(--accent)}
  @media (max-width:520px){ .gearcols{grid-template-columns:1fr} }

  /* ===== combat quick rolls ===== */
  .quickrolls{display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:14px 14px 4px}
  .qr{
    border:1px solid var(--line); background:var(--surface-2); border-radius:2px; padding:10px; text-align:left;
    display:flex; flex-direction:column; gap:2px;
  }
  .qr:hover{border-color:var(--accent)}
  .qr .qn{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.07em; font-size:12px; font-weight:600}
  .qr .qf{font-size:11px; color:var(--muted)}

  /* ===== mount ===== */
  .mountstats{display:grid; grid-template-columns:repeat(3,1fr); gap:8px; padding:0 14px 14px}
  .mstat{background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:8px; text-align:center; display:flex; flex-direction:column; gap:6px; align-items:center}
  .mstat .mk2{font-family:"Courier Prime",ui-monospace,monospace; font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)}
  .mstat .mv{font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-size:15px; font-variant-numeric:tabular-nums}
  .mstat .mv small{color:var(--faint); font-weight:400; font-size:11px}

  /* ===== perks / miracles ===== */
  .perkhint{padding:16px 14px; color:var(--muted); font-size:14px; line-height:1.5}
  .perksub{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.12em; font-size:10px; color:var(--faint); padding:12px 14px 0}
  .perklist{display:flex; flex-direction:column; gap:8px; padding:14px}
  .perksub + .perklist{padding-top:8px}
  .perk{display:flex; gap:11px; text-align:left; align-items:flex-start; width:100%;
    background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:11px 12px}
  .perk:hover{border-color:var(--line-strong)}
  .perk .pcheck{flex:0 0 auto; width:19px; height:19px; border-radius:2px; border:1.5px solid var(--line-strong); margin-top:1px; position:relative}
  .perk[aria-pressed="true"]{border-color:var(--accent); background:color-mix(in srgb,var(--accent) 10%,var(--surface-2))}
  .perk[aria-pressed="true"] .pcheck{background:var(--accent); border-color:var(--accent)}
  .perk[aria-pressed="true"] .pcheck::after{content:"✓"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    color:var(--accent-ink); font-size:12px; font-weight:700; font-family:"Courier Prime",ui-monospace,monospace}
  .perk .ptext{display:flex; flex-direction:column; gap:3px; min-width:0}
  .perk .ptext b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.04em; font-size:13px; font-weight:600; color:var(--ink)}
  .perk .ptext span{font-size:13px; color:var(--muted); line-height:1.42}
  .miraclelist{display:flex; flex-direction:column; gap:8px; padding:14px}
  .miracle{display:flex; gap:11px; align-items:center; justify-content:space-between;
    background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:11px 12px}
  .miracle .mtext{display:flex; flex-direction:column; gap:3px; min-width:0}
  .miracle .mtext b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.04em; font-size:13px; font-weight:600; color:var(--ink)}
  .miracle .mtext span{font-size:13px; color:var(--muted); line-height:1.42}
  .miracle .mtest{flex:0 0 auto; border:1px solid var(--accent); background:transparent; color:var(--accent); border-radius:2px;
    padding:8px 11px; font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:600; white-space:nowrap}
  .miracle .mtest:hover{background:var(--accent); color:var(--accent-ink)}
  .spellhdr{padding:14px 14px 0; font-size:10px; color:var(--muted); letter-spacing:.12em}

  /* ===== spell slots ===== */
  .slotlist{display:flex; flex-direction:column; gap:8px; padding:8px 14px 4px}
  .slot{display:flex; gap:11px; align-items:center; justify-content:space-between; background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:11px 12px; min-height:46px}
  .slot.filled{border-left:2px solid var(--accent)}
  .slot.empty{border-style:dashed; justify-content:center}
  .slot .slot-empty{font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; text-transform:uppercase; letter-spacing:.16em; color:var(--faint)}
  .slot .otext{display:flex; flex-direction:column; gap:3px; min-width:0}
  .slot .otext b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.04em; font-size:13px; font-weight:700; color:var(--ink)}
  .slot .otext span{font-size:13px; color:var(--muted); line-height:1.42}
  .slot .oactions{display:flex; align-items:center; gap:8px; flex:0 0 auto}
  .slot .mtest{flex:0 0 auto; border:1px solid var(--accent); background:transparent; color:var(--accent); border-radius:2px; padding:8px 10px; font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; text-transform:uppercase; letter-spacing:.05em; font-weight:700; white-space:nowrap; cursor:pointer}
  .slot .mtest:hover{background:var(--accent); color:var(--accent-ink)}
  .slot .mv{flex:0 0 auto; width:28px; height:28px; border:1px solid var(--line); background:transparent; color:var(--muted); font-size:15px; font-weight:700; line-height:1; border-radius:2px; cursor:pointer}
  .slot .mv:hover{color:var(--gold); border-color:var(--gold); background:color-mix(in srgb,var(--gold) 12%,transparent)}
  .slot.over{border-color:color-mix(in srgb,var(--danger) 55%,var(--line))}
  .slot .otext b .tag{font-size:9px; font-weight:700; letter-spacing:.1em; border-radius:2px; padding:1px 5px; margin-left:4px; vertical-align:1px; color:var(--danger); border:1px solid color-mix(in srgb,var(--danger) 55%,var(--line))}
  .spellbook{border-top:1px solid var(--line); margin-top:6px}
  .spellbook > summary{cursor:pointer; padding:13px 14px; font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase;
    letter-spacing:.10em; font-size:12px; font-weight:600; color:var(--muted); list-style:none; display:flex; align-items:center; gap:9px}
  .spellbook > summary::-webkit-details-marker{display:none}
  .spellbook > summary::before{content:"▸"; color:var(--accent); font-size:11px; transition:transform .15s}
  .spellbook[open] > summary::before{transform:rotate(90deg)}
  .spellbook > summary:hover{color:var(--accent)}
  .spellbook .ptext em{font-style:normal; color:var(--faint); font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; letter-spacing:.03em}

  /* ===== owned perks / spells (sheet shows only what the character has) ===== */
  .ownlist{display:flex; flex-direction:column; gap:8px; padding:14px}
  .ownitem{display:flex; gap:11px; align-items:flex-start; justify-content:space-between; background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:11px 12px}
  .ownitem .otext{display:flex; flex-direction:column; gap:3px; min-width:0}
  .ownitem .otext b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.04em; font-size:13px; font-weight:700; color:var(--ink)}
  .ownitem.bg{border-left:2px solid var(--gold)}
  .ownitem .otext b .tag.gold{color:var(--gold); border:1px solid color-mix(in srgb,var(--gold) 55%,var(--line)); border-radius:2px; padding:1px 5px; margin-left:4px; font-size:9px; font-weight:700; letter-spacing:.08em; vertical-align:1px}
  .abil .exptag{font-family:"Courier Prime",ui-monospace,monospace; font-size:9px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--gold); border:1px solid color-mix(in srgb,var(--gold) 50%,var(--line)); border-radius:2px; padding:0 4px; margin-left:5px}
  .perk.act{align-items:center}
  .perk.act .ptext b{color:var(--accent-2)}
  .ownitem .otext b .tag{font-size:9px; font-weight:700; letter-spacing:.1em; color:var(--gold); border:1px solid color-mix(in srgb,var(--gold) 55%,var(--line)); border-radius:2px; padding:1px 5px; margin-left:4px; vertical-align:1px}
  .ownitem .otext span{font-size:13px; color:var(--muted); line-height:1.42}
  .ownitem .oactions{display:flex; align-items:center; gap:8px; flex:0 0 auto}
  .ownitem .rm{width:30px; height:30px; border:1px solid var(--line); background:transparent; color:var(--muted); border-radius:2px; font-size:14px; flex:0 0 auto}
  .ownitem .rm:hover{color:var(--danger); border-color:var(--danger)}
  .ownitem .mtest{flex:0 0 auto; border:1px solid var(--accent); background:transparent; color:var(--accent); border-radius:2px; padding:8px 10px; font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; text-transform:uppercase; letter-spacing:.05em; font-weight:700; white-space:nowrap}
  .ownitem .mtest:hover{background:var(--accent); color:var(--accent-ink)}
  .addline.pad{padding:0 14px 14px}
  .packrow{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:8px;
    background:color-mix(in srgb,var(--gold) 8%,var(--surface-2)); border:1px dashed var(--line-strong); border-radius:2px; padding:10px 12px}
  .packrow .pk{display:flex; flex-direction:column; gap:2px}
  .packrow .pk b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.06em; font-size:12px; font-weight:700; color:var(--ink)}
  .packrow .pk small{color:var(--faint); font-size:11px}
  .packrow .rm{width:28px; height:28px; border:none; background:transparent; color:var(--faint); font-size:15px; border-radius:2px; flex:0 0 auto}
  .packrow .rm:hover{color:var(--danger)}
  .packcontents{border-top:1px solid var(--line)}

  /* ===== grimoires (expandable books) ===== */
  .gearlist.grimoires{border-top:1px solid var(--line)}
  details.grim{background:var(--surface-2); border:1px solid var(--line); border-left:2px solid var(--gold); border-radius:2px; margin-bottom:8px; overflow:hidden}
  details.grim > summary{list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px; padding:10px 12px}
  details.grim > summary::-webkit-details-marker{display:none}
  details.grim > summary::before{content:"▸"; color:var(--gold); font-size:11px; transition:transform .15s; flex:0 0 auto}
  details.grim[open] > summary::before{transform:rotate(90deg)}
  .grim-name{font-family:"Playfair Display",Georgia,serif; font-weight:700; font-size:15px; color:var(--heading); flex:1 1 auto; min-width:0}
  .grim-rar{font-family:"Courier Prime",ui-monospace,monospace; font-size:9px; text-transform:uppercase; letter-spacing:.1em; color:var(--gold); border:1px solid color-mix(in srgb,var(--gold) 45%,var(--line)); border-radius:2px; padding:1px 5px; flex:0 0 auto}
  .grim-rm{flex:0 0 auto; width:26px; height:26px; border:1px solid var(--line); background:transparent; color:var(--muted); font-size:13px; border-radius:2px}
  .grim-rm:hover{color:var(--danger); border-color:var(--danger)}
  .grim-body{padding:4px 10px 10px; display:flex; flex-direction:column; gap:6px}
  details.grim-item{background:var(--sunk); border:1px solid var(--line); border-radius:2px}
  details.grim-item > summary{list-style:none; cursor:pointer; padding:8px 10px; font-family:"Courier Prime",ui-monospace,monospace; font-size:12px; font-weight:600; color:var(--ink); display:flex; align-items:center; gap:8px}
  details.grim-item > summary::-webkit-details-marker{display:none}
  details.grim-item > summary::after{content:"＋"; margin-left:auto; color:var(--faint); font-size:13px}
  details.grim-item[open] > summary::after{content:"−"}
  .gi-body{padding:0 10px 10px; display:flex; flex-direction:column; gap:8px}
  .gi-meta{font-family:"Courier Prime",ui-monospace,monospace; font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--faint)}
  .gi-body p{margin:0; font-size:14px; line-height:1.5; color:var(--muted)}
  .gi-body .summon-text{font-family:"IM Fell English",Georgia,serif; font-style:italic; color:var(--ink)}
  .grim-item.flat{padding:8px 10px; font-family:"Courier Prime",ui-monospace,monospace; font-size:12px; font-weight:600; color:var(--muted); display:flex; align-items:center; gap:8px; flex-wrap:wrap}
  .gi-tag{font-family:"Courier Prime",ui-monospace,monospace; font-size:9px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; border-radius:2px; padding:1px 5px; flex:0 0 auto; color:var(--muted); border:1px solid var(--line-strong)}
  .gi-tag.spell{color:var(--accent-2); border-color:color-mix(in srgb,var(--accent-2) 45%,var(--line))}
  .gi-tag.summon{color:var(--gold); border-color:color-mix(in srgb,var(--gold) 45%,var(--line))}
  .gi-note{color:var(--faint); font-weight:400; font-size:11px}
  .gi-body .mtest{align-self:flex-start; border:1px solid var(--accent); background:transparent; color:var(--accent); border-radius:2px; padding:7px 10px; font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; text-transform:uppercase; letter-spacing:.05em; font-weight:700; cursor:pointer}
  .gi-body .mtest:hover{background:var(--accent); color:var(--accent-ink)}

  /* ===== picker modal (perks / spells) ===== */
  .picklist{display:flex; flex-direction:column; gap:8px}

  /* ===== equipment shop modal ===== */
  .shopbar{display:flex; align-items:center; justify-content:space-between; gap:10px; position:sticky; top:-16px; z-index:2;
    background:var(--surface); padding:6px 0 10px; margin-top:-4px; border-bottom:1px solid var(--line)}
  .shopbar .cash{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.08em; font-size:12px; color:var(--muted)}
  .shopbar .cash b{color:var(--heading); font-size:16px; font-variant-numeric:tabular-nums}
  .destseg button:disabled{opacity:.38; cursor:not-allowed}
  .shopmsg{font-size:12px; color:var(--muted); padding:9px 0 2px; min-height:16px; line-height:1.4}
  .shopcat{font-family:"Playfair Display",Georgia,serif; font-weight:700; font-size:16px; color:var(--heading); margin:14px 0 7px; padding-bottom:5px; border-bottom:1px solid var(--line)}
  .shoplist{display:flex; flex-direction:column; gap:6px}
  .shopitem{display:flex; align-items:center; justify-content:space-between; gap:10px; background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:9px 11px}
  .shopitem .sitext{display:flex; flex-direction:column; gap:2px; min-width:0}
  .shopitem .sitext b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.03em; font-size:12px; font-weight:700; color:var(--ink)}
  .shopitem .sitext span{font-size:12px; color:var(--muted); line-height:1.35}
  .sactions{display:flex; align-items:center; gap:7px; flex:0 0 auto}
  .sactions .price{font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; color:var(--gold); font-size:13px; min-width:34px; text-align:right; font-variant-numeric:tabular-nums}
  .sactions .take,.sactions .buy{border:1px solid var(--line-strong); background:transparent; border-radius:2px; padding:6px 11px;
    font-family:"Courier Prime",ui-monospace,monospace; font-size:11px; text-transform:uppercase; letter-spacing:.05em; font-weight:700}
  .sactions .take{color:var(--gold)} .sactions .take:hover{border-color:var(--gold); background:color-mix(in srgb,var(--gold) 12%,transparent)}
  .sactions .buy{color:var(--accent-ink); background:var(--accent); border-color:var(--accent)}
  .sactions .buy:hover{background:var(--accent-2); border-color:var(--accent-2)}

  /* ===== floating die + roller ===== */
  .fab{
    position:fixed; right:calc(50% - 340px + 16px); bottom:calc(20px + env(safe-area-inset-bottom)); z-index:55;
    width:60px; height:60px; border-radius:50%; border:1px solid var(--accent-2);
    background:var(--accent); color:var(--accent-ink); font-size:26px; box-shadow:var(--shadow), 0 0 0 4px color-mix(in srgb,var(--accent) 22%,transparent);
    display:flex; align-items:center; justify-content:center;
  }
  @media (max-width:712px){ .fab{right:16px} }
  .fab:hover{background:var(--accent-2)}

  .scrim{position:fixed; inset:0; background:rgba(5,3,2,.55); z-index:60; opacity:0; pointer-events:none; transition:opacity .18s}
  .scrim.open{opacity:1; pointer-events:auto}
  .drawer{
    position:fixed; left:0; right:0; bottom:0; z-index:61; background:var(--surface); border-top:2px solid var(--accent);
    border-radius:4px 4px 0 0; transform:translateY(102%); transition:transform .22s cubic-bezier(.2,.7,.3,1);
    max-width:680px; margin:0 auto; box-shadow:0 -12px 40px rgba(0,0,0,.4); max-height:86vh; display:flex; flex-direction:column;
    padding-bottom:env(safe-area-inset-bottom);
  }
  .drawer.open{transform:translateY(0)}
  .drawer .dh{display:flex; align-items:center; padding:14px 16px 6px}
  .drawer .dh .grip{position:absolute; left:50%; top:8px; transform:translateX(-50%); width:40px; height:4px; border-radius:3px; background:var(--line-strong)}
  .drawer .dh .ttl{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.14em; font-weight:600; font-size:14px}
  .drawer .dh .x{margin-left:auto; background:transparent; border:none; font-size:22px; color:var(--muted); line-height:1}
  .drawer .db{padding:8px 16px 16px; overflow:auto}

  .pickrow{display:flex; gap:8px; align-items:center; margin-bottom:10px; flex-wrap:wrap}
  .pickrow .field{flex:1; min-width:120px}
  .seg{display:flex; border:1px solid var(--line); border-radius:2px; overflow:hidden}
  .seg button{flex:1; border:none; background:var(--sunk); padding:9px 6px; font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:600; color:var(--muted); border-right:1px solid var(--line)}
  .seg button:last-child{border-right:none}
  .seg button[aria-pressed="true"]{background:var(--accent); color:var(--accent-ink)}
  .combos{display:flex; flex-wrap:wrap; gap:7px; margin:4px 0 12px}
  .combos button{border:1px solid var(--line); background:var(--surface-2); border-radius:2px; padding:7px 12px; font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:600; color:var(--muted)}
  .combos button:hover{border-color:var(--accent); color:var(--accent)}

  .result{
    text-align:center; padding:14px; margin:6px 0 12px; border:1px solid var(--line); border-radius:3px; background:var(--surface-2);
    min-height:96px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  }
  .result .rtot{font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-size:48px; line-height:1; font-variant-numeric:tabular-nums}
  .result .rlab{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.10em; font-size:12px; color:var(--muted)}
  .result .rbreak{font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums}
  .result.crit-hi{border-color:var(--heal); background:color-mix(in srgb,var(--heal) 14%,var(--surface-2))}
  .result.crit-hi .rtot{color:var(--heal)}
  .result.crit-lo{border-color:var(--danger); background:color-mix(in srgb,var(--danger) 14%,var(--surface-2))}
  .result.crit-lo .rtot{color:var(--danger)}
  .result .badge{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.12em; font-size:11px; font-weight:700; padding:2px 9px; border-radius:2px}
  .result .injury{font-family:"IM Fell English",Georgia,serif; font-size:14px; line-height:1.4; color:var(--ink); max-width:36ch; margin-top:5px; padding:6px 10px; border-top:1px solid var(--line)}
  .result.crit-hi .badge{background:var(--heal); color:#0d1405}
  .result.crit-lo .badge{background:var(--danger); color:#fff}
  .rollbtn{width:100%; padding:14px; font-size:16px; font-weight:700; letter-spacing:.12em}
  .log{margin-top:12px; display:flex; flex-direction:column; gap:6px}
  .log .lg{display:flex; justify-content:space-between; gap:8px; font-size:13px; color:var(--muted); border-bottom:1px dashed var(--line); padding-bottom:5px}
  .log .lg .lt{font-variant-numeric:tabular-nums; font-family:"Courier Prime",ui-monospace,monospace; font-weight:600; color:var(--ink)}
  .log .lg.hi .lt{color:var(--heal)} .log .lg.lo .lt{color:var(--danger)}

  /* roll toast */
  .toast{
    position:fixed; top:70px; left:50%; transform:translateX(-50%) translateY(-14px); z-index:70;
    background:var(--surface); border:1px solid var(--line-strong); border-left:4px solid var(--accent);
    border-radius:3px; padding:10px 16px; box-shadow:var(--shadow); opacity:0; pointer-events:none; transition:opacity .18s, transform .18s;
    font-family:"Courier Prime",ui-monospace,monospace; display:flex; align-items:center; gap:12px; max-width:calc(100vw - 28px);
  }
  .toast.show{opacity:1; transform:translateX(-50%) translateY(0)}
  .toast .tt{font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted)}
  .toast .tv{font-size:26px; font-weight:700; font-variant-numeric:tabular-nums}
  .toast.hi{border-left-color:var(--heal)} .toast.hi .tv{color:var(--heal)}
  .toast.lo{border-left-color:var(--danger)} .toast.lo .tv{color:var(--danger)}

  /* import/export dialog */
  .modal-scrim{position:fixed; inset:0; background:rgba(5,3,2,.6); z-index:80; display:none; align-items:center; justify-content:center; padding:16px}
  .modal-scrim.open{display:flex}
  #confirmScrim{z-index:90}
  .modal{background:var(--surface); border:1px solid var(--line-strong); border-radius:4px; width:100%; max-width:560px; box-shadow:var(--shadow); max-height:88vh; display:flex; flex-direction:column}
  .modal .mh{display:flex; align-items:center; padding:14px 16px; border-bottom:1px solid var(--line)}
  .modal .mh .ttl{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.12em; font-weight:600; font-size:14px}
  .modal .mh .x{margin-left:auto; background:transparent; border:none; font-size:22px; color:var(--muted)}
  .modal .mb{padding:16px; overflow:auto; display:flex; flex-direction:column; gap:12px}
  .modal textarea{min-height:150px; font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:12px; line-height:1.4}
  .hint{font-size:13px; color:var(--muted); line-height:1.45}
  .modal .actions{display:flex; gap:8px; flex-wrap:wrap}

  .sheet-foot{padding:8px 0 30px; display:flex; justify-content:center; gap:10px; flex-wrap:wrap}

  /* input + inline action button (e.g. Bounty roller) */
  .inrow{display:flex; gap:8px; align-items:stretch}
  .inrow input{flex:1 1 auto; min-width:0}
  .minibtn{flex:0 0 auto; width:42px; border:1px solid var(--line-strong); background:var(--surface-2); color:var(--ink); border-radius:2px; font-size:16px; cursor:pointer}
  .minibtn:hover{border-color:var(--accent); background:color-mix(in srgb,var(--accent) 14%,transparent)}

  /* ===== WANTED poster (fixed parchment look, theme-independent) ===== */
  #wantedScrim{z-index:88}
  .wanted{
    position:relative; width:min(92vw,420px); max-height:92vh; overflow:auto;
    background:#e9dcbf;
    background-image:
      radial-gradient(120% 80% at 50% -10%, rgba(120,80,30,.10), transparent 60%),
      radial-gradient(120% 70% at 50% 120%, rgba(120,80,30,.16), transparent 60%),
      radial-gradient(140% 120% at 50% 50%, transparent 62%, rgba(90,60,25,.20));
    color:#231a10; text-align:center; padding:24px 22px 18px;
    font-family:"Courier Prime",ui-monospace,monospace;
    border:2px solid #231a10;
    box-shadow:0 0 0 6px #e9dcbf, 0 0 0 8px #231a10, 0 26px 64px rgba(0,0,0,.6);
    transform:rotate(-1.2deg);
  }
  #wantedScrim.open .wanted{animation:wantedStamp .3s cubic-bezier(.2,.8,.3,1.25) both}
  @keyframes wantedStamp{from{opacity:0; transform:rotate(-1.2deg) scale(1.18)} to{opacity:1; transform:rotate(-1.2deg) scale(1)}}
  @media (prefers-reduced-motion:reduce){ #wantedScrim.open .wanted{animation:none} }
  .wanted-x{position:absolute; top:6px; right:8px; border:none; background:transparent; color:#5a4526; font-size:20px; line-height:1; cursor:pointer}
  .wanted-x:hover{color:#8b1a1a}
  .wanted-rule{border-top:4px double #231a10; margin:13px 4px}
  .wanted-eyebrow{font-size:10px; letter-spacing:.2em; text-transform:uppercase; color:#6a4e28; font-weight:700}
  .wanted-title{font-family:"Playfair Display",Georgia,serif; font-weight:900; font-size:clamp(46px,14vw,70px); line-height:.86; letter-spacing:.03em; margin-top:2px}
  .wanted-sub{font-size:13px; letter-spacing:.26em; font-weight:700; margin-top:3px; color:#3a2c17}
  .wanted-portrait{width:104px; height:116px; margin:14px auto 10px; border:3px solid #231a10;
    background:linear-gradient(160deg,#dccaa0,#c7b184); display:flex; align-items:center; justify-content:center;
    box-shadow:inset 0 0 0 1px rgba(35,26,16,.35);}
  .wanted-portrait span{font-family:"Playfair Display",Georgia,serif; font-weight:900; font-size:56px; color:#4a3a20; opacity:.55}
  .wanted-name{font-family:"Playfair Display",Georgia,serif; font-weight:700; font-size:clamp(18px,5.5vw,24px); line-height:1.05; text-wrap:balance}
  .wanted-for{font-family:"IM Fell English",Georgia,serif; font-style:italic; font-size:14px; color:#5a4526; margin:6px 0 2px}
  .wanted-crime{font-family:"Playfair Display",Georgia,serif; font-weight:700; font-size:clamp(18px,5.5vw,24px); line-height:1.1; text-wrap:balance}
  .wanted-reward{margin:14px 0 4px}
  .wanted-reward .rw-amt{display:block; font-family:"Playfair Display",Georgia,serif; font-weight:900; font-size:clamp(32px,10vw,48px); color:#8b1a1a; line-height:1}
  .wanted-reward .rw-lbl{display:block; font-size:12px; letter-spacing:.34em; text-transform:uppercase; font-weight:700; color:#231a10; margin-top:2px}
  .wanted-foot{font-size:11px; color:#5a4526; letter-spacing:.04em}
  .wanted-tear{font-style:italic}

  /* ===== Character-creation wizard ===== */
  .wiz{display:flex; flex-direction:column; gap:14px; padding-top:12px; padding-bottom:96px}
  .wiz-head{display:flex; align-items:center; justify-content:space-between}
  .wiz-count{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.12em; font-size:11px; font-weight:700; color:var(--muted)}
  .wiz-bar{height:4px; background:var(--sunk); border:1px solid var(--line); border-radius:2px; overflow:hidden}
  .wiz-bar span{display:block; height:100%; background:var(--accent)}
  .wiz-body{padding:14px; display:flex; flex-direction:column; gap:12px}
  .wiz-hint{font-size:14px; color:var(--muted); line-height:1.5}
  .wiz-hint b{color:var(--ink)}
  .wiz .seg.wiz-seg{}
  .wiz-die{display:flex; flex-direction:column; gap:5px}
  .wiz-die label{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.10em; font-size:11px; color:var(--muted); font-weight:600}
  .wiz-dierow2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
  .wiz input[type=number]{background:var(--sunk); border:1px solid var(--line); border-radius:2px; padding:9px 10px; font-size:15px; color:inherit; font-family:"Courier Prime",ui-monospace,monospace; width:100%}
  .wiz input[type=number]:focus, .wiz input[type=text]:focus{outline:none; border-color:var(--accent)}
  .wiz-name input{background:var(--sunk); border:1px solid var(--line); border-radius:2px; padding:9px 10px; font-size:15px; color:inherit; width:100%}
  .wiz-result{background:var(--surface-2); border:1px solid var(--line); border-left:2px solid var(--accent); border-radius:2px; padding:11px 12px; display:flex; flex-direction:column; gap:4px}
  .wiz-result > b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.04em; font-size:13px; color:var(--ink)}
  .wiz-result > span{font-family:"IM Fell English",Georgia,serif; font-size:14px; color:var(--muted); line-height:1.45}
  .wiz-foot{position:sticky; bottom:0; z-index:5; display:flex; gap:10px; padding:12px 0 calc(14px + env(safe-area-inset-bottom)); background:linear-gradient(transparent, var(--bg) 34%)}
  .wiz-foot .btn{flex:1}

  .wiz-abils{display:flex; flex-direction:column; gap:8px}
  .wiz-abil{display:grid; grid-template-columns:74px 1fr 32px 40px; gap:10px; align-items:center; background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:8px 10px}
  .wiz-abil.set{border-left:2px solid var(--accent)}
  .wa-chip{border:1px solid var(--line-strong); background:var(--sunk); color:var(--ink); border-radius:2px; padding:6px 8px; font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.04em; font-size:12px; font-weight:700; text-align:left; cursor:pointer}
  .wa-chip[disabled]{opacity:.7; cursor:default}
  .wa-chip.sel{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}
  .wa-die{justify-self:end; width:64px; text-align:center}
  .wa-die-show{justify-self:end; font-family:"Courier Prime",ui-monospace,monospace; font-size:12px; color:var(--faint)}
  .wa-score{justify-self:end; font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-size:18px; font-variant-numeric:tabular-nums}
  .wa-mod{justify-self:end; font-family:"Courier Prime",ui-monospace,monospace; font-weight:700; font-size:16px; color:var(--accent-2); font-variant-numeric:tabular-nums}

  .wiz-classes{display:flex; flex-direction:column; gap:8px}
  .wiz-class{text-align:left; display:flex; flex-direction:column; gap:3px; background:var(--surface-2); border:1px solid var(--line); border-radius:2px; padding:11px 13px; cursor:pointer}
  .wiz-class:hover{border-color:var(--line-strong)}
  .wiz-class.on{border-color:var(--accent); border-left:2px solid var(--accent); background:color-mix(in srgb,var(--accent) 10%,var(--surface-2))}
  .wc-name{font-family:"Playfair Display",Georgia,serif; font-weight:700; font-size:16px; color:var(--heading)}
  .wc-best{font-family:"Courier Prime",ui-monospace,monospace; font-size:9px; text-transform:uppercase; letter-spacing:.1em; color:var(--gold); border:1px solid color-mix(in srgb,var(--gold) 55%,var(--line)); border-radius:2px; padding:1px 5px; margin-left:6px; vertical-align:2px}
  .wc-pitch{font-family:"IM Fell English",Georgia,serif; font-style:italic; font-size:13px; color:var(--muted)}

  .wiz-review{background:var(--surface-2); border:1px solid var(--line); border-top:2px solid var(--accent); border-radius:2px; padding:14px; display:flex; flex-direction:column; gap:8px}
  .wr-name{font-family:"Playfair Display",Georgia,serif; font-weight:700; font-size:22px; color:var(--heading); line-height:1.1}
  .wr-sub{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; letter-spacing:.08em; font-size:12px; color:var(--muted)}
  .wr-mods{display:flex; flex-wrap:wrap; gap:6px 14px; margin:2px 0}
  .wr-mods span{font-family:"Courier Prime",ui-monospace,monospace; font-size:13px; color:var(--ink); font-variant-numeric:tabular-nums}
  .wr-mods b{color:var(--muted); font-weight:700; margin-right:3px}
  .wr-line{font-size:14px; color:var(--muted); line-height:1.45}
  .wr-line b{font-family:"Courier Prime",ui-monospace,monospace; text-transform:uppercase; font-size:11px; letter-spacing:.06em; color:var(--faint); margin-right:6px}
  .wr-line.enc{color:var(--amber)}
  .wr-line.enc b{color:var(--amber)}

  :focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:4px}
  @media (prefers-reduced-motion:reduce){ *{transition:none !important} }
