:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #eeeeea;
  --ink: #20201d;
  --muted: #6d6d66;
  --line: #ddddd5;
  --accent: #246b5f;
  --accent-strong: #164d44;
  --gold: #b7791f;
  --rose: #9f4356;
  --shadow: 0 24px 60px rgba(32, 32, 29, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(36, 107, 95, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(159, 67, 86, 0.08), transparent 40%),
    var(--bg);
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.workspace {
  width: min(1120px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(221, 221, 213, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 8px;
  overflow: hidden;
}

.topbar {
  min-height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 720;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: inline-grid;
  place-items: center;
}

.brand-mark::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}

.status-pill {
  min-width: 116px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.screen {
  display: none;
  padding: clamp(24px, 5vw, 56px);
}

.screen.active {
  display: block;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 48px;
  align-items: center;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.artifact {
  min-height: 330px;
  position: relative;
  display: grid;
  place-items: center;
}

.orbital {
  width: min(300px, 72vw);
  aspect-ratio: 1;
  border: 1px solid rgba(36, 107, 95, 0.25);
  border-radius: 50%;
  position: absolute;
  animation: rotate 18s linear infinite;
}

.orbital span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--rose);
}

.orbital span:nth-child(1) {
  top: 20px;
  left: 50%;
}

.orbital span:nth-child(2) {
  right: 28px;
  bottom: 64px;
  background: var(--accent);
}

.orbital span:nth-child(3) {
  left: 36px;
  bottom: 70px;
  background: var(--gold);
}

.vial {
  width: 110px;
  height: 230px;
  border: 2px solid rgba(32, 32, 29, 0.22);
  border-radius: 48px 48px 24px 24px;
  padding: 12px;
  display: flex;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.65);
}

.liquid {
  width: 100%;
  height: 58%;
  border-radius: 36px 36px 16px 16px;
  background: linear-gradient(180deg, #e8bc63, #246b5f);
  animation: brew 4s ease-in-out infinite;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.panel-heading,
.form-footer,
.review-actions,
.result-head,
.choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.provider-card,
.choice-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.provider-card {
  min-height: 106px;
  padding: 16px;
}

.provider-card strong,
.choice-card strong {
  display: block;
  margin-bottom: 8px;
}

.provider-card span,
.choice-card span {
  color: var(--muted);
  line-height: 1.45;
}

.provider-card:hover,
.provider-card.active,
.choice-card:hover {
  border-color: var(--accent);
  background: #f5faf7;
  transform: translateY(-2px);
}

.model-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-row.hidden {
  display: none;
}

select {
  min-width: min(360px, 100%);
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.narrow {
  max-width: 760px;
  margin: 0 auto;
}

.narrow.wide {
  max-width: 880px;
}

.idea-form {
  margin-top: 26px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(36, 107, 95, 0.12);
}

.form-footer {
  margin-top: 12px;
  color: var(--muted);
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 760;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.text-button {
  background: transparent;
  color: var(--accent);
}

.choice-head {
  align-items: flex-start;
  margin-bottom: 26px;
}

.choice-head h1 {
  font-size: clamp(28px, 4vw, 48px);
}

.cache-meter {
  min-width: 78px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  background: var(--surface);
}

.cache-meter span {
  font-size: 24px;
  font-weight: 820;
}

.cache-meter small {
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  touch-action: pan-y;
}

.choice-card {
  min-height: 270px;
  padding: clamp(20px, 4vw, 30px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.choice-card strong {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
}

.choice-card em {
  color: var(--accent);
  font-style: normal;
  font-weight: 760;
}

.option-meta {
  display: grid;
  gap: 10px;
}

.icon-slug {
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.error-banner {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(159, 67, 86, 0.34);
  border-radius: 8px;
  background: rgba(159, 67, 86, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink);
}

.is-loading .choice-card {
  transform: none;
}

.progress-track {
  height: 8px;
  margin-top: 24px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.25s ease;
}

.review-actions {
  margin-top: 14px;
}

.result-card {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.65;
}

.result-card h2 {
  margin-top: 20px;
}

.result-card pre {
  margin: 16px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes brew {
  50% {
    height: 68%;
  }
}

@media (max-width: 800px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .screen {
    padding: 28px 18px;
  }

  .intro-grid,
  .cards {
    grid-template-columns: 1fr;
  }

  .intro-grid {
    gap: 18px;
  }

  .artifact {
    min-height: 210px;
  }

  .vial {
    width: 76px;
    height: 156px;
  }

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

  .panel-heading,
  .form-footer,
  .review-actions,
  .result-head,
  .choice-head,
  .error-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .choice-card {
    min-height: 190px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 34px;
  }

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

  .status-pill {
    display: none;
  }
}
