/* PC reading surfaces. Existing mobile rules are outside this iteration. */
:root { --reader-size: 18px; --reader-paper: #f7f5ef; --reader-ink: #29251f; --reader-muted: #777166; --reader-seal: #9b3d30; }
body { background: var(--reader-paper); color: var(--reader-ink); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { outline-offset: 4px; }
.reader-home { max-width: 1140px; margin: 36px auto; padding: 0 28px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.home-preview { min-width: 0; }
.home-idea { position: sticky; top: 96px; border: 1px solid #ded7cb; border-radius: 12px; padding: 20px; background: #fffaf2; font: 14px/1.6 system-ui, sans-serif; }
.home-idea h2 { margin: 0; font-size: 21px; }
.home-idea label { display: block; margin: 14px 0 6px; }
.home-idea textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #cfc8bc; border-radius: 8px; background: var(--reader-paper); color: inherit; line-height: 1.6; resize: vertical; }
.home-idea .reader-actions { margin-top: 14px; gap: 8px; }
.home-idea .reader-actions button { padding: 10px 16px; }
.home-idea button:disabled { opacity: .6; cursor: wait; }

.reader-eyebrow { font-size: 13px; color: var(--reader-seal); letter-spacing: .14em; }
.reader-home h1 { font: 36px/1.35 Georgia, 'Songti SC', serif; margin: 20px 0; }
.reader-home .opening-hook { max-width: 620px; font-size: 18px; line-height: 1.75; margin: 24px 0; white-space: normal; }
.reader-home .opening-hook p { margin: 0 0 14px; }
 .reader-home .opening-hook .opening-punchline { font-weight: 650; }
.reader-home .opening-hook .opening-cliffhanger { font-weight: 650; color: var(--reader-seal); }
.opening-selling-tags { display: flex; flex-wrap: wrap; gap: 8px; font: 13px/1.5 system-ui, sans-serif; }
.opening-selling-tags span { padding: 4px 10px; border: 1px solid #d9c4b8; border-radius: 5px; background: #f0e6dc; color: var(--reader-seal); }
.reader-background { font-size: 15px; line-height: 1.8; color: var(--reader-muted); margin: 0 0 18px; }
.reader-tags, .reader-note { color: var(--reader-muted); font-size: 13px; line-height: 1.8; }
.reader-home details { margin: 22px 0; color: var(--reader-muted); }
.reader-home details p { white-space: pre-wrap; line-height: 1.9; }
.reader-name { display: block; margin: 0; font-size: 14px; }
.reader-identity { display: flex; align-items: flex-end; gap: 20px; margin: 30px 0 8px; }
.reader-name input, .reader-name select { display: block; width: 270px; max-width: 100%; padding: 12px 14px; margin-top: 10px; border: 1px solid #cfc8bc; border-radius: 8px; background: #fffaf2; font: inherit; color: inherit; }
.reader-name select { width: 140px; }
.home-idea .reader-identity { flex-direction: column; align-items: stretch; gap: 12px; margin: 14px 0 4px; }
.home-idea .reader-name input, .home-idea .reader-name select { width: 100%; }
.reader-primary { border: 0; border-radius: 8px; background: var(--reader-ink); color: #fffaf2; padding: 14px 30px; cursor: pointer; min-height: 48px; }
.reader-secondary { border: 1px solid #cfc8bc; border-radius: 8px; background: transparent; color: var(--reader-ink); padding: 12px 20px; cursor: pointer; min-height: 44px; }
.reader-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 12px; }
.reader-home #resumeStory { margin-bottom: 28px; }
.reader-home #setupHint { margin: 22px 0; }
.reader-view { font-family: system-ui, 'Microsoft YaHei', sans-serif; }
.reader-view .top-bar { height: 56px; min-height: 56px; box-sizing: border-box; padding: 6px 24px; background: var(--reader-paper); color: var(--reader-ink); box-shadow: none; border-bottom: 1px solid #e5dfd3; }
.reader-view .top-left { min-width: 0; }
.reader-view .story-title { color: var(--reader-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.reader-view .back-btn, .reader-view .top-btn { color: var(--reader-ink); min-height: 44px; border-color: #cfc8bc; background: transparent; }
.reader-view .main-area { min-height: 0; flex: 1; overflow: hidden; padding: 0; }
.reader-view .container { max-width: 760px; width: 100%; margin: 0 auto; padding: 0 28px; box-sizing: border-box; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.reader-view .world-banner, .reader-view .story-sidebar, .reader-view .story-timeline { display: none; }
.reader-view .story-content { flex: 1; min-height: 0; padding: 28px 0; margin: 0; background: transparent; border: 0; border-radius: 0; }
.reader-view .story-text { padding: 0; font: var(--reader-size)/1.85 system-ui, 'Microsoft YaHei', sans-serif; }
.reader-view .story-text p { margin: 0 0 1em; }
.reader-view .seg-toolbar, .reader-view .reasoning-bar { display: none; }
.reader-view.show-tools .seg-toolbar { display: flex; }
.reader-view .story-action { font-size: 13px; color: var(--reader-muted); }
.reader-view .story-divider { margin: 32px 0; }
.reader-view .story-segment { padding: 8px 0; }
.reader-view #helperStatus { display: none; }
.reader-view #saveStatus { font-size: 12px; color: var(--reader-muted); }
.reader-view #saveStatus:not(.save-failed) { height: 18px; }
.reader-view #storyStatus { font-size: 13px; min-height: 18px; }
.reader-view .bottom-action-bar { flex: 0 0 auto; max-height: 40vh; padding: 12px 24px; background: var(--reader-paper); border-top: 1px solid #e5dfd3; }
.reader-view .bottom-action-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.reader-view #btnDirectContinue { background: var(--reader-ink); color: white; padding: 12px 70px; min-height: 46px; border-radius: 8px; }
.reader-view #btnDirection, .reader-view #btnStop { min-height: 44px; }
.reader-view .custom-input-wrap, .reader-view #branchPanel, .reader-view #btnRefresh { display: none !important; }
.reader-view.show-direction .custom-input-wrap { display: flex !important; flex-direction: row; align-items: flex-end; width: 100%; max-width: 720px; margin: 0 auto 12px; gap: 8px; }
.reader-view.show-direction .custom-input { flex: 1; min-width: 0; min-height: 64px; box-sizing: border-box; padding: 10px 12px; font-size: 15px; line-height: 1.6; }
.reader-view.show-direction .bottom-action-bar { display: flex; flex-direction: column; max-height: 60vh; overflow: hidden; }
.reader-view.show-direction #branchPanel.active { display: flex !important; flex-direction: column; flex-wrap: nowrap; align-items: stretch; width: 100%; max-width: 720px; max-height: 34vh; min-height: 0; overflow-y: auto; margin: 0 auto 10px; padding: 2px 6px 2px 2px; box-sizing: border-box; gap: 8px; }
.reader-view.show-direction #branchPanel .branch-pill { flex: 0 0 auto; width: 100%; max-width: none; box-sizing: border-box; padding: 12px 16px; border-radius: 8px; font-size: 15px; line-height: 1.6; text-align: left; white-space: pre-wrap; overflow: visible; overflow-wrap: anywhere; text-overflow: clip; }
.reader-view.show-direction .custom-input-wrap, .reader-view.show-direction .bottom-action-row { flex-shrink: 0; }
.reader-view.show-direction #btnRefresh { display: inline-flex !important; }
.reader-menu { position: absolute; right: 24px; top: 60px; width: 250px; padding: 16px; background: #fffaf2; border: 1px solid #cfc8bc; border-radius: 10px; box-shadow: 0 12px 32px #29251f18; z-index: 1000; }
.reader-menu { max-height: calc(100vh - 100px); overflow-y: auto; }
.reader-menu textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #cfc8bc; background: var(--reader-paper); border-radius: 6px; line-height: 1.6; }
.reader-menu button, .reader-menu a { display: block; width: 100%; text-align: left; min-height: 40px; padding: 8px; box-sizing: border-box; color: var(--reader-ink); }
.reader-menu label { display: block; margin: 10px 8px; }
.reader-view.show-info .world-banner { display: block; flex: 0 0 auto; max-height: 25vh; overflow: auto; margin: 8px; }
.reader-view.show-info .main-area { padding-right: 332px; }
.reader-view.show-info .story-sidebar { display: flex; position: fixed; top: 66px; right: 16px; bottom: 90px; width: 300px; background: var(--reader-paper); border: 1px solid #cfc8bc; z-index: 20; box-shadow: 0 8px 24px #29251f20; }
.reader-view.show-info .story-sidebar .sidebar-tabs { flex-wrap: wrap; }
.reader-profile { max-width: 720px; margin: 40px auto; padding: 0 24px; font-family: system-ui, 'Microsoft YaHei', sans-serif; }
.reader-profile fieldset { margin: 20px 0; border: 1px solid #ded7cb; border-radius: 8px; padding: 16px; }
.reader-profile fieldset label { display: inline-flex; gap: 8px; align-items: center; padding: 10px; min-height: 24px; }
.reader-profile textarea { width: 100%; box-sizing: border-box; padding: 14px; background: #fffaf2; border: 1px solid #cfc8bc; border-radius: 8px; line-height: 1.8; }
.reader-profile #profileStatus { min-height: 24px; }
.preference-savebar { position: sticky; bottom: 0; background: var(--reader-paper); padding: 12px 0; border-top: 1px solid #ded7cb; z-index: 2; }
.preference-savebar #profileStatus { margin: 0 0 8px; }
.preference-savebar .reader-actions { margin: 0; }
.preference-savebar .reader-note { margin-bottom: 0; }
.panel-close { display: block; margin: 0 0 8px auto; padding: 8px 12px; border: 1px solid #cfc8bc; border-radius: 8px; background: transparent; cursor: pointer; }
.reader-view #closeDirection { display: none; }
.reader-view.show-direction #closeDirection { display: inline-flex; }
.reader-view.show-direction #btnDirection { display: none; }
.reader-view .story-sidebar .panel-close { margin: 8px 8px 0 auto; flex-shrink: 0; }
.history-item-delete { width: auto; min-width: 44px; height: 40px; padding: 8px; border-radius: 8px; }
.reader-view .toast { bottom: 100px; }
@media (max-width: 1050px) { .reader-view.show-info .main-area { padding-right: 0; } }
.reader-profile details { margin: 24px 0; }
.reader-profile summary { cursor: pointer; padding: 12px 0; }
.reader-profile .genre-panel { display: grid; gap: 20px; }
.reader-profile .genre-group { display: grid; gap: 10px; }
.reader-profile .genre-group h2 { margin: 0; font-size: 16px; }
.reader-profile .genre-tabs { display: flex; gap: 8px; margin: 0 0 20px; }
.reader-profile .genre-tabs button { padding: 8px 18px; border: 1px solid #ded7cb; border-radius: 8px; background: #fffaf2; color: var(--reader-ink); cursor: pointer; }
.reader-profile .genre-tabs button[aria-selected=true] { background: var(--reader-ink); border-color: var(--reader-ink); color: #fffaf2; }
.reader-profile #excludedGenreTab[aria-selected=true] { background: #8c3f32; border-color: #8c3f32; }
.reader-profile .genre-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.reader-profile #excludedPreference { margin: 8px 0 0; }
.reader-profile #genreTags label { display: inline-flex; align-items: center; gap: 5px; margin: 0; border: 1px solid #ded7cb; border-radius: 20px; padding: 5px 9px; cursor: pointer; }
.reader-profile #genreTags label:has(input:checked) { background: var(--reader-ink); color: #fffaf2; border-color: var(--reader-ink); }

.reader-profile #genreTags label:has(input[name=excludedGenreTag]:checked) { background: #8c3f32; border-color: #8c3f32; color: #fffaf2; }

.home-idea { max-height: calc(100vh - 148px); overflow-y: auto; box-sizing: border-box; }
.home-idea .reader-note { margin: 8px 0; font-size: 12px; line-height: 1.6; }
.home-idea label { margin-top: 10px; }

.home-idea .reader-actions { position: sticky; bottom: -20px; background: #fffaf2; padding: 10px 0; margin-bottom: 0; }

.reader-view .s-tab[hidden] { display: none; }
.reader-view #memoryStatus { margin: 10px 12px; font-size: 12px; color: var(--reader-muted); line-height: 1.6; }
.reader-view .ch-detail { padding: 0 8px 12px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.reader-view .ch-traits { display: grid; gap: 6px; margin-top: 8px; color: var(--reader-muted); }
.reader-view .ch-trait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.reader-view .ch-trait > span { background: #f2ece1; border-radius: 4px; padding: 2px 6px; color: var(--reader-ink); }
.reader-view .ch-trait .top-btn { font-size: 12px; padding: 4px 8px; min-height: 28px; }
.setup-problem { border: 1px solid #b36c51; border-radius: 8px; padding: 12px 16px; background: #fff3e9; }
.setup-problem[hidden] { display: none; }
.setup-problem p { margin: 0; line-height: 1.7; }
.setup-problem .reader-actions { flex-wrap: wrap; margin: 12px 0 0; }
.api-panel .setup-model { margin: 12px 0; }
.api-panel .setup-model summary { cursor: pointer; min-height: 36px; }
.api-panel .reader-note { line-height: 1.7; }
.api-panel #apiSetupStatus { min-height: 36px; color: var(--ink-heavy); }
.api-panel { max-height: calc(100vh - 80px); overflow-y: auto; }
.quickstart-guide { box-sizing: border-box; margin: auto; width: min(620px, calc(100vw - 40px)); max-height: calc(100vh - 60px); padding: 24px 30px; overflow-y: auto; border: 1px solid #cfc8bc; border-radius: 12px; background: #fffaf2; color: #302b25; font-family: inherit; }
.quickstart-guide::backdrop { background: rgb(35 30 25 / 45%); }
.quickstart-guide h2 { font-size: 24px; margin: 12px 0 20px; }
.quickstart-guide h3 { margin: 0 0 6px; font-size: 17px; }
.quickstart-guide ol { padding-left: 22px; }
.quickstart-guide li { padding-left: 4px; margin-bottom: 18px; }
.quickstart-guide p { line-height: 1.75; margin: 6px 0; }
.quickstart-guide .reader-note { font-size: 13px; color: #766e63; }
.quickstart-guide summary { cursor: pointer; padding: 10px 0; }
.quickstart-guide button { min-height: 44px; }
.quickstart-guide .reader-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.guided-start { position: fixed; bottom: 24px; right: 24px; z-index: 1100; box-sizing: border-box; width: min(350px, calc(100vw - 48px)); padding: 18px; border: 2px solid #946346; border-radius: 12px; background: #fffaf2; color: #302b25; box-shadow: 0 8px 28px #302b2526; }
.guided-start[hidden] { display: none; }
.guided-start p { line-height: 1.7; margin: 10px 0; }
.guided-start button { min-height: 44px; }
.guide-progress { font-weight: bold; }
.guide-target { outline: 3px solid #aa7150; outline-offset: 5px; }
.guided-start[data-step="idea"] { left: 24px; right: auto; }
body > .guided-start[data-step="api"] { top: 76px; bottom: auto; right: 24px; }
#apiPanelOverlay .guided-start { position: static; width: auto; margin-top: 16px; }

.guide-navigation { display: flex; gap: 10px; margin: 12px 0; }
.guide-navigation button { flex: 1; }
.guide-navigation button:disabled { opacity: .45; cursor: default; }
