.career-heading { padding: 16px; background: #16342d88; border: 1px solid #65b99a55; border-radius: 6px; margin: 0 0 20px; }.career-heading b { font-size: 13px; }.career-heading small { display: block; font-size: 10px; color: #9ebeb4; margin: 8px 0; }.career-bar { height: 5px; background: #091f24; }.career-bar i { display: block; height: 100%; background: #b9a7ff; }
.character-tabs { display: flex; gap: 8px; margin: 20px 0; }.character-tabs button { border: 1px solid #48636e; background: #172b37; color: #acc6cd; padding: 11px 16px; border-radius: 5px; font-size: 11px; }.character-tabs [aria-selected="true"] { border-color: #89d9bd; background: #244b40; color: #e6fff1; }.loadout-slots { display: flex; gap: 12px; }.loadout-slots label { flex: 1; font-size: 11px; color: #a9c8c8; }.loadout-slots select { display: block; width: 100%; background: #1c343c; color: #ddf1ed; border: 1px solid #6e9c95; margin-top: 8px; border-radius: 4px; }
.skill-library { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }.skill-card { background: #162734; border: 1px solid #455e70; padding: 16px; border-radius: 6px; }.skill-card b { font-size: 13px; }.skill-card p { color: #b0c8cc; font-size: 11px; line-height: 1.7; }.skill-card small { color: #89c9ad; font-size: 9px; }.skill-card.locked { opacity: .6; }
.skillbar .skill { width: 105px; }.touch-actions { position: relative; width: 260px; height: 155px; pointer-events: none; }.touch-actions button { pointer-events: auto; touch-action: none; position: absolute; border: 1px solid #98c4c5; border-radius: 50%; background: #1f4049df; color: #e0faf0; font-size: 10px; padding: 6px; }#primary-button { width: 76px; height: 76px; right: 0; bottom: 0; background: #365e65df; }.touch-actions #special-button { right: 95px; bottom: 0; width: 60px; height: 60px; }.touch-actions #skill-button-2 { right: 80px; bottom: 77px; width: 60px; height: 60px; }.touch-actions #skill-button-3 { right: 0; bottom: 95px; width: 60px; height: 60px; }.touch-actions #revive-button { right: 180px; bottom: 5px; width: 48px; height: 48px; font-size: 9px; }#skill-aim-hint { position: absolute; left: 50%; bottom: 180px; transform: translateX(-50%); background: #132432de; padding: 12px; border: 1px solid #7ca9b8; font-size: 11px; pointer-events: none; }
.character-page .build-explainer { max-width: 760px; }
#notice { top: 140px; max-width: 440px; font-size: 11px; pointer-events: none; }

/* Top-level preparation views */
.manager-views { display: flex; gap: 4px; border: 1px solid #52767c66; padding: 3px; border-radius: 8px; background: #0b1c25b3; }
.manager-views button { background: transparent; border: 1px solid transparent; color: #a9c1c7; padding: 8px 15px; font-size: 10px; letter-spacing: .04em; border-radius: 6px; transition: background .15s, color .15s; }
.manager-views button:hover { background: #23454b99; color: #effff8; }
.manager-views button[aria-selected="true"] { background: linear-gradient(#2b514b, #1c3c37); border-color: #78b6a177; box-shadow: inset 0 -2px #8bdcbd; color: #e8fff5; font-weight: 650; }
.manager-views button:focus:not(:focus-visible) { outline: none; }
.manager-views button:focus-visible { outline: 2px solid #b5f7df; outline-offset: -3px; }
.character-page { padding-top: 82px; }
.character-page .preparation-main { padding-top: 22px; }
.character-page .build-heading h1 { margin: 4px 0; font-size: 30px; }
.character-page .build-heading .intro { margin: 8px 0 12px; font-size: 11px; }
.character-page .build-explainer { margin-bottom: 12px; font-size: 11px; }
.character-page .career-heading { padding: 12px; margin-bottom: 12px; }
.character-page .character-tabs { margin: 12px 0; }
.manager-page { padding: 42px 0; min-height: calc(100dvh - 180px); }
.manager-page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid #789ba333; padding-bottom: 24px; margin-bottom: 26px; }
.manager-page-head h1 { margin: 6px 0 8px; font-size: clamp(30px, 3.4vw, 46px); }
.manager-page-head .intro { margin: 0; max-width: 520px; }
.room-list { display: grid; gap: 10px; }
.room-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #4f6f7b66; background: linear-gradient(100deg, #16303a, #101e29); padding: 18px 20px; border-radius: 7px; }
.room-card strong { display: block; font-size: 13px; letter-spacing: .08em; }
.room-card span { display: block; color: #94b0b7; font-size: 11px; margin-top: 7px; }
.room-card button { width: auto; padding: 11px 20px; }
.account-panel { max-width: 540px; display: grid; gap: 12px; border: 1px solid #4f6f7b66; background: #13252f; border-radius: 8px; padding: 24px; margin-bottom: 18px; }
.account-panel h3 { margin: 0 0 4px; font-size: 18px; }
.account-panel label { font-size: 11px; color: #a9c1c7; }
.account-panel input { display: block; width: 100%; margin-top: 8px; }
.account-panel .primary { margin-top: 4px; }
.account-panel.locked { opacity: .78; }

/* Paper doll and equipment */
.character-overview { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; grid-template-areas: "paper inventory" "fields fields"; gap: 26px; align-items: start; }
.character-overview > .paper-doll-panel { grid-area: paper; }
.character-overview > .character-fields { grid-area: fields; }
.character-overview > .inventory-panel { grid-area: inventory; margin-top: 0; min-width: 0; }
.character-overview .inventory-heading { margin-top: 0; }
.paper-doll-panel { position: relative; display: grid; gap: 8px; grid-template-columns: 96px 1fr 96px; grid-template-areas: "head head head" "chest preview main" "legs preview secondary" "boots preview spare"; border: 1px solid #53707a88; border-radius: 8px; background: radial-gradient(ellipse at 50% 48%, #21414999, #0e1c2666 68%); padding: 12px; }
#character-preview { grid-area: preview; width: 100%; height: 300px; display: block; min-width: 0; }
.paper-doll-hint { grid-column: 1 / -1; font-size: 9px; color: #8ba6ad; text-align: center; margin: 4px 0 0; }
.equipment-slots { display: contents; }
.gear-slot { position: relative; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; min-height: 76px; padding: 8px 5px; border: 1px solid #48636e; background: #122631cc; color: #d8e6e8; border-radius: 6px; overflow: hidden; }
.gear-slot:hover, .gear-slot.active { border-color: #9fe3cd; background: #1e403cda; }
.gear-slot i { font-style: normal; font-size: 15px; color: #8cc7c8; line-height: 1; }
.gear-slot b { font-size: 9px; letter-spacing: .04em; color: #9db8bc; }
.gear-slot .slot-item { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.gear-slot .slot-empty { font-size: 9px; color: #5f7c84; }
.gear-slot small { font-size: 8px; color: #83a3a8; }
.gear-slot.slot-head { grid-area: head; width: 50%; justify-self: center; }
.gear-slot.slot-chest { grid-area: chest; } .gear-slot.slot-legs { grid-area: legs; } .gear-slot.slot-boots { grid-area: boots; }
.gear-slot.slot-main { grid-area: main; } .gear-slot.slot-secondary { grid-area: secondary; }
.rarity-0 { --rarity: #d5dde1; } .rarity-1 { --rarity: #5f9dff; } .rarity-2 { --rarity: #b981ff; } .rarity-3 { --rarity: #ff9b45; } .rarity-4 { --rarity: #ff5364; }
.gear-slot[class*="rarity-"] { border-color: color-mix(in srgb, var(--rarity) 60%, #33454e); box-shadow: inset 0 0 22px color-mix(in srgb, var(--rarity) 10%, transparent); }
.character-fields { min-width: 0; }
.character-page .character-overview .character-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.character-page .character-overview .character-editor label:last-child { grid-column: auto; }
.character-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 18px 0 12px; }
.stat-cell { background: #12242e; border: 1px solid #3c5964; border-radius: 5px; padding: 9px 10px; }
.stat-cell span { display: block; font-size: 9px; color: #8fa9b0; letter-spacing: .03em; }
.stat-cell b { display: block; font-size: 14px; margin-top: 4px; color: #d8f1e8; }

/* Backpack, runes, rewards */
.inventory-panel { margin-top: 26px; }
.inventory-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; border-bottom: 1px solid #789ba333; padding-bottom: 12px; margin: 22px 0 14px; }
.inventory-heading h3 { margin: 4px 0 0; font-size: 17px; }
.inventory-heading .eyebrow { margin: 0; }
.inventory-heading > span { font-size: 10px; color: #a6c1bd; }
.inventory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
#gear-inventory { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.backpack-cell { min-width: 0; min-height: 80px; padding: 8px 5px; border: 1px solid #46606b; border-bottom: 2px solid var(--rarity, #46606b); border-radius: 5px; background: linear-gradient(145deg, #1b303b, #101e28); color: var(--rarity, #91a9b0); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.backpack-cell i { font-style: normal; font-size: 22px; }
.backpack-cell b { max-width: 100%; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backpack-cell small { font-size: 8px; opacity: .7; }
.backpack-cell.inspected, .backpack-cell[data-id]:hover, .backpack-cell[data-id]:focus-visible { outline: 1px solid var(--rarity, #8cc9ba); outline-offset: 1px; }
.backpack-cell.equipped::after { content: 'EQUIPPED'; color: #8be3bf; font-size: 6px; letter-spacing: .1em; }
.empty-cell { opacity: .35; min-height: 80px; }
.gear-inspection { margin-top: 12px; }
.item-card { position: relative; border: 1px solid #48636e; border-left: 3px solid var(--rarity, #48636e); background: linear-gradient(145deg, #172d38, #101d27); border-radius: 6px; padding: 11px 12px; min-height: 106px; }
.item-card.matching { background: linear-gradient(145deg, #1d3b44, #11222c); }
.item-card.equipped { box-shadow: inset 0 0 30px #7de1c70f; }
.item-card header { display: flex; flex-direction: column; gap: 4px; }
.item-card header b { font-size: 12px; color: var(--rarity, #dbe8e8); overflow-wrap: anywhere; }
.item-rarity { font-size: 8px; letter-spacing: .12em; text-transform: uppercase; color: var(--rarity, #9fb3b8); }
.item-card > small { display: block; color: #8fa9b0; font-size: 9px; margin-top: 5px; }
.item-card > p { color: #b9cdd0; font-size: 10px; line-height: 1.6; margin: 6px 0 0; min-height: 16px; }
.item-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.item-actions button { width: auto; padding: 5px 7px; font-size: 8px; letter-spacing: .02em; border-color: #4e6f76; }
.item-actions .danger { color: #f3a4a4; border-color: #855252; }
.equipped-tag { position: absolute; top: 9px; right: 9px; font-size: 7px; font-style: normal; letter-spacing: .1em; color: #8be3bf; text-transform: uppercase; }
.rune-card { min-height: 122px; }
.reward-card { display: flex; flex-direction: column; gap: 5px; width: 100%; text-align: left; background: #1a2b38; border: 1px solid #48636e; border-left: 3px solid var(--rarity, #9f8ccf); color: #e2eeee; padding: 13px 15px; border-radius: 6px; margin: 8px 0; }
.reward-card b { color: var(--rarity, #e2d0ff); font-size: 13px; }
.reward-card small { color: #9fb5ba; font-size: 10px; }

/* In-world nameplates */
#nameplates { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.nameplate { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; will-change: transform; filter: drop-shadow(0 1px 3px #000c); }
.nameplate b { font-size: 10px; font-weight: 500; letter-spacing: .04em; color: #e8f5f0; white-space: nowrap; }
.nameplate i { display: block; width: 56px; height: 5px; background: #091014cc; border: 1px solid #00000088; border-radius: 3px; overflow: hidden; }
.nameplate i span { display: block; height: 100%; width: 100%; background: #7ee1a9; }
.nameplate i span.mid { background: #ffd479; } .nameplate i span.low { background: #ff6b6b; }

@media (max-width: 1100px) { .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .character-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px) {
  .skill-library, .inventory-grid { grid-template-columns: 1fr; }
  .loadout-slots { flex-direction: column; }
  .character-tabs button { padding: 10px 7px; font-size: 10px; }
  .character-overview { grid-template-columns: 1fr; grid-template-areas: "paper" "inventory" "fields"; }
  .manager-views button { padding: 8px 10px; font-size: 9px; }
  .manager-top nav.manager-views { display: flex; gap: 3px; }
  .manager-page-head { align-items: start; flex-direction: column; }
  .room-card { flex-direction: column; align-items: stretch; }
  .room-card button { width: 100%; }
}
@media (pointer: coarse) { #notice { top: 54px; left: 16px; max-width: calc(100% - 32px); font-size: 9px; } }

/* Readable preparation text and touch targets, without shrinking on phones. */
.character-page { font-size: 15px; }
.character-page .profile-note, .character-page .build-explainer, .character-page .build-heading .intro,
.character-page .roster-sidebar .profile-note, .character-page .prototype-note { font-size: 14px; line-height: 1.65; }
.character-page .eyebrow { font-size: 12px; }
.character-page label, .field-label { display: block; font-size: 14px; color: #b5cdd0; }
.character-page input, .character-page select { font-size: 16px; min-height: 46px; }
.character-page .manager-views button, .character-page .character-tabs button,
.character-page .subtle, .character-page .item-actions button { font-size: 14px; min-height: 44px; }
.character-page .manager-views { gap: 4px; }
.character-page .manager-views button { padding: 9px 14px; letter-spacing: .02em; }
.character-page .roster-card b { font-size: 15px; }
.character-page .roster-card small { font-size: 13px; line-height: 1.5; }
.character-page .career-heading b { font-size: 15px; }
.character-page .career-heading small { font-size: 13px; }
.gear-slot b, .gear-slot .slot-item, .gear-slot .slot-empty { font-size: 12px; }
.gear-slot small, .paper-doll-hint { font-size: 11px; line-height: 1.5; }
.gear-slot { min-height: 90px; }
.backpack-cell { min-height: 100px; }
.backpack-cell b { font-size: 13px; }
.backpack-cell small { font-size: 12px; }
.backpack-cell.equipped::after { font-size: 10px; }
.item-card header { padding-right: 70px; }
.item-card header b, .reward-card b, .skill-card b { font-size: 16px; }
.item-rarity, .equipped-tag { font-size: 11px; }
.item-card > small, .item-card > p, .reward-card small, .skill-card p, .inventory-heading > span { font-size: 14px; }
.skill-card small, .stat-cell span { font-size: 12px; }
.stat-cell b { font-size: 17px; }
.character-page .item-actions { gap: 8px; }
.character-page .item-actions button { padding: 9px 12px; }
.inventory-heading { flex-wrap: wrap; gap: 8px; }
.character-save { justify-content: end; }
.character-save { gap: 12px; flex-wrap: wrap; }
.character-save #delete-character { margin-right: auto; color: #f3a49a; border-color: #9a625d; }
.survivor-picker:hover { background: #24443f; border-color: #96e2c8; }
.lobby-battle-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 14px; align-items: end; padding: 22px; margin-bottom: 24px; background: #132932; border: 1px solid #50737b; border-radius: 8px; }
.lobby-battle-controls input { display: block; width: 100%; margin-top: 8px; }
.survivor-picker { display: block; width: 100%; min-height: 46px; padding: 12px; margin-top: 8px; text-align: left; background: #1b353d; color: #dceee8; border: 1px solid #5d888b; border-radius: 5px; font-size: 15px; }
#lobby-build-status { grid-column: 1 / 3; margin: 0; }
@media (max-width: 1100px) {
  .character-overview { grid-template-columns: 1fr; grid-template-areas: "paper" "inventory" "fields"; }
  .paper-doll-panel { max-width: 480px; width: 100%; justify-self: center; }
  .lobby-battle-controls { grid-template-columns: 1fr 1fr; }
  #lobby-build-status { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .manager-layout { display: block; }
  .roster-sidebar { border-right: 0; border-bottom: 1px solid #789ba333; padding: 20px 0; }
  .roster-cards { display: flex; overflow-x: auto; gap: 12px; margin: 14px 0; }
  .roster-card { min-width: 210px; max-width: 280px; }
  .roster-new { width: auto; }
  .character-page .preparation-main { padding-left: 0; }
}
@media (max-width: 650px) {
  .character-page { padding-inline: 16px; }
  .manager-top { flex-wrap: wrap; gap: 12px; }
  .manager-top .manager-views { width: 100%; justify-content: space-between; }
  .character-page .character-tabs { flex-wrap: wrap; }
  .paper-doll-panel { grid-template-columns: 84px minmax(0, 1fr) 84px; padding: 8px; }
  .character-page .character-overview .character-editor, .lobby-battle-controls { grid-template-columns: 1fr; }
  #gear-inventory { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lobby-battle-controls { padding: 16px; }
}
.ground-loot-label { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: min(280px, 75vw); padding: 6px 10px; color: var(--loot-color); background: #070a10dc; border: 1px solid var(--loot-color); border-radius: 4px; box-shadow: 0 0 16px color-mix(in srgb, var(--loot-color) 30%, transparent); text-align: center; pointer-events: none; }
.ground-loot-label[hidden] { display: none; }
.ground-loot-label b { font-size: 14px; line-height: 1.3; }
.ground-loot-label small { font-size: 12px; color: #d5dadc; }
.weapon-sockets { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.character-page .weapon-socket { min-height: 48px; padding: 12px 16px; border: 1px solid #759c9b; }
.backpack-filters { display: flex; gap: 8px; margin: 12px 0 18px; }
.character-page .backpack-filters button { min-height: 46px; padding: 10px 20px; font: inherit; color: #bcd4d1; background: #132932; border: 1px solid #50737b; border-radius: 6px; cursor: pointer; }
.character-page .backpack-filters button[aria-selected="true"] { color: #ddfff1; border-color: #96d5bc; background: #24473f; }
.backpack-filters button:focus-visible, .weapon-socket:focus-visible { outline: 2px solid #c7ffec; outline-offset: 3px; }
.rune-cell i { text-shadow: 0 0 14px var(--rarity); }
.creation-name { display: block; max-width: 520px; margin: 24px 0; }
.creation-name input { display: block; width: 100%; margin: 10px 0; box-sizing: border-box; }
#back-name { margin-bottom: 20px; }
.upgrade-panel { z-index: 5; max-height: 82dvh; overflow: auto; }
.level-up-button { position: absolute; left: 0; top: -56px; min-height: 44px; padding: 10px 16px; border: 1px solid #a9e2b8; border-radius: 6px; background: #254b35ed; color: #e7ffd9; font-size: 14px; font-weight: 700; box-shadow: 0 0 16px #83df8f35; white-space: nowrap; }
.level-up-button:hover { background: #3b6a43; }
#upgrade-close { float: right; min-height: 44px; min-width: 64px; margin: -6px -6px 6px 12px; }
@media (pointer: coarse) { .level-up-button { left: calc(100% + 12px); top: 0; } }
.character-page .roster-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 116px; padding: 14px; border: 1px dashed #6d9297; border-radius: 6px; color: #b9d2ce; background: #10232b; cursor: pointer; }
.roster-empty i { font-size: 32px; font-style: normal; color: #a6e8cb; }
.roster-empty small { font-size: 13px; color: #91afaf; }
.roster-empty:hover, .roster-empty:focus-visible { border-color: #baf4da; background: #203d38; }
.roster-empty:disabled { opacity: .5; cursor: not-allowed; }
.in-battle { --battle-map: 150px; }
.in-battle .topbar { padding-right: calc(var(--battle-map) + 140px + env(safe-area-inset-right)); }
.in-battle #fullscreen { position: absolute; right: calc(var(--battle-map) + 76px + env(safe-area-inset-right)); top: calc(16px + env(safe-area-inset-top)); width: 44px; height: 44px; font-size: 21px; }
#settings-toggle { position: absolute; right: calc(var(--battle-map, 150px) + 24px + env(safe-area-inset-right)); top: calc(16px + env(safe-area-inset-top)); width: 44px; height: 44px; color: #cceade; background: #10262de8; border: 1px solid #718f8e; border-radius: 7px; font-size: 26px; z-index: 4; }
#game-hud .minimap-panel { width: var(--battle-map, 150px); top: calc(16px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); }
#game-hud .minimap-panel figcaption { display: block; padding: 5px 2px; font-size: 10px; }
.minimap-panel figcaption small { display: block; margin-top: 4px; font-size: 7px; }
#battle-settings { width: min(440px, calc(100% - 32px)); z-index: 8; }
#battle-settings .settings { position: static; width: auto; display: grid; gap: 10px; background: none; padding: 10px 0; font-size: 15px; }
#battle-settings .settings label { min-height: 44px; gap: 12px; }
#battle-settings .settings input[type="checkbox"] { width: 20px; height: 20px; }
#battle-settings .settings input[type="range"] { flex: 1; min-width: 0; width: 100%; height: 32px; margin: 0; }
#battle-settings .settings select { font-size: 15px; min-height: 44px; width: 120px; }
#battle-settings .room-info { margin: 12px 0; text-align: left; }
.room-listing { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.room-listing input { width: 20px; height: 20px; accent-color: #89d9bd; }
.lobby-battle-controls .room-listing { grid-column: 1 / -1; }
.lobby-battle-controls .room-listing input { margin: 0; }
.room-listing + .profile-note { grid-column: 1 / -1; margin: 0; }
@media (pointer: fine) {
  #scene { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23071319' stroke-width='5'%3E%3Ccircle cx='20' cy='20' r='9'/%3E%3Cpath d='M20 2v11m0 14v11M2 20h11m14 0h11'/%3E%3C/g%3E%3Cg fill='none' stroke='%23eafff7' stroke-width='2'%3E%3Ccircle cx='20' cy='20' r='9'/%3E%3Cpath d='M20 2v11m0 14v11M2 20h11m14 0h11'/%3E%3C/g%3E%3Ccircle cx='20' cy='20' r='2' fill='%2383ffcd'/%3E%3C/svg%3E") 20 20, crosshair; }
}
.in-battle .topbar { background: none; }
.in-battle .topbar .brand { display: none; }
.in-battle .vitals { display: flex; flex-direction: column; gap: 4px; top: calc(14px + env(safe-area-inset-top)); bottom: auto; left: calc(16px + env(safe-area-inset-left)); width: 58px; padding: 0; min-height: 0; background: none; border: 0; }
.player-avatar { width: 58px; height: 70px; flex: 0 0 auto; object-fit: cover; border: 1px solid #85aaa0; border-radius: 5px; background: #17333f; }
.vitals-info { flex: 1; min-width: 0; }
#hud-player-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; margin-bottom: 5px; }
.vitals-info .vitals-heading { margin-bottom: 4px; gap: 4px; font-size: 9px; }
#career-hud { display: block; color: #9bb8b9; font-size: 9px; }
.in-battle .vitals > .health { width: 100%; height: 6px; margin: 0; }
.in-battle .level-up-button { top: calc(100% + 8px); left: 0; min-height: 44px; padding: 10px 12px; font-size: 13px; }
#party.coop-portraits { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: calc(86px + env(safe-area-inset-left)); display: flex; gap: 6px; margin: 0; max-width: calc(100% - 300px); overflow-x: auto; scrollbar-width: none; }
.ally-portrait { width: 42px; position: relative; flex-shrink: 0; }
.ally-portrait img { display: block; width: 42px; height: 44px; object-fit: cover; object-position: top; border: 1px solid #6b9295; border-radius: 4px; background: #182c34; }
.ally-health { position: absolute; top: 39px; left: 2px; right: 2px; height: 4px; background: #402b2b; }
.ally-health i { display: block; height: 100%; background: #8fc2a8; }
.ally-portrait small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; color: #c3d9d4; text-align: center; }
.ally-portrait.down img { filter: grayscale(1); border-color: #dc8b79; }.ally-portrait.down small { color: #ffbc9c; }
.touch-actions button.aiming { overflow: visible; outline: 2px solid #c4ffe7; box-shadow: 0 0 22px #91e8cc66; }
.touch-actions button.aiming::after { content: ''; position: absolute; left: calc(50% - 12px); top: calc(50% - 12px); width: 24px; height: 24px; transform: translate(var(--aim-x, 0px), var(--aim-y, 0px)); border: 2px solid #d6fff1; border-radius: 50%; background: #85bea36b; box-shadow: 0 2px 5px #0008; pointer-events: none; }
#mobile-roster-toggle, #mobile-roster-close, #inventory-close { display: none; }
.mobile-item-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-sizing: border-box; }
.mobile-item-dialog .gear-inspection { margin-top: 0; }
.mobile-item-dialog .item-actions button, .mobile-item-dialog .weapon-socket, #mobile-item-close { min-height: 44px; padding: 10px 14px; font-size: 14px; }
.mobile-item-dialog .item-actions { gap: 8px; }
.mobile-item-dialog .weapon-sockets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mobile-item-dialog .item-card header b { font-size: 18px; padding-right: 60px; }
.mobile-item-dialog .item-card > p, .mobile-item-dialog .item-card > small { font-size: 13px; }

/* Landscape touch preparation is an equipment workspace, not a long form. */
@media (pointer: coarse), (max-width: 700px) {
  body:has(#join-panel:not([hidden]) #characters-view:not([hidden]) #build-stage:not([hidden])) .topbar { display: none; }
  #join-panel:has(#characters-view:not([hidden]) #build-stage:not([hidden])) { position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: none; padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(10px, env(safe-area-inset-left)); display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; }
  #join-panel:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-top { flex: 0 0 auto; padding: 4px 0; align-items: center; }
  #join-panel:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-top > .eyebrow { display: none; }
  #join-panel:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-views { display: flex; margin-left: auto; }
  #join-panel:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-views button { min-height: 40px; padding: 6px 14px; }
  #characters-view:has(#build-stage:not([hidden])) { display: block; flex: 1; min-height: 0; position: relative; }
  #characters-view:has(#build-stage:not([hidden])) .roster-sidebar { display: none; }
  #characters-view:has(#build-stage:not([hidden])) .preparation-main { padding: 0; height: 100%; min-height: 0; }
  #build-stage:not([hidden]) { height: 100%; min-height: 0; display: flex; flex-direction: column; }
  #build-stage .build-heading { display: contents; }
  #build-stage .build-heading .eyebrow, #build-stage .build-heading .intro, #build-stage > .build-explainer { display: none; }
  .character-page #build-stage .build-heading h1 { position: absolute; top: -42px; left: 0; max-width: calc(100% - 310px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; line-height: 30px; margin: 0; }
  #build-stage #back-class { position: absolute; bottom: 6px; left: 0; z-index: 1; min-height: 42px; padding: 8px; }
  #build-stage .character-tabs { flex: 0 0 auto; gap: 6px; margin: 4px 0 8px; }
  #build-stage .character-tabs button { min-height: 42px; padding: 8px 12px; }
  #mobile-roster-toggle { display: block; margin-right: auto; }
  .roster-expanded #mobile-roster-close { display: block; margin-bottom: 12px; }
  #build-stage > [data-character-section] { flex: 1; min-height: 0; overflow: auto; }
  #build-stage > [data-character-section="overview"] { overflow: hidden; }
  #build-stage .character-overview { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(210px, 40%) minmax(0, 1fr); grid-template-areas: 'paper inventory'; gap: 10px; }
  #build-stage .paper-doll-panel { height: 100%; min-height: 0; box-sizing: border-box; padding: 4px; gap: 4px; grid-template-columns: 60px minmax(0, 1fr) 60px; grid-template-rows: 44px repeat(3, minmax(0, 1fr)); overflow: hidden; overscroll-behavior: none; }
  #build-stage #character-preview { height: 100%; min-height: 0; }
  #build-stage .gear-slot { min-height: 44px; padding: 4px; }
  #build-stage .gear-slot b { font-size: 10px; }
  #build-stage .gear-slot .slot-item, #build-stage .gear-slot .slot-empty, #build-stage .gear-slot small, #build-stage .paper-doll-hint { display: none; }
  #build-stage .gear-slot.slot-head { width: 60px; }
  #build-stage .inventory-panel { display: flex; flex-direction: column; overflow: hidden; height: 100%; min-height: 0; padding-right: 3px; }
  #build-stage .inventory-heading { padding-bottom: 4px; margin: 0; gap: 8px; }
  #build-stage .inventory-heading h3, #build-stage .inventory-heading .eyebrow { display: none; }
  #build-stage #gear-materials { font-size: 11px; }
  #build-stage .backpack-filters { flex: 0 0 auto; background: #0d1e28; margin: 4px 0 8px; gap: 6px; }
  #build-stage .backpack-filters button { min-height: 42px; padding: 7px 14px; }
  #build-stage #gear-inventory { flex: 1; min-height: 0; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); grid-auto-rows: 64px; align-content: start; gap: 6px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; }
  #build-stage .backpack-cell { position: relative; min-height: 0; padding: 5px; gap: 3px; }
  #build-stage .backpack-cell i { font-size: 22px; }
  #build-stage .backpack-cell small { display: none; }
  #build-stage .backpack-cell.equipped::after { content: '◆'; position: absolute; top: 3px; right: 4px; font-size: 9px; }
  #build-stage .backpack-cell b { font-size: 10px; }
  #build-stage .backpack-cell small { font-size: 9px; }
  #build-stage #inspection-home, #build-stage .inventory-panel > .profile-note:last-child { display: none; }
  #build-stage .character-save { flex: 0 0 auto; display: flex; justify-content: space-between; padding: 5px 0; margin: 0; border: 0; gap: 10px; }
  #build-stage .character-save button { min-height: 42px; padding: 8px 12px; }
  #build-stage #save-character { margin-left: auto; }
  #join-panel.saved-inventory:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-top { display: none; }
  .saved-inventory #build-stage #inventory-close { display: block; position: absolute; top: 6px; right: 0; z-index: 2; width: 40px; height: 40px; min-height: 40px; padding: 0; font-size: 25px; line-height: 1; }
  .saved-inventory #build-stage .build-heading h1 { display: none; }
  .saved-inventory #build-stage .paper-doll-panel { position: absolute; top: 0; bottom: 0; left: 0; height: 100%; width: max(210px, 40%); }
  .saved-inventory #build-stage .character-tabs { padding-right: 48px; min-height: 48px; margin: 4px 0 6px; justify-content: flex-end; align-items: center; }
  .saved-inventory #build-stage #mobile-roster-toggle, .saved-inventory #build-stage .character-save { display: none; }
  .saved-inventory #build-stage .inventory-heading { flex: 0 0 auto; }
  .roster-expanded #characters-view:has(#build-stage:not([hidden])) .roster-sidebar { display: block; position: absolute; inset: 0; z-index: 4; background: #10232e; padding: 14px; overflow: auto; border: 1px solid #5c8c88; border-radius: 6px; }
  .roster-expanded #characters-view:has(#build-stage:not([hidden])) .roster-sidebar::before { content: 'Select a survivor or + to create'; display: block; color: #a6d9c9; }
  #characters-view:has(#build-stage:not([hidden])) #profile-error:not(:empty) { position: absolute; bottom: 50px; left: 0; right: 0; z-index: 3; background: #301b22; padding: 10px; }
}
@media (max-width: 480px) {
  #build-stage .character-overview { grid-template-columns: minmax(145px, 44%) minmax(0, 1fr); gap: 6px; }
  #build-stage .paper-doll-panel { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  #build-stage #gear-inventory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #build-stage .character-tabs button { padding: 8px; font-size: 12px; }
  .saved-inventory #build-stage .build-heading h1 { display: none; }
  .saved-inventory #build-stage .paper-doll-panel { width: max(145px, 44%); }
}
.in-battle .run-status { top: calc(148px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); gap: 10px; font-size: 10px; }
.in-battle .run-status b { font-size: 17px; }
.battle-xp { position: absolute; bottom: env(safe-area-inset-bottom, 0px); left: 0; right: 0; margin: 0; height: 5px; border-radius: 0; background: #15242ee8; }
.battle-xp span { display: none; }
.in-battle #notice { top: calc(178px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); max-width: min(400px, 50vw); font-size: 11px; pointer-events: none; }
@media (pointer: coarse), (max-height: 500px) {
  .in-battle .vitals { top: calc(10px + env(safe-area-inset-top)); width: 50px; }
  .player-avatar { width: 50px; height: 60px; }
  #hud-player-name { font-size: 12px; }
  #party.coop-portraits { top: calc(10px + env(safe-area-inset-top)); left: calc(80px + env(safe-area-inset-left)); }
  .in-battle .run-status { top: calc(136px + env(safe-area-inset-top)); }
  .in-battle #notice { top: calc(166px + env(safe-area-inset-top)); }
}
@media (pointer: coarse), (max-height: 500px) {
  .in-battle { --battle-map: 100px; }
  #game-hud .minimap-panel { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  .minimap-panel figcaption small { display: none; }
  #settings-toggle, .in-battle #fullscreen { top: calc(10px + env(safe-area-inset-top)); }
  .in-battle .brand small { display: none; }
}
@media (min-width: 650px) and (max-height: 500px) { .character-page .roster-empty { min-width: 210px; max-width: 280px; } }

/* Reserve the top center for run information; allies stay below the avatar. */
.in-battle .run-status { top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: 180px; display: grid; grid-template-columns: auto auto; justify-content: center; gap: 2px 10px; text-align: center; }
.in-battle .run-status #timer { grid-column: 1 / -1; font-size: 20px; }
.in-battle .run-status #world-phase { display: none; }
.in-battle .level-up-button { top: 0; left: calc(100% + 10px); }
.in-battle #party.coop-portraits { top: calc(96px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); }
.touch-actions #auto-battle-button { right: 174px; bottom: 80px; width: 48px; height: 48px; border-radius: 50%; background: #142c36ed; }
.touch-actions #auto-battle-button svg { display: block; margin: auto; }
.touch-actions #auto-battle-button[aria-pressed="true"] { color: #e3ffdb; border-color: #b2e9a4; background: #35613eea; box-shadow: 0 0 12px #a1f3b333; }
@media (pointer: coarse), (max-height: 500px) {
  .in-battle #party.coop-portraits { top: calc(82px + env(safe-area-inset-top)); }
}

.room-list-actions { display: flex; align-items: center; gap: 8px; }
.room-list-actions button { min-height: 44px; }
#refresh-rooms { width: 44px; padding: 0; font-size: 26px; }
#join-panel #new-room { width: auto; min-height: 44px; padding: 10px 16px; margin: 0; font-size: 14px; white-space: nowrap; }
.lobby-survivor { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.lobby-survivor .survivor-picker { flex: 1; min-height: 44px; }
#room-composer { position: relative; }
#room-composer h2 { grid-column: 1 / -1; margin: 0; font-size: 20px; }
#room-composer-close { position: absolute; top: 8px; right: 8px; width: 44px; padding: 0; font-size: 24px; }
#room-composer:not(.code-mode) label:has(#room-code), #room-composer.code-mode .room-listing, #room-composer.code-mode .room-listing + p { display: none; }

/* Room setup takes over the room chooser instead of appearing as a small card. */
#lobby-view { position: relative; }
#lobby-view:has(#room-composer:not([hidden])) .lobby-room-heading,
#lobby-view:has(#room-composer:not([hidden])) .lobby-survivor,
#lobby-view:has(#room-composer:not([hidden])) #lobby-build-status,
#lobby-view:has(#room-composer:not([hidden])) #room-list,
#lobby-view:has(#room-composer:not([hidden])) > .profile-note:last-child { display: none; }
#lobby-view:has(#room-composer:not([hidden])) { display: flex; flex-direction: column; }
#lobby-view #room-composer:not([hidden]) { position: relative; inset: auto; z-index: 1; display: grid; flex: 1 1 auto; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 20px; width: 100%; max-width: none; min-height: 0; box-sizing: border-box; margin: 0; padding: 18px 0; overflow: auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#lobby-view #room-composer:not([hidden]) h2 { padding-right: 0; font-size: 26px; }
#lobby-view #room-composer:not([hidden]) #room-composer-close { position: static; justify-self: start; order: 3; width: auto; min-height: 40px; padding: 8px 12px; font-size: 12px; }
#lobby-view #room-composer:not([hidden]) #join-button { width: 100%; min-height: 52px; }

@media (pointer: coarse), (max-width: 700px) {
  body:has(#join-panel:not([hidden])) .topbar { display: none; }
  #join-panel:not([hidden]) { position: fixed; inset: 0; transform: none; width: 100%; height: 100dvh; max-height: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display: flex; flex-direction: column; overflow: hidden; }
  #join-panel .manager-top { flex: 0 0 48px; min-height: 48px; padding: 0 10px; align-items: center; justify-content: stretch; }
  #join-panel .manager-top > .eyebrow { display: none; }
  #join-panel .manager-views { display: flex; flex: 1; gap: 4px; margin: 0; padding: 1px; }
  #join-panel .manager-views button { flex: 1; min-height: 44px; font-size: 14px; padding: 8px; }
  #characters-view:not(:has(#build-stage:not([hidden]))) { flex: 1; min-height: 0; display: block; overflow-y: auto; }
  #characters-view:not(:has(#build-stage:not([hidden]))) .roster-sidebar { padding: 16px 14px; border: 0; }
  #preparation-roster h2 { margin: 0; font-size: 18px; }
  #preparation-roster > .profile-note { margin: 6px 0; font-size: 12px; }
  #roster-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 0; gap: 10px; overflow: visible; }
  #roster-cards > button { min-width: 0; max-width: none; min-height: 104px; padding: 12px; }
  #roster-cards small { font-size: 12px; }
  #preparation-roster #profile-status { font-size: 11px; }
  #preparation-roster .profile-heading { display: inline-flex; margin: 0 0 0 8px; }
  .preparation-main:has(#name-stage[hidden]):has(#class-stage[hidden]):has(#build-stage[hidden]) { display: none; }
  #lobby-view, #account-view { flex: 1; min-height: 0; padding: 14px; overflow-y: auto; }
  #lobby-view { display: flex; flex-direction: column; overflow: hidden; position: relative; }
  #lobby-view .manager-page-head { flex: 0 0 auto; flex-direction: row; align-items: center; margin: 0 0 8px; padding: 0 0 8px; gap: 8px; }
  #lobby-view h1 { font-size: 22px; margin: 0; }
  #lobby-view .room-list-actions { gap: 6px; }
  #lobby-view .room-list-actions button { min-height: 44px; padding: 7px 10px; font-size: 12px; }
  #lobby-view #new-room { width: auto; font-size: 13px; padding: 8px 12px; }
  #lobby-view #refresh-rooms { font-size: 24px; padding: 0; }
  #lobby-build-status { flex: 0 0 auto; font-size: 12px; margin: 4px 0 8px; }
  #lobby-view .lobby-survivor { flex: 0 0 auto; margin: 0; }
  #lobby-view #lobby-character { min-height: 44px; padding: 8px 12px; margin: 0; font-size: 13px; }
  #lobby-view #room-list { flex: 1; min-height: 0; overflow-y: auto; align-content: start; overscroll-behavior: contain; }
  #lobby-view > .profile-note:last-child { flex: 0 0 auto; font-size: 11px; margin: 8px 0 0; }
  #lobby-view .room-card { flex-direction: row; align-items: center; padding: 12px; gap: 10px; }
  #lobby-view .room-card button { width: auto; flex-shrink: 0; min-height: 44px; padding: 8px 12px; }
  #lobby-view #room-composer:not([hidden]) { inset: auto; flex: 1 1 auto; grid-template-columns: 1fr 1fr; align-content: start; align-items: center; gap: 14px 8px; padding: 12px 0; min-height: 0; }
  #room-composer h2 { padding-right: 52px; min-height: 44px; }
  #room-composer > .profile-note, #room-composer .room-listing { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.4; }
  #room-composer .room-listing { display: flex; align-items: center; gap: 8px; }
  #room-composer .room-listing input { width: 24px; min-height: 24px; }
  #room-composer > label:has(#room-code), #room-composer #join-button { grid-column: 1 / -1; }
  #room-composer #join-button { padding: 10px; margin: 0; min-height: 48px; }
  #lobby-view #room-composer:not([hidden]) #room-composer-close { position: static; justify-self: start; order: 3; width: auto; min-height: 40px; padding: 6px 8px; font-size: 12px; }

  /* Inventory cells start at the top; one compact tool strip sits underneath. */
  .saved-inventory #build-stage .character-tabs { position: absolute; bottom: 0; right: 44px; z-index: 2; height: 44px; min-height: 44px; margin: 0; padding: 0; gap: 4px; }
  .saved-inventory #build-stage .character-tabs button { width: auto; height: 44px; min-height: 44px; padding: 8px 12px; font-size: 12px; }
  .saved-inventory #build-stage #inventory-close { top: auto; bottom: 0; height: 44px; }
  .saved-inventory #build-stage .inventory-panel { padding-bottom: 48px; }
  .saved-inventory #build-stage .inventory-heading { display: none; }
  .saved-inventory #build-stage .backpack-filters { position: absolute; bottom: 0; left: calc(max(210px, 40%) + 10px); right: 180px; height: 44px; margin: 0; background: none; align-items: center; gap: 4px; }
  .saved-inventory #build-stage .backpack-filters button { min-height: 44px; padding: 6px 10px; font-size: 12px; }
  .saved-inventory #build-stage [data-character-section="stats"], .saved-inventory #build-stage [data-character-section="rewards"] { padding: 12px 0 52px; }
  #build-stage .stats-title { margin: 0 0 10px; font-size: 20px; }
  #build-stage [data-character-section="stats"] .career-heading { margin: 0 0 10px; padding: 10px; }
  #build-stage [data-character-section="stats"] .career-heading small { font-size: 11px; margin: 4px 0; }
  #build-stage [data-character-section="stats"] .character-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  #build-stage #character-stats { order: -1; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
  #build-stage .stat-cell { min-height: 56px; padding: 8px 10px; }
  #build-stage .stat-cell span { font-size: 12px; }
  #build-stage .stat-cell b { font-size: 18px; }
  #build-stage [data-character-section="stats"] .character-editor { display: block; margin: 0; }
  #build-stage [data-character-section="stats"] .character-editor label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
  #build-stage [data-character-section="stats"] .character-editor select { min-height: 44px; height: 44px; padding: 6px; font-size: 14px; }
  #build-stage [data-character-section="stats"] .profile-note { margin: 0; font-size: 12px; line-height: 1.5; }
}
@media (max-width: 480px) {
  #roster-cards { grid-template-columns: 1fr; }
  .saved-inventory #build-stage .inventory-panel { padding-bottom: 94px; }
  .saved-inventory #build-stage .backpack-filters { left: calc(max(145px, 44%) + 6px); right: 0; bottom: 46px; }
  #build-stage #character-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (pointer: coarse), (max-width: 700px) {
  #join-panel.saved-inventory:has(#characters-view:not([hidden]) #build-stage:not([hidden])) { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .saved-inventory #build-stage { position: relative; padding-top: 48px; }
  .saved-inventory #build-stage::before { content: ''; position: absolute; inset: 0 0 auto; height: 48px; background: #10232d; border-bottom: 1px solid #4d737666; pointer-events: none; }
  .saved-inventory #build-stage .paper-doll-panel { top: 48px; height: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
  .saved-inventory #build-stage .inventory-panel { padding: 0; }
  .saved-inventory #build-stage .backpack-filters { position: static; inset: auto; flex: 0 0 48px; height: 48px; margin: 0; background: none; }
  .saved-inventory #build-stage .character-tabs { top: 0; bottom: auto; left: 6px; right: 44px; height: 48px; justify-content: flex-start; }
  .saved-inventory #build-stage #inventory-close { top: 2px; bottom: auto; }
  .saved-inventory #build-stage [data-character-section="stats"], .saved-inventory #build-stage [data-character-section="rewards"] { padding: 10px; }
}

#inspection-home { display: none; }
#inventory-error:empty { display: none; }
#inventory-error { color: #ffb1a6; font-size: 12px; }
#boss-hunt { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); width: min(250px, 44vw); padding: 7px 10px; border: 1px solid #c67b42aa; border-radius: 5px; background: #201913dd; color: #ffcf8b; text-align: center; pointer-events: none; }
#boss-hunt b { display: block; font-size: 10px; letter-spacing: .04em; }
#boss-hunt small { display: block; font-size: 9px; margin-top: 4px; color: #d7bfa1; }
.boss-health { display: block; height: 5px; background: #100d0b; margin-top: 6px; }
.boss-health i { display: block; height: 100%; background: #ee8c42; transition: width .15s; }

/* Upgrade choices always sit above battle notices, trackers and controls. */
.in-battle #upgrade-panel { z-index: 10; background: #10252d; }
.in-battle #down-panel, .in-battle #wipe-panel { z-index: 11; }
#lobby-build-status[data-ready="true"] { display: none; }
@media (pointer: coarse), (max-width: 700px) {
  #boss-hunt { top: 62px; width: min(190px, 35vw); padding: 4px 7px; }
  #boss-hunt b { font-size: 9px; }
  #boss-hunt small { display: none; }
  #boss-hunt .boss-health { height: 3px; margin-top: 4px; }
  #lobby-view { padding: 10px 14px; }
  #lobby-view .manager-page-head { margin-bottom: 4px; padding-bottom: 4px; }
  #lobby-view > .profile-note:last-child { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
  #lobby-view .room-card { padding: 7px 10px; }
}
@media (pointer: coarse), (max-width: 700px) {
  #lobby-view { gap: 6px; }
  #lobby-view .manager-page-head { min-height: 44px; border: 0; margin: 0; padding: 0; gap: 12px; }
  #lobby-view .lobby-survivor { min-width: 0; }
  #lobby-view #lobby-character { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Preparation is one workspace, with a dock rather than a floating item window. */
body:has(#join-panel:not([hidden])) .topbar { display: none; }
.item-detail-placeholder { padding: 20px; margin: 0; color: #8ba9b0; font-size: 13px; line-height: 1.6; }
.item-detail-dock:has(dialog[open]) .item-detail-placeholder { display: none; }
@media (pointer: fine) and (min-width: 701px) {
  #join-panel.character-page { padding: 16px 24px; }
  #join-panel .manager-top { align-items: center; padding: 0 0 12px; }
  #join-panel .manager-top > .eyebrow { font-size: 11px; }
  #join-panel .manager-layout { grid-template-columns: 170px minmax(0, 1fr); min-height: 0; }
  #join-panel .roster-sidebar { padding: 18px 12px 0 0; }
  #join-panel .roster-sidebar h2 { font-size: 16px; }
  #join-panel .roster-sidebar > .profile-note { display: none; }
  #join-panel .roster-cards { margin: 12px 0; }
  #join-panel .roster-card { padding: 10px; gap: 8px; }
  #join-panel .preparation-main { padding: 16px 0 0 18px; }
  .saved-inventory #build-stage .build-heading .eyebrow, .saved-inventory #build-stage > .build-explainer { display: none; }
  .saved-inventory #build-stage .build-heading h1 { font-size: 24px; }
  .saved-inventory #build-stage .build-heading .intro { margin: 5px 0; }
  .saved-inventory #build-stage .character-overview { grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); grid-template-areas: 'paper inventory'; gap: 16px; }
  .saved-inventory #build-stage .character-overview:has(#mobile-item-dialog[open]) { grid-template-areas: 'details inventory'; }
  .saved-inventory #build-stage .character-overview:has(#mobile-item-dialog[open]) > .paper-doll-panel { display: none; }
  .saved-inventory .item-detail-dock { grid-area: details; min-width: 0; border: 1px solid #49616b; background: #10232a; border-radius: 10px; max-height: calc(100dvh - 245px); overflow-y: auto; }
  .saved-inventory #build-stage .paper-doll-panel { grid-template-columns: 64px minmax(0, 1fr) 64px; padding: 6px; gap: 5px; }
  .saved-inventory #build-stage .gear-slot { min-height: 66px; }
  .saved-inventory #build-stage .paper-doll-hint { font-size: 9px; }
  .saved-inventory #build-stage #gear-inventory { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); grid-auto-rows: 58px; max-height: calc(100dvh - 245px); overflow-y: auto; align-content: start; }
  .saved-inventory #build-stage .backpack-cell { min-height: 0; }
  .saved-inventory #build-stage .inventory-panel > .profile-note:last-child { display: none; }
  #join-panel #mobile-item-dialog { position: static; inset: auto; width: 100%; max-width: none; max-height: none; height: auto; margin: 0; padding: 12px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; overflow: visible; }
  #join-panel #mobile-item-dialog::backdrop { background: none; backdrop-filter: none; }
  #join-panel #mobile-item-dialog .choice-heading { gap: 8px; align-items: center; }
  #join-panel #mobile-item-dialog .choice-heading h2 { font-size: 16px; }
  #join-panel #mobile-item-dialog .choice-heading button { font-size: 11px; padding: 6px 8px; min-height: 36px; }
  #join-panel #mobile-item-dialog .item-card { padding: 10px; border: 0; background: none; }
  #join-panel #mobile-item-dialog .item-card header b { font-size: 16px; }
  #join-panel #mobile-item-dialog .item-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #join-panel #mobile-item-dialog .item-actions button { padding: 7px; font-size: 11px; }
}
@media (pointer: coarse), (max-width: 700px) {
  #join-panel.saved-inventory:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-top { display: none; }
  #join-panel .manager-views button { min-height: 44px; font-size: 12px; }
  .item-detail-dock { display: contents; }
  .item-detail-placeholder { display: none; }
  #join-panel #mobile-item-dialog { position: absolute; inset: 48px auto 0 0; height: calc(100% - 48px); max-height: none; width: max(210px, 40%); max-width: none; box-shadow: none; border: 0; border-right: 1px solid #54757c; }
  #build-stage:has(#mobile-item-dialog[open]) .paper-doll-panel { visibility: hidden; }
}
#portrait { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; padding: 30px; color: #e4f3ed; background: radial-gradient(ellipse, #24464c, #0b1821 75%); box-sizing: border-box; }
#portrait[open] { display: grid; place-content: center; justify-items: center; gap: 16px; }
#portrait:not([open]) { display: none; }
#portrait .rotate-symbol { font-size: 68px; color: #8fe0c5; }
#portrait h2 { font-size: 26px; margin: 0; }
#portrait p, #portrait small { max-width: 320px; font-size: 14px; line-height: 1.5; margin: 0; }
#portrait button { padding: 14px 18px; font-size: 14px; }
.character-page:not(.saved-inventory) .item-detail-dock { display: none; }
#join-panel.saved-inventory:has(#characters-view:not([hidden]) #build-stage:not([hidden])) .manager-top { display: none; }
@media (pointer: fine) and (min-width: 701px) {
  .saved-inventory #build-stage { position: relative; }
  .saved-inventory #build-stage #inventory-close { display: block; position: absolute; top: 0; left: 0; z-index: 3; width: auto; min-height: 44px; padding: 8px 12px; font-size: 13px; white-space: nowrap; }
  .saved-inventory #build-stage .character-tabs { position: absolute; top: 0; right: 0; z-index: 2; min-height: 44px; margin: 0; padding: 0; justify-content: flex-end; align-items: center; }
  .saved-inventory #build-stage .character-tabs button { min-height: 44px; padding: 8px 12px; }
  .saved-inventory #build-stage .build-heading { min-height: 44px; }
}

/* Saved equipment header: selection/back on the left, equipment controls on the right. */
@media (pointer: coarse), (max-width: 700px) {
  .saved-inventory #build-stage { padding-top: 48px; }
  .saved-inventory #build-stage #inventory-close { display: block; position: absolute; top: 2px; left: 0; right: auto; bottom: auto; z-index: 3; width: auto; height: 44px; min-height: 44px; padding: 6px 8px; font-size: 12px; white-space: nowrap; }
  .saved-inventory #build-stage .character-tabs { position: absolute; top: 0; left: auto; right: 0; bottom: auto; width: auto; height: 48px; min-height: 48px; margin: 0; padding: 0; justify-content: flex-end; align-items: center; }
  .saved-inventory #build-stage .character-tabs button { width: auto; height: 42px; min-height: 42px; padding: 6px 9px; font-size: 11px; }
  .saved-inventory #build-stage .character-tabs #mobile-roster-toggle { display: none; }
}
.touch-actions { width: 250px; height: 210px; margin-right: 4px; }
.touch-actions button { border-radius: 50%; backdrop-filter: blur(3px); box-shadow: 0 3px 12px #0008, inset 0 1px #ffffff26; }
.touch-actions #primary-button { right: 0; bottom: 0; width: 82px; height: 82px; border: 2px solid #d6e8dc; background: #52776ddf; font-size: 11px; font-weight: 700; }
.touch-actions #special-button { right: 97px; bottom: 86px; width: 66px; height: 66px; }
.touch-actions #skill-button-2 { right: 164px; bottom: 17px; width: 58px; height: 58px; }
.touch-actions #skill-button-3 { right: 157px; bottom: 105px; width: 58px; height: 58px; }
.touch-actions #revive-button { right: 94px; bottom: 4px; width: 52px; height: 52px; }
.touch-actions #auto-battle-button { position: fixed; top: calc(62px + env(safe-area-inset-top)); right: calc(var(--battle-map, 100px) + 24px + env(safe-area-inset-right)); bottom: auto; width: 44px; height: 44px; padding: 0; border-radius: 7px; background: #142c36ed; }
.touch-actions #auto-battle-button[aria-pressed="true"] { color: #e3ffdb; border-color: #b2e9a4; background: #35613eea; box-shadow: 0 0 12px #a1f3b333; }
.touch-actions #auto-battle-button svg { display: block; margin: auto; }
@media (pointer: fine) {
  #touch-controls { display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
  #touch-controls .stick, #touch-controls .touch-actions button:not(#auto-battle-button) { display: none; }
  #touch-controls .touch-actions { position: static; width: 0; height: 0; margin: 0; }
  #touch-controls #auto-battle-button { display: block; }
}
@media (max-width: 480px) {
  .touch-actions { transform: scale(.88); transform-origin: bottom right; margin-right: -4px; }
}
button, button *, #move-stick, #move-stick *, .touch-actions, .touch-actions * { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
@media (pointer: fine) and (min-width: 701px) and (max-width: 1050px) {
  .saved-inventory #build-stage .character-overview { grid-template-columns: minmax(220px, 45%) minmax(0, 1fr); grid-template-areas: 'paper inventory'; }
  .saved-inventory #build-stage .character-overview:has(#mobile-item-dialog[open]) { grid-template-areas: 'details inventory'; }
  .saved-inventory .item-detail-dock { max-height: none; }
}

/* Diablo-style action cluster: a large primary with skills hugging it on an arc
   from 9 to 12 o'clock. Icons take --skill-color; --cooldown (0..1) drives the sweep. */
.touch-actions { width: 250px; height: 210px; }
.touch-actions button.touch-skill, .touch-actions #primary-button { display: grid; place-items: center; align-content: center; gap: 1px; padding: 0; overflow: visible; color: var(--skill-color, #e0faf0); border: 2px solid color-mix(in srgb, var(--skill-color, #98c4c5) 70%, #0b1418); background: radial-gradient(circle at 50% 38%, #2b4650f2, #0e1b21f5 68%); box-shadow: 0 4px 14px #000a, inset 0 0 14px color-mix(in srgb, var(--skill-color, #98c4c5) 28%, transparent), inset 0 1px #ffffff2e; }
.touch-actions #primary-button { right: 0; bottom: 0; width: 100px; height: 100px; border-width: 3px; background: radial-gradient(circle at 50% 36%, #375a60f5, #0f1f25f7 70%); }
.touch-actions #special-button { right: 111px; bottom: 19px; width: 62px; height: 62px; }
.touch-actions #skill-button-2 { right: 84px; bottom: 84px; width: 62px; height: 62px; }
.touch-actions #skill-button-3 { right: 19px; bottom: 111px; width: 62px; height: 62px; }
.touch-actions #revive-button { right: 178px; bottom: 6px; width: 52px; height: 52px; }
.touch-actions .skill-glyph { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 60%, transparent)); position: relative; z-index: 1; }
.touch-actions #primary-button .skill-glyph { width: 42px; height: 42px; stroke-width: 1.6; }
.touch-actions .skill-label { max-width: 54px; color: #e6f3ee; font-size: 8px; font-weight: 600; line-height: 1.05; text-align: center; text-shadow: 0 1px 2px #000; position: relative; z-index: 1; }
.touch-actions #primary-button .skill-label { display: none; }
.touch-actions button.touch-skill::before, .touch-actions #primary-button::before, .skillbar .skill::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2; background: conic-gradient(#050c10d0 calc(var(--cooldown, 0) * 360deg), transparent 0); }
.touch-actions .skill-timer, .skillbar .skill-timer { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; color: #fff; font-size: 19px; font-weight: 800; text-shadow: 0 0 4px #000, 0 1px 2px #000; pointer-events: none; }
.touch-actions button.cooling .skill-glyph, .skillbar .skill.cooling .skill-glyph { opacity: .45; filter: grayscale(.6); }
.touch-actions button.cooling .skill-label { visibility: hidden; }
.touch-actions button.touch-skill:not(.cooling):active, .touch-actions #primary-button:active { transform: scale(.94); }
.touch-actions button.touch-skill:not(.cooling) { animation: skill-ready .5s ease-out; }
@keyframes skill-ready { from { box-shadow: 0 0 0 6px color-mix(in srgb, var(--skill-color, #fff) 45%, transparent), 0 4px 14px #000a; } }

/* Desktop: compact icon slots with key badges and the same cooldown sweep. */
@media (pointer: fine) {
  .skillbar { gap: 10px; align-items: end; bottom: calc(22px + env(safe-area-inset-bottom)); }
  .skillbar .skill { position: relative; width: 62px; height: 62px; padding: 0; display: grid; place-items: center; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--skill-color, #607c7c) 65%, #0b1418); background: radial-gradient(circle at 50% 36%, #2b4650f0, #0e1b21f2 70%); box-shadow: 0 4px 14px #0009, inset 0 0 12px color-mix(in srgb, var(--skill-color, #607c7c) 25%, transparent); color: var(--skill-color, #cfe7df); }
  .skillbar .skill:first-child { width: 76px; height: 76px; border-radius: 50%; border-width: 3px; }
  .skillbar .skill.empty { opacity: .45; border-style: dashed; }
  .skillbar .skill kbd { position: absolute; top: -8px; left: -6px; z-index: 4; padding: 1px 5px; font-size: 9px; border-radius: 4px; background: #0b1519; border: 1px solid #5e7b7b; color: #dcebe6; }
  .skillbar .skill:first-child kbd { left: 4px; top: -6px; }
  .skillbar .skill > span:not(.skill-label) { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 90px; text-align: center; font-size: 9.5px; color: #c8dbd5; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .skillbar .skill small, .skillbar .skill .skill-label { display: none; }
  .skillbar .skill-glyph { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 60%, transparent)); position: relative; z-index: 1; }
  .skillbar .skill:first-child .skill-glyph { width: 38px; height: 38px; }
  .skillbar { padding-bottom: 14px; }
}

/* Run-only rune swapping: button under the fullscreen toggle, panel on top of the battle. */
#rune-button { position: absolute; right: calc(var(--battle-map, 150px) + 76px + env(safe-area-inset-right)); top: calc(62px + env(safe-area-inset-top)); width: 44px; height: 44px; padding: 0; display: grid; place-items: center; color: #c9b8ff; background: #10262de8; border: 1px solid #718f8e; border-radius: 7px; z-index: 4; }
#rune-button[aria-expanded="true"] { color: #f0e8ff; border-color: #b7a0ff; background: #2a2650ee; box-shadow: 0 0 12px #8f78ff44; }
#rune-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; filter: drop-shadow(0 0 4px #8f78ff88); }
.rune-panel { position: absolute; z-index: 10; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(600px, calc(100% - 24px)); max-height: calc(100dvh - 150px); display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); grid-template-areas: 'head head' 'slots pick' 'note note'; gap: 10px 14px; padding: 14px 16px; background: #10252df5; border: 1px solid #79a29288; border-radius: 8px; box-shadow: 0 15px 50px #000a; overflow: hidden; }
.rune-panel[hidden] { display: none; }
.rune-head { grid-area: head; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rune-head h2 { margin: 0; font-size: 20px; } .rune-head .eyebrow { margin: 0 0 3px; }
#rune-close { min-height: 44px; min-width: 76px; }
.rune-slots { grid-area: slots; display: flex; flex-direction: column; gap: 8px; }
.rune-slot { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; text-align: left; color: #dcebe6; background: #142b34; border: 1px solid #48636e; border-radius: 8px; }
.rune-slot.selected { border-color: #b7a0ff; background: #232a4d; box-shadow: inset 0 0 0 1px #b7a0ff66; }
.rune-slot-icon, .rune-card-icon { position: relative; flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--skill-color, #9cb); background: radial-gradient(circle at 50% 36%, #2b4650f2, #0e1b21f5 70%); border: 2px solid color-mix(in srgb, var(--skill-color, #6c8580) 65%, #0b1418); }
.rune-slot-icon .skill-glyph, .rune-card-icon .skill-glyph { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; position: relative; z-index: 1; }
.rune-slot-icon::before, .rune-card-icon::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: conic-gradient(#050c10d0 calc(var(--cooldown, 0) * 360deg), transparent 0); z-index: 2; pointer-events: none; }
.rune-slot-icon .skill-timer, .rune-card-icon .skill-timer, .rune-slot-icon .skill-label, .rune-card-icon .skill-label { display: none; }
.rune-slot-text, .rune-card-text { display: flex; flex-direction: column; min-width: 0; }
.rune-slot-text b, .rune-card-text b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rune-slot-text small, .rune-card-text small { font-size: 11px; color: #9fb7b4; }
.rune-pick { grid-area: pick; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding-right: 2px; }
.rune-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
#rune-panel .rune-card { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; text-align: left; color: #dcebe6; background: #142b34; border: 2px solid color-mix(in srgb, var(--rarity, #d5dde1) 55%, #20323a); border-radius: 8px; }
#rune-panel .rune-card:hover, #rune-panel .rune-card:focus-visible { background: #1d3943; }
#rune-panel .rune-card.equipped { background: #1b3a35; }
.rune-clear { justify-content: center; color: #a9bcbc; border-style: dashed; border-color: #48636e; }
.rune-note { grid-area: note; color: #98b0b0; font-size: 10.5px; line-height: 1.5; }
#rune-empty { margin: 4px 0; }
/* Landscape phones: slots beside the list, no helper text, panel clear of the thumbs' controls. */
@media (pointer: coarse), (max-height: 520px) {
  .rune-panel { top: calc(8px + env(safe-area-inset-top)); width: min(620px, calc(100% - 200px)); max-height: calc(100dvh - 16px); padding: 10px 12px; grid-template-columns: 138px minmax(0, 1fr); gap: 8px 10px; }
  .rune-head h2 { font-size: 17px; }
  .rune-note { display: none; }
  .rune-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .rune-slot, #rune-panel .rune-card { min-height: 46px; }
}

/* Rank-up and Runes share one anchor so they always open in the same place:
   centred, below the top row on desktop, tucked right up to the top on phones
   and narrowed to clear the avatar/Rank-up button (left) and the map/buttons (right). */
:root { --battle-panel-top: calc(64px + env(safe-area-inset-top)); --battle-panel-width: min(600px, calc(100% - 24px)); }
@media (pointer: coarse), (max-height: 520px) {
  :root { --battle-panel-top: calc(6px + env(safe-area-inset-top)); --battle-panel-width: clamp(320px, calc(100% - 440px), 620px); }
}
.in-battle .rune-panel, .in-battle .upgrade-panel { top: var(--battle-panel-top); left: 50%; transform: translateX(-50%); width: var(--battle-panel-width); max-height: calc(100dvh - var(--battle-panel-top) - 10px); box-sizing: border-box; }

/* Special (XP pull) slot: a fourth, smaller button on the touch arc and a fifth card on desktop. */
.touch-actions #pull-button { position: absolute; right: 176px; bottom: 70px; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; border-radius: 50%; color: var(--skill-color, #c7b6ff); border: 2px solid color-mix(in srgb, var(--skill-color, #98c4c5) 70%, #0b1418); background: radial-gradient(circle at 50% 38%, #2b4650f2, #0e1b21f5 68%); box-shadow: 0 4px 14px #000a, inset 0 0 14px color-mix(in srgb, var(--skill-color, #98c4c5) 28%, transparent); pointer-events: auto; touch-action: none; overflow: visible; }
.touch-actions #pull-button[hidden] { display: none; }
.touch-actions #pull-button .skill-glyph { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; position: relative; z-index: 1; filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 60%, transparent)); }
.touch-actions #pull-button::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2; background: conic-gradient(#050c10d0 calc(var(--cooldown, 0) * 360deg), transparent 0); }
.touch-actions #pull-button .skill-label { display: none; }
.touch-actions #pull-button .skill-timer { font-size: 15px; }
.touch-actions #pull-button:not(.cooling) { animation: skill-ready .5s ease-out; box-shadow: 0 0 16px color-mix(in srgb, var(--skill-color, #fff) 45%, transparent), 0 4px 14px #000a; }
@media (pointer: fine) {
  .touch-actions #pull-button { display: none; }
  .skillbar .special-skill { width: 62px; height: 62px; }
  .skillbar .special-skill[hidden] { display: none; }
}
