:root {
  color-scheme: light;
  --app-bg: #ecece8;
  --panel-bg: #fffefa;
  --panel-line: #dedbd2;
  --ink: #202421;
  --muted: #747d77;
  --control: #f7f6f1;
  --control-line: #d8d5ca;
  --focus: #2d5d4d;
  --poster-design-width: 540px;
  --poster-preview-scale: 1;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--app-bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.35) 1px, transparent 1px),
    var(--app-bg);
  background-size: 24px 24px;
}

.is-license-locked {
  overflow: hidden;
}

.license-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.45) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.45) 1px, transparent 1px),
    rgba(236, 236, 232, .96);
  background-size: 24px 24px;
}

.license-gate[hidden] {
  display: none;
}

.license-card {
  display: grid;
  gap: 14px;
  width: min(430px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: rgba(255, 254, 250, .98);
  box-shadow: 0 28px 90px rgba(42, 43, 38, .16);
}

.license-card h1 {
  margin-bottom: 0;
  font-size: 24px;
}

.license-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
}

.editor-panel,
.preview-panel {
  min-width: 0;
}

.editor-panel {
  position: sticky;
  top: 22px;
  align-self: start;
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: rgba(255, 254, 250, .94);
  box-shadow: 0 22px 60px rgba(42, 43, 38, .10);
}

.panel-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--panel-line);
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--focus);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 25px;
  line-height: 1.2;
}

.panel-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.form-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--panel-line);
}

.form-section:last-child {
  border-bottom: 0;
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-bar h2 {
  margin: 0;
  font-size: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-label {
  display: grid;
  gap: 7px;
  color: #3a413d;
  font-size: 13px;
  font-weight: 700;
}

.field-label input,
.field-label textarea,
.field-label select {
  width: 100%;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--control);
  outline: 0;
}

.field-label span {
  display: inline-flex;
  align-items: center;
}

.field-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0 8px 0 0;
  accent-color: var(--focus);
}

.field-label input,
.field-label select {
  height: 40px;
  padding: 0 11px;
}

.field-label input[type="checkbox"] {
  padding: 0;
}

.field-label textarea {
  min-height: 96px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.6;
}

.field-label input:focus,
.field-label textarea:focus,
.field-label select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(45, 93, 77, .13);
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: #fffefb;
}

.item-card + .item-card {
  margin-top: 10px;
}

.item-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.module-position {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.module-layout-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: #26352f;
}

.secondary-button {
  color: #24312c;
  border-color: var(--control-line);
  background: #fffdf7;
}

.danger-button {
  color: #8f3148;
  border-color: #e3bdc6;
  background: #fff3f5;
}

.ghost-button {
  color: #2d5d4d;
  border-color: transparent;
  background: transparent;
}

.icon-button {
  width: 38px;
  padding: 0;
  color: #2f3632;
  background: #f4f1e9;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 9px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: #fffefb;
  color: #28302c;
}

.theme-option.is-active {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(45, 93, 77, .12);
}

.swatches {
  display: flex;
  gap: 4px;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid rgba(30, 40, 36, .14);
}

.helper-text {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.preview-panel {
  display: block;
  min-height: 0;
}

.preview-toolbar {
  position: sticky;
  top: 22px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: rgba(255, 254, 250, .82);
}

.toolbar-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.poster-stage {
  display: grid;
  justify-items: center;
  align-items: start;
  overflow: visible;
  padding: 22px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: rgba(246, 245, 239, .74);
}

.poster-preview-frame {
  width: var(--poster-design-width);
  transform-origin: top center;
  zoom: var(--poster-preview-scale);
}

.export-capture-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: var(--poster-design-width);
  overflow: hidden;
  pointer-events: none;
}

.poster {
  width: var(--poster-design-width);
  padding: 18px;
  color: var(--poster-text);
  background: var(--poster-outer);
  border-radius: 26px;
  box-shadow: inset 0 0 0 1px rgba(30, 38, 34, .045);
}

.poster-paper {
  position: relative;
  min-height: 640px;
  padding: 46px 32px;
  border: 1px solid var(--poster-border);
  border-radius: 23px;
  background: var(--poster-paper);
  box-shadow: 0 24px 70px var(--poster-shadow), 0 2px 8px rgba(30, 38, 35, .06);
}

.poster-date {
  text-align: center;
  color: var(--poster-muted);
  font-size: 14px;
  letter-spacing: 2.8px;
}

.poster-title {
  margin: 8px 0 12px;
  text-align: center;
  color: var(--poster-title);
  font-size: 31px;
  font-weight: 900;
  line-height: 1.22;
}

.poster-dash {
  width: 44px;
  height: 4px;
  margin: 0 auto 24px;
  border-radius: 999px;
  background: var(--poster-main);
}

.poster-section {
  margin-top: 22px;
}

.poster-section:first-of-type {
  margin-top: 0;
}

.poster-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  color: var(--poster-main);
  font-size: 22px;
  font-weight: 900;
}

.poster-section-title::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  border-radius: 3px;
  background: var(--poster-main);
}

.poster-item {
  margin: 0 0 9px;
  font-size: 17px;
  line-height: 1.62;
}

.poster-item-title {
  color: var(--poster-strong);
  font-weight: 900;
}

.poster-module {
  margin: 16px 0;
  color: var(--poster-text);
}

.module-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--poster-main);
  font-size: 19px;
  font-weight: 900;
}

.module-icon {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--poster-paper);
  background: var(--poster-main);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .8px;
}

.poster-module-title {
  margin-bottom: 5px;
  color: var(--poster-main);
  font-size: 18px;
  font-weight: 900;
}

.module-new-words {
  padding: 15px 0 15px 15px;
  border-left: 4px solid var(--poster-main);
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 10px;
}

.word-pill {
  min-width: 82px;
  padding: 6px 13px 7px;
  border: 1px solid var(--module-border);
  border-radius: 999px;
  color: var(--poster-strong);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 2px 7px rgba(30, 38, 35, .06);
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.15;
}

.module-praise {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 15px 16px;
  border: 1px solid var(--module-border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,.76), var(--module-bg));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.praise-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 12%;
  color: white;
  background: var(--poster-main);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .6px;
  transform: rotate(-14deg);
}

.praise-copy {
  margin: 0;
  font-size: 18px;
  line-height: 1.75;
}

.praise-copy span:first-child {
  color: var(--poster-main);
  font-weight: 900;
}

.module-data {
  padding: 14px;
  border: 1px solid var(--module-border);
  border-radius: 14px;
  background: var(--module-bg);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.metric-card {
  min-height: 72px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(30, 38, 35, .06);
}

.metric-label {
  display: block;
  margin-bottom: 5px;
  color: var(--poster-muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  color: var(--poster-strong);
  font-size: 18px;
  line-height: 1.32;
}

.module-next-focus {
  padding: 14px;
  border: 1px dashed var(--module-border);
  border-radius: 14px;
  background: rgba(255,255,255,.5);
}

.focus-ladder {
  display: grid;
  gap: 8px;
}

.focus-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  align-items: start;
}

.focus-step span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: white;
  background: var(--poster-main);
  font-size: 13px;
  font-weight: 900;
}

.focus-step p {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--module-border);
  font-size: 17px;
  line-height: 1.55;
}

.focus-step:last-child p {
  border-bottom: 0;
  padding-bottom: 0;
}

.module-parent {
  position: relative;
  padding: 17px 16px 15px;
  border: 1px solid var(--module-border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.82), var(--module-bg));
}

.parent-badge {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--poster-paper);
  background: var(--poster-main);
  font-size: 12px;
  font-weight: 900;
}

.module-parent p {
  margin: 0;
  font-size: 17px;
  line-height: 1.7;
}

.module-custom {
  padding: 12px 14px;
  border: 1px solid var(--module-border);
  border-radius: 14px;
  background: var(--module-bg);
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 17px;
  line-height: 1.6;
}

.task-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  background: var(--poster-main);
  font-weight: 900;
}

.daily-quote {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px dashed var(--footer-line);
  text-align: center;
  color: var(--poster-muted);
}

.quote-en {
  margin-bottom: 4px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.55;
}

.quote-zh {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--poster-main);
  font-weight: 800;
}

.watermark {
  position: absolute;
  right: 24px;
  bottom: 18px;
  color: var(--poster-main);
  font-size: 12px;
  opacity: .22;
  font-weight: 800;
}

.placeholder {
  color: var(--poster-muted);
}

.score-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.58em;
  padding: 0 .58em;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-bg);
  font-weight: 900;
  white-space: nowrap;
}

.hl {
  padding: .08em .16em;
  border-radius: .28em;
  color: var(--accent);
  background: transparent;
  font-weight: 900;
}

.hl.percent,
.hl.quantity {
  background: var(--accent-bg);
}

.export-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.export-dialog::backdrop {
  background: rgba(28, 31, 29, .42);
}

.export-card {
  padding: 20px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: #fffefa;
  box-shadow: 0 26px 90px rgba(28, 31, 29, .22);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.theme-green-rose {
  --poster-outer: #f4f3ee;
  --poster-paper: #fffefb;
  --poster-border: rgba(45, 93, 77, .12);
  --poster-shadow: rgba(37, 47, 42, .14);
  --poster-text: #1c2421;
  --poster-muted: #78837d;
  --poster-main: #2d5d4d;
  --poster-title: #17211e;
  --poster-strong: #18231f;
  --accent: #a13a5b;
  --accent-bg: #fbf0f3;
  --accent-border: #e9d2da;
  --module-bg: #f7faf7;
  --module-border: #dde9df;
  --footer-line: rgba(45, 93, 77, .28);
}

.theme-navy-coral {
  --poster-outer: #f1f5f8;
  --poster-paper: #ffffff;
  --poster-border: rgba(45, 74, 109, .12);
  --poster-shadow: rgba(32, 51, 75, .13);
  --poster-text: #172033;
  --poster-muted: #758091;
  --poster-main: #2f4a6d;
  --poster-title: #172033;
  --poster-strong: #111827;
  --accent: #bf594a;
  --accent-bg: #fff0ed;
  --accent-border: #efd0ca;
  --module-bg: #f5f8fb;
  --module-border: #dce7f1;
  --footer-line: rgba(47, 74, 109, .26);
}

.theme-ink-gold {
  --poster-outer: #f3f0e8;
  --poster-paper: #fffdf8;
  --poster-border: rgba(65, 69, 60, .13);
  --poster-shadow: rgba(48, 46, 38, .14);
  --poster-text: #22241f;
  --poster-muted: #7d776b;
  --poster-main: #39463e;
  --poster-title: #22241f;
  --poster-strong: #151813;
  --accent: #a8792e;
  --accent-bg: #fff6e5;
  --accent-border: #ead9b7;
  --module-bg: #f8f6f0;
  --module-border: #e5dfd1;
  --footer-line: rgba(57, 70, 62, .26);
}

.theme-plum-sage {
  --poster-outer: #f5f2f4;
  --poster-paper: #fffefe;
  --poster-border: rgba(93, 68, 88, .12);
  --poster-shadow: rgba(64, 48, 60, .12);
  --poster-text: #261f26;
  --poster-muted: #827681;
  --poster-main: #5b4968;
  --poster-title: #261f26;
  --poster-strong: #1f1822;
  --accent: #a8425a;
  --accent-bg: #fff0f4;
  --accent-border: #edd0d9;
  --module-bg: #f8f7f5;
  --module-border: #e5e0df;
  --footer-line: rgba(91, 73, 104, .24);
}

.theme-teal-lime {
  --poster-outer: #eef5f3;
  --poster-paper: #ffffff;
  --poster-border: rgba(36, 88, 96, .12);
  --poster-shadow: rgba(32, 70, 75, .12);
  --poster-text: #17282b;
  --poster-muted: #718385;
  --poster-main: #285a64;
  --poster-title: #17282b;
  --poster-strong: #122225;
  --accent: #6f8640;
  --accent-bg: #f3f8e8;
  --accent-border: #dce8bf;
  --module-bg: #f3faf8;
  --module-border: #d8ebe6;
  --footer-line: rgba(40, 90, 100, .25);
}

.theme-charcoal-sage {
  --poster-outer: #f1f2ef;
  --poster-paper: #fffefa;
  --poster-border: rgba(38, 47, 44, .13);
  --poster-shadow: rgba(30, 38, 35, .14);
  --poster-text: #1d2422;
  --poster-muted: #777f7a;
  --poster-main: #252f2c;
  --poster-title: #1d2422;
  --poster-strong: #111615;
  --accent: #4f735f;
  --accent-bg: #edf5ef;
  --accent-border: #d1dfd5;
  --module-bg: #f7f8f5;
  --module-border: #e2e5dc;
  --footer-line: rgba(37, 47, 44, .25);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .editor-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .preview-panel {
    min-height: auto;
  }

  .preview-toolbar {
    position: static;
  }
}

@media (max-width: 620px) {
  .field-grid,
  .theme-grid,
  .module-position {
    grid-template-columns: 1fr;
  }

  .poster-stage {
    padding: 10px;
  }

  .poster {
    border-radius: 18px;
  }

  .poster-paper {
    border-radius: 18px;
  }

  .dialog-actions {
    flex-direction: column;
  }
}
