/* v386: dungeon settings inside the Dungeon tab. Tokens from .interface-design/system.md: quiet dark panels, game art carries colour,
   gold = what the customer put first (focus rooms, pinned buffs, summary), red = avoided, green = recommended choice. 4px grid. */
.dgs {
  --s-ink: #f0edff; --s-soft: #b7b6cc; --s-dim: #8a8ea8; --s-gold: #f4d38a; --s-red: #ff8293; --s-green: #72dfb2; --s-violet: #c6a8ff;
  --s-panel: linear-gradient(165deg, rgb(27 30 54 / 94%), rgb(14 17 32 / 94%));
  --s-line: 1px solid rgb(152 140 203 / 20%);
  --s-tile: rgb(8 11 22 / 42%);
  --s-tile-line: 1px solid rgb(255 255 255 / 6%);
  display: grid; gap: 12px; margin-top: 20px;
}
.dgs[hidden] { display: none; }
.dgs h2, .dgs h3, .dgs p { margin: 0; }

/* head: what the bot will do (focus of the page) */
.dgs-head { display: grid; gap: 12px; padding: 16px; border: 1px solid rgb(244 211 138 / 28%); border-radius: 16px; background: radial-gradient(ellipse at 0% 0%, rgb(244 211 138 / 10%), transparent 55%), var(--s-panel); box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%); }
.dgs-head-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.dgs-eyebrow { color: var(--s-gold); font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.dgs-head h2 { color: var(--s-ink); font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.dgs-auto { display: flex; align-items: center; gap: 10px; color: var(--s-soft); font-size: 12px; font-weight: 600; }
.dgs-switch { min-width: 64px; padding: 8px 14px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 999px; background: var(--s-tile); color: var(--s-soft); font: inherit; font-weight: 800; cursor: pointer; }
.dgs-switch[aria-checked="true"] { border-color: rgb(114 223 178 / 45%); background: rgb(114 223 178 / 14%); color: var(--s-green); }
.dgs-switch[aria-disabled="true"] { cursor: not-allowed; }
.dgs-summary { display: grid; gap: 6px; margin: 0; padding: 12px; list-style: none; border: var(--s-tile-line); border-radius: 12px; background: var(--s-tile); }
.dgs-summary li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; color: #e9e2c8; font-size: 13px; line-height: 1.5; }
.dgs-summary-icon { text-align: center; }
.dgs-note { color: var(--s-soft); font-size: 12px; }

/* sections */
.dgs-section { display: grid; gap: 12px; padding: 14px 16px; border: var(--s-line); border-radius: 16px; background: var(--s-panel); box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%); }
.dgs-section-head { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.dgs-no { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgb(198 168 255 / 14%); color: var(--s-violet); font-size: 12px; font-weight: 800; }
.dgs-section-copy h3 { color: var(--s-ink); font-size: 15px; font-weight: 800; }
.dgs-section-copy p { margin-top: 2px; color: var(--s-dim); font-size: 12px; line-height: 1.5; }
.dgs-body { display: grid; gap: 8px; }
.dgs-two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dgs-group { color: var(--s-dim); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.dgs-hint { color: var(--s-dim); font-size: 12px; }
.dgs-link, .dgs-more { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--s-violet); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.dgs-link:hover, .dgs-more:hover { background: rgb(198 168 255 / 10%); }
.dgs-more { justify-self: start; padding-left: 0; }
.dgs-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid rgb(244 211 138 / 30%); border-radius: 10px; background: rgb(244 211 138 / 8%); color: #e9dcb6; font-size: 12px; }

/* segmented choices */
.dgs-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.dgs-seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: var(--s-tile-line); border-radius: 10px; background: var(--s-tile); color: var(--s-soft); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.dgs-seg-btn small { padding: 1px 6px; border-radius: 6px; background: rgb(114 223 178 / 14%); color: var(--s-green); font-size: 10px; font-weight: 700; }
.dgs-seg-btn[aria-pressed="true"] { border-color: rgb(198 168 255 / 55%); background: rgb(198 168 255 / 14%); color: var(--s-ink); }

/* rooms */
.dgs-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.dgs-room { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border: var(--s-tile-line); border-radius: 12px; background: var(--s-tile); color: var(--s-soft); font: inherit; text-align: left; cursor: pointer; }
.dgs-room[aria-pressed="true"] { border-color: rgb(244 211 138 / 55%); background: rgb(244 211 138 / 9%); }
.dgs-room-art { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgb(6 8 18 / 55%); font-size: 20px; }
.dgs-room-art img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.dgs-room-copy { display: grid; min-width: 0; }
.dgs-room-copy strong { color: var(--s-ink); font-size: 13px; font-weight: 800; }
.dgs-room-copy small { color: var(--s-dim); font-size: 11px; }
.dgs-rank { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--s-gold); color: #2a1f05; font-size: 12px; font-weight: 800; }
.dgs-rank:empty { display: none; }

/* buffs and curses */
.dgs-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--s-dim); font-size: 11px; }
.dgs-legend .is-pin { color: var(--s-gold); font-weight: 700; }
.dgs-legend .is-avoid { color: var(--s-red); font-weight: 700; }
.dgs-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.dgs-item { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border: var(--s-tile-line); border-radius: 12px; background: var(--s-tile); color: var(--s-soft); font: inherit; text-align: left; cursor: pointer; }
.dgs-item.is-pin { border-color: rgb(244 211 138 / 60%); background: rgb(244 211 138 / 9%); }
.dgs-item.is-avoid { border-color: rgb(255 130 147 / 45%); background: rgb(255 130 147 / 8%); }
.dgs-item.is-avoid .dgs-item-copy strong { color: var(--s-red); }
.dgs-art { position: relative; display: grid; place-items: center; width: 40px; height: 40px; overflow: hidden; border-radius: 10px; background: rgb(6 8 18 / 55%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%); }
.dgs-art img { position: absolute; inset: 4px; width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.dgs-art-fallback { color: var(--s-dim); }
.dgs-item-copy { display: grid; min-width: 0; }
.dgs-item-copy strong { display: -webkit-box; overflow: hidden; color: var(--s-ink); font-size: 13px; font-weight: 800; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dgs-item-copy small { overflow: hidden; color: var(--s-dim); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dgs-tier { padding: 1px 6px; border-radius: 6px; background: rgb(255 255 255 / 6%); color: var(--s-soft); font-size: 10px; font-weight: 800; }
.dgs-tier.is-legendary { background: rgb(244 211 138 / 16%); color: var(--s-gold); }
.dgs-tier.is-super { background: rgb(255 130 147 / 16%); color: var(--s-red); }
.dgs-mark { position: absolute; top: -7px; right: 8px; padding: 0 6px; border-radius: 6px; background: var(--s-gold); color: #2a1f05; font-size: 11px; font-weight: 800; line-height: 16px; }
.dgs-mark.is-avoid { background: var(--s-red); color: #3a0710; }
/* v432: bought by the bot itself (AA Log 3.165 list) */
.dgs-mark.is-auto { background: #72dfb2; color: #05291b; }
.dgs-item.is-auto { border-color: rgb(114 223 178 / 45%); }
.dgs-legend .is-auto { color: #72dfb2; font-weight: 700; }

/* elements */
.dgs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dgs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: var(--s-tile-line); border-radius: 999px; background: var(--s-tile); color: var(--s-soft); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.dgs-chip[aria-pressed="true"] { border-color: rgb(244 211 138 / 55%); background: rgb(244 211 138 / 9%); color: var(--s-ink); }
.dgs-chip b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--s-gold); color: #2a1f05; font-size: 11px; }
.dgs-element { width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }

/* maps */
.dgs-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.dgs-map { display: grid; gap: 6px; padding: 6px; border: var(--s-tile-line); border-radius: 12px; background: var(--s-tile); color: var(--s-ink); font: inherit; font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; }
.dgs-map.is-avoid { border-color: rgb(255 130 147 / 45%); background: rgb(255 130 147 / 8%); color: var(--s-red); }
.dgs-map-art { position: relative; display: block; height: 64px; overflow: hidden; border-radius: 8px; background: rgb(6 8 18 / 55%); }
.dgs-map-art img { width: 100%; height: 100%; object-fit: cover; }
.dgs-map.is-avoid .dgs-map-art img { filter: grayscale(.8) brightness(.55); }
.dgs-map-x { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; }

/* save bar: always in reach while editing */
.dgs-save { position: sticky; bottom: 12px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: var(--s-line); border-radius: 14px; background: rgb(16 18 34 / 94%); box-shadow: 0 10px 30px rgb(0 0 0 / 45%); backdrop-filter: blur(8px); }
.dgs-save p { color: var(--s-green); font-size: 13px; font-weight: 700; }
.dgs-save[data-dirty="true"] { border-color: rgb(244 211 138 / 50%); }
.dgs-save[data-dirty="true"] p { color: var(--s-gold); }
.dgs-save p[data-state="error"] { color: var(--s-red); }
.dgs-save-actions { display: flex; gap: 8px; }
.dgs-ghost, .dgs-primary { padding: 9px 16px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.dgs-ghost { border: var(--s-tile-line); background: var(--s-tile); color: var(--s-soft); }
.dgs-primary { border: 0; background: linear-gradient(135deg, #8f7bff, #b98cff); color: #fff; }
.dgs-ghost:disabled, .dgs-primary:disabled { opacity: .45; cursor: default; }
.dgs button:focus-visible { outline: 2px solid var(--s-violet); outline-offset: 2px; }

@media (max-width: 560px) {
  .dgs-section, .dgs-head { padding: 12px; }
  .dgs-save { bottom: 76px; } /* above the phone bottom menu */
  .dgs-two { grid-template-columns: minmax(0, 1fr); }
  .dgs-rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dgs-items { grid-template-columns: minmax(0, 1fr); }
  .dgs-maps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dgs-section-head { grid-template-columns: 26px minmax(0, 1fr); }
  .dgs-section-head > .dgs-link { grid-column: 2; justify-self: start; padding-left: 0; }
}

/* v387: sub menu at the top of the Dungeon tab (progress & rewards | settings). Only one view shows at a time. */
.dgs-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0 0 12px; padding: 4px; border: 1px solid rgb(152 140 203 / 20%); border-radius: 14px; background: rgb(8 11 22 / 55%); }
.dgs-nav[hidden] { display: none; }
.dgs-nav-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 12px; border: 0; border-radius: 10px; background: none; color: #b7b6cc; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.dgs-nav-btn:hover { color: #f0edff; background: rgb(255 255 255 / 4%); }
.dgs-nav-btn[aria-selected="true"] { background: linear-gradient(165deg, rgb(52 44 96 / 95%), rgb(30 26 58 / 95%)); color: #f0edff; box-shadow: inset 0 0 0 1px rgb(198 168 255 / 35%); }
.dgs-nav-icon { display: grid; place-items: center; width: 26px; height: 26px; }
.dgs-nav-icon img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.dgs-nav-btn:focus-visible { outline: 2px solid #c6a8ff; outline-offset: 2px; }
#panel-dungeon[data-dg-view="settings"] > :not(.dgs-nav):not(#dungeon-settings):not(#dungeon-addon) { display: none !important; }
#panel-dungeon[data-dg-view="progress"] > #dungeon-settings { display: none; }
#panel-dungeon[data-dg-view="settings"] > #dungeon-settings { margin-top: 0; }
/* v456 dungeon add-on card (both views, under the menu) */
#dungeon-addon { margin: 0 0 12px; }
#dungeon-addon[hidden] { display: none; }
.dgs-addon-state { color: var(--s-gold); font-size: 15px; font-weight: 800; }
.dgs-addon-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dgs-addon-msg { min-height: 1em; }
.dgs-addon-msg[data-state="error"] { color: var(--s-red); }
@media (max-width: 560px) { .dgs-nav-btn { font-size: 13px; gap: 6px; } }

/* v407: why Auto Dungeon is off */
.dg-off-why { margin: 8px 0 0; padding: 8px 12px; border: 1px solid rgb(244 211 138 / 30%); border-radius: 10px; background: rgb(244 211 138 / 10%); color: #f4d38a; font-size: 13px; line-height: 1.5; }
.dg-off-why[hidden] { display: none; }
/* v428: "กลับไปลงทันที" */
.dg-off-why { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.dg-go-now { padding: 6px 14px; border: 1px solid rgb(114 223 178 / 55%); border-radius: 999px; background: rgb(114 223 178 / 16%); color: #72dfb2; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.dg-go-now:hover:not(:disabled) { background: rgb(114 223 178 / 26%); }
.dg-go-now:disabled { opacity: .8; cursor: default; }
.dg-go-now:focus-visible { outline: 2px solid #72dfb2; outline-offset: 2px; }
/* v484: what to prepare before buying the add-on, with the example team */
.dgs-addon-prep { display: grid; gap: 8px; margin: 10px 0; padding: 12px; border: 1px solid rgb(255 212 121 / 22%); border-radius: 12px; background: rgb(255 212 121 / 5%); }
.dgs-addon-prep-title { margin: 0; color: #ffd479; font-size: 13px; font-weight: 800; }
.dgs-addon-team { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.dgs-addon-unit { margin: 0; display: grid; gap: 4px; text-align: center; }
.dgs-addon-unit img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid rgb(255 255 255 / 10%); }
.dgs-addon-unit figcaption { overflow: hidden; color: #c9c7dc; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dgs-addon-ticket { display: inline-flex; align-items: center; text-decoration: none; }
@media (max-width: 520px) { .dgs-addon-team { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* v492 maps to avoid are the shop's list: read-only cards for customers, a save bar for admins */
.dgs-map.is-readonly { cursor: default; }
.dgs-shopmaps-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 10px 12px; border: var(--s-line); border-radius: 12px; background: rgb(16 18 34 / 70%); }
.dgs-shopmaps-bar p { margin: 0; font-size: 13px; color: var(--s-ink); }
.dgs-shopmaps-bar p[data-state="error"] { color: var(--s-red); }

/* v641 SHRINE pool (what a shrine can give, from real offers) */
.dgs-pool { margin-top: 10px; border: var(--s-tile-line); border-radius: 12px; background: var(--s-tile); padding: 8px 10px; }
.dgs-pool[open] { display: grid; gap: 8px; }
.dgs-pool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; cursor: pointer; color: var(--s-ink); font-size: 13px; font-weight: 800; }
.dgs-pool-head small { color: var(--s-dim); font-size: 11px; font-weight: 600; }
.dgs-item.is-readonly { cursor: default; }
.dgs-pool-pct { color: var(--s-ink); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
