:root {
  color-scheme: light;
  --paper: #f2eee7;
  --paper-deep: #e8e1d6;
  --ink: #1d2320;
  --muted: #70766f;
  --muted-dark: #525951;
  --line: rgba(29, 35, 32, 0.15);
  --line-strong: rgba(29, 35, 32, 0.3);
  --green: #34584e;
  --green-dark: #243e37;
  --green-soft: #d8e1d9;
  --coral: #c46e56;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(242, 238, 231, 0.91), rgba(242, 238, 231, 0.91)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 35px,
      rgba(52, 88, 78, 0.08) 36px,
      transparent 37px,
      transparent 73px
    );
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.3;
  background:
    radial-gradient(circle at 15% 15%, rgba(196, 110, 86, 0.11), transparent 23rem),
    radial-gradient(circle at 90% 50%, rgba(52, 88, 78, 0.1), transparent 28rem);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.masthead {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--green-dark);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: var(--paper);
  background: var(--green);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.masthead-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

main {
  flex: 1;
}

.hero {
  max-width: 720px;
  padding: clamp(68px, 11vw, 126px) 0 64px;
}

.eyebrow,
.card-kicker {
  margin: 0 0 13px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 680px;
  margin: 0;
  color: var(--green-dark);
  font-family: var(--serif);
  font-size: clamp(52px, 7.5vw, 92px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.hero h1 em {
  color: var(--coral);
  font-style: italic;
}

.lede {
  max-width: 465px;
  margin: 28px 0 0;
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 18px;
  align-items: stretch;
}

.control-card,
.note-card {
  border: 1px solid var(--line);
  border-radius: 3px;
}

.control-card {
  padding: clamp(27px, 4vw, 44px);
  background: rgba(255, 253, 249, 0.61);
  box-shadow: 10px 12px 0 rgba(52, 88, 78, 0.05);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 37px;
}

.step-number {
  color: var(--coral);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1;
}

.card-heading h2,
.note-card h2,
.result-heading h2 {
  margin: 0;
  color: var(--green-dark);
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.025em;
}

.card-heading h2 {
  font-size: clamp(25px, 3vw, 35px);
  line-height: 1.05;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-row {
  display: flex;
  gap: 10px;
}

input[type="url"] {
  min-width: 0;
  flex: 1;
  height: 54px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.77);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="url"]::placeholder {
  color: #9a9e98;
}

input[type="url"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 88, 78, 0.14);
}

button[type="submit"] {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 156px;
  min-height: 54px;
  padding: 0 18px;
  color: #f7f4ed;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.02em;
  transition: background 160ms ease, transform 160ms ease;
}

button[type="submit"]:hover {
  background: var(--green-dark);
}

button[type="submit"]:active {
  transform: translateY(1px);
}

button[type="submit"]:focus-visible,
.text-action:focus-visible,
.wordmark:focus-visible {
  outline: 3px solid rgba(196, 110, 86, 0.55);
  outline-offset: 3px;
}

button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-arrow {
  font-size: 17px;
  font-weight: 400;
}

.field-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

code {
  padding: 2px 4px;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.status {
  display: flex;
  gap: 12px;
  min-height: 58px;
  margin-top: 32px;
  padding: 13px 15px;
  border-left: 2px solid var(--line-strong);
  background: rgba(232, 225, 214, 0.46);
}

.status[data-state="error"] {
  border-left-color: var(--coral);
  background: rgba(196, 110, 86, 0.09);
}

.status[data-state="working"] {
  border-left-color: var(--green);
  background: rgba(216, 225, 217, 0.56);
}

.status[data-state="success"] {
  border-left-color: var(--green);
  background: rgba(216, 225, 217, 0.8);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 6px;
  background: var(--muted);
  border-radius: 50%;
}

.status[data-state="working"] .status-dot {
  background: var(--green);
  animation: pulse 1s ease-in-out infinite alternate;
}

.status[data-state="error"] .status-dot {
  background: var(--coral);
}

.status[data-state="success"] .status-dot {
  background: var(--green);
}

.status-title,
.status-detail {
  margin: 0;
}

.status-title {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 750;
}

.status-detail {
  margin-top: 2px;
  color: var(--muted-dark);
  font-size: 12px;
}

@keyframes pulse {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

.rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.rule-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.rule-index {
  color: var(--coral);
  font-family: var(--serif);
  font-size: 13px;
}

.note-card {
  position: relative;
  overflow: hidden;
  padding: clamp(27px, 4vw, 43px) clamp(23px, 3vw, 34px);
  color: #edf1eb;
  background: var(--green);
}

.note-card::after {
  position: absolute;
  right: -48px;
  bottom: -73px;
  width: 190px;
  height: 190px;
  content: "";
  border: 1px solid rgba(237, 241, 235, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(237, 241, 235, 0.05), 0 0 0 38px rgba(237, 241, 235, 0.05);
}

.note-glyph {
  position: absolute;
  top: 18px;
  right: 26px;
  color: rgba(237, 241, 235, 0.34);
  font-family: var(--serif);
  font-size: 45px;
  line-height: 1;
}

.note-card .card-kicker {
  color: #e6a48f;
}

.note-card h2 {
  max-width: 220px;
  color: #f3f2e9;
  font-size: 31px;
  line-height: 1.06;
}

.note-card > p:not(.card-kicker):not(.note-small) {
  position: relative;
  z-index: 1;
  max-width: 270px;
  margin: 24px 0 0;
  color: rgba(237, 241, 235, 0.83);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
}

.note-rule {
  width: 54px;
  margin: 30px 0 20px;
  border-top: 1px solid rgba(237, 241, 235, 0.42);
}

.note-small {
  position: relative;
  z-index: 1;
  max-width: 260px;
  margin: 0;
  color: rgba(237, 241, 235, 0.62);
  font-size: 11px;
  line-height: 1.5;
}

.result-section {
  margin-top: 74px;
  padding-bottom: 74px;
}

.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 19px;
}

.result-heading h2 {
  font-size: clamp(29px, 4vw, 43px);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 17px;
  padding-bottom: 4px;
}

.text-action {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.text-action span {
  margin-left: 4px;
  color: var(--coral);
  font-size: 16px;
  font-weight: 400;
}

.result-save {
  padding: 0;
  color: var(--green-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.result-save:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.license-note {
  position: relative;
  z-index: 1;
  max-width: 260px;
  margin: 18px 0 0;
  color: rgba(237, 241, 235, 0.62);
  font-size: 11px;
  line-height: 1.5;
}

.license-note a {
  color: #f0c2b4;
  text-underline-offset: 3px;
}

.viewer-frame {
  height: min(78vh, 880px);
  min-height: 520px;
  overflow: hidden;
  background: #d8d4cb;
  border: 1px solid var(--line-strong);
  box-shadow: 10px 12px 0 rgba(52, 88, 78, 0.07);
}

.viewer-frame iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
}

.footer {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 84px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.footer-divider {
  color: var(--coral);
  font-size: 19px;
  line-height: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 30px, 650px);
  }

  .masthead {
    min-height: 72px;
  }

  .masthead-note {
    display: none;
  }

  .hero {
    padding: 68px 0 46px;
  }

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

  .note-card {
    min-height: 330px;
  }

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

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 22px, 500px);
  }

  .hero {
    padding-top: 56px;
  }

  .hero h1 {
    font-size: clamp(48px, 15vw, 72px);
  }

  .lede {
    font-size: 18px;
  }

  .control-card {
    padding: 24px 18px;
  }

  .card-heading {
    margin-bottom: 28px;
  }

  .input-row {
    flex-direction: column;
  }

  button[type="submit"] {
    width: 100%;
  }

  .rules {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .viewer-frame {
    height: 68vh;
    min-height: 420px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 17px 0;
  }

  .footer-divider {
    display: none;
  }
}
