:root {
  color-scheme: light;
  --canvas: #f4f0e8;
  --paper: #fffdf8;
  --ink: #1d211d;
  --muted: #6e7169;
  --line: #d9d5ca;
  --accent: #d85232;
  --accent-dark: #a93b23;
  --success: #337456;
  --danger: #b6422b;
  --shadow: 0 0 0 1px oklch(0 0 0 / 0.06), 0 1px 2px -1px oklch(0 0 0 / 0.06), 0 8px 24px -12px oklch(0 0 0 / 0.14);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 2%, rgb(216 82 50 / 0.08), transparent 24rem),
    var(--canvas);
}

button, textarea, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

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

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

.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-size: 15px; font-weight: 700; text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; color: var(--paper); background: var(--ink); border-radius: 10px; }
.brand-mark svg, .button-icon svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.connection { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: var(--muted); font-size: 13px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: #c19a3b; box-shadow: 0 0 0 3px rgb(193 154 59 / 0.15); }
.connection.online .status-dot { background: var(--success); box-shadow: 0 0 0 3px rgb(51 116 86 / 0.14); }
.connection.offline .status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgb(182 66 43 / 0.14); }

.intro { padding: 62px 0 42px; max-width: 720px; }
.eyebrow, .section-number { margin: 0; color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { margin: 10px 0 14px; max-width: 680px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 6vw, 72px); font-weight: 400; line-height: 0.98; letter-spacing: -0.045em; text-wrap: balance; }
.lede { margin: 0; max-width: 560px; color: var(--muted); font-size: 17px; line-height: 1.6; text-wrap: pretty; }

.workspace { max-width: 820px; }
.panel { background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 84px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 4px 0 0; font-size: 18px; line-height: 1.2; letter-spacing: -0.025em; }
.save-state { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.save-state.saving { color: #997221; }
.save-state.saved { color: var(--success); }
.save-state.error { color: var(--danger); }

textarea {
  display: block;
  width: 100%;
  height: 350px;
  padding: 24px;
  resize: vertical;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.65;
}
textarea::placeholder { color: #aaa79e; }
textarea:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.note-footer { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.copy-button { min-height: 44px; padding: 0 14px 0 16px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; background: #ece8de; font-size: 13px; font-weight: 700; cursor: pointer; transition-property: background-color, scale; transition-duration: 120ms; transition-timing-function: ease-out; }
.copy-button:hover { background: #e2ddd1; }
.copy-button:active { scale: 0.96; }
.copy-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button-icon { display: grid; place-items: center; }

footer { padding: 26px 4px 0; color: var(--muted); font-size: 12px; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 22px; max-width: calc(100% - 32px); padding: 11px 15px; color: white; background: var(--ink); border-radius: 11px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.18); font-size: 13px; font-weight: 650; opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition-property: opacity, transform; transition-duration: 150ms; transition-timing-function: ease-out; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.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: 800px) {
  .intro { padding: 46px 0 34px; }
  textarea { height: 290px; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 24px, 1120px); }
  .topbar { min-height: 66px; }
  .intro { padding: 38px 2px 28px; }
  h1 { font-size: 42px; }
  .lede { font-size: 15px; }
  .panel { border-radius: 18px; }
  .panel-heading { min-height: 76px; padding: 17px 18px; }
  textarea { height: 260px; padding: 20px 18px; }
  .note-footer { padding-left: 18px; }
  .dropzone { margin: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
