:root {
  color-scheme: dark;
  --bg: #10140f;
  --panel: #171d18;
  --panel-2: #20271f;
  --panel-3: #141913;
  --line: #394538;
  --text: #f3f7ea;
  --muted: #b8c5ae;
  --green: #90d957;
  --gold: #f4c44e;
  --red: #ef6d5b;
  --blue: #65b6ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(144, 217, 87, 0.14), transparent 34rem),
    radial-gradient(circle at top right, rgba(244, 196, 78, 0.08), transparent 30rem),
    linear-gradient(135deg, #10140f 0%, #161a21 54%, #1e1d14 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(21rem, 0.92fr) minmax(22rem, 1.08fr);
  gap: 1.25rem;
  width: min(1260px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
  align-items: start;
}

.guide-shell {
  display: block;
  max-width: 840px;
}

.wide-guide {
  width: 100%;
}

.guide-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.guide-back-link:hover {
  color: var(--green);
}

.sim-panel,
.result-panel {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(23, 29, 24, 0.9);
  box-shadow: var(--shadow);
}

.sim-panel {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  padding: 1.1rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.result-panel {
  display: grid;
  gap: 0.95rem;
  padding: 1rem;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.eyebrow {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(1.75rem, 3.1vw, 2.55rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  letter-spacing: -0.015em;
}

.badge,
.pill-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(244, 196, 78, 0.42);
  background: rgba(244, 196, 78, 0.08);
  color: var(--gold);
  padding: 0.32rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 999px;
  white-space: nowrap;
}

/* Preset Bar */
.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 15, 0.6);
}

.preset-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.2rem;
}

.preset-chip {
  border: 1px solid rgba(184, 197, 174, 0.26);
  border-radius: 999px;
  background: rgba(32, 39, 31, 0.85);
  color: var(--muted);
  padding: 0.26rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    color 140ms ease,
    background 140ms ease;
}

.preset-chip:hover {
  border-color: rgba(144, 217, 87, 0.6);
  color: var(--text);
}

.preset-chip.is-active {
  border-color: var(--green);
  background: rgba(144, 217, 87, 0.15);
  color: var(--green);
}

/* Form Controls */
.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  margin: 0;
  background: rgba(32, 39, 31, 0.72);
  min-width: 0;
}

legend {
  padding: 0 0.35rem;
  color: var(--gold);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.wide,
.photo-field,
.run-button {
  grid-column: 1 / -1;
}

.upload-zone {
  position: relative;
  min-height: 4.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border: 1px dashed #6a795e;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragover {
  border-color: var(--green);
  background: rgba(144, 217, 87, 0.07);
  color: var(--text);
}

.upload-zone.is-loaded {
  border-color: rgba(144, 217, 87, 0.95);
  background: rgba(144, 217, 87, 0.09);
  color: var(--text);
}

.upload-zone.is-loaded .upload-icon {
  background: var(--gold);
}

.upload-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--green);
  color: #172013;
  font-weight: 900;
}

.upload-status {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.upload-status.is-loaded {
  color: var(--green);
  font-weight: 700;
}

.upload-status.is-error {
  color: var(--red);
  font-weight: 700;
}

.upload-preview {
  display: grid;
  grid-template-columns: 4.25rem 1fr;
  gap: 0.75rem;
  align-items: center;
  margin: 0.65rem 0 0;
  padding: 0.5rem;
  border: 1px solid rgba(144, 217, 87, 0.38);
  border-radius: 8px;
  background: rgba(16, 21, 15, 0.72);
}

.upload-preview img {
  width: 4.25rem;
  height: 4.25rem;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(237, 246, 219, 0.28);
  background-color: #1c221b;
}

.upload-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.upload-preview figcaption {
  color: var(--green);
  font-weight: 800;
  font-size: 0.84rem;
}

.ghost-button {
  border: 1px solid rgba(239, 109, 91, 0.45);
  border-radius: 6px;
  background: rgba(239, 109, 91, 0.1);
  color: #ff9c8e;
  padding: 0.28rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button:hover {
  background: rgba(239, 109, 91, 0.2);
}

.base-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.market-row {
  grid-column: 1 / -1;
}

.field-row,
.slider-row {
  display: grid;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.slider-row + .slider-row {
  margin-top: 0.55rem;
}

.field-row label,
.field-label {
  display: grid;
  gap: 0.32rem;
}

.split {
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.height-control {
  display: grid;
  gap: 0.32rem;
}

.height-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.height-inputs label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.height-inputs span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid #525f4d;
  background: #10150f;
  color: var(--text);
  border-radius: 6px;
  padding: 0.52rem 0.6rem;
  font-size: 0.9rem;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

.slider-row {
  grid-template-columns: minmax(9.5rem, 12.5rem) 1fr 2.6rem;
  align-items: center;
  gap: 0.55rem;
}

.slider-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 700;
}

input[type="range"] {
  accent-color: var(--green);
  width: 100%;
}

.patch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(6.2rem, 1fr));
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.number-row {
  display: grid;
  gap: 0.3rem;
}

.run-button {
  min-height: 3.1rem;
  border: 0;
  border-radius: 8px;
  color: #161f0d;
  background: linear-gradient(90deg, var(--green), var(--gold));
  font-weight: 900;
  font-size: 0.96rem;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(144, 217, 87, 0.18);
  transition:
    transform 120ms ease,
    box-shadow 150ms ease;
}

.run-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(144, 217, 87, 0.28);
}

.run-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* Result View Tabs */
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-bottom: 0.2rem;
}

.view-tab {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(16, 21, 15, 0.7);
  color: var(--muted);
  padding: 0.42rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.view-tab:hover {
  color: var(--text);
  border-color: rgba(144, 217, 87, 0.5);
}

.view-tab.is-active {
  background: rgba(144, 217, 87, 0.14);
  border-color: var(--green);
  color: var(--green);
}

/* Stage & Telemetry Banner */
.stage {
  position: relative;
  display: grid;
  gap: 0.85rem;
  justify-items: center;
  padding: 1rem;
  overflow: hidden;
  background:
    linear-gradient(rgba(16, 20, 15, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 20, 15, 0.25) 1px, transparent 1px),
    radial-gradient(circle, rgba(101, 182, 255, 0.12), transparent 35rem),
    #21281f;
  background-size: 28px 28px, 28px 28px, auto, auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage.is-telemetry-only {
  padding: 0.8rem 0.95rem;
}

.stage.is-telemetry-only .portrait-stack {
  display: none;
}

.telemetry-banner {
  width: 100%;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.telemetry-cell {
  display: grid;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(237, 246, 219, 0.12);
  border-radius: 7px;
  background: rgba(16, 20, 15, 0.72);
}

.telemetry-cell span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.telemetry-cell strong {
  color: var(--text);
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
}

.portrait-stack {
  position: relative;
  z-index: 1;
  width: min(100%, 25rem);
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(237, 246, 219, 0.2);
  background:
    linear-gradient(45deg, rgba(237, 246, 219, 0.06) 25%, transparent 25% 75%, rgba(237, 246, 219, 0.06) 75%),
    linear-gradient(45deg, rgba(237, 246, 219, 0.06) 25%, transparent 25% 75%, rgba(237, 246, 219, 0.06) 75%),
    rgba(16, 20, 15, 0.35);
  background-position: 0 0, 12px 12px, 0 0;
  background-size: 24px 24px, 24px 24px, auto;
  transform: translateZ(0);
  --jacked-scale: 1;
  --handsome: 0;
  --glow: 0;
  --chud: 0;
  transition:
    width 420ms cubic-bezier(0.16, 1, 0.3, 1),
    aspect-ratio 420ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 300ms ease;
}

.portrait-stack::before,
.portrait-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.portrait-stack::before {
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.78) 45%, rgba(244, 196, 78, 0.32) 52%, transparent 64%),
    radial-gradient(circle at 50% 46%, rgba(144, 217, 87, 0.22), transparent 42%);
  mix-blend-mode: screen;
  transform: translateX(-105%);
}

.portrait-stack::after {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.45), transparent 30%),
    radial-gradient(circle at 50% 52%, rgba(101, 182, 255, 0.22), transparent 55%);
  mix-blend-mode: screen;
}

.portrait-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition:
    opacity 280ms ease,
    filter 280ms ease,
    transform 280ms ease;
}

.portrait-placeholder {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(184, 197, 174, 0.32);
  border-radius: 999px;
  background: rgba(16, 20, 15, 0.78);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.portrait-placeholder[hidden],
.portrait-image[hidden] {
  display: none;
}

.compare-label {
  position: absolute;
  top: 0.75rem;
  z-index: 4;
  display: none;
  border: 1px solid rgba(237, 246, 219, 0.28);
  border-radius: 999px;
  background: rgba(16, 20, 15, 0.78);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0.26rem 0.55rem;
  text-transform: uppercase;
}

.compare-before {
  left: 0.75rem;
}

.compare-after {
  right: 0.75rem;
}

.portrait-before {
  filter: saturate(0.75) contrast(0.95);
}

.portrait-after {
  opacity: 0;
  filter: saturate(calc(1.1 + var(--handsome) * 0.72 - var(--chud) * 0.68))
    contrast(calc(1.04 + var(--handsome) * 0.18 - var(--chud) * 0.18))
    brightness(calc(1.02 + var(--glow) * 0.09 - var(--chud) * 0.22));
  transform: scale(calc(1 + var(--jacked-scale) * 0.022));
}

.portrait-stack.has-generated-image .portrait-after {
  filter: none;
  transform: none;
}

.portrait-stack.has-photo.is-evolved .portrait-after {
  opacity: 1;
}

.portrait-stack.has-photo.is-evolved .portrait-before {
  opacity: 0;
}

.portrait-stack.has-photo.is-evolved.view-before .portrait-before {
  opacity: 1;
}

.portrait-stack.has-photo.is-evolved.view-before .portrait-after {
  opacity: 0;
}

.portrait-stack.has-photo.is-evolved.view-before .compare-before {
  display: inline-flex;
}

.portrait-stack.has-photo.is-evolved.view-after .compare-after {
  display: inline-flex;
}

.portrait-stack.has-photo.is-evolved.compare-mode {
  width: min(100%, 44rem);
  aspect-ratio: 16 / 10;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.portrait-stack.has-photo.is-evolved.compare-mode .portrait-image {
  width: 50%;
  object-fit: cover;
}

.portrait-stack.has-photo.is-evolved.compare-mode .portrait-before {
  left: 0;
  right: auto;
  opacity: 1;
}

.portrait-stack.has-photo.is-evolved.compare-mode .portrait-after {
  left: auto;
  right: 0;
  opacity: 1;
  transform: none;
}

.portrait-stack.has-photo.is-evolved.compare-mode::before {
  left: 50%;
  width: 1px;
  background: rgba(237, 246, 219, 0.42);
  opacity: 1;
  transform: none;
  mix-blend-mode: normal;
}

.portrait-stack.has-photo.is-evolved.compare-mode::after {
  display: none;
}

.portrait-stack.has-photo.is-evolved.compare-mode .compare-label {
  display: inline-flex;
}

.stage-controls {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 20, 15, 0.78);
  z-index: 2;
}

.stage-mode-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.stage-mode-btn.is-active {
  background: rgba(144, 217, 87, 0.2);
  color: var(--green);
}

.portrait-stack.evolving {
  animation: evolveImpact 1.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.portrait-stack.evolving::before {
  animation: lightSweep 1.45s ease-out forwards;
}

.portrait-stack.evolving::after {
  animation: powerBloom 1.65s ease-out forwards;
}

.portrait-stack.has-photo.evolving .portrait-after {
  animation: evolveSwap 1.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.portrait-stack.has-photo.evolving .portrait-before {
  animation: sourceFade 1.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.evolution-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.evolution-flash.active {
  animation: flash 1.65s ease-out;
}

/* Cards */
.result-card {
  border: 1px solid var(--line);
  background: rgba(30, 37, 29, 0.92);
  border-radius: 8px;
  padding: 1.05rem;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Looksmatch & Clearing House Card */
.market-context-line {
  margin: 0.45rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.clearance-scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.clearance-box {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 15, 0.68);
}

.clearance-box.is-accent {
  border-color: rgba(144, 217, 87, 0.45);
  background:
    radial-gradient(circle at top right, rgba(144, 217, 87, 0.12), transparent 14rem),
    rgba(16, 21, 15, 0.78);
}

.clearance-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.clearance-numbers {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.clearance-numbers strong {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.clearance-delta {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
}

.clearance-delta.is-up,
.delta-pill.is-up {
  color: var(--green);
  background: rgba(144, 217, 87, 0.14);
}

.clearance-delta.is-down,
.delta-pill.is-down {
  color: var(--red);
  background: rgba(239, 109, 91, 0.15);
}

.clearance-delta.is-flat,
.delta-pill.is-flat {
  color: var(--muted);
  background: rgba(184, 197, 174, 0.12);
}

.clearance-box small {
  color: var(--muted);
  font-size: 0.78rem;
}

.asymmetry-callout {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--gold);
  border-radius: 0 6px 6px 0;
  background: rgba(244, 196, 78, 0.07);
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  line-height: 1.42;
  color: var(--muted);
}

.asymmetry-callout strong {
  color: var(--gold);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.axis-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.95rem;
}

.axis-chip {
  display: grid;
  gap: 0.22rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(184, 197, 174, 0.16);
  border-radius: 6px;
  background: rgba(16, 20, 15, 0.55);
}

.axis-chip span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.axis-chip strong {
  font-size: 1rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lm-section {
  padding-top: 0.85rem;
  margin-top: 0.85rem;
  border-top: 1px solid rgba(184, 197, 174, 0.16);
}

.lm-section h3,
.impact-list h3,
.next-lever-list h3 {
  margin: 0 0 0.55rem;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-compare-grid,
.archetype-grid,
.lm-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.match-column,
.archetype-card,
.channel-box,
.reality-box {
  padding: 0.75rem;
  border: 1px solid rgba(184, 197, 174, 0.18);
  border-radius: 7px;
  background: rgba(16, 20, 15, 0.58);
}

.match-column.is-projected {
  border-color: rgba(144, 217, 87, 0.38);
  background: rgba(144, 217, 87, 0.05);
}

.match-column p,
.archetype-card p,
.channel-box p,
.reality-box p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.match-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green);
}

.match-tag.is-gold {
  color: var(--gold);
}

.delta-caption {
  margin: 0.55rem 0 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

.archetype-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.archetype-card strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
}

.archetype-tag {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(101, 182, 255, 0.35);
  color: var(--blue);
  background: rgba(101, 182, 255, 0.08);
}

.quality-list {
  display: grid;
  gap: 0.5rem;
}

.quality-row {
  display: grid;
  grid-template-columns: minmax(9.5rem, 11.5rem) auto 1fr;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(184, 197, 174, 0.14);
  border-radius: 6px;
  background: rgba(16, 20, 15, 0.48);
  font-size: 0.85rem;
}

.quality-row strong {
  color: var(--text);
}

.quality-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold);
  background: rgba(244, 196, 78, 0.1);
  border: 1px solid rgba(244, 196, 78, 0.25);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.quality-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.lm-footer-grid {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(184, 197, 174, 0.16);
}

.reality-box {
  border-color: rgba(244, 196, 78, 0.35);
  background: rgba(244, 196, 78, 0.06);
}

.reality-box p {
  color: var(--text);
}

.channel-scores {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
}

/* Evolution Projection Card */
.verdict {
  color: var(--muted);
  line-height: 1.5;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.archetype-line {
  margin: 0.25rem 0 0;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 800;
}

.egg-callout {
  margin: 0.65rem 0;
  padding: 0.55rem 0.75rem;
  border: 1px dashed rgba(244, 196, 78, 0.45);
  border-radius: 6px;
  background: rgba(244, 196, 78, 0.08);
  color: var(--gold);
  font-size: 0.83rem;
  font-weight: 700;
}

.lore-read {
  margin: 0.65rem 0;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.score-ring-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  margin: 0.9rem 0;
}

.score-ring {
  width: 6.6rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.15rem;
  border: 2px solid rgba(144, 217, 87, 0.84);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(144, 217, 87, 0.16), transparent 62%),
    rgba(16, 21, 15, 0.76);
  box-shadow: 0 0 34px rgba(144, 217, 87, 0.12);
}

.score-ring span {
  color: var(--text);
  font-size: 2.3rem;
  font-weight: 900;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.score-ring small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-delta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 0.75rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.score-delta strong {
  color: var(--text);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stat-section-header {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10.5rem) 1fr 5.6rem;
  gap: 0.65rem;
  margin: 0.85rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-section-header span:last-child {
  text-align: right;
}

.stat-list {
  display: grid;
  gap: 0.5rem;
}

.stat-item {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10.5rem) 1fr 5.6rem;
  gap: 0.65rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-item strong {
  color: var(--text);
  font-size: 0.84rem;
}

.bar {
  position: relative;
  height: 0.58rem;
  border-radius: 999px;
  overflow: hidden;
  background: #11170f;
}

.bar-fill {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--blue));
  transition: width 260ms ease;
}

.bar-fill.is-negative {
  background: linear-gradient(90deg, var(--red), #ff9c8e);
}

.bar-baseline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--baseline);
  width: 2px;
  background: rgba(255, 255, 255, 0.75);
  z-index: 2;
}

.stat-value-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.stat-value-cell > span:first-child {
  color: var(--text);
  font-weight: 800;
}

.delta-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.08rem 0.34rem;
  border-radius: 999px;
}

.lever-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.impact-list,
.next-lever-list {
  display: grid;
  gap: 0.5rem;
}

.next-lever-list {
  padding-top: 0.8rem;
  border-top: 1px solid rgba(184, 197, 174, 0.18);
}

.impact-item {
  display: grid;
  grid-template-columns: minmax(6.8rem, 8.5rem) 1fr minmax(7rem, auto) auto;
  gap: 0.6rem;
  align-items: start;
  color: var(--muted);
  font-size: 0.84rem;
}

.impact-item strong,
.impact-item small {
  color: var(--text);
}

.impact-item small {
  font-weight: 700;
  font-size: 0.76rem;
}

.impact-item a,
.lever-item a,
.priority-item a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.impact-item a:hover,
.lever-item a:hover,
.priority-item a:hover {
  text-decoration: underline;
}

.empty-impacts {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.lever-item {
  display: grid;
  grid-template-columns: minmax(6.5rem, 8.5rem) 1fr auto;
  gap: 0.65rem;
  align-items: start;
  color: var(--muted);
  font-size: 0.86rem;
}

.priority-item {
  display: grid;
  grid-template-columns: minmax(6.8rem, 8.5rem) 1fr auto auto;
  gap: 0.65rem;
  align-items: start;
  border: 1px solid rgba(144, 217, 87, 0.25);
  border-radius: 8px;
  background: rgba(144, 217, 87, 0.06);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.7rem;
}

.priority-item strong,
.lever-item strong {
  color: var(--text);
}

.lever-impact {
  color: var(--green);
  font-weight: 800;
  white-space: nowrap;
}

@keyframes evolveSwap {
  0%,
  22% {
    opacity: 0;
    transform: scale(0.985);
  }

  60% {
    opacity: 0.96;
    transform: scale(calc(1 + var(--jacked-scale) * 0.03));
  }

  100% {
    opacity: 1;
    transform: scale(calc(1 + var(--jacked-scale) * 0.022));
  }
}

@keyframes sourceFade {
  0%,
  30% {
    opacity: 1;
    filter: saturate(0.75) contrast(0.95);
  }

  75%,
  100% {
    opacity: 0;
    filter: saturate(0.4) contrast(1.18) brightness(1.32);
  }
}

@keyframes evolveImpact {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(144, 217, 87, 0);
  }

  20% {
    transform: scale(0.988);
  }

  52% {
    transform: scale(1.028);
    box-shadow: 0 0 60px rgba(244, 196, 78, 0.25);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(144, 217, 87, 0);
  }
}

@keyframes lightSweep {
  0% {
    opacity: 0;
    transform: translateX(-105%);
  }

  20% {
    opacity: 0.88;
  }

  70% {
    opacity: 0.8;
    transform: translateX(105%);
  }

  100% {
    opacity: 0;
    transform: translateX(115%);
  }
}

@keyframes powerBloom {
  0%,
  18% {
    opacity: 0;
    transform: scale(0.94);
  }

  48% {
    opacity: 1;
    transform: scale(1.06);
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes flash {
  0%,
  58% {
    background:
      radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0), transparent 52%),
      rgba(255, 255, 255, 0);
  }

  68% {
    background:
      radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.38), transparent 46%),
      rgba(255, 255, 255, 0.14);
  }

  100% {
    background:
      radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0), transparent 52%),
      rgba(255, 255, 255, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portrait-stack,
  .portrait-image,
  .bar-fill {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sim-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 660px) {
  .app-shell {
    width: min(100vw - 1rem, 1260px);
    padding: 0.5rem 0 2rem;
  }

  /* Prevent iOS Safari auto-zoom on input focus */
  input[type="text"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }

  .sim-panel,
  .result-panel {
    padding: 0.85rem;
  }

  .portrait-stack.has-photo.is-evolved.compare-mode {
    aspect-ratio: 4 / 3;
  }

  .control-grid,
  .base-stats-grid,
  .clearance-scoreboard,
  .match-compare-grid,
  .archetype-grid,
  .lm-footer-grid {
    grid-template-columns: 1fr;
  }

  .telemetry-grid,
  .axis-strip,
  .patch-grid {
    grid-template-columns: 1fr 1fr;
  }

  .slider-row,
  .quality-row,
  .impact-item,
  .lever-item,
  .priority-item {
    grid-template-columns: 1fr;
  }

  .slider-row output {
    text-align: left;
  }

  .stat-section-header {
    display: none;
  }

  .stat-item {
    grid-template-columns: 1fr auto;
  }

  .stat-item .bar {
    grid-column: 1 / -1;
    order: 3;
  }

  .score-ring-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .score-delta {
    width: 100%;
  }
}
