/* The Siege Climb v2 (castle3) — painted climb map, parchment, wood, wax. Phone-first 390x844, desktop 1280x800. */
@font-face { font-family: "Cinzel Deco"; src: url("assets/fonts/CinzelDecorative-Bold.ttf"); font-weight: 700; }
@font-face { font-family: "Crimson"; src: url("assets/fonts/CrimsonText-Regular.ttf"); }
@font-face { font-family: "Crimson"; src: url("assets/fonts/CrimsonText-Bold.ttf"); font-weight: 700; }
:root { --ink: #2a1a0c; --ink-soft: #5a4028; --brass: #b8893a; --wood: #6b4226; --wood-dark: #3a2410; --parch: #f3e2c0; --parch-dark: #d9bf8e; --wax: #9c1e1e; --green: #2d6a35; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }   /* ns2: lock page scroll */
body.castle-page { font-family: "Crimson", Georgia, serif; color: var(--ink); height: 100%; min-height: 0;
  background: radial-gradient(ellipse at 50% -10%, rgba(255,190,110,.22), transparent 55%), linear-gradient(180deg, #2c3446 0%, #3b3a45 40%, #2a241f 100%); }
body.in-arena { overflow: hidden; }
.pill-row { display: flex; gap: 6px; flex: 1; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; background: linear-gradient(180deg, var(--parch), var(--parch-dark)); border: 2px solid var(--brass); font-weight: 700; font-size: 1rem; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.pill.gems i { width: 18px; height: 18px; background: url("assets/town/icon_gems.png") center/contain no-repeat; display: inline-block; }
.shard-ico { color: #4aa3c8; text-shadow: 0 0 4px #9fe3ff; }
.castle { max-width: 560px; margin: 0 auto; padding: 68px 10px 30px; }
.sign { text-align: center; margin: 0 auto 10px; padding: 10px 14px 8px; max-width: 360px; background: linear-gradient(180deg, #7a4d2b, #5a3519); border: 3px solid var(--brass); border-radius: 10px;
  box-shadow: 0 6px 0 #2d1b0b, 0 10px 24px rgba(0,0,0,.45); color: #fbe7bf; }
.sign h1 { font-family: "Cinzel Deco", serif; margin: 0; font-size: 1.7rem; text-shadow: 0 2px 0 #2d1b0b; }
.sign p { margin: 2px 0 0; font-style: italic; opacity: .9; }
.btn { font-family: "Crimson", serif; font-weight: 700; cursor: pointer; border-radius: 12px; border: 2px solid var(--brass); color: #fbe7bf; background: linear-gradient(180deg, #8a5a33, #5e3a1c); box-shadow: 0 4px 0 #2d1b0b; padding: 10px 12px; font-size: 1.05rem; line-height: 1.1; min-height: 44px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2d1b0b; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.5); }
.btn.small { font-size: .92rem; padding: 7px 10px; min-height: 38px; }
.btn.big { font-size: 1.15rem; padding: 13px; flex: 1; min-height: 52px; }
.btn.full { display: block; width: 100%; margin-top: 8px; }
.btn.huge { display: block; width: 100%; font-size: 1.35rem; padding: 16px; margin: 10px 0 4px; font-family: "Cinzel Deco", serif; min-height: 60px; }
.btn.danger { background: linear-gradient(180deg, #8a2b22, #5a160f); }
.btn.wax { background: radial-gradient(circle at 35% 30%, #d0413a, var(--wax) 60%, #5a0e0e); border-color: #e9c27a; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.parchment { background: radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.35), transparent 50%), radial-gradient(ellipse at 80% 90%, rgba(120,80,30,.18), transparent 60%), linear-gradient(180deg, var(--parch), var(--parch-dark));
  border: 2px solid #a57b3c; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.card { padding: 12px; margin-bottom: 10px; }
.card h3 { font-family: "Cinzel Deco", serif; margin: 0 0 2px; font-size: 1.15rem; }
.hint { color: #f1dcb2; text-align: center; font-style: italic; margin: 4px 0 10px; font-size: .95rem; }
.fine { font-size: .9rem; color: var(--ink-soft); margin: 4px 0; } .center { text-align: center; }
.row { display: flex; gap: 8px; margin-top: 8px; }

/* ---------- lobby ---------- */
.modes { display: flex; gap: 8px; margin: 10px 0; }
.mode-tab { flex: 1; font: 700 1.05rem "Crimson", serif; padding: 12px 6px; border-radius: 12px; border: 2px solid var(--brass); cursor: pointer; color: #fbe7bf; background: linear-gradient(180deg, #5d5a55, #3e3b37); box-shadow: 0 4px 0 #1d1b19; min-height: 56px; }
.mode-tab.active { background: linear-gradient(180deg, var(--parch), var(--parch-dark)); color: var(--ink); }
.mode-tab b { display: block; font-size: 1.08rem; } .mode-tab small { display: block; font-weight: 400; font-size: .85rem; opacity: .9; }
.heroes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.pick-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px 8px; border-radius: 12px; cursor: pointer; border: 2px solid rgba(90,64,40,.35); background: rgba(255,255,255,.3); font-family: "Crimson", serif; color: var(--ink); min-height: 150px; }
.pick-hero img { height: 86px; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(0,0,0,.3)); }
.pick-hero b { font-size: 1.02rem; } .pick-hero small { font-size: .78rem; color: var(--ink-soft); } .pick-hero em { font-style: normal; font-weight: 700; font-size: 1rem; color: #7a4a00; }
.pick-hero.on { border-color: #b8893a; background: #fff8e6; box-shadow: 0 0 0 3px rgba(224,176,64,.55); }
.pick-hero:not(.on) img { filter: grayscale(.6) brightness(.9); }
.pick-hero .pick { position: absolute; top: 4px; right: 6px; width: 24px; height: 24px; border-radius: 50%; font-style: normal; font-weight: 700; color: #fff; background: radial-gradient(circle at 35% 30%, #d0413a, var(--wax) 60%, #5a0e0e); border: 2px solid #e9c27a; display: grid; place-items: center; font-size: .8rem; }
.party-power { display: flex; gap: 6px; margin-top: 10px; }
.party-power > div { flex: 1; text-align: center; padding: 6px 4px; border-radius: 10px; background: rgba(255,255,255,.45); border: 1px solid #c9a86a; }
.party-power small { display: block; font-size: .76rem; color: var(--ink-soft); } .party-power b { font-size: 1.2rem; } .party-power b span { font-size: .8rem; color: var(--ink-soft); font-weight: 400; }
.party-power .tot { background: linear-gradient(180deg, #fff1c4, #e8c97a); border-color: #7a5a1c; }
.rules { list-style: none; padding: 0; margin: 0; }
.rules li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed rgba(90,64,40,.3); font-size: 1rem; }
.rules li:last-child { border: 0; }
.rules img { width: 44px; height: 44px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }

/* ---------- race: status ---------- */
.race-top { display: grid; grid-template-columns: .8fr .9fr 1fr 1.5fr; gap: 5px; margin-bottom: 5px; }
.st { padding: 4px 6px; border-radius: 10px; background: linear-gradient(180deg, var(--parch), var(--parch-dark)); border: 2px solid var(--brass); text-align: center; min-width: 0; }
.st small { display: block; font-size: .7rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st b { font-size: 1.05rem; white-space: nowrap; } .st b small { display: inline; font-size: .78rem; }
.st .hpbar { margin: 2px 0 0; height: 18px; }
.st .hpbar span { line-height: 14px; font-size: .78rem; }
.race-sub { display: flex; justify-content: space-between; gap: 6px; margin: 0 0 5px; color: #fbe7bf; font-weight: 700; font-size: .92rem; }
.race-sub span { padding: 3px 10px; border-radius: 999px; background: linear-gradient(180deg, #5d3a1d, #3a2410); border: 1px solid #e9c27a; }
.race-sub span[hidden] { display: none; }
.race-sub b { color: #ffe08a; }
.climb { margin: 0 0 6px; padding: 16px 16px 6px; border-radius: 10px; background: linear-gradient(180deg, #4e4b46, #3a3732); border: 2px solid #25221f; }
.climb-track { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #8a8378, #c9b98f); }
.climb-track .cm { position: absolute; top: -16px; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: #3a2410; border: 2px solid #e9c27a; overflow: hidden; }
.climb-track .cm img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.climb-track .cm.down { filter: grayscale(1) opacity(.55); }
.cdot { position: absolute; top: -2px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--c); border: 1.5px solid #fff; }
.cdot.me { width: 16px; height: 16px; top: -4px; margin-left: -8px; background: radial-gradient(circle at 35% 30%, #ffe28a, #c08a1e); z-index: 2; box-shadow: 0 0 6px #ffd86a; }

/* ---------- the climb map: painted wall, real things on it ---------- */
.race-main { display: block; }
.map { position: relative; height: 480px; border-radius: 12px; overflow: hidden; border: 3px solid #3a2410; box-shadow: inset 0 0 40px rgba(0,0,0,.65), 0 6px 16px rgba(0,0,0,.5); background: #3a3530 center / cover no-repeat; }
.map::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,14,8,.55), rgba(20,14,8,.25) 40%, rgba(20,14,8,.55)); }
.map-band { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 3; padding: 3px 14px; border-radius: 8px; font: 700 .9rem "Cinzel Deco", serif; color: #3a220e; background: linear-gradient(180deg, #fbeccb, #e2c58c); border: 2px solid #8a6230; white-space: nowrap; }
.paths { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.paths line { stroke: rgba(255,240,210,.35); stroke-width: .7; stroke-dasharray: 1.6 1.4; vector-effect: non-scaling-stroke; stroke-width: 3; }
.paths line.hot { stroke: #ffd86a; stroke-width: 5; stroke-dasharray: none; filter: drop-shadow(0 0 4px #ffb020); }
.node { position: absolute; z-index: 2; transform: translate(-50%, -50%); width: 104px; padding: 0; border: 0; background: none; cursor: default; display: flex; flex-direction: column; align-items: center; font-family: inherit; color: #fbe7bf; }
.node .medal { position: relative; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; border: 3px solid #b8893a; background: radial-gradient(circle at 50% 35%, #6a5a48, #2a2016 75%); box-shadow: 0 4px 10px rgba(0,0,0,.6); }
.node .medal img { position: absolute; left: 6%; top: 8%; width: 88%; height: 88%; object-fit: contain; object-position: bottom; }
.node.t-fight .medal { border-color: #b8322a; background: radial-gradient(circle at 50% 30%, #7a4a3a, #2a1410 75%); }
.node.t-chest .medal { border-color: #e9c27a; background: radial-gradient(circle at 50% 40%, #fff1c4, #b07a2a 70%); }
.node.t-shrine .medal { border-color: #7ad6a0; background: radial-gradient(circle at 50% 40%, #e0fff0, #3a8a64 70%); }
.node.t-trap .medal { border-color: #d86a3a; background: radial-gradient(circle at 50% 40%, #f0d8b0, #7a4a2a 70%); }
.node.t-camp .medal { border-color: #e9c27a; background: radial-gradient(circle at 50% 40%, #fff1c4, #6a4a2a 70%); }
.node.boss { width: 150px; } .node.boss .medal { width: 80px; height: 80px; border: 4px solid #e9c27a; background: radial-gradient(circle at 50% 30%, #8a3a2a, #1a0a06 75%); box-shadow: 0 0 18px rgba(255,120,60,.55), 0 4px 10px rgba(0,0,0,.6); }
.node .nl { margin-top: 3px; padding: 1px 8px; border-radius: 6px; font-size: .86rem; line-height: 1.15; color: #3a220e; background: linear-gradient(180deg, #fbeccb, #e2c58c); border: 1.5px solid #8a6230; white-space: nowrap; max-width: 124px; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 5px rgba(0,0,0,.5); }
.node.boss .nl { font: 700 .95rem "Cinzel Deco", serif; max-width: 170px; }
.node .ns { font-size: .76rem; font-weight: 700; color: #fff3d6; text-shadow: 0 1px 2px #000, 0 0 6px #000; white-space: nowrap; }
.node.opt { cursor: pointer; z-index: 4; }
.node.opt .medal { box-shadow: 0 0 0 3px #ffd86a, 0 0 18px 4px rgba(255,216,106,.85); animation: nodeGlow 1.3s ease-in-out infinite; }
@keyframes nodeGlow { 50% { box-shadow: 0 0 0 3px #ffd86a, 0 0 6px 1px rgba(255,216,106,.45); } }
.node.opt:active .medal { transform: scale(.95); }
.node.done .medal { filter: grayscale(.8) brightness(.7); }
.node.done .nl { opacity: .7; }
.node .stamp { position: absolute; top: 30px; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: radial-gradient(circle at 35% 30%, #5aa050, #2d6a35 70%); border: 2px solid #e9f5d0; z-index: 3; }
.node.hurt .medal::after { content: "wounded"; position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-size: .6rem; font-weight: 700; color: #fff; background: rgba(140,20,10,.8); }
.node .party { position: absolute; top: 4px; left: calc(50% - 58px); transform: none; z-index: 5; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; border: 3px solid #ffd86a;
  background: radial-gradient(circle at 50% 30%, #ffe9b0, #c08a1e); box-shadow: 0 0 12px rgba(255,216,106,.9); }
.node .party img { width: 100%; height: 160%; object-fit: cover; object-position: top; }
.node.boss .party { top: 10px; left: calc(50% - 84px); }
.node .tok { position: absolute; top: 2px; left: calc(50% + 22px + var(--i, 0) * 10px); width: 18px; height: 18px; border-radius: 50%; font-style: normal; background: var(--c); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.6); z-index: 4; }
.tok.sm { position: static; display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--c); color: #fff; font-size: .62rem; font-weight: 700; align-items: center; justify-content: center; border: 1.5px solid #fff; vertical-align: middle; font-style: normal; }
.node .mini-hp { display: block; width: 90px; height: 7px; margin-top: 2px; border-radius: 4px; background: rgba(0,0,0,.6); border: 1px solid #e9c27a; overflow: hidden; }
.node .mini-hp i { display: block; height: 100%; background: linear-gradient(180deg, #ee7a5a, #a8261c); }

/* ---------- dock: big path buttons ---------- */
.side { margin-top: 8px; }
.dock { padding: 8px; border-radius: 12px; background: linear-gradient(180deg, #5d3a1d, #3a2410); border: 3px solid var(--brass); box-shadow: 0 6px 18px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 7px; }
.dock-msg { color: #fbe7bf; font-family: "Cinzel Deco", serif; text-align: center; font-size: 1.05rem; margin: 2px 0 0; }
.dock-msg.big { font-size: 1.3rem; padding: 12px 0; } .dock-msg.warn { color: #ffd0a0; }
.choice { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 7px; border-radius: 12px; cursor: pointer; text-align: left; font-family: inherit; color: var(--ink); min-height: 64px;
  border: 2px solid #a57b3c; background: linear-gradient(180deg, var(--parch), var(--parch-dark)); box-shadow: 0 3px 0 #2d1b0b; }
.choice:active { transform: translateY(2px); box-shadow: 0 1px 0 #2d1b0b; }
.choice .ci { width: 50px; height: 50px; flex: none; border-radius: 50%; overflow: hidden; border: 2px solid #8a6230; background: radial-gradient(circle at 50% 35%, #6a5a48, #2a2016 75%); position: relative; }
.choice .ci img { position: absolute; left: 6%; top: 8%; width: 88%; height: 88%; object-fit: contain; object-position: bottom; }
.choice.t-chest .ci { background: radial-gradient(circle at 50% 40%, #fff1c4, #b07a2a 70%); } .choice.t-shrine .ci { background: radial-gradient(circle at 50% 40%, #e0fff0, #3a8a64 70%); }
.choice.t-trap .ci { background: radial-gradient(circle at 50% 40%, #f0d8b0, #7a4a2a 70%); } .choice.t-fight .ci { background: radial-gradient(circle at 50% 30%, #7a4a3a, #2a1410 75%); border-color: #8a2b22; }
.choice.boss { border-color: #7a2b22; background: linear-gradient(180deg, #fff1c4, #e8c97a); } .choice.boss .ci { width: 56px; height: 56px; border-color: #e9c27a; background: radial-gradient(circle at 50% 30%, #8a3a2a, #1a0a06 75%); }
.choice .ct { flex: 1; min-width: 0; } .choice .ct > b { display: block; font-size: 1.1rem; } .choice small b { font-size: inherit; color: #3a220e; } .choice b em { font-style: normal; font-weight: 400; font-size: .8rem; color: var(--ink-soft); }
.choice small { color: var(--ink-soft); font-size: .9rem; line-height: 1.2; display: block; }
.choice .cost { font-weight: 700; background: #3a2410; color: #ffe066; border-radius: 999px; padding: 3px 9px; font-size: .92rem; }
.choice.short { opacity: .55; }
.v { font-weight: 700; } .v.strong, .verdict.strong { color: var(--green); } .v.close, .verdict.close { color: #8a5a00; } .v.weak, .verdict.weak { color: #8a2b22; }
.ko-rest { padding: 10px 12px; border-radius: 12px; background: linear-gradient(#e9e2d4, #cfc3ad); border: 2px solid #6b5a44; display: flex; flex-direction: column; gap: 4px; }
.ko-rest b { font-size: 1.08rem; } .ko-rest small { color: var(--ink-soft); font-size: .88rem; }
.boosts { margin-top: 8px; }
.boost-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; color: #fbe7bf; font-weight: 700; }
.boost-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.boost { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 12px; cursor: pointer; font-family: inherit; color: #fbe7bf; border: 2px solid var(--brass); background: linear-gradient(180deg, #8a5a33, #5e3a1c); box-shadow: 0 3px 0 #2d1b0b; min-height: 64px; }
.boost .bi { font-size: 1.35rem; } .boost b { font-size: .84rem; } .boost small { font-size: .74rem; opacity: .9; }
.boost.off { opacity: .4; filter: grayscale(1); }
.boost.active { background: linear-gradient(180deg, #d9a93e, #9a6a1a); box-shadow: 0 0 10px rgba(255,210,100,.9); }
.feed { margin: 8px 0 0; min-height: 20px; }
.feed p { margin: 0; font-size: .88rem; color: #d8ccb4; line-height: 1.25; } .feed p.mine { color: #ffe08a; font-weight: 700; }

/* ---------- hp bars ---------- */
.hpbar { position: relative; height: 22px; margin: 6px 0; border-radius: 11px; background: #3a2410; border: 2px solid #a57b3c; overflow: hidden; }
.hpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #6fd46a, #2d8a35); transition: width .3s; }
.hpbar.low i { background: linear-gradient(180deg, #ff8a5a, #b8321e); }
.hpbar span { position: relative; display: block; text-align: center; color: #fff; font-weight: 700; font-size: .85rem; line-height: 18px; text-shadow: 0 1px 1px #000; }
.hpbar.world i { background: linear-gradient(180deg, #ee7a5a, #a8261c); }

/* ---------- sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 180; background: rgba(20,10,4,.65); display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop[hidden] { display: none; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 16px 14px 20px; border-radius: 16px 16px 0 0; }
@media (min-width: 900px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; max-height: 94vh; } }
.sheet-close { position: absolute; top: 8px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--brass); background: #fff4d8; font-size: 1.1rem; cursor: pointer; z-index: 2; }
.sheet h2 { font-family: "Cinzel Deco", serif; margin: 0 44px 6px 0; font-size: 1.35rem; }
.confirm { text-align: center; } .confirm h2 { margin: 0 0 4px; } .confirm p { margin: 6px 0; font-size: 1.08rem; }
.big-ico { font-size: 3rem; line-height: 1; margin: 4px 0; }
/* the pre-fight power card */
.pcard .pc-head small { color: var(--ink-soft); font-size: .9rem; } .pcard .pc-head h2 { margin: 0 44px 8px 0; }
.pcard .wound { font: 700 .75rem "Crimson", serif; color: #fff; background: #8a2b22; padding: 1px 6px; border-radius: 6px; vertical-align: middle; }
.scout { position: relative; height: 150px; border-radius: 12px; overflow: hidden; background: center 72% / cover no-repeat; border: 2px solid #8a6230; box-shadow: inset 0 0 24px rgba(0,0,0,.5); }
.scout-row { position: absolute; left: 0; right: 0; top: 10px; bottom: 44px; display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.scout-row img { height: var(--h, 80%); max-width: 32%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 4px 4px rgba(0,0,0,.6)); }
.scout-row img.boss { height: 100%; max-width: 60%; } .scout-row img.fly { height: 40%; align-self: center; }
.scout-heroes { position: absolute; left: 0; right: 0; bottom: -18px; display: flex; justify-content: center; gap: 10px; }
.scout-heroes img { height: 82px; object-fit: contain; object-position: top; filter: drop-shadow(0 0 3px rgba(0,0,0,.7)) brightness(.92); }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: stretch; margin: 10px 0 4px; }
.vs .side { margin: 0; text-align: center; padding: 8px 6px; border-radius: 12px; background: rgba(255,255,255,.5); border: 2px solid #c9a86a; display: flex; flex-direction: column; }
.vs .side.you { border-color: #3d7a45; } .vs .side.foe { border-color: #8a2b22; }
.vs .side small { font-size: .88rem; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.vs .side b { font-size: 1.3rem; }
.vs .side em { font-style: normal; font-size: .85rem; color: var(--ink-soft); min-height: 1.2em; } .vs .side em span { display: block; font-size: .74rem; }
.vs .side strong { margin-top: auto; font: 700 1.9rem "Cinzel Deco", serif; line-height: 1.1; padding-top: 4px; border-top: 1px dashed rgba(90,64,40,.4); }
.vs .side.you strong { color: var(--green); } .vs .side.foe strong { color: #8a2b22; }
.vs-mid { align-self: center; font: 700 1.3rem "Cinzel Deco", serif; color: var(--ink-soft); }
.verdict { text-align: center; font: 700 1.2rem "Cinzel Deco", serif; margin: 6px 0; }
.pc-hp { display: flex; align-items: center; gap: 8px; } .pc-hp span { white-space: nowrap; font-weight: 700; } .pc-hp .hpbar { flex: 1; }
.ko-note { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: #efe4d0; border: 1px solid #8a7458; font-weight: 700; text-align: center; }
.boss-hp .hpbar { height: 24px; }
.dmglist { list-style: none; padding: 0; margin: 4px 0; counter-reset: d; }
.dmglist li { display: flex; gap: 6px; align-items: baseline; padding: 2px 6px; font-size: .92rem; border-radius: 6px; counter-increment: d; }
.dmglist li::before { content: counter(d) "."; width: 16px; color: var(--ink-soft); font-size: .8rem; }
.dmglist li span { flex: 1; } .dmglist li.me { background: rgba(224,176,64,.35); font-weight: 700; }
/* results */
.results, .boss-reward { text-align: center; }
.big-seal { width: 76px; height: 76px; margin: 4px auto 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; font-weight: 700;
  background: radial-gradient(circle at 35% 30%, #d0413a, var(--wax) 60%, #5a0e0e); border: 3px solid #e9c27a; box-shadow: 0 4px 10px rgba(0,0,0,.4); }
.big-seal.win { background: radial-gradient(circle at 35% 30%, #ffe08a, #c08a1e 60%, #6a4a0a); }
.results h2, .boss-reward h2 { margin: 0 0 2px; } .results .sub, .boss-reward .sub { margin: 0 0 8px; color: var(--ink-soft); }
.br-art { height: 130px; object-fit: contain; filter: grayscale(.6) drop-shadow(0 4px 6px rgba(0,0,0,.5)); transform: rotate(-8deg); }
.rewards { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.rewards div { flex: 1 1 30%; padding: 8px 4px; border-radius: 10px; background: rgba(255,255,255,.45); border: 1px solid #c9a86a; }
.rewards b { display: block; font-size: 1.05rem; } .rewards small { font-size: .78rem; color: var(--ink-soft); }
.rewards .chest { background: #fff1c4; border-color: #c08a1e; }
.board { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: .95rem; text-align: left; }
.board th { font-size: .75rem; text-transform: uppercase; color: var(--ink-soft); border-bottom: 2px solid #a57b3c; }
.board td { padding: 4px 3px; border-bottom: 1px dashed rgba(90,64,40,.3); }
.board tr.me td { background: rgba(224,176,64,.35); font-weight: 700; }
.boards h3.bh { font-family: "Cinzel Deco", serif; font-size: 1rem; margin: 10px 0 0; text-align: left; } .boards h3.bh small { font-family: "Crimson", serif; font-weight: 400; color: var(--ink-soft); }
.honors { margin: 8px 0 10px; text-align: left; } .honors .bh { margin: 0 0 6px; font-family: "Cinzel Deco", serif; font-size: 1rem; }
.hon-row { display: grid; gap: 6px; }
.hon { display: grid; grid-template-columns: 38px 1fr; align-items: center; column-gap: 8px; padding: 8px 10px; border-radius: 10px; background: linear-gradient(#fbf1d9, #efdcb2); border: 2px solid #b08a4a; }
.hon .hi { grid-row: span 2; font-size: 1.7rem; text-align: center; } .hon b { font-size: 1rem; } .hon small { color: var(--ink-soft); font-size: .8rem; }
.hon.title { background: linear-gradient(#ffe9a8, #e6b94a); border-color: #8a5a10; }
.hon.trophy.silver { background: linear-gradient(#f3f3f0, #cfd2d6); border-color: #7d8288; } .hon.trophy.bronze { background: linear-gradient(#f5dcc2, #d49a6a); border-color: #85522a; }
.hon.banner { background: linear-gradient(90deg, #7a1d1d, #a8322a); color: #fff3dc; border-color: #4a0f0f; } .hon.banner.even { background: linear-gradient(90deg, #1d3f6a, #2f5f94); border-color: #10233d; } .hon.banner small { color: #f3d9b8; }
.hon.sticker { grid-template-columns: 1fr; padding: 6px 10px; border-style: dashed; } .honors.none { text-align: center; }

/* ---------- the arena overlay (battles + scenes) ---------- */
.arena { position: fixed; inset: 0; z-index: 150; background: #120c06; }
.arena[hidden] { display: none; }
.arena-host { position: absolute; inset: 0; }
.arena .bv-stage { height: 100%; }
.after { padding: 10px 12px; border-radius: 12px; background: linear-gradient(180deg, #fbeccb, #e2c58c); border: 2px solid #8a6230; box-shadow: 0 8px 20px rgba(0,0,0,.55); text-align: center; color: var(--ink); }
.after p { margin: 4px 0; font-size: 1rem; } .after .btn.huge { margin: 6px 0 0; }
.after .af-row { display: flex; align-items: center; gap: 8px; } .after .af-row span { font-weight: 700; white-space: nowrap; } .after .af-row .hpbar { flex: 1; margin: 2px 0; }
.after .row .btn { flex: 1; }

/* ---------- tip / toast / lab ---------- */
.tip { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 195; width: min(92vw, 360px); padding: 12px 14px; border-radius: 12px; background: linear-gradient(180deg, #fff4d8, #ecd6a4); border: 2px solid var(--brass); box-shadow: 0 10px 24px rgba(0,0,0,.5); text-align: center; }
.tip[hidden] { display: none; } .tip p { margin: 0 0 8px; font-size: 1.05rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 199; padding: 10px 16px; border-radius: 10px; background: #fff4d8; border: 2px solid var(--brass); font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.5); max-width: 90vw; text-align: center; }
.toast[hidden] { display: none !important; }
.dev { margin-top: 16px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.3); color: #e8d3a8; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dev .note { width: 100%; margin: 4px 0 0; font-size: .8rem; opacity: .85; }

/* ---------- desktop: map left, choices right ---------- */
@media (min-width: 900px) {
  .castle { max-width: 1120px; padding-top: 64px; }
  #lobby { max-width: 620px; margin: 0 auto; }
  .race-top { grid-template-columns: .7fr .8fr 1fr 1.6fr; max-width: 1120px; }
  .race-main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr); gap: 12px; align-items: start; }
  .map { height: calc(100vh - 240px); min-height: 520px; }
  .side { margin-top: 0; }
  .node { width: 130px; } .node .medal { width: 70px; height: 70px; } .node.boss .medal { width: 96px; height: 96px; } .node .nl { font-size: .95rem; max-width: 150px; }
  .node .party { width: 54px; height: 54px; left: calc(50% - 68px); }
}
@media (max-width: 380px) { .node { width: 92px; } .node .medal { width: 52px; height: 52px; } .node .nl { font-size: .8rem; max-width: 104px; } }

/* ---------- no-scroll pass (castle21ns): every screen fits 390x844 and 1280x800 ---------- */
/* (no overflow:hidden on body: the layout itself must fit) */
body.castle-page { min-height: 0; }
.castle { height: 100vh; height: 100dvh; padding: 64px 10px 8px; display: flex; flex-direction: column; }
.castle > .screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.castle > .screen[hidden] { display: none; }
/* small Lab button in the top bar; the lab tools open as a sheet */
.lab-btn { height: 34px; padding: 0 10px; border-radius: 999px; border: 2px solid var(--brass); background: rgba(40,24,10,.75); color: #e8d3a8; font: 700 .8rem "Crimson", serif; cursor: pointer; opacity: .8; }
.lab-btn[aria-expanded="true"] { opacity: 1; background: #6b4226; }
footer.dev { display: none; position: fixed; z-index: 170; left: 10px; right: 10px; top: 62px; max-width: 520px; margin: 0 auto; background: rgba(30,18,8,.96); border: 2px solid var(--brass); box-shadow: 0 10px 30px rgba(0,0,0,.6); }
body.lab-open footer.dev { display: flex; }
/* lobby */
#lobby { justify-content: flex-start; gap: 6px; }
#lobby .sign { margin: 0 auto; padding: 6px 12px 5px; box-shadow: 0 4px 0 #2d1b0b, 0 8px 18px rgba(0,0,0,.4); }
#lobby .sign h1 { font-size: 1.4rem; } #lobby .sign p { font-size: .9rem; }
#lobby .modes { margin: 0; }
#lobby .mode-tab { padding: 6px 6px; min-height: 48px; } #lobby .mode-tab b { font-size: 1rem; } #lobby .mode-tab small { font-size: .8rem; }
#lobby .card { margin: 0; padding: 8px 10px; }
#partyCard .fine { margin: 0; font-size: .85rem; }
#partyCard .heroes { margin-top: 5px; gap: 6px; }
.pick-hero { min-height: 0; padding: 4px 3px 5px; }
.pick-hero img { height: 84px; }
.pick-hero b { font-size: .95rem; line-height: 1.1; } .pick-hero small { font-size: .74rem; line-height: 1.1; } .pick-hero em { font-size: .92rem; line-height: 1.1; }
#partyCard .party-power { margin-top: 6px; } #partyCard .party-power > div { padding: 3px 4px; } #partyCard .party-power b { font-size: 1.05rem; }
#modeCard { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#modeCard .mode-prize { font-size: .92rem; color: var(--ink-soft); line-height: 1.2; } #modeCard .mode-prize b { color: var(--ink); }
#modeCard .btn { flex: none; }
#lobby .btn.huge { margin: 2px 0 0; padding: 12px; min-height: 58px; }
#lobby .hint { margin: 0; font-size: .85rem; }
.rules-sheet h2 { margin-bottom: 4px; } .rules-sheet .rules li { padding: 5px 0; }
/* the climb (castle21ns): the map is the game and takes most of the screen; one thin status bar above, one boosts row below */
#race { max-width: 900px; width: 100%; margin: 0 auto; }
#race .race-top { margin-bottom: 4px; gap: 4px; } #race .st { padding: 2px 5px; }
#race .st small { font-size: .66rem; } #race .st b { font-size: .98rem; }
#race .race-sub { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: .82rem; }
#race .race-sub > span { flex: none; padding: 2px 8px; }
#race .climb { flex: 1; min-width: 0; margin: 0; padding: 12px 12px 3px; }
#race .race-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#race .map { flex: 1; min-height: 260px; height: auto; }
#race .side { flex: none; margin-top: 5px; }
#race .dock { padding: 6px; gap: 5px; margin-bottom: 5px; } #race .dock[hidden] { display: none; }
#race .dock-msg { font-size: .95rem; margin: 0; } #race .dock-msg.big { font-size: 1.15rem; padding: 6px 0; }
#race .choice { min-height: 52px; padding: 4px 8px 4px 5px; gap: 8px; }
#race .choice .ci { width: 42px; height: 42px; } #race .choice.boss .ci { width: 46px; height: 46px; }
#race .btn.huge { margin: 0; padding: 10px; min-height: 50px; font-size: 1.15rem; }
#race .ko-rest { padding: 6px 10px; gap: 2px; }
#race .boosts { margin: 0; }
#race .boost-row { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; }
#race .boost { min-height: 54px; padding: 4px 2px; } #race .boost .bi { font-size: 1.2rem; line-height: 1.1; } #race .boost b { font-size: .82rem; line-height: 1.1; } #race .boost small { font-size: .72rem; line-height: 1.15; }
#race .feed { margin: 0 0 4px; min-height: 0; height: 1.2em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#race .feed p { overflow: hidden; text-overflow: ellipsis; text-align: center; }
/* map nodes: few and big */
#race .map .node { width: 132px; }
#race .map .node .medal { width: 76px; height: 76px; }
#race .map .node.boss .medal { width: 96px; height: 96px; }
#race .map .node .nl { font-size: .95rem; max-width: 130px; }
#race .map .node .ns { font-size: .8rem; white-space: normal; text-align: center; line-height: 1.15; padding: 1px 5px; border-radius: 6px; background: rgba(20,12,6,.6); margin-top: 2px; }
#race .map .node .ns .v.strong { color: #9be38f; } #race .map .node .ns .v.close { color: #ffd36a; } #race .map .node .ns .v.weak { color: #ff9a86; }
#race .map .node .cost { position: absolute; top: 0; left: calc(50% + 26px); font-style: normal; font-weight: 700; font-size: .8rem; padding: 2px 6px; border-radius: 999px; background: #3a2410; color: #ffe066; border: 1.5px solid #e9c27a; z-index: 3; }
#race .map .node.here .medal { width: 64px; height: 64px; }
#race .map .node .party { width: 46px; height: 46px; top: 6px; left: calc(50% - 62px); }
#race .map .node.boss.here .medal { width: 96px; height: 96px; }
#race .map .node.boss.here .party { top: 20px; left: calc(50% - 76px); }
#race .map .node.here.boss { cursor: pointer; }
#race .map .map-hint { position: absolute; left: 0; right: 0; bottom: 6px; margin: 0; text-align: center; z-index: 3; color: #fff3d6; font-weight: 700; font-size: .9rem; text-shadow: 0 1px 2px #000, 0 0 6px #000; pointer-events: none; }
.lab-title { width: 100%; font-family: "Cinzel Deco", serif; }
@media (max-width: 389px) { #race .map .node { width: 112px; } #race .map .node .medal { width: 64px; height: 64px; } }
@media (min-width: 900px) {
  .castle { padding-top: 62px; }
  #lobby { max-width: 760px; width: 100%; margin: 0 auto; }
  #partyCard .heroes { grid-template-columns: repeat(6, 1fr); }
  .pick-hero img { height: 96px; }
  #race .race-main { display: flex; }
  #race .map .node { width: 170px; } #race .map .node .medal { width: 96px; height: 96px; } #race .map .node .nl { font-size: 1.05rem; max-width: 170px; } #race .map .node .ns { font-size: .9rem; }
  #race .map .node .cost { left: calc(50% + 34px); }
}
@media (max-width: 899px) { #race .climb-track .cm { width: 16px; height: 16px; top: -12px; } #race .climb { padding-top: 10px; } }
#race .race-main { align-items: stretch; }
#race .map .node .ns .v { display: block; }
/* night1: phone with Safari toolbars (~664px tall): fit the camp screen without page scroll */
@media (max-height: 760px) and (max-width: 899px) {
  #lobby .sign.banner { padding-top: 4px; padding-bottom: 4px; }
  #lobby .sign.banner p { display: none; }
  .pick-hero img { height: 58px; }
  .pick-hero small { display: none; }
  .pick-hero { padding: 3px; }
  #lobby .card.parchment { padding-top: 8px; padding-bottom: 8px; }
  #partyCard .fine { font-size: .8rem; }
  #lobby .hint { margin: 2px 0 0; font-size: .85rem; }
  .mode-tab { min-height: 48px; padding: 6px; }
}
