/* The raid HUD, after the concept in art/reference/hud-concept-raid.png: the dungeon's name
   on a skull plaque at the top of the view, a plain HP bar above the hotbar on the skull bar,
   and effects above the HP bar. Raiders have no mana.
   It overlays the dungeon view and lets clicks through except on its own controls. */
body[data-mode="raid"] .stats{display:none}
body[data-mode="raid"] .map-badge{display:none}
#game{position:relative;z-index:0}
.raid-hud{position:absolute;inset:0;pointer-events:none;z-index:8;--orb:132px;--slot:54px}
.zoom-controls,.map-badge{z-index:8}
body[data-mode="raid"] .object-dialogue{z-index:10;background:#111f22}
.raid-hud[hidden]{display:none}
.raid-hud .hud-plaque{position:absolute;top:4px;left:50%;transform:translateX(-50%);width:220px;height:48px;filter:drop-shadow(0 4px 6px #000a);pointer-events:none}
.raid-hud .hud-plaque .plaque-fade{position:absolute;inset:0;opacity:1;transition:opacity .8s ease}
.raid-hud .hud-plaque.is-dismissed .plaque-fade,.raid-hud .hud-plaque.is-dismissed .raid-owner-crest,.raid-hud .hud-plaque.is-dismissed .raid-owner-nameplate{opacity:0}
.raid-hud .hud-plaque.is-dismissed .raid-owner-crest,.raid-hud .hud-plaque.is-dismissed .raid-owner-nameplate{transition:opacity .8s ease}
.raid-hud .plaque-slice{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0}
.raid-hud .raid-owner-nameplate{inset:auto;left:50%;top:0;right:auto;bottom:auto;width:auto;height:100%;max-width:100%;transform:translateX(-50%);z-index:1}
.raid-hud .plaque-clip{position:absolute;left:var(--clip-left,28%);right:var(--clip-right,28%);top:18%;bottom:22%;overflow:hidden;display:flex;align-items:center;justify-content:center;z-index:2}
.raid-hud .hud-plaque.is-marquee .plaque-clip{justify-content:flex-start}
.raid-hud .plaque-track{display:inline-flex;align-items:center;white-space:nowrap}
.raid-hud .plaque-echo{display:none}
.raid-hud .hud-plaque.is-marquee .plaque-echo{display:inline}
.raid-hud .hud-plaque.is-marquee .plaque-track>span{padding-right:48px}
.raid-hud .hud-plaque.is-marquee .plaque-track{animation:plaque-marquee var(--marquee-duration,9s) linear infinite}
@keyframes plaque-marquee{0%,16%{transform:translateX(0)}100%{transform:translateX(-50%)}}
.raid-hud .plaque-track>span{font:600 clamp(13px,1.9vw,20px)/1 'Cormorant Garamond',Georgia,serif;letter-spacing:1.5px;color:#e2c58b;text-shadow:0 1px 0 #000,0 0 10px #000;font-variant:small-caps;white-space:nowrap}
.raid-hud .hud-bar{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);width:min(calc(100% - 2*var(--orb) - 8px),620px);height:calc(var(--slot) + 30px);background:url('./assets/hud/hud_bottom_bar.png') center/100% 100% no-repeat;display:flex;align-items:center;justify-content:center;filter:drop-shadow(0 4px 8px #000b)}
.raid-hud .hud-bar .hotbar{display:flex!important;gap:6px!important;margin:0!important;position:static!important;pointer-events:auto}
.raid-hud .hud-bar .hotbar button{width:var(--slot)!important;height:var(--slot)!important;min-width:var(--slot)!important;min-height:var(--slot)!important;padding:3px!important;margin:0!important;border:0!important;border-radius:3px!important;background:#0c0d0bcc url('./assets/hud/hud_slot_frame.png') center/100% 100% no-repeat!important;box-shadow:none!important;color:#f1e3bd!important}
.raid-hud .hud-bar .hotbar button.empty{opacity:.7}
.raid-hud .hud-bar .hotbar button b{font-size:11px!important}
.raid-hud .hud-bar .hotbar button small{font-size:8px!important;color:#c9b98f!important}
.raid-hud .hud-bar .hotbar button.lit{box-shadow:inset 0 0 16px #e0a24a99!important}
.raid-hud .hud-bar .hotbar button.relic{width:auto!important;max-width:110px!important}
.raid-hud .effect-strip{position:absolute;left:50%;transform:translateX(-50%);bottom:calc(var(--slot) + 44px);justify-content:center;max-width:calc(100% - 2*var(--orb));pointer-events:none}
.raid-hud .effect-strip .effect{background:#0d110ce6}
.raid-hud .effect-strip .effect.none{display:none}
@media (max-width:760px){.raid-hud{--orb:84px;--slot:40px}.raid-hud .hud-bar{height:calc(var(--slot) + 18px)}.raid-hud .hud-bar .hotbar{gap:3px!important}.raid-hud .hud-bar .hotbar button b{font-size:9px!important}.raid-hud .hud-bar .hotbar button small{font-size:7px!important}}
@media (max-width:430px){.raid-hud{--orb:66px;--slot:34px}.raid-hud .hud-plaque{top:4px}.raid-hud .hud-bar .hotbar button small:first-child{display:none}}
body[data-mode="raid"] .zoom-controls{top:12px;bottom:auto;right:12px}
@media (min-width:1100px){.raid-hud{--orb:168px;--slot:58px}}
@media (max-width:760px){body[data-mode="raid"] .zoom-controls{top:auto;bottom:calc(var(--orb, 84px) + 18px);right:8px}.raid-hud .hp-number{font-size:8px!important}.raid-hud .hp-number strong{font-size:11px!important}}
/* The old controller panel is gone: keys on a keyboard, taps on the map on a touch screen. */
body[data-mode="raid"] #raid-controls,body[data-mode="raid"] #raid-controls:not([hidden]),body:has(#raid-info:not([hidden])) #raid-controls:not([hidden]){display:none!important}
@media (max-width:760px){body[data-mode="raid"] .zoom-controls{top:52px;bottom:auto;right:8px}}
/* Full-bleed raid. The dungeon fills the window; the site's chrome steps aside and the
   few controls a raider still needs float over the canvas. */
body[data-mode="raid"] #workspace{height:100dvh!important}
body[data-mode="raid"] #workspace .main-panel{position:relative;padding:0!important}
body[data-mode="raid"] #workspace #canvas-wrap{border:0;border-radius:0;box-shadow:none}
body[data-mode="raid"] .map-footer{display:none}
body[data-mode="raid"] .topbar{position:fixed;top:12px;right:206px;left:auto;z-index:8;height:auto!important;min-height:0!important;padding:0!important;background:none!important;border:0!important;box-shadow:none!important;backdrop-filter:none!important}
body[data-mode="raid"] .topbar .brand,body[data-mode="raid"] .topbar nav,body[data-mode="raid"] .topbar #account-button,body[data-mode="raid"] .topbar #connect-wallet{display:none!important}
body[data-mode="raid"] .topbar #wallet{text-shadow:0 1px 3px #000}
body[data-mode="raid"] .panel-heading{position:absolute;top:12px;left:14px;right:auto;z-index:8;margin:0!important;padding:0!important;background:none!important;border:0!important;display:flex;flex-direction:column;align-items:flex-start;gap:6px;pointer-events:none}
body[data-mode="raid"] .panel-heading>*{pointer-events:auto}
body[data-mode="raid"] .panel-heading .name-label{display:none}
body[data-mode="raid"] .panel-heading .eyebrow{color:#c9b98f;text-shadow:0 1px 3px #000;font-size:10px}
body[data-mode="raid"] .heading-actions{order:-1}
body[data-mode="raid"] .main-panel>.result-actions{position:absolute;left:12px;right:12px;bottom:12px;z-index:7;margin:0;max-height:calc(100% - 24px);overflow:auto;box-shadow:0 -12px 40px #000c}
@media (max-width:760px){body[data-mode="raid"] .topbar{display:none}body[data-mode="raid"] .panel-heading{top:8px;left:8px}}
@media (max-width:760px){body[data-mode="raid"] .zoom-controls{top:8px!important;right:8px}body[data-mode="raid"] .raid-hud .hud-plaque{top:58px}body[data-mode="raid"] .panel-heading .eyebrow{display:none}}
body[data-mode="raid"] #raid-banner{top:clamp(92px,15vh,140px)}
/* HP bar: one slim bar, the number beside it, and a pale strip for damage just taken.
   --orb stays 0 so older layout rules that reserved room for the orbs collapse. */
.raid-hud{--orb:0px!important;--hp-gap:calc(var(--slot) + 40px)}
.raid-hud .hp-bar{position:absolute;left:50%;bottom:var(--hp-gap);transform:translateX(-50%);width:min(420px,calc(100% - 32px));display:grid;gap:4px;pointer-events:auto}
.raid-hud .hp-bar[hidden]{display:none}
.raid-hud .hp-label{display:flex;justify-content:space-between;align-items:baseline;font:700 10px/1 Arial,sans-serif;letter-spacing:2px;color:#c9b98f;text-shadow:0 1px 2px #000}
.raid-hud .hp-number{letter-spacing:.5px;color:#a99a78}
.raid-hud .hp-number strong{font-size:14px;color:#f1e4c4;margin-right:1px}
.raid-hud .hp-track{position:relative;height:12px;border-radius:2px;overflow:hidden;background:#0a0c0bd9;border:1px solid #8d785299;box-shadow:0 3px 10px #000b,inset 0 1px 3px #000}
.raid-hud .hp-chunk,.raid-hud .hp-fill{position:absolute;left:0;top:0;bottom:0}
.raid-hud .hp-chunk{width:var(--chunk,100%);background:#efd7a6;opacity:.5}
.raid-hud .hp-fill{width:var(--fill,100%);background:linear-gradient(#e0474e,#a8161e 55%,#760d12);box-shadow:inset 0 1px #ffffff45,1px 0 6px #ff3b3b66}
.raid-hud .hp-bar.low .hp-fill{animation:hp-low 1s ease-in-out infinite}
.raid-hud .hp-bar.low .hp-number strong{color:#ff8a80}
@keyframes hp-low{50%{filter:brightness(1.45)}}
.raid-hud .effect-strip{bottom:calc(var(--hp-gap) + 30px);max-width:calc(100% - 32px)}
@media (max-width:760px){.raid-hud{--hp-gap:calc(var(--slot) + 26px)}}
@media (prefers-reduced-motion:reduce){.raid-hud .hp-bar.low .hp-fill{animation:none}.raid-hud .hud-plaque.is-marquee .plaque-track{animation:none}.raid-hud .hud-plaque .plaque-fade,.raid-hud .hud-plaque.is-dismissed .raid-owner-crest,.raid-hud .hud-plaque.is-dismissed .raid-owner-nameplate{transition-duration:.2s}}
/* Raid ending: a centred card over the darkened dungeon. Death has a blood accent,
   a cleared vault or a way out has gold. One title, one line, the run in tiles, then the choices. */
body[data-mode="raid"] .main-panel>.result-actions.fate{position:absolute;left:50%;top:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);width:min(620px,calc(100% - 32px));max-height:calc(100% - 32px);overflow:auto;margin:0;padding:34px 30px 28px;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:12px;text-align:center;border:1px solid #6d5e44;border-top:2px solid var(--fate,#c69a55);border-radius:4px;background:linear-gradient(180deg,#151b1af5,#0b0f0ef8);box-shadow:0 0 0 100vmax #040506b8,0 24px 60px #000c,inset 0 1px #ffffff0f;z-index:7;animation:fate-rise .7s cubic-bezier(.2,.8,.2,1) both}
/* Keep the map and its HUD below the death card. The Leave raid header stays above it. */
body[data-mode="raid"] .main-panel:has(> .fate-dead) > #canvas-wrap {
  isolation: isolate;
  z-index: 0;
}
body[data-mode="raid"] .main-panel>.result-actions.fate-dead{--fate:#b3372b;box-shadow:0 0 0 100vmax #0a0303c2,0 24px 60px #000c,0 0 80px #6e0d0d33,inset 0 1px #ffffff0f}
body[data-mode="raid"] .main-panel>.result-actions.fate>*{flex:0 0 100%;margin:0}
body[data-mode="raid"] .main-panel>.result-actions.fate>button{flex:0 1 auto;min-width:150px;min-height:46px;order:3}
body[data-mode="raid"] .main-panel>.result-actions.fate>button.primary{order:2}
.result-actions.fate>strong{font:400 clamp(34px,5vw,48px)/1.05 Georgia,'Times New Roman',serif;color:#f2e6cc;letter-spacing:.5px;animation:fate-title 1.1s ease-out both}
.result-actions.fate-dead>strong{color:#efdcc6;text-shadow:0 0 24px #a3221a66}
.result-actions.fate>.raid-status{font:700 11px/1.4 Arial,sans-serif;letter-spacing:3px;text-transform:uppercase;color:var(--fate,#c69a55)}
.result-actions.fate>.death-message,.result-actions.fate>#practice-death-note{font-size:14px;line-height:1.5;color:#a9b2ae;max-width:42ch;margin:0 auto}
.result-actions.fate>.result-medal{font-size:12px;color:#e2c58b;letter-spacing:.5px}
.result-actions.fate>.run-summary{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:6px 0 10px;color:inherit;font-size:inherit}
.result-actions.fate .run-summary .sep{display:none}
.result-actions.fate .run-summary .stat{padding:7px 11px;border:1px solid #343c39;border-radius:3px;background:#090c0bd9;font-size:12px;color:#d9c8a2;white-space:nowrap}
@keyframes fate-rise{from{opacity:0;transform:translate(-50%,calc(-50% + 18px))}to{opacity:1;transform:translate(-50%,-50%)}}
@keyframes fate-title{from{opacity:0;letter-spacing:6px}to{opacity:1;letter-spacing:.5px}}
@media (max-width:760px){body[data-mode="raid"] .main-panel>.result-actions.fate{padding:26px 18px 20px}body[data-mode="raid"] .main-panel>.result-actions.fate>button{flex:1 1 100%}}
@media (prefers-reduced-motion:reduce){body[data-mode="raid"] .main-panel>.result-actions.fate,.result-actions.fate>strong{animation:none}}
