:root {
  --bg: #02050a;
  --panel: #070b13;
  --panel-2: #0b101b;
  --line: #1b2638;
  --text: #edf7ff;
  --muted: #7c91ad;
  --cyan: #00d5ff;
  --cyan-soft: rgba(0, 213, 255, 0.14);
  --blue: #2468ff;
  --violet: #7a17ff;
  --green: #12b981;
  --warn: #f5b84b;
  --gold: #f7c65b;
  --rose: #ff5f9e;
  --amethyst: #a66cff;
  --sapphire: #1ba7ff;
  --emerald: #1ed6a3;
  --ink: #050611;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

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

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(247, 198, 91, 0.13), transparent 18rem),
    radial-gradient(circle at 58% 8%, rgba(0, 213, 255, 0.14), transparent 28rem),
    radial-gradient(circle at 90% 32%, rgba(166, 108, 255, 0.12), transparent 22rem),
    linear-gradient(180deg, #070816 0%, #02050a 52%, #05030c 100%);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 108px;
  padding: 18px 28px 20px;
  border-bottom: 1px solid rgba(247, 198, 91, 0.38);
  background:
    radial-gradient(circle at 18% 22%, rgba(247, 198, 91, 0.14), transparent 20rem),
    radial-gradient(circle at 82% 16%, rgba(255, 95, 158, 0.1), transparent 18rem),
    linear-gradient(90deg, rgba(0, 213, 255, 0.1), transparent 36%, rgba(166, 108, 255, 0.1)),
    linear-gradient(180deg, #11101d 0%, #040713 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34), inset 0 -1px 0 rgba(247, 198, 91, 0.18);
}

.topbar::before {
  position: absolute;
  inset: 10px 18px;
  border: 1px solid rgba(247, 198, 91, 0.14);
  border-radius: 8px;
  content: "";
  pointer-events: none;
}

.topbar::after {
  position: absolute;
  right: 28px;
  bottom: -1px;
  left: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--gold), var(--rose), var(--cyan), transparent);
  content: "";
  opacity: 0.75;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 1px solid rgba(247, 198, 91, 0.76);
  border-radius: 8px;
  color: var(--cyan);
  overflow: hidden;
  background: #02050a;
  box-shadow: inset 0 0 22px rgba(0, 213, 255, 0.2), 0 0 28px rgba(247, 198, 91, 0.12);
}

.brand-mark::after {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  content: "";
  pointer-events: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
}

.brand h1 {
  margin: 4px 0 0;
  font-size: clamp(1.85rem, 3.4vw, 3.45rem);
  font-style: italic;
  line-height: 0.9;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fff8d8 0%, #f7fcff 32%, #7ddfff 62%, #f7c65b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-kicker {
  display: inline-block;
  color: #bda76f;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.brand p {
  margin: 9px 0 0;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.system-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(247, 198, 91, 0.18);
  border-radius: 8px;
  background: rgba(2, 5, 10, 0.54);
}

.language-switch {
  width: 150px;
  padding: 4px;
  border: 1px solid rgba(247, 198, 91, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(247, 198, 91, 0.08), rgba(166, 108, 255, 0.08)),
    rgba(7, 11, 19, 0.86);
  box-shadow: inset 0 0 18px rgba(247, 198, 91, 0.05);
}

.status-chip,
.icon-button {
  min-height: 44px;
  border: 1px solid rgba(0, 213, 255, 0.2);
  border-radius: 8px;
  background: rgba(7, 11, 19, 0.72);
  color: var(--text);
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  font-weight: 800;
}

.status-chip strong {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--cyan);
  font-size: 0.78rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

.icon-button {
  width: 54px;
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 108px);
}

.control-panel {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid rgba(27, 38, 56, 0.9);
  background:
    linear-gradient(180deg, rgba(27, 167, 255, 0.04), transparent 22rem),
    rgba(4, 7, 13, 0.96);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  color: #fff8d8;
  font-size: 1.2rem;
  font-style: italic;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-header span {
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 900;
}

.field-label,
.group-title {
  display: block;
  margin-bottom: 9px;
  color: #93a8ca;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(43, 61, 88, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(7, 13, 26, 0.98), rgba(3, 6, 14, 0.98));
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 142px;
  padding: 14px;
  resize: vertical;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.48;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(247, 198, 91, 0.72);
  box-shadow: 0 0 0 3px rgba(247, 198, 91, 0.12), 0 0 18px rgba(0, 213, 255, 0.08);
}

.control-group {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(43, 61, 88, 0.84);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 213, 255, 0.05), transparent 46%),
    var(--panel);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented.tiny {
  width: 92px;
  grid-template-columns: 1fr 1fr;
}

.segmented button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.segmented button.active {
  background: linear-gradient(135deg, var(--sapphire), var(--amethyst) 52%, var(--gold));
  color: white;
  box-shadow: 0 10px 28px rgba(0, 213, 255, 0.14);
}

.run-button,
.secondary-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #2832f0 0%, var(--amethyst) 42%, var(--sapphire) 74%, var(--gold) 100%);
  color: white;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.run-button {
  margin-top: 12px;
  box-shadow: 0 18px 50px rgba(0, 126, 255, 0.2), 0 0 24px rgba(247, 198, 91, 0.12);
}

.secondary-button {
  min-height: 46px;
  letter-spacing: 0.08em;
}

.main-stage {
  min-width: 0;
  padding: 18px;
}

.stage-visual {
  position: relative;
  min-height: clamp(430px, 48vh, 620px);
  overflow: hidden;
  border: 1px solid rgba(247, 198, 91, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 42%, rgba(247, 198, 91, 0.08), transparent 18rem),
    radial-gradient(circle at center, rgba(16, 40, 70, 0.75), transparent 24rem),
    radial-gradient(circle at 78% 24%, rgba(166, 108, 255, 0.12), transparent 18rem),
    #010408;
  box-shadow: var(--shadow);
}

.stage-visual.is-expanded {
  position: fixed;
  inset: 16px;
  z-index: 40;
  min-height: auto;
  border-color: rgba(247, 198, 91, 0.48);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.78);
}

.genesis-chamber {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 34%, rgba(247, 121, 52, 0.18), transparent 32%),
    radial-gradient(circle at 78% 42%, rgba(27, 167, 255, 0.22), transparent 38%),
    linear-gradient(105deg, rgba(37, 14, 8, 0.7), rgba(2, 8, 18, 0.96) 46%, rgba(3, 25, 49, 0.78));
}

.genesis-chamber::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 58%, rgba(1, 4, 8, 0.72)),
    radial-gradient(circle at center, transparent 34%, rgba(0, 0, 0, 0.18));
  pointer-events: none;
  content: "";
}

.genesis-chamber canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 48% 46%, rgba(255, 221, 120, 0.16), transparent 18%),
    radial-gradient(circle at 25% 35%, rgba(247, 121, 52, 0.14), transparent 30%),
    radial-gradient(circle at 80% 42%, rgba(27, 167, 255, 0.18), transparent 34%),
    #020814;
  opacity: 0.98;
  transform: translateZ(0);
  will-change: transform;
}

.genesis-expand {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(247, 198, 91, 0.34);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.72);
  color: #fff0bf;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.genesis-expand:hover {
  border-color: rgba(247, 198, 91, 0.72);
  background: rgba(247, 198, 91, 0.1);
}

.genesis-hud {
  position: absolute;
  top: 14px;
  right: 64px;
  left: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(247, 198, 91, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 242, 198, 0.08), 0 18px 38px rgba(0, 0, 0, 0.22);
  color: #dcecff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  backdrop-filter: blur(12px);
}

.genesis-hud strong {
  flex: 0 0 auto;
  color: var(--gold);
  white-space: nowrap;
}

.genesis-hud span:not(#genesisReadout) {
  display: none;
}

#genesisReadout {
  min-width: 0;
  overflow: hidden;
  color: rgba(237, 247, 255, 0.9);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.genesis-controls {
  display: none;
}

.genesis-controls label {
  display: grid;
  gap: 4px;
}

.genesis-controls span {
  color: #b9c8dc;
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.genesis-controls input {
  width: 100%;
  accent-color: var(--gold);
}

.genesis-controls button {
  min-height: 34px;
  border: 1px solid rgba(247, 198, 91, 0.32);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(247, 198, 91, 0.2), rgba(0, 213, 255, 0.12));
  color: #fff8d8;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.genesis-controls button.is-active {
  border-color: rgba(255, 240, 191, 0.8);
  box-shadow: 0 0 24px rgba(247, 198, 91, 0.22);
}

.genesis-pipeline {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  max-width: min(500px, calc(100% - 260px));
  color: rgba(237, 247, 255, 0.76);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.82);
  font-family: "Cambria Math", "Segoe UI Symbol", "Segoe UI", sans-serif;
}

.genesis-phase {
  position: absolute;
  bottom: 16px;
  left: 18px;
  z-index: 3;
  max-width: min(390px, calc(100% - 36px));
  padding: 6px 9px;
  border-left: 2px solid var(--gold);
  background: rgba(2, 8, 18, 0.62);
  color: #fff1b8;
  font-family: "Cambria Math", "Segoe UI Symbol", "Segoe UI", monospace;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 0 14px rgba(247, 198, 91, 0.48);
}

.genesis-fallback {
  position: absolute;
  inset: auto 18px 18px;
  z-index: 3;
  display: none;
  padding: 10px 12px;
  border: 1px solid rgba(255, 95, 158, 0.34);
  border-radius: 8px;
  background: rgba(30, 6, 18, 0.84);
  color: #ffd8e6;
  font-size: 0.78rem;
  font-weight: 800;
}

#stageCaption {
  position: absolute;
  z-index: 4;
  top: 62px;
  left: 18px;
  max-width: min(260px, calc(100% - 90px));
  margin: 0;
  padding: 6px 9px;
  border-left: 2px solid rgba(247, 198, 91, 0.82);
  background: rgba(2, 8, 18, 0.58);
  color: #fff0bf;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-align: left;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.8), 0 0 18px rgba(247, 198, 91, 0.34);
  text-transform: uppercase;
  transform: none;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.tabs button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050810;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.tabs button.active {
  border-color: rgba(247, 198, 91, 0.7);
  color: var(--text);
  background: linear-gradient(135deg, rgba(0, 213, 255, 0.1), rgba(247, 198, 91, 0.08));
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.result-card,
.runtime-card,
.operator-card,
.trace-list li,
.setup-grid {
  border: 1px solid rgba(43, 61, 88, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 213, 255, 0.04), transparent 48%),
    rgba(7, 11, 19, 0.92);
}

.result-card {
  padding: 16px;
  border-left: 3px solid var(--gold);
}

.card-kicker {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.result-card h3 {
  margin: 8px 0;
  font-size: 1.28rem;
}

.answer-body {
  display: grid;
  gap: 12px;
  max-width: 980px;
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.72;
  contain: layout paint style;
}

.answer-body > * {
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
}

.answer-body p {
  margin: 0;
  color: rgba(236, 244, 255, 0.92);
}

.answer-body h4 {
  margin: 10px 0 0;
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-body ul,
.answer-body ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.answer-body li {
  padding-left: 4px;
  color: rgba(236, 244, 255, 0.92);
}

.answer-body strong {
  color: #fff3c4;
  font-weight: 950;
}

.answer-body code {
  padding: 2px 6px;
  border: 1px solid rgba(247, 198, 91, 0.2);
  border-radius: 6px;
  background: rgba(5, 8, 16, 0.82);
  color: #9fe7ff;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.9em;
}

.math-inline,
.math-block {
  color: #fff3c4;
  font-family: "Cambria Math", "STIX Two Math", Georgia, serif;
  font-weight: 700;
}

.math-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.12em;
  padding: 0 2px;
  vertical-align: baseline;
}

.math-block {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 4px 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid rgba(247, 198, 91, 0.24);
  border-radius: 8px;
  background: rgba(255, 202, 86, 0.06);
  line-height: 1.5;
  white-space: nowrap;
  contain-intrinsic-size: auto 74px;
}

.math-frac {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  margin: 0 0.16em;
  text-align: center;
  vertical-align: middle;
}

.math-frac > span:first-child {
  padding: 0 0.26em 0.08em;
  border-bottom: 1px solid currentColor;
}

.math-frac > span:last-child {
  padding: 0.08em 0.26em 0;
}

.math-inline sub,
.math-inline sup,
.math-block sub,
.math-block sup {
  line-height: 0;
}

.answer-body pre.code-block {
  position: relative;
  margin: 2px 0 6px;
  padding: 38px 16px 16px;
  overflow: auto;
  border: 1px solid rgba(247, 198, 91, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 202, 86, 0.08), transparent 32%),
    rgba(3, 7, 16, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 244, 196, 0.06);
  contain-intrinsic-size: auto 220px;
}

.answer-body pre.code-block code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: #dff7ff;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre;
}

.code-lang {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 3px 8px;
  border: 1px solid rgba(247, 198, 91, 0.28);
  border-radius: 999px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.answer-note {
  padding: 12px 14px;
  border: 1px solid rgba(247, 198, 91, 0.26);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(247, 198, 91, 0.1), rgba(0, 213, 255, 0.05));
  color: #fff3c4;
  font-weight: 850;
}

.result-card p {
  margin: 0;
  color: #c5d4e7;
  line-height: 1.7;
}

.trace-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-list li {
  padding: 14px;
}

.trace-list strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.trace-list span {
  color: var(--muted);
}

.operator-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.operator-toolbar span {
  color: var(--muted);
  white-space: nowrap;
  font-weight: 800;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.operator-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 12px;
  border-top-color: rgba(247, 198, 91, 0.22);
}

.operator-card h4 {
  margin: 0;
  font-size: 0.9rem;
}

.operator-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #b8c7da;
  font-size: 0.78rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: end;
}

.tag {
  max-width: 100%;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid rgba(247, 198, 91, 0.22);
  border-radius: 6px;
  color: #f3cd7d;
  font-size: 0.7rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-stack {
  display: grid;
  gap: 16px;
}

.api-key-card {
  display: grid;
  gap: 16px;
  max-width: 760px;
  padding: 18px;
  border: 1px solid rgba(247, 137, 47, 0.42);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(247, 198, 91, 0.1), rgba(132, 79, 255, 0.12)),
    rgba(15, 16, 31, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.api-key-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.api-key-card-header > div {
  display: grid;
  gap: 8px;
}

.api-key-card-header span {
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.api-key-card-header small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.55;
}

.api-key-card-header a {
  flex: 0 0 auto;
  color: #c8a7ff;
  font-size: 0.8rem;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.api-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.api-key-input-wrap {
  display: grid;
  gap: 7px;
}

.api-key-input-wrap span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.api-key-row input {
  min-height: 38px;
  border-color: rgba(255, 126, 38, 0.72);
  background: rgba(4, 10, 22, 0.9);
}

.api-key-status {
  display: none;
  min-height: 20px;
  padding: 8px 10px;
  border: 1px solid rgba(82, 255, 187, 0.22);
  border-radius: 8px;
  background: rgba(30, 255, 171, 0.08);
  color: #9cffd6;
  font-size: 0.82rem;
  font-weight: 850;
}

.api-key-status.visible {
  display: block;
}

.api-key-status.warning {
  border-color: rgba(255, 198, 91, 0.28);
  background: rgba(255, 198, 91, 0.08);
  color: #ffe2a1;
}

.secondary-button.compact {
  width: auto;
  min-width: 86px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff7a00, #ff9d10);
  font-size: 0.84rem;
  letter-spacing: 0;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.setup-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-grid .wide {
  grid-column: 1 / -1;
}

.setup-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 2px;
}

.setup-section-title span {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.setup-section-title small {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.free-models {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  padding: 16px;
  border: 1px solid rgba(247, 198, 91, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(247, 198, 91, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(2, 5, 10, 0.78), rgba(8, 7, 18, 0.78));
}

.free-models-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.free-models-header > div {
  display: grid;
  gap: 6px;
}

.free-models-header span {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.free-models-header small {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
  text-transform: none;
}

#selectedModelSummary {
  flex: 0 0 auto;
  max-width: 360px;
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid rgba(247, 198, 91, 0.35);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(247, 198, 91, 0.11), rgba(0, 213, 255, 0.07));
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.free-model-card {
  display: grid;
  gap: 8px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid rgba(43, 61, 88, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 213, 255, 0.05), transparent 42%),
    #050810;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.free-model-card:hover,
.free-model-card.active {
  border-color: rgba(247, 198, 91, 0.72);
  background:
    linear-gradient(135deg, rgba(247, 198, 91, 0.12), rgba(0, 213, 255, 0.08)),
    #050810;
}

.free-model-card strong {
  font-size: 0.92rem;
}

.free-model-card em {
  justify-self: start;
  padding: 4px 8px;
  border: 1px solid rgba(247, 198, 91, 0.28);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.free-model-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.35;
}

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

.chain-list {
  display: grid;
  gap: 8px;
}

.chain-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid rgba(247, 198, 91, 0.2);
  border-left: 2px solid var(--gold);
  border-radius: 8px;
  background:
    radial-gradient(circle at 0% 0%, rgba(247, 198, 91, 0.14), transparent 42%),
    linear-gradient(135deg, rgba(5, 11, 22, 0.96), rgba(18, 10, 31, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 242, 198, 0.025);
}

.chain-item::after {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(0, 213, 255, 0.06);
  border-radius: 6px;
  pointer-events: none;
  content: "";
}

.chain-item b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(247, 198, 91, 0.38);
  border-radius: 999px;
  background: rgba(247, 198, 91, 0.08);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 950;
}

.chain-item div {
  min-width: 0;
}

.chain-item strong {
  display: block;
  overflow: hidden;
  color: #fff8d8;
  font-size: 0.8rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-item span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-card {
  margin-top: 12px;
  padding: 10px;
}

.runtime-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.runtime-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.runtime-card dt {
  color: var(--muted);
}

.runtime-card dd {
  max-width: 160px;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 850;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-footer {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(180px, 0.7fr) minmax(150px, 0.52fr) minmax(280px, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 10px 24px;
  border-top: 1px solid rgba(247, 198, 91, 0.42);
  background:
    radial-gradient(circle at 12% 20%, rgba(247, 198, 91, 0.16), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(191, 84, 255, 0.14), transparent 28%),
    linear-gradient(90deg, rgba(11, 29, 78, 0.62), rgba(28, 8, 43, 0.5) 52%, rgba(5, 44, 52, 0.48)),
    #02040a;
  box-shadow: inset 0 1px 0 rgba(255, 242, 198, 0.08), 0 -16px 42px rgba(0, 0, 0, 0.2);
}

.footer-support h2 {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.footer-support h2 span:first-child {
  color: #ffffff;
  opacity: 0.72;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-links a,
.bank-pill,
.footer-credit a {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  text-decoration: none;
}

.bank-pill {
  padding: 6px 10px;
  border: 1px solid rgba(247, 198, 91, 0.28);
  border-radius: 6px;
  background: rgba(15, 12, 20, 0.82);
  box-shadow: inset 0 0 18px rgba(247, 198, 91, 0.04);
}

.footer-links a {
  padding: 6px 9px;
  border: 1px solid rgba(27, 38, 56, 0.72);
  border-radius: 6px;
  color: #b8c7da;
}

.footer-links a:hover {
  border-color: rgba(247, 198, 91, 0.44);
  background: rgba(247, 198, 91, 0.08);
}

.footer-center {
  color: #dfefff;
  font-size: clamp(0.76rem, 0.95vw, 0.92rem);
  font-style: italic;
  font-weight: 950;
  letter-spacing: 0.16em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
}

.footer-center span {
  color: var(--gold);
  font-style: normal;
}

.footer-counter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(247, 198, 91, 0.28);
  border-radius: 6px;
  background: rgba(3, 12, 24, 0.72);
  box-shadow: inset 0 0 22px rgba(0, 213, 255, 0.05);
}

.footer-counter-label {
  align-self: center;
  overflow: hidden;
  color: var(--gold);
  font-size: 0.61rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.footer-counter > strong {
  grid-row: span 2;
  align-self: center;
  color: #ffffff;
  font-family: "Cambria Math", "Segoe UI", sans-serif;
  font-size: 1.35rem;
  line-height: 1;
}

.footer-counter-details {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  color: #b8c7da;
  font-size: 0.62rem;
  font-weight: 800;
}

.footer-counter-details b {
  color: var(--cyan);
}

.footer-counter-details .online-metric {
  color: #bdf8d3;
}

.online-metric i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-radius: 50%;
  background: #45e58b;
  box-shadow: 0 0 8px rgba(69, 229, 139, 0.9);
}

.online-metric b {
  color: #72f0a7;
}

.footer-counter small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.56rem;
}

.footer-credit {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-credit a {
  color: #c99cff;
  font-style: italic;
}

.footer-credit .footer-id {
  color: #b8c7da;
  font-style: normal;
  opacity: 0.9;
}

.companion-apps {
  display: grid;
  gap: 16px;
  padding: 22px 28px 24px;
  border-top: 1px solid rgba(247, 198, 91, 0.18);
  background:
    radial-gradient(circle at 14% 14%, rgba(247, 198, 91, 0.08), transparent 28%),
    radial-gradient(circle at 86% 4%, rgba(255, 75, 142, 0.07), transparent 30%),
    linear-gradient(180deg, rgba(7, 10, 22, 0.98), rgba(5, 4, 15, 0.98));
}

.companion-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.companion-heading span {
  color: var(--gold);
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 950;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.companion-heading small {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

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

.tarot-card {
  position: relative;
  display: grid;
  min-height: 224px;
  place-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 22px 18px;
  border: 1px solid rgba(247, 198, 91, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 12%, rgba(247, 198, 91, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(0, 213, 255, 0.08), rgba(122, 23, 255, 0.08)),
    #050810;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.tarot-trajectory {
  background:
    radial-gradient(circle at 22% 18%, rgba(0, 213, 255, 0.22), transparent 30%),
    radial-gradient(circle at 82% 82%, rgba(191, 84, 255, 0.22), transparent 30%),
    linear-gradient(145deg, rgba(8, 33, 82, 0.88), rgba(31, 8, 66, 0.82)),
    #050810;
}

.tarot-passport {
  background:
    radial-gradient(circle at 18% 18%, rgba(247, 198, 91, 0.26), transparent 31%),
    radial-gradient(circle at 80% 78%, rgba(255, 75, 142, 0.18), transparent 32%),
    linear-gradient(145deg, rgba(58, 29, 10, 0.82), rgba(34, 10, 60, 0.82)),
    #050810;
}

.tarot-prime {
  background:
    radial-gradient(circle at 18% 18%, rgba(18, 185, 129, 0.24), transparent 30%),
    radial-gradient(circle at 84% 80%, rgba(247, 198, 91, 0.18), transparent 31%),
    linear-gradient(145deg, rgba(5, 49, 45, 0.86), rgba(49, 42, 9, 0.78)),
    #050810;
}

.tarot-card::before,
.tarot-card::after {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(247, 198, 91, 0.24);
  border-radius: 50%;
  content: "";
}

.tarot-card::before {
  top: -24px;
  left: -18px;
}

.tarot-card::after {
  right: -18px;
  bottom: -24px;
}

.tarot-card:hover {
  border-color: rgba(247, 198, 91, 0.72);
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32), 0 0 26px rgba(247, 198, 91, 0.14);
}

.tarot-number {
  position: absolute;
  top: 14px;
  left: 16px;
  color: #f3cd7d;
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.18em;
}

.tarot-icon {
  display: grid;
  width: 72px;
  height: 96px;
  place-items: center;
  border: 1px solid rgba(247, 198, 91, 0.52);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 240, 191, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(247, 198, 91, 0.11), rgba(122, 23, 255, 0.09)),
    rgba(5, 8, 16, 0.72);
  color: #fff0bf;
  font-size: 1.65rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
  box-shadow: inset 0 0 20px rgba(247, 198, 91, 0.08), 0 0 20px rgba(247, 198, 91, 0.08);
}

.tarot-card strong {
  font-size: 1.04rem;
}

.tarot-card small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.4;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

  .free-model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
  }

  .tarot-grid {
    grid-template-columns: 1fr;
  }

  .footer-center,
  .footer-credit {
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar,
  .brand,
  .system-strip {
    align-items: flex-start;
  }

  .topbar,
  .workspace,
  .setup-grid,
  .api-key-row,
  .free-models-header,
  .companion-heading,
  .setup-section-title,
  .app-footer,
  .footer-credit {
    display: block;
  }

  .topbar {
    padding: 16px;
  }

  .brand h1 {
    font-size: 2.25rem;
  }

  .brand p {
    letter-spacing: 0.22em;
  }

  .system-strip {
    width: 100%;
    margin-top: 16px;
    flex-wrap: wrap;
  }

  .main-stage {
    padding: 18px;
  }

  .control-panel {
    border-right: 0;
  }

  .stage-visual {
    min-height: 260px;
  }

  .stage-visual.is-expanded {
    inset: 8px;
  }

  .genesis-hud {
    top: 64px;
    right: 12px;
    left: 12px;
    min-width: 0;
    font-size: 0.62rem;
  }

  .genesis-expand {
    top: 12px;
    right: 12px;
  }

  .genesis-controls {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    padding: 10px;
  }

  .genesis-pipeline {
    display: none;
  }

  .genesis-phase {
    right: 64px;
    bottom: 14px;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #stageCaption {
    top: 14px;
    left: 16px;
    max-width: calc(100% - 88px);
    letter-spacing: 0.12em;
  }

  .free-model-grid {
    grid-template-columns: 1fr;
  }

  .api-key-card {
    max-width: none;
  }

  .secondary-button.compact {
    width: 100%;
    margin-top: 10px;
  }

  #selectedModelSummary {
    display: block;
    max-width: none;
    margin-top: 12px;
  }

  .footer-center {
    margin: 18px 0;
    letter-spacing: 0.12em;
  }

  .footer-counter {
    margin: 12px 0;
  }

  .companion-heading small {
    margin-top: 8px;
    text-align: left;
  }

  .footer-links {
    align-items: stretch;
  }

  .footer-links a,
  .bank-pill {
    display: inline-flex;
    align-items: center;
  }
}
