:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #242323;
  background: #f6f5f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #242323;
  --muted: #898783;
  --line: #e8e6e1;
  --accent: #7956cf;
  --accent-dark: #6140b5;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #f6f5f2; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.writer-header {
  position: sticky;
  z-index: 3;
  top: 0;
  min-height: 72px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  border-bottom: 1px solid #eceae6;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; width: fit-content; align-items: center; gap: 9px; color: #302943; text-decoration: none; font-size: 19px; font-weight: 650; letter-spacing: -.06em; }
.brand-mark { width: 29px; height: 29px; display: block; object-fit: contain; }
.header-center { display: grid; justify-items: center; gap: 4px; }
.header-eyebrow { color: #9c8ac7; font-size: 9px; font-weight: 750; letter-spacing: .16em; }
.save-status { color: #8c8984; font-size: 11px; }
.save-status.is-saving { color: #7956cf; }
.save-status.is-error { color: #b33e50; }
.writer-nav { justify-self: end; display: flex; gap: 16px; }
.back-link {
  min-height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  border: 1px solid #67313a;
  border-radius: 6px;
  color: #f0d9d7;
  background: #271619;
  text-decoration: none;
  font-size: 11px;
}
.back-link:hover { color: var(--accent-dark); }

.writer-layout { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 72px; display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 42px; align-items: start; }
.compose-column { min-width: 0; }
.compose-intro { margin: 0 0 25px 3px; }
.eyebrow { color: #9c8ac7; font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #9c82d5; box-shadow: 0 0 0 4px rgba(156, 130, 213, .12); }
.compose-intro h1 { margin: 18px 0 10px; color: #2b2535; font-family: Georgia, "Times New Roman", serif; font-size: clamp(35px, 4vw, 48px); font-weight: 400; line-height: 1.08; letter-spacing: -.045em; }
.compose-intro p { margin: 0; color: #898783; font-size: 12px; }

.editor-card { overflow: hidden; border: 1px solid #e9e6e1; border-radius: 14px; background: #fff; box-shadow: 0 12px 35px rgba(44, 37, 54, .045); }
.title-label { display: block; padding: 24px 28px 8px; color: #9a9690; font-size: 9px; font-weight: 740; letter-spacing: .14em; }
.title-input { width: calc(100% - 56px); height: 58px; margin: 0 28px 17px; padding: 0; border: 0; outline: 0; color: #282430; background: transparent; font-family: Georgia, "Times New Roman", serif; font-size: 29px; letter-spacing: -.035em; }
.title-input::placeholder { color: #c4c0c8; }
.title-input:focus-visible { box-shadow: 0 2px 0 #b8a5e5; }
.editor-topline { min-height: 49px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f0eeeb; }
.view-switch { height: 100%; display: flex; align-items: stretch; gap: 18px; }
.view-tab { position: relative; padding: 0 3px; border: 0; color: #96928d; background: transparent; font-size: 11px; }
.view-tab.is-active { color: #44375c; font-weight: 650; }
.view-tab.is-active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; content: ""; background: #8f72cf; }
.markdown-hint { color: #b0ada7; font-size: 10px; }
.toolbar { min-height: 43px; padding: 5px 17px; display: flex; align-items: center; gap: 5px; border-top: 1px solid #f0eeeb; border-bottom: 1px solid #f0eeeb; background: #fcfbfa; }
.toolbar button { min-width: 30px; height: 29px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 5px; color: #68646d; background: transparent; font-size: 11px; }
.toolbar button:hover { color: #6546ab; background: #f0ecf7; }
.toolbar button:focus-visible, .view-tab:focus-visible, .import-button:focus-visible, .publish-button:focus-visible { outline: 2px solid #9879da; outline-offset: 2px; }
.toolbar-divider { width: 1px; height: 19px; margin: 0 4px; background: #e9e6e1; }
.toolbar .scene-button { margin-left: auto; padding: 0 9px; color: #7862a6; }
.scene-button span { font-size: 10px; }
.story-editor { width: 100%; min-height: 430px; padding: 25px 29px; display: block; resize: vertical; border: 0; outline: 0; color: #3a3740; background: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.85; }
.story-editor::placeholder { color: #b6b2bb; }
.story-editor:focus-visible { box-shadow: inset 0 0 0 2px rgba(121, 86, 207, .18); }
.story-preview { min-height: 430px; padding: 25px 29px; color: #3a3740; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.85; overflow-wrap: anywhere; }
.story-preview h1, .story-preview h2 { color: #302943; font-weight: 500; line-height: 1.25; }
.story-preview h1 { font-size: 27px; }
.story-preview h2 { font-size: 21px; }
.story-preview blockquote { margin: 16px 0; padding: 4px 0 4px 17px; border-left: 2px solid #c8b7e9; color: #777080; }
.story-preview .scene-break { margin: 26px auto; width: 35px; border: 0; border-top: 1px solid #bca9de; }
.story-preview ul { padding-left: 23px; }
.editor-footer { min-height: 40px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f0eeeb; color: #a4a09a; font-size: 10px; }
.privacy-note { margin: 14px 0 0; display: flex; align-items: center; gap: 6px; color: #aaa7a0; font-size: 10px; }
.privacy-note svg { width: 14px; height: 14px; }

.writer-sidebar { padding-top: 127px; display: grid; gap: 13px; }
.sidebar-card { padding: 18px; border: 1px solid #e9e6e1; border-radius: 12px; background: #fff; }
.sidebar-heading { display: flex; align-items: center; gap: 10px; }
.sidebar-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #765ab4; background: #f2eef9; font-size: 15px; }
.sidebar-heading h2 { margin: 0 0 3px; color: #37333d; font-size: 12px; font-weight: 680; }
.sidebar-heading p { margin: 0; color: #a09c96; font-size: 10px; }
.sidebar-copy { margin: 15px 0 13px; color: #85817b; font-size: 10px; line-height: 1.65; }
.import-button { width: 100%; min-height: 38px; padding: 0 11px; display: flex; align-items: center; justify-content: space-between; border: 1px solid #e9e4f1; border-radius: 7px; color: #6149a0; background: #faf8fd; font-size: 10px; font-weight: 650; }
.import-button:hover { background: #f2edf9; }
.import-button:disabled { cursor: wait; opacity: .65; }
.pdf-hint { margin: 9px 0 0; color: #aaa69f; font-size: 9px; text-align: center; }
.tool-message { margin: 8px 0 0; color: #a54b51; font-size: 10px; line-height: 1.5; }
.tool-message.is-success { color: #398366; }
.drafts-card { padding-bottom: 12px; }
.draft-list { margin: 14px 0 0; padding: 0; list-style: none; }
.draft-list li + li { border-top: 1px solid #f1efec; }
.draft-list a { padding: 10px 0; display: block; overflow: hidden; color: #615a6b; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.draft-list a:hover { color: #6546ab; }
.draft-empty { padding: 12px 0 4px; color: #aaa69f; font-size: 10px; }
.publish-card { padding: 18px; border: 1px solid #e4dcef; border-radius: 12px; background: linear-gradient(145deg, #f8f5fc, #f2eef8); }
.publish-note { margin: 0 0 13px; color: #71677f; font-family: Georgia, "Times New Roman", serif; font-size: 13px; }
.publish-button { width: 100%; min-height: 42px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 7px; color: #fff; background: #7956cf; font-size: 11px; font-weight: 650; transition: background .16s; }
.publish-button:hover { background: #6140b5; }
.publish-button:disabled { cursor: wait; opacity: .65; }
.publish-hint { margin: 10px 0 0; color: #9992a2; font-size: 9px; line-height: 1.5; }
.toast { position: fixed; z-index: 5; right: 22px; bottom: 22px; max-width: min(390px, calc(100vw - 44px)); padding: 12px 16px; transform: translateY(12px); border: 1px solid #e7e1ef; border-radius: 9px; color: #4a4059; background: #fff; box-shadow: 0 10px 35px rgba(37, 29, 49, .12); opacity: 0; pointer-events: none; font-size: 11px; line-height: 1.5; transition: opacity .2s, transform .2s; }
.toast.is-visible { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .writer-layout { width: min(760px, calc(100% - 36px)); grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 32px; }
  .writer-sidebar { padding-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .publish-card { grid-column: 1 / -1; }
}

@media (max-width: 580px) {
  .writer-header { min-height: 62px; padding: 0 15px 8px; grid-template-columns: 1fr auto; grid-template-rows: 62px auto; }
  .header-center { justify-items: start; grid-column: 2; grid-row: 1; }
  .writer-nav { grid-column: 1 / -1; grid-row: 2; gap: 8px; }
  .back-link { min-height: 30px; padding: 0 8px; font-size: 10px; }
  .writer-layout { width: calc(100% - 28px); padding-top: 25px; }
  .compose-intro h1 { font-size: 38px; }
  .title-label { padding: 20px 18px 7px; }
  .title-input { width: calc(100% - 36px); height: 48px; margin: 0 18px 14px; font-size: 25px; }
  .editor-topline { padding: 0 16px; }
  .toolbar { padding: 5px 9px; gap: 2px; }
  .toolbar button { min-width: 28px; padding: 0 5px; }
  .scene-button span { display: none; }
  .story-editor, .story-preview { min-height: 360px; padding: 20px 18px; font-size: 15px; }
  .editor-footer { padding: 0 12px; font-size: 9px; }
  .writer-sidebar { grid-template-columns: 1fr; }
  .publish-card { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

:root {
  color-scheme: dark;
  color: #eee5e2;
  background: #100d0e;
  --ink: #eee5e2;
  --muted: #a39796;
  --line: #392326;
  --accent: #bd2034;
  --accent-dark: #98182a;
}

body { color: var(--ink); background: radial-gradient(ellipse at 75% 0%, rgba(116, 22, 36, .14), transparent 30%), #100d0e; }
.writer-header { border-color: #3a2024; background: rgba(20, 14, 16, .95); }
.brand { color: #f0e5e2; font-family: "Spectral SC", Georgia, serif; letter-spacing: .1em; text-transform: uppercase; }
.brand-mark { color: #f6e8e4; }
.header-eyebrow, .eyebrow { color: #ce6874; }
.save-status { color: #a99795; }
.save-status.is-saving { color: #ef7c87; }
.save-status.is-error, .tool-message { color: #ed8790; }
.writer-nav a:hover, .back-link:hover { color: #ef8790; }
.back-link:hover { border-color: #bd4a59; background: #451820; }
.compose-intro h1, .story-preview h1, .story-preview h2, .publish-note { color: #eee3e0; }
.compose-intro h1 { font-family: "UnifrakturCook", "Old English Text MT", Georgia, serif; font-weight: 700; }
.compose-intro p { color: #a79593; }
.status-dot { background: #d84353; box-shadow: 0 0 0 4px rgba(216, 67, 83, .14); }
.editor-card, .sidebar-card { border-color: #3e272b; background: #191214; box-shadow: 0 12px 35px rgba(0, 0, 0, .24); }
.title-label, .markdown-hint, .editor-footer, .pdf-hint { color: #a18f8d; }
.title-input { color: #f1e7e4; }
.title-input::placeholder, .story-editor::placeholder { color: #77686a; }
.title-input:focus-visible { box-shadow: 0 2px 0 #c33b4b; }
.editor-topline, .editor-footer { border-color: #382529; }
.view-tab { color: #9c8988; }
.view-tab.is-active { color: #f0e4e1; }
.view-tab.is-active::after { background: #c33345; }
.toolbar { border-color: #382529; background: #171113; }
.toolbar button { color: #c0aeaa; }
.toolbar button:hover { color: #f2dfe0; background: #451a22; }
.toolbar-divider { background: #493034; }
.toolbar .scene-button { color: #e4868e; }
.story-editor, .story-preview { color: #ded3d0; background: #151012; }
.story-preview blockquote { border-color: #a93c49; color: #b7a3a1; }
.story-preview .scene-break { border-color: #a93c49; }
.privacy-note { color: #968381; }
.sidebar-heading h2 { color: #e8ddda; }
.sidebar-heading p, .sidebar-copy, .draft-empty, .publish-hint { color: #a18f8d; }
.sidebar-icon { color: #f1c7c7; background: #4a1b24; }
.import-button { border-color: #66303a; color: #f1d8d6; background: #271619; }
.import-button:hover { background: #431a22; }
.draft-list li + li { border-color: #382529; }
.draft-list a { color: #c9b5b2; }
.draft-list a:hover { color: #f08a93; }
.publish-card { border-color: #71313b; background: linear-gradient(145deg, #35161d, #211316); }
.publish-note { color: #dfcbc7; }
.publish-button { background: #a91c30; }
.publish-button:hover { background: #c02a3f; }
.toast { border-color: #603039; color: #f0dfdc; background: #211518; box-shadow: 0 10px 35px rgba(0, 0, 0, .5); }

.category-step { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 70px; }
.category-back-link { margin-bottom: 46px; display: inline-block; color: #c28a8e; text-decoration: none; font-size: 11px; }
.category-back-link:hover { color: #f08a93; }
.category-step h1 { margin: 14px 0 11px; color: #f1e5e2; font-family: "UnifrakturCook", "Old English Text MT", Georgia, serif; font-size: clamp(42px, 6vw, 66px); line-height: 1.04; }
.category-step-copy { margin: 0; color: #aa9694; font-size: 12px; }
.writer-category-grid { margin-top: 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.writer-category-card {
  min-width: 0;
  height: clamp(150px, 20vw, 230px);
  padding: 14px;
  display: flex;
  align-items: end;
  overflow: hidden;
  border: 1px solid #54242c;
  border-radius: 10px;
  color: #fff3ef;
  background-color: #29171a;
  background-position: center;
  background-size: cover;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .28);
  text-align: left;
  transition: border-color .18s, transform .18s;
}
.writer-category-card:hover { transform: translateY(-3px); border-color: #dc5361; }
.writer-category-card span { font-family: "Yeseva One", "UnifrakturCook", Georgia, serif; font-size: clamp(23px, 2.8vw, 34px); font-weight: 400; text-shadow: 0 2px 12px #000; overflow-wrap: anywhere; }
.category-choice-row { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.selected-category-badge { padding: 5px 9px; display: inline-block; border: 1px solid #76323d; border-radius: 20px; color: #efb4b6; background: #2a1519; font-family: "Spectral SC", Georgia, serif; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.change-category-button { min-height: 27px; padding: 0 9px; border: 1px solid #67313a; border-radius: 16px; color: #d7b8b8; background: #201416; font-size: 9px; }
.change-category-button:hover { border-color: #bd4a59; color: #fff0ef; background: #451820; }

.sidebar-metadata-card .sidebar-heading { margin-bottom: 15px; align-items: flex-start; }
.metadata-field { min-width: 0; display: grid; align-content: start; gap: 8px; color: #e8ddda; font-size: 10px; font-weight: 650; }
.metadata-field > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metadata-field strong { color: #e98a93; font-size: 9px; font-weight: 600; }
.metadata-field > span small { color: #a18f8d; font-size: 9px; font-weight: 450; }
.metadata-field input, .metadata-field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #493034;
  border-radius: 7px;
  outline: 0;
  color: #eee5e2;
  background: #151012;
  font-size: 11px;
  font-weight: 400;
}
.metadata-field textarea { min-height: 92px; resize: vertical; font-family: Georgia, "Times New Roman", serif; line-height: 1.65; }
.metadata-field input:focus, .metadata-field textarea:focus { border-color: #bd4a59; box-shadow: 0 0 0 3px rgba(189, 32, 52, .14); }
.metadata-field input::placeholder, .metadata-field textarea::placeholder { color: #77686a; }
.metadata-field > small { color: #968381; font-size: 9px; font-weight: 400; line-height: 1.5; }
.banner-upload-row { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.banner-upload-row > div { width: 100%; display: grid; justify-items: start; gap: 9px; }
.story-banner-preview { width: 100%; height: 120px; border: 1px solid #603039; border-radius: 7px; object-fit: cover; background: #100d0e; }
.banner-upload-button { width: 100%; min-height: 36px; padding: 0 13px; border: 1px solid #72303a; border-radius: 6px; color: #f2e5e2; background: #3a171e; font-size: 10px; font-weight: 650; }
.banner-upload-button:hover { border-color: #c84858; background: #521a25; }
.banner-upload-button:disabled { cursor: wait; opacity: .65; }

@media (max-width: 760px) {
  .writer-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-step { width: calc(100% - 32px); padding-top: 30px; }
  .category-back-link { margin-bottom: 32px; }
}

@media (max-width: 580px) {
  .category-step { width: calc(100% - 28px); }
  .writer-category-card { height: 155px; padding: 11px; }
  .writer-category-card span { font-size: 24px; }
}
