.commander-select {
  --commander-inset:24px;
  --commander-card-height:234px;
  --commander-preview-width:clamp(44px,13vw,58px);
  --commander-preview-height:112px;
  position:relative; isolation:isolate; width:100%; height:100svh; height:100dvh;
  overflow:hidden; background:#07131d; color:var(--paper); touch-action:pan-y; user-select:none;
  animation:commander-page-in .38s ease-out both;
}
.commander-worlds,.commander-scene,.commander-background,.commander-select-shade { position:absolute; inset:0; pointer-events:none; }
.commander-scene { overflow:hidden; }
.commander-background {
  width:100%; height:100%; object-fit:cover; opacity:0;
  filter:brightness(.78) saturate(.9) blur(1px); transform:scale(1.04);
  transition:opacity 440ms ease;
}
[data-commander-art="culture"] .commander-background { object-position:62% center; }
[data-commander-art="idiran"] .commander-background { object-position:48% center; filter:brightness(.72) saturate(.8) blur(1.2px); }
[data-commander-art="independent"] .commander-background { object-position:51% center; filter:brightness(.68) saturate(.85) blur(1px); }
.commander-figure {
  position:absolute; opacity:0; transform:translateX(-22px); transform-origin:50% 65%;
  transition:opacity 350ms ease,transform 440ms var(--ease);
}
.commander-figure img {
  display:block; width:100%; height:100%; object-fit:contain;
  animation:commander-drift 9s ease-in-out infinite;
  filter:drop-shadow(0 0 2px #d1e6e526) drop-shadow(0 14px 22px #02080c60);
}
[data-commander-art="culture"] .commander-figure { width:128%; height:35%; left:-14%; top:25%; }
[data-commander-art="idiran"] .commander-figure { width:102%; height:89%; left:-1%; bottom:0; }
[data-commander-art="independent"] .commander-figure { width:104%; height:91%; left:-4%; bottom:0; }
[data-commander-art="idiran"] .commander-figure img,[data-commander-art="independent"] .commander-figure img {
  object-fit:cover; object-position:center top; animation:commander-breathe 8s ease-in-out infinite;
}
.commander-scene.is-current .commander-background { opacity:1; }
.commander-scene.is-current .commander-figure { opacity:1; transform:translateX(0); transition-delay:65ms; }
.commander-scene:not(.is-current) .commander-figure img { animation-play-state:paused; }
.commander-select-shade {
  z-index:2;
  background:linear-gradient(180deg,#03111d95 0%,#03111d00 22%,#03111d00 42%,#04101b30 54%,#04101bc9 80%,#04101bf2 100%);
}
.commander-select-header {
  position:absolute; z-index:5; left:var(--commander-inset); right:var(--commander-inset); top:calc(18px + var(--safe-top));
  display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:8px;
  text-shadow:0 2px 12px #0009;
}
.commander-select-header h1 { margin:0; text-align:center; font:600 21px/1.1 var(--font-ui); letter-spacing:.02em; }
.commander-select-header .icon-button { width:44px; height:44px; }
.commander-select-arrow {
  position:absolute; top:35%; z-index:4; width:44px; height:54px;
  display:grid; place-items:center; border:0; padding:0; color:var(--paper);
  background:transparent; transition:background .16s,color .16s;
}
.commander-select-arrow .icon { width:25px; height:25px; filter:drop-shadow(0 1px 4px #000); }
.commander-select-previous { left:var(--commander-inset); }
.commander-select-next { right:var(--commander-inset); }
.commander-select-arrow:hover { background:#a6d4ea20; }
.commander-select-arrow:active { background:var(--paper); color:var(--ink); }
.commander-select-controls {
  position:absolute; z-index:5; left:var(--commander-inset); right:var(--commander-inset);
  bottom:calc(100px + var(--safe-bottom)); pointer-events:none;
}
.commander-card-fan {
  display:grid; grid-template-columns:minmax(0,1fr) repeat(2,var(--commander-preview-width));
  gap:8px; align-items:center; width:min(100%,520px); height:var(--commander-card-height);
}
.commander-select-identity,.player-sheet .commander-card-content {
  background:linear-gradient(140deg,#1a3545e6,#091b28ee 80%);
  backdrop-filter:blur(15px); -webkit-backdrop-filter:blur(15px);
  box-shadow:0 10px 28px #01081070;
}
.commander-select-identity {
  position:relative; grid-row:1; min-width:0; isolation:isolate; padding:15px 12px 36px; border:0;
  pointer-events:auto;
  transform-origin:top left; transition:filter .25s,opacity .25s;
}
.commander-select-identity[data-card-position="0"] { grid-column:1; z-index:2; height:var(--commander-card-height); }
.commander-select-identity[data-card-position="1"] { grid-column:2; }
.commander-select-identity[data-card-position="2"] { grid-column:3; }
.commander-select-identity:not(.is-current) { height:var(--commander-preview-height); filter:brightness(.73); padding:7px 3px; display:grid; align-items:center; }
.commander-select-identity::before {
  content:""; position:absolute; inset:0; z-index:2; pointer-events:none; opacity:0;
  background:linear-gradient(115deg,transparent 28%,#b8edff24 48%,transparent 68%);
  background-size:245% 100%;
  clip-path:inset(0);
}
.commander-select-identity.is-current::before { animation:commander-card-shimmer .65s ease-out; }
.commander-select-identity:has(.commander-card-select:focus-visible) { outline:2px solid #b3e4fa; outline-offset:4px; }
.commander-card-select { position:absolute; inset:0; z-index:3; padding:0; background:none; border:0; border-radius:0; }
.commander-card-select:active { transform:none; }
.commander-card-select:focus-visible { outline:0; }
.commander-select-identity .commander-card-content { pointer-events:none; }
.commander-banner-heading { display:grid; grid-template-columns:34px minmax(0,1fr) 25px; gap:8px; align-items:center; }
.commander-banner-portrait { width:34px; height:34px; overflow:hidden; border-radius:50%; border:2px solid #a3ddf2; box-shadow:0 0 0 3px #6995b526; }
.commander-banner-portrait img { display:block; width:100%; height:100%; object-fit:cover; }
.commander-card-content p,.commander-card-content h2 { margin:0; }
.commander-card-content .commander-select-faction { font:600 10px/1.1 var(--font-ui); letter-spacing:.17em; text-transform:uppercase; color:#a9def2; margin-bottom:5px; }
.commander-card-content h2 { font:400 clamp(15px,4.2vw,19px)/1.15 var(--font-display); letter-spacing:-.035em; }
.commander-card-health.commander-health-badge { width:25px; height:27px; padding-bottom:5px; font-size:17px; }
.commander-faction-short { display:none; }
.commander-banner-details { margin:15px 0 0; padding:0; border:0; }
.commander-banner-details dt { color:#afc9d7; font:600 10px/1 var(--font-ui); letter-spacing:.12em; text-transform:uppercase; }
.commander-banner-details dd { margin:5px 0 0; }
.commander-banner-details dd strong { color:#e6f3f9; font:600 17px/1.12 var(--font-ui); }
.commander-banner-ability dd p { margin-top:5px; color:#c8d6df; font-size:13px; line-height:1.3; }
.commander-starter-button { position:absolute; z-index:4; right:13px; bottom:-16px; width:60px; height:64px; padding:0; border:0; background:transparent; display:grid; place-items:center; }
.commander-starter-stack { position:relative; display:block; width:32px; height:47px; transform:rotate(-7deg); transition:transform .22s; }
.commander-starter-button:hover .commander-starter-stack { transform:translateY(-4px) rotate(-3deg); }
.commander-starter-button:active .commander-starter-stack { transform:translateY(-1px) scale(.96); }
.commander-starter-count { position:absolute; bottom:1px; right:3px; border:1px solid #bdd0ce; border-radius:50%; background:#0d2332; color:var(--paper); width:23px; height:23px; display:grid; place-items:center; font-family:var(--font-ui); font-size:13px; }
.commander-select-identity:not(.is-current) .commander-starter-button { visibility:hidden; }
.commander-select-identity:not(.is-current) .commander-banner-heading { display:flex; flex-direction:column; gap:8px; text-align:center; }
.commander-select-identity:not(.is-current) :is(.commander-banner-details,.commander-select-faction,[data-commander-name],.commander-card-health) { display:none; }
.commander-select-identity:not(.is-current) .commander-faction-short { display:block; color:#d1e5ee; font:600 11px/1 var(--font-ui); }
.commander-start.button { position:absolute; z-index:6; right:var(--commander-inset); bottom:calc(22px + var(--safe-bottom)); min-width:154px; min-height:52px; justify-content:space-between; padding:12px 22px; text-transform:uppercase; letter-spacing:.1em; }
.commander-start .icon { width:18px; height:18px; }
.commander-starter-preview { position:absolute; inset:0; z-index:20; background:#030b167a; backdrop-filter:blur(15px); -webkit-backdrop-filter:blur(15px); animation:commander-preview-in .2s ease-out; user-select:text; }
.commander-starter-preview[hidden] { display:none; }
.commander-starter-close { position:absolute; top:calc(16px + var(--safe-top)); right:var(--commander-inset); z-index:2; width:40px; height:40px; display:grid; place-items:center; padding:0; color:#d9e9ee; }
.commander-starter-close .icon { width:21px; height:21px; }
.commander-starter-scroll { height:100%; overflow:auto; overscroll-behavior:contain; padding:calc(80px + var(--safe-top)) 25px calc(38px + var(--safe-bottom)); scrollbar-width:thin; scrollbar-color:#55717b transparent; }
.commander-starter-preview .commander-starter-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:1fr; gap:32px 22px; max-width:1120px; margin:0 auto; align-items:stretch; }
.commander-starter-preview .commander-starter-card { display:block; min-width:0; width:100%; height:100%; border:0; background:transparent; padding:0; text-align:initial; transition:transform .15s; align-self:stretch; }
.commander-starter-card:hover { transform:translateY(-3px); }
.commander-starter-card:active { transform:scale(.98); }
.commander-select.has-starter-preview .commander-figure img { animation-play-state:paused; }
@media(hover:hover) { .commander-select-identity:not(.is-current):hover { filter:brightness(.88); } }
@keyframes commander-drift { 0%,100%{transform:translateY(0) rotate(-.2deg)} 50%{transform:translateY(-5px) rotate(.2deg)} }
@keyframes commander-breathe { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-2px) scale(1.004)} }
@keyframes commander-page-in { from{opacity:0} to{opacity:1} }
@keyframes commander-preview-in { from{opacity:0} to{opacity:1} }
@keyframes commander-card-shimmer { 0%{opacity:0;background-position:100% 0} 30%{opacity:1} 100%{opacity:0;background-position:0 0} }
@media(min-width:600px) { .commander-starter-preview .commander-starter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:38px 26px; } }
@media(min-width:900px),(min-width:650px) and (max-height:500px) {
  .commander-select { --commander-inset:clamp(24px,4vw,72px); --commander-card-height:226px; --commander-preview-height:172px; }
  .commander-select-header { top:calc(25px + var(--safe-top)); }
  .commander-select-header h1 { font-size:24px; }
  .commander-select-controls { bottom:calc(110px + var(--safe-bottom)); }
  .commander-card-fan { grid-template-columns:minmax(0,1.58fr) repeat(2,minmax(0,1fr)); width:min(100%,838px); gap:16px; }
  .commander-select-identity { padding:17px 15px 42px; }
  .commander-select-identity h2 { font-size:23px; }
  .commander-banner-heading { grid-template-columns:43px minmax(0,1fr) 29px; }
  .commander-banner-portrait { width:43px; height:43px; }
  .commander-banner-details { margin-top:18px; }
  .commander-banner-ability dd p { font-size:14px; }
  .commander-select-identity:not(.is-current) { display:block; padding:16px 13px; }
  .commander-select-identity:not(.is-current) .commander-banner-heading { display:grid; grid-template-columns:34px minmax(0,1fr); text-align:left; }
  .commander-select-identity:not(.is-current) .commander-banner-portrait { width:34px; height:34px; }
  .commander-select-identity:not(.is-current) :is(.commander-select-faction,[data-commander-name]) { display:block; }
  .commander-select-identity:not(.is-current) .commander-faction-short { display:none; }
  .commander-select-identity:not(.is-current) h2 { font-size:17px; }
  .commander-select-identity:not(.is-current) .commander-banner-details { display:block; margin-top:16px; }
  .commander-select-identity:not(.is-current) .commander-banner-ability dd p { display:none; }
  .commander-select-identity:not(.is-current) .commander-banner-details dd strong { font-size:15px; }
  [data-commander-art="culture"] .commander-figure { left:11%; top:13%; width:78%; height:57%; }
  [data-commander-art="idiran"] .commander-figure,[data-commander-art="independent"] .commander-figure { left:42%; bottom:0; width:58%; height:95%; }
  [data-commander-art="idiran"] .commander-figure img,[data-commander-art="independent"] .commander-figure img { object-fit:contain; object-position:center bottom; }
  .commander-select-shade { background:linear-gradient(90deg,#04101b90 0%,#04101b22 48%,#04101b00 68%),linear-gradient(180deg,#04101b55 0%,transparent 25%,transparent 55%,#04101bdd 100%); }
  .commander-start.button { bottom:calc(30px + var(--safe-bottom)); }
  .commander-starter-preview .commander-starter-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:38px 28px; }
}
@media(max-width:359px),(max-height:650px) {
  .commander-select { --commander-inset:18px; --commander-card-height:242px; }
  .commander-select-header { top:calc(12px + var(--safe-top)); }
  .commander-select-header h1 { font-size:19px; }
  .commander-select-arrow { top:18%; }
  .commander-select-controls { bottom:calc(88px + var(--safe-bottom)); }
  .commander-select-identity { padding:13px 12px 32px; }
  .commander-banner-heading { grid-template-columns:34px minmax(0,1fr) 25px; gap:8px; }
  .commander-banner-portrait { width:34px; height:34px; }
  .commander-select-identity h2 { font-size:15px; }
  .commander-banner-details { margin-top:15px; }
  .commander-banner-ability dd p { font-size:12px; }
  .commander-banner-details dt { font-size:9px; }
  .commander-banner-details dd strong { font-size:16px; }
  .commander-start.button { min-height:48px; bottom:calc(16px + var(--safe-bottom)); }
}
@media(min-width:650px) and (max-height:500px) {
  .commander-select { --commander-card-height:210px; --commander-preview-height:160px; }
  .commander-select-controls { bottom:calc(90px + var(--safe-bottom)); }
  .commander-starter-preview .commander-starter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
.player-sheet > header { margin-bottom:10px; }
.player-sheet .commander-card-content { padding:16px 14px; }
.player-sheet .commander-banner-heading { grid-template-columns:40px minmax(0,1fr) 25px; }
.player-sheet .commander-banner-portrait { width:40px; height:40px; }
.player-sheet .commander-banner-details {
  margin-top:16px;
}
@media(prefers-reduced-motion:reduce) { .commander-select,.commander-select *,.commander-select *:before,.commander-select *:after { animation:none!important; transition:none!important; } }
.reduce-motion .commander-select,.reduce-motion .commander-select *,.reduce-motion .commander-select *:before,.reduce-motion .commander-select *:after { animation:none!important; transition:none!important; }

.commander-deck-choice.button {
  position: absolute;
  z-index: 6;
  left: var(--commander-inset);
  bottom: calc(22px + var(--safe-bottom));
  max-width: calc(100% - 2 * var(--commander-inset) - 138px);
  min-height: 52px;
  gap: .5rem;
  padding-inline: .6rem;
  letter-spacing: .024em;
}
.commander-deck-choice[hidden] { display: none; }
.commander-deck-choice:not([hidden]) + .commander-start.button { min-width: 126px; }
.commander-deck-choice .icon { flex-shrink: 0; }
.commander-deck-name { overflow-wrap: anywhere; white-space: normal; text-align: left; line-height: 1.12; }
.commander-deck-options b {
  margin-left: auto;
  padding-left: .35rem;
  color: #b4def0;
  font-variant-numeric: tabular-nums;
}
.commander-deck-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: .5rem;
  max-width: 1120px;
  margin: 0 auto 1.5rem;
}
.commander-deck-options .button {
  min-height: 46px;
  justify-content: space-between;
  padding-inline: .65rem;
  background: #10202bec;
}
.commander-deck-options [aria-pressed="true"] {
  border-color: #83cce5;
  background: #203a4b;
}
@media(min-width:900px) {
  .commander-deck-choice.button { bottom: calc(30px + var(--safe-bottom)); }
}
@media(max-height:720px) {
  .commander-deck-choice.button { min-height: 48px; bottom: calc(16px + var(--safe-bottom)); }
}
