:root {
  color-scheme: light;
  --ink: #25183e;
  --muted: #625572;
  --violet: #7140d7;
  --violet-dark: #5b2abf;
  --border: #e9e1f3;
  --page: #fbf9fe;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 260px; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #9a70f1; outline-offset: 4px; }
.shell { width: min(100% - 48px, 1000px); margin-inline: auto; }

.site-header { background: #fff; border-bottom: 1px solid #eee7f6; }
.header-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--violet); color: #fff; box-shadow: 0 3px 10px #7140d733; }
.brand-accent { color: var(--violet); }
.header-tag { display: flex; align-items: center; gap: 8px; color: #5d467e; background: #f4edff; padding: 8px 13px; border-radius: 99px; font-size: .875rem; font-weight: 600; }
.header-tag svg { width: 17px; height: 17px; }

.hero { isolation: isolate; position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 282px; margin-block: 30px 26px; padding: 32px 46px; overflow: hidden; border-radius: 25px; border: 1px solid #e9dff8; background: radial-gradient(ellipse at 78% 52%, #e9dbff 0, transparent 56%), linear-gradient(112deg, #f3ebff, #f8f3ff 60%, #efe6fd); }
.hero-copy { position: relative; z-index: 2; }
.hero h1 { font-size: clamp(3rem, 6.7vw, 4.6rem); line-height: 1.08; letter-spacing: -.074em; font-weight: 800; margin: 0 0 16px; }
.hero h1 span { color: var(--violet); }
.hero p { max-width: 460px; color: #574668; line-height: 1.52; font-size: 1.0625rem; margin: 0; }
.hero-art { width: 320px; height: 218px; position: relative; flex: 0 0 auto; margin-right: 14px; }
.art-orbit { position: absolute; inset: -38px -25px; background-image: radial-gradient(#9b72e8 1px, transparent 1px); background-size: 14px 14px; mask-image: radial-gradient(ellipse, #0009, transparent 70%); }
.paper { position: absolute; width: 118px; height: 151px; border-radius: 13px; }
.paper-back { top: 31px; left: 87px; transform: rotate(-17deg); background: #d6bffb; border: 1px solid #c8adf3; box-shadow: 0 10px 30px #6b38b724; }
.paper-front { top: 23px; left: 114px; transform: rotate(11deg); background: white; border: 1px solid #f2eafc; padding: 37px 14px 13px; box-shadow: 0 13px 32px #6b38b72b; }
.paper-fold { position: absolute; right: 0; top: 0; width: 28px; height: 28px; background: linear-gradient(45deg, #efe4ff 49%, #f8f3ff 52%); border-radius: 0 12px 0 8px; }
.paper-picture { display: block; width: 100%; height: auto; }
.paper-line { width: 80%; height: 5px; background: #e3d5f9; border-radius: 6px; margin-top: 10px; }
.paper-line.short { width: 53%; margin-top: 6px; }
.art-badge { position: absolute; top: 151px; left: 183px; padding: 9px 15px; border-radius: 10px; transform: rotate(-9deg); color: white; background: #7948e1; box-shadow: 0 7px 18px #6b38b748; font-size: .875rem; font-weight: 800; letter-spacing: .06em; }
.art-spark { position: absolute; color: #a378ef; font-size: 25px; }
.spark-one { top: 28px; right: 46px; }
.spark-two { left: 52px; bottom: 37px; font-size: 17px; }

.editor { background: white; border: 1px solid var(--border); border-radius: 23px; box-shadow: 0 14px 36px #4a257709; }
.editor-header { padding: 24px 26px 19px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.editor-header h2 { margin: 0 0 4px; font-size: 1.35rem; letter-spacing: -.035em; }
.editor-header p { margin: 0; color: var(--muted); line-height: 1.5; }
.page-count { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 8px 12px; border-radius: 9px; background: #f3edfd; color: #6036ad; font-size: .875rem; font-weight: 700; }
.page-count svg { width: 17px; height: 17px; }
.editor-content { padding: 0 26px 22px; }
.drop-zone { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 25px 16px; border: 1.5px dashed #bd9ced; border-radius: 16px; background: #faf6ff; transition: background .16s, border-color .16s; }
.drop-zone.is-dragging { border-color: var(--violet); background: #eee1ff; }
.image-mark { display: grid; place-items: center; width: 51px; height: 51px; color: var(--violet); background: #eee3fe; border-radius: 14px; }
.image-mark svg { width: 25px; height: 25px; }
.drop-zone h3 { font-size: 1.125rem; margin: 12px 0 0; letter-spacing: -.025em; }
.paste-hint { margin: 8px 0 16px; color: var(--muted); font-size: .9375rem; line-height: 1.75; }
kbd { display: inline-block; min-width: 1.45em; border-radius: 5px; padding: 0 .34em; border: 1px solid #e5d9f6; border-bottom-width: 2px; background: #fff; color: #623e9e; font: 700 .875rem/1.45 'Segoe UI', system-ui, sans-serif; vertical-align: .05em; }
.import-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; border: 1px solid transparent; border-radius: 10px; padding: 0 15px; font-size: .9375rem; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.button svg { width: 18px; height: 18px; }
.button-secondary { background: #ede2ff; color: #6033b2; }
.button-secondary:hover { background: #e4d2ff; }
.button-outline { background: #fff; color: #54387e; border-color: #e4d8f5; }
.button-outline:hover:not(:disabled) { background: #f6efff; border-color: #cdb4ef; }
.button-outline:disabled { opacity: .65; cursor: default; }
.pick-button { position: relative; }
.pick-button:focus-within { outline: 3px solid #9a70f1; outline-offset: 4px; }
.pick-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.button[aria-disabled="true"] { cursor: wait; }
.notice { margin: 12px 0 0; color: #594176; font-size: .9375rem; line-height: 1.5; }
.notice:empty { margin: 0; }
.notice.error { color: #9a2c47; }

.pages { list-style: none; display: grid; gap: 9px; margin: 16px 0 0; padding: 0; }
.page-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 13px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fcfaff; }
.thumbnail { flex: 0 0 auto; width: 46px; aspect-ratio: 210 / 297; margin: 0; padding: 4px; display: grid; place-items: center; border: 1px solid #e6ddef; border-radius: 3px; background: #fff; }
.thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.page-details { min-width: 0; flex: 1; display: grid; gap: 4px; }
.page-details strong { font-size: .9375rem; }
.page-details span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .875rem; }
.caption-field { grid-column: 2 / -1; display: grid; gap: 5px; padding-bottom: 3px; }
.caption-field label { color: #54387e; font-size: .875rem; font-weight: 600; }
.caption-field textarea { min-width: 0; width: 100%; min-height: 44px; resize: vertical; padding: 9px 10px; border: 1px solid #e5d9f2; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; line-height: 1.4; }
.caption-field textarea::placeholder { color: #756687; }
.page-actions { display: flex; gap: 4px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #6036ad; }
.icon-button:hover:not(:disabled) { background: #eee3fc; }
.icon-button:disabled { color: #a39aaf; cursor: default; }
.icon-button svg { width: 17px; height: 17px; }

.export-bar { padding: 18px 26px; display: flex; align-items: end; gap: 14px; justify-content: space-between; border-top: 1px solid #eee6f6; background: #fcfaff; border-radius: 0 0 23px 23px; }
.export-actions { display: flex; gap: 8px; }
.export-actions .button { white-space: nowrap; }
.file-field { width: min(100%, 330px); }
.file-field label { font-size: .875rem; font-weight: 700; display: inline-block; margin-bottom: 6px; }
.filename-input { display: flex; align-items: center; border: 1px solid #e5d9f2; border-radius: 9px; background: #fff; overflow: hidden; }
.filename-input:focus-within { outline: 2px solid #9a70f1; outline-offset: 2px; }
.filename-input input { min-width: 0; width: 100%; border: 0; outline: 0; padding: 10px 12px; min-height: 42px; color: var(--ink); }
.filename-input span { color: var(--muted); padding: 0 12px; font-size: .875rem; border-left: 1px solid #eee6f6; }
.button-primary { min-height: 44px; color: #fff; background: var(--violet); white-space: nowrap; }
.button-primary:hover:not(:disabled) { background: var(--violet-dark); }
.button-primary:disabled { color: #695686; background: #e9dff8; cursor: default; }
.footer { padding: 19px 0 24px; font-size: .875rem; color: #625275; display: flex; align-items: center; justify-content: center; gap: 7px; }
.footer svg { width: 17px; height: 17px; color: var(--violet); }

.preview-dialog { width: min(100% - 24px, 650px); max-height: calc(100% - 24px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 18px; color: var(--ink); background: #fff; box-shadow: 0 24px 80px #25183e38; }
.preview-dialog::backdrop { background: #25183e88; }
.preview-header, .preview-controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px; }
.preview-header h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.025em; }
.preview-stage { position: relative; display: grid; place-items: center; padding: 12px; background: #f2ebfb; }
.preview-sheet { width: min(100%, 400px, max(135px, calc(70.7dvh - 122px))); aspect-ratio: 210 / 297; position: relative; background: #fff; box-shadow: 0 5px 18px #25183e20; }
.preview-sheet canvas { position: absolute; inset: 3.367% 4.762%; width: 90.476%; height: 93.266%; }
.preview-status { position: absolute; text-align: center; margin: 0 14px; padding: 8px 12px; border-radius: 8px; background: #fff; color: var(--muted); }
.preview-status:empty { display: none; }
.preview-controls span { text-align: center; color: #54387e; font-size: .875rem; }

@media (max-width: 700px) {
  .shell { width: min(100% - 32px, 1000px); }
  .hero { padding: 27px 25px; min-height: 245px; margin-top: 20px; }
  .hero-art { margin-right: -80px; transform: scale(.77); transform-origin: 0 50%; }
  .hero p { font-size: 1rem; }
}
@media (max-width: 500px) {
  .header-inner { height: 60px; }
  .header-tag { padding: 6px 8px; }
  .hero { min-height: 220px; }
  .hero h1 { font-size: clamp(2.4rem, 10.5vw, 3.25rem); }
  .hero-art { position: absolute; right: -120px; top: -13px; margin: 0; transform: scale(.52); transform-origin: 50% 50%; opacity: .72; }
  .hero p { max-width: 265px; }
  .editor-header { padding: 18px 15px 15px; }
  .editor-content { padding: 0 15px 15px; }
  .export-bar { padding: 14px 15px; flex-direction: column; align-items: stretch; }
  .file-field { width: 100%; }
  .export-actions { flex-wrap: wrap; }
  .export-actions .button { flex: 1 1 auto; }
  .page-row { gap: 8px; padding-inline: 7px; }
  .caption-field { grid-column: 1 / -1; }
  .page-actions { gap: 0; }
  .icon-button { width: 32px; }
  .preview-header, .preview-controls { padding-inline: 10px; }
  .preview-controls .button { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
