:root {
  --ink: #142137;
  --muted: #607087;
  --paper: #ffffff;
  --canvas: #f4f7f5;
  --mist: #e9f5f0;
  --mint: #3cc99a;
  --mint-dark: #08785d;
  --coral: #e86155;
  --line: #d7e1e4;
  --error: #a12c25;
  --shadow: 0 20px 60px rgba(20, 33, 55, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "DM Sans", system-ui, sans-serif;
  letter-spacing: 0;
}

button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(8, 120, 93, 0.24);
  outline-offset: 2px;
}

.creator-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 max(22px, calc((100vw - 1440px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink);
  background: var(--mint);
  border: 1px solid #a7e8d3;
  border-radius: 50%;
  font-family: "Newsreader", Georgia, serif;
}

.privacy-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.creator-header-actions { display: flex; align-items: center; gap: 14px; }
.creator-language-picker select { min-height: 36px; padding: 0 28px 0 10px; color: var(--ink); background: #fff; border: 1px solid #b9c6cb; border-radius: 6px; cursor: pointer; font-size: 0.76rem; font-weight: 700; }
.status-dot { width: 8px; height: 8px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 0 4px rgba(60, 201, 154, 0.14); }

.creator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(460px, 0.86fr);
  width: min(1440px, 100%);
  min-height: calc(100dvh - 68px);
  margin: 0 auto;
}

.editor-panel { padding: 58px clamp(28px, 5vw, 74px) 90px; background: var(--paper); }
.editor-heading { max-width: 650px; }
.eyebrow { margin: 0 0 10px; color: var(--mint-dark); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }
h1, h2, h3, p { margin-top: 0; }
h1, .preview-toolbar h2, .monthbook-page h3 { font-family: "Newsreader", Georgia, serif; font-weight: 600; }
.editor-heading h1 { max-width: 560px; margin-bottom: 14px; font-size: clamp(2.75rem, 5vw, 4.5rem); line-height: 0.94; }
.editor-heading > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.6; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 620px; margin: 44px 0 0; border-bottom: 1px solid var(--line); }
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
}
.step span { display: grid; place-items: center; width: 22px; height: 22px; background: #edf1f2; border-radius: 50%; font-size: 0.68rem; }
.step.is-active { color: var(--mint-dark); border-bottom-color: var(--mint-dark); }
.step.is-active span, .step.is-complete span { color: #fff; background: var(--mint-dark); }

.form-section { min-width: 0; margin: 0; padding: 42px 0; border: 0; border-bottom: 1px solid var(--line); }
.form-section legend, .review-section h2 { margin-bottom: 24px; padding: 0; font-size: 1.05rem; font-weight: 700; }
.field-grid { display: grid; gap: 18px; }
.field-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; margin-bottom: 20px; }
.field-grid .field { margin-bottom: 20px; }
.field > span { font-size: 0.82rem; font-weight: 700; }
.field small, .photo-summary, .upload-zone small { color: var(--muted); font-size: 0.73rem; line-height: 1.45; }
.field input, .field textarea {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b9c6cb;
  border-radius: 6px;
  outline: none;
}
.field input { min-height: 46px; }
.field textarea { min-height: 126px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #7b8898; }
.field input:focus, .field textarea:focus { border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(60, 201, 154, 0.16); }
.field input:invalid:not(:placeholder-shown) { border-color: var(--error); }

.upload-zone {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 152px;
  padding: 24px;
  color: var(--ink);
  background: var(--mist);
  border: 1px dashed #82b5a5;
  border-radius: 8px;
  cursor: pointer;
}
.upload-zone:hover { background: #e0f1ea; border-color: var(--mint-dark); }
.upload-zone:active { transform: translateY(1px); }
.upload-symbol { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 8px; color: #fff; background: var(--mint-dark); border-radius: 50%; font-size: 1.55rem; font-weight: 400; }
.upload-zone strong { margin-bottom: 3px; }
.photo-summary { display: flex; justify-content: space-between; gap: 16px; margin: 12px 0 18px; }
.photo-summary span:first-child { color: var(--ink); font-weight: 700; }
.photo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-item {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  min-height: 94px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.photo-item img { width: 74px; height: 100%; min-height: 94px; object-fit: cover; }
.photo-item-content { display: grid; align-content: center; gap: 7px; min-width: 0; padding: 12px 38px 12px 12px; }
.photo-item-content strong { overflow: hidden; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.photo-item-content label { display: grid; gap: 3px; color: var(--muted); font-size: 0.64rem; }
.photo-item-content input { min-width: 0; height: 30px; padding: 0 7px; color: var(--ink); background: var(--canvas); border: 1px solid var(--line); border-radius: 4px; font-size: 0.7rem; }
.photo-controls { display: flex; gap: 4px; }
.icon-action {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}
.icon-action:hover { border-color: #91a0a9; }
.icon-action:disabled { opacity: 0.36; cursor: default; }
.remove-photo { position: absolute; top: 8px; right: 8px; color: var(--error); }

.review-section > p { max-width: 590px; margin-bottom: 24px; color: var(--muted); font-size: 0.88rem; line-height: 1.65; }
.check-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.check-list > div { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; min-height: 72px; border-bottom: 1px solid var(--line); }
.check-list > div > span { display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); background: #edf1f2; border-radius: 50%; font-size: 0.7rem; font-weight: 700; }
.check-list p { display: grid; gap: 3px; margin: 0; }
.check-list strong { font-size: 0.82rem; }
.check-list small { color: var(--muted); font-size: 0.72rem; }
.check-list .is-complete > span { color: #fff; background: var(--mint-dark); }
.check-list .is-complete > span::before { content: "✓"; }
.check-list .is-complete > span { font-size: 0; }
.check-list .is-complete > span::before { font-size: 0.78rem; }

.preview-panel {
  position: sticky;
  top: 68px;
  align-self: start;
  min-width: 0;
  min-height: calc(100dvh - 68px);
  padding: 40px clamp(24px, 4vw, 58px) 30px;
  background: #e5ece9;
}
.preview-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.preview-toolbar .eyebrow { margin-bottom: 5px; }
.preview-toolbar h2 { margin: 0; font-size: 1.65rem; }
.page-tabs { display: flex; padding: 3px; background: rgba(255, 255, 255, 0.76); border: 1px solid #cbd6d4; border-radius: 6px; }
.page-tab { min-height: 34px; padding: 0 11px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; cursor: pointer; font-size: 0.7rem; font-weight: 700; }
.page-tab.is-active { color: #fff; background: var(--ink); }

.preview-stage { display: grid; place-items: center; min-height: 0; margin: 28px auto 24px; }
.monthbook-page {
  position: relative;
  width: min(100%, 470px, calc((100dvh - 300px) * 210 / 297));
  aspect-ratio: 210 / 297;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(20, 33, 55, 0.12);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.monthbook-page[hidden] { display: none; }
.empty-photo { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; color: #738196; background: #dfe8e4; }
.empty-photo span { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; }
.empty-photo img { width: 100%; height: 100%; object-fit: cover; }
.cover-photo { position: absolute; inset: 0; }
.cover-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(9, 25, 40, 0.7), rgba(9, 25, 40, 0.05) 62%); }
.cover-preview-copy { position: absolute; z-index: 1; right: 9%; bottom: 9%; left: 9%; color: #fff; }
.cover-preview-copy p { margin-bottom: 8px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.cover-preview-copy h3 { margin-bottom: 7px; font-size: clamp(2.5rem, 5vw, 4.2rem); line-height: 0.92; }
.cover-preview-copy span { color: rgba(255,255,255,0.82); font-size: 0.78rem; }
.preview-page-number { position: absolute; right: 5%; bottom: 3.3%; color: rgba(20,33,55,0.45); font-size: 0.58rem; }
.cover-preview .preview-page-number { z-index: 2; color: rgba(255,255,255,0.65); }

.timeline-preview { padding: 7%; }
.timeline-preview header { display: flex; align-items: end; justify-content: space-between; gap: 18px; height: 15%; }
.timeline-preview header span { max-width: 34%; color: var(--coral); font-size: 0.62rem; font-weight: 700; text-transform: uppercase; }
.timeline-preview header h3 { max-width: 62%; margin: 0; font-size: clamp(1.5rem, 3vw, 2.3rem); line-height: 0.96; text-align: right; }
.timeline-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; grid-template-rows: 1fr 1fr 0.9fr; gap: 2%; height: 78%; margin-top: 4%; }
.timeline-grid .slot-large { grid-row: 1 / 3; }
.timeline-grid .slot-wide { grid-column: 1 / 3; }
.timeline-more { position: absolute; left: 7%; bottom: 3%; z-index: 2; padding: 5px 8px; color: var(--ink); background: rgba(255,255,255,0.9); border-radius: 3px; font-size: 0.56rem; font-weight: 700; }

.story-preview { display: grid; grid-template-rows: 45% 55%; }
.story-photo { width: 100%; height: 100%; }
.story-preview-copy { padding: 7% 8%; overflow: hidden; }
.story-preview-copy > p:first-child { margin-bottom: 7px; color: var(--coral); font-size: 0.6rem; font-weight: 700; text-transform: uppercase; }
.story-preview-copy h3 { margin-bottom: 10px; font-size: clamp(1.6rem, 3.3vw, 2.6rem); line-height: 0.95; }
.story-preview-copy > p:not(:first-child) { display: -webkit-box; margin-bottom: 12px; overflow: hidden; color: var(--muted); font-size: clamp(0.56rem, 1vw, 0.72rem); line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.story-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.story-notes span { color: var(--muted); font-size: 0.54rem; }
.story-notes b { display: block; overflow: hidden; color: var(--ink); font-size: 0.7rem; text-overflow: ellipsis; white-space: nowrap; }

.preview-actions { display: grid; grid-template-columns: auto minmax(180px, 1fr); gap: 10px; width: min(100%, 470px); margin: 0 auto; }
.primary-action, .secondary-action, .danger-action {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}
.primary-action { color: #0d2a22; background: var(--mint); border: 1px solid var(--mint); }
.primary-action:hover:not(:disabled) { background: #62ddb5; }
.primary-action:active:not(:disabled), .secondary-action:active, .danger-action:active { transform: translateY(1px); }
.primary-action:disabled { color: #738196; background: #cad4d1; border-color: #cad4d1; cursor: not-allowed; }
.secondary-action { color: var(--ink); background: transparent; border: 1px solid #9caaa9; }
.secondary-action:hover { background: rgba(255,255,255,0.55); }
.danger-action { color: #fff; background: var(--error); border: 1px solid var(--error); }
.export-note { width: min(100%, 470px); margin: 10px auto 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; text-align: right; }

.notice { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(390px, calc(100% - 40px)); padding: 13px 16px; color: #fff; background: var(--ink); border-radius: 6px; box-shadow: var(--shadow); font-size: 0.82rem; }
.notice.is-error { background: var(--error); }
.confirm-dialog { width: min(450px, calc(100% - 32px)); padding: 30px; color: var(--ink); background: #fff; border: 0; border-radius: 8px; box-shadow: 0 28px 90px rgba(20,33,55,0.28); }
.confirm-dialog::backdrop { background: rgba(12, 25, 39, 0.66); }
.confirm-dialog h2 { margin-bottom: 9px; font-size: 1.35rem; }
.confirm-dialog p { color: var(--muted); line-height: 1.55; }
.confirm-dialog > div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

@media (max-width: 1080px) {
  .creator-shell { grid-template-columns: minmax(0, 1fr) minmax(390px, 0.8fr); }
  .editor-panel { padding-right: 34px; padding-left: 34px; }
  .preview-panel { padding-right: 24px; padding-left: 24px; }
  .photo-list { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .creator-shell { display: block; }
  .editor-panel { padding: 40px 22px 54px; }
  .preview-panel { position: relative; top: auto; min-height: 0; padding: 42px 22px 34px; }
  .editor-heading h1 { font-size: 3.2rem; }
  .preview-stage { margin-top: 22px; }
  .monthbook-page { width: min(100%, 470px); }
}

@media (max-width: 560px) {
  .creator-header { height: 62px; padding: 0 16px; }
  .privacy-text { display: none; }
  .creator-header-actions { gap: 8px; }
  .creator-language-picker select { min-height: 34px; }
  .creator-shell { min-height: calc(100dvh - 62px); }
  .editor-panel { padding: 34px 18px 46px; }
  .editor-heading h1 { font-size: 2.75rem; }
  .steps { margin-top: 32px; }
  .step { justify-content: center; padding: 0 3px; font-size: 0.72rem; }
  .form-section { padding: 34px 0; }
  .field-grid.two-columns { grid-template-columns: 1fr; gap: 0; }
  .photo-summary { display: grid; gap: 4px; }
  .preview-panel { padding: 34px 16px 28px; }
  .preview-toolbar { display: grid; }
  .page-tabs { width: 100%; }
  .page-tab { flex: 1; }
  .monthbook-page { width: min(100%, 430px); }
  .preview-actions { grid-template-columns: 1fr; }
  .primary-action { grid-row: 1; }
  .export-note { text-align: left; }
  .confirm-dialog { padding: 24px 20px; }
}

html[lang^="zh"] h1,
html[lang^="zh"] .preview-toolbar h2,
html[lang^="zh"] .monthbook-page h3 {
  font-family: "Noto Sans SC", "Noto Sans TC", "PingFang SC", "Microsoft JhengHei", sans-serif;
  font-weight: 700;
}

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