/* Shadowforge — black iron, molten seams, blood moon. */
:root {
  /* Anvil Reign forge palette (same as the studio site), with blood for the Hollow */
  --bg: #050403; --bg2: #0c0907; --iron: #16110d; --iron2: #211a14; --panel: rgba(12, 8, 6, .92); --line: rgba(255, 170, 90, .14); --line2: rgba(255, 170, 90, .28);
  --ink: #f6e8d6; --mute: #c49a78; --dim: #8a6248;
  --moon: #fff3d6; --violet: #ff6a1a; --gold: #ffd27a; --ember: #ff6a1a; --ember2: #ff9a3c; --blood: #a3171c;
  --heat: linear-gradient(100deg, #ff4d0d 0%, #ff8a2a 30%, #ffd27a 55%, #ff8a2a 75%, #ff4d0d 100%);
  --hollow: #e0301e; --warden: #5a96d8; --wanderer: #5cb36c;
  --r: 14px; --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --serif: Cinzel, Georgia, 'Times New Roman', serif; --sans: Inter, 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
body { overflow: hidden; }
button { font: inherit; color: inherit; }
b.t-hollow { color: var(--hollow); } b.t-warden { color: var(--warden); } b.t-wanderer { color: var(--wanderer); }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

.screen { position: fixed; inset: 0; display: none; z-index: 1; }
.screen.active { display: flex; }
#title, #lobby { align-items: center; justify-content: center; padding: 24px 16px; overflow-y: auto; }

/* ------------------------------ buttons ------------------------------ */
.btn { appearance: none; border: 1px solid var(--line2); background: rgba(24, 14, 12, .9); padding: 11px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; letter-spacing: .01em; transition: transform .12s, background .2s, border-color .2s, box-shadow .2s; }
.btn:hover { background: rgba(48, 22, 18, .95); border-color: rgba(201, 162, 74, .6); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.hot { background: linear-gradient(180deg, #ff8a2a, #c2400c); color: #1a0702; border-color: #ffd27a; text-shadow: none; box-shadow: 0 0 22px rgba(201, 162, 74, .35); }
.btn.hot:hover { box-shadow: 0 0 34px rgba(255, 106, 26, .7); }
.btn.ghost { background: transparent; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.danger { border-color: rgba(224, 70, 58, .6); }
.btn.reveal { background: linear-gradient(180deg, #5a0a0c, #1a0304); border-color: #e0301e; color: #ffd9c8; box-shadow: 0 0 18px rgba(224, 48, 30, .5); }
.link { background: none; border: 0; color: var(--gold); text-decoration: underline; cursor: pointer; padding: 0; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(10, 6, 6, .85); cursor: pointer; font-size: 16px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12px; color: var(--mute); letter-spacing: .08em; }

/* ------------------------------ title ------------------------------ */
.title-card, .lobby-card { position: relative; width: min(560px, 100%); padding: 36px 32px 28px; background: linear-gradient(180deg, rgba(20, 10, 10, .92), rgba(6, 3, 4, .95)); border: 1px solid var(--line2); border-radius: 22px; box-shadow: var(--shadow), 0 0 80px rgba(179, 32, 42, .12); text-align: center; margin: auto; }
.moon-mark { width: 92px; height: 92px; margin: -20px auto 8px; border-radius: 50%; background: radial-gradient(circle at 38% 36%, #ff9a6a, #c0391f 55%, #5a0e08); box-shadow: 0 0 40px rgba(220, 60, 30, .7), 0 0 120px rgba(179, 32, 42, .5); position: relative; overflow: hidden; }
.moon-mark::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 70% 40%, rgba(7, 4, 5, .95) 0 42%, transparent 43%); }
.eyebrow { font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--mute); }
.logo { font-family: var(--serif); font-weight: 900; background: linear-gradient(180deg, #e9e2d8, #8a8078 60%, #4a423c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-size: clamp(30px, 8.2vw, 54px); line-height: 1.05; margin: 6px 0 4px; letter-spacing: .02em; white-space: nowrap; filter: drop-shadow(0 0 24px rgba(255, 90, 20, .45)); }
@keyframes flow { to { background-position: 220% 0; } }
.logo span { background: var(--heat); background-size: 220% 100%; animation: flow 7s linear infinite; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo.sm { font-size: 20px; margin: 0; text-shadow: none; }
.tag { font-family: var(--serif); font-size: 17px; color: var(--ember2); margin: 6px 0 12px; }
.blurb { color: var(--mute); margin: 0 auto 22px; max-width: 460px; }
.field { display: block; text-align: left; margin: 0 0 16px; }
.field > span { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); margin-bottom: 6px; }
.field em { font-style: normal; color: var(--gold); letter-spacing: 0; text-transform: none; margin-left: 6px; }
input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(4, 2, 2, .7); color: var(--ink); font: inherit; outline: none; }
input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(179, 32, 42, .25); }
.dice-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.dice-pick button { width: 52px; height: 52px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 2, 2, .6); cursor: pointer; display: grid; place-items: center; }
.dice-pick button img { width: 46px; height: 46px; }
.dice-pick button[aria-checked='true'] { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 162, 74, .45); }
.piece-pick button { width: 60px; height: 60px; } .piece-pick button img { width: 56px; height: 56px; }
.swatches { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 50%, #000)); cursor: pointer; padding: 0; }
.swatches button[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 210, 122, .5); }
.dice-pick .sw { width: 26px; height: 26px; border-radius: 6px; }
.title-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.title-actions.sub { margin-top: 14px; }
.join-row { display: flex; gap: 6px; }
.join-row input { width: 92px; text-transform: uppercase; text-align: center; letter-spacing: .25em; font-weight: 700; }
.status { min-height: 22px; color: var(--ember); margin: 14px 0 0; font-size: 14px; }

/* ------------------------------ lobby ------------------------------ */
.code { font-family: var(--serif); font-size: 64px; font-weight: 900; letter-spacing: .3em; color: var(--gold); text-shadow: 0 0 24px rgba(201, 162, 74, .45); margin: 2px 0 4px; padding-left: .3em; }
.hint { color: var(--mute); font-size: 14px; margin: 6px 0 14px; }
.seats { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; text-align: left; }
.seats li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 2, 2, .5); }
.seats .pawn-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.seats .nm { flex: 1; font-weight: 600; }
.seats .tagx { font-size: 12px; color: var(--dim); }
.seats img { width: 30px; height: 30px; }
.seats .x { background: none; border: 0; color: var(--mute); cursor: pointer; font-size: 18px; }
.seats li.empty { color: var(--dim); border-style: dashed; justify-content: center; }
.lobby-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------ game ------------------------------ */
#game { display: none; }
#game.active { display: block; }
#board { position: absolute; inset: 0; }
#board canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.no-gl { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 8px 14px; border-radius: 10px; color: var(--mute); }
.panel { position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.topbar { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.tb-left { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }
.tb-right { display: flex; gap: 6px; }
.tb-turn { font-family: var(--serif); font-weight: 700; font-size: 16px; padding: 7px 18px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line2); text-align: center; }
.tb-turn.mine { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 22px rgba(201, 162, 74, .35); }

.players { top: 62px; left: 12px; width: 262px; max-height: calc(100% - 300px); overflow-y: auto; padding: 8px; }
.pl { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; cursor: default; }
.pl + .pl { margin-top: 4px; }
.pl.turn { border-color: rgba(201, 162, 74, .55); background: rgba(201, 162, 74, .07); }
.pl.dead { opacity: .55; }
.pl.target { cursor: pointer; border-color: rgba(255, 255, 255, .45); animation: glowpl 1.2s infinite alternate; }
@keyframes glowpl { to { background: rgba(255, 255, 255, .08); } }
.pl .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.pl .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .nm small { font-weight: 500; color: var(--dim); }
.pl .wounds { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--mute); }
.pl .wounds.bad { color: var(--hollow); }
.pl .who { grid-column: 2 / 4; font-size: 12.5px; color: var(--mute); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pl .who .f { font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.pl .who .sigil { width: 13px; height: 13px; }
.pl .items { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px; }
.pl .bar { grid-column: 2 / 4; height: 4px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
.pl .bar i { display: block; height: 100%; background: linear-gradient(90deg, #7a0e10, #ff3a1a); border-radius: 3px; transition: width .5s; }
.it { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); cursor: help; white-space: nowrap; }
.it.blessing { color: #e8c674; border-color: rgba(201, 162, 74, .5); background: rgba(201, 162, 74, .08); }
.it.curse { color: #ffb0a6; border-color: rgba(224, 70, 58, .55); background: rgba(224, 70, 58, .1); }
.f-hollow { color: var(--hollow); } .f-warden { color: var(--warden); } .f-wanderer { color: var(--wanderer); }
.badge.creator { background: var(--heat); background-size: 200% 100%; color: #1a0702; font-weight: 800; }
.badge.founder { background: rgba(255, 210, 122, .14); color: var(--gold); border: 1px solid rgba(255, 210, 122, .4); font-weight: 700; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .07); color: var(--mute); }

.side { top: 62px; right: 12px; width: 330px; bottom: 12px; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 10px; cursor: pointer; color: var(--mute); font-weight: 600; position: relative; }
.tab.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--violet); }
.tab .dot { position: absolute; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); margin-left: 4px; }
.tab-body { display: none; flex: 1; overflow-y: auto; padding: 10px 12px; }
.tab-body.active { display: flex; flex-direction: column; }
#log .e { padding: 4px 0; font-size: 13.5px; color: #cfc3b0; border-bottom: 1px dashed rgba(255, 255, 255, .04); animation: fadein .35s; }
#log .e.turn { color: var(--gold); font-family: var(--serif); font-weight: 700; padding-top: 10px; border: 0; }
#log .e.roll { color: #b8a890; }
#log .e.dmg, #log .e.death { color: #ffb0a6; }
#log .e.heal { color: #a8f0c0; }
#log .e.reveal { color: #fff; font-weight: 700; }
#log .e.secret, #log .e.card.priv { color: #a8f0c0; font-style: italic; }
#log .e.secret::before { content: '🔒 '; }
#log .e.over { color: var(--moon); font-family: var(--serif); font-weight: 700; font-size: 15px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
#chat { justify-content: flex-end; }
#chat-lines { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
#chat-lines .c b { margin-right: 6px; }
#chat-form { display: flex; gap: 6px; margin-top: 8px; }
#chat-form input { padding: 8px 12px; }

.dock { position: absolute; left: 286px; right: 354px; bottom: 12px; display: flex; gap: 10px; align-items: flex-end; pointer-events: none; }
.dock > * { pointer-events: auto; }
.hand { flex: 0 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.actions { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.actions .q { font-family: var(--serif); font-weight: 700; margin-bottom: 8px; }
.actions .opts { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; }
.actions .opts .btn { padding: 8px 14px; font-size: 14px; }
.actions .wait { color: var(--mute); display: flex; align-items: center; gap: 10px; }
.actions .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--violet); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions.mine { border-color: var(--gold); box-shadow: var(--shadow), 0 0 30px rgba(201, 162, 74, .22); }
.actions .free { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* my character, small */
.mini { width: 150px; border-radius: 12px; overflow: hidden; border: 2px solid var(--line2); background: #0d0b12; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s; }
.mini:hover { transform: translateY(-4px); }
.mini .portrait-wrap { height: 92px; }
.mini .mi { padding: 6px 9px 8px; }
.mini .mi b { display: block; font-family: var(--serif); font-size: 14px; line-height: 1.2; }
.mini .mi span { font-size: 11.5px; color: var(--mute); }
.mini.hollow { border-color: var(--hollow); } .mini.warden { border-color: var(--warden); } .mini.wanderer { border-color: var(--wanderer); }
.mini .secret { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }

/* ------------------------------ cards ------------------------------ */
.portrait-wrap { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; }
.portrait-wrap svg, .portrait-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait-img { opacity: 0; transition: opacity .3s; }
.portrait-img.ok { opacity: 1; }
.mini .portrait-wrap { aspect-ratio: auto; }

/* Character card: black iron frame with molten seams. Initial in a ring, name, art window, faction plate with an HP seal,
   then Win condition and Special ability. Painted art can replace the drawn portrait (art/<id>.webp). */
.ccard { width: 310px; padding: 9px; border-radius: 16px; text-align: left; position: relative;
  background: linear-gradient(160deg, #3a2a1c, #120c08 40%, #2a1d12 70%, #0b0705); box-shadow: 0 30px 80px rgba(0, 0, 0, .75), 0 0 50px color-mix(in srgb, var(--fc, #888) 30%, transparent), inset 0 0 0 1px rgba(255, 190, 120, .25); }
.ccard.hollow { --fc: var(--hollow); } .ccard.warden { --fc: var(--warden); } .ccard.wanderer { --fc: var(--wanderer); }
.ccard .cc-frame { position: relative; border-radius: 10px; overflow: hidden; background: #0a0706; border: 1px solid rgba(255, 140, 60, .45); box-shadow: inset 0 0 18px rgba(255, 90, 20, .18); }
.ccard .cc-frame::before, .ccard .cc-frame::after { content: ''; position: absolute; width: 26px; height: 26px; border: 2px solid #c9a24a; z-index: 3; opacity: .8; pointer-events: none; }
.ccard .cc-frame::before { top: 4px; right: 4px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.ccard .cc-frame::after { bottom: 4px; left: 4px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.ccard .cc-head { position: relative; z-index: 2; display: flex; align-items: center; gap: 4px; height: 50px; padding: 0 12px 0 64px; background: linear-gradient(180deg, #2a1d14, #120c08); border-bottom: 1px solid rgba(255, 140, 60, .4); }
.ccard .cc-init { position: absolute; left: 6px; top: 4px; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font: 900 34px/1 var(--serif);
  background: radial-gradient(circle at 40% 35%, #3a2a20, #0a0605 70%) padding-box, var(--heat) border-box; border: 3px solid transparent; color: #ffd27a; text-shadow: 0 0 12px rgba(255, 106, 26, .9); box-shadow: 0 4px 14px rgba(0, 0, 0, .8); }
.ccard .cc-name { font: 700 21px/1.05 var(--serif); color: #f4ebe1; letter-spacing: .02em; padding-left: 4px; }
.ccard .cc-art { position: relative; }
.ccard .cc-art .portrait-wrap { aspect-ratio: 5 / 4; }
.ccard .cc-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 6px; font: italic 600 13px var(--serif); color: #e9dcc8; background: linear-gradient(0deg, rgba(0, 0, 0, .85), transparent); }
.ccard .cc-plate { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 12px; background: linear-gradient(180deg, #241912, #0e0907); border-top: 1px solid rgba(255, 140, 60, .4); border-bottom: 1px solid rgba(255, 140, 60, .25); }
.ccard .cc-fac { font: 900 17px/1 var(--serif); letter-spacing: .14em; text-transform: uppercase; color: var(--fc); display: flex; align-items: center; gap: 6px; text-shadow: 0 0 10px color-mix(in srgb, var(--fc) 50%, transparent); }
.ccard .cc-fac .sigil { width: 18px; height: 18px; }
.ccard .cc-hp { display: flex; align-items: center; gap: 6px; font: 900 15px var(--serif); color: #e9dcc8; }
.ccard .cc-hp b { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 900 20px/1 var(--serif); color: #fff3d6;
  background: radial-gradient(circle at 38% 32%, #e0301e, #6a0a0a 70%); border: 2px solid #ffb27a; box-shadow: 0 0 14px rgba(224, 48, 30, .7), inset 0 -3px 6px rgba(0, 0, 0, .5); }
.ccard .cc-text { padding: 10px 13px 6px; font-size: 13.2px; line-height: 1.42; color: #e2d6c4; background: radial-gradient(ellipse at 50% 0%, rgba(255, 106, 26, .07), transparent 70%); }
.ccard .cc-row + .cc-row { margin-top: 8px; }
.ccard .cc-row > b { display: block; font: 700 12.5px var(--serif); letter-spacing: .08em; color: #ffd27a; text-transform: uppercase; }
.ccard .cc-ab { color: #ff8a2a; font-weight: 700; }
.ccard .cc-once { color: #e0301e; font-style: italic; font-size: 12px; }
.ccard .flavor { font-size: 12px; color: var(--dim); font-style: italic; margin: 0; padding: 4px 13px 12px; }
.ccard .cc-used { font-size: 12px; color: var(--mute); padding: 0 13px 8px; }

.gcard { width: 250px; min-height: 340px; border-radius: 16px; padding: 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); position: relative; }
.gcard::before { content: ''; position: absolute; inset: 8px; border-radius: 10px; border: 1.5px solid currentColor; opacity: .5; pointer-events: none; }
.gcard .card-art { position: relative; width: 100%; height: 130px; display: grid; place-items: center; border-radius: 8px; overflow: hidden; }
.gcard .card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.gcard .card-art img.ok { opacity: 1; }
.gcard .deck-ico { width: 74px; height: 74px; }
.gcard .kind { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; opacity: .8; }
.gcard h3 { font-family: var(--serif); font-size: 24px; margin: 0; line-height: 1.15; }
.gcard p { margin: 0; font-size: 15px; }
.gcard .who { margin-top: auto; font-size: 12px; opacity: .75; }
.gcard.blessing { background: radial-gradient(circle at 50% 30%, #3e3018, #15100a 75%); color: #e0bd6a; border: 1px solid #6b5426; }
.gcard.curse { background: radial-gradient(circle at 50% 30%, #3a0a0c, #0a0303 75%); color: #ff4a3a; border: 1px solid #5a0a0c; }
.gcard.whisper { background: radial-gradient(circle at 50% 30%, #12301e, #050d08 75%); color: #8fe0a6; border: 1px solid #1f4a2c; }

/* ------------------------------ overlays ------------------------------ */
.overlay { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; background: rgba(4, 1, 1, .5); padding: 16px; }
.overlay[hidden] { display: none; }
#card-pop { background: rgba(4, 1, 1, .35); cursor: pointer; }
.pop { animation: popin .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes popin { from { transform: translateY(40px) rotateX(40deg) scale(.7); opacity: 0; } }
#modal { z-index: 150; background: rgba(4, 1, 1, .72); }
.modal { position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: linear-gradient(180deg, #160c0b, #070405); border: 1px solid var(--line2); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.modal .close { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 28px; color: var(--mute); cursor: pointer; }
.modal h2 { font-family: var(--serif); margin: 0 0 4px; font-size: 30px; }
.modal h3 { font-family: var(--serif); margin: 20px 0 6px; color: var(--gold); }
.modal p, .modal li { color: #cfc3b0; }
.modal .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; justify-items: center; }
.modal .grid .ccard { width: 100%; }
.loc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.loc-list div { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.loc-list b { font-family: var(--serif); }
.loc-list .rl { float: right; font-weight: 700; color: var(--gold); }
.cards-list { columns: 2 260px; font-size: 14px; }
.cards-list li { break-inside: avoid; margin-bottom: 6px; }
.over-head { text-align: center; }
.over-head .big { font-family: var(--serif); font-size: 40px; color: var(--moon); text-shadow: 0 0 30px rgba(179, 32, 42, .6); }
.over-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 18px 0; }
.ov { border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: #0d0b12; position: relative; }
.ov.win { border-color: var(--gold); box-shadow: 0 0 24px rgba(201, 162, 74, .4); }
.ov .portrait-wrap { aspect-ratio: 16 / 10; }
.ov .t { padding: 8px 10px; }
.ov .t b { font-family: var(--serif); display: block; }
.ov .t span { font-size: 12.5px; color: var(--mute); }
.ov .crown { position: absolute; top: 8px; right: 8px; background: var(--gold); color: #1d1206; font-weight: 800; font-size: 11px; padding: 3px 8px; border-radius: 999px; letter-spacing: .1em; }
.toast { position: fixed; left: 50%; bottom: 200px; transform: translateX(-50%) translateY(20px); background: rgba(10, 6, 6, .96); border: 1px solid var(--line2); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .3s; z-index: 160; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.banner { position: fixed; left: 0; right: 0; top: 38%; text-align: center; font-family: var(--serif); font-weight: 900; font-size: clamp(30px, 6vw, 58px); color: var(--moon); text-shadow: 0 0 40px var(--bc, rgba(179, 32, 42, .8)), 0 4px 20px #000; z-index: 130; pointer-events: none; opacity: 0; transform: scale(.9); transition: opacity .4s, transform .6s; }
.banner.show { opacity: 1; transform: none; }
.banner small { display: block; font-size: .38em; font-weight: 700; letter-spacing: .1em; color: var(--mute); }
canvas.dice3d { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 125; pointer-events: none; opacity: 1; transition: opacity .5s ease; }
canvas.dice3d.fade { opacity: 0; }
.dice2d { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 126; display: flex; gap: 14px; pointer-events: none; }
.dice2d span { width: 70px; height: 70px; display: grid; place-items: center; font: 900 34px var(--serif); background: #f6eed6; color: #1d1206; border-radius: 14px; box-shadow: var(--shadow); animation: popin .4s; }
.dice2d span.d4 { clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 22px; }

/* ------------------------------ phones ------------------------------ */
@media (max-width: 980px) {
  body { overflow: auto; }
  #game.active { display: flex; flex-direction: column; position: relative; min-height: 100%; }
  #game { position: relative; inset: auto; }
  #board { position: relative; height: 48vh; flex: none; }
  .topbar { position: absolute; }
  .tb-left .chip { display: none; }
  .topbar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .tb-left { padding: 5px 10px; }
  .logo.sm { font-size: 15px; }
  .tb-turn { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
  .tb-right { gap: 4px; }
  .icon-btn { width: 30px; height: 30px; font-size: 13px; }
  .panel, .dock { position: relative; inset: auto; width: auto; max-height: none; margin: 8px 10px 0; }
  .dock { order: 1; flex-direction: column-reverse; align-items: stretch; }
  .players { order: 2; }
  .side { order: 3; height: 340px; margin-bottom: 16px; }
  .hand { justify-content: flex-start; overflow-x: auto; }
  .mini { width: 130px; }
  .toast { bottom: 24px; }
}

/* held items: small cards under each player; hover (or tap) shows the full card */
.mini-card { width: 50px; height: 70px; padding: 4px 3px; border-radius: 6px; display: inline-flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; cursor: zoom-in; position: relative; transition: transform .15s, box-shadow .15s; font: 600 8.5px/1.1 var(--sans); text-align: center; overflow: hidden; }
.mini-card .deck-ico { width: 26px; height: 26px; margin-top: 4px; }
.mini-card span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card:hover, .mini-card:focus-visible { transform: translateY(-3px) scale(1.06); }
.mini-card.blessing { background: radial-gradient(circle at 50% 30%, #3e3018, #15100a 80%); color: #e0bd6a; border: 1px solid #8a6a2a; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .4); }
.mini-card.curse { background: radial-gradient(circle at 50% 30%, #3a0a0c, #0a0303 80%); color: #ff5a3a; border: 1px solid #7a1214; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .4); }
.pl .items { gap: 6px; margin-top: 2px; }
.card-tip { position: fixed; z-index: 170; pointer-events: none; animation: popin .25s cubic-bezier(.2, 1.3, .4, 1); }
.card-tip[hidden] { display: none; }
.card-tip .gcard { width: 220px; min-height: 300px; }

/* you were hit: a red pulse at the edges of the screen */
.hurt { position: fixed; inset: 0; pointer-events: none; z-index: 128; opacity: 0; box-shadow: inset 0 0 160px 40px rgba(180, 10, 0, .75); }
.hurt.on { animation: hurt .9s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }

/* =====================================================================
   FORGED IRON PASS — panels, buttons and rows look like worked metal
   ===================================================================== */
:root {
  /* fine grain and soot, drawn once as an SVG noise texture */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .16 0 0 0 0 .09 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --rivet: radial-gradient(circle at 35% 35%, #8a7a66 0 1.5px, #3a2f26 2.5px, #120d0a 4px, transparent 4.5px);
  --plate: linear-gradient(180deg, rgba(16, 10, 7, .97), rgba(6, 4, 3, .98) 60%, rgba(10, 6, 4, .98));
}
.panel, .actions, .title-card, .lobby-card, .modal, .tb-left, .tb-turn {
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), var(--grain), var(--plate);
  background-size: 12px 12px, 12px 12px, 12px 12px, 12px 12px, 160px 160px, 100% 100%;
  background-position: 6px 6px, calc(100% - 6px) 6px, 6px calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  border: 1px solid #5a3018;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 190, 120, .14), inset 0 -2px 0 rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .55);
}
.tb-left, .tb-turn { background-image: var(--grain), var(--plate); background-size: 160px 160px, 100% 100%; background-position: 0 0, 0 0; background-repeat: repeat, no-repeat; }
/* a hairline of ember along the top edge of every plate */
.panel::before, .actions::before, .title-card::before, .lobby-card::before, .modal::before {
  content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 122, 26, .7), rgba(255, 210, 122, .9), rgba(255, 122, 26, .7), transparent);
  box-shadow: 0 0 10px rgba(255, 106, 26, .6);
}
.actions, .title-card, .lobby-card { position: relative; }
.actions.mine { border-color: #7a4a1a; box-shadow: 0 20px 50px rgba(0, 0, 0, .65), 0 0 34px rgba(255, 106, 26, .28), inset 0 1px 0 rgba(255, 190, 120, .2), inset 0 0 0 1px rgba(0, 0, 0, .55); }
.tb-turn.mine { border-color: #b8862b; box-shadow: 0 0 26px rgba(255, 106, 26, .45), inset 0 1px 0 rgba(255, 210, 122, .3); }

/* buttons: worked iron with a bevel; the main action is hot metal */
.btn { background: linear-gradient(180deg, #2c160c, #140906 55%, #0c0503); border: 1px solid #6a3a1c; color: #efe4d2;
  box-shadow: inset 0 1px 0 rgba(255, 200, 140, .18), inset 0 -2px 0 rgba(0, 0, 0, .5), 0 3px 8px rgba(0, 0, 0, .5); text-shadow: 0 1px 1px #000; }
.btn:hover { background: linear-gradient(180deg, #5e3018, #2c140a 55%, #1a0c06); border-color: #b8862b; box-shadow: inset 0 1px 0 rgba(255, 210, 150, .25), 0 0 16px rgba(255, 106, 26, .35), 0 3px 8px rgba(0, 0, 0, .5); }
.btn.ghost { background: rgba(12, 8, 6, .5); }
.btn.hot { position: relative; overflow: hidden; color: #1a0702; text-shadow: 0 1px 0 rgba(255, 230, 180, .5); border-color: #ffd27a;
  background: linear-gradient(180deg, #ffb24a, #ff6a1a 45%, #b8380a); box-shadow: inset 0 1px 0 rgba(255, 255, 220, .6), inset 0 -3px 0 rgba(90, 20, 0, .55), 0 0 22px rgba(255, 106, 26, .55); }
.btn.hot::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 220, .45) 50%, transparent 70%); transform: translateX(-120%); animation: heat 3.2s ease-in-out infinite; }
@keyframes heat { 60%, 100% { transform: translateX(120%); } }
.btn.reveal { background: linear-gradient(180deg, #6a0c10, #2a0304 60%, #1a0203); border-color: #c0301e; color: #ffd9c8; box-shadow: inset 0 1px 0 rgba(255, 140, 120, .3), 0 0 18px rgba(224, 48, 30, .45); }
.actions .opts .btn { border-radius: 8px; }
.icon-btn { background: linear-gradient(180deg, #3a1c0e, #160a05); border-color: #6a3a1c; box-shadow: inset 0 1px 0 rgba(255, 200, 140, .15), 0 3px 8px rgba(0, 0, 0, .5); }
.icon-btn:hover { border-color: #b8862b; box-shadow: 0 0 12px rgba(255, 106, 26, .4); }

/* player rows: engraved separators; whose turn it is glows like a coal */
.pl { border-radius: 8px; }
.pl + .pl { margin-top: 0; border-top: 1px solid rgba(0, 0, 0, .6); box-shadow: inset 0 1px 0 rgba(255, 190, 120, .06); }
.pl.turn { background: linear-gradient(90deg, rgba(255, 106, 26, .16), rgba(255, 106, 26, .02)); border-color: rgba(255, 140, 60, .45); box-shadow: inset 3px 0 0 #ff6a1a; }
.pl .bar { height: 5px; background: #0a0706; box-shadow: inset 0 1px 2px #000; }
.pl .bar i { background: linear-gradient(90deg, #5a0608, #c0200e 60%, #ff6a1a); box-shadow: 0 0 6px rgba(255, 80, 20, .6); }
.tabs { border-bottom: 1px solid #000; box-shadow: 0 1px 0 rgba(255, 190, 120, .08); }
.tab { font-family: var(--serif); letter-spacing: .06em; }
.tab.active { color: var(--gold); box-shadow: inset 0 -2px 0 var(--ember); text-shadow: 0 0 10px rgba(255, 106, 26, .5); }
#log .e { border-bottom: 1px solid rgba(0, 0, 0, .5); box-shadow: 0 1px 0 rgba(255, 190, 120, .04); }
#log .e.turn { color: var(--ember2); text-shadow: 0 0 8px rgba(255, 106, 26, .4); }
input { background: linear-gradient(180deg, #0c0503, #160a05); border-color: #5a3018; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7); }
input:focus { border-color: #b8862b; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7), 0 0 0 3px rgba(255, 106, 26, .2); }
.seats li { background: linear-gradient(180deg, rgba(20, 11, 7, .8), rgba(6, 3, 2, .8)); border-color: #4a2614; }
.dice-pick button { background: radial-gradient(circle at 50% 40%, #1c0e07, #070302); border-color: #4a2614; }
.code { background: var(--heat); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: flow 7s linear infinite; filter: drop-shadow(0 0 18px rgba(255, 106, 26, .45)); text-shadow: none; }
.toast { background-image: var(--grain), var(--plate); background-size: 160px 160px, 100% 100%; border-color: #4a3626; }
.mini { border-width: 2px; box-shadow: 0 14px 30px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(0, 0, 0, .6); }

/* the live board behind the title and lobby, under a dark vignette so the menu stays readable */
#title-bg { position: fixed; inset: 0; z-index: 0; }
#title-bg canvas { width: 100% !important; height: 100% !important; display: block; }
#title-bg::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, rgba(5, 3, 2, .55) 0, rgba(5, 3, 2, .2) 45%, rgba(5, 3, 2, .75) 100%); }
#title .title-card, #lobby .lobby-card { backdrop-filter: blur(6px); }

/* settings */
.settings h3 { margin-top: 18px; padding-bottom: 6px; border-bottom: 1px solid rgba(0, 0, 0, .6); box-shadow: 0 1px 0 rgba(255, 190, 120, .06); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 2px; border-bottom: 1px solid rgba(255, 190, 120, .05); }
.set-row b { display: block; font-weight: 700; }
.set-row span { display: block; font-size: 13px; color: var(--mute); }
.set-ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.set-ctl output { width: 42px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 700; font-size: 13px; }
.switch { width: 50px; height: 28px; border-radius: 999px; border: 1px solid #5a3018; background: #0c0603; position: relative; cursor: pointer; padding: 0; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7); transition: background .2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(180deg, #6a5040, #2a1a10); box-shadow: 0 2px 4px rgba(0, 0, 0, .6); transition: transform .2s, background .2s; }
.switch[aria-checked="true"] { background: linear-gradient(180deg, #8a3a10, #4a1606); border-color: #ff8a2a; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5), 0 0 12px rgba(255, 106, 26, .4); }
.switch[aria-checked="true"] span { transform: translateX(22px); background: linear-gradient(180deg, #ffd27a, #ff6a1a); }
input[type=range] { width: 150px; padding: 0; accent-color: #ff6a1a; background: none; border: 0; box-shadow: none; }
input[type=range]:disabled { opacity: .35; }
.seg { display: flex; border: 1px solid #5a3018; border-radius: 999px; overflow: hidden; }
.seg button { background: #0c0603; border: 0; padding: 6px 14px; cursor: pointer; color: var(--mute); font-weight: 600; }
.seg button[aria-checked="true"] { background: linear-gradient(180deg, #ff9a3c, #c2400c); color: #1a0702; }
@media (max-width: 560px) { .set-row { flex-direction: column; align-items: flex-start; } }

/* faction emblems: sized to the text around them unless a rule says otherwise */
.sigil { width: 1em; height: 1em; vertical-align: -0.14em; flex: none; }
.ccard .cc-plate { gap: 10px; }
.ccard .cc-fac { font-size: 15px; letter-spacing: .1em; min-width: 0; }
.ccard .cc-hp { flex: none; }
.mini-card .mc-art { width: 44px; height: 36px; object-fit: cover; border-radius: 3px; margin-top: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .7); }

/* =====================================================================
   CARD STOCK PASS — cards look printed on real material, each deck its own
   Painted textures from Astra (art/ui/*.webp) are layered on top when they exist (see art.js: --tex-*).
   ===================================================================== */
:root {
  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .08 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23p)'/%3E%3C/svg%3E");
  --blotch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .1 0 0 0 0 .02 0 0 0 1.4 -.55'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23b)'/%3E%3C/svg%3E");
  --leather: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='l'%3E%3CfeTurbulence type='turbulence' baseFrequency='.06' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .02 0 0 0 0 .02 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23l)'/%3E%3C/svg%3E");
  --blood-stain: radial-gradient(ellipse at 78% 82%, rgba(110, 6, 4, .55), rgba(110, 6, 4, 0) 22%), radial-gradient(ellipse at 14% 64%, rgba(90, 4, 4, .45), rgba(90, 4, 4, 0) 14%);
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .6' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .06 0 0 0 0 .16 0 0 0 0 .09 0 0 0 .4 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23f)'/%3E%3C/svg%3E");
  --corner-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%237a5418' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 22V8a5 5 0 0 1 5-5h14'/%3E%3Cpath d='M8 30c0-12 10-22 22-22'/%3E%3Cpath d='M14 14c4 0 6 2 6 6-4 0-6-2-6-6z' fill='%237a5418'/%3E%3C/g%3E%3C/svg%3E");
  --corner-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%238a1410' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 22V8a5 5 0 0 1 5-5h14'/%3E%3Cpath d='M8 30c0-12 10-22 22-22'/%3E%3Cpath d='M12 12l8 8M20 12l-8 8'/%3E%3C/g%3E%3C/svg%3E");
  --corner-green: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%233f8a55' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M3 22V8a5 5 0 0 1 5-5h14'/%3E%3Cpath d='M9 26c2-8 8-14 16-16'/%3E%3Ccircle cx='16' cy='16' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  --tex-boon: none; --tex-curse: none; --tex-whisper: none; --tex-char: none;
}
.gcard { border-radius: 14px; padding: 20px 18px 16px; overflow: hidden; }
.gcard::before { inset: 9px; border-radius: 8px; opacity: 1; }
.gcard .card-art { height: 140px; border-radius: 4px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 3px 10px rgba(0, 0, 0, .6); }
.gcard .kind { font-weight: 800; letter-spacing: .26em; opacity: 1; }
.gcard h3 { font-size: 25px; }
.gcard p { font-size: 15px; line-height: 1.4; font-weight: 500; }

/* Boons: aged parchment, dark ink, a gilt border */
.gcard.blessing, .mini-card.blessing {
  color: #2a1606; border: 2px solid #3a2408;
  background-image: var(--tex-boon), var(--corner-gold), var(--corner-gold), var(--corner-gold), var(--corner-gold), var(--blotch), var(--paper-noise), linear-gradient(170deg, #cdb488, #ab8c58 55%, #846634);
  background-size: cover, 34px, 34px, 34px, 34px, 300px, 220px, 100%;
  background-position: center, 6px 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, no-repeat;
  box-shadow: inset 0 0 40px rgba(70, 38, 8, .75), inset 0 0 6px rgba(0, 0, 0, .6), 0 24px 60px rgba(0, 0, 0, .7);
}
.gcard.blessing::before { border: 1.5px solid rgba(110, 72, 18, .75); box-shadow: inset 0 0 0 3px rgba(205, 168, 96, .35), inset 0 0 0 4px rgba(110, 72, 18, .45); }
.gcard.blessing h3 { color: #3a1c04; text-shadow: 0 1px 0 rgba(255, 236, 190, .45); }
.gcard.blessing .kind { color: #6a3e0a; }
.gcard.blessing .who { color: #4a2c0c; opacity: .85; }
.gcard.blessing .deck-ico { color: #6a3e0a; }

/* Curses: charred black leather, blood-red ink, old stains */
.gcard.curse, .mini-card.curse {
  color: #e9c9b8; border: 2px solid #2a0404;
  background-image: var(--tex-curse), var(--corner-red), var(--corner-red), var(--corner-red), var(--corner-red), var(--blood-stain), var(--leather), linear-gradient(170deg, #1e0807, #0e0404 60%, #160606);
  background-size: cover, 34px, 34px, 34px, 34px, 100%, 200px, 100%;
  background-position: center, 6px 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, .85), inset 0 0 0 1px rgba(160, 20, 14, .35), 0 24px 60px rgba(0, 0, 0, .75);
}
.gcard.curse::before { border: 1.5px solid rgba(160, 22, 14, .6); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .5), inset 0 0 0 4px rgba(120, 14, 10, .4); }
.gcard.curse h3 { color: #ff4a32; text-shadow: 0 0 14px rgba(200, 20, 10, .55), 0 2px 2px #000; }
.gcard.curse .kind { color: #c42a1c; }
.gcard.curse .deck-ico { color: #c42a1c; }

/* Whispers: dark green paper with a red wax seal */
.gcard.whisper {
  color: #d4ead8; border: 2px solid #08180e;
  background-image: var(--tex-whisper), var(--corner-green), var(--corner-green), var(--corner-green), var(--corner-green), var(--fibre), var(--paper-noise), linear-gradient(170deg, #0e2416, #071409 60%, #050f07);
  background-size: cover, 34px, 34px, 34px, 34px, 200px, 220px, 100%;
  background-position: center, 6px 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, no-repeat;
  box-shadow: inset 0 0 44px rgba(0, 0, 0, .8), 0 24px 60px rgba(0, 0, 0, .7);
}
.gcard.whisper::before { border: 1.5px solid rgba(80, 160, 100, .45); }
.gcard.whisper h3 { color: #9fe8b4; }
.gcard.whisper .kind { color: #6fbf88; }
.gcard.whisper::after { content: ''; position: absolute; left: 50%; bottom: 14px; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 38% 34%, #d0362a, #8a0e0c 55%, #4a0405); box-shadow: 0 2px 6px rgba(0, 0, 0, .7), inset 0 -3px 6px rgba(0, 0, 0, .45), inset 0 2px 3px rgba(255, 140, 120, .35);
  clip-path: polygon(50% 0, 62% 6%, 76% 4%, 84% 16%, 96% 24%, 94% 38%, 100% 50%, 94% 62%, 96% 76%, 84% 84%, 76% 96%, 62% 94%, 50% 100%, 38% 94%, 24% 96%, 16% 84%, 4% 76%, 6% 62%, 0 50%, 6% 38%, 4% 24%, 16% 16%, 24% 4%, 38% 6%); }
.gcard.whisper .who { margin-bottom: 40px; }

/* mini cards get the same stock, smaller corners */
.mini-card.blessing, .mini-card.curse { background-size: cover, 12px, 12px, 12px, 12px, 100%, 120px, 100%; background-position: center, 2px 2px, right 2px top 2px, left 2px bottom 2px, right 2px bottom 2px, 0 0, 0 0, 0 0; }
.mini-card.blessing { box-shadow: inset 0 0 12px rgba(70, 38, 8, .8); }
.mini-card.curse { box-shadow: inset 0 0 14px rgba(0, 0, 0, .9); }

/* character cards: a dark vellum text panel inside the iron frame */
.ccard .cc-text, .ccard .flavor, .ccard .cc-used {
  background-image: var(--tex-char), var(--paper-noise), linear-gradient(180deg, #1c120a, #120b06);
  background-size: cover, 220px, 100%; background-repeat: no-repeat, repeat, no-repeat;
}
.ccard .cc-text { box-shadow: inset 0 0 0 1px rgba(255, 190, 120, .1), inset 0 8px 18px rgba(0, 0, 0, .5); color: #ead9c0; }
.ccard .flavor { border-top: 1px solid rgba(255, 190, 120, .1); padding-top: 8px; color: #a8896a; }

/* the game emblem at the top of the title card */
.emblem { display: block; width: 120px; height: 120px; margin: -34px auto 4px; filter: drop-shadow(0 0 24px rgba(255, 90, 20, .55)); }
/* The emblem PNG has its own transparent silhouette. */

/* deck colours: easy to tell apart at a glance (bone-white Boons, black Curses, emerald Whispers), over the same textures */
.gcard.blessing, .mini-card.blessing {
  background-image: linear-gradient(170deg, rgba(250, 242, 222, .5), rgba(232, 214, 172, .34)), var(--tex-boon), var(--corner-gold), var(--corner-gold), var(--corner-gold), var(--corner-gold), var(--blotch), var(--paper-noise), linear-gradient(170deg, #e2cfa6, #c7ab78 55%, #a68654);
  background-size: 100%, cover, 34px, 34px, 34px, 34px, 300px, 220px, 100%;
  background-position: 0 0, center, 6px 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, no-repeat;
  border-color: #b8913e;
  box-shadow: inset 0 0 34px rgba(90, 56, 14, .55), inset 0 0 0 1px rgba(255, 236, 190, .5), 0 0 22px rgba(255, 220, 150, .18), 0 24px 60px rgba(0, 0, 0, .7);
}
.gcard.curse, .mini-card.curse {
  background-image: linear-gradient(170deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .25)), var(--tex-curse), var(--corner-red), var(--corner-red), var(--corner-red), var(--corner-red), var(--blood-stain), var(--leather), linear-gradient(170deg, #140404, #070202 60%, #0e0303);
  background-size: 100%, cover, 34px, 34px, 34px, 34px, 100%, 200px, 100%;
  background-position: 0 0, center, 6px 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  border-color: #6a0a08;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, .9), inset 0 0 0 1px rgba(200, 30, 20, .45), 0 0 22px rgba(170, 16, 10, .3), 0 24px 60px rgba(0, 0, 0, .75);
}
.gcard.whisper {
  background-image: linear-gradient(170deg, rgba(36, 150, 76, .34), rgba(14, 92, 46, .3)), var(--tex-whisper), var(--corner-green), var(--corner-green), var(--corner-green), var(--corner-green), var(--fibre), var(--paper-noise), linear-gradient(170deg, #145a30, #0b3a1e 60%, #072a15);
  background-size: 100%, cover, 34px, 34px, 34px, 34px, 200px, 220px, 100%;
  background-position: 0 0, center, 6px 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, no-repeat;
  border-color: #2a8a4c;
  box-shadow: inset 0 0 40px rgba(0, 20, 8, .7), inset 0 0 0 1px rgba(120, 230, 150, .3), 0 0 22px rgba(40, 180, 90, .25), 0 24px 60px rgba(0, 0, 0, .7);
}
.gcard.whisper h3 { color: #b4f5c6; text-shadow: 0 2px 2px rgba(0, 0, 0, .6); }
.gcard.whisper .kind { color: #8fe8a8; }
.mini-card.blessing { background-size: 100%, cover, 12px, 12px, 12px, 12px, 100%, 120px, 100%; background-position: 0 0, center, 2px 2px, right 2px top 2px, left 2px bottom 2px, right 2px bottom 2px, 0 0, 0 0, 0 0; box-shadow: inset 0 0 10px rgba(90, 56, 14, .6); }
.mini-card.curse { background-size: 100%, cover, 12px, 12px, 12px, 12px, 100%, 120px, 100%; background-position: 0 0, center, 2px 2px, right 2px top 2px, left 2px bottom 2px, right 2px bottom 2px, 0 0, 0 0, 0 0; box-shadow: inset 0 0 14px rgba(0, 0, 0, .9); }

/* Title footer (the Anvil Reign kit, as in Fate & Ember): version · Test report · website. */
.btn.xs { padding: 4px 10px; font-size: 11px; letter-spacing: .06em; }
.title-foot { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 106, 26, .14); }
.title-foot .ver { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #b8862b; margin-right: 4px; }
/* Test report form and preview. */
.report select, .report textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #5a3018; background: linear-gradient(180deg, #0c0503, #160a05); color: var(--ink); font: inherit; outline: none; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7); resize: vertical; }
.report select:focus, .report textarea:focus { border-color: #b8862b; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7), 0 0 0 3px rgba(255, 106, 26, .2); }
.report select option { background: #0c0503; }
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rp-text { min-height: 300px; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre; }
@media (max-width: 560px) { .rp-grid { grid-template-columns: 1fr; } }

/* ============ Library: "The Forge Archive" (same kit as Counter Forge's library) ============ */
.library { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 3vh 3vw; background: rgba(2, 1, 1, .82); backdrop-filter: blur(7px); }
.library[hidden] { display: none; }
.lb-shell { width: min(1180px, 100%); height: 94vh; display: flex; flex-direction: column; gap: 14px; padding: 24px 26px; box-sizing: border-box; overflow: hidden;
  background: radial-gradient(ellipse at 85% 0%, rgba(255, 106, 26, .10), transparent 55%), linear-gradient(180deg, #120806, #070303 60%, #040202); border: 1px solid #5a3018; border-radius: 18px; box-shadow: 0 28px 100px #000c, inset 0 0 0 1px rgba(255, 210, 122, .05); }
.lb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex: none; }
.lb-kicker { color: #b8862b; font-size: 11px; letter-spacing: .22em; }
.lb-head h2 { margin: 6px 0 0; font-size: 30px; line-height: 1.1; color: #f3e6cf; }
.lb-head h2:empty { display: none; }
.lb-tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: none; border-bottom: 1px solid rgba(255, 106, 26, .16); padding-bottom: 10px; }
.lb-tab { appearance: none; border: 1px solid transparent; background: none; color: #c9b89a; font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.lb-tab:hover { color: #ffd27a; }
.lb-tab.on { color: #1a0a04; background: linear-gradient(180deg, #ffb14a, #ff6a1a); border-color: #ffd27a; }
.lb-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: none; }
.lb-controls input[type=search] { flex: 1 1 220px; width: auto; padding: 10px 14px; }
.lb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-chip { appearance: none; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid #5a3018; background: rgba(12, 6, 3, .8); color: #d9c7a6; cursor: pointer; }
.lb-chip.on { border-color: #ff6a1a; color: #ffd27a; box-shadow: 0 0 0 2px rgba(255, 106, 26, .18); }
.lb-sort { display: flex; gap: 6px; align-items: center; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9d8a6a; }
.lb-sort select { padding: 7px 10px; border-radius: 10px; border: 1px solid #5a3018; background: #0c0503; color: #efe4d2; font: inherit; text-transform: none; letter-spacing: 0; }
.lb-grid { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-content: start; padding: 2px 4px 8px 2px; }
.lb-grid.whispers, .lb-grid.locations { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lb-tile { appearance: none; text-align: left; font: inherit; color: #efe4d2; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 14px; border: 1px solid #3a1f10;
  background: linear-gradient(180deg, rgba(28, 14, 8, .9), rgba(8, 4, 3, .95)); transition: transform .12s, border-color .2s, box-shadow .2s; }
.lb-tile:hover, .lb-tile:focus-visible { transform: translateY(-2px); border-color: #ff6a1a; box-shadow: 0 10px 30px rgba(0, 0, 0, .6), 0 0 22px rgba(255, 106, 26, .18); outline: none; }
.lb-tile.hollow { border-top: 2px solid #a3171c; } .lb-tile.warden { border-top: 2px solid #4a7ab8; } .lb-tile.wanderer { border-top: 2px solid #3fae6a; }
.lb-art { display: block; position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #050303; margin-bottom: 4px; }
.lb-art .portrait-wrap, .lb-art .portrait, .lb-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lb-art.card { display: grid; place-items: center; color: #6a4a2a; }
.lb-art.card .deck-ico { width: 46%; height: 46%; }
.lb-art img { opacity: 0; transition: opacity .3s; } .lb-art img.ok { opacity: 1; }
.lb-tile.blessing .lb-art.card { color: #b8862b; } .lb-tile.curse .lb-art.card { color: #8a1a1c; }
.lb-name { font-weight: 700; font-size: 15px; color: #f6ead2; }
.lb-sub { font-size: 12px; color: #b8862b; }
.lb-desc { font-size: 12.5px; line-height: 1.4; color: #c9b89a; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lb-meta { display: flex; justify-content: space-between; font-size: 12px; color: #c9b89a; margin-top: 2px; }
.lb-meta .sigil { width: 12px; height: 12px; vertical-align: -2px; }
.lb-tile.whisper { border-left: 3px solid #2f8a4a; }
.lb-quote { font-style: italic; font-size: 14px; line-height: 1.45; color: #e3f0dc; }
.lb-tile.place { border-left: 4px solid var(--lc); }
.lb-roll { align-self: flex-start; font-weight: 800; font-size: 12px; letter-spacing: .08em; color: #1a0a04; background: #ffd27a; padding: 2px 8px; border-radius: 999px; }
.lb-roll.big { font-size: 16px; padding: 4px 14px; }
.lb-detail { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }
.lb-page { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 24px; margin-top: 14px; align-items: start; }
.lb-card { position: sticky; top: 0; display: grid; justify-items: center; }
.lb-card .ccard, .lb-card .gcard { width: 100%; max-width: 330px; }
.lb-place { width: 100%; padding: 22px; border-radius: 16px; border: 1px solid #3a1f10; border-left: 5px solid var(--lc); background: linear-gradient(180deg, #160a06, #070303); }
.lb-place h3 { font-size: 24px; margin: 12px 0 8px; color: #f6ead2; }
.lb-secs { display: grid; gap: 12px; }
.lb-sec { border: 1px solid #3a1f10; border-radius: 12px; padding: 12px 16px; background: rgba(255, 106, 26, .025); }
.lb-sec h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: #ffb14a; }
.lb-sec p { margin: 0 0 6px; line-height: 1.5; color: #e2d4ba; }
.lb-note { color: #9d8a6a !important; font-size: 13px; }
.lb-row { appearance: none; display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 4px; border: 0; border-top: 1px solid rgba(255, 210, 122, .06); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.lb-row:first-of-type { border-top: 0; }
.lb-row:hover { background: rgba(255, 106, 26, .07); }
.lb-row strong { display: block; color: #f3ecdc; font-size: 14px; font-weight: 600; }
.lb-row small { display: block; color: #b8a888; font-size: 12.5px; line-height: 1.35; }
.lb-mini { position: relative; width: 38px; height: 38px; flex: none; border-radius: 8px; overflow: hidden; }
.lb-mini .portrait-wrap, .lb-mini .portrait, .lb-mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
  .library { padding: 0; } .lb-shell { height: 100vh; height: 100dvh; border-radius: 0; padding: 16px; }
  .lb-head h2 { font-size: 23px; } .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .lb-grid.whispers, .lb-grid.locations { grid-template-columns: 1fr; }
  .lb-page { grid-template-columns: 1fr; } .lb-card { position: static; }
}
/* Phones: the turn banner gets its own row under the logo and buttons, so nothing runs off the screen. */
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .tb-right { margin-left: auto; }
  .tb-turn { order: 3; flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; }
}

/* Whisper on screen: who → whom, the (secret) question for those two, and what happened, for everyone. */
.whisper-pop { position: fixed; z-index: 45; top: 74px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); padding: 14px 18px 16px; text-align: center; pointer-events: none;
  border-radius: 16px; border: 1px solid #2f6a3e; border-top: 3px solid #3fae6a; background: linear-gradient(180deg, rgba(10, 22, 12, .96), rgba(4, 8, 5, .97)); box-shadow: 0 18px 60px rgba(0, 0, 0, .75), 0 0 40px rgba(63, 174, 106, .14);
  animation: wp-in .35s ease-out; }
.whisper-pop[hidden] { display: none; }
@keyframes wp-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.wp-kicker { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #7fd49a; }
.wp-kicker .deck-ico { width: 16px; height: 16px; color: #3fae6a; }
.wp-who { font-family: var(--serif); font-size: 21px; margin: 6px 0 10px; color: #efe4d2; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.wp-arrow { color: #3fae6a; }
.wp-card { min-height: 24px; padding: 10px 12px; border-radius: 10px; background: rgba(63, 174, 106, .07); border: 1px dashed rgba(63, 174, 106, .35); }
.wp-q { display: block; font-style: italic; font-size: 15.5px; line-height: 1.45; color: #e6f4e0; }
.wp-priv { display: block; margin-top: 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #7fd49a; }
.wp-secret { font-size: 13.5px; color: #b9cdb4; }
.wp-wait { color: #7fd49a; }
.wp-result { margin-top: 12px; font-size: 15px; color: #c9b89a; display: flex; justify-content: center; align-items: center; gap: 8px; }
.wp-result.done { color: #ffd27a; font-weight: 700; font-size: 16.5px; }
@media (max-width: 980px) { .whisper-pop { top: 96px; } .wp-who { font-size: 18px; } }

/* What's new (pop-up after an update, and the list in Settings) */
.whats-new h2 { margin: 6px 0 14px; }
.wn-log section { padding: 12px 0; border-top: 1px solid rgba(255, 106, 26, .14); }
.wn-log section:first-child { border-top: 0; padding-top: 2px; }
.wn-log h4 { margin: 0 0 8px; font-family: var(--serif); font-size: 16px; color: #ffb14a; letter-spacing: .04em; }
.wn-log h4 small { font-family: var(--sans); font-size: 12px; color: #9d8a6a; letter-spacing: 0; margin-left: 6px; }
.wn-log ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.wn-log li { line-height: 1.5; color: #e2d4ba; }
.wn-log li::marker { color: #ff6a1a; }
.wn-settings { border: 1px solid #3a1f10; border-radius: 12px; padding: 10px 14px; background: rgba(255, 106, 26, .025); }
.wn-settings summary { cursor: pointer; color: #d9c7a6; font-weight: 600; }
.wn-settings[open] summary { margin-bottom: 10px; }
