:root {
  --bronze: #b8924a; --bronze-d: #7d5f2c; --gold: #e0c27a; --ivory: #efe6d0; --parch: #e6d8b8; --parch-d: #cdbb92;
  --ink: #2a1d14; --red: #8c2323; --red-d: #5e1717; --char: #1a1310; --char2: #251b15; --stone: #8b8169;
  --ok: #6fb35a; --warn: #d9a441; --bad: #c0463a;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --serif: Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0e0a08; overflow: hidden; font-family: var(--serif); color: var(--ivory); overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#cv-settle, #cv-battle { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.sheet canvas { border-radius: 8px; border: 2px solid var(--bronze-d); }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ---- buttons ---- */
.btn { min-height: 46px; padding: 8px 16px; border: 1px solid var(--bronze-d); border-radius: 8px; color: var(--ivory); font-size: 15px; letter-spacing: .04em; cursor: pointer;
  background: linear-gradient(#4a3826, #2e2218); box-shadow: inset 0 1px 0 rgba(255,230,170,.25), 0 2px 4px rgba(0,0,0,.4); text-shadow: 0 1px 1px #000; transition: transform .08s, filter .15s; }
.btn:active:not(:disabled) { transform: scale(.97); filter: brightness(1.2); }
.btn.primary { background: linear-gradient(#a02e2e, #6a1b1b); border-color: #c9a35a; font-weight: 700; }
.btn.gold { background: linear-gradient(#c9a35a, #8a6a2e); color: #20140c; text-shadow: none; font-weight: 700; border-color: #e8d29a; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { min-height: 38px; padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; filter: grayscale(.6); cursor: default; }
.btn.block { width: 100%; }

/* ---- title ---- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; z-index: 50;
  background: radial-gradient(ellipse at 50% 30%, #4b2f22 0%, #1a1310 65%, #0d0907 100%); transition: opacity .6s; }
.screen.off { opacity: 0; pointer-events: none; }
.emblem { width: 120px; height: 120px; margin-bottom: 8px; filter: drop-shadow(0 4px 12px rgba(0,0,0,.6)); }
.title h1, .screen h1 { margin: 6px 0 0; font-size: clamp(32px, 9vw, 54px); letter-spacing: .22em; font-weight: 700; color: var(--gold); text-shadow: 0 2px 0 #3b2412, 0 0 24px rgba(201,163,90,.35); }
.screen h2 { margin: 4px 0 18px; font-size: clamp(13px, 3.6vw, 18px); letter-spacing: .5em; color: var(--ivory); font-weight: 400; opacity: .85; }
.screen .tag { font-style: italic; color: #bba78a; margin-bottom: 26px; }
.screen .menu { display: flex; flex-direction: column; gap: 10px; width: min(300px, 80vw); }
.prologue { max-width: 420px; line-height: 1.75; font-size: 17px; color: #d8c9a6; min-height: 150px; }
.prologue p { margin: 0 0 10px; animation: fadein 1.4s both; }
.prologue p:nth-child(2) { animation-delay: 1.6s; } .prologue p:nth-child(3) { animation-delay: 3.2s; }
.small-note { margin-top: 18px; font-size: 11px; color: #8d7d63; max-width: 320px; line-height: 1.4; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- HUD ---- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.topbar { position: absolute; top: 0; left: 0; right: 0; padding: calc(8px + var(--sat)) 10px 8px; display: flex; gap: 6px; align-items: center; background: linear-gradient(rgba(14,9,6,.88), rgba(14,9,6,0)); }
.plaque { padding: 5px 10px; border: 1px solid var(--bronze-d); border-radius: 7px; background: linear-gradient(#2e2218, #1f160f); font-size: 13px; display: flex; align-items: center; gap: 5px; box-shadow: inset 0 1px 0 rgba(255,230,170,.15); white-space: nowrap; }
.plaque b { color: var(--gold); font-weight: 700; }
.plaque.full b { color: var(--warn); }
.topbar .grow { flex: 1; }
.topbar .name { white-space: nowrap; font-size: 13px; letter-spacing: .1em; color: var(--gold); text-transform: uppercase; }
.topbar .sub { font-size: 11px; color: #bba78a; font-style: italic; }
.reslist { display: flex; gap: 5px; flex-wrap: wrap; }
.ri { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.5); }
.ri.denarii { background: radial-gradient(circle at 35% 30%, #fff2b0, #c9962f 60%, #7a5a1a); }
.ri.timber { background: linear-gradient(90deg, #8a6a44, #5a4228); border-radius: 3px; }
.ri.stone { background: linear-gradient(135deg, #b8ad98, #7b735f); border-radius: 3px; transform: rotate(8deg); }
.ri.iron { background: linear-gradient(135deg, #8c92a0, #3c4150); border-radius: 2px; }
.nav { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 8px calc(10px + var(--sab)); display: flex; gap: 6px; justify-content: center; background: linear-gradient(rgba(14,9,6,0), rgba(14,9,6,.92)); align-items: flex-end; }
.nav .btn { flex: 1; max-width: 120px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; letter-spacing: .06em; min-height: 54px; }
.nav .btn .g { font-size: 20px; line-height: 1; }
.nav .btn.go { max-width: 150px; min-height: 64px; font-size: 13px; }
.nav .btn.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,194,122,.6), inset 0 1px 0 rgba(255,230,170,.25); } 50% { box-shadow: 0 0 0 9px rgba(224,194,122,0), inset 0 1px 0 rgba(255,230,170,.25); } }
.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--sab)); max-width: min(420px, 92vw); padding: 8px 14px; background: rgba(28,20,14,.92); border: 1px solid var(--bronze); border-radius: 18px; font-size: 13px; text-align: center; color: var(--gold); animation: fadein .6s; }

/* ---- sheets ---- */
#sheet-root { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.veil { position: absolute; inset: 0; background: rgba(8,5,3,.62); display: flex; align-items: flex-end; justify-content: center; pointer-events: auto; animation: fadein .2s; }
@media (min-width: 700px) { .veil { align-items: center; } }
.sheet { width: min(620px, 100%); max-height: min(88vh, 100% - var(--sat)); display: flex; flex-direction: column; border: 2px solid var(--bronze); border-bottom: none; border-radius: 16px 16px 0 0; color: var(--ink);
  background: linear-gradient(rgba(255,245,215,.35), rgba(120,90,50,.15)), repeating-linear-gradient(0deg, rgba(120,90,40,.04) 0 2px, transparent 2px 5px), var(--parch);
  box-shadow: 0 -8px 40px rgba(0,0,0,.6), inset 0 0 40px rgba(120,80,30,.25); animation: rise .25s ease-out; }
@media (min-width: 700px) { .sheet { border-bottom: 2px solid var(--bronze); border-radius: 16px; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet > header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px 16px; border-bottom: 1px solid rgba(90,60,25,.35); }
.sheet > header h3 { margin: 0; flex: 1; font-size: 18px; letter-spacing: .12em; text-transform: uppercase; color: #5e1717; }
.sheet .x { width: 44px; height: 44px; font-size: 20px; border-radius: 50%; border: 1px solid var(--bronze-d); background: rgba(255,245,215,.6); color: var(--ink); cursor: pointer; }
.sheet .body { padding: 12px 16px calc(16px + var(--sab)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet .btn { color: var(--ivory); }
.sheet .btn.ghost { color: var(--ink); border-color: var(--bronze-d); }
.sheet p { line-height: 1.45; margin: 6px 0; }
.muted { opacity: .7; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { border: 1px solid rgba(90,60,25,.5); border-radius: 10px; padding: 10px; background: rgba(255,248,225,.55); box-shadow: inset 0 0 12px rgba(120,80,30,.12); }
.card.sel { outline: 2px solid var(--red); }
.card.locked { opacity: .55; }
.cost { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: rgba(40,28,18,.12); font-size: 13px; margin-right: 4px; }
.cost.short { color: var(--bad); font-weight: 700; background: rgba(192,70,58,.14); }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; padding: 9px 4px; text-align: center; border: 1px solid var(--bronze-d); border-radius: 8px; cursor: pointer; font-size: 13px; letter-spacing: .06em; background: rgba(255,245,215,.4); color: var(--ink); min-height: 44px; }
.tab.on { background: linear-gradient(#a02e2e, #6a1b1b); color: var(--ivory); }
.lvl { font-weight: 700; color: var(--red); }
.bar { height: 8px; background: rgba(40,28,18,.25); border-radius: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(#8bd070, #4f9a3a); }
.bar.xp > i { background: linear-gradient(#e0c27a, #b8924a); }
.rar-common { color: #6b6050; } .rar-uncommon { color: #3f7a30; } .rar-rare { color: #2f5fa6; } .rar-epic { color: #7a3fa0; } .rar-legendary { color: #b07a10; }
.stat { display: inline-flex; gap: 3px; margin-right: 8px; font-size: 13px; }
.divider { height: 1px; background: rgba(90,60,25,.3); margin: 10px 0; }
.banner-note { padding: 8px 10px; border-radius: 8px; background: rgba(140,35,35,.12); border: 1px dashed var(--red); font-size: 13px; text-align: center; color: var(--red-d); }

/* roster */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ucard { cursor: pointer; padding: 6px; text-align: center; position: relative; }
.ucard canvas { position: static; width: 84px; height: 84px; border-radius: 8px; border: 2px solid var(--bronze-d); }
.ucard .nm { font-size: 13px; font-weight: 700; margin-top: 3px; }
.ucard .badge { position: absolute; top: 4px; right: 4px; padding: 1px 6px; border-radius: 8px; font-size: 10px; background: var(--red); color: var(--ivory); }
.portrait-lg { position: static; width: 110px; height: 110px; border-radius: 10px; border: 2px solid var(--bronze); flex: none; }
.slot { cursor: pointer; min-height: 64px; display: flex; flex-direction: column; justify-content: center; text-align: center; font-size: 12px; }

/* ---- map ---- */
#map { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 20%, #3a2a1c, #14100c); }
.map-head { padding: calc(10px + var(--sat)) 12px 8px; background: linear-gradient(#241a12, #1a1310); border-bottom: 1px solid var(--bronze-d); }
.map-head h3 { margin: 0; font-size: 17px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.map-body { flex: 1; position: relative; margin: 8px; border-radius: 12px; border: 2px solid var(--bronze-d); overflow: hidden;
  background: linear-gradient(rgba(255,240,200,.18), rgba(100,70,30,.25)), repeating-linear-gradient(45deg, rgba(100,70,30,.06) 0 3px, transparent 3px 8px), #bfa878; box-shadow: inset 0 0 50px rgba(70,40,10,.55); }
.map-body svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.node { position: absolute; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; border: 3px solid #5a4020; background: radial-gradient(circle at 35% 30%, #f0e2bd, #b79c66); color: #2a1d14; font-size: 24px; display: flex; align-items: center; justify-content: center; cursor: default; z-index: 2; box-shadow: 0 3px 8px rgba(0,0,0,.4); transition: transform .15s; }
.node small { position: absolute; bottom: -17px; font-size: 10px; letter-spacing: .04em; white-space: nowrap; color: #3a2814; font-weight: 700; text-shadow: 0 0 4px rgba(255,240,200,.9); }
.node.avail { cursor: pointer; border-color: var(--red); animation: pulse2 1.4s infinite; }
.node.sel { transform: scale(1.18); border-color: #ffdb6a; }
.node.done { background: radial-gradient(circle at 35% 30%, #8a8470, #5d5846); opacity: .75; color: #3c3629; }
.node.future { background: radial-gradient(circle at 35% 30%, #cdbd96, #a08c62); opacity: .8; }
.node.hid { font-size: 20px; color: #6b5a3a; }
.node.here { outline: 3px solid var(--red); outline-offset: 3px; }
.node.boss { width: 70px; height: 70px; margin: -35px 0 0 -35px; font-size: 32px; border-color: #3a1010; background: radial-gradient(circle at 35% 30%, #e8a090, #8c2323); color: #fff2d0; }
@keyframes pulse2 { 0%,100% { box-shadow: 0 0 0 0 rgba(140,35,35,.7), 0 3px 8px rgba(0,0,0,.4); } 50% { box-shadow: 0 0 0 11px rgba(140,35,35,0), 0 3px 8px rgba(0,0,0,.4); } }
.map-foot { padding: 8px 12px calc(12px + var(--sab)); background: linear-gradient(#1a1310, #241a12); border-top: 1px solid var(--bronze-d); display: flex; flex-direction: column; gap: 8px; }
.squadline { display: flex; gap: 6px; }
.chip { flex: 1; padding: 4px 6px; border: 1px solid var(--bronze-d); border-radius: 7px; background: #1f160f; font-size: 11px; text-align: center; min-width: 0; }
.chip .bar { margin-top: 3px; height: 6px; }
.chip.down { opacity: .45; }
.infoline { min-height: 40px; font-size: 13px; color: #d8c9a6; }
.infoline b { color: var(--gold); }

/* ---- battle ---- */
#battle-ui { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
#battle-ui > * { pointer-events: auto; }
.btop { position: absolute; top: 0; left: 0; right: 0; padding: calc(6px + var(--sat)) 8px 4px; display: flex; gap: 6px; align-items: center; pointer-events: none; }
.btop > * { pointer-events: auto; }
.btop .title { flex: 1; text-align: center; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); text-shadow: 0 1px 3px #000; pointer-events: none; }
.btop .btn { min-height: 40px; min-width: 44px; padding: 4px 10px; font-size: 13px; }
.btn.toggle.on { background: linear-gradient(#c9a35a, #8a6a2e); color: #20140c; text-shadow: none; }
.bossbar { position: absolute; top: calc(52px + var(--sat)); left: 50%; transform: translateX(-50%); width: min(420px, 80vw); text-align: center; font-size: 12px; letter-spacing: .12em; color: #ffd9c0; text-shadow: 0 1px 3px #000; pointer-events: none; }
.bossbar .b { height: 10px; border: 1px solid #c9a35a; background: rgba(0,0,0,.6); border-radius: 6px; overflow: hidden; margin-top: 2px; }
.bossbar .b i { display: block; height: 100%; background: linear-gradient(#d9503a, #7a1d1d); }
.bbottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + var(--sab)); display: flex; gap: 5px; justify-content: center; background: linear-gradient(rgba(14,9,6,0), rgba(14,9,6,.9) 35%); }
.ucard-b { flex: 1; max-width: 120px; min-width: 0; border: 2px solid var(--bronze-d); border-radius: 10px; padding: 4px; background: linear-gradient(#32251a, #1d140e); text-align: center; cursor: pointer; position: relative; }
.ucard-b.sel { border-color: #ffdb6a; box-shadow: 0 0 12px rgba(255,219,106,.5); }
.ucard-b.dead { opacity: .35; }
.ucard-b .nm { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard-b .bar { margin: 3px 0; height: 6px; background: rgba(0,0,0,.6); }
.abtn { width: 100%; min-height: 42px; border-radius: 8px; border: 1px solid var(--bronze); background: linear-gradient(#5a4028, #3a2918); color: var(--ivory); font-size: 11px; position: relative; overflow: hidden; cursor: pointer; padding: 2px; line-height: 1.15; }
.abtn.rdy { background: linear-gradient(#a8742a, #6a4414); box-shadow: 0 0 10px rgba(232,195,106,.55); animation: pulse 1.2s infinite; }
.abtn .cd { position: absolute; left: 0; bottom: 0; width: 100%; background: rgba(0,0,0,.6); }
.abtn .t { position: relative; }
.banner-big { position: absolute; left: 0; right: 0; top: 36%; text-align: center; pointer-events: none; animation: bannerin 2.4s both; }
.banner-big div { display: inline-block; padding: 10px 28px; background: linear-gradient(90deg, transparent, rgba(20,12,8,.88) 20%, rgba(20,12,8,.88) 80%, transparent); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); font-size: 20px; }
.banner-big small { display: block; font-size: 12px; letter-spacing: .2em; color: #d8c9a6; margin-top: 3px; }
@keyframes bannerin { 0% { opacity: 0; transform: scale(1.15); } 15%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* misc */
#toasts { position: absolute; top: calc(64px + var(--sat)); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { padding: 8px 16px; border-radius: 18px; background: rgba(28,20,14,.95); border: 1px solid var(--bronze); color: var(--ivory); font-size: 14px; animation: toast 3s both; max-width: 92vw; text-align: center; }
.toast.bad { border-color: var(--bad); } .toast.good { border-color: var(--ok); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#fade { position: absolute; inset: 0; background: #0d0907; opacity: 0; pointer-events: none; z-index: 70; transition: opacity .35s; }
#fade.on { opacity: 1; pointer-events: auto; }
.loot-line { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.big-result { text-align: center; font-size: 28px; letter-spacing: .2em; text-transform: uppercase; margin: 4px 0 6px; }
.big-result.win { color: #7a1d1d; } .big-result.lose { color: #4a4a52; }
input[type=range] { width: 100%; height: 36px; accent-color: #8c2323; }
.sw { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bronze-d); vertical-align: middle; cursor: pointer; margin: 2px; }
.sw.on { outline: 3px solid var(--red); }
.arksc { opacity: .9; }
.arksc .card { background: repeating-linear-gradient(45deg, rgba(60,50,40,.12) 0 6px, rgba(60,50,40,.04) 6px 12px); }
.kbd { padding: 0 6px; border-radius: 4px; border: 1px solid var(--bronze-d); background: rgba(255,245,215,.5); }
@media (max-height: 460px) { .nav .btn { min-height: 44px; } .nav .btn .g { font-size: 16px; } .hint { bottom: 62px; } .node { width: 48px; height: 48px; margin: -24px 0 0 -24px; font-size: 20px; } .node.boss { width: 58px; height: 58px; margin: -29px 0 0 -29px; } .map-foot { padding-top: 4px; } }

/* ---- first-person ---- */
#cv-fp { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; background: #000; }
#fp-ui { position: absolute; inset: 0; pointer-events: none; z-index: 5; touch-action: none; user-select: none; -webkit-user-select: none; }
#fp-ui.off { display: none; }
#fp-ui.touch { pointer-events: auto; }
#fp-ui > * { position: absolute; }
.btn.red { background: linear-gradient(#a02e2e, #6a1b1b); border-color: #c9a35a; }
.fp-vig { inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(150,10,10,.78) 100%); transition: opacity .05s; }
.fp-flash { inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(255,240,200,.5), rgba(255,240,200,0) 70%); }
.fp-cross { left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,240,210,.7); box-shadow: 0 0 4px #000; }
.fp-cross.blk { background: #e0c27a; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 2px; }
.fp-tele { left: 50%; top: 50%; width: 0; height: 0; }
.fp-tele i { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; background: radial-gradient(circle at 50% 30%, #ffd070, #e0742a 55%, transparent 70%); clip-path: polygon(50% 0, 100% 90%, 50% 70%, 0 90%); filter: drop-shadow(0 0 5px #000); }
.fp-tele i.hv { background: radial-gradient(circle at 50% 30%, #ff9a7a, #d01818 60%, transparent 72%); width: 44px; height: 44px; left: -22px; top: -22px; }
.fp-tele i.hit { background: #c01818; width: 28px; height: 28px; left: -14px; top: -14px; clip-path: polygon(50% 100%, 100% 10%, 50% 30%, 0 10%); }
.fp-bars { left: calc(14px + env(safe-area-inset-left, 0px)); top: calc(12px + var(--sat)); width: min(34vw, 300px); display: flex; flex-direction: column; gap: 5px; }
.fp-bar { height: 10px; border: 1px solid rgba(0,0,0,.7); background: rgba(10,6,4,.6); border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(184,146,74,.35); }
.fp-bar > i { display: block; height: 100%; width: 100%; }
.fp-bar.hp > i { background: linear-gradient(#d04a3a, #8c1e18); }
.fp-bar.st > i { background: linear-gradient(#cdd86a, #7e9a2e); }
.fp-bar.st { height: 8px; } .fp-bar.st.low > i { background: linear-gradient(#e0a050, #a05a1a); animation: fpblink .4s infinite alternate; }
@keyframes fpblink { to { opacity: .55; } }
.fp-ammo { color: var(--gold); font-size: 14px; text-shadow: 0 1px 2px #000; }
.fp-awareness { left: 50%; top: calc(58px + var(--sat)); transform: translateX(-50%); color: var(--gold); font-size: 12px; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.fp-time { left: 12px; top: calc(58px + var(--sat)); color: var(--ivory); font-size: 12px; text-shadow: 0 1px 3px #000; }
.fp-tactics { top: calc(82px + var(--sat)); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; pointer-events: none; }
.fp-tactics button { pointer-events: auto; touch-action: none; color: var(--ivory); background: rgba(26,19,16,.8); border: 1px solid var(--bronze-d); border-radius: 6px; min-width: 44px; min-height: 44px; padding: 3px 8px; font-size: 12px; }
.fp-tactics button[hidden] { display: none; }
.fp-tactics button.lit { color: #ffd48a; border-color: #e2a04b; box-shadow: 0 0 10px #e2a04b66; }
.fp-target { left: 50%; top: calc(14px + var(--sat)); transform: translateX(-50%); width: min(36vw, 260px); text-align: center; opacity: 0; transition: opacity .15s; font-size: 12px; letter-spacing: .1em; text-shadow: 0 1px 2px #000; }
.fp-target.on { opacity: 1; } .fp-bar.en > i { background: linear-gradient(#c8c0a8, #8a826c); }
.fp-boss { left: 50%; bottom: calc(22px + var(--sab)); transform: translateX(-50%); width: min(60vw, 520px); text-align: center; opacity: 0; transition: opacity .3s; letter-spacing: .12em; font-size: 13px; text-shadow: 0 1px 2px #000; }
.fp-boss.on { opacity: 1; } .fp-bar.bo { height: 12px; margin-top: 4px; } .fp-bar.bo > i { background: linear-gradient(#b8924a, #7a1c1c); }
.fp-prompt { left: 50%; top: 62%; transform: translateX(-50%); padding: 6px 14px; border-radius: 6px; background: rgba(20,12,8,.7); border: 1px solid var(--bronze-d); font-size: 15px; opacity: 0; transition: opacity .15s; white-space: nowrap; }
.fp-prompt.on { opacity: 1; }
.fp-msgs { left: 50%; bottom: 26%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; width: 90vw; pointer-events: none; }
.fp-msg { padding: 4px 12px; border-radius: 5px; background: rgba(20,12,8,.62); font-size: 14px; text-align: center; text-shadow: 0 1px 2px #000; animation: fadein .25s both; }
.fp-msg.good { color: #cfe6a8; } .fp-msg.bad { color: #f0a090; }
.fp-pause { right: calc(14px + env(safe-area-inset-right, 0px)); top: calc(10px + var(--sat)); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--bronze-d); background: rgba(26,19,16,.6); color: var(--ivory); font-size: 14px; pointer-events: auto; }
.fp-panel { left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(86vw, 440px); max-height: 80vh; overflow: auto; padding: 18px; border-radius: 12px; background: linear-gradient(#e9dcbc, #d1bf94); color: var(--ink); border: 2px solid var(--bronze); box-shadow: 0 10px 40px #000; pointer-events: auto; display: flex; flex-direction: column; gap: 10px; }
.fp-panel h3 { margin: 0; text-align: center; letter-spacing: .12em; text-transform: uppercase; color: #5e1717; } .fp-panel p { margin: 0; line-height: 1.5; } .fp-panel .m { font-size: 12px; opacity: .75; }
.fp-panel .btn { color: var(--ivory); }
.fp-touch { display: none; }
#fp-ui.touch .fp-touch { display: block; position: absolute; inset: 0; }
.fp-touch > * { position: absolute; pointer-events: auto; }
.fp-stick { width: 116px; height: 116px; margin: -58px 0 0 -58px; border-radius: 50%; border: 2px solid rgba(224,194,122,.45); background: rgba(26,19,16,.25); pointer-events: none !important; }
.fp-stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(224,194,122,.45); border: 2px solid rgba(224,194,122,.7); }
.fp-btn { width: 74px; height: 74px; border-radius: 50%; border: 2px solid rgba(224,194,122,.6); background: radial-gradient(circle at 40% 30%, rgba(90,50,36,.8), rgba(26,16,12,.78)); color: var(--ivory); font-size: 13px; letter-spacing: .04em; text-shadow: 0 1px 2px #000; touch-action: none; display: flex; align-items: center; justify-content: center; }
.fp-btn.held { background: radial-gradient(circle at 40% 30%, #b8643a, #6a1b1b); transform: scale(.94); }
.fp-btn.big { width: 96px; height: 96px; font-size: 15px; }
/* landscape (primary): action cluster on the right, kept away from the screen edge */
.fp-btn[data-b=light] { right: calc(7vw + env(safe-area-inset-right, 0px)); bottom: calc(14vh + var(--sab)); }
.fp-btn[data-b=heavy] { right: calc(7vw + 106px + env(safe-area-inset-right, 0px)); bottom: calc(10vh + var(--sab)); }
.fp-btn[data-b=block] { right: calc(7vw + 20px + env(safe-area-inset-right, 0px)); bottom: calc(14vh + 112px + var(--sab)); }
.fp-btn[data-b=dodge] { right: calc(7vw + 112px + env(safe-area-inset-right, 0px)); bottom: calc(10vh + 96px + var(--sab)); width: 66px; height: 66px; }
.fp-btn.use { right: calc(7vw + 212px + env(safe-area-inset-right, 0px)); bottom: calc(14vh + var(--sab)); background: radial-gradient(circle at 40% 30%, #c9a35a, #6a4a1c); color: #20140c; font-weight: 700; }
.fp-btn.use[hidden] { display: none; }
#fp-ui.portrait .fp-btn[data-b=light] { bottom: calc(10vh + var(--sab)); right: 5vw; }
#fp-ui.portrait .fp-btn[data-b=heavy] { right: calc(5vw + 100px); bottom: calc(7vh + var(--sab)); }
#fp-ui.portrait .fp-btn[data-b=block] { right: calc(5vw + 8px); bottom: calc(10vh + 110px + var(--sab)); }
#fp-ui.portrait .fp-btn[data-b=dodge] { right: calc(5vw + 100px); bottom: calc(7vh + 92px + var(--sab)); }
#fp-ui.portrait .fp-btn.use { right: calc(5vw + 8px); bottom: calc(10vh + 214px + var(--sab)); }
@media (max-height: 420px) { .fp-btn { width: 62px; height: 62px; font-size: 12px; } .fp-btn.big { width: 80px; height: 80px; } .fp-btn[data-b=heavy] { right: calc(7vw + 90px); } .fp-btn[data-b=dodge] { right: calc(7vw + 94px); bottom: calc(10vh + 80px); width: 56px; height: 56px; } .fp-btn[data-b=block] { bottom: calc(14vh + 94px); } .fp-btn.use { right: calc(7vw + 176px); } }
.fp-btn[data-b=heal] { right: calc(7vw + 218px + env(safe-area-inset-right, 0px)); bottom: calc(10vh + 96px + var(--sab)); width: 60px; height: 60px; font-size: 11px; }
#fp-ui.portrait .fp-btn[data-b=heal] { right: calc(5vw + 192px); bottom: calc(7vh + 92px + var(--sab)); }
@media (max-height: 420px) { .fp-btn[data-b=heal] { right: calc(7vw + 180px); bottom: calc(10vh + 80px); width: 52px; height: 52px; } }
.fp-bar.bo { position: relative; } .fp-bar.bo::before, .fp-bar.bo::after { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.8); } .fp-bar.bo::before { left: 33%; } .fp-bar.bo::after { left: 66%; }
.fp-cross.mark { background: #ff7a50; transform: scale(2.2); box-shadow: 0 0 8px #ff5a30; }

.goal { position: absolute; left: 10px; top: calc(46px + var(--sat)); width: min(250px, 44vw); display: block; padding: 4px 9px; text-align: left; background: rgba(28,20,14,.82); border: 1px solid var(--bronze); border-radius: 10px; font: inherit; font-size: 11px; line-height: 1.25; color: #d9c9a6; }
.goal b, .goal span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal b { color: var(--gold); font-size: 12px; }
.goal.ready { border-color: #f2c14e; box-shadow: 0 0 8px rgba(242,193,78,.45); }
.goal-card { border-color: var(--bronze); }
@media (max-height: 460px) { .goal { top: calc(40px + var(--sat)); } }
@media (max-height: 460px) { .summary .loot-line { display: inline-block; margin-right: 14px; } .summary .card { padding: 6px 10px; } .summary p { margin: 2px 0; } }

.movebtn { position: absolute; right: 10px; top: calc(46px + var(--sat)); min-height: 44px; padding: 4px 10px; background: rgba(28,20,14,.82); border: 1px solid var(--bronze); border-radius: 10px; font: inherit; font-size: 12px; color: var(--gold); }
@media (min-width: 0px) { .edittools { position: absolute; right: 10px; top: calc(46px + var(--sat)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; } .edittools .movebtn { position: static; } }
@media (max-width: 600px) and (min-height: 461px) {
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .topbar .grow { flex-basis: 100%; display: flex; align-items: baseline; gap: 8px; }
  .topbar .reslist { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .plaque { padding: 5px 7px; }
  .goal { top: calc(88px + var(--sat)); width: calc(100% - 20px); }
  .edittools { top: calc(138px + var(--sat)); left: 10px; right: 10px; flex-direction: row; gap: 6px; }
  .edittools .movebtn { flex: 1; padding: 4px 4px; }
}
.dchips { display: flex; gap: 6px; width: 100%; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.dchip { flex: 0 0 auto; min-height: 36px; padding: 4px 10px; border: 1px solid var(--bronze-d); border-radius: 18px; background: #1f160f; font: inherit; font-size: 12px; color: var(--parchment, #e8dcc0); }
.dchip.on { border-color: var(--gold); color: var(--gold); background: #3a2a14; }
.movebar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 10px calc(10px + var(--sab)); display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; background: linear-gradient(rgba(14,9,6,0), rgba(14,9,6,.92) 40%); }
.movemsg { flex: 1 1 220px; max-width: 460px; padding: 8px 12px; background: rgba(28,20,14,.92); border: 1px solid var(--bronze); border-radius: 14px; font-size: 13px; text-align: center; color: var(--gold); }
.movebar.good .movemsg { border-color: #6fbf5f; color: #d6f5c8; }
.movebar.bad .movemsg { border-color: #d24a3a; color: #ffd0c8; }
.moveacts { display: flex; gap: 8px; }
.moveacts .btn { min-width: 110px; min-height: 48px; font-size: 14px; }
.moveacts .btn[disabled] { opacity: .4; pointer-events: none; }
