.keep-page {
  --keep-blue: #278fab;
  --keep-blue-soft: #0c3440;
  --keep-red: #d45b49;
  --keep-red-soft: #3b1715;
  --keep-green: #6cae64;
  --keep-orange: #d78638;
  --keep-violet: #9468b3;
  padding-bottom: 34px;
}

.keep-shell {
  width: min(1460px, calc(100% - 32px));
  margin: 22px auto 0;
}

.keep-hero {
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px 32px;
  padding: 24px 28px;
  border: 1px solid #57492d;
  border-top: 3px solid var(--red);
  background:
    linear-gradient(105deg, rgba(19, 21, 18, .98), rgba(34, 21, 16, .94)),
    var(--panel);
  box-shadow: var(--shadow);
}

.keep-hero h1 {
  margin: 4px 0 8px;
  color: var(--gold-bright);
  font: 800 clamp(2rem, 4vw, 3.15rem)/1 Georgia, serif;
}

.keep-hero-copy > p:last-child {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.keep-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.model-status {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #3e382d;
}

.model-status span {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 13px 16px 0;
}

.model-status span + span { border-left: 1px solid #3e382d; }
.model-status b { color: var(--gold-bright); font: 800 1.45rem Georgia, serif; }
.model-status small { color: var(--muted); font-size: .68rem; text-transform: uppercase; }

.keep-audio { margin: 12px 0; }

.keep-stage-tabs {
  position: sticky;
  top: 66px;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background: rgba(14, 16, 13, .98);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .32);
  backdrop-filter: blur(12px);
}

.keep-stage-tabs button {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 1px 9px;
  padding: 10px 16px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.keep-stage-tabs button + button { border-left: 1px solid var(--line); }
.keep-stage-tabs button::after {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  content: "";
  background: transparent;
}

.keep-stage-tabs button.is-active {
  color: var(--text);
  background: #251d12;
}

.keep-stage-tabs button.is-active::after {
  background: var(--gold);
  box-shadow: 0 0 12px rgba(230, 185, 72, .45);
}

.keep-stage-tabs span {
  grid-row: 1 / 3;
  align-self: center;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #67552c;
  color: var(--gold);
  font-size: .68rem;
  font-weight: 900;
}

.keep-stage-tabs b { font-size: .83rem; }
.keep-stage-tabs small { color: #918775; font-size: .65rem; }

.keep-stage {
  border: 1px solid var(--line);
  background: #10120f;
  box-shadow: var(--shadow);
}

.stage-heading {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #171914;
}

.stage-heading h2 {
  margin: 2px 0 0;
  font: 800 clamp(1.35rem, 3vw, 2rem)/1.1 Georgia, serif;
}

.stage-progress {
  width: min(300px, 40%);
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .72rem;
  text-align: right;
}

.stage-progress i {
  height: 7px;
  overflow: hidden;
  border: 1px solid #4e4737;
  background: #090a08;
}

.stage-progress b {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width .2s ease;
}

.setup-list { display: grid; }

.setup-row {
  border-bottom: 1px solid #373329;
  background: #121410;
}

.setup-row:nth-child(even) { background: #151612; }

.setup-row > header {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
}

.row-code {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #6d5729;
  color: var(--gold-bright);
  background: #282011;
  font-size: .7rem;
  font-weight: 900;
}

.setup-row h3 {
  margin: 0;
  font: 800 1.05rem Georgia, serif;
}

.setup-row header small {
  color: var(--muted);
  font-size: .65rem;
  text-transform: uppercase;
}

.assignment-state {
  justify-self: end;
  padding: 5px 8px;
  border: 1px solid #464238;
  color: #8f887a;
  font-size: .64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.assignment-state.is-set {
  border-color: #2f7241;
  color: #88d795;
  background: #102819;
}

.setup-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(120px, .45fr) minmax(110px, .35fr) auto;
  gap: 10px;
  align-items: end;
  padding: 0 18px 12px 72px;
}

.sub-controls {
  grid-template-columns: minmax(220px, 1.3fr) minmax(110px, .4fr) minmax(120px, .45fr) auto;
}

.setup-controls label,
.gear-toolbar label,
.gear-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.setup-controls select,
.gear-toolbar select,
.gear-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #504a3d;
  border-radius: 0;
  color: var(--text);
  background: #0d0f0c;
  padding: 8px 34px 8px 10px;
}

.setup-controls select:focus,
.gear-toolbar select:focus,
.gear-grid select:focus {
  outline: 2px solid rgba(230, 185, 72, .48);
  outline-offset: 1px;
}

.status-chip {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 7px 10px;
  border: 1px solid #4c463a;
  color: var(--muted);
  background: #11120f;
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-chip.is-premium {
  border-color: #795e25;
  color: var(--gold-bright);
  background: #2b210e;
}

.status-chip.is-f2p {
  border-color: #296a78;
  color: #72d9eb;
  background: #0b2930;
}

.gear-toggle {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid #615330;
  color: var(--gold-bright);
  background: #211b10;
  font-size: .72rem;
  font-weight: 900;
}

.gear-toggle[aria-expanded="true"] {
  color: #10120f;
  background: var(--gold);
}

.impact-strip {
  min-height: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding: 0 18px 10px 72px;
}

.impact-strip:empty { min-height: 0; padding-bottom: 0; }

.impact-strip span {
  padding: 3px 6px;
  border-left: 2px solid var(--cyan);
  color: #c7dce0;
  background: #102127;
  font-size: .63rem;
  font-weight: 800;
}

.sub-row .impact-strip span {
  border-left-color: var(--keep-red);
  color: #ebc3bc;
  background: #2a1513;
}

.gear-drawer {
  margin: 0 18px 14px 72px;
  padding: 13px;
  border: 1px solid #51472f;
  background: #0d0f0c;
}

.gear-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 11px;
}

.gear-toolbar button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #5a4e34;
  color: var(--muted);
  background: #171710;
  font-size: .68rem;
  font-weight: 800;
}

.gear-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stage-actions {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid #4c422c;
  background: #171710;
}

.stage-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: .7rem;
}

.results-actions { display: flex; gap: 8px; }

.result-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #11130f;
}

.result-summary article {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 13px 16px;
}

.result-summary article + article { border-left: 1px solid var(--line); }
.result-summary small { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.result-summary strong { color: var(--gold-bright); font: 800 clamp(1.45rem, 3vw, 2.15rem)/1 Georgia, serif; }
.result-summary article:nth-child(2) strong { color: #ef8371; }
.result-summary span { color: #877e6f; font-size: .66rem; }

.result-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #0e100d;
}

.result-tabs button {
  min-height: 50px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: .72rem;
  font-weight: 900;
}

.result-tabs button + button { border-left: 1px solid #302e27; }
.result-tabs button.is-active {
  border-bottom-color: var(--gold);
  color: var(--gold-bright);
  background: #211b10;
}

.result-view { padding: 20px; }

.troop-stack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.troop-stack-card {
  min-width: 0;
  border: 1px solid #4d4638;
  border-top: 3px solid var(--troop-color, var(--gold));
  background: #171914;
}

.troop-stack-card > header {
  min-height: 76px;
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #3b372e;
}

.troop-stack-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .72));
}

.troop-stack-card h3 {
  margin: 0;
  color: var(--troop-color, var(--gold-bright));
  font: 800 1.05rem Georgia, serif;
}

.troop-stack-card header small {
  color: var(--muted);
  font-size: .62rem;
  text-transform: uppercase;
}

.stack-side { padding: 12px; }
.stack-side + .stack-side { border-top: 1px solid #3b372e; }
.stack-side > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stack-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.stack-metrics div {
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid #3d3a32;
  background: #10120f;
  text-align: center;
}

.stack-metrics b {
  display: block;
  overflow-wrap: anywhere;
  color: #7ed9e8;
  font-size: .82rem;
}

.stack-side.enemy .stack-metrics b { color: #ef8371; }
.stack-metrics small { color: #81796b; font-size: .57rem; }

.result-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  background: #201b11;
  font-size: .72rem;
}

.result-callout b { color: var(--gold-bright); }

.breakdown-band {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 15px;
  border-left: 3px solid var(--cyan);
  background: #142026;
}

.breakdown-band h3 {
  margin: 1px 0 0;
  font: 800 1.35rem Georgia, serif;
}

.breakdown-band > span {
  color: var(--muted);
  font-size: .68rem;
}

.breakdown-band.compact { min-height: 58px; }

.responsive-table {
  overflow-x: auto;
  border: 1px solid #454035;
  border-top: 0;
}

.responsive-table table {
  width: 100%;
  min-width: 740px;
  border-collapse: collapse;
}

.responsive-table th,
.responsive-table td {
  height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid #353229;
  text-align: right;
  white-space: nowrap;
}

.responsive-table th:first-child,
.responsive-table td:first-child { text-align: left; }
.responsive-table th {
  color: var(--muted);
  background: #0e100d;
  font-size: .64rem;
  text-transform: uppercase;
}
.responsive-table td { font-size: .76rem; }
.responsive-table tbody tr:last-child td { border-bottom: 0; }
.responsive-table td strong { color: var(--gold-bright); }
.responsive-table td.enemy-value strong { color: #ef8371; }

.detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.detail-columns > section {
  min-width: 0;
  border: 1px solid #454035;
  background: #151713;
}

.detail-columns > section > h3 {
  margin: 0;
  padding: 13px 15px;
  border-bottom: 1px solid #454035;
  font: 800 1rem Georgia, serif;
}

.effect-list { display: grid; }

.effect-item {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid #302e27;
}

.effect-item:last-child { border-bottom: 0; }
.effect-item b { display: block; font-size: .75rem; }
.effect-item small { display: block; color: var(--muted); font-size: .61rem; }
.effect-item strong { color: var(--gold-bright); font-size: .82rem; white-space: nowrap; }
.effect-item.is-debuff strong { color: #ef8371; }
.effect-empty { padding: 20px; color: var(--muted); font-size: .74rem; text-align: center; }

.sub-roster-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.sub-result-row {
  min-width: 0;
  padding: 11px 12px;
  border-left: 3px solid var(--keep-red);
  background: #1d1513;
}

.sub-result-row b { display: block; font-size: .74rem; }
.sub-result-row small { color: var(--muted); font-size: .61rem; }

.keep-note { margin-top: 14px; }

.general-command {
  padding: 18px;
  border-bottom: 1px solid #4a3c25;
  background:
    linear-gradient(135deg, rgba(40, 24, 17, .55), rgba(10, 27, 31, .55)),
    #11130f;
}

.general-command-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.general-command-heading h3 {
  margin: 2px 0 5px;
  color: var(--gold-bright);
  font: 800 1.5rem/1.1 Georgia, serif;
}

.general-command-heading p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
}

.general-catalog-status {
  min-width: 116px;
  padding: 10px 13px;
  border: 1px solid #66532b;
  background: #241d12;
  text-align: center;
}

.general-catalog-status b,
.general-catalog-status small { display: block; }
.general-catalog-status b { color: var(--gold-bright); font: 800 1.35rem Georgia, serif; }
.general-catalog-status small { color: var(--muted); font-size: .59rem; text-transform: uppercase; }

.general-command-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, .42fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.general-command-toolbar > label,
.general-config > label,
.specialty-controls > label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: .63rem;
  font-weight: 800;
  text-transform: uppercase;
}

.general-command select,
.general-picker select,
.general-picker input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid #514934;
  border-radius: 2px;
  color: var(--text);
  background: #0d0f0c;
  padding: 0 10px;
}

.pair-compatibility {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: 8px 12px;
  border-left: 3px solid #756b55;
  background: #191a16;
}

.pair-compatibility b { font-size: .76rem; }
.pair-compatibility span { color: var(--muted); font-size: .64rem; }
.pair-compatibility.is-clear { border-left-color: #55b677; background: #102219; }
.pair-compatibility.is-check { border-left-color: var(--gold); background: #292110; }
.pair-compatibility.is-blocked { border-left-color: var(--keep-red); background: #2c1512; }

.general-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.general-slot {
  min-width: 0;
  border: 1px solid #474335;
  border-top: 3px solid var(--keep-blue);
  background: #141612;
}

.general-slot.is-main { border-top-color: var(--gold); }

.general-slot > header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 8px 10px;
  border-bottom: 1px solid #3c382d;
  background: #1a1b17;
}

.general-slot > header b,
.general-slot > header small { display: block; }
.general-slot > header b { font: 800 .84rem Georgia, serif; }
.general-slot > header small { color: var(--muted); font-size: .59rem; }

.general-position {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 28px;
  border: 1px solid #806725;
  color: var(--gold-bright);
  background: #2d2412;
  font-size: .59rem;
  font-weight: 900;
}

.is-assistant .general-position {
  border-color: #246c7b;
  color: #91e4ef;
  background: #102a31;
}

.general-source-badge {
  padding: 4px 6px;
  border: 1px solid #4c493e;
  color: var(--muted);
  background: #10110e;
  font-size: .56rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.general-source-badge.is-tone { border-color: #577c3e; color: #9bdf79; background: #142211; }
.general-source-badge.is-client { border-color: #286a78; color: #7edce9; background: #10252b; }
.general-source-badge.is-blocked { border-color: #8d3a2e; color: #f19482; background: #2b1411; }

.general-select {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #38362d;
  color: var(--text);
  background: #10120f;
  text-align: left;
}

.general-select:hover,
.general-select:focus-visible { background: #202016; outline: 1px solid var(--gold); outline-offset: -1px; }
.general-select > span:first-child {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #725b25;
  color: var(--gold-bright);
  background: radial-gradient(circle, #3a2a13, #15140f);
  font: 800 1.2rem Georgia, serif;
}
.is-assistant .general-select > span:first-child { border-color: #286d7c; color: #8be0ec; background: #112a31; }
.general-select b,
.general-select small { display: block; }
.general-select b { overflow-wrap: anywhere; font-size: .84rem; }
.general-select small { margin-top: 2px; color: var(--muted); font-size: .61rem; }
.general-select > span:last-child { color: var(--gold); font-size: 1.5rem; }

.general-stat-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid #37342b;
  background: #0d0f0c;
}

.general-stat-line span { min-width: 0; padding: 7px 8px; }
.general-stat-line span + span { border-left: 1px solid #302e27; }
.general-stat-line b,
.general-stat-line small { display: block; }
.general-stat-line b { color: var(--gold-bright); font-size: .72rem; }
.general-stat-line small { overflow-wrap: anywhere; color: var(--muted); font-size: .52rem; }

.general-skill-brief { padding: 10px 12px; border-bottom: 1px solid #37342b; background: #171812; }
.general-skill-brief b { color: var(--gold-bright); font: 800 .8rem Georgia, serif; }
.general-skill-brief p { margin: 4px 0 0; color: #c8c0b0; font-size: .65rem; line-height: 1.5; }

.general-config {
  display: grid;
  grid-template-columns: minmax(160px, .42fr) minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #37342b;
}

.general-toggle {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  align-self: end;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid #454233;
  color: #d3ccbc !important;
  background: #10120f;
  font-size: .61rem !important;
  font-weight: 700 !important;
  text-transform: none !important;
}

.general-toggle input { width: 16px; height: 16px; accent-color: var(--gold); }

.specialty-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.general-impact {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 5px;
  padding: 8px 12px;
  border-bottom: 1px solid #37342b;
}

.general-impact span {
  padding: 3px 6px;
  border-left: 2px solid var(--keep-blue);
  color: #a9e5ed;
  background: #10262b;
  font-size: .58rem;
  font-weight: 800;
}
.general-impact span.is-debuff { border-left-color: var(--keep-red); color: #f0aa9d; background: #2a1512; }
.general-impact > small { color: var(--muted); font-size: .63rem; }
.general-gear-toggle { margin: 9px 12px; width: calc(100% - 24px); }
.general-gear-drawer { margin: 0 12px 12px; }

.general-model-note {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  background: #1c1810;
  font-size: .64rem;
  line-height: 1.45;
}

.general-picker {
  width: min(1000px, calc(100% - 28px));
  max-width: none;
  height: min(780px, calc(100dvh - 32px));
  max-height: none;
  padding: 0;
  border: 1px solid #75602d;
  color: var(--text);
  background: #10120f;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .75);
}

.general-picker::backdrop { background: rgba(2, 4, 3, .82); backdrop-filter: blur(5px); }
.general-picker-shell { height: 100%; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); }
.general-picker-shell > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid #554728;
  background: linear-gradient(100deg, #251c12, #102329);
}
.general-picker-shell h2 { margin: 2px 0 0; color: var(--gold-bright); font: 800 1.35rem Georgia, serif; }
.general-picker-shell > header button {
  width: 38px;
  height: 38px;
  border: 1px solid #5c523d;
  color: var(--text);
  background: #11130f;
  font-size: 1.35rem;
}

.general-picker-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 190px;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #37342b;
  background: #171914;
}
.general-picker-filters label { display: grid; gap: 4px; color: var(--muted); font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.general-picker-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid #37342b;
  color: var(--muted);
  background: #0c0e0b;
  font-size: .63rem;
}
.general-picker-results { min-height: 0; overflow: auto; padding: 8px; }
.general-picker-row,
.general-picker-clear {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(230px, .42fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #343229;
  color: var(--text);
  background: #131511;
  text-align: left;
}
.general-picker-row:nth-child(odd) { background: #171814; }
.general-picker-row:hover,
.general-picker-row:focus-visible,
.general-picker-row.is-selected { background: #292111; outline: 1px solid #725b25; outline-offset: -1px; }
.general-picker-identity { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 9px; }
.general-picker-identity i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #745d27;
  color: var(--gold-bright);
  background: #2a2112;
  font: normal 800 1rem Georgia, serif;
}
.general-picker-identity b,
.general-picker-identity small,
.general-picker-skill b,
.general-picker-skill small { display: block; overflow-wrap: anywhere; }
.general-picker-identity b,
.general-picker-skill b { font-size: .73rem; }
.general-picker-identity small,
.general-picker-skill small { margin-top: 2px; color: var(--muted); font-size: .58rem; line-height: 1.35; }
.general-picker-skill { min-width: 0; }
.general-picker-skill b { color: #9ddce5; }
.general-picker-clear {
  grid-template-columns: 1fr;
  margin-bottom: 7px;
  border: 1px solid #60352c;
  color: #f0a090;
  background: #251410;
}
.general-picker-clear b,
.general-picker-clear small { display: block; }
.general-picker-clear small { margin-top: 2px; color: #bd8b82; font-size: .58rem; }
.general-picker-empty { padding: 30px 12px; color: var(--muted); text-align: center; }

.creature-stage > .stage-heading {
  background:
    linear-gradient(105deg, rgba(41, 22, 15, .72), rgba(8, 35, 42, .58)),
    #171914;
}

.creature-stage > .stage-heading > div:first-child {
  max-width: 790px;
}

.creature-stage > .stage-heading > div:first-child > p:last-child,
.creature-section > header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.55;
}

.creature-stage-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, auto));
  align-items: stretch;
  border: 1px solid #51462e;
  background: #0d100d;
}

.creature-stage-summary > span,
.creature-stage-summary > label {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 13px;
}

.creature-stage-summary > * + * { border-left: 1px solid #3b372e; }
.creature-stage-summary b { color: var(--gold-bright); font: 800 1.3rem Georgia, serif; }
.creature-stage-summary small,
.creature-stage-summary label > span {
  color: var(--muted);
  font-size: .57rem;
  font-weight: 800;
  text-transform: uppercase;
}

.creature-stage-summary input {
  width: 70px;
  height: 28px;
  border: 1px solid #5d502f;
  color: var(--gold-bright);
  background: #151710;
  padding: 0 7px;
  font-weight: 800;
}

.creature-warning {
  margin: 0;
  padding: 11px 18px;
  border-bottom: 1px solid #7c3b30;
  color: #ffc1b6;
  background: #321713;
  font-size: .72rem;
}

.creature-section {
  border-bottom: 1px solid #403a2d;
}

.creature-section > header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px 18px;
  border-bottom: 1px solid #403a2d;
  background: #141612;
}

.creature-section > header h3 {
  margin: 2px 0 0;
  color: var(--gold-bright);
  font: 800 1.2rem Georgia, serif;
}

.creature-assignment-list,
.seal-profile-list {
  display: grid;
}

.creature-assignment,
.seal-profile {
  min-width: 0;
  border-bottom: 1px solid #38342a;
  background: #10120f;
}

.creature-assignment:nth-child(even),
.seal-profile:nth-child(even) { background: #131510; }

.creature-assignment > header,
.seal-profile > header {
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  border-bottom: 1px solid #302d25;
}

.seal-profile > header {
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
}

.creature-assignment > header h3,
.seal-profile > header h3 {
  margin: 2px 0 0;
  font: 800 1.05rem Georgia, serif;
}

.creature-assignment > header small,
.seal-profile > header small {
  display: block;
  color: var(--muted);
  font-size: .58rem;
  text-transform: uppercase;
}

.creature-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #735c2b;
  color: var(--gold);
  background: #211a10;
  font-size: .68rem;
  font-weight: 900;
}

.creature-assignment > header button,
.seal-profile > header button {
  width: 34px;
  height: 34px;
  border: 1px solid #60352d;
  color: #f2a391;
  background: #24120f;
  font-size: 1.25rem;
}

.seal-profile > header > strong {
  color: var(--gold-bright);
  font: 800 1rem Georgia, serif;
  text-align: right;
}

.seal-profile > header > strong small {
  margin-top: 2px;
  font: 700 .52rem Arial, sans-serif;
}

.creature-primary-grid,
.creature-config-grid,
.seal-base-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
}

.creature-config-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 0;
}

.seal-base-controls {
  grid-template-columns: minmax(0, 1fr) minmax(150px, .3fr);
}

.creature-primary-grid label,
.creature-config-grid label,
.seal-base-controls label,
.seal-track-grid label,
.dragon-talent label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.creature-primary-grid label > span,
.creature-config-grid label > span,
.seal-base-controls label > span,
.seal-track-grid label > span,
.dragon-talent label > span,
.creature-category > span {
  color: var(--muted);
  font-size: .58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.creature-primary-grid select,
.creature-config-grid select,
.seal-base-controls select,
.seal-track-grid select,
.dragon-talent input,
.dragon-refinement select,
.dragon-refinement input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid #514934;
  border-radius: 2px;
  color: var(--text);
  background: #0d0f0c;
  padding: 0 9px;
}

.creature-category {
  min-height: 40px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 5px 10px;
  border: 1px solid #514934;
  background: #171912;
}

.creature-category b { color: #90dbe6; font-size: .75rem; }

.creature-readout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 16px 12px;
  border: 1px solid #3e3a30;
  background: #171914;
}

.creature-readout > span {
  min-height: 56px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
}

.creature-readout > span + span { border-left: 1px solid #353229; }
.creature-readout small { color: var(--muted); font-size: .55rem; text-transform: uppercase; }
.creature-readout b { color: var(--gold-bright); font-size: .82rem; overflow-wrap: anywhere; }
.creature-readout.is-progression { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.creature-upgrade-note {
  margin: -2px 16px 12px;
  padding: 9px 11px;
  border-left: 3px solid var(--keep-violet);
  color: #d8b9ed;
  background: #21172a;
  font-size: .64rem;
  line-height: 1.45;
}

.creature-effect-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 14px;
}

.creature-effect {
  min-width: min(250px, 100%);
  flex: 1 1 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 7px 9px;
  border-left: 3px solid var(--keep-blue);
  color: #a7e9f0;
  background: #10252a;
}

.creature-effect b { font-size: .65rem; overflow-wrap: anywhere; }
.creature-effect strong { color: #85e0ec; font-size: .72rem; white-space: nowrap; }
.creature-effect.is-muted { border-left-color: #665f50; color: #918a7d; background: #1a1a16; }
.creature-effect.is-muted strong { color: #aaa292; }

.dragon-talents,
.dragon-refinements {
  margin: 0 16px 12px;
  border: 1px solid #403b30;
  background: #131510;
}

.dragon-talents > header,
.dragon-refinements > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid #403b30;
  background: #1b1b15;
}

.dragon-talents > header b,
.dragon-refinements > header b { color: var(--gold-bright); font: 800 .9rem Georgia, serif; }
.dragon-talents > header small,
.dragon-refinements > header small { color: var(--muted); font-size: .57rem; }

.dragon-talent {
  display: grid;
  grid-template-columns: minmax(180px, .45fr) minmax(160px, .22fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid #302e27;
}

.dragon-talent:last-child { border-bottom: 0; }
.dragon-talent > div { display: flex; align-items: center; gap: 8px; }
.dragon-talent > div > b { font-size: .72rem; }
.dragon-talent > small { color: #8ed8e4; font-size: .61rem; line-height: 1.4; overflow-wrap: anywhere; }

.creature-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: .56rem;
}

.creature-switch input { width: 15px; height: 15px; accent-color: var(--gold); }
.creature-passive {
  padding: 3px 5px;
  border: 1px solid #315b45;
  color: #77d79a;
  background: #112419;
  font-size: .52rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dragon-refinement {
  display: grid;
  grid-template-columns: 34px minmax(100px, .8fr) minmax(100px, .8fr) minmax(120px, .6fr);
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-bottom: 1px solid #302e27;
}

.dragon-refinement:last-child { border-bottom: 0; }
.dragon-refinement > span {
  display: grid;
  place-items: center;
  height: 32px;
  border: 1px solid #684f28;
  color: var(--gold);
  background: #211a10;
  font-size: .61rem;
  font-weight: 900;
}

.dragon-refinement > label {
  position: relative;
  min-width: 0;
}

.dragon-refinement > label > span {
  position: absolute;
  top: 11px;
  right: 9px;
  color: var(--gold);
  font-size: .67rem;
}

.dragon-refinement input { padding-right: 25px; }

.seal-track-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 0 16px 12px;
}

.innate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 16px 12px;
}

.innate-skill {
  min-height: 60px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-left: 3px solid var(--keep-green);
  background: #122018;
}

.innate-skill > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #396e4b;
  color: #80dfa0;
  font-size: .6rem;
  font-weight: 900;
}

.innate-skill b,
.innate-skill small { display: block; }
.innate-skill b { font-size: .7rem; }
.innate-skill small { margin-top: 3px; color: var(--muted); font-size: .55rem; }
.innate-skill strong { color: #83e3a2; font-size: .7rem; text-align: right; }
.innate-skill.is-locked { border-left-color: #665f50; background: #191a16; }
.innate-skill.is-locked > span { border-color: #5a5549; color: #9c9588; }
.innate-skill.is-locked strong { color: #9c9588; }

.creature-empty {
  min-height: 100px;
  display: grid;
  place-content: center;
  gap: 5px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.creature-empty b { color: var(--text); font: 800 1rem Georgia, serif; }
.creature-empty span { font-size: .7rem; }

.creature-result-section {
  margin-top: 12px;
  border: 1px solid #454035;
  background: #151713;
}

.creature-result-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1120px) {
  .troop-stack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sub-roster-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dragon-talent { grid-template-columns: minmax(170px, .5fr) minmax(150px, .3fr); }
  .dragon-talent > small { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .keep-shell { width: min(100% - 18px, 1460px); margin-top: 10px; }
  .keep-hero { grid-template-columns: 1fr; padding: 20px; }
  .keep-hero-actions { justify-content: flex-start; }
  .setup-controls,
  .sub-controls {
    grid-template-columns: minmax(0, 1fr) minmax(110px, .42fr);
    padding-left: 18px;
  }
  .status-chip,
  .gear-toggle { width: 100%; }
  .impact-strip { padding-left: 18px; }
  .gear-drawer { margin-left: 18px; }
  .gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-columns { grid-template-columns: 1fr; }
  .general-pair-grid { grid-template-columns: 1fr; }
  .general-picker-filters { grid-template-columns: 1fr 1fr; }
  .general-search { grid-column: 1 / -1; }
  .creature-primary-grid { grid-template-columns: 1fr 1fr; }
  .creature-primary-grid label:first-child { grid-column: 1 / -1; }
  .seal-track-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .innate-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .keep-page { padding-bottom: 20px; }
  .command-bar { min-height: 62px; grid-template-columns: auto 1fr; padding: 6px 9px; }
  .command-brand { justify-self: end; }
  .command-brand img { width: 40px; height: 40px; }
  .verified-mark { display: none; }
  .back-link span:last-child { display: none; }
  .keep-stage-tabs { top: 62px; }
  .keep-stage-tabs button {
    min-height: 62px;
    grid-template-columns: 24px 1fr;
    gap: 5px;
    padding: 7px;
  }
  .keep-stage-tabs span { width: 24px; height: 24px; font-size: .58rem; }
  .keep-stage-tabs b { font-size: .67rem; }
  .keep-stage-tabs small { display: none; }
  .keep-hero { min-height: 0; }
  .keep-hero h1 { font-size: 2rem; }
  .keep-hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .model-status { grid-template-columns: 1fr; }
  .model-status span { padding: 9px 0; }
  .model-status span + span { border-left: 0; border-top: 1px solid #3e382d; }
  .stage-heading { align-items: flex-start; flex-direction: column; gap: 10px; padding: 15px; }
  .stage-progress { width: 100%; text-align: left; }
  .setup-row > header { grid-template-columns: 38px 1fr; padding: 9px 12px; }
  .assignment-state { grid-column: 2; justify-self: start; }
  .setup-controls,
  .sub-controls { grid-template-columns: 1fr 1fr; padding: 0 12px 10px; }
  .setup-controls label:first-child,
  .sub-controls label:first-child { grid-column: 1 / -1; }
  .impact-strip { padding: 0 12px 9px; }
  .gear-drawer { margin: 0 12px 12px; }
  .gear-toolbar { grid-template-columns: 1fr; }
  .gear-grid { grid-template-columns: 1fr; }
  .general-command { padding: 12px; }
  .general-command-heading { align-items: flex-start; }
  .general-command-heading h3 { font-size: 1.25rem; }
  .general-catalog-status { min-width: 88px; }
  .general-command-toolbar { grid-template-columns: 1fr; }
  .general-slot > header { grid-template-columns: auto minmax(0, 1fr); }
  .general-source-badge { grid-column: 2; justify-self: start; }
  .general-config { grid-template-columns: 1fr; }
  .specialty-controls { grid-template-columns: 1fr; }
  .general-stat-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .general-stat-line span:nth-child(3) { border-left: 0; }
  .general-stat-line span:nth-child(n + 3) { border-top: 1px solid #302e27; }
  .general-picker {
    width: 100%;
    height: 100dvh;
    margin: 0;
    border: 0;
  }
  .general-picker-filters { grid-template-columns: 1fr; }
  .general-search { grid-column: auto; }
  .general-picker-summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .general-picker-row { grid-template-columns: 1fr; gap: 6px; }
  .stage-actions { flex-wrap: wrap; padding: 12px; }
  .stage-actions > span { width: 100%; margin: 0; }
  .stage-actions .command-button { flex: 1 1 160px; }
  .results-heading { align-items: stretch; }
  .results-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-summary article { min-height: 78px; padding: 10px 12px; }
  .result-summary article:nth-child(3) { grid-column: 1 / -1; min-height: 66px; }
  .result-summary article:nth-child(3) strong { font-size: 1.6rem; }
  .result-summary article:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .result-tabs {
    position: sticky;
    top: 124px;
    z-index: 30;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .result-tabs button {
    min-height: 56px;
    padding: 6px 3px;
    font-size: .64rem;
    line-height: 1.2;
    white-space: normal;
  }
  .result-view { padding: 12px; }
  .troop-stack-grid { grid-template-columns: 1fr; }
  .result-callout { align-items: flex-start; flex-direction: column; }
  .breakdown-band { align-items: flex-start; flex-direction: column; }
  .sub-roster-results { grid-template-columns: 1fr; }
  .creature-stage-summary { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .creature-stage-summary > span,
  .creature-stage-summary > label { min-width: 0; padding: 7px; }
  .creature-stage-summary input { width: 100%; }
  .creature-section > header { align-items: stretch; flex-direction: column; gap: 11px; }
  .creature-section > header .command-button { width: 100%; }
  .creature-assignment > header,
  .seal-profile > header { padding-inline: 10px; }
  .seal-profile > header {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }
  .seal-profile > header > strong { grid-column: 2; grid-row: 2; justify-self: start; text-align: left; }
  .seal-profile > header > button { grid-column: 3; grid-row: 1; }
  .creature-primary-grid,
  .creature-config-grid,
  .seal-base-controls { grid-template-columns: 1fr; padding-inline: 10px; }
  .creature-primary-grid label:first-child { grid-column: auto; }
  .creature-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-inline: 10px; }
  .creature-readout > span:nth-child(3) { border-left: 0; }
  .creature-readout > span:nth-child(n + 3) { border-top: 1px solid #353229; }
  .creature-readout.is-progression { grid-template-columns: 1fr; }
  .creature-readout.is-progression > span + span {
    border-left: 0;
    border-top: 1px solid #353229;
  }
  .creature-upgrade-note { margin-inline: 10px; }
  .creature-effect-grid { padding-inline: 10px; }
  .dragon-talents,
  .dragon-refinements { margin-inline: 10px; }
  .dragon-talents > header,
  .dragon-refinements > header { align-items: flex-start; flex-direction: column; }
  .dragon-talent { grid-template-columns: 1fr; }
  .dragon-talent > small { grid-column: auto; }
  .dragon-refinement {
    grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr);
  }
  .dragon-refinement > label { grid-column: 2 / -1; }
  .seal-track-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 10px; }
  .innate-grid { padding-inline: 10px; }
  .innate-skill { grid-template-columns: 36px minmax(0, 1fr); }
  .innate-skill strong { grid-column: 2; text-align: left; }
  .creature-result-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-progress b { transition: none; }
}
