/* The Bosses hall: Dungeon lobby structure (dungeon-lobby.css) with its own
   arena theme — crimson banners and iron plates over the same native stonework. */
.drawer.bosses-drawer { width: min(calc(1180px + var(--ui-nav-rail-size)), 100%); }
.drawer.bosses-drawer .drawer-panel {
  display: flex; flex-direction: column; min-height: 0; height: 100%;
  padding: 12px 16px 18px; overflow: hidden; backdrop-filter: none;
  background: #130d12;
  background-image: radial-gradient(ellipse at 50% 18%, #6b1f2c55 0, #130d1200 55%),
    radial-gradient(ellipse at 50% 40%, #130d1200 20%, #0b0a10e0 100%),
    linear-gradient(#130d12d9, #0b0a10ec), url("/data/dungeon-loot/stone-rubble-256.png");
  background-size: auto, auto, auto, 512px 512px;
  image-rendering: pixelated;
}
.bosses-drawer .drawer-head { position: relative; flex: none; height: 0; margin: 0; padding: 0; border: 0; box-shadow: none; }
.bosses-drawer .drawer-head :is(h2, #drawer-kicker) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.bosses-drawer #drawer-close {
  position: absolute; top: 4px; right: 0; z-index: 8; width: 44px; height: 44px;
  border: 2px solid #6d4652; border-radius: 0; background: #2a1820;
  box-shadow: inset 2px 2px 0 #4a2a35, 3px 3px 0 #060b13;
}
#drawer.bosses-drawer #drawer-content { display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }

.boss-hall { --boss-crimson: #c23a4c; --boss-crimson-light: #f3a0a8; --boss-crimson-dark: #6b1f2c; --boss-iron: #8a95a3; --boss-iron-dark: #3a414c; --boss-gold: #e9bd62;
  display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; gap: 10px; font-family: var(--ui-font-body); color: #ece4d4; }
.boss-hall-toolbar { flex: none; padding: 0 56px 0 0; }
.boss-hall-brand { display: flex; align-items: center; gap: 12px; min-height: 86px; }
.boss-hall-mark { flex: none; }
.boss-hall-brand > div:not(.boss-hall-access) > small { display: block; color: #d8a7ae; font: 600 10px/1.4 var(--ui-font-body); letter-spacing: 1.6px; text-transform: uppercase; }
.boss-hall-brand > div:not(.boss-hall-access) > strong { display: block; color: #f6e2c2; text-shadow: 3px 3px 0 #060b13; font: 400 50px/1 var(--ui-font-display); }
.boss-hall-access { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-left: auto; }
.boss-hall-access > span { display: flex; align-items: center; gap: 5px; color: #d1c3c6; font: 500 12px/1.3 var(--ui-font-body); }

/* One shared resource strip: token stock, guaranteed prize and the rule book. */
.boss-hall-resources {
  display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 52px; padding: 6px 10px;
  border-top: 4px solid var(--boss-crimson-dark); box-shadow: 0 -3px 0 #060b13, inset 0 -3px 0 #08060a;
  background: #1c1219;
}
.boss-token-balance { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 10px 4px 6px; border: 2px solid #8a5a3a; background: #2c1d16; box-shadow: inset 2px 2px 0 #ffffff12, 2px 2px 0 #060b13; }
.boss-token-name { display: grid; gap: 1px; color: #f1c998; font: 400 21px/1 var(--ui-font-display); }
.boss-token-name small { color: #c9b9a8; font: 500 10px/1.25 var(--ui-font-body); }
.boss-token-stock { margin-left: 6px; color: #ffe0b0; font: 400 30px/1 var(--ui-font-display); text-shadow: 2px 2px 0 #060b13; }
.boss-guaranteed { display: flex; align-items: center; gap: 6px; color: #e7d9c0; font: 400 20px/1 var(--ui-font-display); }
.boss-rules { flex: none; margin: 0 0 0 auto; color: #c9bcc0; font: 400 11px/1.45 var(--ui-font-body); }
.boss-rules summary { display: flex; align-items: center; gap: 5px; width: fit-content; min-height: 32px; margin-left: auto; color: var(--boss-crimson-light); cursor: pointer; list-style: none; }
.boss-rules summary::-webkit-details-marker { display: none; }
.boss-rules summary::after { content: "+"; font: 400 18px/1 var(--ui-font-display); }
.boss-rules[open] summary::after { content: "−"; }
.boss-rules[open] { flex-basis: 100%; order: 3; max-height: 180px; overflow-y: auto; }
.boss-rules p { margin: 4px 0 8px; max-width: 900px; }

/* Pending prize and current arena are explicit, separate calls to action. */
.boss-callout { display: flex; flex: none; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--boss-gold); border-left-width: 6px; background: linear-gradient(90deg, #3a2a14, #1c1219 80%); box-shadow: 3px 3px 0 #060b13; }
.boss-callout[data-boss-callout="arena"] { border-color: var(--boss-iron); background: linear-gradient(90deg, #232a35, #1c1219 80%); }
.boss-callout > div { display: grid; gap: 3px; min-width: 0; flex: 1; }
.boss-callout strong { color: #ffe5a0; font: 400 26px/1 var(--ui-font-display); text-shadow: 2px 2px 0 #060b13; }
.boss-callout[data-boss-callout="arena"] strong { color: #e6edf3; }
.boss-callout small { color: #d9ccbd; font: 500 11px/1.35 var(--ui-font-body); }
.boss-choice-types { display: flex; gap: 4px; }
.boss-callout .ui-button { flex: none; min-height: 44px; font: 400 21px/1 var(--ui-font-display); }

/* Tier columns, like the Dungeon categories: a metal banner per tier and its
   arenas listed beneath; a tier without released arenas reads "coming soon". */
.boss-tier-grid { display: grid; flex: 1; min-height: 0; grid-template-columns: repeat(var(--boss-tier-columns, 2), minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 12px; }
.boss-tier-grid[data-boss-tier-count="1"] { --boss-tier-columns: 1; }
.boss-tier-grid[data-boss-tier-count="3"] { --boss-tier-columns: 3; }
.boss-tier {
  --tier-metal: #c9945e; --tier-light: #f1c998; --tier-dark: #6a442e; --tier-surface: #30271f;
  --tier-banner: url("/data/dungeon-banners/bronze-512x128.png");
  display: flex; flex-direction: column; align-self: start; min-height: 0; max-height: 100%; padding: 8px; background: #24303f;
  clip-path: polygon(0 12px, 12px 12px, 12px 0, calc(100% - 12px) 0, calc(100% - 12px) 12px, 100% 12px, 100% 100%, 0 100%);
  box-shadow: inset 3px 0 0 #46566a, inset -3px 0 0 #080e18, inset 0 -4px 0 #080e18;
}
.boss-tier[data-boss-tier="silver"] { --tier-metal: #b9cbd5; --tier-light: #edf3f4; --tier-dark: #536c7d; --tier-surface: #253543; --tier-banner: url("/data/dungeon-banners/silver-512x128.png"); }
.boss-tier[data-boss-tier="gold"] { --tier-metal: #e9bd62; --tier-light: #ffe5a0; --tier-dark: #786033; --tier-surface: #342d20; --tier-banner: url("/data/dungeon-banners/gold-512x128.png"); }
.boss-tier-head {
  position: relative; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; height: 72px; padding: 10px 14px;
  border: 3px solid #080e18; background-color: var(--tier-surface);
  background-image: linear-gradient(90deg, #060b1388, #060b1322 55%, #060b1366), var(--tier-banner);
  background-position: center; background-size: cover; image-rendering: pixelated;
  box-shadow: inset 0 3px 0 #ffffff18, 0 3px 0 var(--tier-dark);
}
.boss-tier-head::after { content: ""; position: absolute; top: 0; left: 8px; right: 8px; height: 3px; background: var(--tier-metal); opacity: .65; }
.boss-tier-head h3 { margin: 0; color: var(--tier-light); text-shadow: 2px 2px 0 #060b13; font: 400 36px/.95 var(--ui-font-display); }
.boss-tier-head small { color: #c9d2db; font: 500 10px/1.2 var(--ui-font-body); }
.boss-tier-status { padding: 4px 8px; border: 1px solid var(--tier-dark); background: #060b13e8; color: var(--tier-light); font: 400 20px/1 var(--ui-font-display); white-space: nowrap; }

/* Arena sheets: native panorama banner, identity, rewards and the entry action. */
.boss-arena-grid {
  display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content; align-content: start; gap: 4px; padding: 6px 4px 6px; overflow-y: auto; overscroll-behavior: contain;
  background: #111b29; scrollbar-color: var(--tier-dark) #060b13; scrollbar-width: thin;
}
.boss-sheet {
  position: relative; display: grid; min-width: 0; border: 1px solid #364459; border-left: 3px solid var(--boss-type); background: #152130;
  background-image: linear-gradient(90deg, #152130 0, #152130e6 38%, #152130b3 100%), var(--boss-panorama);
  background-size: auto, cover; background-position: center, right center; image-rendering: pixelated; box-shadow: 0 2px 0 #060b13;
}
.boss-sheet-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 64px; padding: 7px 8px 7px 7px; }
.boss-sheet-portrait { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #080e18; background: #060b13b8; box-shadow: inset 0 0 0 1px #b9cbd522; }
.boss-sheet-portrait img { width: 48px; height: 48px; image-rendering: pixelated; }
.boss-sheet-detail { display: grid; gap: 3px; min-width: 0; }
.boss-sheet-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.boss-sheet-heading h3 { margin: 0; color: #e9e9df; font: 400 23px/1 var(--ui-font-display); text-shadow: 2px 2px 0 #060b13; overflow-wrap: anywhere; }
.boss-sheet-level { color: #fff1d2; font: 400 18px/1 var(--ui-font-display); }
.boss-sheet-cost { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; color: #f1c58d; font: 700 11px/1 var(--ui-font-body); }
.boss-sheet-cost .boss-cost-art { width: 16px; height: 16px; image-rendering: pixelated; }
.boss-sheet-arena { margin: 0; color: #a0b4c7; font: 400 10px/1.2 var(--ui-font-body); }
.boss-sheet-arena [data-boss-access="locked"] { color: var(--ui-color-danger, #ff7b7b); font-weight: 700; }
.boss-sheet-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.boss-sheet-tags .type-badges { gap: 4px; }
.boss-sheet-rewards { display: flex; flex-wrap: wrap; gap: 4px; }
.boss-reward-slot {
  display: inline-flex; align-items: center; gap: 3px; min-height: 22px; padding: 0 5px 0 1px; box-sizing: border-box;
  border: 1px solid var(--loot-color, #6f8297); background: var(--loot-surface, #182737);
}
.boss-reward-slot .ui-pixel-icon, .boss-reward-slot .boss-art { flex: none; width: 20px !important; height: 20px !important; }
.boss-reward-slot .boss-art img, .boss-reward-slot .ui-pixel-icon img { width: 20px; height: 20px; }
.boss-reward-slot strong { color: #f2e5c7; font: 400 15px/1 var(--ui-font-display); }
.boss-reward-slot small { color: #c9e0e9; font: 600 9px/1 var(--ui-font-body); white-space: nowrap; }
.boss-sheet-status { margin: 0; padding: 3px 8px 6px; border-top: 1px solid #364459; color: #b9c5d0; font: 500 10px/1.3 var(--ui-font-body); }
.boss-sheet-status[data-boss-status="level"], .boss-sheet-status[data-boss-status="token"] { color: var(--ui-color-danger, #ff7b7b); }
.boss-sheet-status[data-boss-status="pending"] { color: var(--boss-gold); }
.boss-sheet-status[data-boss-status="here"] { color: #9de2ad; }
.boss-sheet-status[data-boss-status="soon"] { color: #e9d8a8; }
.boss-sheet .boss-enter { min-width: 76px; min-height: 44px; padding: 5px 10px; font: 400 21px/1 var(--ui-font-display); }
.boss-sheet[data-boss-entry="soon"] { filter: saturate(.75); }
.boss-sheet[data-boss-entry="soon"] .boss-sheet-portrait img { filter: brightness(.35) contrast(1.2); }
.boss-sheet[data-boss-entry="level"] { filter: saturate(.7); }
.boss-sheet[data-boss-entry="here"] { border-color: #9de2ad; }
.bosses-drawer :is(button, summary):focus-visible { outline: 2px solid var(--ui-color-focus); outline-offset: -3px; }

@media (max-width: 759px), (max-height: 500px) {
  .drawer.bosses-drawer .drawer-panel { padding: 6px 10px 12px; }
  #drawer.bosses-drawer #drawer-content { display: block; overflow-y: auto; }
  .boss-hall { display: block; }
  .boss-hall > * + * { margin-top: 10px; }
  .boss-hall-toolbar { padding: 0; }
  .boss-hall-brand { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 5px; min-height: 82px; padding-right: 44px; }
  .boss-hall-brand > .boss-hall-mark { grid-column: 1; grid-row: 1 / 3; }
  .boss-hall-brand > div:not(.boss-hall-access) { grid-column: 2; grid-row: 1; align-self: end; }
  .boss-hall-brand > div:not(.boss-hall-access) > small { font-size: 8px; letter-spacing: .7px; }
  .boss-hall-brand > div:not(.boss-hall-access) > strong { font-size: 40px; }
  .boss-hall-access { grid-column: 2; grid-row: 2; gap: 2px 8px; margin: 0; }
  .boss-hall-access > span { gap: 2px; font-size: 10px; }
  .boss-hall-access .ui-pixel-icon { display: none; }
  .boss-rules { margin-left: 0; }
  .boss-rules summary { min-height: 44px; margin-left: 0; }
  .boss-tier-grid { display: flex; flex-direction: column; }
  .boss-tier { max-height: none; align-self: stretch; }
  .boss-arena-grid { overflow: visible; padding-inline: 0; }
  .boss-callout { flex-wrap: wrap; }
  .boss-callout .ui-button { flex: 1 1 100%; }
  .boss-sheet .boss-enter { min-height: 44px; }
}
}
@media (max-width: 399px) {
  .boss-sheet .boss-enter { min-width: 64px; padding: 5px 6px; }
  .boss-token-stock { font-size: 26px; }
}

/* Victory: the TM type choice reuses the native radio dialog with type cards. */
.ui-confirm[data-boss-reward-choice] > img { width: 100%; max-width: 384px; height: auto; aspect-ratio: 384 / 160; object-fit: cover; image-rendering: pixelated; border: 3px solid #080e18; box-shadow: 0 3px 0 #6b1f2c; }
.ui-confirm[data-boss-reward-choice] .ui-confirm__choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.boss-reward-type { display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-width: 0; padding-left: 6px; border-left: 4px solid var(--boss-type); }
.boss-reward-type img { grid-row: 1 / 3; width: 32px; height: 32px; image-rendering: pixelated; }
.boss-reward-type strong { font: 400 22px/1 var(--ui-font-display); }
.boss-reward-type small { color: var(--ui-color-text-muted, #a5b5c8); font: 500 10px/1.3 var(--ui-font-body); }
@media (max-width: 420px) { .ui-confirm[data-boss-reward-choice] .ui-confirm__choices { grid-template-columns: minmax(0, 1fr); } }

/* Receipt ceremony: the Dungeon chest over the boss arena panorama. */
.boss-reward-chosen { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 0; color: #f4dfb4; font: 400 28px/1 var(--ui-font-display); }
.boss-reward-chosen img { width: 32px; height: 32px; image-rendering: pixelated; }
.boss-reward-scene > img { filter: saturate(.85) brightness(.8); }

/* End of a boss fight: one centered, unmistakable result over the arena. */
.boss-result { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, #0b0a1000 20%, #0b0a10b8 100%); }
.boss-result[hidden] { display: none; }
.boss-result-panel { pointer-events: auto; display: grid; justify-items: center; gap: 10px; width: min(460px, 100%); padding: 22px 26px 24px;
  border: 3px solid #080e18; border-top: 4px solid var(--boss-result-accent, #e9bd62); background: #18121a; color: #f2ead6; text-align: center;
  box-shadow: inset 0 3px 0 #ffffff12, 6px 8px 0 #060b13cc; animation: boss-result-in 320ms steps(6, end) both; }
.boss-result[data-result="defeat"] { --boss-result-accent: #c23a4c; }
.boss-result-kicker { margin: 0; color: #c9bcc0; font: 600 11px/1.3 var(--ui-font-body); letter-spacing: 1.4px; text-transform: uppercase; }
.boss-result h2 { margin: 0; color: var(--boss-result-accent, #e9bd62); font: 400 64px/.95 var(--ui-font-display); text-shadow: 3px 4px 0 #060b13; }
.boss-result-note { margin: 0; color: #e3d8c6; font: 500 14px/1.45 var(--ui-font-body); }
.boss-result-hint { margin: 0; color: #c9bcc0; font: 500 11px/1.4 var(--ui-font-body); }
.boss-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; width: 100%; }
.boss-result-actions .ui-button { flex: 1 1 180px; min-height: 48px; font: 400 23px/1 var(--ui-font-display); }
@keyframes boss-result-in { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .boss-result-panel { animation: none; } }
@media (max-width: 420px) { .boss-result h2 { font-size: 52px; } .boss-result-panel { padding: 18px 16px 20px; } }

/* Arena HUD: boss identity card and the two arena controls. */
.boss-status-head { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.boss-status-portrait { display: grid; place-items: center; width: 52px; height: 52px; border: 2px solid #080e18; background: #060b13b8; box-shadow: inset 2px 2px 0 #ffffff14; }
.boss-status-portrait img { width: 48px; height: 48px; image-rendering: pixelated; }
.boss-status-title { display: grid; gap: 2px; min-width: 0; }
.boss-status-kicker { overflow: hidden; color: #d8c7ab; font: 600 10px/1.3 var(--ui-font-body); letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; }
.boss-status-title h2 { margin: 0; color: #f6e2c2; font: 400 30px/1 var(--ui-font-display); text-shadow: 2px 2px 0 #060b13; overflow-wrap: anywhere; }
.boss-status-head .ui-chip { align-self: start; }
.boss-status-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 10px; }
.boss-status-level { padding: 3px 7px; border: 1px solid #3d4a5c; background: #060b13; color: #fff1d2; font: 400 18px/1 var(--ui-font-display); }
.boss-status-rules { display: grid; gap: 6px; margin: 10px 0; padding: 10px 0 0; border-top: 1px solid var(--ui-color-border); list-style: none; }
.boss-status-rules li { display: flex; align-items: center; gap: 8px; color: #c9d2db; font: 500 12px/1.3 var(--ui-font-body); }
.boss-arena-mode :is(.gym-exit, .boss-battle-tools) > .ui-button {
  min-height: 40px; padding: 6px 14px; border: 2px solid #46566a; border-radius: 0; background: #1a2230; color: #f2ead6; opacity: 1;
  font: 400 20px/1 var(--ui-font-display); letter-spacing: 0; text-transform: none;
  box-shadow: inset 2px 2px 0 #ffffff14, inset -2px -2px 0 #080e18, 3px 3px 0 #060b13;
}
.boss-arena-mode :is(.gym-exit, .boss-battle-tools) > .ui-button:hover:not(:disabled) { background: #243046; border-color: #6a7d94; }
.boss-arena-mode .gym-exit > [data-gym-leave] { border-color: #8a2a38; background: #3a1820; color: #ffd9de; }
.boss-arena-mode .gym-exit > [data-gym-leave]:hover:not(:disabled) { background: #52202b; border-color: #c23a4c; }
.boss-arena-mode .boss-battle-tools { width: auto; }
.boss-arena-mode .boss-battle-tools[style*="--boss-tools-left"] .ranked-tv-tower { top: 52px; left: calc(12px - var(--boss-tools-left)); }
.boss-arena-mode .boss-battle-tools > .ui-button[aria-expanded="true"] { border-color: #e9bd62; color: #ffe5a0; }
.boss-arena-mode :is(.gym-exit, .boss-battle-tools) > .ui-button:focus-visible { outline: 2px solid var(--ui-color-focus); outline-offset: 2px; }
@media (max-width: 620px) {
  .boss-arena-mode :is(.gym-exit, .boss-battle-tools) > .ui-button { min-height: 44px; padding: 6px 10px; font-size: 18px; }
}

/* Compact HUD: the card's summary becomes a grid; the boss rows span it and
   the rule list folds into "Detalhes" like the gym team list. */
@media (max-width: 959px) {
  .boss-status-head, .boss-status-tags, .boss-status-rules { grid-column: 1 / -1; }
  .boss-status-head { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; }
  .boss-status-portrait { width: 40px; height: 40px; }
  .boss-status-portrait img { width: 36px; height: 36px; }
  .boss-status-title h2 { font-size: 24px; }
  .boss-status-tags { margin-top: 4px; }
  #gym-world-hud[data-details-expanded="false"] .boss-status-rules { display: none; }
}

/* Victory + TM choice in the same panel. */
.boss-result[data-result="choose"] { --boss-result-accent: #e9bd62; }
.boss-result[data-result="choose"] .boss-result-panel { width: min(520px, 100%); }
.boss-result-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; margin-top: 4px; }
.boss-result-type { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; border: 2px solid #364459; border-left: 5px solid var(--boss-type); background: #152130; color: #f2ead6; cursor: pointer; font: 400 22px/1 var(--ui-font-display); text-align: left; }
.boss-result-type input { position: absolute; opacity: 0; pointer-events: none; }
.boss-result-type img { width: 32px; height: 32px; image-rendering: pixelated; }
.boss-result-type:hover { background: #1d2c40; }
.boss-result-type[data-selected="true"] { border-color: #e9bd62; background: #2b2a1d; box-shadow: inset 0 0 0 1px #e9bd6266; }
.boss-result-type:has(input:focus-visible) { outline: 2px solid var(--ui-color-focus); outline-offset: 2px; }
@media (max-width: 420px) { .boss-result-types { grid-template-columns: minmax(0, 1fr); } }
