:root {
  --navy-950: #06152c;
  --navy-900: #082044;
  --navy-800: #102f5d;
  --ink: #0e1a36;
  --muted: #54627b;
  --soft: #f6f9fc;
  --surface: #ffffff;
  --line: #d8e1ed;
  --line-strong: #c5d0dd;
  --green: #178d55;
  --green-strong: #0d7744;
  --green-soft: #eef9f3;
  --blue: #1967d2;
  --blue-soft: #eef6ff;
  --amber: #96620b;
  --amber-soft: #fff8ea;
  --shadow: 0 18px 48px rgba(13, 31, 64, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(22, 141, 85, 0.08), transparent 28%),
    linear-gradient(180deg, #fbfdff 0%, #f7fafc 56%, #f9fbff 100%);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 28px;
  min-height: 64px;
  padding: 10px 46px;
  background: linear-gradient(90deg, var(--navy-900), var(--navy-950));
  color: #fff;
  box-shadow: 0 12px 24px rgba(4, 14, 33, 0.16);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  color: #44c783;
  letter-spacing: 0;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 34px;
  font-weight: 800;
}

.main-nav a,
.header-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.main-nav a:hover {
  color: #8be5b4;
}

.header-action {
  justify-self: end;
  padding: 0 18px;
  border: 1px solid #47c98a;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-weight: 800;
}

.header-action:hover {
  background: rgba(68, 199, 131, 0.15);
}

.page-shell {
  width: min(1430px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 54px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 328px);
  align-items: center;
  gap: 30px;
  margin: 0 0 18px;
  padding: 0 0 8px;
}

.hero-copy h1 {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: clamp(42px, 5vw, 62px);
  line-height: 1.05;
  color: #071a3b;
}

.hero-copy p {
  max-width: 850px;
  margin: 10px 0 0;
  color: #485672;
  font-size: 20px;
  line-height: 1.35;
}

.hero-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border: 1px solid #b8dccb;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 250, 246, 0.94));
  color: #233657;
}

.hero-note p {
  margin: 0;
  line-height: 1.4;
}

.note-dot {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #5eb389;
  border-radius: 50%;
  color: var(--green-strong);
  font-size: 13px;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(450px, 0.98fr);
  gap: 16px;
}

.tool-panel,
.result-panel,
.content-card,
.about-panel,
.source-guide-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.tool-panel,
.result-panel {
  padding: 18px;
}

.panel-kicker {
  margin: 0 0 12px;
  font-weight: 800;
}

.source-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.source-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: #fff;
  color: #203150;
  font-weight: 800;
}

.source-tab:last-child {
  border-right: 0;
}

.source-tab span {
  max-width: 36px;
  overflow: hidden;
  border-radius: 999px;
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
}

.source-tab.is-active {
  background: var(--green-soft);
  color: var(--green-strong);
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.field-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
}

.field-group {
  min-width: 0;
}

.field-group.is-wide {
  grid-column: 1 / -1;
}

.field-group label,
.access-toggle {
  color: #122145;
  font-weight: 800;
}

.optional {
  color: var(--muted);
  font-weight: 600;
}

.field-group input {
  width: 100%;
  min-height: 40px;
  margin-top: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(13, 31, 64, 0.03);
}

.field-group input:focus,
.source-tab:focus-visible,
.text-button:focus-visible,
.generate-button:focus-visible,
.ghost-button:focus-visible,
.faq-item:focus-visible,
.header-action:focus-visible {
  outline: 3px solid rgba(25, 103, 210, 0.24);
  outline-offset: 2px;
}

.hint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.form-footer {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(210px, 268px);
  align-items: center;
  gap: 18px;
  margin-top: 20px;
}

.access-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.access-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.ghost-button,
.generate-button,
.text-button {
  border-radius: 6px;
  font-weight: 800;
}

.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--navy-800);
}

.ghost-button:hover {
  background: var(--blue-soft);
}

.generate-button {
  min-height: 46px;
  border: 0;
  background: linear-gradient(180deg, #1fa267, #0d7c48);
  color: #fff;
  box-shadow: 0 12px 22px rgba(13, 124, 72, 0.22);
}

.generate-button:hover {
  background: linear-gradient(180deg, #188f59, #086b3b);
}

.result-heading,
.in-text-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-heading h2,
.in-text-heading h3,
.review-list h3,
.section-heading h2,
.about-panel h2,
.detail-panel h2,
.detail-panel h3 {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: #0b1b39;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: end;
}

.text-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #9dd5b9;
  background: #fff;
  color: var(--green-strong);
}

.text-button:hover {
  background: var(--green-soft);
}

.citation-output,
.in-text-output {
  border-radius: 6px;
  font-size: 19px;
  line-height: 1.55;
}

.citation-output {
  min-height: 142px;
  margin-top: 12px;
  padding: 20px 18px;
  border: 1px solid #a8d8bf;
  background: linear-gradient(145deg, #fff, #f3fbf7);
}

.citation-output p {
  margin: 0;
}

.citation-output em {
  font-style: italic;
}

.divider {
  height: 1px;
  margin: 18px 0 14px;
  background: var(--line);
}

.in-text-output {
  min-height: 48px;
  margin-top: 8px;
  padding: 10px 16px;
  border: 1px solid #96c4ff;
  background: linear-gradient(180deg, #fff, #f3f8ff);
}

.review-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 260px);
  gap: 18px;
  align-items: end;
  margin-top: 22px;
}

.review-list {
  display: grid;
  gap: 6px;
}

.review-list h3 {
  margin-bottom: 2px;
  font-size: 16px;
}

.review-list label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #263754;
  line-height: 1.25;
}

.review-list input {
  margin-top: 3px;
  accent-color: var(--green);
}

.important-note {
  padding: 16px;
  border: 1px solid #edd398;
  border-radius: 6px;
  background: var(--amber-soft);
  color: #50370a;
}

.important-note p {
  margin: 8px 0 0;
  line-height: 1.35;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(340px, 1.08fr) minmax(320px, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.content-card {
  padding: 20px;
}

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

.section-heading span {
  display: inline-grid;
  min-width: 34px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
}

.section-heading h2 {
  font-size: 18px;
}

.steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  min-height: 28px;
  padding-left: 36px;
  line-height: 1.35;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.guide-copy {
  margin: 18px 0 0;
  color: #40506a;
  line-height: 1.55;
}

.example-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.example-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.example-row:first-child {
  border-top: 0;
}

.example-row > span,
.example-row > p {
  margin: 0;
  padding: 9px 12px;
}

.example-row > span {
  color: #1a2a48;
  font-weight: 800;
}

.example-head {
  background: #f7fafc;
}

.example-head span {
  color: #273856;
}

.example-row p {
  color: #283752;
  line-height: 1.35;
}

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

.faq-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.faq-item[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  margin-top: -8px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: #fbfdff;
  color: #30415d;
  line-height: 1.5;
}

.faq-answer.is-open {
  display: block;
}

.about-panel {
  margin-top: 16px;
  padding: 24px;
}

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

.about-columns p {
  margin: 0;
  color: #40506a;
  line-height: 1.62;
}

.source-guide-panel {
  margin-top: 16px;
  padding: 24px;
}

.source-guide-panel h2,
.source-guide-grid h3 {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: #0b1b39;
}

.source-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.source-guide-grid article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
}

.source-guide-grid h3 {
  font-size: 16px;
}

.source-guide-grid p {
  margin: 9px 0 0;
  color: #40506a;
  line-height: 1.56;
}

.detail-panel {
  margin-top: 16px;
  padding: 24px;
}

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

.detail-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
}

.detail-grid h3 {
  font-size: 17px;
}

.detail-grid p {
  margin: 10px 0 0;
  color: #40506a;
  line-height: 1.58;
}

.detail-footnote {
  max-width: 980px;
  margin: 18px 0 0;
  color: #40506a;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 7px;
  background: var(--navy-950);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    display: none;
  }

  .workspace,
  .hero,
  .content-grid,
  .about-columns,
  .source-guide-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    gap: 14px;
  }

  .result-panel {
    order: -1;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 10px 16px;
    gap: 12px;
  }

  .brand {
    font-size: 18px;
  }

  .header-action {
    padding: 0 12px;
  }

  .page-shell {
    width: min(100vw - 28px, 680px);
    padding-top: 18px;
  }

  .hero-copy h1 {
    font-size: 40px;
  }

  .hero-copy p {
    font-size: 18px;
  }

  .source-tabs,
  .field-list,
  .form-footer,
  .review-zone,
  .example-row {
    grid-template-columns: 1fr;
  }

  .source-tab {
    justify-content: flex-start;
    padding: 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .source-tab:last-child {
    border-bottom: 0;
  }

  .result-heading,
  .in-text-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-actions {
    justify-content: start;
  }

  .citation-output {
    font-size: 17px;
  }

  .content-card,
  .tool-panel,
  .result-panel,
  .about-panel,
  .source-guide-panel,
  .detail-panel {
    padding: 16px;
  }
}
