/* v493 owner 2026-11-24: dungeon tab redesign. (1) one card for the run being played: the room's own map art behind the room
   number, weak-element tags, the 20-room track, keys / coins / chests, buffs and curses with their numbers and a total line,
   a gold "paused" box with the time left and a big resume button. (2) finished runs as small buttons that open a popup with the
   run's room route (dungeon-map.js) and loot. Tokens follow .interface-design/system.md (ink, soft, dim, green, red, gold). */
#panel-dungeon .dg-hero.dg2 { display: block; margin: 12px 0 16px; padding: 0; overflow: hidden; border: var(--dg-line, 1px solid rgb(152 140 203 / 20%)); border-radius: 18px; background: linear-gradient(165deg, rgb(27 30 54 / 94%), rgb(14 17 32 / 94%)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%); }

/* hero: the room's map */
#panel-dungeon .dg2-hero { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; min-height: 190px; padding: 18px; }
#panel-dungeon .dg2-bg { position: absolute; inset: 0; z-index: -2; background: #151730 center / cover no-repeat; transform: scale(1.04); }
#panel-dungeon .dg2-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgb(10 11 24 / 15%) 0%, rgb(10 11 24 / 55%) 45%, rgb(16 18 34 / 97%) 100%), linear-gradient(90deg, rgb(10 11 24 / 70%), transparent 70%); }
#panel-dungeon .dg2-top { position: absolute; top: 14px; left: 18px; right: 18px; display: flex; justify-content: space-between; gap: 8px; }
#panel-dungeon .dg2-pill, #panel-dungeon .dg2 .dg-room-state { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; border: 1px solid rgb(255 255 255 / 16%); background: rgb(10 11 24 / 55%); color: #f0edff; font-size: 11px; font-weight: 700; white-space: nowrap; backdrop-filter: blur(6px); box-shadow: none; }
#panel-dungeon .dg2 .dg-room-state.is-live { color: #72dfb2; border-color: rgb(114 223 178 / 40%); background: rgb(10 30 24 / 60%); }
#panel-dungeon .dg2 .dg-room-state.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #72dfb2; box-shadow: 0 0 10px #72dfb2; animation: dg2-blink 1.6s cubic-bezier(.23, 1, .32, 1) infinite; }
@keyframes dg2-blink { 50% { opacity: .35; } }
#panel-dungeon .dg2-room { color: #f0edff; font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
#panel-dungeon .dg2-room small { margin-left: 6px; color: #b7b6cc; font-size: 20px; font-weight: 700; }
#panel-dungeon .dg2-map { margin-top: 6px; color: #f0edff; font-size: 15px; font-weight: 700; }
#panel-dungeon .dg2-map:empty { display: none; }
#panel-dungeon .dg2-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#panel-dungeon .dg2-tags:empty { display: none; }
#panel-dungeon .dg2-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 7px; border-radius: 8px; border: 1px solid rgb(255 224 102 / 35%); background: rgb(10 11 24 / 62%); color: #ffe066; font-size: 12px; font-weight: 700; backdrop-filter: blur(6px); }
#panel-dungeon .dg2-glyph { width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }

/* body */
#panel-dungeon .dg2-body { display: grid; gap: 12px; padding: 4px 18px 18px; }
#panel-dungeon .dg2 .dg-track { padding: 6px; }
#panel-dungeon .dg2 .dg-step { height: 14px; border-radius: 4px; }
#panel-dungeon .dg2 .dg-track-ends { margin-top: -8px; }
#panel-dungeon .dg2 .dgm:not(.dgm-panel) { margin-top: -4px; }
#panel-dungeon .dg2-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#panel-dungeon .dg2-stat { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px; border-radius: 12px; border: 1px solid rgb(255 255 255 / 6%); background: rgb(8 11 22 / 42%); }
#panel-dungeon .dg2-stat.is-empty b { color: #ff8293; }
#panel-dungeon .dg2-stat-art { display: grid; place-items: center; flex: none; width: 34px; height: 34px; color: #b7b6cc; }
#panel-dungeon .dg2-stat-art img { width: 34px; height: 34px; object-fit: contain; image-rendering: pixelated; }
#panel-dungeon .dg2-stat b { display: block; color: #f0edff; font-size: 17px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
#panel-dungeon .dg2-stat span:not(.dg2-stat-art) { display: block; overflow: hidden; color: #8a8ea8; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }

/* buffs and curses with numbers */
#panel-dungeon .dg2-fx { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#panel-dungeon .dg2-fx:empty { display: none; }
#panel-dungeon .dg2-fx-none { grid-column: 1 / -1; margin: 0; padding: 12px; border-radius: 12px; background: rgb(8 11 22 / 42%); color: #8a8ea8; font-size: 12px; text-align: center; }
#panel-dungeon .dg2-fx-col { --c: #72dfb2; padding: 12px; border-radius: 14px; border: 1px solid rgb(255 255 255 / 6%); border-top: 2px solid var(--c); background: rgb(8 11 22 / 42%); }
#panel-dungeon .dg2-fx-col.is-curse { --c: #ff8293; }
#panel-dungeon .dg2-fx-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; color: var(--c); font-size: 13px; }
#panel-dungeon .dg2-fx-head small { color: #8a8ea8; font-size: 12px; }
#panel-dungeon .dg2-fx-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 0; }
#panel-dungeon .dg2-fx-row + .dg2-fx-row { border-top: 1px solid rgb(255 255 255 / 5%); }
#panel-dungeon .dg2-fx-icon { display: grid; place-items: center; width: 36px; height: 36px; padding: 3px; border-radius: 10px; background: rgb(6 8 18 / 50%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%); color: var(--c); }
#panel-dungeon .dg2-fx-icon img { width: 100%; height: 100%; object-fit: contain; }
#panel-dungeon .dg2-fx-copy { min-width: 0; }
#panel-dungeon .dg2-fx-copy strong { display: block; color: #f0edff; font-size: 13px; font-weight: 700; line-height: 1.3; }
#panel-dungeon .dg2-fx-copy small { display: block; color: var(--c); font-size: 12px; font-weight: 600; }
#panel-dungeon .dg2-tier { margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: rgb(255 255 255 / 9%); color: #b7b6cc; font-size: 10px; font-weight: 800; vertical-align: 1px; }
#panel-dungeon .dg2-tier.is-top { background: #f4d38a; color: #1b1405; }
#panel-dungeon .is-curse .dg2-tier.is-top { background: #ff8293; color: #2a0710; }
#panel-dungeon .dg2-fx-qty:not(:empty) { padding: 2px 6px; border-radius: 6px; background: rgb(255 255 255 / 7%); color: #b7b6cc; font-size: 11px; font-weight: 800; }
#panel-dungeon .dg2-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -2px; }
#panel-dungeon .dg2-sum[hidden] { display: none; }
#panel-dungeon .dg2-sum-label { color: #8a8ea8; font-size: 12px; }
#panel-dungeon .dg2-sum-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: rgb(114 223 178 / 10%); color: #72dfb2; font-size: 12px; font-weight: 700; }
#panel-dungeon .dg2-sum-chip.is-curse { background: rgb(255 130 147 / 10%); color: #ff8293; }

/* paused: time left + resume */
#panel-dungeon .dg2-resume { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; border-radius: 14px; border: 1px solid rgb(244 211 138 / 26%); background: linear-gradient(100deg, rgb(244 211 138 / 12%), rgb(244 211 138 / 3%)); }
#panel-dungeon .dg2-resume[hidden] { display: none; }
#panel-dungeon .dg2-ring { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: conic-gradient(#f4d38a 0 calc(var(--left, 100) * 1%), rgb(255 255 255 / 8%) 0); }
#panel-dungeon .dg2-ring span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #19182b; color: #f4d38a; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
#panel-dungeon .dg2-resume-copy b { display: block; color: #f4d38a; font-size: 14px; font-weight: 800; }
#panel-dungeon .dg2-resume-copy span { display: block; color: #b7b6cc; font-size: 12px; }
#panel-dungeon .dg2-go { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #8ff0c6, #45c992); color: #062218; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 18px rgb(69 201 146 / 35%), inset 0 1px 0 rgb(255 255 255 / 45%); transition: transform .14s cubic-bezier(.23, 1, .32, 1), box-shadow .14s cubic-bezier(.23, 1, .32, 1); }
#panel-dungeon .dg2-go:hover { box-shadow: 0 8px 24px rgb(69 201 146 / 50%), inset 0 1px 0 rgb(255 255 255 / 45%); }
#panel-dungeon .dg2-go:active { transform: scale(.97); }
#panel-dungeon .dg2-go:disabled { cursor: default; opacity: .75; }
#panel-dungeon .dg2-go:focus-visible { outline: 2px solid #72dfb2; outline-offset: 2px; }

/* finished runs: small buttons */
#panel-dungeon .drun-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
#panel-dungeon .drun-btn { --rc: #72dfb2; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 58px; padding: 0 12px 0 10px; border: 1px solid rgb(255 255 255 / 8%); border-left: 3px solid var(--rc); border-radius: 12px; background: rgb(8 11 22 / 55%); color: #f0edff; font: inherit; text-align: left; cursor: pointer; transition: transform .14s cubic-bezier(.23, 1, .32, 1), background .14s; }
#panel-dungeon .drun-btn.is-out { --rc: #ff8293; }
#panel-dungeon .drun-btn:hover { background: rgb(255 255 255 / 5%); }
#panel-dungeon .drun-btn:active { transform: scale(.97); }
#panel-dungeon .drun-btn:focus-visible { outline: 2px solid var(--rc); outline-offset: 2px; }
.drun-btn-no { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgb(255 255 255 / 7%); font-weight: 800; font-variant-numeric: tabular-nums; }
#panel-dungeon .drun-btn-copy { min-width: 0; }
#panel-dungeon .drun-btn-copy b, #panel-dungeon .drun-btn-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#panel-dungeon .drun-btn-copy b { color: var(--rc); font-size: 13px; font-weight: 800; line-height: 1.25; }
#panel-dungeon .drun-btn-copy small { color: #8a8ea8; font-size: 11px; }
.drun-btn-rr { display: inline-flex; align-items: center; gap: 4px; color: #f4d38a; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.drun-btn-rr img { width: 20px; height: 20px; object-fit: contain; }
.drun-btn-rr.is-big { font-size: 18px; }
.drun-btn-rr.is-big img { width: 26px; height: 26px; }

/* popup with the run's room route */
.drun-modal { width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid rgb(152 140 203 / 22%); border-radius: 18px; background: #12142a; color: #f0edff; box-shadow: 0 30px 80px rgb(0 0 0 / 60%); }
.drun-modal::backdrop { background: rgb(4 5 12 / 72%); backdrop-filter: blur(4px); }
.drun-modal[open] { display: flex; flex-direction: column; animation: drun-pop .2s cubic-bezier(.23, 1, .32, 1); }
@keyframes drun-pop { from { opacity: 0; transform: scale(.96); } }
.drun-modal-head { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid rgb(255 255 255 / 7%); }
.drun-modal-head small { display: block; color: #8a8ea8; font-size: 12px; }
.drun-modal-title { display: block; font-size: 16px; font-weight: 800; }
.drun-modal-title.is-win { color: #72dfb2; } .drun-modal-title.is-out { color: #ff8293; }
.drun-x { width: 34px; height: 34px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 10px; background: rgb(255 255 255 / 5%); color: #b7b6cc; font: inherit; cursor: pointer; }
.drun-x:hover { color: #f0edff; }
.drun-modal-body { overflow-y: auto; padding: 4px 16px 16px; }
.drun-modal-sub { margin: 12px 0 8px; color: #8a8ea8; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.drun-modal .dgm-past { margin: 0; }
.drun-modal .drun-card { list-style: none; border: 0; padding: 0; background: transparent; }

@media (max-width: 640px) {
  #panel-dungeon .dg2-room { font-size: 36px; }
  #panel-dungeon .dg2-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #panel-dungeon .dg2-fx { grid-template-columns: minmax(0, 1fr); }
  #panel-dungeon .dg2-resume { grid-template-columns: 44px minmax(0, 1fr); }
  #panel-dungeon .dg2-resume .dg2-go { grid-column: 1 / -1; }
  #panel-dungeon .dg2-ring { width: 44px; height: 44px; } #panel-dungeon .dg2-ring span { width: 36px; height: 36px; font-size: 11px; }
  .drun-modal-head { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .drun-modal-head .drun-btn-rr { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #panel-dungeon .dg2 .dg-room-state.is-live::before, .drun-modal[open] { animation: none; }
}
