:root {
  --ivory: #f4f7ea;
  --lavender: #e2d9e2;
  --thistle: #cdb9dd;
  --sky: #75adc9;
  --peri: #9580d4;
  --white: #fff;
  --ink: #2f3040;
  --muted: #707486;
  --faint: #9a9dac;
  --line: #d8d2de;
  --danger: #c96f78;
  --success: #5e9b87;
  --shadow: 0 12px 30px rgba(78, 76, 112, .10);
  --shadow-float: 0 18px 48px rgba(78, 76, 112, .16);
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body.drawer-open { overflow: hidden; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--ivory);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body.is-locked { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; stroke-width: 1.8; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 72px;
  padding: 0 clamp(24px, 4vw, 64px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(216, 210, 222, .7);
  background: rgba(244, 247, 234, .82);
  backdrop-filter: blur(20px);
}
.circle-button, .avatar-button, .icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(205, 185, 221, .55);
  border-radius: 50%;
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 7px 20px rgba(78, 76, 112, .08);
  transition: transform .15s ease, background .18s ease, border-color .18s ease;
}
.circle-button:hover, .avatar-button:hover, .icon-button:hover { background: var(--white); border-color: var(--sky); }
.circle-button:active, .avatar-button:active, .icon-button:active { transform: scale(.96); }
#open-more { flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; margin-left: 12px; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font: 600 18px/1.1 "Noto Serif SC", serif; }
.brand small { color: var(--muted); font-size: 8px; letter-spacing: .14em; }
.brand-logo { display: block; flex: 0 0 auto; width: 62px; height: 40px; object-fit: contain; }
#shared-stories-count { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.auth-logo { display: block; width: 136px; height: 88px; }
.auth-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.seed-mark {
  position: relative;
  width: 22px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid var(--peri);
  border-radius: 60% 40% 55% 45% / 47% 48% 52% 53%;
  transform: rotate(-25deg);
}
.seed-mark::after { content: ""; position: absolute; width: 2px; height: 14px; top: 6px; left: 10px; background: var(--sky); transform: rotate(35deg); }
.seed-mark span { width: 5px; height: 5px; border-radius: 50%; background: var(--peri); }
.desktop-nav { margin-left: auto; display: flex; align-items: center; gap: 28px; align-self: stretch; }
.desktop-nav a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.desktop-nav a.is-active { color: var(--peri); font-weight: 700; }
.desktop-nav a.is-active::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--peri); }
.top-actions { margin-left: 22px; display: flex; align-items: center; gap: 10px; }
.top-actions .circle-button { position: relative; }
.unread-badge { position: absolute; top: -3px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border: 2px solid var(--ivory); border-radius: 999px; background: #d978a1; color: #fff; font-size: 9px; font-weight: 700; }
.avatar-button { border: 0; background: var(--peri); color: #fff; font-weight: 700; }

.main-content { min-height: calc(100vh - 72px); }
.view { display: none; animation: page-in .28s ease; }
.view.is-visible { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.content-wrap { width: min(100% - clamp(32px, 8vw, 128px), 1240px); margin: 0 auto; padding: 34px 0 72px; }
.compact-page { padding-top: 44px; }

.page-search-wrap { position: relative; width: min(100%, 720px); margin: 0 auto 10px; }
.page-search {
  height: 40px;
  padding: 0 16px 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(130, 150, 180, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 6px 18px rgba(80, 90, 120, .08);
  backdrop-filter: blur(18px);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.page-search:focus-within { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(117, 173, 201, .14), var(--shadow); }
.page-search > svg { flex: 0 0 auto; color: #6f8798; }
.page-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.page-search input::placeholder { color: #87909d; opacity: 1; }
.page-search button { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.page-search button:hover { background: rgba(226, 217, 226, .62); }
.page-search .voice-button { color: var(--peri); background: rgba(226, 217, 226, .62); }
.search-clear { visibility: hidden; }
.page-search.has-value .search-clear { visibility: visible; }
.search-results { position: absolute; z-index: 10; top: 78px; left: 0; right: 0; padding: 10px; border: 1px solid rgba(205, 185, 221, .5); border-radius: 20px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-float); backdrop-filter: blur(20px); }
.search-result { width: 100%; padding: 11px 12px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 13px; background: transparent; text-align: left; }
.search-result:hover { background: var(--lavender); }
.search-result > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 10px; background: var(--thistle); color: #fff; font-family: "Noto Serif SC", serif; }
.search-result strong, .search-result small { display: block; }
.search-result small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.search-all { width: 100%; height: 42px; margin-top: 4px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--peri); font-weight: 700; }

.playtime-strip { height: 54px; min-height: 54px; margin-bottom: 7px; padding: 7px 20px; display: flex; align-items: center; gap: 10px; border-radius: 16px; background: rgba(226, 217, 226, .62); overflow: hidden; }
.metric-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 50%; background: rgba(255, 255, 255, .68); color: var(--peri); }
.playtime-strip small, .playtime-strip strong { display: block; }
.playtime-strip small { color: var(--muted); font-size: 10px; }
.playtime-strip strong { margin-top: 2px; font-size: 22px; line-height: 1.1; }
.playtime-strip strong span { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.sync-state { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.sync-state svg { width: 16px; color: var(--success); }
.announcement { min-height: 32px; margin-bottom: 22px; padding: 0 10px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(130, 150, 180, .22); border-radius: 16px; background: rgba(255, 255, 255, .76); box-shadow: 0 6px 18px rgba(80, 90, 120, .06); }
.announcement-label { min-width: 48px; padding: 5px 8px; border-radius: 999px; background: rgba(226, 217, 226, .72); color: var(--peri); font-size: 10px; font-weight: 700; text-align: center; }
.announcement div { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.announcement strong, .announcement small { display: block; }
.announcement strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.announcement small { margin-top: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.announcement-open { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; flex: 0 0 28px; border: 0; border-radius: 50%; background: transparent; color: var(--peri); }
.announcement-open:hover { background: var(--lavender); }

.home-section { margin-bottom: 42px; }
.section-heading { margin-bottom: 15px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading small, .page-heading > small, .library-heading small, .drawer-head small, dialog > small, .narrative > small { color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.section-heading h2 { margin: 6px 0 0; font: 600 22px/1.25 "Noto Serif SC", serif; }
.text-button { min-height: 40px; padding: 0; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--peri); font-size: 12px; font-weight: 700; }
.text-button svg { width: 16px; }
.continue-card { min-height: 230px; display: flex; align-items: stretch; overflow: hidden; border: 1px solid rgba(205, 185, 221, .5); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.story-cover { position: relative; display: grid; place-items: center; overflow: hidden; color: #fff; isolation: isolate; }
.story-cover::after { content: ""; position: absolute; z-index: -1; width: 128px; height: 128px; border: 1px solid rgba(255, 255, 255, .42); border-radius: 50%; }
.story-cover::before { content: ""; position: absolute; z-index: -1; width: 230px; height: 78px; left: -18px; bottom: 8px; border: 1px solid rgba(255, 255, 255, .34); border-radius: 50%; transform: rotate(-25deg); }
.story-cover b { font: 600 43px "Noto Serif SC", serif; }
.cover-code { position: absolute; top: 14px; left: 16px; color: rgba(255, 255, 255, .76); font-size: 8px; letter-spacing: .12em; }
.orbit { position: absolute; top: 65px; right: 38px; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.cover-tide { background: #7871b5; }
.cover-mist { background: #8d9aba; }
.cover-lighthouse { background: #7098ac; }
.cover-paper { background: #b594bd; }
.cover-mountain { background: #8ba09b; }
.cover-star { background: #71879e; }
.continue-card > .story-cover { width: 205px; flex: 0 0 205px; }
.continue-info { flex: 1; min-width: 0; padding: 30px 32px; }
.continue-info h3 { margin: 20px 0 6px; font: 600 22px "Noto Serif SC", serif; }
.continue-info p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.continue-info > small { color: var(--muted); font-size: 10px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { min-height: 26px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--lavender); font-size: 10px; }
.tag-purple { background: var(--thistle); }
.progress { width: min(100%, 520px); height: 5px; margin-bottom: 10px; overflow: hidden; border-radius: 999px; background: var(--lavender); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--sky); }
.primary-button, .secondary-button, .ai-button, .danger-button { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 14px; font-weight: 700; font-size: 12px; transition: transform .15s ease, filter .18s ease; }
.primary-button { background: var(--sky); color: #fff; }
.secondary-button { border-color: var(--line); background: var(--lavender); }
.ai-button { background: var(--peri); color: #fff; }
.danger-button { background: var(--danger); color: #fff; }
.primary-button:hover, .secondary-button:hover, .ai-button:hover, .danger-button:hover { filter: brightness(.94); }
.primary-button:active, .secondary-button:active, .ai-button:active, .danger-button:active { transform: scale(.98); }
.continue-card > .primary-button { align-self: center; margin-right: 26px; }
.primary-button svg, .secondary-button svg, .ai-button svg { width: 16px; }

.recent-scroller { display: flex; gap: 16px; padding: 2px 2px 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.recent-card { flex: 0 0 280px; min-height: 310px; overflow: hidden; border: 1px solid rgba(205, 185, 221, .5); border-radius: 18px; background: var(--white); box-shadow: 0 8px 22px rgba(78, 76, 112, .07); scroll-snap-align: start; }
.recent-card .story-cover { height: 142px; }
.story-card > button.story-cover, .recent-card > button.story-cover { width: 100%; padding: 0; border: 0; font: inherit; text-align: inherit; cursor: pointer; }
.story-card > button.story-cover:focus-visible, .recent-card > button.story-cover:focus-visible { outline: 3px solid var(--peri); outline-offset: -4px; }
.story-card > button.story-cover:hover, .recent-card > button.story-cover:hover { filter: brightness(1.04); }
.recent-card .story-cover::after { width: 104px; height: 104px; }
.recent-body { padding: 17px; }
.recent-body h3 { margin: 0 0 6px; font: 600 17px "Noto Serif SC", serif; }
.recent-body p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.recent-body .progress { height: 4px; margin: 13px 0 7px; }
.recent-body small { color: var(--muted); font-size: 9px; }
.recent-body .text-button { margin-top: 8px; }

.library-heading { margin: 12px 0 20px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.library-heading h1, .page-heading h1, .detail-copy h1 { margin: 7px 0 0; font: 600 32px "Noto Serif SC", serif; }
.library-tabs { display: flex; gap: 30px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.library-tabs button { position: relative; padding: 0 0 15px; border: 0; background: transparent; color: var(--muted); white-space: nowrap; }
.library-tabs button.is-active { color: var(--peri); font-weight: 700; }
.library-tabs button.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--peri); }
.library-tabs b { margin-left: 4px; padding: 2px 6px; border-radius: 999px; background: var(--lavender); font-size: 9px; }
.library-tools { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.filter-group { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.filter-group button, .view-switch button { min-width: 0; min-height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .65); color: var(--muted); font-size: 12px; white-space: nowrap; }
.filter-group button { min-width: 72px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.filter-label-short { display: none; }
.filter-group button.is-active { border-color: var(--peri); color: var(--peri); background: rgba(226, 217, 226, .6); }
.filter-panel { position: relative; z-index: 5; margin: -3px 0 14px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .9); box-shadow: var(--shadow); }
.filter-option { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--muted); font-size: 11px; }
.filter-option.is-selected { border-color: var(--peri); background: var(--lavender); color: var(--ink); }
.active-filters { margin: -2px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.active-filters button { padding: 6px 0; border: 0; background: transparent; color: var(--peri); font-weight: 700; white-space: nowrap; }
.filter-group svg, .view-switch svg { width: 17px; height: 17px; flex: 0 0 auto; }
.view-switch { flex: 0 0 76px; display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--lavender); }
.view-switch button { width: 34px; min-height: 34px; padding: 0; justify-content: center; border: 0; background: transparent; }
.view-switch button.is-active { background: var(--white); color: var(--peri); }
.story-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.story-grid.is-list { grid-template-columns: 1fr; }
.story-card { min-width: 0; overflow: hidden; border: 1px solid rgba(205, 185, 221, .5); border-radius: 18px; background: var(--white); box-shadow: 0 8px 22px rgba(78, 76, 112, .07); }
.story-card .story-cover { height: 176px; }
.story-card .story-cover::after { width: 125px; height: 125px; }
.story-card-body { padding: 16px; }
.story-card h3 { margin: 0 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 17px "Noto Serif SC", serif; }
.story-card p { margin: 0 0 11px; color: var(--muted); font-size: 10px; }
.story-card .progress { height: 4px; margin: 10px 0 13px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-menu { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.card-menu:hover { background: var(--lavender); }
.story-grid.is-list .story-card { height: 145px; display: grid; grid-template-columns: 160px 1fr; grid-template-rows: minmax(0, 1fr); }
.story-grid.is-list .story-card .story-cover { height: 140px; align-self: start; }
.story-grid.is-list .story-card-body { min-width: 0; height: 100%; padding: 8px 16px 5px; display: flex; flex-direction: column; overflow: hidden; }
.story-grid.is-list .story-card h3 { margin-bottom: 3px; line-height: 1.2; }
.story-grid.is-list .story-card p { margin-bottom: 4px; line-height: 1.2; }
.story-grid.is-list .story-card .progress { margin: 5px 0; }
.story-grid.is-list .card-foot { margin-top: auto; }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-state > svg { width: 48px; height: 48px; color: var(--thistle); }
.empty-state h2 { margin: 16px 0 7px; font: 600 22px "Noto Serif SC", serif; }
.empty-state p { margin: 0 auto 20px; color: var(--muted); }

.page-heading { max-width: 720px; margin-bottom: 30px; }
.page-heading p, .detail-copy > p { color: var(--muted); line-height: 1.75; }
.create-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.create-card { position: relative; min-height: 260px; padding: 24px; border: 1px solid rgba(205, 185, 221, .6); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); text-align: left; }
.create-card:hover, .create-card.featured { border-color: var(--peri); }
.create-card.featured { background: rgba(226, 217, 226, .65); }
.create-card > svg:first-child { width: 30px; height: 30px; margin: 46px 0 18px; color: var(--peri); }
.create-card > svg:last-child { position: absolute; right: 23px; bottom: 22px; color: var(--peri); }
.create-card > span { position: absolute; top: 22px; left: 24px; color: var(--muted); font-size: 10px; }
.create-card h2 { margin: 0 0 8px; font: 600 20px "Noto Serif SC", serif; }
.create-card p { margin: 0; color: var(--muted); font-size: 12px; }
.public-empty { min-height: 460px; padding-top: 110px; border-top: 1px solid var(--line); }
.back-button { min-height: 40px; padding: 0; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--muted); }
.back-button svg { width: 17px; }
.detail-layout { margin-top: 25px; display: flex; align-items: stretch; gap: 34px; }
.detail-cover { width: 280px; height: 340px; flex: 0 0 280px; border-radius: 20px; box-shadow: var(--shadow); }
.detail-copy { padding: 18px 0; }
.detail-copy dl { display: flex; gap: 32px; margin: 26px 0; }
.detail-copy dt { color: var(--muted); font-size: 10px; }
.detail-copy dd { margin: 4px 0 0; font-weight: 700; }
.button-row { display: flex; gap: 10px; }

.stage-bar { min-height: 64px; padding: 0 clamp(18px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.stage-bar > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.stage-bar > span svg { width: 16px; color: var(--success); }
.stage-layout { width: min(100% - 48px, 1060px); margin: 28px auto 80px; display: grid; grid-template-columns: 230px minmax(0, 780px); gap: 22px; }
.world-state, .narrative { height: max-content; padding: 22px; border: 1px solid rgba(205, 185, 221, .5); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.world-state h2 { margin: 0 0 18px; font: 600 17px "Noto Serif SC", serif; }
.world-state dl { margin: 0; }
.world-state dl div { padding: 11px 0; border-top: 1px solid var(--line); }
.world-state dt { color: var(--muted); font-size: 10px; }
.world-state dd { margin: 4px 0 0; font-size: 11px; font-weight: 700; }
.narrative h1 { margin: 16px 0 20px; font: 600 27px/1.45 "Noto Serif SC", serif; }
.narrative > p { font: 16px/1.9 "Noto Serif SC", serif; }
.scene-note { margin: 24px 0; padding: 11px 13px; border-left: 3px solid var(--sky); background: var(--lavender); font-size: 11px; }
.action-options { margin: 20px 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-options button { min-height: 48px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--ivory); text-align: left; font-size: 11px; }
.action-options button:hover { border-color: var(--sky); }
.action-options button.is-selected { border-color: var(--peri); background: var(--lavender); box-shadow: 0 0 0 2px rgba(147, 129, 177, .1); }
.action-options b { color: var(--peri); font-size: 10px; }
.free-action { display: flex; gap: 8px; }
.free-action input { flex: 1; min-width: 0; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--lavender); outline: 0; }

.drawer { position: fixed; z-index: 40; inset: 0; visibility: hidden; pointer-events: none; }
.drawer.is-open { visibility: visible; pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(47, 48, 64, .28); opacity: 0; transition: opacity .28s ease; }
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; bottom: 0; overflow-y: auto; background: rgba(255, 255, 255, .94); backdrop-filter: blur(24px); transition: transform .3s ease; }
.more-drawer .drawer-panel { left: 0; width: clamp(360px, 66.67vw, 520px); padding: 28px 28px 24px; border-radius: 0 24px 24px 0; box-shadow: 16px 0 45px rgba(78, 76, 112, .16); transform: translateX(-100%); }
.more-drawer.is-open .drawer-panel { transform: none; }
.notification-drawer .drawer-panel { right: 0; width: 390px; padding: 28px; box-shadow: -16px 0 45px rgba(78, 76, 112, .16); transform: translateX(100%); }
.notification-drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.drawer-head h2 { margin: 5px 0 0; font: 600 24px "Noto Serif SC", serif; }
.icon-button { width: 40px; height: 40px; box-shadow: none; }
.dream-balance { width: 100%; min-height: 72px; padding: 13px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(205, 185, 221, .6); border-radius: 18px; background: var(--lavender); text-align: left; }
.dream-balance > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--white); color: var(--peri); }
.dream-balance div { flex: 1; }
.dream-balance small, .dream-balance strong { display: block; }
.dream-balance small { color: var(--muted); font-size: 10px; }
.dream-balance strong { margin-top: 2px; font-size: 19px; }
.dream-balance > svg { width: 17px; color: var(--muted); }
.menu-groups > div { padding: 20px 0 12px; border-bottom: 1px solid var(--line); }
.menu-groups > div > small { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.menu-groups button { width: 100%; min-height: 44px; padding: 0 8px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.menu-groups button:hover { background: rgba(226, 217, 226, .7); }
.menu-groups button > svg:first-child { width: 18px; color: var(--sky); }
.menu-groups button > span { flex: 1; }
.menu-groups button > svg:last-child { width: 15px; color: var(--faint); }
@media (min-width: 1024px) {
  .menu-page-nav { display: none; }
}
.logout-button { width: 100%; min-height: 46px; margin-top: 18px; padding: 0 9px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 12px; background: transparent; color: var(--danger); text-align: left; }
.logout-button:hover { background: rgba(201, 111, 120, .08); }
.notification-tabs { display: flex; gap: 18px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.notification-tabs button { padding: 0 0 12px; border: 0; background: transparent; color: var(--muted); white-space: nowrap; font-size: 11px; }
.notification-tabs button.is-active { color: var(--peri); border-bottom: 2px solid var(--peri); font-weight: 700; }
.notice-list { padding-top: 17px; display: flex; flex-direction: column; gap: 10px; }
.notice { padding: 14px; display: flex; gap: 11px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.notice.unread { border-color: var(--thistle); }
.notice > span { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 32px; border-radius: 50%; background: var(--lavender); color: var(--peri); }
.notice > span svg { width: 16px; }
.notice strong, .notice small { font-size: 11px; }
.notice p { margin: 4px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.notice small { color: var(--faint); font-size: 9px; }

.profile-menu { position: fixed; z-index: 35; top: 82px; right: clamp(24px, 4vw, 64px); width: 280px; padding: 14px; visibility: hidden; opacity: 0; transform: translateY(-8px); border: 1px solid rgba(255, 255, 255, .18); border-radius: 18px; background: rgba(117, 173, 201, .88); color: #fff; box-shadow: 0 16px 38px rgba(45, 32, 29, .22); backdrop-filter: blur(20px); transition: opacity .18s ease, transform .18s ease, visibility .18s; }
.profile-menu.is-open { visibility: visible; opacity: 1; transform: translateY(0); }
.profile-summary { padding: 4px 5px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255, 255, 255, .2); }
.profile-summary > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--peri); color: #fff; font-weight: 700; }
.profile-summary strong, .profile-summary small { display: block; }
.profile-summary small { margin-top: 3px; color: rgba(255, 255, 255, .68); font-size: 10px; }
.profile-links { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .2); }
.profile-links button, .profile-logout { width: 100%; min-height: 42px; padding: 0 9px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 11px; background: transparent; text-align: left; font-size: 12px; }
.profile-links button { color: rgba(255, 255, 255, .94); }
.profile-links button:hover { background: rgba(255, 255, 255, .12); }
.profile-links svg, .profile-logout svg { width: 17px; }
.profile-logout { margin-top: 8px; color: var(--danger); }
.profile-logout:hover { background: rgba(255, 255, 255, .1); }

dialog { width: min(510px, calc(100vw - 32px)); padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: var(--ivory); color: var(--ink); box-shadow: var(--shadow-float); }
dialog::backdrop { background: rgba(47, 48, 64, .32); backdrop-filter: blur(3px); }
dialog h2 { margin: 9px 0 7px; font: 600 24px "Noto Serif SC", serif; }
dialog > p { margin: 0 0 20px; color: var(--muted); line-height: 1.7; }
.dialog-close { position: absolute; top: 15px; right: 16px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; }
.dialog-close:hover { background: var(--lavender); }
dialog label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 12px; }
dialog textarea { width: 100%; min-height: 110px; padding: 12px; resize: vertical; border: 1px solid var(--line); border-radius: 14px; background: var(--lavender); outline: 0; }
dialog textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(117, 173, 201, .14); }
.dialog-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 9px; }
.theme-options { display: flex; flex-direction: column; gap: 9px; }
.theme-options button { min-height: 60px; padding: 10px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); text-align: left; }
.theme-options button.is-active { border-color: var(--peri); }
.theme-options button > div { flex: 1; }
.theme-options strong, .theme-options small { display: block; }
.theme-options small { color: var(--muted); font-size: 10px; }
.theme-options button > svg { visibility: hidden; color: var(--peri); }
.theme-options button.is-active > svg { visibility: visible; }
.swatch { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; }
.swatch.mist { background: var(--lavender); }
.swatch.system { background: #6e7180; box-shadow: inset 18px 0 #fff; }
.save-tabs { margin: 17px 0 6px; display: flex; gap: 20px; border-bottom: 1px solid var(--line); }
.save-tabs button { padding: 0 0 10px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.save-tabs button.is-active { color: var(--peri); border-bottom: 2px solid var(--peri); }
.save-row { padding: 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.save-row strong, .save-row small { display: block; }
.save-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.confirm-dialog { text-align: center; }
.confirm-icon { width: 48px; height: 48px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: rgba(201, 111, 120, .1); color: var(--danger); }
.confirm-dialog .dialog-actions { justify-content: center; }
.toast { position: fixed; z-index: 60; bottom: 26px; left: 50%; max-width: calc(100vw - 32px); padding: 11px 15px; opacity: 0; pointer-events: none; transform: translate(-50%, 14px); border-radius: 12px; background: var(--ink); color: #fff; font-size: 11px; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }

.auth-page { min-height: 100vh; padding: 32px 16px; display: grid; place-items: center; background: var(--ivory); }
.auth-card { width: min(100%, 424px); padding: 32px; border: 1px solid rgba(117, 173, 201, .22); border-radius: 24px; background: var(--white); box-shadow: 0 18px 48px rgba(78, 76, 112, .10); text-align: center; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.auth-brand .seed-mark { width: 64px; height: 64px; border-width: 3px; }
.auth-brand .seed-mark::after { height: 31px; top: 14px; left: 29px; }
.auth-brand .seed-mark span { width: 9px; height: 9px; }
.auth-card h1 { margin: 20px 0 7px; font: 600 28px/1.25 "Noto Serif SC", serif; }
.auth-subtitle { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
#login-form { text-align: left; }
#login-form > label { display: block; margin: 0 0 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.auth-input-wrap { height: 48px; margin-bottom: 16px; padding: 0 13px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 14px; background: rgba(244, 247, 250, .68); transition: border-color .18s ease, box-shadow .18s ease; }
.auth-input-wrap:focus-within { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(117, 173, 201, .14); }
.auth-input-wrap > svg { width: 17px; flex: 0 0 17px; color: var(--muted); }
.auth-input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.auth-input-wrap input::placeholder { color: var(--faint); }
.password-toggle { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; flex: 0 0 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.password-toggle:hover { background: var(--lavender); }
.password-toggle svg { width: 17px; }
.auth-options { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.remember-option { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.remember-option input { width: 15px; height: 15px; accent-color: var(--peri); }
#forgot-password { padding: 0; border: 0; background: transparent; color: var(--peri); font-size: 12px; }
#forgot-password:hover { color: var(--sky); }
.auth-error { min-height: 20px; margin: 7px 0 5px; color: var(--danger); font-size: 12px; line-height: 1.5; }
.auth-submit { width: 100%; height: 48px; margin-top: 2px; border: 0; border-radius: 14px; background: var(--peri); color: #fff; font-size: 13px; font-weight: 700; transition: filter .18s ease, transform .15s ease; }
.auth-submit:hover { filter: brightness(.95); }
.auth-submit:active { transform: scale(.99); }
.auth-submit:disabled { cursor: wait; opacity: .72; }
.auth-legal { margin: 22px 0 0; color: var(--muted); font-size: 11px; }
.auth-version { display: block; margin-top: 12px; color: var(--faint); font-size: 9px; letter-spacing: .1em; }
#login-invite { display: block; width: 100%; margin: 6px 0 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ivory); }
#toggle-invite { margin-top: 12px; }
.personal-editor { margin-bottom: 16px; }
.personal-editor summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.personal-editor form { margin-top: 14px; }
.security-contact { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.security-contact small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.security-proof { margin: 0; padding: 0; min-width: 0; border: 0; }
#account-security-dialog form > .secondary-button { margin-left: 8px; }
#browse-as-guest { margin-top: 12px; margin-left: 8px; }
.guest-login { min-width: 54px; color: var(--ink); }
body.is-guest #sample-story-detail :is(.save-selector, .player-progress-card, .chapter-section, .cover-last-played),
body.is-guest #more-drawer :is(.dream-balance, [data-request-logout], [data-action="invite"], [data-route="profile-center"], [data-story-route="model"], [data-story-route="usage"]) {
  display: none;
}
.cloud-progress, .cloud-choices, .cloud-confirmation { margin: 12px 0; }
.cloud-stream { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ivory); }
.cloud-role-options, .cloud-preferences { margin: 12px 0; }
.cloud-preferences .creation-field { margin-top: 10px; }

@media (min-width: 1024px) and (max-width: 1199px) {
  .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .topbar { height: 64px; padding: 0 20px; }
  .desktop-nav { gap: 16px; }
  .top-actions { margin-left: 16px; gap: 7px; }
  .desktop-nav a { font-size: 12px; }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .more-drawer .drawer-panel { width: clamp(360px, 66.67vw, 520px); }
}

@media (max-width: 960px) {
  .continue-info { padding: 26px 24px; }
  .stage-layout { grid-template-columns: 190px minmax(0, 1fr); }
}

@media (max-width: 767px) {
  body { padding-bottom: 72px; }
  .topbar { height: 64px; padding: 0 16px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; }
  #open-more { grid-column: 1; grid-row: 1; }
  .desktop-nav { display: none; }
  .brand { grid-column: 2; grid-row: 1; justify-self: start; margin-left: 0; }
  .top-actions { grid-column: 3; grid-row: 1; justify-self: end; margin-left: 0; }
  .circle-button, .avatar-button { width: 40px; height: 40px; }
  .brand .seed-mark { display: grid; width: 19px; height: 24px; }
  .brand .seed-mark::after { height: 12px; top: 5px; left: 8px; }
  .brand .seed-mark span { width: 4px; height: 4px; }
  .brand strong { font-size: 17px; }
  .brand small { display: none; }
  .top-actions { gap: 7px; }
  .main-content { min-height: calc(100vh - 64px); }
  .content-wrap { width: calc(100% - 32px); padding: 22px 0 42px; }
  .page-search-wrap { margin-bottom: 10px; }
  .page-search { height: 40px; padding: 0 8px 0 12px; gap: 8px; border-color: rgba(130, 150, 180, .22); box-shadow: 0 5px 14px rgba(80, 90, 120, .06); }
  .page-search input { font-size: 15px; }
  .page-search button { width: 32px; height: 32px; flex-basis: 32px; }
  .playtime-strip { height: 54px; min-height: 54px; margin-bottom: 7px; padding: 7px 13px; border-radius: 16px; background: rgba(226, 217, 226, .62); }
  .metric-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .playtime-strip strong { font-size: 21px; }
  .playtime-strip strong span { font-size: 9px; }
  .sync-state { font-size: 10px; }
  .sync-state svg { display: none; }
  .announcement { min-height: 32px; margin-bottom: 22px; padding: 0 8px; gap: 6px; border-radius: 16px; box-shadow: 0 5px 14px rgba(80, 90, 120, .045); }
  .announcement-label { min-width: 44px; padding: 3px 5px; text-align: center; }
  .announcement div { gap: 6px; }
  .announcement strong { font-size: 11px; }
  .announcement small { font-size: 10px; }
  .announcement-open { width: 28px; height: 28px; flex: 0 0 28px; }
  .home-section { margin-bottom: 28px; }
  .section-heading h2 { font-size: 19px; }
  .continue-card { display: block; }
  .continue-card > .story-cover { width: 100%; height: 145px; }
  .continue-info { padding: 19px; }
  .continue-info h3 { margin-top: 16px; font-size: 20px; }
  .continue-card > .primary-button { width: calc(100% - 38px); margin: 0 19px 18px; }
  .recent-card { flex-basis: min(76vw, 280px); }
  .library-heading { align-items: center; }
  .library-heading h1, .page-heading h1, .detail-copy h1 { font-size: 27px; }
  .library-heading .ai-button { padding: 0 12px; }
  .library-tabs { gap: 22px; }
  .library-tools { align-items: center; gap: 8px; }
  .filter-group { flex: 1 1 auto; width: auto; gap: 6px; }
  .filter-group button { height: 34px; min-height: 34px; flex: 1 1 72px; max-width: 140px; padding: 0 8px; gap: 5px; font-size: 12px; }
  .view-switch { flex-basis: 76px; }
  .view-switch button { width: 34px; min-height: 34px; }
  .filter-label-full { display: none; }
  .filter-label-short { display: inline; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .story-card .story-cover { height: 145px; }
  .story-card .story-cover::after { width: 96px; height: 96px; }
  .story-card-body { padding: 12px; }
  .story-card h3 { font-size: 14px; }
  .story-card p { font-size: 9px; }
  .story-card .tag { max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; }
  .create-grid { grid-template-columns: 1fr; gap: 11px; }
  .create-card { min-height: 165px; padding: 19px; }
  .create-card > svg:first-child { margin: 23px 0 12px; }
  .detail-layout { display: block; }
  .detail-cover { width: 100%; height: 235px; }
  .detail-copy { padding-top: 22px; }
  .stage-bar { padding: 0 15px; gap: 9px; }
  .stage-bar > span { font-size: 9px; }
  .stage-bar .secondary-button { min-height: 38px; padding: 0 9px; font-size: 9px; }
  .stage-layout { width: calc(100% - 32px); display: block; margin-top: 18px; }
  .world-state { display: none; }
  .narrative { padding: 19px 16px; }
  .narrative h1 { font-size: 23px; }
  .narrative > p { font-size: 15px; }
  .action-options { grid-template-columns: 1fr; }
  .free-action { display: block; }
  .free-action input, .free-action .ai-button { width: 100%; }
  .free-action input { margin-bottom: 8px; }
  .more-drawer .drawer-panel { width: 66.67vw; padding: 22px 16px 18px; }
  .menu-groups button { padding: 0 4px; font-size: 12px; }
  .dream-balance { padding: 10px; }
  .notification-drawer .drawer-panel { top: auto; width: 100%; max-height: 86vh; padding: 22px 18px; border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .notification-drawer.is-open .drawer-panel { transform: none; }
  .profile-menu { top: 68px; right: 12px; bottom: auto; width: min(240px, calc(100vw - 32px)); padding: 14px; border-radius: 18px; opacity: 0; transform: translateY(-8px); transition: opacity .18s ease, transform .18s ease, visibility .18s; }
  .profile-menu.is-open { opacity: 1; transform: translateY(0); }
  .mobile-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 72px; padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .92); backdrop-filter: blur(18px); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10px; }
  .mobile-nav a.is-active { color: var(--sky); }
  .mobile-nav svg { width: 19px; }
  .toast { bottom: 86px; }
}

/* Immersive story detail page */
body.is-detail-route { background: var(--ivory); }
body.is-detail-route .topbar,
body.is-detail-route .mobile-nav { display: none; }
body.is-detail-route .main-content { min-height: 100dvh; }
body.is-detail-route .view#view-detail { min-height: 100dvh; }

.detail-page-immersive { min-height: 100dvh; padding: 0 16px 32px; }
.detail-backbar { width: min(100%, 860px); height: 64px; margin: 0 auto; display: flex; align-items: center; }
.detail-back { min-width: 44px; height: 44px; padding: 0 10px 0 4px; display: inline-flex; align-items: center; gap: 2px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; }
.detail-back:hover { background: rgba(255, 255, 255, .72); color: var(--ink); }
.detail-back svg { width: 22px; height: 22px; }
.detail-content { width: min(100%, 860px); margin: 0 auto; }
.detail-cover-card { position: relative; width: 100%; height: 246px; overflow: hidden; padding: 22px; display: flex; flex-direction: column; justify-content: center; border-radius: 20px; background: linear-gradient(135deg, rgba(117, 173, 201, .96), rgba(149, 128, 212, .9)); color: #fff; box-shadow: 0 14px 30px rgba(78, 76, 112, .1); }
.detail-cover-card::before { content: ""; position: absolute; right: -10%; bottom: -48%; width: 72%; aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, .36); border-radius: 50%; transform: rotate(-20deg); }
.detail-cover-card .cover-code { position: absolute; z-index: 1; top: 18px; left: 22px; font-size: 11px; letter-spacing: .15em; }
.detail-cover-card > b { position: relative; z-index: 1; margin: 5px 0 8px; font: 600 70px/1 "Noto Serif SC", serif; }
.detail-cover-card .cover-byline, .detail-cover-card .cover-last-played { position: relative; z-index: 1; font-size: 11px; opacity: .92; }
.detail-cover-card .cover-last-played { margin-top: 4px; font-size: 10px; opacity: .78; }
.detail-cover-card .orbit { position: absolute; z-index: 0; right: 15%; top: 22%; width: 126px; height: 126px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 50%; transform: rotate(28deg) skewX(-18deg); }
.detail-cover-card .orbit::after { content: ""; position: absolute; top: 12px; right: 15px; width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .68); }
.detail-tags { min-height: 28px; margin-top: 14px; display: flex; align-items: center; gap: 7px; overflow: hidden; }
.detail-tags .tag { flex: 0 0 auto; }
.detail-title { margin: 15px 0 0; max-width: 680px; font: 600 clamp(30px, 4vw, 40px)/1.2 "Noto Serif SC", serif; letter-spacing: 0; }
.detail-description { max-width: 680px; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.detail-actions { position: relative; margin-top: 20px; display: flex; align-items: center; gap: 9px; flex-wrap: nowrap; }
.detail-primary-actions { display: flex; align-items: center; gap: 9px; min-width: 0; }
.detail-actions .primary-button, .detail-actions .secondary-button, .save-trigger { min-height: 46px; border-radius: 14px; }
.detail-actions .primary-button { min-width: 118px; }
.detail-actions .secondary-button { min-width: 126px; }
.detail-actions button svg { width: 16px; }
.save-selector { position: relative; margin-left: auto; }
.save-trigger { min-width: 82px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); background: #f4f7ea; color: var(--ink); font-size: 12px; font-weight: 700; }
.save-trigger:hover { border-color: var(--sky); }
.save-trigger[aria-expanded="true"] { border-color: var(--sky); color: var(--sky); }
.save-trigger svg { width: 15px; transition: transform .18s ease; }
.save-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.save-menu, .empty-save-menu { position: absolute; z-index: 8; top: calc(100% + 7px); right: 0; width: 126px; padding: 6px; border: 1px solid rgba(205, 185, 221, .62); border-radius: 16px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-float); backdrop-filter: blur(20px); }
.save-menu button, .empty-save-menu button { width: 100%; min-width: 0; padding: 8px 9px; display: block; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.save-menu button:hover, .empty-save-menu button:hover { background: rgba(226, 217, 226, .58); }
.save-menu button.is-current { background: rgba(117, 173, 201, .13); color: var(--sky); }
.save-menu span, .save-menu small { display: block; }
.save-menu span { font-size: 11px; }
.save-menu small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.save-menu button.is-current small { color: var(--sky); }
.empty-save-menu { width: 158px; }
.empty-save-menu > small { display: block; padding: 5px 9px 6px; color: var(--muted); font-size: 9px; }
.empty-save-menu button { font-size: 10px; }
.player-progress-card, .chapter-section { margin-top: 26px; padding: 18px; border: 1px solid rgba(205, 185, 221, .5); border-radius: 18px; background: rgba(255, 255, 255, .8); box-shadow: 0 10px 26px rgba(78, 76, 112, .07); }
.player-facts-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.player-identity { display: flex; align-items: baseline; gap: 18px; min-width: 0; }
.player-identity strong { font-size: 12px; font-weight: 400; }
.player-identity .player-name { font: 600 18px/1.3 "Noto Serif SC", serif; }
.detail-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.detail-section-heading small { color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.detail-section-heading h2 { margin: 4px 0 0; font: 600 18px/1.3 "Noto Serif SC", serif; }
.progress-badge { min-width: 42px; height: 26px; padding: 0 8px; display: grid; place-items: center; border-radius: 999px; background: rgba(117, 173, 201, .14); color: var(--sky); font-size: 11px; font-weight: 700; }
.player-facts { margin-top: 15px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.player-world-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.player-facts span { min-width: 0; }
.player-facts small, .player-facts strong { display: block; }
.player-facts small { color: var(--muted); font-size: 10px; }
.player-facts strong { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.detail-progress-line { height: 5px; margin-top: 17px; overflow: hidden; border-radius: 999px; background: var(--lavender); }
.detail-progress-line span { display: block; height: 100%; border-radius: inherit; background: var(--sky); }
.detail-progress-caption { margin-top: 7px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.detail-chapter-list { margin-top: 12px; border-top: 1px solid var(--line); }
.detail-chapter { width: 100%; min-height: 66px; padding: 10px 2px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 22px; align-items: center; gap: 11px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.detail-chapter:last-child { border-bottom: 0; }
.detail-chapter:hover { background: rgba(226, 217, 226, .22); }
.detail-chapter .chapter-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--lavender); color: var(--peri); font-size: 11px; font-weight: 700; }
.detail-chapter.is-current .chapter-number { background: var(--sky); color: #fff; }
.detail-chapter .chapter-copy { min-width: 0; }
.detail-chapter strong, .detail-chapter small { display: block; }
.detail-chapter strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.detail-chapter small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.detail-chapter > svg { color: var(--sky); }

@media (max-width: 767px) {
  .detail-page-immersive { padding-right: 16px; padding-left: 16px; }
  .detail-backbar { height: 56px; }
  .detail-content { width: 100%; }
  .detail-cover-card { height: 188px; padding: 18px; border-radius: 18px; }
  .detail-cover-card .cover-code { top: 16px; left: 18px; }
  .detail-cover-card > b { font-size: 58px; }
  .detail-cover-card .orbit { right: 11%; top: 18%; width: 102px; height: 102px; }
  .detail-title { margin-top: 13px; font-size: 28px; }
  .detail-description { margin-top: 9px; font-size: 13px; line-height: 1.75; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
  .detail-actions { margin-top: 16px; gap: 9px; }
  .detail-primary-actions { flex: 1 1 auto; min-width: 0; }
  .detail-primary-actions > button { flex: 1 1 0; min-width: 0; padding: 0 8px; }
  .detail-actions .primary-button, .detail-actions .secondary-button { min-width: 0; }
  .save-selector { margin-left: auto; }
  .player-progress-card, .chapter-section { margin-top: 20px; padding: 14px; border-radius: 16px; }
  .detail-section-heading h2 { font-size: 16px; }
  .player-identity { gap: 13px; }
  .player-identity .player-name { font-size: 16px; }
  .player-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 8px; }
  .player-world-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-world-facts strong { font-size: 11px; }
  .detail-progress-caption { display: block; line-height: 1.7; }
  .detail-progress-caption span { display: block; }
  .detail-chapter { min-height: 60px; }
}

@media (min-width: 768px) {
  .detail-cover-card { height: 246px; }
}

@media (max-width: 430px) {
  .library-tools { flex-wrap: nowrap; gap: 8px; }
  .filter-group { flex: 1 1 0; width: auto; flex-wrap: nowrap; gap: 5px; }
  .filter-group button { flex: 1 1 0; min-width: 0; max-width: none; padding: 0 6px; gap: 4px; }
  .view-switch { margin-left: auto; }
}

@media (max-width: 360px) {
  .filter-group button > svg:first-child { display: none; }
}

@media (max-width: 390px) {
  .story-grid { grid-template-columns: 1fr; }
  .story-card { display: grid; grid-template-columns: 120px 1fr; }
  .story-card .story-cover { height: 145px; }
  .announcement-label { display: inline-flex; }
}

@media (max-width: 480px) {
  .auth-page { padding: 24px; place-items: start center; }
  .auth-card { width: 100%; padding: 26px 0 16px; border: 0; background: transparent; box-shadow: none; }
  .auth-brand .seed-mark { width: 56px; height: 56px; }
  .auth-brand .seed-mark::after { height: 27px; top: 12px; left: 25px; }
  .auth-brand .seed-mark span { width: 8px; height: 8px; }
  .auth-card h1 { margin-top: 20px; font-size: 26px; }
}

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

/* Second-round story experience */
.story-detail-page,
.game-setup-page,
.character-page,
.subpage { padding-top: 26px; }
.story-detail-page .back-button,
.game-setup-page .back-button,
.character-page .back-button,
.subpage .back-button { margin-bottom: 22px; }
.story-hero { margin-top: 0; display: grid; grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); gap: 36px; align-items: stretch; }
.story-hero .detail-cover { width: 100%; min-height: 320px; border-radius: 24px; }
.story-hero .detail-copy { padding: 22px 0; display: flex; flex-direction: column; justify-content: center; }
.story-hero .detail-copy h1 { font-size: clamp(28px, 3vw, 42px); }
.story-hero .detail-copy > p { max-width: 620px; margin: 16px 0 22px; }
.story-hero .button-row { flex-wrap: wrap; }
.detail-meta { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 24px; }
.detail-meta span { display: grid; gap: 3px; }
.detail-meta small, .progress-summary small { color: var(--muted); font-size: 10px; }
.detail-meta strong { font-size: 12px; }
.progress-overview, .detail-section, .setup-panel, .character-form-panel, .character-preview, .game-side-card, .game-narrative, .chapter-detail { border: 1px solid rgba(205, 185, 221, .5); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.progress-overview { margin-top: 26px; padding: 22px; }
.progress-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.progress-summary div { min-width: 0; padding-right: 12px; border-right: 1px solid var(--line); }
.progress-summary div:last-child { border-right: 0; }
.progress-summary small, .progress-summary strong { display: block; }
.progress-summary strong { margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.progress-line, .chapter-progress, .slot-progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--lavender); }
.progress-line { margin-top: 20px; }
.progress-line span, .chapter-progress span, .slot-progress span { display: block; height: 100%; border-radius: inherit; background: var(--sky); }
.progress-caption { margin-top: 7px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.detail-section { margin-top: 24px; padding: 22px; }
.save-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.save-slot { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(244, 247, 234, .55); }
.save-slot.is-current { border-color: var(--sky); background: rgba(117, 173, 201, .08); }
.save-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.save-slot-head b { padding: 3px 7px; border-radius: 999px; background: rgba(117, 173, 201, .16); color: var(--sky); font-size: 9px; }
.save-slot-head .slot-empty { background: var(--lavender); color: var(--muted); }
.save-slot > strong, .save-slot > p, .save-slot > small { display: block; }
.save-slot > strong { margin-top: 18px; font-size: 12px; }
.save-slot > p { min-height: 32px; margin: 4px 0 12px; color: var(--muted); font-size: 10px; }
.save-slot > small { margin-top: 8px; color: var(--muted); font-size: 9px; }
.save-slot .slot-progress { margin-top: 15px; height: 4px; }
.save-slot .text-button, .save-slot .secondary-button { margin-top: 11px; }
.save-slots-page { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.slot-actions { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.slot-actions .primary-button { min-height: 38px; }
.slot-actions .icon-button { margin-left: auto; }
.save-note { margin-top: 16px; padding: 13px 15px; display: flex; align-items: center; gap: 9px; border-radius: 14px; background: rgba(226, 217, 226, .55); color: var(--muted); font-size: 11px; }
.save-note svg { flex: 0 0 auto; width: 16px; color: var(--peri); }
.detail-columns { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-columns .detail-section { margin-top: 0; }
.chapter-list { display: flex; flex-direction: column; }
.chapter-row { min-height: 58px; padding: 10px 0; display: grid; grid-template-columns: 32px minmax(0, 1fr) 18px; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.chapter-row:first-child { border-top: 0; }
.chapter-row > span, .chapter-detail > div > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--lavender); color: var(--peri); font-size: 11px; font-weight: 700; }
.chapter-row.is-current > span { background: var(--sky); color: #fff; }
.chapter-row strong, .chapter-row small { display: block; }
.chapter-row strong { font-size: 12px; }
.chapter-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.chapter-row > svg { color: var(--sky); }
.note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note-grid > div { min-width: 0; padding: 13px; display: grid; grid-template-columns: 20px 1fr; gap: 2px 8px; border-radius: 14px; background: rgba(244, 247, 234, .7); }
.note-grid svg { grid-row: span 2; width: 18px; color: var(--peri); }
.note-grid strong, .note-grid small { min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-grid strong { font-size: 11px; }
.note-grid small { color: var(--muted); font-size: 9px; }
.chapter-directory { display: grid; gap: 12px; }
.chapter-detail { padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.chapter-detail > div { min-width: 0; display: flex; align-items: flex-start; gap: 13px; }
.chapter-detail h2 { margin: 3px 0 5px; font: 600 18px "Noto Serif SC", serif; }
.chapter-detail p { margin: 0; color: var(--muted); font-size: 11px; }
.chapter-detail small { color: var(--muted); font-size: 10px; }
.chapter-detail.is-current { border-color: var(--sky); }

.page-heading { max-width: 760px; }
.game-setup-page .page-heading, .character-page .page-heading, .subpage .page-heading { margin-bottom: 26px; }
.setup-grid, .character-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.setup-panel { padding: 22px; }
.panel-kicker { color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.setup-panel h2 { margin: 8px 0 18px; font: 600 20px/1.35 "Noto Serif SC", serif; }
.mode-options, .length-options { display: grid; gap: 9px; }
.mode-option, .length-option { position: relative; min-width: 0; padding: 13px 14px; display: block; border: 1px solid var(--line); border-radius: 14px; background: rgba(244, 247, 234, .55); text-align: left; }
.mode-option:hover, .length-option:hover { border-color: var(--sky); }
.mode-option.is-selected, .length-option.is-selected { border-color: var(--peri); background: rgba(226, 217, 226, .68); box-shadow: 0 0 0 2px rgba(149, 128, 212, .08); }
.mode-option strong, .mode-option small, .length-option small { display: block; }
.mode-option strong { font-size: 12px; }
.mode-option small { max-width: 88%; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.mode-option span { position: absolute; top: 12px; right: 12px; color: var(--peri); font-size: 9px; }
.length-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.length-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.length-option small { color: var(--muted); font-size: 9px; }
.estimate-card { margin-top: 16px; padding: 13px; display: flex; align-items: center; gap: 10px; border-radius: 14px; background: rgba(117, 173, 201, .1); }
.estimate-card svg { width: 18px; flex: 0 0 auto; color: var(--peri); }
.estimate-card small, .estimate-card strong { display: block; }
.estimate-card small { color: var(--muted); font-size: 9px; }
.estimate-card strong { margin-top: 2px; font-size: 11px; }
.dynamic-settings { margin-top: 20px; }
.setting-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.setting-grid label, .character-fields > label, .field-row > label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.setting-grid select, .character-fields input, .character-fields textarea, .character-fields select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: rgba(244, 247, 234, .62); outline: 0; }
.setting-grid select, .character-fields input, .character-fields select { height: 42px; padding: 0 11px; }
.setting-grid select:focus, .character-fields input:focus, .character-fields textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(117, 173, 201, .12); }
.dynamic-settings > .text-button { margin-top: 15px; }
.setup-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.character-layout { grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr); align-items: start; }
.character-form-panel, .character-preview { padding: 22px; }
.character-progress { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 23px; }
.character-progress > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--lavender); color: var(--muted); font-size: 10px; }
.character-progress > span.is-done, .character-progress > span.is-active { background: var(--sky); color: #fff; }
.character-progress > i { width: 30px; height: 1px; background: var(--line); }
.character-progress small { flex-basis: 100%; color: var(--muted); font-size: 10px; }
.character-fields { display: grid; gap: 15px; }
.field-with-actions { display: flex; gap: 6px; }
.field-with-actions input { flex: 1; }
.field-with-actions button, .field-refresh { min-width: 40px; height: 42px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--lavender); color: var(--peri); }
.field-with-actions svg { width: 16px; }
.character-fields textarea { min-height: 88px; padding: 11px; resize: vertical; line-height: 1.6; }
.field-refresh { min-height: 34px; height: 34px; margin-top: 7px; font-size: 10px; }
.field-row { display: grid; grid-template-columns: .5fr 1.5fr; gap: 10px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-chips button { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(244, 247, 234, .62); color: var(--muted); font-size: 10px; }
.choice-chips button.is-selected { border-color: var(--peri); background: var(--lavender); color: var(--ink); }
.character-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.character-preview { position: sticky; top: 92px; background: linear-gradient(145deg, rgba(226, 217, 226, .72), rgba(255, 255, 255, .92)); text-align: center; }
.preview-avatar { width: 76px; height: 76px; margin: 24px auto 12px; display: grid; place-items: center; border-radius: 24px; background: var(--sky); color: #fff; font: 600 30px "Noto Serif SC", serif; }
.character-preview h2 { margin: 0; font: 600 24px "Noto Serif SC", serif; }
.character-preview > p { margin: 6px 0 20px; color: var(--muted); font-size: 11px; }
.preview-list { display: grid; gap: 8px; text-align: left; }
.preview-list span { padding: 10px 12px; display: flex; justify-content: space-between; gap: 9px; border-radius: 12px; background: rgba(255, 255, 255, .65); }
.preview-list small, .preview-list strong { font-size: 10px; }
.preview-list small { color: var(--muted); }
.preview-note { margin-top: 18px; padding: 11px; display: flex; align-items: flex-start; gap: 8px; border-radius: 12px; background: rgba(117, 173, 201, .1); color: var(--muted); text-align: left; font-size: 10px; line-height: 1.6; }
.preview-note svg { width: 16px; flex: 0 0 auto; color: var(--sky); }

.view#view-game { min-height: calc(100vh - 72px); padding-bottom: 62px; background: rgba(244, 247, 234, .45); }
.game-topbar { width: min(100% - 48px, 1240px); min-height: 68px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.game-topbar .back-button { justify-self: start; }
.game-status { text-align: center; }
.game-status strong, .game-status span { display: block; }
.game-status strong { font-size: 15px; }
.game-status span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.game-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.save-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.save-status svg { width: 15px; color: var(--success); }
.save-status.is-saving svg { color: var(--peri); animation: save-pulse 1s infinite; }
@keyframes save-pulse { 50% { opacity: .4; } }
.game-meta-strip { width: min(100% - 48px, 1240px); min-height: 42px; margin: 0 auto; padding: 0 13px; display: flex; align-items: center; gap: 18px; border: 1px solid rgba(205, 185, 221, .45); border-radius: 14px; background: rgba(255, 255, 255, .72); color: var(--muted); font-size: 10px; }
.game-meta-strip > span { display: inline-flex; align-items: center; gap: 6px; }
.game-meta-strip svg { width: 15px; color: var(--sky); }
.timeline-badge { margin-left: auto; min-height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; background: var(--lavender); color: var(--peri); font-size: 10px; }
.game-layout { width: min(100% - 48px, 1120px); margin: 25px auto 0; display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 22px; align-items: start; }
.game-side-card { padding: 18px; position: sticky; top: 88px; }
.game-side-card h2 { margin: 8px 0 13px; font: 600 18px "Noto Serif SC", serif; }
.game-side-card > small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.game-side-card .text-button { margin-top: 14px; }
.mini-state { margin-top: 17px; padding-top: 13px; display: grid; gap: 10px; border-top: 1px solid var(--line); }
.mini-state span { display: flex; justify-content: space-between; gap: 8px; }
.mini-state small { color: var(--muted); font-size: 10px; }
.mini-state strong { font-size: 10px; }
.game-narrative { padding: clamp(22px, 4vw, 42px); }
.game-narrative h1 { margin-top: 14px; font-size: clamp(25px, 3vw, 34px); }
.game-narrative > p { max-width: 690px; font-size: 16px; line-height: 1.9; }
.scene-note { margin: 20px 0 14px; padding: 12px 13px; display: flex; align-items: center; gap: 8px; border-radius: 12px; background: rgba(149, 128, 212, .11); color: var(--peri); font-size: 11px; }
.scene-note svg { width: 16px; }
.turn-change { display: flex; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: 10px; }
.turn-change span { display: inline-flex; align-items: center; gap: 6px; }
.turn-change svg { width: 15px; color: var(--sky); }
.game-narrative .action-options { margin-top: 24px; }
.game-narrative .free-action { align-items: stretch; }
.free-action textarea { flex: 1; min-width: 0; min-height: 48px; padding: 12px 13px; resize: vertical; border: 1px solid var(--line); border-radius: 14px; background: var(--lavender); outline: 0; }
.free-action textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(117, 173, 201, .12); }
.taohu-fab { position: fixed; z-index: 21; right: 28px; bottom: 28px; width: 56px; height: 56px; display: grid; place-items: center; border: 3px solid rgba(255, 255, 255, .8); border-radius: 50%; background: var(--peri); color: #fff; box-shadow: var(--shadow-float); font: 600 18px "Noto Serif SC", serif; }
.taohu-fab:hover { transform: translateY(-2px); }

.game-panel { position: fixed; z-index: 45; inset: 0; visibility: hidden; pointer-events: none; }
.game-panel.is-open { visibility: visible; pointer-events: auto; }
.panel-backdrop { position: absolute; inset: 0; background: rgba(47, 48, 64, .25); opacity: 0; transition: opacity .22s ease; }
.game-panel.is-open .panel-backdrop { opacity: 1; }
.game-panel-card { position: absolute; top: 0; right: 0; bottom: 0; width: min(410px, calc(100vw - 32px)); overflow-y: auto; padding: 26px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(24px); box-shadow: -18px 0 42px rgba(78, 76, 112, .16); transform: translateX(100%); transition: transform .25s ease; }
.game-panel.is-open .game-panel-card { transform: none; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.panel-header h2 { margin: 5px 0 0; font: 600 22px "Noto Serif SC", serif; }
.state-profile { padding: 14px; display: flex; align-items: center; gap: 10px; border-radius: 16px; background: var(--lavender); }
.state-profile > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--sky); color: #fff; font-weight: 700; }
.state-profile div { min-width: 0; flex: 1; }
.state-profile strong, .state-profile small { display: block; }
.state-profile strong { font-size: 13px; }
.state-profile small { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.state-profile > b { color: var(--peri); font-size: 10px; }
.state-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.state-section > small { display: block; margin-bottom: 9px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.state-row { padding: 8px 0; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid rgba(216, 210, 222, .7); font-size: 11px; }
.state-row:first-of-type { border-top: 0; }
.state-row strong { font-size: 10px; font-weight: 600; }
.panel-callout { margin: 0; padding: 11px 12px; border-radius: 12px; background: rgba(117, 173, 201, .1); color: var(--ink); font-size: 11px; line-height: 1.65; }
.state-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.state-columns > div { padding: 11px; border-radius: 12px; background: rgba(244, 247, 234, .75); }
.state-columns strong, .state-columns span { display: block; }
.state-columns strong { font-size: 16px; }
.state-columns span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.timeline-mini { display: flex; align-items: center; gap: 0; }
.timeline-mini span { position: relative; flex: 1; height: 4px; background: var(--lavender); }
.timeline-mini span:first-child { border-radius: 999px 0 0 999px; }
.timeline-mini span:last-child { border-radius: 0 999px 999px 0; }
.timeline-mini .is-done, .timeline-mini .is-current { background: var(--sky); }
.timeline-mini .is-current::after { content: ""; position: absolute; top: -4px; right: -1px; width: 12px; height: 12px; border: 2px solid var(--white); border-radius: 50%; background: var(--peri); }
.muted-copy { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.panel-intro { margin: -8px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.taohu-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); }
.taohu-tabs button { padding: 0 0 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 11px; }
.taohu-tabs button.is-active { border-color: var(--peri); color: var(--peri); font-weight: 700; }
.taohu-content { padding-top: 15px; }
.memory-item { padding: 12px; display: flex; align-items: flex-start; gap: 9px; border-radius: 13px; background: rgba(244, 247, 234, .75); }
.memory-item + .memory-item { margin-top: 8px; }
.memory-item > svg { width: 16px; flex: 0 0 auto; color: var(--success); }
.memory-item.pending > svg { color: var(--peri); }
.memory-item strong, .memory-item small { display: block; }
.memory-item strong { font-size: 11px; }
.memory-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.taohu-content .secondary-button { margin-top: 12px; }
.rollback-card { padding: 15px; border: 1px solid var(--thistle); border-radius: 15px; background: rgba(226, 217, 226, .45); }
.rollback-card small, .rollback-card strong, .rollback-card p { display: block; }
.rollback-card small { color: var(--muted); font-size: 9px; }
.rollback-card strong { margin-top: 5px; font-size: 14px; }
.rollback-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.rollback-card .secondary-button { margin-top: 12px; }

@media (max-width: 1023px) {
  .story-hero { grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
  .story-hero .detail-cover { min-height: 280px; }
  .save-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .setting-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .story-detail-page, .game-setup-page, .character-page, .subpage { padding-top: 18px; }
  .story-hero { display: block; }
  .story-hero .detail-cover { min-height: 205px; height: 205px; border-radius: 20px; }
  .story-hero .detail-copy { padding: 20px 0 0; }
  .story-hero .detail-copy h1 { font-size: 28px; }
  .detail-meta { margin-top: 21px; gap: 16px; }
  .progress-overview, .detail-section, .setup-panel, .character-form-panel, .character-preview { padding: 17px; border-radius: 17px; }
  .progress-summary { grid-template-columns: 1fr 1fr; gap: 12px; }
  .progress-summary div:nth-child(2) { border-right: 0; }
  .progress-summary div:nth-child(3), .progress-summary div:nth-child(4) { padding-top: 11px; border-top: 1px solid var(--line); }
  .progress-caption { display: block; line-height: 1.7; }
  .progress-caption span { display: block; }
  .detail-columns, .setup-grid, .character-layout { grid-template-columns: 1fr; gap: 14px; }
  .save-slots { display: flex; overflow-x: auto; margin-right: -17px; padding-right: 17px; scroll-snap-type: x proximity; }
  .save-slot { flex: 0 0 82%; scroll-snap-align: start; }
  .save-slots-page { display: grid; margin-right: 0; padding-right: 0; }
  .save-slots-page .save-slot { width: auto; }
  .chapter-detail { display: block; padding: 15px; }
  .chapter-detail .primary-button, .chapter-detail .secondary-button { width: 100%; margin-top: 14px; }
  .note-grid { gap: 8px; }
  .page-heading h1 { font-size: 27px; }
  .length-options { grid-template-columns: 1fr 1fr; }
  .setting-grid { grid-template-columns: 1fr 1fr; }
  .character-preview { position: static; }
  .character-actions, .setup-actions { display: grid; grid-template-columns: 1fr; }
  .character-actions > *, .setup-actions > * { width: 100%; }
  .view#view-game { padding-bottom: 90px; }
  .game-topbar { width: calc(100% - 32px); min-height: 64px; grid-template-columns: auto 1fr auto; gap: 8px; }
  .game-topbar .back-button { font-size: 11px; }
  .game-status { text-align: left; }
  .game-status strong { font-size: 12px; }
  .game-status span { font-size: 9px; }
  .game-actions { gap: 5px; }
  .game-actions .save-status { display: none; }
  .game-actions .icon-button { width: 38px; height: 38px; }
  .game-meta-strip { width: calc(100% - 32px); min-height: 64px; padding: 8px 11px; display: flex; flex-wrap: wrap; gap: 7px 13px; }
  .game-meta-strip > span:nth-child(2) { flex-basis: calc(100% - 4px); }
  .timeline-badge { position: absolute; top: 75px; right: 16px; }
  .game-layout { width: calc(100% - 32px); display: block; margin-top: 15px; }
  .game-side-card { position: static; margin-bottom: 14px; }
  .game-side-card .mini-state { grid-template-columns: 1fr 1fr; }
  .game-narrative { padding: 20px 16px; }
  .game-narrative > p { font-size: 15px; }
  .game-narrative .action-options { grid-template-columns: 1fr; }
  .game-narrative .free-action { display: block; }
  .free-action textarea, .free-action .ai-button { width: 100%; }
  .free-action .ai-button { margin-top: 8px; }
  .taohu-fab { right: 16px; bottom: 86px; width: 50px; height: 50px; }
  .game-panel-card { width: min(410px, calc(100vw - 20px)); padding: 20px 16px; border-radius: 20px 0 0 20px; }
}

@media (max-width: 390px) {
  .setting-grid, .length-options { grid-template-columns: 1fr; }
  .game-topbar .back-button { max-width: 62px; overflow: hidden; white-space: nowrap; }
  .game-meta-strip { font-size: 9px; }
}

/* Immersive conversation layout */
body.is-game-route {
  --game-topbar-height: 64px;
  --player-bar-height: 112px;
  --composer-height: 82px;
  overflow: hidden;
  background: var(--ivory);
}
body.is-game-route .topbar,
body.is-game-route .mobile-nav { display: none; }
body.is-game-route .main-content { min-height: 100dvh; }
body.is-game-route .view#view-game { display: block; min-height: 0; height: 100dvh; padding: 0; overflow: hidden; background: var(--ivory); }
.game-shell { position: relative; height: 100dvh; overflow: hidden; }
.game-topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto;
  width: 100%;
  height: var(--game-topbar-height);
  min-height: var(--game-topbar-height);
  padding: 0 max(16px, calc((100vw - 1080px) / 2));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(216, 210, 222, .78);
  background: rgba(244, 247, 234, .9);
  backdrop-filter: blur(18px);
}
.game-topbar .game-back { justify-self: start; min-width: 72px; }
.game-script-name { justify-self: center; color: var(--muted); font-size: 12px; }
.game-status { text-align: right; white-space: nowrap; }
.game-status strong { display: block; font-size: 12px; }
.game-status .save-status { justify-content: flex-end; margin-top: 2px; }
.game-actions { justify-self: end; display: flex; align-items: center; gap: 7px; }
.game-actions .icon-button { width: 38px; height: 38px; }
.player-info-bar {
  position: fixed;
  z-index: 31;
  top: calc(var(--game-topbar-height) + 8px);
  left: 50%;
  width: min(calc(100% - 32px), 1080px);
  height: var(--player-bar-height);
  transform: translateX(-50%);
}
.player-info-trigger {
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) 24px;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 6px 12px;
  border: 1px solid rgba(205, 185, 221, .64);
  border-radius: 16px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 8px 22px rgba(78, 76, 112, .08);
  text-align: left;
}
.player-info-trigger:hover { border-color: var(--sky); }
.player-primary, .player-fact { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.player-primary { grid-column: 1; grid-row: 1; }
.player-primary strong { font: 600 16px/1.2 "Noto Serif SC", serif; }
.player-primary small, .player-fact small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.player-fact { flex-direction: column; gap: 1px; }
.player-fact b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.player-status { min-width: 0; min-height: 22px; padding: 3px 10px; overflow: hidden; border-radius: 6px; background: rgba(226, 217, 226, .72); color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.player-status:nth-of-type(4) { grid-column: 1 / 3; grid-row: 2; }
.player-status:nth-of-type(5) { grid-column: 3; grid-row: 2; }
.player-expand { grid-column: 4; grid-row: 2; justify-self: center; width: 18px; color: var(--ink); }
.player-info-trigger[aria-expanded="true"] .player-expand { transform: rotate(180deg); }
.story-viewport {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--game-topbar-height) + var(--player-bar-height) + 24px) 16px calc(var(--composer-height) + 26px);
  scrollbar-gutter: stable;
}
.story-turn { width: min(100%, 840px); margin: 0 auto; }
.ai-reply-time { margin: 0 6px 7px; color: var(--muted); font: 10px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; }
.story-card { border: 1px solid rgba(205, 185, 221, .5); border-radius: 18px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.story-card.game-narrative { display: block; padding: 28px 32px 24px; }
.story-card.game-narrative h1 { margin: 14px 0 20px; font: 600 clamp(25px, 3vw, 34px)/1.3 "Noto Serif SC", serif; }
.story-card.game-narrative > p { max-width: 690px; margin: 0 0 17px; font-size: 16px; line-height: 1.9; }
.story-card .scene-note { margin: 22px 0 14px; }
.story-card .turn-change { padding-bottom: 0; }
.story-turn > .action-options { width: 100%; margin: 14px auto 0; }
.story-turn > .action-options button { min-height: 52px; background: rgba(244, 247, 234, .84); }
.game-composer {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: var(--keyboard-height, 0px);
  left: 0;
  min-height: var(--composer-height);
  padding: 10px max(12px, calc((100vw - 1080px) / 2)) calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: rgba(244, 247, 234, .92);
  backdrop-filter: blur(18px);
}
.game-composer textarea { flex: 1 1 auto; min-width: 0; min-height: 46px; max-height: 120px; padding: 12px 14px; resize: none; overflow-y: auto; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .88); outline: 0; line-height: 1.45; }
.game-composer textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(117, 173, 201, .12); }
.send-button, .retry-button, .taohu-button { min-height: 46px; border-radius: 13px; font-size: 11px; font-weight: 700; }
.send-button { min-width: 68px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: var(--sky); color: #fff; }
.send-button svg { width: 15px; }
.retry-button { min-width: 48px; padding: 0 10px; border: 1px solid var(--line); background: var(--lavender); }
.taohu-button { min-width: 68px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 999px; background: var(--peri); color: #fff; }
.taohu-button svg { width: 16px; }

body.is-game-route #status-panel { z-index: 50; }
body.is-game-route #status-panel .game-panel-card {
  top: calc(var(--game-topbar-height) + var(--player-bar-height) + 8px);
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(calc(100% - 32px), 1080px);
  max-height: 66.67dvh;
  padding: 20px;
  border-radius: 0 0 20px 20px;
  transform: translate(-50%, -110%);
  transition: transform .22s ease;
}
body.is-game-route #status-panel.is-open .game-panel-card { transform: translate(-50%, 0); }
body.is-game-route #status-panel .panel-header { position: sticky; top: -20px; z-index: 1; padding: 0 0 12px; margin: -2px 0 12px; background: rgba(255, 255, 255, .96); }

@media (max-width: 767px) {
  body.is-game-route { --game-topbar-height: 58px; --player-bar-height: 98px; --composer-height: 74px; }
  .game-topbar { padding: 0 12px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; }
  .game-topbar .game-back { min-width: 54px; padding: 0 5px 0 0; font-size: 11px; }
  .game-script-name { display: none; }
  .game-status { justify-self: center; text-align: center; }
  .game-status strong { font-size: 11px; }
  .game-status .save-status { display: none; }
  .game-actions { gap: 5px; }
  .game-actions .icon-button { width: 36px; height: 36px; }
  .player-info-bar { width: calc(100% - 32px); }
  .player-info-trigger { padding: 9px 10px; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) minmax(0, .9fr) 20px; gap: 4px 7px; border-radius: 15px; }
  .player-primary { flex-direction: column; align-items: flex-start; gap: 0; }
  .player-primary strong { font-size: 15px; }
  .player-primary small, .player-fact small { font-size: 9px; }
  .player-fact b { font-size: 10px; }
  .player-status { min-height: 19px; padding: 2px 8px; font-size: 9px; }
  .story-viewport { padding-right: 16px; padding-left: 16px; }
  .story-card.game-narrative { padding: 20px 16px 18px; border-radius: 17px; }
  .story-card.game-narrative { display: block; grid-template-columns: none; }
  .story-card.game-narrative h1 { margin: 13px 0 19px; font-size: 24px; }
  .story-card.game-narrative > p { font-size: 15px; line-height: 1.9; }
  .story-turn > .action-options { margin-top: 10px; gap: 8px; }
  .story-turn > .action-options button { min-height: 48px; padding: 9px 12px; font-size: 11px; }
  .game-composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 5px; }
  .game-composer textarea { min-height: 44px; padding: 11px 10px; font-size: 12px; }
  .send-button, .retry-button, .taohu-button { min-height: 44px; }
  .send-button { min-width: 54px; padding: 0 8px; font-size: 10px; }
  .retry-button { min-width: 42px; padding: 0 7px; font-size: 10px; }
  .taohu-button { min-width: 44px; width: 44px; padding: 0; }
  .taohu-button span { display: none; }
  body.is-game-route #status-panel .game-panel-card { width: calc(100% - 16px); padding: 16px 14px; border-radius: 0 0 18px 18px; }
  body.is-game-route #status-panel .panel-header { top: -16px; padding-top: 2px; }
}

/* Dialogue page UI baseline: V3 Peach Core specification */
body.is-game-route {
  --game-topbar-height: 76px;
  --player-bar-height: 142px;
  --composer-height: 76px;
  background: var(--ivory);
}

body.is-game-route .game-topbar {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 1fr) minmax(0, 1fr);
  height: var(--game-topbar-height);
  min-height: var(--game-topbar-height);
  padding: 0 max(16px, calc((100vw - 1080px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 24px rgba(75, 96, 130, .06);
}

body.is-game-route .game-topbar .game-back {
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  justify-self: start;
  overflow: hidden;
  border-radius: 50%;
  font-size: 0;
}

body.is-game-route .game-topbar .game-back svg { width: 19px; height: 19px; }
body.is-game-route .game-header-center { min-width: 0; display: grid; justify-items: center; gap: 2px; text-align: center; }
body.is-game-route .game-script-name { display: block; min-width: 0; overflow: hidden; color: var(--text, var(--ink)); font-size: 18px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
body.is-game-route .game-status-meta { color: var(--muted); font-size: 11px; line-height: 1.35; }
body.is-game-route .game-actions { justify-self: end; }
body.is-game-route .game-actions .icon-button { width: 44px; height: 44px; }

body.is-game-route .player-info-bar {
  top: calc(var(--game-topbar-height) + 10px);
  width: min(calc(100% - 24px), 920px);
  height: var(--player-bar-height);
  overflow: hidden;
  border: 1px solid rgba(75, 92, 118, .14);
  border-radius: 20px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 8px 24px rgba(75, 96, 130, .08);
  backdrop-filter: blur(18px);
  transition: max-height .22s ease, box-shadow .22s ease;
}

body.is-game-route .player-info-bar.is-expanded {
  height: auto;
  max-height: 66dvh;
  box-shadow: 0 12px 30px rgba(75, 96, 130, .12);
}

body.is-game-route .player-info-trigger {
  height: var(--player-bar-height);
  padding: 16px 20px 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto 22px;
  grid-template-areas: "identity identity" "time place" "metric-a metric-b" "handle handle";
  align-items: center;
  gap: 8px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body.is-game-route .player-info-trigger:hover { border-color: transparent; background: rgba(117, 173, 201, .05); }
body.is-game-route .player-primary { grid-area: identity; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
body.is-game-route .player-primary strong { color: var(--ink); font-size: 17px; }
body.is-game-route .player-primary small { color: var(--muted); font-size: 11px; white-space: normal; }
body.is-game-route .player-fact { display: grid; gap: 1px; min-width: 0; }
body.is-game-route .player-time { grid-area: time; }
body.is-game-route .player-place { grid-area: place; }
body.is-game-route .player-fact small { color: var(--muted); font-size: 10px; }
body.is-game-route .player-fact b { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
body.is-game-route .player-status { min-width: 0; height: 32px; padding: 7px 10px; border-radius: 10px; background: rgba(226, 217, 226, .68); color: var(--muted); font-size: 10px; line-height: 18px; }
body.is-game-route .player-status:nth-of-type(4) { grid-area: metric-a; }
body.is-game-route .player-status:nth-of-type(5) { grid-area: metric-b; }
body.is-game-route .player-expand { grid-area: handle; justify-self: center; width: 18px; height: 18px; color: var(--muted); transition: transform .22s ease; }
body.is-game-route .player-info-trigger[aria-expanded="true"] .player-expand { transform: rotate(180deg); }
body.is-game-route .player-status-details { max-height: calc(66dvh - var(--player-bar-height)); overflow-y: auto; padding: 0 20px 18px; border-top: 1px solid var(--line); overscroll-behavior: contain; }
body.is-game-route .player-status-details section { padding: 12px 0; border-bottom: 1px solid var(--line); }
body.is-game-route .player-status-details section:last-child { border-bottom: 0; }
body.is-game-route .player-status-details small, body.is-game-route .player-status-details strong, body.is-game-route .player-status-details span { display: block; }
body.is-game-route .player-status-details small { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
body.is-game-route .player-status-details strong { color: var(--ink); font-size: 12px; }
body.is-game-route .player-status-details span { margin-top: 4px; color: var(--muted); font-size: 11px; }

body.is-game-route .story-viewport { padding-top: calc(var(--game-topbar-height) + var(--player-bar-height) + 26px); padding-bottom: calc(var(--composer-height) + 32px); }
body.is-game-route .story-turn { width: min(100%, 780px); }
body.is-game-route .story-card.game-narrative { border-color: var(--line); border-radius: 18px; box-shadow: var(--shadow-soft, 0 8px 24px rgba(75, 96, 130, .08)); }
body.is-game-route .story-card.game-narrative > p { line-height: 1.85; }
body.is-game-route .story-turn > .action-options { grid-template-columns: 1fr 1fr; gap: 10px; }
body.is-game-route .story-turn > .action-options button { min-height: 54px; border-radius: 15px; background: rgba(255, 255, 255, .78); transition: transform .12s ease, background .16s ease, border-color .16s ease; }
body.is-game-route .story-turn > .action-options button:hover { border-color: var(--sky); background: rgba(117, 173, 201, .12); }
body.is-game-route .story-turn > .action-options button:active { transform: scale(.98); }
body.is-game-route .story-turn > .action-options b { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 26px; border-radius: 50%; background: rgba(149, 128, 212, .14); color: var(--peri); }

body.is-game-route .game-composer { min-height: var(--composer-height); padding: 10px max(12px, calc((100vw - 920px) / 2)) calc(10px + env(safe-area-inset-bottom)); gap: 8px; background: rgba(255, 255, 255, .72); }
body.is-game-route .game-composer textarea { min-height: 48px; border-radius: 999px; background: rgba(255, 255, 255, .88); }
body.is-game-route .send-button, body.is-game-route .retry-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
body.is-game-route .send-button { background: var(--sky); }
body.is-game-route .retry-button { border-color: rgba(205, 185, 221, .62); background: var(--lavender); color: var(--peri); }
body.is-game-route .send-button svg, body.is-game-route .retry-button svg { width: 18px; height: 18px; }
body.is-game-route .retry-button:hover { transform: scale(1.04); }
body.is-game-route .retry-button:active svg { animation: retry-spin .3s ease; }
@keyframes retry-spin { to { transform: rotate(360deg); } }
body.is-game-route .taohu-fab { z-index: 40; right: 24px; bottom: calc(var(--composer-height) + 24px); width: 56px; height: 56px; border: 2px solid rgba(205, 185, 221, .8); box-shadow: var(--shadow-float); cursor: grab; touch-action: none; user-select: none; transition: transform .18s ease, box-shadow .18s ease; }
body.is-game-route .taohu-fab:active { cursor: grabbing; transform: scale(.96); }
body.is-game-route .taohu-fab:hover { transform: translateY(-2px); }

@media (max-width: 767px) {
  body.is-game-route { --game-topbar-height: 64px; --player-bar-height: 156px; --composer-height: 68px; }
  body.is-game-route .game-topbar { padding: 0 12px; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; }
  body.is-game-route .game-topbar .game-back, body.is-game-route .game-actions .icon-button { width: 40px; height: 40px; }
  body.is-game-route .game-script-name { max-width: 190px; font-size: 16px; }
  body.is-game-route .game-status-meta { font-size: 10px; }
  body.is-game-route .player-info-bar { width: calc(100% - 24px); border-radius: 18px; }
  body.is-game-route .player-info-trigger { height: var(--player-bar-height); padding: 14px 16px 9px; gap: 7px 10px; }
  body.is-game-route .player-primary strong { font-size: 16px; }
  body.is-game-route .player-status-details { padding-right: 16px; padding-left: 16px; }
  body.is-game-route .story-viewport { padding-right: 16px; padding-left: 16px; }
  body.is-game-route .story-turn > .action-options { grid-template-columns: 1fr; }
  body.is-game-route .game-composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  body.is-game-route .game-composer textarea { min-height: 44px; padding: 11px 16px; font-size: 12px; }
  body.is-game-route .send-button, body.is-game-route .retry-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  body.is-game-route .taohu-fab { right: 16px; bottom: calc(var(--composer-height) + 18px); width: 50px; height: 50px; }
}

@media (max-width: 390px) {
  body.is-game-route .game-script-name { max-width: 160px; font-size: 15px; }
  body.is-game-route .player-info-trigger { padding-right: 12px; padding-left: 12px; }
}

/* Dialogue status card revision: compact identity block with one expandable card. */
body.is-game-route {
  --game-topbar-height: 64px;
  --player-bar-height: 108px;
}

body.is-game-route .game-topbar {
  height: var(--game-topbar-height);
  min-height: var(--game-topbar-height);
}

body.is-game-route .player-status-card {
  display: flex;
  flex-direction: column;
  height: var(--player-bar-height);
  max-height: var(--player-bar-height);
  overflow: visible;
  z-index: 20;
  border: 1px solid rgba(75, 92, 118, .14);
  border-radius: 20px;
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 8px 24px rgba(75, 96, 130, .08);
  backdrop-filter: blur(18px);
}

body.is-game-route .player-status-card.is-expanded {
  height: min(66dvh, calc(100dvh - var(--game-topbar-height) - 24px));
  max-height: 66dvh;
}

body.is-game-route .player-info-trigger {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 10px 20px 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border: 0;
  border-radius: 19px 19px 0 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

body.is-game-route .player-info-trigger:hover {
  border-color: transparent;
  background: rgba(117, 173, 201, .05);
}

body.is-game-route .player-status-top {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
}

body.is-game-route .player-avatar {
  width: 46px;
  height: 46px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(117, 173, 201, .16);
  color: var(--sky);
  font: 600 24px/1 "Noto Serif SC", serif;
}

body.is-game-route .player-status-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
}

body.is-game-route .player-identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
}

body.is-game-route .player-identity strong {
  color: var(--ink);
  font: 600 17px/1.2 "Noto Serif SC", serif;
}

body.is-game-route .player-identity small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

body.is-game-route .player-context {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

body.is-game-route .player-context__item {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-game-route .player-context__item[aria-label]::before { content: none; }

body.is-game-route .player-status-metrics {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

body.is-game-route .player-status-metric {
  min-width: 0;
  height: 25px;
  padding: 2px 10px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(226, 217, 226, .68);
  color: var(--muted);
  font-size: 10px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-game-route .player-status-details {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 8px 20px 0;
  border: 0;
  overscroll-behavior: contain;
}

body.is-game-route .player-detail-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

body.is-game-route .player-status-details .detail-section {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.is-game-route .player-status-details .detail-section + .detail-section { margin-top: 14px; }

body.is-game-route .detail-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

body.is-game-route .player-detail-heading {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

body.is-game-route .player-detail-row {
  min-height: 34px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 10px;
  background: rgba(226, 217, 226, .54);
  color: var(--ink);
  font-size: 11px;
}

body.is-game-route .player-detail-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-game-route .player-status-handle {
  flex: 0 0 15px;
  width: 100%;
  min-height: 15px;
  padding: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: 0;
  border-radius: 0 0 19px 19px;
  background: var(--white);
  color: var(--muted);
}

body.is-game-route .player-status-handle:hover { background: var(--white); }
body.is-game-route .player-status-handle .player-expand {
  grid-column: auto;
  grid-row: auto;
  justify-self: center;
  align-self: center;
  width: 20px;
  height: 20px;
  transition: transform .22s ease;
}
body.is-game-route .player-status-handle[aria-expanded="true"] .player-expand { transform: none; }
body.is-game-route .player-status-card.is-expanded .player-status-handle { color: var(--peri); }

@media (max-width: 767px) {
  body.is-game-route {
    --game-topbar-height: 58px;
    --player-bar-height: 99px;
  }

  body.is-game-route .game-topbar { height: var(--game-topbar-height); min-height: var(--game-topbar-height); }
  body.is-game-route .player-status-card { width: calc(100% - 24px); border-radius: 18px; }
  body.is-game-route .player-info-trigger { min-height: 0; padding: 8px 14px 4px; border-radius: 17px 17px 0 0; gap: 5px; }
  body.is-game-route .player-status-top { min-height: 0; grid-template-columns: 42px minmax(0, 1fr); column-gap: 9px; }
  body.is-game-route .player-avatar { width: 42px; height: 42px; border-radius: 50%; font-size: 21px; }
  body.is-game-route .player-status-main { gap: 8px; }
  body.is-game-route .player-identity strong { font-size: 16px; }
  body.is-game-route .player-identity small { font-size: 10px; }
  body.is-game-route .player-context { gap: 8px; }
  body.is-game-route .player-context__item { font-size: 10px; }
  body.is-game-route .player-status-metrics { gap: 8px; }
  body.is-game-route .player-status-metric { height: 25px; padding: 2px 9px; font-size: 9px; }
  body.is-game-route .player-status-details { padding-right: 14px; padding-left: 14px; }
  body.is-game-route .player-status-handle { flex-basis: 15px; min-height: 15px; border-radius: 0 0 17px 17px; }
}

@media (max-width: 390px) {
  body.is-game-route .player-info-trigger { padding-right: 12px; padding-left: 12px; }
  body.is-game-route .player-context__item[aria-label]::before { display: none; }
}

/* Peach Core story assistant dialog */
.taohu-dialog[open] {
  --taohu-height: min(660px, 78dvh, calc(var(--taohu-view-height, 100dvh) - 24px));
  --taohu-divider: #e8e2ec;
  --taohu-purple: #62478d;
  position: fixed;
  inset: var(--taohu-view-top, 0px) 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(680px, calc(100% - 32px));
  height: var(--taohu-height);
  max-width: none;
  max-height: none;
  margin: 0 auto;
  transform: translateY(calc((var(--taohu-view-height, 100dvh) - var(--taohu-height)) / 2));
  padding: 0;
  overflow: hidden;
  border: 1px solid #efebf3;
  border-radius: 26px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 26px 80px rgb(48 39 75 / 24%), 0 6px 20px rgb(48 39 75 / 12%);
}
.taohu-dialog::backdrop {
  background: rgb(45 40 61 / 31%);
  backdrop-filter: blur(3px);
}
body:has(.taohu-dialog[open]) { overflow: hidden; }
.taohu-header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--taohu-divider);
  background:
    radial-gradient(ellipse at 4% 0%, #eee4f7, transparent 67%),
    linear-gradient(110deg, #fbf8fd, #f6fafc);
}
.taohu-emblem {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 16px;
  background: linear-gradient(145deg, #a792d1, #755ba9);
  color: white;
  box-shadow: 0 5px 12px rgb(98 71 141 / 19%), inset 0 1px rgb(255 255 255 / 35%);
}
.taohu-emblem svg { width: 23px; height: 23px; }
.taohu-emblem { overflow: hidden; border-radius: 50%; background: var(--white); }
.taohu-emblem img { display: block; width: 100%; height: 100%; object-fit: cover; }
.taohu-fab { overflow: hidden; background: var(--white); padding: 0; }
.taohu-fab img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
@media (max-width: 430px) { .brand-logo { width: 48px; height: 32px; } }
@media print { .brand-logo { content: url("assets/brand/peachcore-smooth-black.svg"); } }
.taohu-heading { flex: 1; min-width: 0; }
.taohu-header h2 { margin: 0; font: 600 24px/1.25 "Noto Serif SC", serif; letter-spacing: .04em; }
.taohu-header p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.taohu-header .icon-button {
  flex-shrink: 0;
  border-color: #e4ddec;
  background: rgb(255 255 255 / 72%);
  color: #5e536f;
  box-shadow: none;
}
.taohu-header .icon-button:hover { background: white; border-color: #bba8d1; }
.taohu-thread {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c5b8d4 transparent;
  padding: 22px;
  background:
    radial-gradient(ellipse at 95% 0%, rgb(219 232 242 / 58%), transparent 65%),
    linear-gradient(158deg, #f8f4fa 0%, #f8faf8 68%, #f4f7ea 100%);
}
.taohu-message { max-width: min(94%, 510px); overflow-wrap: anywhere; }
.taohu-message > span { display: block; margin: 0 2px 6px; font-size: 13px; color: var(--taohu-purple); font-weight: 600; }
.taohu-message:not(.is-player) > span { display: flex; align-items: center; gap: 7px; }
.taohu-message:not(.is-player) > span::before { content: ""; display: inline-block; flex: 0 0 26px; width: 26px; height: 26px; border: 1px solid var(--thistle); border-radius: 50%; background: white url("assets/taohu-avatar.jpg") center / cover; }
.taohu-message > p, .taohu-proposal {
  margin: 0;
  padding: 12px 15px;
  border: 1px solid #ebe5ef;
  border-radius: 5px 17px 17px;
  background: var(--white);
  box-shadow: 0 3px 9px rgb(66 50 90 / 5%);
  font-size: 15px;
  line-height: 1.65;
}
.taohu-message > p { white-space: pre-wrap; }
.taohu-message.is-player { align-self: flex-end; }
.taohu-message.is-player > span { text-align: right; color: #516d83; }
.taohu-message.is-player > p {
  border-color: #d7e4ed;
  border-radius: 17px 5px 17px 17px;
  background: #eaf3f9;
}
.taohu-proposal { padding: 0; overflow: hidden; }
.taohu-proposal > strong {
  display: block;
  padding: 10px 15px;
  border-bottom: 1px solid var(--taohu-divider);
  background: linear-gradient(105deg, #f2ebf8, #fbf9fd);
  color: var(--taohu-purple);
}
.taohu-proposal dl { display: grid; gap: 3px; margin: 0; padding: 12px 15px; }
.taohu-proposal dt { font-weight: 700; font-size: 13px; color: #59486f; }
.taohu-proposal dd { margin: 0; }
.taohu-proposal dd + dt { margin-top: 6px; }
.taohu-proposal small { display: block; padding: 0 15px; font-size: 13px; color: var(--muted); }
.taohu-conflict { margin: 0 15px 10px; padding: 8px 10px; border-left: 3px solid #aa6271; border-radius: 5px 10px 10px 5px; background: #faedf1; }
.taohu-proposal-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 3px 10px 9px; }
.taohu-proposal-actions .secondary-button:disabled { opacity: .66; cursor: default; }
.taohu-composer {
  display: grid;
  gap: 9px;
  padding: 13px 22px 11px;
  border-top: 1px solid var(--taohu-divider);
  background: #fdfcfe;
}
.taohu-services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.taohu-options, .taohu-compose-row { display: flex; align-items: center; gap: 8px; }
.taohu-services button, .taohu-cancel {
  min-height: 42px;
  padding: 5px 10px;
  border: 1px solid #e8e1ee;
  border-radius: 12px;
  background: #f7f4fa;
  color: #57466b;
  font-size: 14px;
  line-height: 1.2;
}
.taohu-services button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; }
.taohu-services button:hover { border-color: #cbb9dd; background: #f1ebf7; }
.taohu-services button[aria-pressed="true"] { border-color: #a58cc3; background: #eee5f7; color: #4b316c; }
.taohu-services svg { width: 16px; height: 16px; flex: 0 0 16px; }
.taohu-options { flex-wrap: wrap; font-size: 14px; }
.taohu-options label { margin: 0; color: #59486f; }
.taohu-options select { min-height: 36px; padding: 4px 8px; border: 1px solid var(--taohu-divider); border-radius: 9px; background: var(--white); color: var(--ink); font: inherit; }
.taohu-cancel { border-color: transparent; background: transparent; color: var(--taohu-purple); }
.taohu-cancel:hover { background: #f5eff9; }
.taohu-compose-row {
  padding: 5px;
  border: 1px solid #e2dbe9;
  border-radius: 15px;
  background: var(--white);
}
.taohu-compose-row:focus-within { border-color: #9d86bf; box-shadow: 0 0 0 3px rgb(149 128 212 / 12%); }
.taohu-compose-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 110px;
  margin: 0;
  padding: 6px 8px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}
.taohu-compose-row textarea:focus { outline: 0; box-shadow: none; }
.taohu-compose-row .primary-button {
  min-height: 44px;
  align-self: flex-end;
  gap: 5px;
  padding: 0 13px;
  border-radius: 11px;
  background: #d3e7f2;
  color: #233a50;
}
.taohu-compose-row .primary-button:hover { background: #c1dceb; }
.taohu-compose-row .primary-button svg { width: 15px; height: 15px; }
.taohu-preview-note { margin: 0; color: var(--muted); font-size: 12px; }
.taohu-dialog :focus-visible { outline: 2px solid #654892; outline-offset: 2px; }
.taohu-compose-row textarea:focus-visible { outline: 0; }
@media (max-width: 600px) {
  .taohu-dialog[open] { width: calc(100% - 24px); border-radius: 20px; }
  .taohu-header, .taohu-thread, .taohu-composer { padding-left: 12px; padding-right: 12px; }
  .taohu-header { padding-top: 12px; padding-bottom: 12px; gap: 9px; }
  .taohu-header h2 { font-size: 21px; }
  .taohu-header p { font-size: 12px; }
  .taohu-emblem { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
  .taohu-services { gap: 5px; }
  .taohu-services button { padding: 4px; gap: 4px; white-space: nowrap; font-size: 13px; }
  .taohu-services svg { width: 14px; height: 14px; flex-basis: 14px; }
  .taohu-compose-row .primary-button { padding: 0 9px; }
}

/* Creation intake and workspace */
.creation-page { max-width: 1160px; padding-top: 26px; padding-bottom: 32px; }
.creation-page > .back-button { margin-bottom: 17px; }
.creation-heading {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0 0 20px;
  padding: clamp(16px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(115deg, var(--lavender), var(--white) 58%, rgba(117, 173, 201, .14));
  box-shadow: var(--shadow);
}
.creation-icon {
  display: grid;
  flex: 0 0 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--thistle);
  border-radius: 16px;
  background: var(--lavender);
  color: var(--ink);
}
.creation-heading h1 { margin: 0; font: 600 clamp(23px, 3vw, 34px)/1.35 "Noto Serif SC", serif; overflow-wrap: anywhere; }
.creation-heading p { margin: 5px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.creation-grid, .workspace-grid { display: grid; align-items: start; gap: 16px; }
.creation-grid { grid-template-columns: minmax(0, 1.4fr) minmax(265px, 1fr); }
.workspace-grid { grid-template-columns: minmax(255px, .7fr) minmax(0, 1.5fr); }
.creation-card {
  min-width: 0;
  padding: clamp(15px, 2.5vw, 23px);
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  box-shadow: var(--shadow);
}
.creation-card h2, .creation-drafts h2 { margin: 0 0 15px; font: 600 20px/1.4 "Noto Serif SC", serif; }
.creation-card-heading { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.creation-card-heading h2 { margin: 0; }
.creation-meta, .creation-note, .creation-field-source { color: var(--muted); font-size: 13px; }
.creation-field { display: grid; gap: 7px; margin-bottom: 14px; color: var(--ink); font-size: 14px; font-weight: 600; }
.creation-field:last-child { margin-bottom: 0; }
.creation-field input, .creation-field textarea, .creation-field select {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  line-height: 1.55;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
}
.creation-field textarea { resize: vertical; min-height: 92px; }
.creation-field-source { font-weight: 400; overflow-wrap: anywhere; }
.creation-upload-area {
  display: grid;
  justify-items: start;
  gap: 7px;
  padding: 13px;
  border: 1px dashed var(--thistle);
  border-radius: 13px;
  background: rgba(226, 217, 226, .23);
}
.creation-upload-area small { color: var(--ink); line-height: 1.5; }
.creation-upload, .creation-actions .secondary-button { background: var(--lavender); color: var(--ink); }
.creation-files { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.creation-files li, .creation-original {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
}
.creation-original { margin-top: 10px; }
.creation-file-name { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 9px; }
.creation-file-name strong { overflow-wrap: anywhere; }
.creation-file-name small { color: var(--muted); }
.creation-file-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.creation-file-details summary, .creation-original summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.creation-file-preview {
  max-height: 260px;
  overflow: auto;
  margin: 8px 0;
  padding: 10px;
  border-radius: 9px;
  background: rgba(226, 217, 226, .4);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.creation-inline { min-height: 38px; padding: 4px 5px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-weight: 600; }
.creation-inline:hover { background: var(--lavender); }
.workspace-navigation {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 17px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(226, 217, 226, .25);
}
.workspace-navigation button {
  min-height: 42px;
  padding: 5px 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
}
.workspace-navigation button:hover { background: var(--lavender); }
.workspace-navigation button[aria-pressed="true"] {
  border-color: var(--thistle);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}
.workspace-field + .workspace-field { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.workspace-field .creation-field { margin-bottom: 5px; }
.workspace-confirmation { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--ink); font-size: 13px; cursor: pointer; }
.workspace-confirmation input { accent-color: #795eaa; }
.creation-feedback { min-height: 22px; margin: 10px 0 4px; color: var(--ink); overflow-wrap: anywhere; }
.creation-feedback.is-error { color: var(--ink); }
.creation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.creation-actions .primary-button, #creation-setup .primary-button { color: var(--ink); background: rgba(117, 173, 201, .36); }
.creation-actions button:disabled { opacity: .6; cursor: wait; }
.creation-drafts { margin-top: 26px; }
.creation-draft-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(245px, 100%), 1fr)); gap: 9px; }
#creation-library-drafts { margin-bottom: 14px; }
.creation-draft-card {
  display: grid;
  justify-items: start;
  gap: 3px;
  min-height: 84px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
}
.creation-draft-card:hover { border-color: var(--peri); }
.creation-draft-card strong { font-size: 15px; }
.creation-draft-card small { color: var(--muted); }
.creation-draft-action { color: var(--ink); font-size: 13px; font-weight: 600; }
.creation-page :focus-visible, #creation-setup :focus-visible, .creation-draft-card:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }
@media (max-width: 760px) {
  .creation-page { padding-top: 16px; }
  .creation-grid, .workspace-grid { grid-template-columns: 1fr; gap: 11px; }
  .creation-heading { gap: 10px; margin-bottom: 13px; }
  .creation-icon { height: 42px; flex-basis: 42px; border-radius: 13px; }
  .workspace-navigation { gap: 3px; padding: 3px; }
  .workspace-navigation button { font-size: 13px; }
  .creation-actions { justify-content: stretch; }
  .creation-actions > * { flex: 1 1 auto; justify-content: center; }
}


/* Direct start from a scenario file */
.creation-grid.is-files-only { grid-template-columns: minmax(0, 1fr); }
#import-role-reference .creation-original:first-child { margin-top: 0; }
.import-game {
  height: 100dvh;
  overflow: auto;
  overscroll-behavior: contain;
}
.import-game .creation-page { max-width: 850px; }
.import-opening > #import-game-opening {
  margin: 0 0 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.8;
}
.import-opening .creation-note { margin: 0; padding-top: 13px; border-top: 1px solid var(--line); }


/* Workspace completion uses the original Peach Core success color. */
.workspace-field.is-complete input:not([type="checkbox"]),
.workspace-field.is-complete textarea { border-color: var(--success); background: var(--white); }
.workspace-assist {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.workspace-assist input, .workspace-mode input { accent-color: var(--peri); }
.workspace-field-status { margin-left: 10px; color: var(--ink); font-size: 13px; }
.workspace-field-status:not(:empty) { padding: 3px 7px; border: 1px solid var(--success); border-radius: 999px; }
.workspace-reference {
  min-width: 0;
  margin: 0 0 19px;
  padding: 11px 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.workspace-reference legend { padding: 0 5px; color: var(--ink); font-weight: 700; }
.workspace-reference p { margin: 0 0 8px; }
.workspace-mode-options { display: grid; gap: 7px; }
.workspace-mode {
  display: flex;
  align-items: start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
}
.workspace-mode:has(:checked) { border-color: var(--peri); background: var(--lavender); }
.workspace-mode strong, .workspace-mode small { display: block; }
.workspace-mode small { color: var(--ink); }
.narrative-style { min-inline-size: 0; margin: 12px 0; padding: 0; border: 0; }
.setup-panel > .narrative-style { margin: 0; }
.narrative-style legend {
  margin-bottom: 9px;
  padding: 0;
  color: var(--ink);
  font: 600 16px/1.4 "Noto Serif SC", serif;
}
.narrative-style-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.narrative-style-options .workspace-mode { padding: 9px 10px; }
.narrative-style-options .workspace-mode:has(:focus-visible) { outline: 2px solid var(--peri); outline-offset: 2px; }
.narrative-style-options input { flex: 0 0 auto; margin: 3px 0 0; accent-color: var(--peri); }
.narrative-style-options small { margin-top: 2px; color: var(--muted); line-height: 1.5; }
@media (max-width: 380px) {
  .narrative-style-options { grid-template-columns: minmax(0, 1fr); }
}
.setup-extra { margin: 12px 0; }
.setup-extra > .creation-field, #sample-custom-length { margin-top: 12px; }
.profile-page-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  margin-bottom: 16px;
  padding: clamp(16px, 4vw, 34px);
  border: 1px solid var(--thistle);
  border-radius: 22px;
  background: linear-gradient(120deg, var(--lavender), var(--white));
  box-shadow: var(--shadow);
}
.profile-page-heading h1 { margin: 0; color: var(--ink); font: 600 clamp(25px, 5vw, 40px)/1.3 "Noto Serif SC", serif; overflow-wrap: anywhere; }
.profile-page-heading p { margin: 7px 0; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-page-avatar {
  display: grid;
  width: clamp(56px, 10vw, 86px);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--thistle);
  color: var(--ink);
  font: 600 29px "Noto Serif SC", serif;
  box-shadow: var(--shadow);
}
.profile-page-genre { display: inline-block; border-radius: 999px; background: var(--lavender); padding: 4px 9px; color: var(--ink); }
.personal-activity .text-button { margin-top: 10px; }
.personal-create { margin-top: 14px; color: var(--ink); }
@media (max-width: 520px) {
  .profile-page-heading { grid-template-columns: auto minmax(0, 1fr); }
  .profile-page-heading > button { grid-column: 1 / -1; justify-self: start; }
}


#sample-setup .length-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#sample-setup .setup-panel + .setup-panel { margin-top: 14px; }
.creation-feedback.is-error { border-left: 3px solid var(--danger); padding-left: 9px; }
@media (max-width: 520px) { #sample-setup .length-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Save details and delegated pacing */
.pace-delegation { margin-bottom: 9px; }
#sample-pace-option { margin-top: 1px; }
.save-detail-page { max-width: 880px; }
.save-detail-catalog { display: grid; gap: 9px; }
.save-detail-chapter { min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.save-detail-chapter > summary {
  padding: 12px 13px;
  background: var(--lavender);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
.save-detail-rounds { margin: 0; padding: 0; list-style: none; max-height: 52vh; overflow: auto; }
.save-detail-round { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; }
.save-detail-round + .save-detail-round { border-top: 1px solid var(--line); }
.save-detail-round-copy { min-width: 0; }
.save-detail-round-copy p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.save-detail-round .secondary-button, .save-detail-status { flex: 0 0 auto; }
.save-detail-round .secondary-button { min-height: 40px; }
.save-detail-status { color: var(--muted); font-size: 13px; }
.save-detail-status.is-current { padding: 4px 8px; border: 1px solid var(--success); border-radius: 999px; color: var(--ink); }
.save-detail-page :focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }


/* Discovery and account tools */
.square-toolbar { display:grid; grid-template-columns:minmax(0,2fr) repeat(2,minmax(0,1fr)); align-items:end; gap:12px; margin-bottom:18px; padding:14px; border:1px solid var(--line); border-radius:16px; background:var(--white); }
.square-toolbar .creation-field { margin:0; }
.square-story { min-width:0; }
.catalog-entry { position: relative; }
.catalog-story-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 16px; cursor: pointer; }
.catalog-story-link:focus-visible { outline: none; }
.catalog-story-link:focus-visible::after { outline: 2px solid var(--peri); outline-offset: -3px; }
.catalog-entry .story-engagement { position: relative; z-index: 2; pointer-events: none; }
.catalog-entry .story-engagement button { pointer-events: auto; }
.catalog-cover { position: relative; }
.catalog-cover > button.story-cover { width: 100%; padding: 0; border: 0; font: inherit; cursor: pointer; }
.catalog-cover > button.story-cover:focus-visible { outline: 3px solid var(--peri); outline-offset: -4px; }
.square-story, .recent-card:has(.story-engagement) { display: flex; flex-direction: column; }
.square-story > .story-card-body, .recent-card:has(.story-engagement) > .recent-body { flex: 1; display: flex; flex-direction: column; }
.story-engagement { display: flex; align-items: center; gap: 18px; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); }
.story-engagement-item { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 28px; padding: 0; border: 0; background: transparent; color: inherit; font-family: inherit; font-size: 11px; line-height: 1.2; }
.story-engagement-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.story-engagement-item[aria-pressed="true"] svg { fill: currentColor; }
.story-engagement-item[aria-pressed="true"] { color: var(--peri); }
.story-engagement-item:focus-visible { outline: 2px solid var(--peri); outline-offset: 3px; }
.story-engagement-item:disabled { opacity: .65; cursor: wait; }
.square-story .story-card-body h2 { margin:0 0 7px; color:var(--ink); font:600 18px/1.45 "Noto Serif SC", serif; overflow-wrap:anywhere; }
.square-story .story-card-body p { min-height:3em; }
.square-story .text-button, .utility-page .text-button, .surface-chapter .text-button { color:var(--ink); }
.catalog-glyph { font:600 25px "Noto Serif SC", serif; }
.surface-card p, .surface-card a { overflow-wrap:anywhere; }
.surface-card > .primary-button, .surface-card > .secondary-button { margin-top:8px; color:var(--ink); }
.surface-card > a { display:block; color:var(--ink); }
.surface-card h3 { margin:17px 0 8px; color:var(--ink); font:600 17px "Noto Serif SC", serif; }
.surface-list { display:grid; gap:9px; margin:10px 0; overflow-wrap:anywhere; }
.surface-list .surface-card { padding:12px 14px; box-shadow:none; }
.surface-list .surface-card h2 { margin:0 0 7px; font-size:17px; }
.surface-list .surface-card p { margin:0; }
.surface-empty { color:var(--muted); }
.surface-buttons { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.surface-buttons .primary-button, .surface-buttons .secondary-button { color:var(--ink); }
.surface-chapter { margin-bottom:9px; }
.surface-chapter summary { cursor:pointer; font-weight:700; }
.surface-chapter p { margin-bottom:3px; }
.surface-turn-log { display:grid; gap:9px; margin:13px 0; }
.surface-turn-log .model-turn { padding:14px 16px; box-shadow:none; }
.model-turn p, .model-proposal-copy { margin:6px 0 11px; white-space:pre-wrap; overflow-wrap:anywhere; }
.model-turn p:last-child { margin-bottom:0; }
.model-proposal-copy { padding:6px 15px 0; }
.utility-game-input { display:flex; flex-wrap:wrap; align-items:end; gap:8px; margin-top:14px; }
.utility-game-input textarea { flex:1 1 130px; min-width:0; padding:8px 10px; border:1px solid var(--line); border-radius:12px; background:var(--white); font-size:16px; }
.utility-game-input .send-button { min-width:44px; color:var(--ink); }
@media (max-width:580px) {
  .square-toolbar { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .square-toolbar .creation-field:first-child { grid-column:1 / -1; }
}

/* Administration */
.site-maintenance-banner {
  width: min(100% - 32px, 1240px);
  margin: 14px auto 0;
  padding: 11px 16px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--thistle);
  border-radius: 13px;
  background: var(--lavender);
  color: var(--ink);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.site-maintenance-banner strong { flex: 0 0 auto; }

.admin-workbench { padding-top: clamp(20px, 5vw, 44px); }
body.is-admin-route .mobile-nav { display: none; }
.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(115deg, var(--lavender), var(--white) 78%);
  box-shadow: var(--shadow);
}
.admin-heading { min-width: 0; }
.admin-heading h1 {
  margin: 0;
  font: 600 clamp(25px, 4vw, 39px)/1.25 "Noto Serif SC", serif;
  letter-spacing: .015em;
}
.admin-caption { max-width: 52ch; margin: 8px 0 0; color: var(--ink); line-height: 1.65; }
.admin-status {
  --admin-status-color: var(--peri);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--admin-status-color) 56%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-status-color) 13%, var(--white));
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.admin-status[data-state="live"], .admin-status[data-state="active"] { --admin-status-color: var(--success); }
.admin-status[data-state="maintenance"], .admin-status[data-state="disabled"] { --admin-status-color: var(--danger); }
.admin-status::before {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--admin-status-color);
  content: "";
}
.admin-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: 10px;
  margin-bottom: 19px;
}
.admin-metric {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px clamp(12px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}
.admin-metric > span { color: var(--muted); font-size: 12px; }
.admin-metric > strong { font-size: clamp(21px, 3vw, 28px); font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }

.admin-layout { display: grid; grid-template-columns: 174px minmax(0, 1fr); align-items: start; gap: 14px; }
.admin-nav {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--white) 74%, var(--lavender));
}
.admin-nav button {
  min-width: 0;
  min-height: 45px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}
.admin-nav button svg { width: 16px; height: 16px; flex: 0 0 16px; }
.admin-nav button:hover { background: var(--white); }
.admin-nav button[aria-pressed="true"] { border-color: var(--thistle); background: var(--lavender); font-weight: 700; }
.admin-panel {
  min-width: 0;
  padding: clamp(15px, 3vw, 27px);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.admin-panel h2 { margin: 0; font: 600 22px/1.4 "Noto Serif SC", serif; }
.admin-panel p { margin: 6px 0 13px; color: var(--muted); overflow-wrap: anywhere; }
.admin-toolbar, .admin-actions, .admin-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-toolbar { justify-content: space-between; margin: 13px 0; }
.admin-toolbar > form { min-width: 0; }
.admin-pager { justify-content: flex-end; margin-top: 12px; font-size: 12px; }
.admin-form { display: grid; gap: 13px; align-items: start; }
.admin-form label { display: grid; min-width: 0; gap: 5px; margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.admin-toolbar .admin-search { display: flex; flex: 1 1 240px; align-items: center; gap: 8px; max-width: 420px; }
.admin-search input { flex: 1 1 0; }
.admin-search button { flex-shrink: 0; }
:is(.admin-workbench, .admin-operation) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
.admin-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { width: 100%; }
.admin-form :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--peri); }
.admin-form label:has(> :is(input[type="checkbox"], input[type="radio"])) { display: flex; align-items: center; gap: 8px; }
.admin-form textarea { min-height: 94px; resize: vertical; }
:is(.admin-workbench, .admin-operation) .primary-button { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 42%, var(--white)); color: var(--ink); }
:is(.admin-workbench, .admin-operation) .danger-button { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 20%, var(--white)); color: var(--ink); }
:is(.admin-workbench, .admin-operation) button:disabled { opacity: .55; cursor: default; transform: none; }
:is(.admin-workbench, .admin-operation) :focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }

.admin-table-wrap { min-width: 0; max-width: 100%; margin-top: 9px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.admin-table { width: 100%; border-collapse: collapse; color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-table :is(th, td) { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table thead th { background: color-mix(in srgb, var(--lavender) 62%, var(--white)); font-size: 12px; font-weight: 700; white-space: nowrap; }
.admin-table tbody tr:last-child :is(th, td) { border-bottom: 0; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--lavender) 23%, var(--white)); }
.admin-table td { overflow-wrap: anywhere; }
.admin-table :is(th, td):has(.admin-actions) { min-width: 148px; }
.admin-table .admin-actions { gap: 4px; }
.admin-table .admin-actions button, .admin-pager button { min-height: 38px; padding: 0 9px; border-radius: 10px; font-size: 12px; }

#admin-feedback { margin: 10px 0; padding: 9px 11px; border-left: 3px solid var(--success); border-radius: 5px 10px 10px 5px; background: var(--ivory); color: var(--ink); overflow-wrap: anywhere; }
#admin-feedback:empty { display: none; }
#admin-feedback:is(.is-error, [data-state="error"]) { border-color: var(--danger); }
.admin-invite-code {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(100%, 500px);
  align-items: center;
  gap: 7px;
  margin: 8px 0;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.admin-invite-code input { font-family: ui-monospace, Consolas, monospace !important; }
.admin-invite-code span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.admin-operation { max-height: calc(100dvh - 32px); padding: clamp(17px, 4vw, 28px); overflow-y: auto; }
.admin-operation h2 { margin-top: 0; }
.admin-operation p { overflow-wrap: anywhere; }
.admin-operation .admin-actions { justify-content: flex-end; }

@media (max-width: 760px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .admin-nav { position: static; grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr)); }
  .admin-nav button { justify-content: center; text-align: center; }
  .admin-table { min-width: 590px; }
}
@media (max-width: 430px) {
  .admin-header { flex-wrap: wrap; gap: 10px; }
  .admin-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .admin-metric { padding: 10px; }
  .admin-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-nav button { gap: 5px; padding-inline: 4px; font-size: 12px; }
  .admin-toolbar > :is(.admin-actions, form) { flex: 1 1 100%; }
  .admin-account-table { display: block; min-width: 0; }
  .admin-account-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .admin-account-table tbody { display: block; }
  .admin-account-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  .admin-account-table tr:last-child { border-bottom: 0; }
  .admin-account-table td { padding: 0; border: 0; }
  .admin-account-table td:first-child { font-weight: 700; }
  .admin-account-table td:nth-child(3)::before { content: "余额 "; color: var(--muted); }
  .admin-account-table td:nth-child(4) { color: var(--muted); font-size: 12px; }
  .admin-account-table td:last-child { grid-column: 1 / -1; }
}
/* Homepage discovery — scoped to preserve the other routes. */
#view-home .home-content { width: min(calc(100% - 64px), 1240px); padding-top: 28px; }
#view-home .page-search-wrap { width: min(100%, 640px); margin-bottom: 24px; }
#view-home .page-search { height: 44px; box-shadow: 0 4px 14px rgba(78, 76, 112, .04); }
#view-home .search-results { top: calc(100% + 8px); }
#view-home .announcement { margin-bottom: 24px; }
#view-home .home-section { margin-bottom: 32px; }
#view-home .section-heading { align-items: center; margin-bottom: 16px; gap: 16px; }
#view-home .section-heading h2 { margin: 0; font-size: 22px; }
#view-home .section-heading > .text-button { flex-shrink: 0; font-size: 13px; }
#view-home #shared-stories-title { scroll-margin-top: 94px; }
.home-welcome { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; margin-bottom: 32px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(110deg, var(--white), var(--lavender)); }
.home-welcome h1 { margin: 0 0 8px; font: 600 22px/1.4 "Noto Serif SC", serif; }
.home-welcome p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
#view-home .primary-button { background: var(--peri); }
.home-welcome .primary-button { flex-shrink: 0; font-size: 14px; }
#view-home .recent-scroller { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0; overflow: visible; }
#view-home .recent-card { min-height: 112px; display: flex; flex-direction: row; border-radius: 16px; box-shadow: 0 4px 14px rgba(78, 76, 112, .04); }
#view-home .recent-card .catalog-cover { width: 82px; flex: 0 0 82px; }
#view-home .recent-card .story-cover { height: 100%; min-height: 112px; }
#view-home .recent-card .story-cover b { font-size: 30px; }
#view-home .recent-card .story-cover::after { width: 68px; height: 68px; }
#view-home .recent-body { min-width: 0; flex: 1; padding: 12px; display: flex; flex-direction: column; }
#view-home .recent-body h3 { margin: 0 0 5px; font: 600 14px/1.45 "Noto Serif SC", serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#view-home .recent-body p { margin: 0 0 5px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-recent-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.home-recent-foot time { color: var(--muted); font-size: 11px; }
#view-home .home-recent-foot .text-button, #view-home .home-recent-foot .primary-button { margin: 0 0 0 auto; min-height: 28px; font-size: 12px; }
#view-home .home-recent-foot .primary-button { padding: 0 10px; border-radius: 8px; }
.home-recent-empty { grid-column: 1 / -1; min-height: 80px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px dashed var(--line); border-radius: 16px; background: rgba(255, 255, 255, .56); }
.home-recent-empty p { margin: 0; color: var(--muted); font-size: 14px; }
.home-recent-empty .text-button { flex-shrink: 0; }
.home-discovery-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.home-source-filter { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--lavender); }
.home-source-filter button, .home-genre-filter button { flex-shrink: 0; min-height: 32px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 14px; white-space: nowrap; transition: background .16s ease, color .16s ease; }
.home-source-filter button { min-width: 64px; padding: 0 14px; border-radius: 9px; }
.home-source-filter button[aria-pressed="true"] { background: var(--peri); color: var(--white); }
.home-sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.home-sort > span { position: relative; display: flex; align-items: center; }
.home-sort select { appearance: none; min-height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font: inherit; color: var(--ink); cursor: pointer; }
.home-sort svg { position: absolute; right: 8px; width: 14px; height: 14px; pointer-events: none; }
.home-genre-filter { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.home-genre-filter button { padding: 0 12px; border-radius: 999px; }
.home-genre-filter button[aria-pressed="true"] { border-color: var(--thistle); background: var(--lavender); color: var(--ink); font-weight: 600; }
.home-genre-filter button:hover, .home-source-filter button[aria-pressed="false"]:hover { background: var(--white); color: var(--ink); }
#view-home #shared-stories-feedback { min-height: 100px; padding: 24px; border: 1px dashed var(--line); border-radius: 16px; background: rgba(255, 255, 255, .5); text-align: center; color: var(--muted); }
#view-home #shared-stories-feedback p { margin: 0 0 12px; font-size: 14px; }
#view-home .story-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
#view-home .story-card { display: flex; flex-direction: column; border-radius: 16px; background: var(--white); box-shadow: 0 4px 14px rgba(78, 76, 112, .045); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
#view-home .story-card .story-cover { height: auto; aspect-ratio: 16 / 10; }
#view-home .story-card .cover-code { font-size: 11px; letter-spacing: .04em; }
#view-home .story-card-body { padding: 16px; }
#view-home .story-card-body h2 { margin: 0 0 9px; min-height: 0; font-size: 16px; line-height: 1.45; }
.home-story-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.home-story-title:hover { color: var(--peri); }
.home-story-tags { display: flex; gap: 6px; min-height: 23px; margin-bottom: 9px; }
#view-home .home-story-tags .tag { min-height: 23px; max-width: 100%; padding: 2px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); background: var(--ivory); }
#view-home .story-card-body p { margin: 0 0 14px; min-height: 3.2em; font-size: 13px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#view-home .story-engagement { gap: 18px; padding-top: 8px; }
.home-footer { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--muted); }
#view-home :is(button, select):focus-visible { outline: 2px solid var(--peri); outline-offset: 3px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #view-home .story-card:hover { transform: translateY(-2px); border-color: var(--thistle); box-shadow: 0 8px 20px rgba(78, 76, 112, .08); }
}
@media (max-width: 1100px) {
  #view-home .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view-home .recent-card .catalog-cover { width: 64px; flex-basis: 64px; }
}
@media (max-width: 767px) {
  #view-home .home-content { width: calc(100% - 32px); padding-top: 20px; padding-bottom: 104px; }
  #view-home .page-search-wrap { margin-bottom: 20px; }
  #view-home .page-search input { font-size: 16px; }
  #view-home .home-section { margin-bottom: 24px; }
  #view-home .section-heading { margin-bottom: 12px; }
  #view-home .section-heading h2 { font-size: 20px; }
  #view-home .section-heading > .text-button { font-size: 12px; }
  .home-welcome { min-height: 112px; padding: 20px; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
  .home-welcome h1 { font-size: 20px; }
  .home-welcome p { font-size: 13px; }
  .home-welcome .primary-button { min-height: 40px; font-size: 13px; }
  #view-home .recent-scroller { display: flex; gap: 12px; overflow-x: auto; padding: 0 0 6px; scroll-snap-type: x proximity; }
  #view-home .recent-card { flex: 0 0 260px; }
  #view-home .recent-card .catalog-cover { width: 70px; flex-basis: 70px; }
  .home-recent-empty { flex: 1 0 100%; min-width: 0; padding: 14px; gap: 8px; }
  .home-recent-empty p { font-size: 13px; }
  .home-discovery-tools { gap: 8px; margin-bottom: 12px; }
  .home-source-filter button { min-width: 44px; padding: 0 10px; font-size: 13px; }
  .home-sort { gap: 5px; font-size: 12px; }
  .home-sort select { max-width: 115px; padding-left: 8px; }
  .home-genre-filter { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 12px; margin-bottom: 16px; scrollbar-width: thin; }
  .home-genre-filter button { font-size: 13px; }
  #view-home .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #view-home .story-card { border-radius: 14px; }
  #view-home .story-card-body { padding: 12px; }
  #view-home .story-card-body h2 { font-size: 14px; }
  #view-home .story-card-body p { font-size: 12px; margin-bottom: 12px; }
  #view-home .story-card .cover-code { top: 10px; left: 12px; font-size: 10px; }
  #view-home .story-card .story-cover b { font-size: 34px; }
  #view-home .story-engagement { gap: 12px; flex-wrap: wrap; }
  .home-footer { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  #view-home *, #view-home *::before, #view-home *::after { scroll-behavior: auto !important; transition: none !important; }
}

.social-layout{display:grid;grid-template-columns:180px minmax(0,720px) 300px;gap:20px;align-items:start}.social-main{min-width:0}.social-left,.social-right{position:sticky;top:96px;display:grid;gap:12px}.social-left h1,.social-right h2{margin:0;font:600 22px 'Noto Serif SC',serif}.social-right h2{font-size:17px}.social-right p{color:var(--muted)}.social-nav{padding:12px 16px;text-align:left;border:0;border-radius:12px;background:transparent;color:var(--muted)}.social-nav.is-active,.social-tabs .is-active{background:var(--lavender);color:var(--peri)}.social-post,.social-composer,.social-profile,.social-comment-form,.social-comment{padding:20px;margin-bottom:16px;border:1px solid var(--line);border-radius:16px;background:var(--white)}.social-post-head{display:flex;gap:12px;align-items:center}.social-avatar{width:44px;height:44px;flex-shrink:0;border:0;border-radius:50%;background:var(--lavender);color:var(--peri);font-size:20px}.social-name,.social-time{display:block;padding:0;border:0;background:none;text-align:left}.social-name{font-weight:600;font-size:15px}.social-time{font-size:12px;color:var(--muted);margin-top:4px}.social-follow{margin-left:auto;min-height:32px}.social-copy{font-size:16px;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere;cursor:pointer}.social-copy.is-folded{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:6;overflow:hidden}.social-post-tools{display:flex;justify-content:space-between;gap:8px;border-top:1px solid var(--line);margin-top:16px}.social-more{font-size:12px;color:var(--muted)}.social-more .text-button{margin-right:16px}.social-images{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.social-image{border:0;padding:0;background:var(--lavender);border-radius:10px;overflow:hidden;aspect-ratio:1}.social-image img{width:100%;height:100%;object-fit:cover}.social-script{display:block;width:100%;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--ivory);text-align:left;margin-top:12px}.social-original{padding:12px;background:var(--ivory);border-radius:12px;overflow-wrap:anywhere}.social-tabs{display:flex;gap:12px;margin-bottom:16px;border-bottom:1px solid var(--line);position:sticky;top:72px;background:var(--ivory);z-index:3;padding:8px 0}.social-tabs button{padding:0 16px;border-radius:10px}.social-composer textarea,.social-comment-form textarea,.social-composer input,.social-right input{width:100%;border:1px solid var(--line);border-radius:12px;padding:12px;background:var(--white);font:inherit}.social-composer textarea{resize:vertical;font-size:16px}.social-compose-options{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:12px}.social-compose-options input{font-size:12px}.social-compose-options select{min-width:0;max-width:220px;padding:8px;border:1px solid var(--line);border-radius:8px;background:var(--white)}.social-compose-options .primary-button{margin-left:auto;background:var(--peri)}.social-upload-preview{display:flex;gap:6px;flex-wrap:wrap}.social-upload-preview img{width:60px;height:60px;object-fit:cover}.social-empty{padding:28px;color:var(--muted);text-align:center}.social-profile{overflow:hidden}.social-profile-cover{height:160px;background:linear-gradient(110deg,var(--lavender),var(--thistle));margin:-20px -20px -24px}.social-profile>.social-avatar{position:relative;width:72px;height:72px;border:4px solid var(--white)}.social-profile h1{font-size:24px}.social-comment-form textarea{min-height:80px}.social-comment p{white-space:pre-wrap;overflow-wrap:anywhere}.social-lightbox img{display:block;max-width:85vw;max-height:75vh;object-fit:contain}.social-lightbox{max-width:95vw}.social-lightbox::backdrop{background:rgba(47,48,64,.65)}
@media(max-width:1199px){.social-layout{grid-template-columns:minmax(0,1fr) 260px}.social-left{display:none}}@media(max-width:899px){.social-layout{grid-template-columns:1fr}.social-right{position:static;grid-row:1}.social-right h2,.social-right p,.social-right .text-button{display:none}.social-post,.social-composer{padding:16px;border-radius:14px;margin-bottom:12px}.social-copy{font-size:15px}.social-tabs{top:64px}.social-compose-options select{max-width:170px}}
#view-square > .creation-page { display:none; }
#view-square > .content-wrap { width:min(calc(100% - 64px),1240px); } @media(max-width:767px){ #view-square > .content-wrap { width:calc(100% - 32px); } }
/* Standalone Moments-style publishing page. */
#community-root.is-compose { max-width:720px; padding-top:28px; }
.social-publish-page { padding:0 28px 28px; box-shadow:0 8px 24px rgba(47,48,64,.05); }
.social-publish-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 0; border-bottom:1px solid var(--line); }
.social-publish-header h1 { margin:0; font:600 20px 'Noto Serif SC',serif; }
.social-publish-header .primary-button { background:var(--peri); min-width:72px; }
.social-publish-page #social-text { min-height:180px; border:0; border-radius:0; padding:24px 0 8px; outline:none; background:transparent; line-height:1.8; resize:vertical; }
.social-word-count { display:block; text-align:right; color:var(--muted); margin-bottom:16px; }
.social-media-tools { display:flex; align-items:center; gap:12px; margin:16px 0 8px; }
.social-publish-media { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.social-preview-tile { position:relative; aspect-ratio:1; border-radius:12px; overflow:hidden; background:var(--lavender); }
.social-preview-tile img { width:100%; height:100%; object-fit:cover; }
.social-remove { position:absolute; right:6px; top:6px; border:0; border-radius:8px; padding:5px 8px; background:var(--white); color:var(--ink); }
.social-preview-video { grid-column:1/-1; min-width:0; }
.social-preview-video video,.social-post-video { display:block; width:100%; max-height:420px; border-radius:12px; background:var(--lavender); }
.social-preview-video p { overflow-wrap:anywhere; }
.social-publish-row { display:flex; justify-content:space-between; align-items:center; gap:20px; min-height:64px; border-top:1px solid var(--line); font-size:14px; }
.social-publish-row select { width:min(65%,350px); min-height:40px; border:1px solid var(--line); border-radius:10px; padding:8px; background:var(--white); font:inherit; }
.social-topic-box { padding:20px 0; border-top:1px solid var(--line); }
.social-topic-box h2 { margin:0 0 12px; font-size:14px; font-weight:500; }
.social-topic-input { display:flex; gap:12px; }
.social-topic-input input { min-width:0; flex:1; }
.social-topic-chip { border:1px solid var(--line); border-radius:999px; background:var(--ivory); padding:6px 12px; color:var(--muted); font-size:13px; }
.social-selected-topics,.social-topic-suggestions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.social-selected-topics .social-topic-chip { color:var(--peri); background:var(--lavender); }
.social-publish-entry { width:100%; margin-bottom:16px; background:var(--peri); }
@media(max-width:767px){#community-root.is-compose { padding-top:16px; }.social-publish-page{padding:0 16px 20px;}.social-publish-header{padding:16px 0;}.social-publish-header h1{font-size:18px}.social-publish-page #social-text{min-height:160px}.social-publish-media{gap:8px}}
/* Public profile editing follows the existing homepage palette. */
#community-root.is-profile-edit { max-width:760px; }
.public-profile-editor { margin:0 auto; }
.public-profile-editor-header { display:flex; align-items:center; gap:24px; margin-bottom:20px; }
.public-profile-editor-header h1 { margin:0; font:600 24px 'Noto Serif SC',serif; }
.public-profile-section { padding:24px; margin-bottom:20px; border:1px solid var(--line); border-radius:16px; background:var(--white); }
.public-profile-section h2 { margin:0 0 20px; font:600 17px 'Noto Serif SC',serif; }
.public-profile-cover-preview { height:190px; overflow:hidden; border-radius:12px; background:linear-gradient(110deg,var(--lavender),var(--thistle)); }
.public-profile-cover-preview img,.public-profile-avatar-preview img,.social-profile-cover img,.social-avatar img,#open-profile img { display:block; width:100%; height:100%; object-fit:cover; }
.social-avatar,#open-profile { overflow:hidden; }
.public-profile-image-actions { display:flex; gap:16px; align-items:center; margin:12px 0 24px; }
.public-profile-avatar-row { display:flex; gap:20px; align-items:center; }
.public-profile-avatar-preview { width:88px; height:88px; flex-shrink:0; display:grid; place-items:center; border:1px solid var(--line); border-radius:50%; overflow:hidden; background:var(--lavender); color:var(--peri); font-size:28px; }
.public-profile-avatar-row .text-button { margin-left:16px; }
.public-profile-avatar-row p { margin:8px 0 0; }
.public-profile-field { display:grid; gap:10px; margin-bottom:24px; font-size:14px; }
.public-profile-field input,.public-profile-field select,.public-profile-field textarea { width:100%; min-width:0; min-height:44px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--white); font:inherit; }
.public-profile-field textarea { resize:vertical; line-height:1.7; }
.public-profile-field:last-of-type { margin-bottom:8px; }
.public-profile-count { display:block; text-align:right; color:var(--muted); }
.public-profile-editor-footer { display:flex; justify-content:flex-end; align-items:center; gap:12px; padding:16px 0 28px; }
.public-profile-editor-footer .creation-feedback { margin-right:auto; }
.public-profile-editor-footer .primary-button { background:var(--peri); }
.public-profile-editor :focus-visible { outline:2px solid var(--peri); outline-offset:3px; }
@media(max-width:767px){.public-profile-editor-header{gap:16px}.public-profile-editor-header h1{font-size:20px}.public-profile-section{padding:16px;border-radius:14px}.public-profile-cover-preview{height:140px}.public-profile-avatar-row{gap:16px}.public-profile-avatar-preview{width:72px;height:72px}.public-profile-editor-footer{position:sticky;bottom:72px;background:var(--ivory);padding:12px 0;flex-wrap:wrap}.public-profile-editor-footer .creation-feedback{flex-basis:100%;margin:0}}
/* Script detail: same palette and controls as home and library. */
#catalog-detail{width:min(calc(100% - 64px),1240px);padding-top:24px}.script-detail{min-width:0}.script-detail-hero{display:grid;grid-template-columns:360px minmax(0,1fr);gap:28px;margin:20px 0 28px;align-items:start}.script-detail-cover{aspect-ratio:16/10;border-radius:16px;box-shadow:var(--shadow)}.script-detail-cover b{font-size:64px}.script-detail-info h1{margin:0 0 12px;font:600 30px/1.4 'Noto Serif SC',serif;overflow-wrap:anywhere}.script-detail-tags{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}.script-detail-tags .tag{font-size:12px}.script-detail-summary{font-size:15px;line-height:1.75;margin:0 0 14px;color:var(--muted)}.script-detail-author,.script-detail-player-count{font-size:13px;margin:6px 0;color:var(--muted)}.script-detail-interactions{display:flex;gap:20px;align-items:center;flex-wrap:wrap;margin-top:16px;padding-top:12px;border-top:1px solid var(--line)}.script-detail-interactions .story-engagement{margin:0;padding:0;border:0;gap:18px}.script-detail-interactions .story-engagement-item{font-size:13px;min-height:40px}.script-detail-interactions .text-button{font-size:13px}.script-detail-play-actions{display:flex;gap:12px;align-items:center;margin-top:16px}.script-detail-play-actions .primary-button{background:var(--peri);min-width:180px;font-size:15px}.script-detail-columns{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:24px;align-items:start}.script-detail-main,.script-detail-side{min-width:0}.script-detail-section{margin-bottom:24px;padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--white)}.script-detail-section>h2{margin:0 0 16px;font:600 20px 'Noto Serif SC',serif}.script-detail-description{margin:0;font-size:16px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}.script-author-mark{width:48px;height:48px;display:grid;place-items:center;border-radius:50%;background:var(--lavender);font-size:22px;color:var(--peri)}.script-detail-side>.script-detail-section{padding:20px}.script-comment-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px}.script-comment-toolbar select{min-height:36px;border:1px solid var(--line);border-radius:10px;background:var(--white);padding:6px 12px}.script-comment-form{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;margin:16px 0}.script-comment-form textarea{width:100%;padding:12px;border:1px solid var(--line);border-radius:12px;font:inherit;font-size:16px;line-height:1.7;resize:vertical;background:var(--white)}.script-comment-form .primary-button{background:var(--peri)}.script-comment{padding:20px 0;border-top:1px solid var(--line)}.script-comment-heading{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.script-comment-heading time{margin-left:auto;font-size:12px;color:var(--muted)}.script-comment>p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:15px;line-height:1.8}.script-comment-actions{display:flex;gap:18px;flex-wrap:wrap}.script-comment-reply-note{flex-basis:100%;display:flex;align-items:center;gap:12px}.script-recommend-list{display:grid;gap:14px}.script-recommend-card{box-shadow:none;border-radius:12px}.script-recommend-card .story-cover{height:100px;aspect-ratio:auto}.script-recommend-card .story-cover b{font-size:32px}.script-recommend-card .story-card-body{padding:12px}.script-recommend-card .story-card-body h2{font-size:15px;margin:6px 0 8px}.script-recommend-card .story-card-body>p{display:none}.script-recommend-card .home-story-tags{margin-bottom:10px}.script-recommend-card .tag{font-size:11px}.script-recommend-reason{color:var(--muted);font-size:11px}.script-detail :focus-visible{outline:2px solid var(--peri);outline-offset:3px}#script-comments{scroll-margin-top:90px}
@media(max-width:1000px){.script-detail-hero{grid-template-columns:300px minmax(0,1fr)}.script-detail-columns{grid-template-columns:minmax(0,1fr) 280px}.script-detail-info h1{font-size:26px}}
@media(max-width:767px){#catalog-detail{width:calc(100% - 32px);padding-top:16px;padding-bottom:104px}.script-detail-hero{grid-template-columns:1fr;gap:16px;margin-top:16px}.script-detail-cover{width:100%;max-height:300px}.script-detail-info h1{font-size:24px}.script-detail-columns{grid-template-columns:1fr;gap:0}.script-detail-section{padding:16px;border-radius:14px;margin-bottom:20px}.script-detail-description{font-size:15px}.script-detail-interactions{gap:16px}.script-detail-side>.script-detail-section{padding:16px}.script-recommend-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.script-recommend-card{display:flex}.script-recommend-card .story-card-body{padding:10px}.script-recommend-card .story-card-body h2{font-size:14px}.script-recommend-card .story-engagement{gap:10px;flex-wrap:wrap}.script-detail-info{display:flex;flex-direction:column}.script-detail-interactions{order:1}.script-detail-play-actions .primary-button{flex:1;max-width:400px;min-width:0}.script-detail-play-actions .secondary-button{flex-shrink:0}.script-comment-heading time{flex-basis:100%;margin-left:54px}}
/* Account-backed creation workspace. */
#view-create-workspace>.content-wrap{width:min(calc(100% - 64px),1480px);max-width:none}.wb-enabled #creation-drafts{display:none}.wb-manager{margin-top:32px}.wb-home-tabs{display:flex;gap:16px;align-items:center;margin:16px 0}.wb-home-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.wb-home-card{padding:20px;border:1px solid var(--line);border-radius:16px;background:var(--white)}.wb-home-card h3{margin:0 0 10px;font-size:17px}.wb-home-card .surface-buttons{margin-top:16px}.wb-home-tabs .is-active{color:var(--peri)}
#view-create-workspace .workspace-grid{grid-template-columns:192px minmax(0,1fr) 300px;gap:20px;align-items:start}.wb-directory{position:sticky;top:96px;min-width:0}.wb-directory .workspace-navigation{display:flex;flex-direction:column;gap:8px;margin:0;padding:8px;border:1px solid var(--line);border-radius:16px;background:var(--white)}.wb-directory .workspace-navigation button{width:100%;min-height:44px;flex-shrink:0;text-align:left;padding:10px 12px;border-radius:10px;border:0;background:transparent;font-size:14px}.wb-directory .workspace-navigation button[aria-pressed=true]{background:var(--lavender);color:var(--peri)}.wb-directory .workspace-navigation button.is-complete::after{content:'✓';float:right;color:var(--success)}#view-create-workspace .workspace-editor{min-width:0;padding:24px}.wb-materials{margin-bottom:24px;padding-bottom:16px;border-bottom:1px solid var(--line)}.wb-materials>summary{cursor:pointer;color:var(--peri);font-weight:600}.wb-materials .creation-materials{margin:16px 0 0;padding:0;border:0;box-shadow:none;background:transparent}.wb-rail{min-width:0;padding:20px;position:sticky;top:96px}.wb-rail h2{font-size:18px;margin:0 0 12px}.wb-ai-scope{display:grid;gap:8px;margin:16px 0}.wb-ai-suggestion{margin-top:20px;padding-top:16px;border-top:1px solid var(--line)}.wb-ai-suggestion h3{font-size:15px}.wb-ai-suggestion pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:340px;overflow:auto;font-family:inherit;font-size:14px;line-height:1.7;background:var(--ivory);padding:12px;border-radius:10px}.wb-ai-suggestion button{margin-right:16px}.wb-completion{margin-top:20px;padding:12px;background:var(--ivory);border-radius:10px;color:var(--muted);font-size:13px}.wb-top-actions{margin-left:auto;display:flex;gap:10px;align-items:center;flex-wrap:wrap}.wb-top-actions .primary-button{background:var(--peri)}#view-create-workspace .creation-heading{flex-wrap:wrap;gap:16px}#view-create-workspace .creation-actions{justify-content:flex-end;gap:12px;flex-wrap:wrap}.wb-publish-page{max-width:1160px}.wb-publish-heading{display:flex;align-items:center;gap:24px;margin-bottom:24px}.wb-publish-heading h1{margin:0;font:600 26px 'Noto Serif SC',serif}.wb-publish-form{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:24px;align-items:start}.wb-public-preview{position:sticky;top:96px}.wb-public-preview img{width:100%;aspect-ratio:16/10;object-fit:cover;border-radius:12px}.wb-public-preview p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7}.wb-publish-form>.creation-card{min-width:0;padding:24px}.wb-publish-form .primary-button{background:var(--peri);margin-left:12px}.workbench-cover-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.story-cover.has-cover-image>b,.story-cover.has-cover-image>.orbit{display:none}.story-cover.has-cover-image::before,.story-cover.has-cover-image::after{display:none}.story-cover.has-cover-image>.cover-code{z-index:1;background:rgba(47,48,64,.55);padding:3px 6px;border-radius:6px;color:var(--white)}
@media(max-width:1200px){#view-create-workspace .workspace-grid{grid-template-columns:180px minmax(0,1fr)}.wb-rail{grid-column:2;position:static}.wb-home-list{grid-template-columns:repeat(2,minmax(0,1fr))}.wb-top-actions{margin-left:0}}
@media(max-width:767px){#view-create-workspace>.content-wrap{width:calc(100% - 32px)}#view-create-workspace .workspace-grid{grid-template-columns:1fr;gap:16px}.wb-directory{position:static}.wb-directory .workspace-navigation{flex-direction:row;overflow-x:auto;gap:6px;padding:6px}.wb-directory .workspace-navigation button{width:auto;white-space:nowrap}.wb-rail{grid-column:auto;padding:16px}#view-create-workspace .workspace-editor{padding:16px}.wb-top-actions{gap:8px}.wb-top-actions>.text-button{font-size:12px}.wb-publish-form{grid-template-columns:1fr}.wb-public-preview{position:static;grid-row:1}.wb-publish-form>.creation-card{padding:16px}.wb-home-list{grid-template-columns:1fr}.wb-publish-heading h1{font-size:22px}}
