:root {
  --cream: #f5f0e7;
  --paper: #fffdf8;
  --ink: #20332a;
  --green: #285b3a;
  --green-soft: #e3ece1;
  --line: #d9d0c1;
  --muted: #6d746c;
  --danger: #a42e25;
  --shadow: 0 12px 30px rgb(32 51 42 / 7%);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
a { color: var(--green); }
button, input, textarea { font: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #8aad91; outline-offset: 2px; }
.site-header { min-height: 72px; display: flex; align-items: center; gap: 18px; padding: 12px 5vw; border-bottom: 1px solid var(--line); }
.home-link { margin-left: auto; color: var(--muted); }
.brand { font-weight: 800; letter-spacing: .16em; text-decoration: none; }
.eyebrow { margin: 0; color: var(--green); font-size: .72rem; font-weight: 700; letter-spacing: .16em; }
.tabs { display: flex; gap: 8px; padding: 25px 5vw 0; }
.tabs button { border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 12px 25px; color: var(--muted); cursor: pointer; }
.tabs button.active { border-bottom-color: var(--green); color: var(--green); font-weight: 700; }
.workspace { max-width: 1250px; margin: auto; padding: 20px 5vw 60px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
#create-tab.active { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 26px; }
.sidebar { min-width: 0; }
.sidebar-heading { margin: 28px 0 4px; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.empty-state { min-height: 150px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 9px 14px; color: var(--ink); text-decoration: none; cursor: pointer; }
.button.primary { border-color: var(--green); background: var(--green); color: #fff; }
.button.danger { color: var(--danger); }
.button.full-width { width: 100%; }
.button[disabled], .tabs button[disabled], .article-row[disabled], .button.disabled { cursor: not-allowed; opacity: .55; }
.button.disabled { pointer-events: none; }
.article-row { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 15px 4px; color: var(--ink); text-align: left; cursor: pointer; }
.article-row.current { color: var(--green); }
.article-row small { display: block; margin-top: 4px; color: var(--muted); }
label { display: block; margin: 18px 0 7px; font-weight: 650; }
input, textarea { display: block; width: 100%; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 11px; color: var(--ink); }
input[type="file"] { padding: 8px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; clip-path: inset(50%) !important; }
.hint { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; }
.file-summary { margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.thumbnail-preview { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.thumbnail-preview img { width: 112px; height: 78px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; }
.editor-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.editor-heading h1 { margin: 4px 0 0; font-size: 1.6rem; }
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); gap: 18px; margin-top: 22px; }
.code-pane, .preview-pane { min-width: 0; }
.pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pane-heading h2, .preview-pane h2 { margin: 0 0 10px; font-size: 1rem; }
.pane-heading .button { margin: 0 0 10px; }
.button.compact { min-height: 36px; padding: 5px 10px; font-size: .86rem; }
.article-code { min-height: 620px; resize: vertical; tab-size: 2; white-space: pre; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.live-preview { display: block; width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.status { flex: none; border-radius: 999px; background: var(--green-soft); padding: 5px 10px; color: var(--green); font-size: .78rem; font-weight: 700; text-transform: capitalize; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 22px 0; }
.save-guidance { margin: -10px 0 18px; color: var(--muted); font-size: .88rem; }
.notice { min-height: 46px; padding: 11px 5vw; color: var(--green); }
.notice.bad { color: var(--danger); }
.notice .button { margin-left: 10px; min-height: 36px; padding: 5px 10px; }
.notice .copy-fallback { margin-top: 8px; }
.muted { color: var(--muted); }
.notes { margin-top: 30px; }
.note { border-left: 3px solid #afc7ad; background: #f7f5ef; padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note time { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.note-compose { margin-top: 18px; }
.article-media { margin-top: 34px; border-top: 1px solid var(--line); padding-top: 24px; }
.article-media > h2 { margin-bottom: 4px; }
.media-callout { border-left: 3px solid #afc7ad; background: #f7f5ef; padding: 10px 12px; }
.media-upload { max-width: 680px; margin: 20px 0; }
.media-upload .button { margin-top: 12px; }
.media-recovery { margin: 24px 0; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--paper); }
.media-recovery h3 { margin-top: 0; }
.media-counts { font-weight: 700; }
.media-recovery-group { margin: 16px 0; }
.media-recovery-group > summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 650; }
.media-recovery-row { padding: 14px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.media-id { display: block; font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.media-reference-status { margin: 8px 0; font-size: .83rem; }
.media-plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.media-choice { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; margin: 0; font-size: .86rem; }
.media-choice input { width: 20px; height: 20px; flex: none; }
.media-recovery-row > .media-code { margin: 10px 0; }
.media-checkpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.external-image-tool { display: grid; grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr) minmax(100px, .5fr); gap: 0 12px; margin: 20px 0; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #f9f6f0; }
.external-image-tool h3 { grid-column: 1 / -1; margin: 0; font-size: 1rem; }
.external-image-tool .button { align-self: end; margin-top: 12px; }
.media-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin-top: 22px; }
.media-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #f9f6f0; padding: 14px; }
.media-card h3 { margin: 12px 0 2px; overflow-wrap: anywhere; font-size: 1rem; }
.media-meta { margin: 0; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.media-preview img, .media-preview video { display: block; width: 100%; max-height: 260px; border-radius: 7px; background: #111; object-fit: contain; }
.media-preview audio { display: block; width: 100%; }
.media-code { font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
textarea.media-code { min-height: 72px; resize: vertical; }
.media-settings { display: grid; grid-template-columns: minmax(100px, .6fr) minmax(0, 1.4fr); gap: 0 10px; }
.media-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.media-actions .button { min-height: 38px; padding: 6px 10px; font-size: .84rem; }
.upload-row { max-width: 620px; }
.upload-row .button { margin-top: 12px; }
.inspiration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; margin-top: 25px; }
.inspiration-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 10px; }
.inspiration-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.figure-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; }
.figure-actions button { border: 0; background: transparent; color: var(--danger); cursor: pointer; }
.links-panel { margin-top: 28px; padding: 16px; }
.links-panel h2 { margin-top: 0; font-size: 1rem; }
.links-panel label { font-size: .9rem; }
.links-list { margin-top: 18px; }
.link-row { border-top: 1px solid var(--line); padding: 12px 0; }
.link-row p { margin: 0 0 8px; }
.link-row .state { color: var(--green); font-size: .8rem; }
.link-row.revoked .state { color: var(--danger); }
.private-link { margin-top: 8px; }
.private-link input { margin-bottom: 8px; font: .78rem ui-monospace, monospace; }
.private-warning { color: var(--danger); font-size: .78rem; }
.signed-out { max-width: 520px; margin: 15vh auto; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); padding: 40px; text-align: center; }
@media (max-width: 760px) {
  #create-tab.active { display: block; }
  .workspace { padding-right: 4vw; padding-left: 4vw; }
  .sidebar { margin-bottom: 24px; }
  .editor-heading { display: block; }
  .status { display: inline-block; margin-top: 10px; }
  .editor-split { grid-template-columns: 1fr; }
  .article-code, .live-preview { min-height: 440px; height: 55vh; }
  .external-image-tool, .media-settings { grid-template-columns: 1fr; }
}

@media (min-width: 761px) and (max-width: 1050px) {
  .editor-split { grid-template-columns: 1fr; }
}
