* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120c08; color: #f4ead6; font: 15px/1.35 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ov { pointer-events: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.serif { font-family: Georgia, 'Times New Roman', serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

/* ---------- mission hud */
.party { position: absolute; left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.pc { display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.pc .face { position: relative; width: 46px; height: 46px; border-radius: 50%; background: #2a1e14 center/cover; border: 2px solid #00000088; box-shadow: 0 2px 6px #0008; }
.pc.cap .face { width: 54px; height: 54px; border-color: #ffd040; }
.pc .ring { position: absolute; inset: -5px; border-radius: 50%; }
.pc.ready .face { animation: pulse 0.8s ease-in-out infinite; }
.pc.down .face { filter: grayscale(1) brightness(0.6); }
.pc .meta { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.pc .nm { font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; letter-spacing: 0.02em; }
.pc .hp { width: 70px; height: 6px; background: #000a; border-radius: 3px; overflow: hidden; }
.pc.cap .hp { width: 96px; height: 8px; }
.pc .hp i { display: block; height: 100%; background: #6f6; transition: width 0.15s; }
.pc .tap { font-size: 10px; font-weight: 800; color: #fff; background: #000b; border-radius: 6px; padding: 1px 5px; display: none; width: fit-content; }
.pc.ready .tap { display: block; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.topr { position: absolute; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); display: flex; gap: 8px; align-items: center; }
.gold { white-space: nowrap; font-weight: 900; color: #ffd84a; text-shadow: 0 1px 3px #000; font-size: 17px; background: #0007; padding: 3px 10px; border-radius: 14px; }
.gold.bump { animation: bump 0.25s; }
@keyframes bump { 50% { transform: scale(1.25); } }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; background: #0009; font-size: 18px; font-weight: 900; display: grid; place-items: center; }
.objective { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-weight: 800; font-size: 13px; text-shadow: 0 1px 3px #000; background: #0006; padding: 3px 12px; border-radius: 12px; white-space: nowrap; pointer-events: none; }
.bossbar { position: absolute; top: max(36px, calc(env(safe-area-inset-top) + 28px)); left: 50%; transform: translateX(-50%); width: min(340px, 52vw); pointer-events: none; text-align: center; }
.bossbar .nm { font: italic 700 14px Georgia, serif; text-shadow: 0 1px 3px #000; color: #ffd8c8; }
.bossbar .bar { height: 9px; background: #000b; border-radius: 5px; overflow: hidden; border: 1px solid #ff806055; }
.bossbar .bar i { display: block; height: 100%; background: linear-gradient(#ff6a4a, #c02818); transition: width 0.12s; }
.actions { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 10px; align-items: end; }
.act { position: relative; width: 66px; height: 66px; border-radius: 50%; background: radial-gradient(#4a3624, #24180e); border: 2px solid #c8a46a; color: #fff; font-weight: 900; font-size: 11px; text-align: center; display: grid; place-items: center; box-shadow: 0 3px 8px #000a; overflow: hidden; }
.act span { position: relative; z-index: 2; line-height: 1.05; text-shadow: 0 1px 2px #000; }
.act .cd { position: absolute; inset: 0; background: conic-gradient(#000c var(--a, 0deg), transparent 0); z-index: 1; }
.act.big { width: 80px; height: 80px; font-size: 12px; border-color: #ffd040; }
.act.big.ready { animation: pulse 0.8s infinite; background: radial-gradient(#9a6a20, #4a2a08); }
.act.dodge { width: 56px; height: 56px; grid-column: 1; }
.act .key { position: absolute; bottom: 5px; left: 0; right: 0; font-size: 9px; opacity: 0.7; z-index: 2; }
.hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; opacity: 0.75; text-shadow: 0 1px 2px #000; pointer-events: none; }
.toast { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); font: 900 30px Georgia, serif; text-align: center; color: #ffe8b0; text-shadow: 0 2px 0 #5a2a08, 0 4px 14px #000; pointer-events: none; white-space: nowrap; animation: toast 2.2s forwards; }
.toast small { display: block; font: 700 14px system-ui; color: #f4ead6; margin-top: 4px; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }
.vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px #000a; }
.hurt { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px #ff1a0a; opacity: 0; transition: opacity 0.3s; }
.tapmark { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 3px solid #ffd040; border-radius: 50%; pointer-events: none; animation: tapm 0.4s forwards; }
@keyframes tapm { to { transform: scale(0.3); opacity: 0; } }

/* ---------- sheets and cards */
.shade { position: absolute; inset: 0; background: #0009; display: flex; align-items: center; justify-content: center; padding: 12px; animation: fadein 0.2s; }
@keyframes fadein { from { opacity: 0; } }
.sheet { width: min(560px, 100%); max-height: 92%; overflow: auto; background: linear-gradient(#f6ecd4, #e8d8b4); color: #2a1e12; border-radius: 14px; padding: 16px; box-shadow: 0 10px 40px #000c; border: 3px solid #8a6a3a; touch-action: pan-y; }
.sheet h2 { font: 700 24px Georgia, serif; margin: 0 0 4px; color: #4a2a10; }
.sheet h3 { font: 700 17px Georgia, serif; margin: 12px 0 6px; color: #5a3414; }
.sheet .sub { font-size: 13px; color: #6a5030; margin-bottom: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 10px; background: linear-gradient(#b8432a, #8a2a16); color: #fff6e0; font-weight: 800; box-shadow: 0 3px 0 #4a140a, 0 4px 10px #0005; min-height: 44px; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #4a140a; }
.btn.alt { background: linear-gradient(#6a5a44, #4a3c2a); box-shadow: 0 3px 0 #241a10; }
.btn.gold { background: linear-gradient(#e0a830, #a87010); color: #2a1a04; box-shadow: 0 3px 0 #5a3a04; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.card { background: #fff8e8; border: 2px solid #c8a46a; border-radius: 10px; padding: 10px 12px; }
.card.pick { cursor: pointer; }
.card.pick:active { background: #fff0cc; }
.chip { display: inline-block; font-size: 11px; font-weight: 900; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 6px; background: #4a2a10; color: #fff0d0; text-transform: uppercase; }
.chip.crypt { background: #5a3a7a; } .chip.escort { background: #3a6a4a; } .chip.hunt { background: #6a4a1a; } .chip.siege { background: #8a2a1a; } .chip.coach { background: #1a3a6a; } .chip.finale { background: #000; color: #ffd040; }
.pay { font-weight: 900; color: #8a5a00; }
.skulls { color: #8a2a1a; font-weight: 900; letter-spacing: 1px; }
.pitch { font-family: Georgia, serif; font-size: 14px; margin: 6px 0; color: #3a2a18; }
.client { font-size: 12px; color: #7a6040; font-style: italic; }
.face-s { width: 52px; height: 52px; border-radius: 50%; background: #3a2a1a center/cover; border: 2px solid #8a6a3a; flex: none; }
.mood { font-size: 12px; font-weight: 800; }
.bar { height: 7px; background: #0002; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: #c84a2a; }
.item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: #fff8e8; border: 2px solid #ccb48a; }
.item .nm { font-weight: 800; }
.item .st { font-size: 12px; color: #5a4a30; }
.r0 { color: #6a6458; } .r1 { color: #2a6ab8; } .r2 { color: #b88a00; } .r3 { color: #c8561a; }
.delta { font-weight: 900; } .delta.up { color: #2a8a3a; } .delta.dn { color: #b8321a; }
.say { font-family: Georgia, serif; font-style: italic; color: #3a2a18; }
.say b { font-style: normal; font-family: system-ui; font-size: 13px; color: #6a3a14; margin-right: 4px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { padding: 7px 12px; border-radius: 8px; background: #0001; font-weight: 800; color: #5a3a1a; }
.tabs button.on { background: #5a3a1a; color: #fff0d0; }
.close { float: right; font-size: 22px; font-weight: 900; color: #6a4a2a; padding: 0 6px; }

/* ---------- tavern hud */
.tbar { position: absolute; left: 0; right: 0; top: 0; padding: max(8px, env(safe-area-inset-top)) 12px 8px; display: flex; align-items: center; gap: 10px; background: linear-gradient(#000a, transparent); }
.tbar .cname { font: 700 18px Georgia, serif; color: #ffe0a8; text-shadow: 0 1px 3px #000; }
.tbar .renown { font-size: 12px; color: #e8d0a0; }
.tbar .grow { flex: 1; }
.bbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 10px max(12px, env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: center; background: linear-gradient(transparent, #000c); flex-wrap: wrap; }
.bbar .btn { flex: 1 1 28%; max-width: 190px; padding: 9px 6px; font-size: 14px; line-height: 1.1; }
.bbar .btn small { font-weight: 700; opacity: 0.8; margin-left: 3px; }
.badge { background: #ffd040; color: #2a1a04; border-radius: 10px; padding: 0 6px; font-size: 12px; font-weight: 900; }
.title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; background: radial-gradient(ellipse at center, #3a2414cc, #0c0806f0); text-align: center; overflow: auto; }
.title h1 { font: 700 clamp(44px, 12vw, 78px) Georgia, serif; margin: 0; color: #ffd890; text-shadow: 0 3px 0 #6a2a08, 0 8px 30px #000; letter-spacing: 0.02em; }
.title .tag { font: italic 16px Georgia, serif; color: #e8d0a8; max-width: 460px; }
.roles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.role { width: 150px; background: #f6ecd4; color: #2a1e12; border-radius: 12px; padding: 10px; border: 3px solid #8a6a3a; cursor: pointer; }
.role .face-s { width: 72px; height: 72px; margin: 0 auto 6px; }
.role b { font: 700 16px Georgia, serif; display: block; }
.role small { font-size: 12px; color: #5a4a30; display: block; }
.role:active { transform: scale(0.97); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: #120c08; font: 700 20px Georgia, serif; color: #ffd890; }
.loading .bar { width: 200px; margin-top: 10px; }
.loading .bar i { background: #ffd040; }
.talkline { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(520px, 94vw); background: #f6ecd4ee; color: #2a1e12; border-radius: 12px; padding: 10px 14px; border: 2px solid #8a6a3a; box-shadow: 0 6px 20px #000a; }
@media (max-width: 420px) { .act { width: 60px; height: 60px; } .act.big { width: 72px; height: 72px; } .sheet { padding: 12px; } }
.boons { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 46vw; pointer-events: none; }
.boons span { font-size: 10px; font-weight: 800; background: #000a; color: #ffd890; border-radius: 6px; padding: 2px 6px; }
.toast { white-space: normal; width: min(92vw, 640px); }
@media (max-width: 500px) { .toast { font-size: 24px; } .boons { left: 8px; transform: none; max-width: 52vw; justify-content: flex-start; } }
@media (max-width: 640px) {
  .objective { left: auto; right: max(8px, env(safe-area-inset-right)); transform: none; top: max(54px, calc(env(safe-area-inset-top) + 46px)); font-size: 12px; }
  .bossbar { left: auto; right: max(8px, env(safe-area-inset-right)); transform: none; top: max(84px, calc(env(safe-area-inset-top) + 76px)); width: min(220px, 56vw); text-align: right; }
}
.callb { position: absolute; left: 0; top: 38%; display: flex; align-items: center; gap: 10px; padding: 8px 22px 8px 12px; background: linear-gradient(90deg, #000d, #0000); pointer-events: none; animation: callb 1.5s forwards; }
.callb b { display: block; font: 700 20px Georgia, serif; color: #fff2d8; text-shadow: 0 2px 4px #000; }
.callb span { font: 900 14px system-ui; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 1px 3px #000; }
.callb .face-s { width: 58px; height: 58px; border-width: 3px; }
@keyframes callb { 0% { transform: translateX(-100%); } 15% { transform: translateX(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(10%); } }
