:root {
  color-scheme: light;
  --bg: #eee2cf;
  --paper: #fffaf1;
  --paper-strong: #fffdf7;
  --ink: #24211b;
  --muted: #756d61;
  --line: #dccdb8;
  --line-strong: #bcae99;
  --accent: #2d6a66;
  --accent-dark: #174743;
  --red: #a33a31;
  --green-soft: #dcebe5;
  --amber-soft: #f4e2c8;
  --red-soft: #f1d4cf;
  --shadow: 0 24px 70px rgba(77, 63, 42, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 250, 238, 0.9) 0 18rem, transparent 34rem),
    linear-gradient(145deg, #f6eddf 0%, var(--bg) 48%, #dfcfb8 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border-radius: 6px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  font-weight: 750;
  letter-spacing: 0;
}

.brand-mark,
.upload-icon {
  display: inline-grid;
  place-items: center;
}

.brand-mark {
  width: 35px;
  height: 35px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}

svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  color: var(--accent-dark);
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.drop-stage {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 116px);
  padding: 40px 0;
}

.drop-stage.compact {
  min-height: auto;
  padding: 28px 0 18px;
}

.dropzone {
  width: min(620px, 100%);
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 250, 241, 0.66);
  box-shadow: var(--shadow);
}

.dropzone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(255, 253, 247, 0.92);
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-label {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 210px;
  padding: 24px;
  border: 1px solid rgba(188, 174, 153, 0.55);
  background:
    linear-gradient(rgba(255, 253, 247, 0.72), rgba(255, 253, 247, 0.72)),
    repeating-linear-gradient(
      135deg,
      rgba(45, 106, 102, 0.06) 0,
      rgba(45, 106, 102, 0.06) 1px,
      transparent 1px,
      transparent 13px
    );
  cursor: pointer;
}

.upload-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--accent-dark);
  background: var(--paper-strong);
}

.upload-icon svg {
  width: 31px;
  height: 31px;
}

.drop-title {
  font-size: clamp(2rem, 6vw, 4.6rem);
  font-weight: 760;
  line-height: 0.95;
  text-align: center;
  letter-spacing: 0;
}

.drop-subtitle {
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  max-width: 90%;
  overflow-wrap: anywhere;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 0;
  color: #fffaf0;
  background: var(--accent-dark);
  cursor: pointer;
}

.primary-button:disabled {
  cursor: not-allowed;
  color: rgba(36, 33, 27, 0.5);
  background: #d7c9b6;
}

.hidden {
  display: none !important;
}

.loading-panel,
.error-panel,
.summary-band,
.favorability-panel,
.results section,
.results aside section {
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.84);
  box-shadow: 0 12px 40px rgba(77, 63, 42, 0.08);
}

.loading-panel,
.error-panel {
  align-items: center;
  gap: 18px;
  width: min(720px, 100%);
  margin: 13vh auto 0;
  padding: 24px;
}

.loading-panel {
  display: flex;
}

.loading-panel h1 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.loading-panel p,
.error-panel p,
.section-heading p,
.rationale,
.baseline {
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex: 0 0 auto;
}

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

.error-panel {
  color: var(--red);
  display: block;
}

.results {
  padding: 34px 0 0;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: 28px;
  padding: 28px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.summary-band h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4.4vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.summary-band p {
  max-width: 72ch;
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.parties,
.terms-list,
.comparison-list,
.gotchas-list,
.main-column,
.side-column {
  display: grid;
  align-content: start;
  align-items: start;
  gap: 12px;
}

.side-column > section {
  align-self: start;
}

.party-pill {
  border-left: 4px solid var(--accent);
  padding: 12px;
  background: var(--paper-strong);
}

.party-pill strong {
  display: block;
  margin-bottom: 2px;
}

.party-pill span,
.clause {
  color: var(--muted);
  font-size: 0.9rem;
}

.favorability-panel {
  margin-top: 18px;
  padding: 24px 28px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.favor-bar {
  position: relative;
  height: 18px;
  overflow: hidden;
  background: #e0d2be;
}

.bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
}

.left-fill {
  left: 0;
  background: linear-gradient(90deg, #315a7d, #b6c8d7);
}

.right-fill {
  right: 0;
  background: linear-gradient(90deg, #c6d9ce, #2d6a66);
}

.midline {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: 50%;
  z-index: 2;
  border-left: 2px solid rgba(36, 33, 27, 0.42);
}

.marker {
  position: absolute;
  top: -5px;
  left: 50%;
  z-index: 3;
  width: 9px;
  height: 28px;
  background: var(--ink);
  transform: translateX(-50%);
}

.rationale {
  margin: 12px 0 0;
  line-height: 1.55;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  margin-top: 18px;
}

.results section,
.results aside section {
  padding: 22px;
}

.term-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  background: var(--paper-strong);
  border: 1px solid rgba(216, 203, 184, 0.88);
}

.term-title {
  display: grid;
  align-content: start;
  gap: 8px;
}

.term-title h3,
.gotcha h3,
.comparison-item h3 {
  margin: 0;
  font-size: 1rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 720;
  background: #ebe1d1;
  color: var(--ink);
}

.badge.low {
  background: var(--green-soft);
  color: var(--accent-dark);
}

.badge.medium {
  background: var(--amber-soft);
  color: #754411;
}

.badge.high,
.badge.critical {
  background: var(--red-soft);
  color: #7d251e;
}

.term-points {
  margin: 0 0 12px;
  padding-left: 18px;
  line-height: 1.55;
}

.term-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.term-note strong {
  color: var(--ink);
}

.comparison-item,
.gotcha {
  padding: 15px;
  background: var(--paper-strong);
  border: 1px solid rgba(216, 203, 184, 0.88);
}

.comparison-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.comparison-meta div {
  padding: 10px;
  background: #f2eadc;
}

.comparison-meta span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
}

.gotcha {
  border-left: 4px solid var(--red);
}

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

.gotcha .ask {
  color: var(--accent-dark);
}

.question-list,
.limit-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  line-height: 1.45;
}

.limit-list {
  color: var(--muted);
}

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

  .topbar,
  .summary-band,
  .content-grid,
  .term-row,
  .comparison-meta {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading {
    display: grid;
  }

  .status {
    white-space: normal;
  }

  .drop-stage {
    min-height: calc(100vh - 132px);
    padding: 24px 0;
  }

  .dropzone {
    min-height: 310px;
    padding: 16px;
  }

  .summary-band,
  .favorability-panel,
  .results section,
  .results aside section {
    padding: 18px;
  }
}
