:root {
  --cream: #faf9f6;
  --white: #ffffff;
  --ink: #111111;
  --black-80: #313130;
  --black-60: #626260;
  --black-50: #7b7b78;
  --oat: #dedbd6;
  --sand: #d3cec6;
  --orange: #ff5600;
  --orange-dark: #d94800;
  --green: #2c6415;
  --report-blue: #65b5ff;
  --report-green: #0bdf50;
  --report-red: #c41c1c;
  --report-pink: #ff2067;
  --report-lime: #b3e01c;
  --sans: Saans, "Saans Fallback", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: SaansMono, "SaansMono Fallback", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--oat);
  background: rgba(250, 249, 246, 0.96);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.brand small {
  margin-top: 4px;
  color: var(--black-50);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button,
.tab {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 9px 14px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover,
.icon-button:hover,
.tab:hover {
  transform: scale(1.06);
}

.button:active,
.icon-button:active,
.tab:active {
  transform: scale(0.92);
}

.button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.button.primary:hover {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--white);
}

.button.secondary,
.icon-button {
  border-color: var(--oat);
  background: var(--cream);
}

.button.secondary:hover,
.icon-button:hover {
  border-color: var(--ink);
  background: var(--white);
}

.icon-button {
  min-height: 34px;
  padding: 7px 10px;
}

.app-shell {
  width: min(1560px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 480px);
  gap: 48px;
  align-items: end;
  padding: 28px 0 36px;
}

.intro h1 {
  max-width: 980px;
  margin: 0;
  font-size: clamp(46px, 7vw, 92px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.intro p {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--black-60);
  font-size: 18px;
  line-height: 1.45;
}

.method-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--oat);
  background: var(--white);
}

.method-summary span {
  display: flex;
  min-height: 56px;
  align-items: center;
  padding: 14px 16px;
  border-right: 1px solid var(--oat);
  border-bottom: 1px solid var(--oat);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}

.method-summary span:nth-child(2n) {
  border-right: 0;
}

.method-summary span:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(280px, 330px) minmax(520px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--oat);
  border-radius: 8px;
  background: var(--white);
  box-shadow: none;
  overflow: hidden;
}

.panel-head {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--oat);
  background: var(--cream);
}

.panel h2,
.methodology h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.input-panel,
.settings-panel {
  padding-bottom: 16px;
}

.input-panel label,
.settings-panel label {
  display: grid;
  gap: 7px;
  margin: 14px 16px 0;
  color: var(--black-60);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  border: 1px solid var(--oat);
  border-radius: 4px;
  background: var(--cream);
  color: var(--ink);
  padding: 11px 12px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--orange);
  background: var(--white);
}

fieldset {
  margin: 14px 16px 0;
  padding: 13px;
  border: 1px solid var(--oat);
  border-radius: 4px;
  background: var(--cream);
}

legend {
  padding: 0 6px;
  color: var(--black-80);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.radio-row,
.check-row {
  display: flex !important;
  grid-template-columns: unset !important;
  align-items: center;
  gap: 10px !important;
  margin: 10px 0 0 !important;
  color: var(--ink) !important;
  font-family: var(--sans) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  text-transform: none !important;
}

.radio-row input,
.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  flex: 0 0 auto;
}

.readiness {
  margin: 16px;
  padding: 15px;
  border: 1px solid var(--oat);
  border-radius: 4px;
  background: var(--cream);
}

.readiness > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.label {
  color: var(--black-60);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

#readinessScore {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

.meter {
  height: 10px;
  overflow: hidden;
  margin: 14px 0;
  border: 1px solid var(--oat);
  border-radius: 999px;
  background: var(--white);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--orange);
  transition: width 180ms ease;
}

.readiness p {
  margin: 0;
  color: var(--black-60);
  font-size: 13px;
  line-height: 1.35;
}

.output-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(560px, 1fr) auto;
}

.output-head span {
  color: var(--green);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--oat);
  background: var(--white);
  overflow-x: auto;
}

.tab {
  min-height: 36px;
  border-color: var(--oat);
  background: var(--cream);
  white-space: nowrap;
}

.tab.active {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--white);
}

#output {
  min-height: 560px;
  width: 100%;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--oat);
  background: #fffdfa;
  color: var(--black-80);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 18px;
  resize: none;
  white-space: pre;
  overflow: auto;
}

.output-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  background: var(--cream);
}

.output-footer p {
  max-width: 720px;
  margin: 0;
  color: var(--black-60);
  font-size: 13px;
  line-height: 1.35;
}

.methodology {
  margin-top: 14px;
  padding: 28px;
  border: 1px solid var(--oat);
  border-radius: 8px;
  background: var(--white);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.method-grid article {
  min-height: 160px;
  padding: 14px;
  border: 1px solid var(--oat);
  border-radius: 8px;
  background: var(--cream);
}

.method-grid article:nth-child(1) {
  border-top: 4px solid var(--orange);
}

.method-grid article:nth-child(2) {
  border-top: 4px solid var(--report-blue);
}

.method-grid article:nth-child(3) {
  border-top: 4px solid var(--report-green);
}

.method-grid article:nth-child(4) {
  border-top: 4px solid var(--report-pink);
}

.method-grid article:nth-child(5) {
  border-top: 4px solid var(--report-lime);
}

.method-grid article:nth-child(6) {
  border-top: 4px solid var(--report-red);
}

.method-grid h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.method-grid p {
  margin: 12px 0 0;
  color: var(--black-60);
  font-size: 13px;
  line-height: 1.4;
}

.prompt-page {
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.prompt-page h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(44px, 6vw, 80px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.prompt-page p {
  max-width: 740px;
  margin: 18px 0 0;
  color: var(--black-60);
  font-size: 18px;
}

.prompt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 14px;
}

.prompt-frame {
  min-height: 680px;
  width: 100%;
  overflow: auto;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--oat);
  border-radius: 8px;
  background: var(--white);
  color: var(--black-80);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  }

  .output-panel {
    grid-column: 1 / -1;
  }

  .method-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .top-actions .primary {
    grid-column: 1 / -1;
  }

  .button,
  .icon-button,
  .tab {
    transform: none !important;
  }

  .app-shell {
    width: min(100vw - 24px, 720px);
    padding-top: 18px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 10px;
  }

  .intro h1 {
    font-size: 44px;
  }

  .intro p {
    font-size: 16px;
  }

  .method-summary {
    grid-template-columns: 1fr;
  }

  .method-summary span {
    border-right: 0;
  }

  .method-summary span:nth-last-child(2) {
    border-bottom: 1px solid var(--oat);
  }

  .workspace,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .output-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #output {
    min-height: 500px;
    font-size: 12px;
  }

  .prompt-page {
    width: min(100vw - 24px, 720px);
    padding-top: 24px;
  }

  .prompt-page h1 {
    font-size: 44px;
  }
}
