:root {
  color-scheme: dark;
  --bg: #0c1019;
  --panel: #151d2b;
  --inset: #101724;
  --line: #2a364b;
  --line-soft: #222d3f;
  --text: #f0f3f9;
  --muted: #a7b3c9;
  --subtle: #8290ab;
  --gold: #ffcd67;
  --blue: #91b9ff;
  --cyan: #66d8ba;
  --lilac: #dab0ff;
  font: 16px/1.45 Inter, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box }
body { margin: 0; min-width: 290px }
button, input, select { font: inherit }
button, a { -webkit-tap-highlight-color: transparent }
button { color: inherit; cursor: pointer }
a { color: inherit; text-decoration: none }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px }
button:disabled { cursor: wait }
[hidden] { display: none !important }
h1, h2, h3, p { margin: 0 }
svg { display: block; width: 1.15em; height: 1.15em; flex: none }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; font-style: normal }
.shell { width: min(1320px, calc(100% - 72px)); margin-inline: auto }

.topbar { background: #101622; border-bottom: 1px solid var(--line-soft) }
.topbar-inner { height: 63px; display: flex; align-items: center; justify-content: space-between }
.wordmark { display: flex; align-items: center; gap: .65rem; font-size: 1.19rem; font-weight: 900; letter-spacing: -.05em }
.brand-icon { width: 34px; height: 34px; background: var(--gold); border-radius: 9px; color: #141721; box-shadow: inset 0 -3px 0 #d9a647 }
.brand-accent { color: var(--gold) }
nav { align-items: center; display: flex; gap: 1.65rem; height: 100%; color: var(--muted); font-weight: 650; font-size: .88rem }
nav > * { height: 100% }
.nav-current { display: flex; align-items: center; color: var(--gold); border-bottom: 2px solid var(--gold); padding-top: 2px }
.nav-button, .plain { border: 0; background: transparent; padding: 0; color: var(--muted) }
.nav-button { display: flex; align-items: center; gap: .4rem; position: relative; white-space: nowrap }
.nav-button:hover, .plain:hover, .footer a:hover { color: var(--gold) }
.nav-count { color: var(--gold) }

.banner {
  margin: 25px 0 28px;
  min-height: 218px;
  display: flex;
  align-items: center;
  isolation: isolate;
  border: 1px solid #354969;
  border-radius: 16px;
  background: linear-gradient(90deg, #121b2a 3%, #121b2aeb 20%, #121b2a28 58%, #222b3b0d), #151d2b url("arena.webp") right 48% / cover no-repeat;
  box-shadow: 0 14px 36px #0003, inset 0 1px 0 #a2c6fc24;
}
.banner-copy { padding: 28px 42px }
.eyebrow { color: var(--gold); font-weight: 800; font-size: .76rem; letter-spacing: .12em; display: flex; align-items: center; gap: .5rem }
.banner h1 { font-size: clamp(3rem, 6.7vw, 6.8rem); line-height: .99; letter-spacing: -.085em; margin: .25rem 0 .45rem; font-weight: 950; text-shadow: 0 4px 0 #070e1a, 0 10px 24px #040810 }
.banner h1 span { color: var(--gold); margin-left: .07em }
.banner-description { color: #cbd7eb; font-size: 1rem }

.workspace { display: grid; grid-template-columns: 252px minmax(0, 1fr); align-items: start; gap: 22px; scroll-margin-top: 20px }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px }
.settings { padding: 19px 16px 14px }
.settings h2 { font-size: 1.02rem; display:flex; align-items:center; gap: .57rem; margin-bottom: 18px; letter-spacing: -.02em }
.settings h2 [data-icon] { color: var(--gold) }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0 }
legend, .select-label { color: #d7dfef; font-size: .875rem; font-weight: 700; margin-bottom: 6px; padding: 0 }
.variance-field, .select-label { margin-top: 15px }
.setting-hint { color: var(--muted); font-size: .79rem; margin: 7px 0 0; min-height: 34px }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #0d1420; gap: 3px }
.segmented label { flex: 1; position: relative; min-width: 0 }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0 }
.segmented label span { min-height: 32px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .35rem; padding: 3px 5px; color: var(--muted); font-size: .85rem; font-weight: 680; white-space: nowrap }
.segmented input:checked + span { background: #29364a; border-color: #3a4b64; color: var(--text) }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px }
.variance { display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1.3fr) minmax(0,.85fr) }
.variance label span { padding-inline:3px; font-size:.8rem }
.variance input:checked + span { background: #392f26; border-color: #725735; color: var(--gold) }
.select-label { display: block }
select {
  display:block; min-height: 40px; width: 100%; border: 1px solid var(--line);
  padding: 6px 31px 6px 10px; appearance: none; border-radius: 7px; color: var(--text); background: #101724 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m2 2 4 4 4-4' fill='none' stroke='%23a7b3c9' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") right 10px center / 12px auto no-repeat; font-size: .875rem;
}
.preferences { display: flex; width: 100%; align-items: center; gap: .46rem; margin: 12px 0; padding: 5px 0; background: transparent; border: 0; color: var(--muted); font-size: .86rem; text-align: left }
.preferences:hover { color: var(--gold) }
.pref-count { margin-left:auto; color: var(--gold); font-size: .75rem; background: #423323; padding: 0 5px; border-radius: 5px }
.roll-button { display: flex; width: 100%; justify-content: center; gap: .45rem; align-items: center; min-height: 47px; font-size: .96rem; font-weight: 850; color: #20170d; border: 1px solid #ffdc8c; border-radius: 8px; background: linear-gradient(#ffda79, #ffbe52); box-shadow: inset 0 -3px #d69538, 0 4px 18px #f7a93223; transition: filter .16s, transform .16s }
.roll-button:hover { filter: brightness(1.09); transform: translateY(-1px) }
.roll-button:active { transform: translateY(1px) }
.shortcut { text-align: center; color: var(--subtle); font-size: .77rem; margin-top: 8px }
kbd { border: 1px solid #3b465b; border-radius: 4px; padding: 0 .3em; background: var(--inset); font: inherit; color: #c8d3e8 }

.result { min-width: 0 }
.result-heading { display: flex; align-items: end; justify-content: space-between; gap: .75rem; margin: 0 0 12px }
.result-heading h2 { font-size: clamp(1.35rem, 2.8vw, 1.8rem); font-weight: 800; letter-spacing: -.038em; line-height: 1.15 }
.section-kicker { color: var(--subtle); margin-bottom: 3px }
.outline-button, .icon-button { min-height: 34px; padding: .36rem .63rem; background: #171f2e; border: 1px solid #38465d; border-radius: 7px; display: inline-flex; flex: none; align-items: center; justify-content: center; gap: .38rem; font-size: .84rem; font-weight: 720; white-space: nowrap }
.outline-button:hover, .icon-button:hover { border-color: var(--blue); background: #24324a }
.outline-button[aria-pressed="true"] { color: var(--gold); border-color: #775e36 }
.icon-button { width: 36px; padding: 0 }
.lineup { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem),1fr)); gap: 14px }
.lineup.solo { grid-template-columns: minmax(0, 600px) }
.deck { --accent: var(--blue); container: deck / inline-size; padding: 13px 15px 12px; min-width:0; border-top: 2px solid #496da6; background: linear-gradient(180deg,#1b2a41 0,#151d2b 82px); }
.deck:nth-child(2) { --accent: #ffb27b; border-top-color: #a86e51; background: linear-gradient(180deg,#302738 0,#151d2b 82px) }
.deck-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 11px }
.deck-header > div { min-width: 0 }
.player { color: var(--accent); display: flex; gap: .35rem; align-items: center; letter-spacing: .09em; font-weight: 800; font-size: .73rem }
.deck h3 { font-weight: 800; font-size: clamp(.95rem,1.55vw,1.2rem); letter-spacing: -.027em; line-height: 1.15; margin-top: 4px; overflow-wrap: anywhere }
.elixir { display: flex; align-items: center; gap: .27rem; background: #241e35; border: 1px solid #49365f; padding: 3px 7px; border-radius: 7px; color: var(--lilac); font-weight: 800; font-size: .86rem; white-space: nowrap }
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 23rem);
  margin-inline: auto;
  padding: clamp(4px, 1.5cqi, 8px);
  border: 1px solid #344964;
  border-radius: 11px;
  background: #0c1523;
  box-shadow: inset 0 2px 6px #050913;
}
.card-button { --card-bg:#23324a; position: relative; min-width: 0; padding: 2px 3px 4px; border: 1px solid #415473; border-radius: 8px; background: linear-gradient(150deg,var(--card-bg),#172235 90%); font-size: .74rem; display:flex; flex-direction:column; align-items:center; justify-content:space-between; color: #f1f3fa; transition: border-color .16s,background .16s,transform .16s; isolation: isolate }
.card-button:hover { border-color: #afc8ff; transform: translateY(-2px); z-index: 1 }
.card-button.rare { --card-bg:#493337; border-color: #72505b }
.card-button.epic { --card-bg:#3d3053; border-color: #6b527c }
.card-button.legendary { --card-bg:#284650; border-color: #47717e }
.card-button.champion { --card-bg:#494232; border-color: #7f694b }
.card-button.marked { border-color: var(--gold); box-shadow: inset 0 0 0 1px #ffcd6755 }
.card-button.banned { border-color: #e68d92; opacity:.62 }
.card-art { display: block; width: 100%; height: 62px; object-fit: contain; margin-top: 2px; filter: drop-shadow(0 3px 2px #03051058); pointer-events: none }
.card-placeholder { display:flex; justify-content:center; align-items:center; color: var(--blue); min-height: 46px; font-size: 1.6rem; font-weight: 800 }
.card-name { color: #eef2fc; line-height: 1.12; display:flex; align-items:center; justify-content:center; width:100%; min-height: 1.7em; text-align:center; font-weight: 740; overflow-wrap: anywhere }
.cost, .lock-mark { position:absolute; top:4px; height:19px; min-width:19px; border-radius: 50%; display:grid; place-items:center; font-size:.72rem; line-height:1; font-weight:850; z-index:1; box-shadow:0 1px 4px #090713 }
.cost { left:4px; background:#722ca7; border:1px solid #cb92fa; color:#fff }
.lock-mark { right:4px; background:#2b241d; border:1px solid #9c7538; color:var(--gold); padding: 0 3px }
.card-grid .card-button {
  padding: 0;
  justify-content: flex-start;
  border-radius: 7px;
  box-shadow: inset 0 -2px 0 #070e1f70;
}
.card-grid .card-button.marked { box-shadow: inset 0 0 0 1px var(--gold) }
.card-portrait {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.06;
  overflow: hidden;
  border-radius: 6px 6px 0 0;
  background: radial-gradient(ellipse at 55% 40%, #ffffff12, transparent 74%);
}
.card-portrait .card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  transform: scale(1.15);
}
.card-portrait .form-badge {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 1px 5px #03050be0;
}
.card-grid .card-name {
  min-height: 2.5em;
  padding: 2px 3px 4px;
  font-size: clamp(.65rem, 3.2cqi, .78rem);
  background: #0a132288;
  border-radius: 0 0 6px 6px;
  flex: 1;
}
.card-grid .cost, .card-grid .lock-mark { top:3px; z-index:2 }
.card-grid .cost { left:3px }
.card-grid .lock-mark { right:3px }
.deck-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items:center; border-top: 1px solid #2b3649; padding-top: 10px; margin-top: 11px }
.deck-foot p { min-width:0; color:var(--muted); font-size:.8rem }
.deck-foot strong { color:var(--text); font-weight:700 }
.copy-actions { display: flex; align-items: center; gap: .35rem; min-width: 0; max-width: 100% }
.copy-actions button { min-height:32px; font-size:.78rem }
.copy-actions .icon-button { width: 31px }
.team-panel { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; margin-top:13px; padding: 12px 14px; align-items:start; background: linear-gradient(90deg,#172e32,#16242d 65%,#151d2b); border-color:#335450; }
.team-icon { border-radius: 8px; width: 33px; height: 33px; background: #254843; color: var(--cyan) }
.team-top { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.3rem .6rem }
.team-top h3 { font-size: 1rem; letter-spacing: -.02em; }
.team-label { display:inline-flex; align-items:center; gap: .28rem; color:var(--cyan); font-size:.74rem; font-weight:740 }
.team-copy { color:#c1d3da; font-size:.86rem; margin-top:3px }
.coverage-row { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px }
.cover { display:inline-flex; align-items:center; gap:.25rem; color:#bfe3d9; background:#173832; border:1px solid #31574e; border-radius:5px; padding:2px 6px; font-size:.73rem; font-weight:680; white-space:nowrap }
.error { border:1px solid #82464e; border-radius:8px; background:#342831; color:#ffbcb9; padding:9px 13px; margin-bottom:10px; font-size:.9rem }
.footer { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 20px; border-top:1px solid var(--line-soft); margin-top:24px; padding:13px 0 22px; color:var(--subtle); font-size:.79rem }
.footer div { display:flex; flex-wrap:wrap; gap: 5px 16px }
.footer .plain, .footer a { color:var(--muted) }
.footer .plain:hover, .footer a:hover { color:var(--gold) }

dialog { border:1px solid #3e4d66; border-radius:14px; color:var(--text); background:#151d2b; width:min(820px,calc(100% - 24px)); max-height:calc(100% - 32px); padding:0; box-shadow:0 20px 70px #0009; }
dialog::backdrop { background:#050811c9; backdrop-filter: blur(4px) }
dialog[open] { display:flex; flex-direction:column }
.dialog-head { padding:17px 19px 13px; display:flex; justify-content:space-between; align-items:flex-start; border-bottom:1px solid var(--line); gap:.5rem }
.dialog-head h2 { font-size:1.28rem; letter-spacing:-.03em }
.dialog-head p, .dialog-foot { color:var(--muted); font-size:.86rem }
.pool-options { display:grid; grid-template-columns:1fr minmax(110px,155px); gap:8px; padding:11px 17px 5px }
.search-wrap { display:flex; align-items:center; gap:.45rem; padding:0 10px; border:1px solid var(--line); border-radius:7px; background:var(--inset); min-width:0 }
.search-wrap [data-icon] { color:var(--subtle) }
.search-wrap input { color:var(--text); border:0; background:transparent; min-width:0; width:100%; padding:6px 0; outline:none }
.search-wrap:focus-within { outline:2px solid var(--gold); outline-offset:2px }
.pool-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; padding:4px 17px; color:var(--muted); font-size:.85rem }
.pool-segmented { gap:3px; }
.pool-segmented label span { padding-inline:9px }
.pool-actions .plain { margin-left:auto; color:var(--gold) }
.pool-note { color:#ffc6a4; padding:0 17px; font-size:.85rem; }
.pool-note:empty { display:none }
.pool-grid { padding:8px 17px 14px; display:grid; grid-template-columns:repeat(auto-fill, minmax(78px,1fr)); gap:7px; overflow:auto; min-height:125px }
.pool-grid .card-art { height:62px }
.pool-grid .card-button { font-size:.76rem; min-height:92px }
.dialog-foot { padding:10px 17px; display:flex; gap:8px; justify-content:space-between; align-items:center; border-top:1px solid var(--line) }
#method, #saved { width:min(600px,calc(100% - 24px)) }
.method-copy, .saved-list { padding:15px 18px; overflow:auto }
.method-copy p { margin-bottom:.8rem; color:var(--muted) }
.method-copy a { color:var(--blue) }
.saved-row { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--line); margin-bottom:7px; padding:5px 0 10px; gap:8px }
.saved-row strong, .saved-row small { display:block }
.saved-row small { color:var(--muted); margin-top:.15rem }
.saved-row > div:last-child { display:flex; align-items:center; gap:6px }
.toast { position:fixed; z-index:5; right:22px; bottom:20px; max-width:calc(100% - 44px); padding:10px 14px; background:#233249; border:1px solid #4f6589; border-radius:8px; color:var(--text); box-shadow:0 8px 25px #0008 }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0 }
@keyframes reveal { from { opacity:.4; transform:translateY(3px) } to {opacity:1;transform:none} }
.reveal .deck, .reveal .team-panel { animation:reveal .24s both }
.reveal .deck:nth-child(2) { animation-delay:.04s }
@media (max-width: 1040px) {
  .shell { width:calc(100% - 36px) }
  .workspace { grid-template-columns: 218px minmax(0,1fr); gap:15px }
  .lineup { gap:10px }
  .deck { padding-inline:9px }
}
@media (max-width: 880px) {
  .workspace { grid-template-columns:minmax(0,1fr) }
}
@media (max-width: 730px) {
  .settings { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.25fr); gap:8px 12px; padding:13px }
  .settings h2 { grid-column:1/-1; margin:0 0 1px }
  .variance-field { margin:0 }
  .setting-hint { min-height:0; margin:4px 0 0 }
  .select-label { grid-column:1; grid-row:3; margin:0 0 -6px }
  #style { grid-column:1; grid-row:4 }
  .preferences { grid-column:2; grid-row:4; margin:0; }
  .roll-button { grid-column:1/-1; }
  .shortcut { display:none }
  .workspace .result { margin-top:3px }
  .deck { padding-inline:12px }
  .banner { margin:16px 0 16px; min-height:174px; background-position:65% center }
  .banner-copy { padding:20px }
}
@media (max-width: 475px) {
  .shell { width:calc(100% - 24px) }
  .topbar-inner { height:53px }
  nav { gap:12px; font-size:.8rem }
  .nav-current { display:none }
  .wordmark { font-size:1.05rem }
  .brand-icon { width:30px; height:30px }
  .banner { min-height:153px; background-position:57% center }
  .banner-copy { padding:13px }
  .banner h1 { font-size:3.4rem }
  .banner .eyebrow { font-size:.63rem; letter-spacing:.075em }
  .banner-description { font-size:.82rem }
  .pool-actions .plain { margin-left:0 }
  .pool-actions > span { display:none }
  .pool-grid { grid-template-columns:repeat(auto-fill,minmax(69px,1fr)) }
}
@media (max-width: 360px) {
  .settings { display:block }
  .settings h2 { margin-bottom:12px }
  .variance-field, .select-label { margin-top:12px }
  .select-label { margin-bottom:5px }
  .preferences { margin:8px 0 }
  nav { gap:8px }
  .banner .eyebrow { overflow-wrap:anywhere }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation:none !important; scroll-behavior:auto !important; transition:none !important }
}

.tower-card:hover { transform:none }
.pool-grid .tower-card { cursor:default }

.slot-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; margin-top:11px }
.slot-select { min-width:0 }
.slot-select label { display:block; min-height:1.55em; color:var(--blue); font-size:.72rem; font-weight:760; line-height:1.2; overflow-wrap:anywhere }
.slot-select select { min-height:34px; padding-left:6px; padding-right:19px; background-position:right 5px center; background-size:9px auto; font-size:.77rem; text-overflow:ellipsis }
.slot-evo label { color:#e0bbff }
.slot-evo select { border-color:#674486; background-color:#211b30 }
.slot-hero label { color:#ffdf92 }
.slot-hero select { border-color:#795c37; background-color:#2b241f }
.slot-wild label { color:#92e6d3 }
.slot-wild select { border-color:#38695f; background-color:#1a2a2a }
.card-button.form-evo { --card-bg:#482b65; border-color:#9361bf }
.card-button.form-hero { --card-bg:#4a3424; border-color:#ae8150 }
.card-button.form-champion { --card-bg:#515039; border-color:#ae9761 }
.card-button.marked { box-shadow:inset 0 0 0 1px var(--gold) }
.form-badge { border-radius:3px; padding:.12em .36em; font-size:.61rem; line-height:1.15; font-weight:820; letter-spacing:.03em; margin-top:-1px }
.form-badge.evo { color:#ead3ff; background:#592c7b }
.form-badge.hero { color:#ffe6a5; background:#704829 }
.form-badge.champion { color:#fff1b7; background:#625025 }
.form-badge.tower { color:#d5e7ff; background:#31476a }
.import-note { display:flex; align-items:baseline; gap:.45rem; color:var(--muted); font-size:.8rem; margin:.65rem .13rem -.28rem }
.import-note svg { align-self:center; color:var(--blue) }
.pool-preferences { margin-left:auto; color:var(--subtle); font-size:.8rem }
.pool-actions .plain { margin-left:0 }
.pool-grid .form-badge { margin-top:2px }
#qr { width:min(550px,calc(100% - 24px)) }
.qr-content { display:grid; grid-template-columns:minmax(0,216px) minmax(0,1fr); align-items:center; gap:17px; padding:16px; overflow:auto }
#qr-image { display:block; max-width:100%; height:auto; border-radius:8px; background:white }
#qr-slots { list-style:none; margin:9px 0; padding:0; color:var(--text); font-size:.84rem }
#qr-slots strong { color:var(--muted); font-size:.78rem; display:block; margin-top:4px }
.qr-content p { color:var(--muted); font-size:.81rem }
@container deck (min-width: 28rem) {
  .slot-grid { grid-template-columns:repeat(4,minmax(0,1fr)) }
}
@container deck (max-width: 24rem) {
  .copy-actions { width:100% }
  .copy-actions .copy-deck { flex:1 }
}
@media (max-width: 475px) {
  .pool-actions .pool-preferences { display:block; margin-left:0 }
  .qr-content { grid-template-columns:minmax(0,1fr); justify-items:center; text-align:center }
  .qr-content>div { padding-bottom:4px }
}
