/* 1.1 economy: currencies, the Lab, item choice screens, level-up tools, pause items and the run summary. */
.dust-ic, .gold-ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.dust-ic { background: url(../assets/ui/stardust.png) no-repeat center / contain; image-rendering: pixelated; }
.gold-ic { background: url(../assets/ui/gold.png) no-repeat center / contain; image-rendering: pixelated; }
.ui-ic { image-rendering: pixelated; vertical-align: -2px; }
.tag-chip .ui-ic { margin-right: 3px; vertical-align: -2px; }
#lvl-skip::before, #lvl-ban::before, #lvl-reroll::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 5px; vertical-align: -3px; background: no-repeat center / contain; image-rendering: pixelated; }
#lvl-skip::before { background-image: url(../assets/ui/skip.png); }
#lvl-ban::before { background-image: url(../assets/ui/banish.png); }
#lvl-reroll::before { background-image: url(../assets/ui/reroll.png); }
.gold-txt { color: var(--gold); }
.btn.tiny { padding: 3px 8px; font-size: 12px; min-height: 0; }

/* Lab. */
.lab-box { max-height: 100%; overflow-y: auto; }   /* Stays inside the screen padding, below the top bar. */
.lab-dust { color: #d9ccff; font-size: 18px; }
#lab-tabs { display: flex; gap: 6px; margin: 8px 0 10px; }
.lab-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.lab-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px; }
.lab-row .lv { color: var(--muted); font-size: 12px; }
.lab-row .sub { font-size: 13px; }
.lab-row .eff { font-size: 13px; color: var(--muted); }
.lab-row .eff .to { color: var(--green); }
/* Repertoire, the second starting move: a light gold frame and tint, nothing else changes (js/ui/lab-ui.js). */
.lab-row.lab-key { box-shadow: inset 0 0 0 2px rgba(255, 210, 63, .55);
  background-image: linear-gradient(135deg, rgba(255, 210, 63, .12), rgba(255, 210, 63, 0) 60%); }
.lab-sub { grid-column: 1 / -1; justify-self: start; }
.lab-note { margin: 0 0 8px; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.lab-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-left: 4px solid var(--rc, #9fb1c9); }
.lab-item.locked { opacity: .78; }
.lab-item.arch { outline: 2px dashed var(--gold); }
.lab-item .mx { color: var(--muted); font-size: 12px; }
.lab-item .ds { color: var(--muted); font-size: 13px; margin: 2px 0 4px; }
.lab-item .st { font-size: 12px; margin-right: 6px; }
.lab-item .st.ok { color: var(--green); }
.lab-item .st.lock { color: #ffb36b; }
.lab-tour { position: sticky; bottom: 0; margin-top: 10px; }
.lab-tour .panel { border: 2px solid var(--gold); background: rgba(10,20,48,.95); }
.grow { flex: 1; min-width: 0; }
.item-ic { image-rendering: pixelated; vertical-align: middle; }

/* Item choice screens. */
.pick-box { width: min(600px, 100%); }
.pick-foot { gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.card.off { opacity: .45; cursor: default; }
.card.off:hover { transform: none; background: rgba(0,0,0,.2); border-color: rgba(244,248,255,.3); }
.card .stk { font-size: 12px; color: var(--muted); font-weight: 400; }
.card .price { margin-top: 4px; font-weight: 700; }
.card .price.ok { color: var(--gold); }
.card .price.no { color: #8f98ab; }

/* Level-up tools. */
.lvl-tools { gap: 8px; justify-content: center; flex-wrap: wrap; }
#cards.banning .card { border-color: var(--red); }
#cards.banning .card:hover { background: rgba(255,95,109,.15); }

/* Pause items. */
.pause-items { margin-top: 10px; text-align: left; max-height: 30vh; overflow-y: auto; }
.pause-items h4 { margin: 6px 0; color: var(--muted); }
.pi-row { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; border-bottom: 1px solid rgba(244,248,255,.08); }
.pi-row .stk { color: var(--muted); font-size: 12px; }
.pi-row .ds { color: var(--muted); font-size: 12px; }

/* Run summary. */
.rs-share { position: relative; min-width: 56px; }
.rs-share i { position: absolute; left: 0; top: 20%; bottom: 20%; background: rgba(95,212,255,.25); border-radius: 3px; }
.rs-share span { position: relative; }
.over-eco { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; text-align: left; }
.oe-sec { padding: 8px 10px; }
.oe-sec h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; }
.oe-line { display: flex; justify-content: space-between; font-size: 14px; }
.oe-total { border-top: 1px solid rgba(244,248,255,.15); margin-top: 4px; padding-top: 4px; color: #d9ccff; }
.oe-items { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.oe-item { position: relative; }
.oe-item b { position: absolute; right: -2px; bottom: -4px; font-size: 11px; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.oe-moves { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.oe-moves small { color: var(--muted); }
.oe-ko { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.oe-mon { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px; font-size: 12px; }
.oe-mon .oe-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-mon b { white-space: nowrap; }
.oe-pic { position: relative; display: inline-block; line-height: 0; }
.oe-new { position: absolute; right: -4px; top: -4px; font-style: normal; line-height: 0; padding: 1px; background: #10131a; border-radius: 50%; box-shadow: 0 0 0 1px var(--gold); }
.oe-mon.is-new .oe-name { color: var(--gold); }
.oe-legend { float: right; text-transform: none; color: var(--gold); font-size: 11px; }
.oe-up { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.oe-up small { display: block; color: var(--muted); }
.oe-up .bar { height: 5px; background: rgba(0,0,0,.4); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.oe-up .bar i { display: block; height: 100%; background: #c9a6ff; }
.oe-rec { font-size: 16px; color: var(--muted); }
.oe-rec.up { color: var(--green); }
.over-btns { gap: 10px; justify-content: center; }
/* 1.15b: the one-time Telegram home screen prompt above the results buttons (js/core/tg.js). */
.over-home { margin: 8px 0 4px; padding: 8px 10px; border: 1px solid rgba(244,248,255,.18); border-radius: 10px; background: rgba(0,0,0,.25); text-align: center; }
.over-home p { margin: 0 0 6px; font-size: 14px; }
.over-home .row { gap: 8px; justify-content: center; }
#scr-over .box { max-height: calc(100dvh - 20px); overflow-y: auto; }

@media (max-width: 520px) {
  .over-eco, .lab-list, .lab-grid { grid-template-columns: 1fr; }
  .card .nm { font-size: 16px; }
  .lab-row { grid-template-columns: 32px 1fr; }
  .lab-row > .btn { grid-column: 1 / -1; }
}

/* The achievement pop-up stays above the game and menus but goes under modal windows and pause. */
#scr-pick:not(.hidden) ~ .ach-pop, #scr-levelup:not(.hidden) ~ .ach-pop, #scr-pause:not(.hidden) ~ .ach-pop,
#scr-upgrades:not(.hidden) ~ .ach-pop, #scr-bond:not(.hidden) ~ .ach-pop, #scr-item:not(.hidden) ~ .ach-pop,
#scr-over:not(.hidden) ~ .ach-pop { z-index: 19; }

/* Research (1.1, E8). */
.dex-mode { display: flex; gap: 6px; margin: 6px 0 4px; }
.research .gen-tab.locked { opacity: .5; }
.research-types .chip.type { padding: 3px 5px; }
.research-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.research-tile { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 5px; border-radius: 9px;
  border: 2px solid rgba(244,248,255,.18); background: rgba(0,0,0,.25); color: inherit; font: inherit; cursor: pointer; }
.research-tile.own { background: rgba(255,255,255,.13); }
.research-tile.r4 { border-color: #4fb4ff; }
.research-tile.r5 { border-color: #ffcb3d; }
.research-tile b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.research-tile .pt-portrait { width: 48px; height: 48px; image-rendering: pixelated; }
.research-tile.unknown canvas { width: 48px; height: 48px; filter: brightness(0) sepia(1) hue-rotate(190deg) saturate(4) brightness(.45); }
.research-bar { display: block; width: 100%; height: 4px; border-radius: 2px; background: rgba(0,0,0,.45); overflow: hidden; }
.research-bar i { display: block; height: 100%; background: #7dffb0; }
.research-tile.done .research-bar i, .research-tile.own .research-bar i { background: var(--gold); }
.research-egg { position: absolute; top: 4px; right: 4px; width: 12px; height: 15px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; background: #fff6d8; box-shadow: inset -2px -2px 0 #e6c56b, 0 0 6px #ffd23f; }
.research-tile .badge-copies { position: absolute; top: 3px; left: 5px; font-size: 11px; font-weight: 800; color: var(--gold); text-shadow: 0 1px 0 #000; }
.research-sum { margin: 8px 0 0; }
.research-card { margin-top: 8px; }
.research-card p { margin: 4px 0; }
.oe-research { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; align-items: center; }
.oe-res .pt-portrait { width: 20px; height: 20px; vertical-align: middle; }
.egg-research { color: #7dffb0; font-size: 12px; margin: 0; }
.egg-ready { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.egg-art.mini { width: 16px; height: 20px; display: inline-block; }
@media (max-width: 520px) {
  .research-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 48vh; }
  .research-tile .pt-portrait, .research-tile.unknown canvas { width: 40px; height: 40px; }
}

/* rc-1.1b: on wide screens the pause and run-over windows use two columns, so the damage table, knockouts by
   species and the build fit on 1920x1080 without scrolling. Phones keep the single 580 px column. */
@media (min-width: 1024px) and (min-height: 600px) {
  #scr-over > .box, #scr-pause > .box { width: min(1180px, 94vw) !important; max-height: 96vh; }
  #scr-over > .box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 18px; align-content: start; }
  #scr-over > .box > h2, #scr-over > .box > .over-btns, #scr-over > .box > .over-home { grid-column: 1 / -1; }
  #scr-over #over-stats { grid-column: 1; }
  #scr-over #over-runstats { grid-column: 1; }
  #scr-over #over-eco { grid-column: 2; grid-row: 2 / span 2; align-self: start; }
  #scr-pause > .box { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 18px; align-content: start; }
  #scr-pause > .box > h2, #scr-pause > .box > .sub, #scr-pause > .box > .note, #scr-pause > .box > .row { grid-column: 1 / -1; }
  #scr-pause #pause-stats { grid-column: 1; grid-row: span 3; }
  #scr-pause #pause-cast, #scr-pause #pause-items, #scr-pause #pause-sound { grid-column: 2; }
}

/* rc-1.1b: the gacha fits a 360 px phone. Grid children may shrink, the legendary sprites shrink with the banner, the pull
   buttons wrap, and the window cannot be dragged sideways. */
.split > * { min-width: 0; }
.banner .feat canvas { flex: 0 1 auto; min-width: 0; max-width: 34%; height: auto; image-rendering: pixelated; }
#scr-gacha > .box { overflow-x: hidden; touch-action: pan-y; }
#scr-gacha .row { flex-wrap: wrap; }
#scr-gacha .row > .btn.grow { min-width: 0; flex: 1 1 130px; }
@media (max-width: 480px) {
  #scr-gacha .banner { padding: 12px; }
  #scr-gacha .banner h3 { font-size: 22px; }
  #scr-gacha .banner .feat { height: 120px; margin: 6px -6px -12px; }
  #scr-gacha .banner .feat canvas { max-width: 40%; }
}
/* rc-1.1b: the legal line steps aside while a window is open on a phone held upright; it stays on the menu itself. */
@media (max-width: 760px) and (min-height: 521px) {
  body:has(.scr.dim:not(.hidden)) .credits-line { display: none !important; }
}

/* rc-1.1b: full map from 1.4 (patch-1.4-map). */
.map-box { width: min(1700px, 100%); height: min(100%, calc(100dvh - 24px)); display: flex; flex-direction: column; gap: 10px; }
.map-box h2 { margin: 0; }
.map-wrap { display: flex; gap: 16px; align-items: stretch; min-height: 0; flex: 1 1 auto; }
.map-stage { flex: 1 1 auto; min-width: 160px; min-height: 0; display: flex; align-items: center; justify-content: center; }
#map-canvas { image-rendering: pixelated; display: block; }
.map-legend { flex: 0 1 340px; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.map-legend li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.3; color: var(--muted); opacity: .6; }
.map-legend li.on { opacity: 1; color: var(--ink); }
.map-legend li canvas { flex: none; width: 24px; height: 24px; }
.map-legend b { color: var(--ink); }
.map-hint, .map-pick { margin: 0; text-align: center; }
.map-pick { color: #7dffb0; }
#map-canvas { cursor: crosshair; touch-action: none; }
@media (max-height: 520px) {
  .map-box { padding: 10px 14px; gap: 6px; }
  .map-stage { max-height: calc(100dvh - 110px); }
  .map-legend { max-height: calc(100dvh - 110px); font-size: 12px; }
  .map-hint { display: none; }
  .map-pick { font-size: 12px; }
}
@media (max-width: 560px) {
  .map-wrap { flex-direction: column; }
  .map-stage { flex: none; height: min(calc(100vw - 48px), 52dvh); }
  .map-legend { flex: 1 1 auto; min-height: 0; }
}
