[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { --navy: #1e2c5a; --ink: #24345e; --ice: #c4ecf8; --ice2: #9ed2ee; --blue: #6f9fe0; --gold: #f7d24a; --gold-dk: #c89a1a; --red: #e5553c; --green: #5ad04a; --white: #ffffff;
  --cut: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px); }
html, body { margin: 0; height: 100%; background: #5b3b24; /* wood: iOS sometimes leaves a strip under the app, this lets the bottom bar run on into it */ color: var(--white); overscroll-behavior: none; font: 700 16px/1.3 ui-rounded, 'SF Pro Rounded', -apple-system, system-ui, sans-serif; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
canvas.px, .px { image-rendering: pixelated; image-rendering: crisp-edges; }
.o { -webkit-text-stroke: 5px #1a1226; paint-order: stroke fill; }
button:disabled { opacity: .45; filter: grayscale(.7); }
button:active:not(:disabled) { transform: translateY(2px); }

/* chunky pixel panels */
.card, .panel { background: var(--ice); color: var(--ink); border: 4px solid var(--ink); clip-path: var(--cut); padding: 12px; box-shadow: inset 0 0 0 3px #eafaff; }
.row { background: var(--ice2); color: var(--ink); border: 3px solid var(--ink); clip-path: var(--cut); padding: 8px 10px; }
.banner { background: var(--blue); color: #fff; border: 4px solid var(--ink); clip-path: var(--cut); text-align: center; padding: 6px 10px; margin: -4px 0 10px; font-size: 22px; text-shadow: 2px 2px 0 var(--ink); }
.btn { min-height: 52px; border: 4px solid var(--ink); clip-path: var(--cut); background: var(--ice2); color: var(--ink); font-weight: 700; font-size: 18px; padding: 4px 14px; box-shadow: inset 0 -4px 0 #0002, inset 0 3px 0 #fff8; }
.btn.gold { background: var(--gold); box-shadow: inset 0 -5px 0 var(--gold-dk), inset 0 3px 0 #fff9; }
.btn.blue { background: var(--blue); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.btn.wide { width: 100%; }
.sq { width: 44px; height: 44px; border: 3px solid var(--ink); clip-path: var(--cut); background: var(--blue); color: #fff; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.sq.small { width: 34px; height: 34px; font-size: 14px; }
.sq.big { width: 62px; height: 62px; font-size: 28px; background: #3a5a9a; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #24345e; color: #fff; clip-path: var(--cut); padding: 3px 8px; font-size: 15px; }
.lbl { font-size: 13px; opacity: .85; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.hint { display: flex; align-items: center; gap: 8px; margin: 0 10px; background: var(--ice); color: var(--ink); border: 3px solid var(--ink); clip-path: var(--cut); padding: 8px; font-size: 14px; }
.toast { background: var(--gold); color: var(--ink); border: 4px solid var(--ink); clip-path: var(--cut); padding: 8px 12px; text-align: center; font-size: 18px; }

/* ---------- home ---------- */
#home { position: fixed; inset: 0; display: flex; flex-direction: column;
  background: linear-gradient(#3b7fd0 0, #2f6cb8 100%); background-image: linear-gradient(#ffffff0d 2px, transparent 2px), linear-gradient(90deg, #ffffff0d 2px, transparent 2px), linear-gradient(#3b7fd0, #24569e); background-size: 24px 24px, 24px 24px, 100% 100%; }
.topbar { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 10px 6px; }
.res { background: #13204a; border: 3px solid #0a1230; clip-path: var(--cut); padding: 4px 12px; font-size: 18px; color: #fff; display: inline-flex; gap: 6px; align-items: center; }
#gold { flex: 1; max-width: 160px; }
#b-bag { margin-left: auto; }
#page { flex: 1; overflow-y: auto; padding: 6px 10px 14px; display: flex; flex-direction: column; gap: 10px; }
#nav { display: flex; align-items: flex-end; background: var(--navy); border-top: 4px solid #0e1636; padding: 4px 4px calc(env(safe-area-inset-bottom) + 4px); }
#nav button { flex: 1; border: 0; background: none; color: #8aa0d0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 60px; justify-content: center; font-size: 13px; }
#nav button i { font-style: normal; font-size: 26px; }
#nav button.on { color: #fff; background: #2f4a8e; clip-path: var(--cut); margin-top: -14px; min-height: 76px; }
#nav button.on i { font-size: 30px; }
/* battle */
.chapter { padding: 0; overflow: hidden; }
.chapter canvas { width: 100%; height: 240px; display: block; }
.chapter .info { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chapter h3 { margin: 0; font-size: 24px; }
.stars { font-size: 22px; letter-spacing: 2px; }
.bigplay { min-height: 70px; font-size: 26px; }
/* gear */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: center; background: linear-gradient(#8ccfef, #bfe6c8 70%, #8ab070 70%); border: 4px solid var(--ink); clip-path: var(--cut); padding: 10px; }
.hero .who { display: flex; justify-content: center; }
.slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; justify-items: center; }
.hex { width: 70px; height: 78px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--ink); display: flex; align-items: center; justify-content: center; position: relative; border: 0; padding: 0; }
.hex::before { content: ''; position: absolute; inset: 4px; clip-path: inherit; background: #4a6aa8; }
.hex > * { position: relative; }
.hex.common::before { background: #9aa8b8; } .hex.rare::before { background: #4a9ae8; } .hex.epic::before { background: #a85ae8; } .hex.legendary::before { background: #f0b030; }
.hex .lab { position: absolute; bottom: 6px; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 var(--ink); }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: #13204a; color: #fff; clip-path: var(--cut); padding: 6px; text-align: center; font-size: 15px; }
.stat b { display: block; font-size: 20px; }
.inv { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.slotbox { aspect-ratio: 1; border: 3px solid var(--ink); clip-path: var(--cut); background: #a8cce0; display: flex; align-items: center; justify-content: center; position: relative; padding: 0; }
.slotbox.common { background: #b8c4d0; } .slotbox.rare { background: #7ab8f0; } .slotbox.epic { background: #c48af0; } .slotbox.legendary { background: #f8c850; }
.slotbox .on { position: absolute; top: 2px; right: 3px; font-size: 11px; color: var(--ink); }
.item h3 { margin: 0; font-size: 22px; }
.rar { display: inline-block; padding: 2px 10px; color: #fff; text-shadow: 1px 1px 0 var(--ink); clip-path: var(--cut); font-size: 14px; }
.rar.common { background: #8898a8; } .rar.rare { background: #3a8ae0; } .rar.epic { background: #9a4ae0; } .rar.legendary { background: #e0a020; }
.lines { display: flex; flex-direction: column; gap: 4px; background: var(--ice2); border: 3px solid var(--ink); clip-path: var(--cut); padding: 8px; }
.lines .fx { color: #8a3ad0; }
.itemhead { display: flex; gap: 12px; align-items: center; }
.itemicon { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; border: 4px solid var(--ink); clip-path: var(--cut); background: #a8b8d8; }
.lore { font-size: 14px; font-style: italic; opacity: .85; }
/* anvil */
.recipe { display: flex; flex-direction: column; gap: 8px; }
.recipe .top { display: flex; gap: 10px; align-items: center; }
.recipe .top .itemicon { width: 60px; height: 60px; }
.needs { display: flex; flex-wrap: wrap; gap: 4px; }
.need { background: #fff8; border: 2px solid var(--ink); clip-path: var(--cut); padding: 2px 6px; font-size: 14px; }
.need.ok { background: #b8f0a8; } .need.no { background: #f0b0a8; }
.recipe.locked { opacity: .7; }
/* talents */
.tgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tal { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0; background: none; border: 0; color: #fff; }
.tal .hex { width: 76px; height: 84px; font-size: 30px; }
.tal small { font-size: 12px; text-align: center; text-shadow: 1px 1px 0 var(--ink); }
.tal.locked .hex::before { background: #6a7890; }
.tal.max .hex::before { background: #f0b030; }
.tier { color: #fff; font-size: 14px; text-shadow: 2px 2px 0 var(--ink); margin-top: 4px; }
/* codex */
.tabs { display: flex; gap: 6px; }
.tabs button { flex: 1; min-height: 46px; border: 3px solid var(--ink); clip-path: var(--cut); background: var(--ice2); color: var(--ink); font-size: 16px; }
.tabs button.on { background: var(--gold); }
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mcard { padding: 0 0 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.mcard .role { width: 100%; background: var(--blue); color: #fff; font-size: 13px; padding: 3px; text-shadow: 1px 1px 0 var(--ink); }
.mcard .pic { height: 74px; display: flex; align-items: center; justify-content: center; }
.mcard.unknown .pic canvas { filter: brightness(0) opacity(.45); }
.mcard b { font-size: 14px; }
.combo { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; background: var(--blue); color: #fff; border: 3px solid var(--ink); clip-path: var(--cut); padding: 6px 10px; }
.combo.on { background: #4a7ad0; box-shadow: inset 0 0 0 3px var(--gold); }
.combo b { text-shadow: 1px 1px 0 var(--ink); }
.combo .m { color: var(--gold); font-size: 22px; text-shadow: 2px 2px 0 var(--ink); }
.combo .dice { display: flex; gap: 3px; }
.combo .die { width: 26px; height: 26px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.seg { display: flex; border: 3px solid var(--ink); clip-path: var(--cut); }
.seg button { border: 0; background: var(--ice2); color: var(--ink); min-height: 40px; min-width: 64px; }
.seg button.on { background: var(--gold); }
.link { border: 0; background: none; color: #b03a2a; text-decoration: underline; min-height: 44px; }

/* ---------- dice (white, pips; gold glow when kept) ---------- */
.die { aspect-ratio: 1; background: #f4f8fc; border: 3px solid var(--ink); clip-path: var(--cut); position: relative; box-shadow: inset 0 -5px 0 #b8c8d8, inset 0 3px 0 #fff; }
.die i { position: absolute; width: 18%; height: 18%; background: #24345e; transform: translate(-50%, -50%); }
.die.keep { background: #bfe4ff; box-shadow: inset 0 0 0 3px #4ab0ff, inset 0 -5px 0 #8ab8e0; }
.die.rolling { animation: tumble .12s steps(2) infinite; }
@keyframes tumble { 0% { transform: rotate(-10deg) translateY(-3px); } 100% { transform: rotate(10deg) translateY(2px); } }

/* ---------- the run ---------- */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: fixed; left: 8px; top: calc(env(safe-area-inset-top) + 8px); display: flex; flex-direction: column; gap: 6px; z-index: 3; pointer-events: none; }
.lvl { display: flex; align-items: center; gap: 6px; }
.lvl b { font-size: 18px; text-shadow: 2px 2px 0 #1a1226; }
.xp { width: 110px; height: 12px; background: #1a1226; border: 2px solid #1a1226; }
.xp i { display: block; height: 100%; background: var(--gold); }
.tag { background: #1a1226cc; padding: 3px 12px; font-size: 18px; clip-path: var(--cut); align-self: flex-start; }
#b-pause { position: fixed; right: 8px; top: calc(env(safe-area-inset-top) + 8px); z-index: 3; background: #1a1226; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.mbar { position: absolute; transform: translate(-50%, 0); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mbar .hp { width: 64px; height: 12px; background: #1a1226; border: 2px solid #1a1226; position: relative; }
.mbar .hp i { display: block; height: 100%; background: #ef5a4a; }
.mbar .hp span { position: absolute; inset: -6px 0 0; text-align: center; font-size: 14px; }
.mbar .atk { background: #1a1226; padding: 0 6px; font-size: 14px; color: var(--gold); }
.mbar .sh { color: #9ad8ff; font-size: 12px; }
.herobar { position: absolute; transform: translate(-50%, 0); text-align: center; }
.herobar b { font-size: 24px; }
.herobar .hp { width: 120px; height: 14px; background: #1a1226; border: 2px solid #1a1226; }
.herobar .hp i { display: block; height: 100%; background: var(--green); }
.float { position: absolute; transform: translate(-50%, -50%); font-size: 26px; font-weight: 700; animation: rise .9s ease-out forwards; white-space: nowrap; }
.float.big { font-size: 38px; color: var(--gold); }
.float.bad { color: #ff6a5a; } .float.good { color: #7aff6a; } .float.loot { font-size: 18px; color: var(--gold); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -180%) scale(1); } }
.banner-float { position: absolute; left: 50%; top: 21%; transform: translate(-50%, -50%); width: max-content; max-width: 92vw; font-size: 22px; line-height: 1.2; text-align: center; color: var(--gold); background: rgba(12,8,16,.62); padding: 6px 14px; border-radius: 10px; animation: banner 2.2s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.9); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }
#fbottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; padding: 0 10px calc(env(safe-area-inset-bottom) + 8px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#readout { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.dia { width: 50px; height: 50px; margin: 0 10px; transform: rotate(45deg); background: #13204acc; border: 4px solid #0a1230; display: flex; align-items: center; justify-content: center; }
.dia b { transform: rotate(-45deg); font-size: 22px; color: var(--gold); }
#ro-hand { font-size: 20px; } #ro-hand em { font-size: 24px; }
#ro-hand em { font-style: normal; color: var(--gold); font-size: 28px; }
#dice { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; max-width: 420px; padding: 10px; background: #13204acc; clip-path: var(--cut); }
.dslot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dslot .die { width: 100%; }
.dslot small { font-size: 14px; color: var(--gold); min-height: 16px; }
.dslot .lock { width: 100%; aspect-ratio: 1; background: #3a4a6a; clip-path: var(--cut); display: flex; align-items: center; justify-content: center; font-size: 22px; opacity: .7; }
.pill { min-height: 40px; padding: 0 18px; border: 3px solid #0a1230; clip-path: var(--cut); background: #13204a; color: #fff; font-size: 20px; }
#fnav { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 420px; }
.attack { width: 150px; height: 110px; border: 0; background: none; position: relative; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.attack::before { content: ''; position: absolute; inset: 8px 22px; transform: rotate(45deg); background: linear-gradient(#8ab8ff, #4a7ad0); border: 5px solid var(--ink); box-shadow: inset 0 0 0 4px #c8e0ff; }
.attack > * { position: relative; }
.attack b { font-size: 34px; } .attack span { font-size: 16px; text-shadow: 2px 2px 0 var(--ink); }
/* overlays: skill cards, wheel */
#overlay { position: fixed; inset: 0; z-index: 8; background: #0a1230cc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.ovtitle { font-size: 34px; text-shadow: 3px 3px 0 var(--ink); }
.skill { width: 100%; max-width: 420px; display: grid; grid-template-columns: 80px 1fr; gap: 10px; align-items: center; border: 4px solid var(--ink); clip-path: var(--cut); background: #f0a040; color: #fff; padding: 8px; text-align: left; box-shadow: inset 0 0 0 4px #ffd890; }
.skill.blue { background: #6fa0e0; box-shadow: inset 0 0 0 4px #c8e0ff; }
.skill .ic { width: 76px; height: 76px; border: 3px solid var(--ink); clip-path: var(--cut); background: #ffd890; display: flex; align-items: center; justify-content: center; font-size: 38px; }
.skill b { display: block; font-size: 20px; text-shadow: 2px 2px 0 var(--ink); } .skill span { font-size: 15px; text-shadow: 1px 1px 0 var(--ink); }
.wheel { width: min(300px, 78vw); aspect-ratio: 1; border-radius: 50%; border: 8px solid #7a4a2a; position: relative; box-shadow: 0 0 0 4px var(--ink); transition: transform 2.2s cubic-bezier(.15,.8,.2,1); }
.wheel span { position: absolute; left: 50%; top: 50%; width: 46%; transform-origin: 0 50%; font-size: 12px; color: var(--ink); padding-left: 30px; }
.pointer { font-size: 34px; margin-bottom: -26px; z-index: 2; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 10; background: #0a1230b0; display: flex; align-items: center; justify-content: center; padding: calc(env(safe-area-inset-top) + 10px) 14px calc(env(safe-area-inset-bottom) + 10px); }
.sheet .card { width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; }
#sheet-body { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
@media (prefers-reduced-motion: reduce) { .die.rolling, .float, .wheel { animation: none; transition: none; } }

/* ---------- polish: icons, deeper panels, shiny buttons ---------- */
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.22em; margin: 0 1px; }
#nav i .ico { width: 30px; height: 30px; vertical-align: 0; }
#nav button:not(.on) i .ico { opacity: .75; }
.sq .ico { width: 34px; height: 34px; vertical-align: 0; }
.hex .ico, .tal .hex .ico, .skill .ic .ico { width: 40px; height: 40px; vertical-align: 0; }
.attack b .ico { width: 44px; height: 44px; vertical-align: 0; }
.pill .ico { width: 22px; height: 22px; }
.float .ico { width: 1.2em; height: 1.2em; }
.card, .panel { background: linear-gradient(#d4f2fc, #b4e0f2); box-shadow: inset 0 0 0 3px #f0fcff, inset 0 -8px 0 #8cc4e0, 0 4px 0 #0e1636; }
.row { background: linear-gradient(#b4dcf2, #98c8e4); box-shadow: inset 0 2px 0 #fff8, inset 0 -3px 0 #6aa4cc; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.banner { background: linear-gradient(#8ab8ff, #5a88d8); box-shadow: inset 0 3px 0 #fff6, inset 0 -4px 0 #2a4a9a; }
.btn { box-shadow: inset 0 -5px 0 #0003, inset 0 3px 0 #fffa, 0 3px 0 #0e1636; }
.btn.gold { background: linear-gradient(#ffe678, #f0b820); color: #5a3a00; box-shadow: inset 0 -5px 0 #b87a00, inset 0 3px 0 #fffb, 0 3px 0 #0e1636; text-shadow: 0 1px 0 #fff8; }
.btn.blue { background: linear-gradient(#8ab8ff, #5a88d8); box-shadow: inset 0 -5px 0 #2a4a9a, inset 0 3px 0 #fff7, 0 3px 0 #0e1636; }
.res { background: linear-gradient(#1c2c62, #10193e); box-shadow: inset 0 2px 0 #fff2; }
.sq { background: linear-gradient(#7aa8ec, #4a78c8); box-shadow: inset 0 3px 0 #fff6, inset 0 -3px 0 #2a4a9a; }
.stat { background: linear-gradient(#24346a, #13204a); box-shadow: inset 0 2px 0 #fff2; }
.stat b { color: var(--gold); text-shadow: 0 2px 0 #0008; }
.chapter canvas { border-bottom: 4px solid var(--ink); }
.hex::before { background: linear-gradient(#6a8ac8, #3a5a98); box-shadow: inset 0 3px 0 #fff4; }
.hex.common::before { background: linear-gradient(#c0ccd8, #8898a8); } .hex.rare::before { background: linear-gradient(#78bcff, #2a7ad8); }
.hex.epic::before { background: linear-gradient(#d09aff, #8a3ad0); } .hex.legendary::before { background: linear-gradient(#ffe070, #e09010); }
.hex.rare { filter: drop-shadow(0 0 4px #4a9ae8); } .hex.epic { filter: drop-shadow(0 0 5px #b06af0); } .hex.legendary { filter: drop-shadow(0 0 7px #ffc030); }
.slotbox { box-shadow: inset 0 3px 0 #fff6, inset 0 -3px 0 #0002; }
.slotbox.rare { box-shadow: inset 0 0 0 2px #3a8ae0, 0 0 6px #4a9ae8; } .slotbox.epic { box-shadow: inset 0 0 0 2px #9a4ae0, 0 0 7px #b06af0; } .slotbox.legendary { box-shadow: inset 0 0 0 2px #e0a020, 0 0 9px #ffc030; animation: glint 1.6s ease-in-out infinite alternate; }
@keyframes glint { to { filter: brightness(1.2); } }
.itemicon { background: radial-gradient(#e0ecff, #a8b8d8); }
.need { display: inline-flex; align-items: center; gap: 2px; }
.hero { box-shadow: inset 0 -6px 0 #0002; }
.skill { box-shadow: inset 0 0 0 4px #ffd890, inset 0 -10px 0 #0002; }
.skill .ic { background: radial-gradient(#fff0c8, #f0b860); }
.combo { background: linear-gradient(#7aa4e8, #5a84d0); box-shadow: inset 0 2px 0 #fff4; }
.tabs button { box-shadow: inset 0 3px 0 #fff8, inset 0 -3px 0 #0002; }
.mcard.unknown .pic canvas { filter: brightness(0) opacity(.45); }
#nav { background: linear-gradient(#2a3c78, #1a2650); box-shadow: inset 0 3px 0 #fff2; }
#nav button.on { background: linear-gradient(#4a6ac0, #2f4a8e); box-shadow: inset 0 3px 0 #fff4; }
#b-reroll { display: inline-flex; align-items: center; gap: 4px; } #b-reroll.empty { opacity: .5; } .dslot .die { cursor: pointer; }
#b-reroll { background: none; border: 0; clip-path: none; min-height: 0; padding: 0; font-size: 22px; text-shadow: 0 2px 0 #1a1226, 0 0 6px #1a1226; }
#b-reroll .ico { width: 24px; height: 24px; }
/* the attack button: a round action */
.attack { width: 104px; height: 104px; margin-bottom: 2px; }
.attack::before { inset: 0; transform: none; border-radius: 50%; background: radial-gradient(circle at 50% 30%, #a8cbff, #4a7ad0 70%); border: 5px solid var(--ink); box-shadow: inset 0 0 0 3px #c8e0ff, inset 0 -8px 0 #2a4a9a, 0 4px 0 #0e1636; }
.attack b .ico { width: 40px; height: 40px; }
.attack span { font-size: 15px; }
.attack:active:not(:disabled) { transform: translateY(2px) scale(.96); }

/* ---------- the fight: soft light, frosted HUD ---------- */
#fight::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at 50% 38%, transparent 52%, rgba(4,26,36,.5) 100%); }
.tag, .chip { background: rgba(10,34,44,.5); backdrop-filter: blur(3px); }
#hud .tag, #hud .chip, #b-pause { box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
#b-pause { background: rgba(10,34,44,.55); }
#dice { background: linear-gradient(rgba(14,50,60,.42), rgba(8,30,40,.55)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.16), 0 6px 14px rgba(0,0,0,.25); backdrop-filter: blur(4px); }
.dslot .lock { background: rgba(120,150,150,.35); }
.dia { background: rgba(10,34,44,.55); border-color: rgba(255,255,255,.35); }
.xp { background: rgba(10,34,44,.6); border-color: rgba(255,255,255,.25); }
.mbar .hp, .herobar .hp { border-color: rgba(10,26,34,.8); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.mbar .hp i { background: linear-gradient(#ff8070, #d83a30); } .herobar .hp i { background: linear-gradient(#8aee70, #3aa83a); }
.mbar .atk { background: rgba(10,34,44,.7); }
.die { box-shadow: inset 0 -5px 0 #b8d0d8, inset 0 3px 0 #fff, 0 3px 6px rgba(0,0,0,.3); }
/* dice upgrades */



/* special dice and the build page */
.die.up { background: #ffe8c8; box-shadow: inset 0 -5px 0 #e8a860, inset 0 3px 0 #fff, 0 0 10px #ff9a30; }
.die .badge { position: absolute; right: -4px; top: -6px; min-width: 24px; height: 24px; padding: 0 3px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; background: #5a3a20; border: 2px solid #1a1226; border-radius: 50%; text-shadow: none; clip-path: none; }
.die .badge .ico { width: 16px; height: 16px; margin: 0; }



.stk { color: #ffb050; font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile { aspect-ratio: 1; border: 3px solid var(--ink); clip-path: var(--cut); background: radial-gradient(#fff0c8, #f0b860); display: flex; align-items: center; justify-content: center; padding: 0; }
.tile .ico { width: 34px; height: 34px; }
.tile.locked { background: #7a8aa8; opacity: .8; }
.tile.die-reroll { background: radial-gradient(#e8f6ff, #70c0f0); } .tile.die-combo { background: radial-gradient(#f4e8ff, #b890f0); } .tile.die-resonant { background: radial-gradient(#ffecec, #f08080); }
.tile.locked.die-reroll, .tile.locked.die-combo, .tile.locked.die-resonant { background: #7a8aa8; }

/* ---------- Dicero-style fight polish ---------- */
.lvl b { font-size: 20px; }
.xp { width: 130px; height: 12px; border-radius: 8px; background: rgba(10,34,44,.7); border: 2px solid rgba(255,255,255,.55); overflow: hidden; }
.xp i { background: linear-gradient(#ffe678, #f0b820); border-radius: 8px; }
#hud .tag { background: linear-gradient(90deg, rgba(10,34,44,.62), rgba(10,34,44,0)); clip-path: none; padding: 2px 30px 2px 0; display: flex; align-items: center; gap: 6px; box-shadow: none; backdrop-filter: none; }
#h-round { padding-left: 4px !important; font-size: 16px !important; opacity: .9; }
.sqi { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(#ffa850, #e8602a); border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.35); display: inline-flex; align-items: center; justify-content: center; }
.sqi.boss { background: linear-gradient(#b890ff, #7a40d8); }
.sqi .ico { width: 24px; height: 24px; margin: 0; }
#b-pause { border-radius: 10px; clip-path: none; width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.6); }
/* dice: chunky rounded cubes with round pips, sitting on a plate */
#dice { background: none; box-shadow: none; backdrop-filter: none; padding: 4px 0 0; gap: 10px; clip-path: none; }
.die { clip-path: none; border: 0; border-radius: 16%; background: linear-gradient(#ffffff, #dde8f2); box-shadow: inset 0 -7px 0 #aebfce, inset 0 2px 0 #fff, 0 7px 0 rgba(10,30,40,.35), 0 12px 12px rgba(0,0,0,.25); }
.die i { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5a6a88, #1a2540 70%); width: 19%; height: 19%; box-shadow: 0 1px 0 #fff8; }
.die.up { box-shadow: inset 0 -7px 0 rgba(0,0,0,.28), inset 0 2px 0 #fff8, 0 7px 0 rgba(10,30,40,.35), 0 0 16px var(--glow, #ff9a30), 0 12px 12px rgba(0,0,0,.25); }
.die.up i { background: radial-gradient(circle at 35% 30%, #fff8b0, #ffd020 60%, #d89a00); box-shadow: 0 0 0 2px rgba(60,20,0,.55); }
.die.up.t-anvil { --glow: #d8a060; background: repeating-linear-gradient(135deg, #9a6a3a 0 9px, #7a5230 9px 18px); }



.die .badge { left: 2px; right: auto; top: -10px; background: none; border: 0; border-radius: 0; filter: drop-shadow(0 2px 0 #1a1226) drop-shadow(0 0 3px #1a1226); font-size: 14px; color: #fff; font-weight: 700; }
.die .badge .ico { width: 24px; height: 24px; }
.dslot small { background: rgba(10,34,44,.55); border-radius: 10px; padding: 0 10px; min-height: 18px; margin-top: 8px; font-size: 15px; }
.dslot .lock { background: rgba(255,255,255,.18); border-radius: 16%; clip-path: none; box-shadow: inset 0 -5px 0 rgba(0,0,0,.18), 0 5px 0 rgba(10,30,40,.25); }
/* readout: a gold-rimmed diamond and the combo name */
.dia { background: rgba(10,34,44,.45); border: 3px solid #ffe9a0; box-shadow: 0 0 0 2px rgba(10,26,34,.5), inset 0 0 0 2px rgba(10,26,34,.35); }
#ro-hand { text-shadow: 0 2px 0 rgba(10,26,34,.8); }
.attack::before { border: 5px solid #f4d060; box-shadow: inset 0 0 0 3px #c8e0ff, inset 0 -8px 0 #2a4a9a, 0 0 0 3px #7a5a10, 0 5px 0 #0e1636; }
.herostat { position: absolute; transform: translate(0, -50%); font-size: 17px; line-height: 1.25; pointer-events: none; }
.herostat .ico { width: 20px; height: 20px; }
.die.up.t-reroll { --glow: #d8a060; background: repeating-linear-gradient(135deg, #9a6a3a 0 9px, #7a5230 9px 18px); }
.die.up.t-combo { --glow: #d8a060; background: repeating-linear-gradient(135deg, #9a6a3a 0 9px, #7a5230 9px 18px); }
.die.up.t-resonant { --glow: #d8a060; background: repeating-linear-gradient(135deg, #9a6a3a 0 9px, #7a5230 9px 18px); }
/* dice as cubes: top face (power) + front face (pips) */
.die .top { position: absolute; left: 0; right: 0; top: 0; height: 30%; border-radius: 16% 16% 0 0 / 50% 50% 0 0; background: linear-gradient(#ffffff, #eef4fa); box-shadow: inset 0 -3px 0 rgba(10,30,50,.18); display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: #fff; font-weight: 700; text-shadow: 0 1px 0 #1a1226, 0 0 2px #1a1226; }
.die .top .ico { width: auto; height: 82%; margin: 0; filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
.die i { width: 17%; height: 15%; }
.die.up .top { background: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.25)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.die.up.t-anvil .top { background-color: #c89a62; } .die.up.t-reroll .top { background-color: #c89a62; }
.die.up.t-combo .top { background-color: #c89a62; } .die.up.t-resonant .top { background-color: #c89a62; }
.combo .die .top { height: 26%; }
.dslot .die { aspect-ratio: 0.9; }
.dslot .die .top { height: 34%; font-size: 15px; }
.dslot .die i { height: 13%; }
/* pixel-art dice: the canvas is the die, CSS only adds glow and the level tag */
.die { background: none !important; box-shadow: none !important; border-radius: 0; clip-path: none; aspect-ratio: auto !important; filter: drop-shadow(0 5px 0 rgba(10,30,40,.3)); }
.die canvas { display: block; }
.die .top, .die i, .die .badge { display: none; }
.die.up { filter: drop-shadow(0 5px 0 rgba(10,30,40,.3)) drop-shadow(0 0 6px var(--glow, #ff9a30)); }
.die.up.t-anvil, .die.up.t-reroll, .die.up.t-combo, .die.up.t-resonant { --glow: #d8a060; }
.die.keep { filter: drop-shadow(0 0 0 #000) drop-shadow(0 0 5px #4ab0ff); }
.dlv { position: absolute; right: 4%; top: 2%; min-width: 22px; height: 22px; border-radius: 11px; background: #1a1226; color: #ffd84a; font-size: 14px; display: flex; align-items: center; justify-content: center; border: 2px solid #ffd84a; }
.skill .ic .die { width: 58px; }
.dtile { padding: 6px; background: radial-gradient(#ffffff, #c8d8e8) !important; }
.dtile .die { width: 100%; }
.combo .die { width: 26px; height: auto; filter: none; }

/* ---------- the camp (main menu) ---------- */
#page.flush { padding: 0; gap: 0; }
.stage { position: relative; border-bottom: 5px solid var(--ink); box-shadow: 0 6px 0 #0e1636, inset 0 -30px 40px -20px rgba(4,26,36,.5); overflow: hidden; flex: none; }
.stage canvas { width: 100%; height: 100%; display: block; }
.ribbon { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); min-width: 250px; text-align: center; padding: 8px 34px 10px; color: #fff; display: flex; flex-direction: column; gap: 0; background: linear-gradient(#5a8ae8, #3a62c0); clip-path: polygon(0 12%, 7% 12%, 7% 0, 93% 0, 93% 12%, 100% 12%, 100% 100%, 93% 100%, 93% 88%, 7% 88%, 7% 100%, 0 100%); filter: drop-shadow(0 3px 0 #0e1636); }
.ribbon b { font-size: 24px; line-height: 1.1; }
.ribbon span { font-size: 13px; opacity: .92; text-shadow: 0 1px 0 #0e1636; }
.starrow { position: absolute; left: 50%; top: 82px; transform: translateX(-50%); display: flex; gap: 6px; filter: drop-shadow(0 2px 0 rgba(10,26,34,.7)); }
.bestchip { position: absolute; right: 10px; bottom: 10px; background: rgba(10,34,44,.6); padding: 4px 12px; border-radius: 12px; font-size: 15px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.playzone { padding: 14px 12px 12px; display: flex; flex-direction: column; gap: 12px; }
.bigplay { min-height: 76px; font-size: 30px; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { filter: brightness(1); transform: scale(1); } 50% { filter: brightness(1.12); transform: scale(1.015); } }
.tiles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hinttile { min-height: 72px; border: 3px solid var(--ink); clip-path: var(--cut); background: linear-gradient(#2a4a8e, #1c3470); color: #cfe0ff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; padding: 6px 4px; line-height: 1.15; text-align: center; box-shadow: inset 0 2px 0 #fff3; }
.hinttile.on { background: linear-gradient(#f4c850, #d89a20); color: #4a2e00; box-shadow: inset 0 2px 0 #fff9, inset 0 -4px 0 #a06a00; }
.hinttile:not(.on) .ico { filter: grayscale(.7) brightness(.8); }
#nav button.dot { position: relative; }
#nav button.dot::after { content: ''; position: absolute; top: 8px; right: calc(50% - 26px); width: 14px; height: 14px; border-radius: 50%; background: #ff4a3a; border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.3); }
/* the other tabs: a calmer, richer backdrop */
#home { background: radial-gradient(ellipse at 50% 0, #4a8ae0 0, #2f64b8 45%, #1c3a78 100%); }
#page:not(.flush) { background-image: linear-gradient(#ffffff0a 2px, transparent 2px), linear-gradient(90deg, #ffffff0a 2px, transparent 2px); background-size: 24px 24px; }
.topbanner { position: absolute; left: 0; right: 0; top: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ribbon { position: static; transform: none; min-width: 280px; white-space: nowrap; padding: 8px 38px 10px; }
.ribbon b { font-size: 22px; }
.starrow { position: static; transform: none; }
#nav button.dot::after { width: 12px; height: 12px; top: 10px; right: calc(50% - 30px); border-width: 2px; }
/* the gambler on the road */
#npcbar { display: flex; gap: 10px; width: 100%; max-width: 420px; padding-bottom: 8px; }
#npcbar[hidden] { display: none !important; }
#npcbar .btn { flex: 1; min-height: 60px; font-size: 20px; }
#fbottom.npcmode > :not(#npcbar) { display: none !important; }
.bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; font-size: 15px; max-width: 220px; text-align: center; -webkit-text-stroke: 0; paint-order: normal; animation: pop .25s ease-out; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -10px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
#npcbubble { width: max-content; max-width: min(300px, 84vw); }   /* the gambler talks a lot */
#labels:has(#npcbubble) { z-index: 4; }   /* and covers the HUD while he does */
@keyframes pop { from { transform: translate(-50%, -80%) scale(.6); opacity: 0; } }

/* ---------- alive: hit feedback ---------- */
#hurt { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 55%, transparent 40%, rgba(255,40,30,.55) 100%); }
#dmgb { position: fixed; right: 0; top: 34%; z-index: 3; pointer-events: none; padding: 4px 14px 4px 34px; text-align: right; background: linear-gradient(90deg, transparent, rgba(10,26,34,.7) 40%); animation: slidein .2s ease-out; }
#dmgb[hidden] { display: none; }
#dmgb small { display: block; font-size: 14px; color: #ffe9a0; }
#dmgb b { font-size: 38px; color: var(--gold); font-style: italic; text-shadow: 0 3px 0 #1a1226, 0 0 12px #ff9a30; }
@keyframes slidein { from { transform: translateX(80px); opacity: 0; } }
.die.beat { animation: beat .26s ease-out; }
@keyframes beat { 35% { transform: translateY(-12px) scale(1.12); filter: brightness(1.5) drop-shadow(0 0 8px #fff); } }
.die.land { animation: land .32s ease-out; }
@keyframes land { 0% { transform: translateY(-22px) scale(1.08, .92); } 45% { transform: translateY(0) scale(1.12, .88); } 70% { transform: translateY(-5px) scale(.97, 1.04); } 100% { transform: none; } }
.float { font-style: italic; letter-spacing: 1px; text-shadow: 0 3px 0 #1a1226; }
.float.big { font-size: 46px; color: #ff9a30; }
.float.sm { font-size: 20px; color: #ffe9c0; }
#h-loot { font-size: 18px !important; padding-left: 4px !important; }
#h-loot.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); filter: brightness(1.4); } }
.fly { position: absolute; width: 20px; height: 20px; pointer-events: none; will-change: transform; filter: drop-shadow(0 0 4px #ffd84a); }
.fly .ico { width: 20px; height: 20px; margin: 0; }

/* ---------- Diablo-style sheet, sets, forge ---------- */
.charsheet { background: linear-gradient(#1c2a58, #121c40); color: #dfe8ff; border: 3px solid #0a1230; clip-path: var(--cut); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: inset 0 2px 0 #fff2; }
.powerline { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; color: #fff; border-bottom: 2px solid #ffffff22; padding-bottom: 4px; }
.powerline b { color: var(--gold); font-size: 20px; }
.sheetgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.srow { display: flex; justify-content: space-between; align-items: center; font-size: 14px; min-height: 26px; }
.srow b { color: #fff; font-size: 16px; }
.lbl2 { font-size: 13px; color: #a8b8e0; }
.setblock { display: flex; flex-direction: column; gap: 2px; font-size: 14px; background: #0a123066; padding: 6px 8px; border-radius: 6px; color: #dfe8ff; }
.bonus { color: #7a88b0; } .bonus.on { color: #7aff8a; }
.nm.common { color: #4a5a70; } .nm.rare { color: #1a72d8; } .nm.epic { color: #8a34d8; } .nm.legendary { color: #c07a00; }
.sline em { font-style: normal; font-size: 13px; } .up { color: #1a9a3a; } .down { color: #d03a2a; }
.cmp { font-size: 14px; }
.itemicon.rare { box-shadow: 0 0 10px #4a9ae8; } .itemicon.epic { box-shadow: 0 0 12px #b06af0; } .itemicon.legendary { box-shadow: 0 0 16px #ffc030; }
.rrow { display: grid; grid-template-columns: 50px 1fr 54px; gap: 8px; align-items: center; background: #0a123066; padding: 6px; border-radius: 6px; }
.itemicon.small { width: 48px; height: 48px; border-width: 3px; }
.rmid { display: flex; flex-direction: column; gap: 3px; min-width: 0; } .rmid b { font-size: 15px; color: #fff; }
.rrow .need { font-size: 13px; color: var(--ink); padding: 1px 5px; }
.fbtn { min-height: 48px; padding: 0; font-size: 20px; }
.forgeov { position: fixed; inset: 0; z-index: 20; touch-action: none; }
.forgeov canvas { width: 100%; height: 100%; display: block; }
.forgehint { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font-size: 22px; color: #fff; pointer-events: none; animation: pulse 1.2s ease-in-out infinite; }
.card.reveal { animation: revealpop .45s cubic-bezier(.2,1.6,.4,1); }
.card.reveal.rare { box-shadow: inset 0 0 0 5px #4aa8ff; } .card.reveal.epic { box-shadow: inset 0 0 0 5px #b86aff; } .card.reveal.legendary { box-shadow: inset 0 0 0 5px #ffc030; }
@keyframes revealpop { from { transform: scale(.6); opacity: 0; } }
.item .setblock, .sheet .setblock { background: #1c2a58; }

/* ---------- the dwarves' camp: wood, parchment, iron and firelight ---------- */
:root { --brown: #3a2212; --cream: #f4e4bc; }
#home { background: #231917 var(--t-brick); background-size: 64px 64px; image-rendering: pixelated; }
#home::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 100%, rgba(255,140,50,.16), transparent 62%), linear-gradient(rgba(10,6,4,.45), transparent 22%); }
#page:not(.flush) { background-image: none; position: relative; z-index: 1; }
.topbar, #nav { position: relative; z-index: 2; }
.card, .panel, .row, .banner, .btn, .sq, .res, .tabs button, .combo, .charsheet, .hinttile, .slotbox, .need, .hint, .toast, .itemicon, .lines, .stat, .seg, .skill .ic, .tile, .skill { clip-path: none; box-shadow: none; }
.card, .panel { border: 12px solid transparent; border-image: var(--t-parchment) 8 fill / 16px round; background: none; color: var(--brown); padding: 6px; image-rendering: pixelated; }
.sheet .card { border-image: var(--t-parchment) 8 fill / 16px round; background: none; }
.charsheet { border: 12px solid transparent; border-image: var(--t-dark) 8 fill / 16px round; background: none; color: var(--cream); padding: 4px 6px; image-rendering: pixelated; }
.powerline { color: #ffe9b0; border-bottom: 2px solid #ffffff1c; text-shadow: 0 2px 0 #140d0a; }
.lbl2 { color: #c8ae88; } .srow b { color: #fff4d4; } .bonus { color: #8a7458; } .bonus.on { color: #9aee7a; }
.setblock, .item .setblock, .sheet .setblock { background: #1e1410; color: var(--cream); border: 2px solid #4a2e18; }
.rrow { background: #1e1410aa; border: 2px solid #4a2e18; }
.rmid b { color: #fff4d4; }
.row { border: 10px solid transparent; border-image: var(--t-parchment) 8 fill / 14px round; background: none; color: var(--brown); padding: 2px 6px; image-rendering: pixelated; }
.lines { border: 8px solid transparent; border-image: var(--t-parchment) 8 fill / 12px round; background: none; color: var(--brown); padding: 2px 4px; image-rendering: pixelated; }
.banner { border: 12px solid transparent; border-image: var(--t-wood) 8 fill / 16px round; background: none; color: #ffe9b0; text-shadow: 0 2px 0 #2a1710; padding: 0 6px; margin: 0 0 8px; image-rendering: pixelated; }
.toast { border: 10px solid transparent; border-image: var(--t-gold) 8 fill / 14px round; background: none; color: #4a2c08; padding: 0 6px; image-rendering: pixelated; }
.btn { border: 10px solid transparent; border-image: var(--t-steel) 8 fill / 14px round; background: none; color: #fff; text-shadow: 0 2px 0 #1e222a; padding: 0 8px; image-rendering: pixelated; }
.btn.gold { border-image: var(--t-gold) 8 fill / 14px round; background: none; color: #4a2c08; text-shadow: 0 1px 0 #fff4; box-shadow: none; }
.btn.blue { border-image: var(--t-wood) 8 fill / 14px round; background: none; color: #ffe9b0; text-shadow: 0 2px 0 #2a1710; box-shadow: none; }
.btn:disabled { filter: grayscale(.8) brightness(.8); opacity: 1; }
.sq { border: 8px solid transparent; border-image: var(--t-wood) 8 fill / 12px round; background: none; image-rendering: pixelated; }
.res { border: 10px solid transparent; border-image: var(--t-dark) 8 fill / 14px round; background: none; color: #ffe9b0; padding: 0 6px; image-rendering: pixelated; }
#nav { border-top: 0; background: none; padding-top: 0; border-style: solid; border-color: transparent; border-width: 12px 0 0; border-image: var(--t-wood) 8 fill / 16px 0 0 round; box-shadow: none; image-rendering: pixelated; }
#nav button { color: #d8b890; text-shadow: 0 2px 0 #2a1710; }
#nav button.on { background: radial-gradient(ellipse at 50% 70%, rgba(255,160,60,.55), transparent 72%); clip-path: none; color: #fff; box-shadow: none; }
#nav button:not(.on) i .ico { opacity: .8; }
.tabs button { border: 10px solid transparent; border-image: var(--t-wood) 8 fill / 14px round; background: none; color: #ffe9b0; text-shadow: 0 2px 0 #2a1710; font-size: 15px; image-rendering: pixelated; }
.tabs button.on { border-image: var(--t-gold) 8 fill / 14px round; color: #4a2c08; text-shadow: none; background: none; }
.tier { color: #ffe9b0; text-shadow: 0 2px 0 #140d0a; }
.place { position: relative; border: 12px solid transparent; border-image: var(--t-wood) 8 fill / 16px round; image-rendering: pixelated; flex: none; }
.place canvas { display: block; width: 100%; height: auto; }
.quip { position: absolute; left: 25%; top: 2px; max-width: 46%; background: #fff8e4; color: var(--brown); border: 2px solid var(--brown); border-radius: 10px; padding: 3px 8px; font-size: 13px; line-height: 1.2; animation: pop .3s ease-out; }
.quip::after { content: ''; position: absolute; left: -9px; bottom: 6px; border: 5px solid transparent; border-right-color: var(--brown); border-left: 0; }
.hero { border: 12px solid transparent; border-image: var(--t-wood) 8 fill / 16px round; background: none; padding: 4px; clip-path: none; box-shadow: none; image-rendering: pixelated; }
.hex { background: #2a1710; } .hex::before { background: linear-gradient(#8a5a30, #5a3a20); }
.hex .lab { color: #ffe9b0; text-shadow: 0 1px 0 #1a0e08; }
.slotbox { border: 8px solid transparent; border-image: var(--t-dark) 8 fill / 12px round; background: none; image-rendering: pixelated; }
.slotbox.common { background: #6a707a55; } .slotbox.rare { background: #2a7ad866; box-shadow: none; } .slotbox.epic { background: #8a3ad877; box-shadow: none; } .slotbox.legendary { background: #e0a02088; box-shadow: none; }
.itemicon { border: 8px solid transparent; border-image: var(--t-dark) 8 fill / 12px round; background: none; image-rendering: pixelated; }
.need { background: #f4e4bc; border: 2px solid #4a2e18; } .need.ok { background: #cfe8a0; } .need.no { background: #f0b090; }
.hinttile { border: 10px solid transparent; border-image: var(--t-dark) 8 fill / 14px round; background: none; color: #d8c0a0; image-rendering: pixelated; }
.hinttile.on { border-image: var(--t-gold) 8 fill / 14px round; background: none; color: #4a2c08; box-shadow: none; }
.ribbon { background: linear-gradient(#a8743e, #744824); filter: drop-shadow(0 3px 0 #2a1710); }
.stage { border-bottom: 0; box-shadow: none; }
.tal small { text-shadow: 0 2px 0 #140d0a; color: #ffe9b0; }
.tal .hex::before { background: linear-gradient(#8a5a30, #5a3a20); } .tal.locked .hex::before { background: #4a4048; } .tal.max .hex::before { background: linear-gradient(#ffe070, #e09010); }
.combo { border: 10px solid transparent; border-image: var(--t-dark) 8 fill / 14px round; background: none; image-rendering: pixelated; }
.combo.on { border-image: var(--t-gold) 8 fill / 14px round; background: none; box-shadow: none; }
.mcard .role { background: #744824; }
.tile { border: 8px solid transparent; border-image: var(--t-dark) 8 fill / 12px round; image-rendering: pixelated; }
.tile, .dtile { background: none !important; } .tile.locked { background: none; }
.skill { border: 12px solid transparent; border-image: var(--t-ember) 8 fill / 16px round; background: none; padding: 2px; image-rendering: pixelated; }
.skill.blue { border-image: var(--t-wood) 8 fill / 16px round; background: none; }
.skill.dice { border-image: var(--t-steel) 8 fill / 16px round; background: none; }
.skill .ic { border: 8px solid transparent; border-image: var(--t-parchment) 8 fill / 12px round; background: none; }
.nm.common { color: #5a4a3a; } .nm.rare { color: #1a62c0; } .nm.epic { color: #7a24c8; } .nm.legendary { color: #b06a00; }
.lbl { opacity: .9; }
#fight .sq { border-image: var(--t-wood) 8 fill / 12px round; }
#b-pause { background: none; border-radius: 0; }
.tgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tal { width: 84px; }
.tier { text-align: center; }
.quip { left: 24%; top: 0; max-width: 56%; font-size: 12px; }
.fx.legendary { color: #b06a00; }
.need.rarec { border-color: #e0a020; box-shadow: 0 0 6px #ffc030; }
/* the road to the boss: one dot per wave */
#trail { position: fixed; z-index: 3; left: 47%; right: 62px; top: calc(env(safe-area-inset-top) + 20px); display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
#trail::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1px; background: rgba(10,26,34,.55); }
#trail i { position: relative; width: 9px; height: 9px; border-radius: 50%; background: #e8e4d0; box-shadow: 0 0 0 2px rgba(10,26,34,.7); }
#trail i.done { background: #ffc030; }
#trail i.now { width: 13px; height: 13px; background: #ff7a30; box-shadow: 0 0 0 2px #fff, 0 0 8px #ff9a30; }
#trail i.end { width: 14px; height: 14px; border-radius: 3px; background: #b84ad8; }
#trail i.end.now { background: #ff4a4a; }
.mbar .hp i, .herobar .hp i { transition: width .1s linear; }
/* the dwarf on his sheet breathes */
.who canvas { transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scaleY(1.025); } }
@media (prefers-reduced-motion: reduce) { .who canvas { animation: none; } }
/* forge: filter and what a recipe can give */
.fseg { display: flex; } .fseg button { flex: 1; min-height: 44px; font-size: 15px; }
button.itemicon { padding: 0; cursor: pointer; }
.roll { display: flex; flex-direction: column; gap: 1px; padding: 4px 2px; } .roll + .roll { border-top: 1px solid #4a2e1844; }
.rolltop { display: flex; justify-content: space-between; align-items: baseline; }

.nameinput { width: 100%; min-height: 48px; font: inherit; font-size: 18px; padding: 6px 12px; border: 3px solid var(--ink); background: #fff; color: var(--ink); }

.sline.gone, .fx.gone { opacity: .6; text-decoration: line-through; } .sline.gone em, .fx.gone em { text-decoration: none; display: inline-block; }
.bonus.down { color: #d03a2a; }

.need, .row.tap { cursor: pointer; } .need { min-height: 32px; }
.monrow { display: flex; align-items: center; gap: 12px; } .monrow .px { flex: none; }
.monpic { flex: none; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.monrow > div:last-child { text-align: left; }

.card.reveal.legendary { animation: revealpop .45s cubic-bezier(.2,1.6,.4,1), revleg 1.6s ease-out; } .card.reveal.epic { animation: revealpop .45s cubic-bezier(.2,1.6,.4,1), revepic 1.2s ease-out; }
@keyframes revleg { 0% { box-shadow: 0 0 0 0 #ffe070; filter: brightness(2.2); } 100% { box-shadow: 0 0 60px 20px #ffc03000; filter: none; } }
@keyframes revepic { 0% { box-shadow: 0 0 0 0 #c880ff; filter: brightness(1.8); } 100% { box-shadow: 0 0 50px 16px #b86aff00; filter: none; } }

#rhythm { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 2px 0; color: #ffd890; font-size: 16px; font-weight: 800; text-shadow: 0 2px 0 #1a1226, 0 0 6px #1a1226; }
#rhythm[hidden] { display: none; }
#rhythm i { font-style: normal; width: 16px; height: 16px; border: 2px solid #1a1226; border-radius: 50%; background: #3a2a22; display: inline-flex; align-items: center; justify-content: center; }
#rhythm i.on { background: #ffa030; box-shadow: 0 0 6px #ff9020; }
#rhythm i.star { border-radius: 4px; width: 22px; height: 22px; background: #4a3a30; } #rhythm i .ico { width: 16px; height: 16px; margin: 0; opacity: .5; }
#rhythm.ready { color: #fff4b0; animation: rhythmpulse .7s ease-in-out infinite alternate; } #rhythm.ready i.star { background: #ffb030; box-shadow: 0 0 12px #ffa020; } #rhythm.ready i .ico { opacity: 1; } #rhythm.ready i.on { background: #ffc040; }
@keyframes rhythmpulse { to { transform: scale(1.08); text-shadow: 0 2px 0 #1a1226, 0 0 12px #ffa020; } }

/* inventory and gear slots: a glow from the middle shows the rarity (none for common) */
.slotbox > :not(.on) { position: relative; z-index: 1; }
.slotbox.rare::before, .slotbox.epic::before, .slotbox.legendary::before { content: ''; position: absolute; inset: 3px; pointer-events: none; }
.slotbox.rare { box-shadow: 0 0 6px #4aa8ff88; animation: none; } .slotbox.rare::before { background: radial-gradient(circle at 50% 52%, #4aa8ffaa 0%, #4aa8ff33 45%, transparent 75%); }
.slotbox.epic { box-shadow: 0 0 9px #b86affbb; animation: none; } .slotbox.epic::before { background: radial-gradient(circle at 50% 52%, #b86affcc 0%, #b86aff55 48%, transparent 78%); }
.slotbox.legendary { box-shadow: 0 0 12px #ffc030dd, 0 0 3px #fff4b0; animation: legglow 1.8s ease-in-out infinite alternate; }
.slotbox.legendary::before { background: radial-gradient(circle at 50% 52%, #ffe070ee 0%, #ffc030aa 40%, #ff9a1044 62%, transparent 80%); }
@keyframes legglow { from { box-shadow: 0 0 8px #ffc030aa, 0 0 2px #fff4b0; filter: brightness(1); } to { box-shadow: 0 0 16px #ffc030, 0 0 4px #fff4b0; filter: brightness(1.15); } }

.mbar .atk.guard { color: #8ad0ff; animation: rhythmpulse .7s ease-in-out infinite alternate; } .mbar .atk.charge { color: #ff9a6a; }

.gatebox { display: flex; flex-direction: column; gap: 14px; align-items: stretch; padding: 0 8px; } .gatetext { color: #fff4d8; font-size: 18px; text-align: center; line-height: 1.3; text-shadow: 0 2px 0 #1a1226; }

/* Ember dice: reds and oranges */
.die.up.t-cinder { --glow: #ff6a30; background: repeating-linear-gradient(135deg, #e0461a 0 9px, #bc3414 9px 18px); } .die.up.t-kindling { --glow: #ff6a30; background: repeating-linear-gradient(135deg, #e0461a 0 9px, #bc3414 9px 18px); }
.die.up.t-spark { --glow: #ff6a30; background: repeating-linear-gradient(135deg, #e0461a 0 9px, #bc3414 9px 18px); } .die.up.t-wildfire { --glow: #ff6a30; background: repeating-linear-gradient(135deg, #e0461a 0 9px, #bc3414 9px 18px); }
.die.up.t-cinder .top { background-color: #ff9460; } .die.up.t-kindling .top { background-color: #ff9460; } .die.up.t-spark .top { background-color: #ff9460; } .die.up.t-wildfire .top { background-color: #ff9460; }
/* the powers sheet */
.pwcard { display: flex; align-items: center; gap: 12px; padding: 10px; border: 3px solid transparent; text-align: left; width: 100%; background: none; color: inherit; font: inherit; }
.pwcard.on { border-color: var(--pw, #ffd070); box-shadow: 0 0 14px var(--pw, #ffd070); } .pwcard.locked { opacity: .55; }
.pwcard .pwic { flex: none; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(0,0,0,.25); } .pwcard .pwic .ico { width: 40px; height: 40px; margin: 0; }
.pwcard b { display: block; font-size: 20px; color: var(--pw, #fff); } .pwcard span { font-size: 15px; line-height: 1.25; display: block; }
.pwrow { display: flex; gap: 8px; align-items: center; justify-content: center; }


/* gear filter chips */
.fchips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; flex: none; } .fchips::-webkit-scrollbar { display: none; }
.fchip { flex: none; min-height: 44px; clip-path: none; white-space: nowrap; padding: 0 14px; border: 3px solid #1a1226; border-radius: 22px; background: #3a2a22; color: #f4e6c8; font-size: 16px; font-weight: 700; border-left: 8px solid var(--chip, #8a7a6a); }
.fchip.on { background: #f0c040; color: #2a1810; }
/* chapter 3: spores on a die (it can't be rerolled), and the glow when your hand will burst them */
.die.spored::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 35% 40%, rgba(200,120,230,.5), rgba(110,50,140,.28) 70%); pointer-events: none; }
.die .spo { position: absolute; left: -2px; top: -6px; display: flex; align-items: center; gap: 1px; color: #f8e0ff; font-size: 13px; z-index: 2; pointer-events: none; }
.die .spo .ico { width: 18px; height: 18px; }
.die.burst { filter: drop-shadow(0 0 5px #a8ff90); animation: softbob 1.2s ease-in-out infinite alternate; }   /* a still glow and a slow bob: animating filter is costly on iPhone */
@keyframes softbob { to { transform: translateY(-3px); } }
.mbar .atk.spore { color: #e0a0ff; }
/* auto mode: the round tag says AUTO, the attack button rests */
.startrow { display: flex; gap: 6px; align-items: center; justify-content: center; margin: 6px 0; }
.startrow .lbl { font-size: 15px; margin-right: 4px; }
.startch { min-width: 48px; min-height: 44px; padding: 0 8px; font-size: 17px; }
/* Blast: dice in a live run glow yellow; the jump count by the dwarf */
.die.arc { filter: drop-shadow(0 0 3px #fff080) drop-shadow(0 0 6px #ffd020); }
.herostat .jumps { color: #fff080; }
/* Shadow: dice left out of the hand feed the dark (violet glow); the ring of dark in the readout */
.die.feed { filter: drop-shadow(0 0 3px #c4a4ff) drop-shadow(0 0 7px #7a3ad8); }
.herostat .dark { color: #d8c4ff; }
/* crystal armour: a diamond per plate under the monster; the ones this hand cracks pulse; cracked ones are dim. Dice that crack glow ice blue */
.mbar .ar { display: flex; gap: 8px; }
.mbar .ar .plate { display: flex; gap: 1px; filter: drop-shadow(0 0 1px #06182e) drop-shadow(0 0 1px #06182e); }   /* a dark rim round each diamond */
.mbar .ar .xd { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 21px; line-height: 1; font-weight: 900; color: #06182e; -webkit-text-stroke: 0; paint-order: normal; text-shadow: none; background: linear-gradient(135deg, #ffffff 30%, #c8ecff 60%, #8ad0f0); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }   /* no outline on the digit (the .o stroke swallowed it on a phone) */
.mbar .ar .xd.chip { background: linear-gradient(135deg, #ffffff 20%, #fff3a8); box-shadow: none; }
.mbar .ar .plate.off .xd { background: rgba(40,80,130,.75); color: #d8ecff; font-size: 14px; width: 38px; }
.mbar .ar .plate.crack { filter: drop-shadow(0 0 1px #06182e) drop-shadow(0 0 5px #ffffff); animation: crackbob 1.2s ease-in-out infinite alternate; }
@keyframes crackbob { to { transform: translateY(-3px) scale(1.08); } }
.die.crack { filter: drop-shadow(0 0 4px #ffffff) drop-shadow(0 0 10px #4ab0ff); outline: 3px solid #bfe8ff; outline-offset: 1px; border-radius: 6px; box-shadow: 0 0 14px 2px #4ab0ff; }
.herostat .dark.on { color: #f4eeff; text-shadow: 0 0 6px #a47ae8; }

/* ---------- the set book (anvil) ---------- */
.bookhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #ffe9b0; text-shadow: 0 2px 0 #2a1710; font-size: 14px; padding: 0 4px; }
.bookhead b { font-size: 20px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--cream); }
.legend span { display: inline-flex; align-items: center; gap: 4px; background: #1e1410; border: 2px solid #4a2e18; padding: 1px 6px; border-radius: 6px; }
.sw { width: 12px; height: 12px; display: inline-block; border-radius: 3px; }
.sw.own { background: #b86aff; } .sw.ready { border: 2px solid #ffc030; } .sw.miss { border: 2px dashed #8a6a48; } .sw.unk { background: #120c08; border: 1px solid #3a2416; }
.book { display: grid; grid-template-columns: 76px repeat(6, 1fr); gap: 4px; align-items: center; }
.book .colh { display: flex; justify-content: center; opacity: .7; }
.book .chrow { grid-column: 1 / -1; font: inherit; font-size: 12px; color: #c8a878; background: none; border: 0; border-bottom: 2px solid #4a2e1866; border-radius: 0; text-align: left; min-height: 44px; padding: 4px 2px 2px; margin-top: 2px; }
.book .chrow.off { color: #8a7050; }
.book .rowh { font-size: 10px; letter-spacing: -.3px; line-height: 1.15; color: var(--cream); display: flex; flex-direction: column; gap: 1px; padding-left: 4px; border-left: 4px solid var(--tint); min-width: 0; }
.book .rowh span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book .rowh small { font-size: 10px; opacity: .8; } .book .rowh small.on { color: #8ae070; opacity: 1; }
.cell { aspect-ratio: 1; position: relative; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: #1a110c; border: 2px solid #3a2416; padding: 0; min-width: 0; }
.cell.own { background: radial-gradient(#fff3, transparent 70%), var(--rc); border-color: #1e1410; }
.cell.ready { background: #2a1c10; border-color: #ffc030; box-shadow: 0 0 8px #ffb02088, inset 0 0 6px #ffc03055; }
.cell.miss { background: #241812; border: 2px dashed #6a4a30; }
.cell.unk { background: #120c08; border-color: #24170f; color: #5a4030; font-size: 18px; }
.cell .bdg { position: absolute; right: -3px; bottom: -3px; background: #ffc030; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border: 2px solid #4a2c08; }
.cell .bdg .ico { width: 12px; height: 12px; }
.cell .wk { position: absolute; left: 1px; top: -1px; font-size: 11px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.cell .dot { position: absolute; right: 2px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: #ffc030; border: 1px solid #4a2c08; }
.cell .bar { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; background: #000a; border-radius: 2px; overflow: hidden; }
.cell .bar i { display: block; height: 100%; background: #e8a040; }
.book .lockrow { grid-column: 1 / -1; font-size: 12px; color: #a08060; display: flex; align-items: center; gap: 6px; background: #120c08; border: 2px solid #24170f; border-radius: 6px; padding: 8px; }
.mid { text-align: center; }
.ingl { display: flex; flex-direction: column; gap: 4px; }
.ingr { display: grid; grid-template-columns: 1fr auto minmax(18px, auto); gap: 8px; align-items: center; background: #fff6; border: 2px solid var(--brown); border-radius: 6px; padding: 3px 8px; font-size: 14px; color: var(--brown); text-align: left; min-height: 34px; }
.ingr.ok b { color: #2a7a1a; } .ingr.no b { color: #c03020; }
.ingr .src { display: flex; align-items: center; gap: 2px; font-size: 11px; opacity: .85; justify-self: end; }
.copies { display: flex; gap: 6px; flex-wrap: wrap; }
.copy { display: flex; align-items: center; gap: 4px; background: #fff6; border: 2px solid var(--brown); border-radius: 6px; padding: 2px 6px 2px 2px; font-size: 13px; color: var(--brown); min-height: 40px; }
.copy i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.mons { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.mons > span { display: flex; align-items: center; gap: 4px; }
.sheet .fchips { padding-bottom: 4px; }
/* ---------- gear: a list by slot ---------- */
.geartop { display: grid; grid-template-columns: 104px 1fr; gap: 8px; align-items: stretch; background: none; border: 0; padding: 0; color: inherit; text-align: left; flex: none; }
.geartop .hero { display: flex; align-items: center; justify-content: center; }
.statmini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 12px; color: var(--cream); text-align: center; }
.statmini b { display: block; font-size: 18px; color: #ffd860; }
.fchip em { font-style: normal; background: #3ab83a; color: #fff; border-radius: 8px; padding: 0 6px; margin-left: 6px; font-size: 13px; }
.slothead { font-size: 13px; color: #c8a878; margin-top: 6px; }
.slothead:first-child { margin-top: 0; }
.irow { width: 100%; display: grid; grid-template-columns: 5px 46px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; background: none; border: 0; border-top: 2px solid #4a2e1866; color: var(--cream); text-align: left; }
.slothead + .irow { border-top: 0; }
.irow .rs { align-self: stretch; border-radius: 3px; }
.ib { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 3px solid #1e1410; background: radial-gradient(#fff4, transparent 70%), #8a98a8; }
.ib.common { background: radial-gradient(#fff4, transparent 70%), #c0ccd8; } .ib.rare { background: radial-gradient(#fff4, transparent 70%), #4aa8ff; }
.ib.epic { background: radial-gradient(#fff4, transparent 70%), #b86aff; } .ib.legendary { background: radial-gradient(#fff4, transparent 70%), #ffc030; }
.imid { min-width: 0; }
.nm2 { font-size: 15px; color: #fff4d4; }
.sub { font-size: 12px; font-weight: 600; color: #d8c0a0; }
.rart.common { color: #c0ccd8; } .rart.rare { color: #6ab8ff; } .rart.epic { color: #c88aff; } .rart.legendary { color: #ffc030; }
.fxn { color: #ffd860; }
.tag2 { font-size: 11px; border-radius: 6px; padding: 0 5px; margin-left: 6px; background: #3ab83a; color: #fff; vertical-align: 1px; }
.setx { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.setx .up { color: #8ae070; } .setx .down { color: #ff8a70; }
.delta { font-size: 17px; min-width: 46px; text-align: right; }
.delta.up { color: #7ae060; } .delta.down { color: #ff8a70; } .delta.eq { color: #a89070; }
.junk { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 14px; flex: none; }
.btn.mini { min-height: 44px; font-size: 15px; padding: 0 6px; }
.sparerow { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
/* what the dwarf wears, at the top of the gear tab */
.wornbox { display: grid; grid-template-columns: 1fr 1.25fr; gap: 6px; align-items: center; flex: none; }
.wornbox .who { display: flex; justify-content: center; }
.wornslots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wslot { aspect-ratio: .85; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; border-radius: 8px; border: 3px solid #1e1410; font-size: 12px; color: #fff; text-shadow: 0 1px 0 #1e1410, 0 0 3px #1e1410; background: radial-gradient(#fff4, transparent 70%), #8a98a8; }
.wslot.common { background: radial-gradient(#fff4, transparent 70%), #c0ccd8; } .wslot.rare { background: radial-gradient(#fff4, transparent 70%), #4aa8ff; }
.wslot.epic { background: radial-gradient(#fff4, transparent 70%), #b86aff; } .wslot.legendary { background: radial-gradient(#fff4, transparent 70%), #ffc030; }
.wslot.empty { background: #2a1c1488; border-style: dashed; border-color: #6a4a30; font-size: 10px; }
.geartop { grid-template-columns: 1fr; }
.irow.worn { background: #ffc03018; box-shadow: inset 3px 0 0 #ffc030; border-radius: 6px; }
/* the effects the gear gives, and the ones past their cap */
.fxbox { flex: none; display: flex; flex-direction: column; gap: 4px; }
.fxbox .powerline b.overn { color: #ff8a50; }
.fxrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; font-size: 14px; color: #fff4d4; padding: 2px 4px; border-radius: 6px; }
.fxrow .fxt b { color: #ffd860; }
.fxsrc { display: flex; gap: 3px; align-items: center; }
.fxsrc .setdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.fxrow.over { background: #5a1c1455; box-shadow: inset 3px 0 0 #ff8a50; }
.overcap { grid-column: 1 / -1; font-size: 12px; color: #ff9a70; }
.fxl { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: #ffd860; line-height: 1.25; }
.fxl .waste { color: #ff9a70; text-decoration: line-through; text-decoration-color: #ff9a7088; }
/* companions (talent tier 5): the Battle-tab row, the collection sheet, the hatching */
.petrow { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; }
.petrow.dot::after { content: ''; position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: #ff4a3a; border: 3px solid #fff; }
.petsheet { display: flex; flex-direction: column; gap: 8px; }
.pethatch { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pethatch[hidden] { display: none; }
.petinfo { position: sticky; top: -6px; z-index: 2; margin: 0; border-left: 6px solid var(--rar, #c8d4e0) !important; }
.pethead { display: flex; align-items: center; gap: 12px; }
.petpic { flex: none; min-width: 84px; height: 84px; padding: 0 4px; display: flex; align-items: center; justify-content: center; border-radius: 42px; background: radial-gradient(ellipse, color-mix(in srgb, var(--rar) 45%, transparent) 0, transparent 70%); }
.petname { min-width: 0; }
.petnm { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.petnm b { font-size: 19px; }
.rarchip { padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #fff; background: var(--rar); text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.petlv { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; font-weight: 700; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 10px; height: 10px; border-radius: 3px; background: rgba(0,0,0,.18); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.pips i.on { background: var(--rar); box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 0 4px var(--rar); }
.petlines { margin-top: 6px; }
.petline { font-size: 14px; line-height: 1.3; margin-top: 3px; }
.petcomes { margin-top: 6px; font-weight: 800; color: #2a7a2a; }
.petbring { margin-top: 8px; min-height: 44px; }
.rartabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.rartab { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 3px 2px; border: 3px solid var(--rar); border-radius: 8px; background: rgba(0,0,0,.12); color: inherit; font: inherit; line-height: 1.15; }
.rartab b { font-size: 13px; }
.rartab small { font-size: 12px; opacity: .8; }
.rartab.on { background: var(--rar); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.55); }
.rartab.on small { opacity: 1; }
.petgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.petcard { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; min-height: 92px; padding: 6px 2px 5px; border: 3px solid color-mix(in srgb, var(--rar) 55%, transparent); border-radius: 8px; background: rgba(0,0,0,.12); color: inherit; font: inherit; }
.petcard small { font-size: 12px; text-align: center; line-height: 1.1; max-width: 100%; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.petcard .pips i { width: 7px; height: 7px; }
.petcard.on { background: rgba(255,240,180,.3); }
.petcard.sel { border-color: var(--rar); box-shadow: 0 0 0 2px var(--rar), 0 0 10px var(--rar); }
.petcard.locked { border-style: dashed; opacity: .6; }
.petmark { position: absolute; top: 1px; right: 3px; font-size: 13px; font-weight: 800; color: #2a7a2a; }
.petodds { text-align: center; }
.sil { filter: brightness(0) opacity(.45); }
.lbl.on { color: #2a8a2a; font-weight: 700; opacity: 1; }
.hatchbox { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 4px; text-align: center; }
.hatchbox b { font-size: 20px; }
.hatchbox .rar { font-size: 13px; opacity: .85; }
.hatchpic { min-height: 120px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hatchpic.wob { animation: eggwob .45s ease-in-out; }
.hatchpic.pop { animation: revealpop .45s cubic-bezier(.2,1.6,.4,1); filter: drop-shadow(0 0 14px var(--rar, #fff)); }
@keyframes eggwob { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 45% { transform: rotate(10deg); } 70% { transform: rotate(-6deg); } }

.xfercode { text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.xfererr { color: #b03a2a; font-weight: 700; }

/* iOS short-window bug (html.gap, set by checkGap in app.js): lay the full-screen layers out against a 100vh body, not the short viewport */
html.gap, html.gap body { height: 100vh; overflow: hidden; }
html.gap body { position: relative; }
html.gap :is(#home, #scene, #hud, #b-pause, #labels, #fbottom, #overlay, .sheet, #hurt, #dmgb, .forgeov, #trail), html.gap #fight::before { position: absolute; }

/* a computer: the game in a phone-sized frame in the middle of the window (index.html), on the dark of the mine */
html.desk, html.desk body { height: 100%; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #2a1c34 0%, #120c1c 60%, #08060e 100%); }
html.desk body { display: grid; place-items: center; }
html.desk #phone { width: min(430px, calc((100vh - 48px) * 430 / 932)); height: min(932px, calc(100vh - 48px)); border: 0; border-radius: 34px; background: #1e2c5a;
  box-shadow: 0 0 0 10px #16101e, 0 0 0 12px #3a2c48, 0 30px 80px rgba(0,0,0,.7), 0 0 120px rgba(140,90,220,.15); }
.herostat .anc { color: #bfe8ff; }

/* the power pills above the dice: one per power with a number to watch, in the power's colour */
#pills { display: flex; justify-content: center; gap: 6px; max-width: 420px; }
#pills:empty { display: none; }
.pill2 { display: flex; align-items: center; gap: 5px; min-height: 30px; padding: 2px 11px; border-radius: 16px; font: inherit; font-size: 17px; font-weight: 800; color: #fff; background: rgba(10,26,40,.66); border: 2px solid var(--pw, #fff); box-shadow: 0 0 8px rgba(0,0,0,.35); white-space: nowrap; }
.pill2 .ico { width: 20px; height: 20px; }
.pill2.on { background: rgba(60,30,110,.8); box-shadow: 0 0 10px var(--pw); }
.herobar .crit { position: absolute; left: calc(100% + 8px); top: 3px; font-size: 16px; white-space: nowrap; color: #fff; }
.herobar .crit .ico { width: 18px; height: 18px; }

/* the Ancestors echoes: the hand's name and each number stay on screen long enough to read */
.float.echo { font-size: 24px; color: #bfe8ff; text-shadow: 0 3px 0 #0e2a44, 0 0 8px rgba(140,210,255,.7); letter-spacing: 1px; }
.float.echodmg { font-size: 32px; color: #ffffff; text-shadow: 0 3px 0 #0e2a44, 0 0 10px rgba(140,210,255,.8); }
@keyframes echohold { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 22% { transform: translate(-50%, -52%) scale(1); } 80% { opacity: 1; transform: translate(-50%, -75%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -95%) scale(1); } }
.float.echo, .float.echodmg { animation-name: echohold; animation-timing-function: ease-out; }

/* chapter 5: the swallowed number */
.die.swallowed { filter: brightness(.5) saturate(.5); }
.die.swallowed::after { content: ''; position: absolute; left: 50%; top: 50%; width: 64%; height: 64%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #000 52%, #7a3ad8 70%, rgba(122,58,216,0) 76%); pointer-events: none; }
#h-swallow { cursor: pointer; color: #e0c8ff; }
.doorgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; justify-items: center; margin: 8px 0; }
.doorgrid i { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #2a2040, #0a0610); box-shadow: inset 0 0 0 2px #4a3a6a; }
.doorgrid i.on { background: radial-gradient(circle at 40% 35%, #fff4ff, #c060ff 55%, #5a24a8); box-shadow: 0 0 14px 3px rgba(192,96,255,.7), inset 0 0 0 2px #e8d0ff; }
.doorrow { display: flex; align-items: center; gap: 10px; }

/* the staging copy says so */
html.staging body::after { content: 'STAGING'; position: fixed; z-index: 9999; top: calc(env(safe-area-inset-top) + 2px); left: 50%; transform: translateX(-50%); padding: 1px 8px; background: #d8385a; color: #fff; font: 700 11px/1.4 system-ui, sans-serif; letter-spacing: .08em; pointer-events: none; }
