:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #ffffff;
  --surface-strong: #ffffff;
  --border: #d9d9d9;
  --border-strong: #b9b9b9;
  --ink: #1e1e1e;
  --ink-soft: #555555;
  --accent: #a51e22;
  --accent-strong: #8b171a;
  --accent-soft: #bf5558;
  --rule: rgba(0, 0, 0, 0.12);
  --shadow: none;
  --radius-xl: 8px;
  --radius-lg: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
}

button,
textarea,
input {
  font: inherit;
}

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

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

.title-panel {
  padding: 34px 36px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.source-badge {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-badge-icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  flex: 0 0 auto;
}

.source-badge:hover {
  background: #faf7f7;
}

.title-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
}

.title-grid {
  display: block;
}

.title-copy {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: none;
  padding-right: 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
}

.panel-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 1.42rem;
  font-weight: 700;
  color: var(--accent);
}

h2 {
  margin: 0;
  font-family: "Libre Baskerville", serif;
  line-height: 1.16;
  font-weight: 700;
  font-size: clamp(2.15rem, 2.8vw, 2.7rem);
}

.lede,
.instruction-intro,
.meta,
.status {
  color: var(--ink-soft);
}

.lede {
  margin: 0;
  max-width: none;
  font-size: 1.06rem;
  line-height: 1.68;
}

.reference-line {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.5;
}

.reference-link {
  color: var(--accent-strong);
  text-decoration: none;
}

.reference-link:hover {
  text-decoration: underline;
}

.title-input {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Libre Baskerville", serif;
  font-size: clamp(1.8rem, 3vw, 3.05rem);
  line-height: 1.14;
  font-weight: 700;
}

.title-input::placeholder {
  color: rgba(29, 39, 51, 0.34);
}

.title-input:focus {
  outline: none;
  box-shadow: none;
}

.workspace {
  display: grid;
  gap: 20px;
}

.panel:not(.title-panel) {
  padding: 28px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-button,
.accent-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

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

.accent-button {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.ghost-button:hover,
.accent-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover {
  border-color: var(--border-strong);
  background: #faf7f7;
}

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

textarea {
  width: 100%;
  min-height: 380px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface-strong);
}

textarea:focus,
button:focus,
input:focus {
  outline: 3px solid rgba(110, 133, 151, 0.25);
  outline-offset: 2px;
}

.instruction-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.instruction-option {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.instruction-option:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: #faf7f7;
}

.instruction-checkbox {
  margin: 0;
  inline-size: 18px;
  block-size: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.instruction-title {
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
}

.instruction-checkbox:checked + .instruction-title,
.instruction-option:hover .instruction-title {
  color: var(--accent-strong);
}

.instruction-option:has(.instruction-checkbox:checked) {
  border-color: var(--accent);
  background: #fcf3f3;
}

.status {
  margin: 10px 0 0;
  line-height: 1.5;
}

.status.error {
  color: #8c2c1c;
}

.status.success {
  color: #157347;
  font-weight: 600;
}

.status.success::selection {
  color: #157347;
  background: rgba(21, 115, 71, 0.12);
}

code {
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(165, 30, 34, 0.08);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .page-shell {
    width: min(100% - 20px, 960px);
    padding-top: 20px;
  }

  .title-panel,
  .panel:not(.title-panel) {
    padding: 22px;
  }

  .title-copy {
    padding-right: 0;
  }

  .source-badge {
    position: static;
    margin-bottom: 16px;
    width: fit-content;
  }

  textarea {
    min-height: 300px;
  }
}
