/* v330: unit upgrade window (unit-upgrade.js). Card faces use the game rarity colours of item-rarity.css. */
.uu-tile {
  --uu-medal: radial-gradient(circle at 35% 30%, #fff8dc, #f4d38a 45%, #b9862c);
  --uu-ease: cubic-bezier(.23, 1, .32, 1);
  position: relative;
  cursor: pointer;
  transition: box-shadow .15s var(--uu-ease), transform .15s var(--uu-ease), border-color .15s;
}
.uu-tile:active { transform: scale(.97); }
.uu-tile .activity-team-unit-art { position: relative; }
.uu-tile .activity-team-unit-image { transition: transform .25s var(--uu-ease), filter .2s; }
.uu-veil { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; align-content: center; gap: 6px; border-radius: inherit; background: rgb(8 10 24 / 0%); opacity: 0; pointer-events: none; transition: opacity .16s var(--uu-ease), background .16s; }
.uu-gear { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--uu-medal); color: #2a1c02; box-shadow: 0 6px 14px rgb(0 0 0 / 55%), inset 0 0 0 2px rgb(255 255 255 / 50%); transform: scale(.85) rotate(-30deg); transition: transform .22s var(--uu-ease); }
.uu-gear svg { width: 22px; height: 22px; }
.uu-veil small { font-size: 10.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; transform: translateY(4px); transition: transform .2s var(--uu-ease); }
.activity-banner-team-units .uu-tile:is(:hover, :focus-visible) { border-color: rgb(244 211 138 / 55%); box-shadow: 0 8px 22px -10px rgb(244 211 138 / 70%); outline: none; }
.uu-tile:is(:hover, :focus-visible) .uu-veil { opacity: 1; background: rgb(8 10 24 / 55%); }
.uu-tile:is(:hover, :focus-visible) .uu-gear { transform: none; }
.uu-tile:is(:hover, :focus-visible) .uu-veil small { transform: none; }
.uu-tile:is(:hover, :focus-visible) .activity-team-unit-image { transform: scale(1.06); filter: saturate(1.1); }
.uu-stat { display: flex; align-items: center; gap: 5px; padding: 0 4px; font-size: 10.5px; color: #8a8ea8; white-space: nowrap; font-variant-numeric: tabular-nums; }
.uu-rank { width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--uu-medal); color: #10131f; font-weight: 900; font-size: 10px; }
.uu-rank.is-money { width: auto; padding: 0 6px; border-radius: 999px; font-size: 9.5px; }
.uu-rank.is-none { background: rgb(255 255 255 / 8%); color: #8a8ea8; }
.uu-tier { margin-left: auto; color: #72dfb2; font-weight: 800; }
.uu-tier.is-off { color: #ff8293; }
.uu-tip { position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 30; width: max-content; max-width: 220px; padding: 7px 10px; border-radius: 10px; background: #12152a; box-shadow: 0 0 0 1px rgb(244 211 138 / 40%), 0 10px 24px rgb(0 0 0 / 55%); font-size: 12px; pointer-events: none; opacity: 0; transform: translate(-50%, 4px) scale(.96); transform-origin: 50% 100%; transition: opacity .14s var(--uu-ease), transform .18s var(--uu-ease); }
.uu-tip b { display: block; color: #f4d38a; font-size: 12.5px; }
.uu-tip span { color: #b7b6cc; font-size: 11px; }
.uu-tip::after { content: ""; position: absolute; left: 50%; top: 100%; width: 10px; height: 10px; background: #12152a; transform: translate(-50%, -50%) rotate(45deg); box-shadow: 1px 1px 0 rgb(244 211 138 / 40%); }
.uu-tile:is(:hover, :focus-visible) .uu-tip { opacity: 1; transform: translate(-50%, 0) scale(1); }
.uu-tile.uu-dirty::before { content: ""; position: absolute; top: -3px; left: -3px; z-index: 6; width: 10px; height: 10px; border-radius: 50%; background: #f4d38a; box-shadow: 0 0 0 2px #0d1020; }
@media (hover: none) { .uu-tip { display: none; } }

/* window */
html.uu-lock { overflow: hidden; }
.uu-backdrop {
  --ink: #f0edff; --soft: #b7b6cc; --dim: #8a8ea8; --gold: #f4d38a; --green: #72dfb2; --red: #ff8293; --sky: #7fd8ff; --violet: #c6a8ff;
  --well: rgb(6 8 18 / 55%); --lit-hi: #6ff0a6; --lit-lo: #1f9a58;
  --uu-medal: radial-gradient(circle at 35% 30%, #fff8dc, #f4d38a 45%, #b9862c); --uu-ease: cubic-bezier(.23, 1, .32, 1);
  position: fixed; inset: 0; z-index: 1000; display: none; place-items: start center; overflow-y: auto; padding: 28px 16px; background: rgb(4 5 12 / 62%); backdrop-filter: blur(3px); color: var(--ink);
}
.uu-backdrop.is-open { display: grid; animation: uu-fade .18s var(--uu-ease); }
@keyframes uu-fade { from { opacity: 0; } }
.uu-backdrop button { font: inherit; }
.uu-dialog { width: min(1040px, 100%); border-radius: 20px; background: linear-gradient(165deg, rgb(27 30 54 / 97%), rgb(14 17 32 / 97%)); border: 1px solid rgb(152 140 203 / 20%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%), 0 30px 80px rgb(0 0 0 / 55%); animation: uu-pop .22s var(--uu-ease); }
@keyframes uu-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.uu-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; }
.uu-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.uu-sub { margin: 2px 0 0; color: var(--soft); font-size: 12px; }
.uu-close { margin-left: auto; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgb(152 140 203 / 20%); background: var(--well); color: var(--soft); font-size: 18px; cursor: pointer; }
.uu-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 20px; padding: 9px 12px; border-radius: 12px; background: var(--well); color: var(--soft); font-size: 12px; }
.uu-legend b { color: var(--ink); }
.uu-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; border-radius: 3px; }
.uu-key-green { background: linear-gradient(180deg, #6ff0a6, #1f9a58); }
.uu-key-medal { background: var(--uu-medal); border-radius: 50% !important; }
.uu-legend .uu-gold, .uu-gold { color: var(--gold); }
.uu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 16px 20px; }
@media (max-width: 860px) { .uu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .uu-grid { grid-template-columns: minmax(0, 1fr); padding: 12px; } .uu-backdrop { padding: 10px 8px; } .uu-legend { margin: 0 12px; } }

.uu-unit { --glow: #9aa0b6; --fill: linear-gradient(165deg, #9aa0b6, #3d4256 78%);
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: rgb(10 13 26 / 70%); box-shadow: 0 0 0 1px rgb(255 255 255 / 7%); scroll-margin: 24px; transition: box-shadow .3s var(--uu-ease); }
.uu-unit[data-rarity="rare"] { --glow: #3fa8ff; --fill: linear-gradient(165deg, #5cc0ff, #163f96 80%); }
.uu-unit[data-rarity="epic"] { --glow: #b16cff; --fill: linear-gradient(165deg, #c891ff, #4a1d9c 80%); }
.uu-unit[data-rarity="legendary"] { --glow: #ffbf3a; --fill: linear-gradient(165deg, #ffd864, #b0560c 80%); }
.uu-unit[data-rarity="mythic"] { --glow: #ff6ad5; --fill: linear-gradient(155deg, #ff7ad9 0%, #b16cff 42%, #3f8dff 100%); }
.uu-unit[data-rarity="secret"] { --glow: #ff3344; --fill: linear-gradient(165deg, #ff4252 0%, #7a0716 55%, #160006 100%); }
.uu-unit.is-dirty { box-shadow: 0 0 0 1px rgb(244 211 138 / 55%); }
.uu-unit.is-picked { animation: uu-picked 1.4s var(--uu-ease); }
@keyframes uu-picked { 0%, 40% { box-shadow: 0 0 0 2px var(--gold), 0 0 26px -4px var(--gold); } }
.uu-face { position: relative; isolation: isolate; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 12px; background: var(--fill); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 26%), inset 0 1px 0 rgb(255 255 255 / 40%), 0 8px 18px -10px var(--glow); }
.uu-face::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(90% 60% at 30% 0%, rgb(255 255 255 / 32%), transparent 70%), repeating-linear-gradient(135deg, rgb(255 255 255 / 7%) 0 2px, transparent 2px 9px), linear-gradient(180deg, transparent 45%, rgb(0 0 0 / 48%)); }
.uu-art { position: relative; width: 92px; height: 92px; overflow: hidden; border-radius: 12px; background: rgb(0 0 0 / 30%); box-shadow: inset 0 0 0 2px rgb(255 255 255 / 55%), 0 4px 10px rgb(0 0 0 / 45%); }
.uu-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.uu-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 32px; font-weight: 900; color: rgb(255 255 255 / 70%); }
.uu-lv { position: absolute; left: 5px; top: 4px; z-index: 1; padding: 0 6px; border-radius: 999px; background: rgb(0 0 0 / 60%); font-size: 11px; font-weight: 800; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 22%); }
.uu-who { min-width: 0; align-self: center; padding-right: 38px; }
.uu-name { font-size: 16px; font-weight: 800; line-height: 1.2; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / 80%), 0 0 6px rgb(0 0 0 / 40%); overflow-wrap: anywhere; }
.uu-rar { margin-top: 3px; font-size: 11px; font-weight: 700; color: rgb(255 255 255 / 85%); text-shadow: 0 1px 2px rgb(0 0 0 / 80%); }
.uu-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.uu-pill { padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / 52%); color: #fff; font-size: 11px; font-weight: 700; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 18%); font-variant-numeric: tabular-nums; }
.uu-pill.is-gold { color: var(--gold); }
.uu-medal { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--uu-medal); color: #10131f; font-size: 15px; font-weight: 900; box-shadow: 0 2px 6px rgb(0 0 0 / 50%), inset 0 0 0 2px rgb(255 255 255 / 45%); }
.uu-medal.is-none { background: rgb(0 0 0 / 50%); color: rgb(255 255 255 / 70%); }
.uu-medal.is-money { width: auto; height: 26px; top: auto; bottom: 8px; padding: 0 10px; border-radius: 999px; font-size: 11px; }

.uu-body { flex: 1; display: grid; align-content: start; gap: 10px; padding: 10px 12px 12px; }
.uu-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--soft); }
.uu-label { margin-right: auto; }
.uu-row button { min-width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgb(255 255 255 / 6%); color: var(--soft); font-weight: 800; cursor: pointer; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%); transition: transform .12s var(--uu-ease); font-variant-numeric: tabular-nums; }
.uu-row button:active { transform: scale(.95); }
.uu-order button.is-on { color: #10131f; background: var(--uu-medal); box-shadow: 0 2px 6px rgb(0 0 0 / 40%); }
.uu-quick button { padding: 0 10px; font-size: 11px; }
.uu-quick button.is-on { color: var(--ink); background: rgb(198 168 255 / 14%); box-shadow: inset 0 0 0 1px var(--violet); }

.uu-bar { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; }
.uu-seg { display: grid; gap: 4px; padding: 0; border: 0; background: none; color: var(--dim); cursor: pointer; }
.uu-cell { height: 26px; display: grid; place-items: center; border-radius: 7px; background: rgb(255 255 255 / 6%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%); font-size: 12px; font-weight: 900; transition: transform .12s var(--uu-ease); font-variant-numeric: tabular-nums; }
.uu-seg:active .uu-cell { transform: scale(.92); }
.uu-yen { font-size: 10px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.uu-seg.is-on .uu-cell { background: linear-gradient(180deg, var(--lit-hi), var(--lit-lo)); color: #052014; box-shadow: 0 0 10px -3px var(--lit-hi), inset 0 1px 0 rgb(255 255 255 / 45%); }
.uu-seg.is-on .uu-yen { color: var(--gold); }
.uu-seg.is-new .uu-cell::after { content: "✦"; margin-left: 2px; font-size: 9px; color: #fff3c4; }
.uu-seg.is-new:not(.is-on) .uu-cell::after { color: var(--gold); }
.uu-seg.is-focus .uu-cell, .uu-seg:focus-visible .uu-cell { outline: 2px solid #fff; outline-offset: 1px; }
.uu-seg:focus-visible { outline: none; }
.uu-detail { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--well); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 6%); }
.uu-tag { font-size: 11px; font-weight: 800; color: var(--dim); }
.uu-detail b { display: block; font-size: 13px; color: #fff; }
.uu-detail b.is-new { color: var(--gold); }
.uu-detail div span { display: block; font-size: 11px; color: var(--soft); }
.uu-price { font-size: 16px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.uu-missing { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--well); color: var(--dim); font-size: 12px; }

.uu-savebar { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px dashed rgb(255 255 255 / 9%); }
.uu-spend { font-size: 11px; color: var(--soft); }
.uu-spend b { display: block; font-size: 17px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.uu-state { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--green); }
.uu-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.uu-state.is-dirty { color: var(--gold); }
.uu-state.is-saving { color: var(--sky); }
.uu-state.is-failed { color: var(--red); }
.uu-save { height: 34px; padding: 0 14px; border: 0; border-radius: 10px; background: linear-gradient(180deg, var(--lit-hi), var(--lit-lo)); color: #052014; font-weight: 900; cursor: pointer; box-shadow: 0 4px 12px -6px var(--lit-hi), inset 0 1px 0 rgb(255 255 255 / 45%); transition: transform .12s var(--uu-ease), opacity .15s; }
.uu-save:active { transform: scale(.96); }
.uu-save:disabled { opacity: .35; cursor: default; box-shadow: none; }

.uu-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 20px 16px; border-top: 1px solid rgb(255 255 255 / 6%); }
.uu-sum { font-size: 12px; color: var(--soft); }
.uu-sum b { display: block; color: var(--gold); font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.uu-saveall { margin-left: auto; height: 42px; padding: 0 20px; border-radius: 12px; border: 1px solid rgb(111 240 166 / 45%); background: rgb(111 240 166 / 10%); color: var(--green); font-weight: 900; cursor: pointer; }
.uu-saveall:disabled { opacity: .35; cursor: default; }
.uu-note { margin: 0; padding: 0 20px 16px; color: var(--dim); font-size: 11px; }
.uu-confirm { position: fixed; inset: 0; z-index: 1001; display: grid; place-items: center; background: rgb(0 0 0 / 50%); }
.uu-confirm[hidden] { display: none; }
.uu-confirm > div { width: min(360px, 90vw); padding: 16px; border-radius: 16px; background: linear-gradient(165deg, rgb(27 30 54), rgb(14 17 32)); border: 1px solid rgb(244 211 138 / 40%); }
.uu-confirm p { margin: 0 0 12px; }
.uu-btns { display: flex; justify-content: flex-end; gap: 8px; }
.uu-btns button { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid rgb(152 140 203 / 20%); background: var(--well); color: var(--ink); font-weight: 800; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .uu-tile, .uu-tile *, .uu-backdrop, .uu-backdrop * { animation: none !important; transition: none !important; } }
/* v331: stepper for units whose tiers are not known yet */
.uu-stepper { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--soft); }
.uu-stepper button { width: 34px; height: 30px; border: 0; border-radius: 9px; background: rgb(255 255 255 / 6%); color: var(--ink); font-size: 16px; font-weight: 900; cursor: pointer; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%); }
.uu-stepper button:disabled { opacity: .35; cursor: default; }
.uu-stepper b { min-width: 44px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(180deg, var(--lit-hi), var(--lit-lo)); color: #052014; font-weight: 900; font-variant-numeric: tabular-nums; }

/* v679 วางกี่ตัว row (mint = placing, red = never placed) */
.uu-placerow button { padding: 0 9px; font-size: 11px; }
.uu-placerow button.is-on { color: #06281b; background: #72dfb2; box-shadow: none; }
.uu-placerow button.is-on[aria-label="ไม่วางตัวนี้"] { color: #fff; background: #d9475a; }
.uu-tier.uu-place { color: #72dfb2; }
.uu-tier.uu-place.is-off { color: #ff8a8a; }
