:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #6f6f6f;
  --line: #e6e1d8;
  --surface: #ffffff;
  --paper: #fbfaf7;
  --soft: #f2eee6;
  --accent: #8f5d43;
  --shadow: 0 16px 40px rgba(20, 20, 20, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  padding: 0 0 28px;
}

.hero-copy {
  max-width: 620px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 24px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.lede {
  max-width: 700px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

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

.editor,
.results {
  padding: clamp(18px, 3vw, 28px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.panel h2,
.panel h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.panel h2 {
  font-size: 1.35rem;
}

.panel h3 {
  font-size: 1rem;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: #303847;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
  resize: vertical;
  min-height: 116px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(143, 93, 67, 0.12);
}

.hint {
  margin: -4px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.compact {
  margin: 16px 0 22px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.primary-button {
  background: var(--ink);
  color: #fff;
  padding: 0 18px;
  box-shadow: 0 10px 28px rgba(27, 31, 42, 0.22);
}

.secondary-button,
.ghost-button {
  padding: 0 15px;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

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

.full {
  width: 100%;
}

.status {
  display: inline-flex;
  min-width: 72px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
}

.citation-box {
  min-height: 150px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: #fffdf9;
  padding: 18px;
  color: #252b36;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.7;
}

.explanation {
  min-height: 24px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.saved-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.saved-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 16px;
  padding-left: 22px;
}

.saved-list:empty::before {
  content: "No saved citations yet.";
  display: block;
  margin-left: -22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.saved-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.saved-list p {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

.saved-list button {
  min-height: 32px;
  background: #f9e5df;
  color: #8a2f24;
  padding: 0 10px;
  font-size: 0.82rem;
}

.advanced {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.advanced .field {
  margin: 14px 0 0;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .two,
  .three {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .saved-head {
    align-items: stretch;
    flex-direction: column;
  }

  .actions button {
    flex: 1 1 100%;
  }
}
