/* Magic Trash Can — iPad Mini PWA */
:root {
  --space-black: #0a0a0f;
  --deep-space: #12121a;
  --card: #1a1a2e;
  --surface: #16213e;
  --border: #2a2a4a;
  --gold: #ffd700;
  --gold-dim: #c4a000;
  --text: #e8e8e8;
  --text-2: #aaaaaa;
  --muted: #666680;
  --warning: #ffb74d;
  --danger: #ef5350;
  --ok: #66bb6a;
  --Republic: #1565c0;
  --Separatists: #6a1b9a;
  --Rebels: #e65100;
  --Empire: #37474f;
  --Fringe: #2e7d32;
  --NewRepublic: #00838f;
  --Mandalorian: #546e7a;
  --Sith: #ef5350;
  --Vong: #ab47bc;
  --OldRepublic: #4fc3f7;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tabbar-h: 56px;
  --radius: 12px;
  --touch: 44px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--space-black); color: var(--text); }
html { color-scheme: dark; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; touch-action: manipulation; }
button { cursor: pointer; }
img { display: block; }

#app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  overflow: hidden;
  background: var(--space-black);
}

/* Header */
.topbar {
  flex: 0 0 auto;
  background: var(--deep-space);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px 8px;
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar-row + .topbar-row { margin-top: 6px; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 148px;
}
.brand img {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1.1;
}
.brand-sub { font-size: 11px; color: var(--muted); }
.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.field span, .field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field-label { margin: 8px 0 6px; }
.name-field { flex: 1 1 140px; }
.faction-field { flex: 0 1 150px; }
.field input, .field select, .filters input {
  height: var(--touch);
  min-height: var(--touch);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
                    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 10px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field input:focus, .field select:focus, .filters input:focus {
  border-color: var(--gold);
}
.header-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.btn {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.btn:active { transform: scale(0.97); }
.btn-gold {
  background: var(--gold);
  color: #1a1400;
  border-color: var(--gold);
}
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: #5a2a32; }
.btn[disabled] { opacity: 0.45; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.scroll-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 10px 8px;
  scrollbar-width: none;
}
.scroll-chips::-webkit-scrollbar { display: none; }
.wrap-chips { flex-wrap: wrap; }
.chip {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.chip.is-on {
  color: #0a0a0f;
  background: var(--gold);
  border-color: var(--gold);
}
.chip.faction.is-on { color: #fff; }
.chip .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: currentColor;
  vertical-align: middle;
}

.points-row { align-items: center; }
.points-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 140px;
  flex: 1 1 160px;
}
.points-readout {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  white-space: nowrap;
}
.points-readout.is-over { color: var(--danger); }
.progress {
  flex: 1;
  height: 6px;
  background: #0e0e18;
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
  min-width: 80px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.18s ease;
}
.progress-bar.is-over { background: var(--danger); }

/* Main + views */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.view {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
}
.view.is-active { display: flex; }

.squad-layout, .gen-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 10px 8px;
}
.pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pane-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.pane-count { font-size: 12px; color: var(--muted); }
.filters {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
  padding: 8px 10px 6px;
}
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.pane-foot {
  padding: 8px 10px calc(8px + var(--safe-b) * 0);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.gen-controls .gen-body { padding: 10px 12px 16px; overflow: auto; }
.hint { color: var(--text-2); font-size: 13px; margin: 0 0 8px; }

/* Figure rows */
.fig-row, .squad-row {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 0 10px;
  align-items: center;
  padding: 8px 8px 8px 0;
  min-height: 56px;
  border-bottom: 1px solid #22223a;
  text-align: left;
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  color: inherit;
}
.fig-row:active, .squad-row:active { background: #1e2744; }
.accent {
  align-self: stretch;
  background: var(--muted);
  border-radius: 0 3px 3px 0;
}
.fig-main { min-width: 0; padding: 2px 0; }
.fig-name {
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fig-meta {
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.fig-meta .unique { color: var(--gold); }
.fig-stats { color: var(--muted); }
.fig-side {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cost {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}
.icon-btn {
  width: var(--touch);
  height: var(--touch);
  min-width: var(--touch);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn.remove { color: var(--text-2); font-size: 18px; }
.icon-btn:active { background: #243056; }
.qty {
  min-width: 22px;
  text-align: center;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Tab bar */
.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--deep-space);
  border-top: 1px solid var(--border);
  padding: 4px 8px calc(6px + var(--safe-b));
}
.tab {
  min-height: var(--touch);
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tab svg { width: 22px; height: 22px; }
.tab.is-active { color: var(--gold); }

/* Overlay / sheet
   Safari ignores the HTML hidden attribute when display:flex is set on .overlay,
   so the dimmer stays up forever unless we force [hidden] off. */
.overlay[hidden],
.toast[hidden],
.view[hidden] {
  display: none !important;
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(12px + var(--safe-b));
}
.sheet {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(640px, 100%);
  max-height: min(86dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px 20px;
  position: relative;
}
.sheet-close {
  position: absolute;
  top: 8px; right: 8px;
  width: var(--touch); height: var(--touch);
  border: 0; background: transparent;
  color: var(--text-2);
  font-size: 28px;
  line-height: 1;
}
.sheet h2 { margin: 0 32px 4px 0; font-size: 20px; }
.sheet .sub { color: var(--text-2); font-size: 13px; margin-bottom: 12px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 12px 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.stat b { display: block; font-size: 16px; color: var(--gold); }
.stat span { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
}
.tag.force { border-color: #3d4a8a; color: #90caf9; }
.sheet-section-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 8px 0 4px;
}
.save-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.save-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 8px 8px 12px;
  min-height: var(--touch);
}
.save-item .grow { flex: 1; min-width: 0; }
.save-item .name { font-weight: 650; }
.save-item .meta { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  transform: translateX(-50%);
  background: #2a2340;
  color: var(--text);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 10px 16px;
  z-index: 50;
  font-size: 13px;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rules-layout {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
.rule-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.rule-card h2 {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.rule-card p { margin: 0; color: var(--text-2); font-size: 14px; }
.rules-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0 12px; }

@media (min-width: 900px) {
  .rules-layout { grid-template-columns: 1fr 1fr; }
  .rules-foot { grid-column: 1 / -1; }
  .overlay { align-items: center; }
}

/* iPad Mini portrait (~744) and any stacked layout */
@media (orientation: portrait), (max-width: 999px) {
  .squad-layout, .gen-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .points-meta { flex: 1 1 100%; margin-left: 0; }
  .header-actions { margin-left: 0; }
}

@media (min-width: 1000px) and (orientation: landscape) {
  .squad-layout, .gen-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }
}

.pane[hidden] { display: none !important; }
.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;
}

#view-squad.is-battle .squad-layout {
  grid-template-columns: minmax(260px, 0.86fr) minmax(340px, 1.14fr);
}
.battle-row.is-selected { background: #243056; }
.battle-row.is-defeated { opacity: 0.55; }
.battle-row.is-defeated .fig-name { text-decoration: line-through; }

#battle-card { padding: 12px; background: #0e0e16; }

.swm-card {
  --faction: #2f8f3a;
  border: 3px solid #e7eef6;
  border-radius: 4px;
  background-color: #b9c6d8;
  background-image: repeating-linear-gradient(-32deg, rgba(255,255,255,0.28) 0 1px, transparent 1px 8px);
  color: #111;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.swm-stripe { height: 7px; background: var(--faction); }
.swm-headrow {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 10px 4px;
  background-color: #b9c6d8;
  background-image: repeating-linear-gradient(-32deg, rgba(255,255,255,0.28) 0 1px, transparent 1px 8px);
}
.swm-top {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 22px 6px 8px;
  background: #141414;
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
}
.swm-emblem { width: 28px; height: 28px; flex: 0 0 auto; }
.swm-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: #fff;
}
.swm-cost {
  flex: 0 0 auto;
  width: 54px;
  height: 50px;
  margin-left: -16px;
  background: #111;
  display: grid;
  place-items: center;
  clip-path: polygon(22% 0, 78% 0, 100% 22%, 100% 78%, 78% 100%, 22% 100%, 0 78%, 0 22%);
}
.swm-cost b {
  width: 46px;
  height: 42px;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  clip-path: polygon(22% 0, 78% 0, 100% 22%, 100% 78%, 78% 100%, 22% 100%, 0 78%, 0 22%);
}
.swm-mid {
  display: grid;
  grid-template-columns: minmax(158px, 0.86fr) 1.45fr;
  gap: 8px;
  align-items: start;
  padding: 6px 10px 6px;
}
.swm-stats { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.swm-stat { display: flex; align-items: center; min-height: 40px; }
.swm-stat-label {
  background: #141414;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  line-height: 1.1;
  padding: 8px 14px 8px 8px;
  border-radius: 7px 2px 2px 7px;
  min-width: 96px;
  white-space: nowrap;
}
.swm-oct {
  margin-left: -12px;
  width: 52px;
  height: 46px;
  background: #111;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  clip-path: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%);
}
.swm-oct b {
  width: 44px;
  height: 38px;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  clip-path: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%);
}
.swm-star {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #111;
}
.swm-body {
  background: #fff;
  color: #111;
  border: 2px solid #1a1a1a;
  border-radius: 12px;
  padding: 8px 10px 10px;
  min-width: 0;
}
.swm-body h4 {
  margin: 8px 0 2px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: #111;
}
.swm-body h4:first-child { margin-top: 0; }
.swm-body p, .swm-rule { margin: 0 0 6px; font-size: 13px; line-height: 1.35; }
.sheet .swm-rule { color: var(--text); }
.swm-body b { font-weight: 800; }
.swm-set { margin-top: 8px !important; font-size: 11px !important; color: #444; }
.swm-play {
  margin: 0 10px 8px;
  background: #fff;
  color: #111;
  border: 2px solid #1a1a1a;
  border-radius: 12px;
  padding: 6px 10px 8px;
}
.swm-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.swm-track-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #333;
  font-weight: 800;
}
.swm-stepper { display: flex; align-items: center; gap: 4px; }
.swm-step {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
}
.swm-step.by10 { width: auto; min-width: 44px; padding: 0 8px; font-size: 15px; }
.swm-step:active { transform: scale(0.97); }
.swm-step.addhit {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  font-size: 15px;
  background: #8e1d2c;
  color: #fff;
  border-color: #8e1d2c;
}
.swm-stepper input {
  width: 64px;
  height: 44px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #111;
  background: #fff;
  border: 2px solid #111;
  border-radius: 8px;
}
.swm-left { min-width: 72px; text-align: right; }
.swm-left b {
  display: block;
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #111;
}
.swm-left span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #444;
}
.swm-left.is-down b { color: #8e1d2c; }
.swm-hpbar {
  flex: 1 0 100%;
  height: 8px;
  background: #e4d3ae;
  border-radius: 99px;
  overflow: hidden;
}
.swm-hpbar > div { height: 100%; background: #8e1d2c; width: 0; }
.swm-hint { flex: 1 1 auto; margin: 0; font-size: 12px; color: #333; }
.swm-rolls { display: flex; gap: 8px; margin-top: 4px; }
.swm-rolls .btn { flex: 1; }
.swm-save { background: #1c4f8a; color: #fff; border-color: #1c4f8a; }
.swm-results { display: grid; gap: 8px; margin-top: 10px; }
.swm-result {
  background: #f4f7fb;
  border: 1px solid #c5ceda;
  border-radius: 8px;
  padding: 8px 10px;
  color: #111;
}
.swm-result.is-empty { color: #333; font-size: 13px; }
.swm-eq {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.swm-eq b {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #111;
}
.swm-eq span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #444;
}
.swm-eq .op { font-size: 20px; color: #444; padding-bottom: 12px; }
.swm-eq .total b { color: #111; }
.swm-nat { font-size: 13px; font-weight: 800; margin-bottom: 4px; text-align: center; }
.swm-nat.hit { color: #1b7a32; }
.swm-nat.miss { color: #8e1d2c; }
.swm-save-note { text-align: center; font-size: 13px; margin-top: 4px; color: #333; }
.swm-eq .save b { color: #1b7a32; }
.swm-eq .fail b { color: #8e1d2c; }
.swm-card.is-defeated .swm-stripe,
.swm-card.is-defeated .swm-headrow,
.swm-card.is-defeated .swm-mid { filter: grayscale(0.85); opacity: 0.72; }
.swm-stamp {
  margin: 0 0 8px;
  display: inline-block;
  border: 2px solid #8e1d2c;
  color: #8e1d2c;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 2px 8px;
  transform: rotate(-6deg);
}
.swm-stamp[hidden] { display: none !important; }

@media (orientation: portrait), (max-width: 999px) {
  #view-squad.is-battle .squad-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(120px, 0.34fr) minmax(0, 1fr);
  }
}

.player-tag {
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
}
.swm-player {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1400;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}
.head-btn { min-height: 32px; padding: 0 10px; font-size: 13px; }
.progress[hidden] { display: none !important; }
#create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.create-grid .span-2 { grid-column: span 2; }
.field textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.swm-last {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #111;
}
.swm-save-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 4px;
  font-weight: 800;
}
.swm-save-line b {
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.swm-save-line span {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.swm-save-line.save { color: #1b7a32; }
.swm-save-line.fail { color: #8e1d2c; }
.swm-save-line.attack { color: #111; }

#battle-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 6px;
}
#battle-card .swm-card {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#battle-card .swm-headrow { position: static; flex: 0 0 auto; padding-bottom: 2px; }
#battle-card .swm-mid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 4px;
}
#battle-card .swm-stats { overflow: auto; gap: 4px; }
#battle-card .swm-stat { min-height: 32px; }
#battle-card .swm-stat-label { font-size: 11px; padding: 6px 12px 6px 8px; }
#battle-card .swm-oct { width: 42px; height: 36px; }
#battle-card .swm-oct b { width: 34px; height: 28px; font-size: 14px; }
#battle-card .swm-name { font-size: 16px; }
#battle-card .swm-body {
  overflow: auto;
  min-height: 0;
  max-height: 100%;
}
#battle-card .swm-play {
  flex: 0 0 auto;
  margin: 0 8px 6px;
  padding: 6px 8px;
}
#battle-card .swm-track { margin-bottom: 4px; }
#battle-card .swm-cost { width: 46px; height: 42px; }
#battle-card .swm-cost b { width: 38px; height: 34px; font-size: 16px; }
