/* SHOK CHAT · designer handoff, 2026-10-26.
   This final layer deliberately leaves the original screen/event contracts intact.
   Width decisions use the available main column, including when its sidebar is open. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f5f6f8;
  --border: #e6e8ee;
  --line: #e6e8ee;
  --text: #626977;
  --muted: #858c99;
  --accent: #2163e0;
  --accent-2: #1855c7;
  --user-bubble: #2163e0;
  --bot-bubble: #f5f6f8;
  --danger: #bb3848;
  --room-accent: #2163e0;
  --room-accent-ink: #ffffff;
  --product-accent-soft: #eef4ff;
  --shok-ink: #262d3b;
  --shok-blue-soft: #eef4ff;
  --shok-radius: 7px;
  --shok-sidebar: 256px;
  --shok-shadow: 0 10px 36px rgb(35 52 82 / 9%);
}
html, body { background: #fff; color: var(--text); font-family: "Noto Sans KR", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow: hidden; }
button, input, textarea, select { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; }
::selection { color: #173970; background: #dbe8ff; }
* { scrollbar-color: #cbd1dc transparent; scrollbar-width: thin; }
[hidden] { display: none !important; }
.app-shell { display: grid; grid-template-columns: var(--shok-sidebar) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); width: 100%; min-width: 0; background: #fff; transition: grid-template-columns 240ms cubic-bezier(.2,.7,.2,1); }
.app-shell.sidebar-collapsed { grid-template-columns: 0px minmax(0, 1fr); }
#main { grid-column: 2; grid-row: 2; display: flex; flex: 1 1 0; flex-direction: column; min-width: 0; min-height: 0; height: 100%; background: #fff; container: shok-main / inline-size; }
#main > .screen { flex: 1 1 auto; height: auto; min-height: 0; width: 100%; }
.screen, .creator-screen, .rooms-screen { background: #fff; }
#serverSaveBar, .server-save-bar, .home-model-badge, #navMyCharacters, #accountCharacterManage, #libraryCharacterCount, #allCharacterCount, #galleryScreen .fab { display: none !important; }
#serverSaveBar[data-state="error"] { display: flex !important; flex: 0 0 auto; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 24px; border: 0; border-bottom: 1px solid #efd5da; background: #fff6f7; color: #983344; font-size: 12px; line-height: 1.6; }
#serverSaveBar[data-state="error"] button { padding: 5px 10px; border: 1px solid #dfacb6; border-radius: 7px; background: #fff; color: #983344; font: inherit; cursor: pointer; }
#serverSaveBar #serverDevices { display: none; }

/* One continuous, in-flow panel. It never covers the page beneath it. */
#sidebar { grid-column: 1; grid-row: 2; position: relative; inset: auto; transform: none; display: flex; width: auto; min-width: 0; height: 100%; border: 0; background: #f9fafc; box-shadow: inset -1px 0 var(--border); z-index: 20; opacity: 1; transition: opacity 160ms ease, transform 240ms cubic-bezier(.2,.7,.2,1), visibility 240ms; }
#sidebar > * { min-width: var(--shok-sidebar); box-sizing: border-box; }
.app-shell.sidebar-collapsed #sidebar { display: flex; opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(-12px); }
#sidebar .sidebar-head { display: none; }
.brand, .brand-home, .sidebar-head .brand { color: var(--accent); font-size: 19px; font-weight: 800; letter-spacing: -.7px; white-space: nowrap; }
.brand .dot { display: none; }
.brand-home:hover { color: var(--accent-2); }
#sidebarToggle, [data-sidebar-open] { color: var(--accent); border-radius: 7px; }
#sidebarToggle:hover, [data-sidebar-open]:hover { background: var(--shok-blue-soft); }
#sidebar .sidebar-head .icon-btn { flex: 0 0 25px; width: 25px; height: 34px; }
#sidebar .sidebar-nav { padding: 12px; border-color: var(--border); gap: 3px; }
.side-item { color: var(--text); font-size: 13px; border-radius: 7px; }
.side-item:hover, .side-item.active { color: var(--accent); background: #edf3fd; box-shadow: none; }
.side-item .si-ic { color: var(--muted); }
.side-item.active .si-ic { color: var(--accent); }
.shok-sidebar-tabs { display: grid; flex: 0 0 auto; grid-template-columns: 1fr 1fr; padding: 0 16px; border-bottom: 1px solid var(--border); }
.shok-sidebar-tab { position: relative; min-height: 54px; padding: 14px 5px; border: 0; border-radius: 0; background: transparent; color: var(--muted); text-align: center; font-size: 14px; cursor: pointer; }
.shok-sidebar-tab[aria-selected="true"], .shok-sidebar-tab.active { color: var(--accent); font-weight: 700; }
.shok-sidebar-tab[aria-selected="true"]::after, .shok-sidebar-tab.active::after { content: ""; position: absolute; height: 2px; bottom: -1px; left: 12px; right: 12px; background: var(--accent); }
.sidebar-recent { min-height: 0; padding: 22px 16px; }
.shok-sidebar-panel { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow-y: auto; }
.shok-sidebar-library { min-height: 43px; margin: 20px 20px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.shok-sidebar-library:hover { color: var(--accent); border-color: #bfd2f4; }
.shok-party-list { padding: 12px; }
.shok-party-item { display: block; width: 100%; margin-block: 5px; padding: 12px 10px; border: 0; border-radius: 7px; background: #fff; color: var(--text); text-align: left; font-size: 13px; cursor: pointer; }
.shok-party-browse { display: block; margin: 0 20px 20px; min-height: 40px; padding: 10px; border: 1px solid var(--accent); border-radius: 7px; background: #fff; color: var(--accent); font-size: 12px; cursor: pointer; }
.sidebar-recent-title { margin: 0 8px 14px; font-size: 12px; font-weight: 500; color: var(--muted); }
.recent-list { gap: 7px; }
.recent-item { padding: 10px 8px; border-radius: 7px; color: var(--text); }
.recent-item:hover, .recent-item.active { background: #edf2f9; }
.recent-name { color: var(--shok-ink); font-weight: 500; }
.recent-av, .avatar, .chat-title .avatar { background: #e9eef7; }
.recent-empty, .shok-sidebar-empty { padding: 35px 10px 25px; color: var(--muted); font-size: 13px; line-height: 1.8; text-align: center; }
.shok-sidebar-empty strong, .shok-sidebar-empty b { display: block; margin-bottom: 9px; color: var(--text); font-size: 14px; font-weight: 500; }
.shok-sidebar-empty p { margin: 9px 0 18px; }
.shok-sidebar-empty button, .shok-sidebar-browse { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid var(--accent); border-radius: 7px; color: var(--accent); background: #fff; font-size: 12px; cursor: pointer; }
.shok-sidebar-footer { display: grid; flex-shrink: 0; grid-template-columns: repeat(3, 1fr); align-items: center; justify-content: center; gap: 14px 10px; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); margin-top: auto; background: #f9fafc; }
.shok-sidebar-footer button, .shok-sidebar-footer a { color: var(--muted); border: 0; padding: 6px 0; background: transparent; text-decoration: none; font-size: 12px; cursor: pointer; }
.shok-sidebar-footer button:hover, .shok-sidebar-footer a:hover { color: var(--accent); }
.payment-sidebar { margin: 14px 20px 0; padding: 10px 14px; border-color: var(--accent); border-radius: 7px; color: #fff; background: var(--accent); font-size: 13px; }
.payment-sidebar > span:last-child { color: #fff; }
.payment-sidebar:hover { color: #fff; background: var(--accent-2); }
.shok-sidebar-footer > .payment-sidebar { grid-column: 1 / -1; width: 100%; margin: 0; padding: 11px 13px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #fff; }
.shok-sidebar-footer > .payment-sidebar:hover { background: var(--accent-2); color: #fff; }
.shok-sidebar-footer > button:not(.payment-sidebar) { white-space: nowrap; }

/* Header with persistent navigation and the search field. */
.topbar { min-height: 66px; flex-shrink: 0; padding: 14px 28px; color: var(--text); background: #fff; border-color: var(--border); backdrop-filter: none; }
#galleryScreen .home-topbar, #appShell > .shok-global-header { grid-column: 1 / -1; grid-row: 1; display: flex; position: relative; align-items: center; justify-content: flex-start; gap: 20px; min-height: 80px; padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--border); z-index: 30; }
.shok-global-header > .brand { display: flex; order: 0; flex: 0 0 156px; font-size: 20px; }
.shok-global-header > [data-sidebar-open] { display: grid !important; order: 1; width: 24px; min-width: 24px; flex: 0 0 24px; margin-right: 20px; }
.shok-global-header > .shok-nav { order: 2; }
.shok-global-header > #librarySearchForm { order: 3; }
.shok-global-header > .home-actions { order: 4; }
#main > .screen .topbar > [data-sidebar-open], #main > .screen .topbar > .brand { display: none !important; }
.shok-nav { display: flex; align-items: center; flex: 0 0 auto; gap: 25px; }
.shok-nav button, .shok-nav a { padding: 10px 0; border: 0; background: transparent; color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.shok-nav button:hover, .shok-nav a:hover, .shok-nav [aria-current="page"], .shok-nav .active { color: var(--accent); }
#librarySearchForm { position: relative; flex: 1 1 260px; width: auto; min-width: 140px; max-width: 340px; height: 42px; padding: 0 6px 0 14px; margin-left: auto; border: 1px solid #e2e6ed; border-radius: 7px; background: #f7f8fa; }
#librarySearchForm:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(33 99 224 / 7%); }
#librarySearchInput { color: var(--text); font-size: 12px; }
#librarySearchInput::placeholder { color: #969da9; }
#librarySearchForm #homeSearchBtn { color: var(--muted); width: 32px; height: 32px; border-radius: 7px; }
#librarySearchForm #homeSearchBtn:hover { background: #eaf0fa; color: var(--accent); }
.home-actions, .shok-global-header .home-actions { flex: 0 0 auto; gap: 12px; margin-left: 0; }
.payment-entry, .shok-login, .shok-login-button { min-height: 38px; padding: 8px 13px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #fff; font-size: 12px; white-space: nowrap; }
.payment-entry:hover { background: var(--accent-2); color: #fff; }
.shok-login, .shok-login-button { border-color: transparent; padding-inline: 0; color: var(--text); background: transparent; cursor: pointer; }
.shok-login:hover, .shok-login-button:hover { color: var(--accent); }
.shok-login-action { min-height: 40px; min-width: 128px; padding: 8px 12px; color: var(--accent); background: #fff; border: 1px solid var(--accent); border-radius: 7px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.shok-login-action:hover { background: var(--shok-blue-soft); }
.shok-global-header.shok-guest #accountBtn { display: none; }
.account-trigger { width: 34px; height: 34px; border-color: var(--border); background: #fff; }
.account-trigger:hover, .top-action:hover { background: var(--panel-2); }
.install-pill { border-color: var(--border); color: var(--text); background: #fff; }
.home-popover { top: 72px; right: 28px; color: var(--text); background: #fff; border-color: var(--border); border-radius: 7px; box-shadow: var(--shok-shadow); backdrop-filter: none; }

/* A six-column library and a 196 / 680 / 196 feature at the desktop reference width. */
#galleryScreen .home-feed { width: 100%; max-width: 1184px; padding: 40px 32px 72px; margin: 0 auto; background: #fff; }
.library-intro, .library-shortcuts { display: none !important; }
.library-intro { margin-bottom: 24px; }
.library-intro h1 { font-size: 22px; color: var(--shok-ink); font-weight: 700; }
.library-shortcuts { margin-bottom: 24px; }
#galleryScreen .home-play-entry { border-radius: 7px; border-color: var(--border); background: #f8faff; box-shadow: none; }
#galleryScreen .home-play-entry h2 { color: var(--text); font-weight: 500; font-size: 14px; }
#galleryScreen .home-play-entry .room-btn { border-color: var(--accent); border-radius: 7px; color: var(--accent); background: #fff; }
#galleryScreen .home-play-entry .room-btn:hover { background: var(--shok-blue-soft); color: var(--accent); }
.continue-card { color: var(--text); background: #fff; border-color: var(--border); border-radius: 7px; }
.continue-card:hover { background: #f6f9ff; border-color: #c1d4f7; }
#continueSection .home-section-head h2 { color: var(--text); }
.text-action { color: var(--muted); }
.text-action:hover, .text-action[aria-pressed="true"] { color: var(--accent); }
.shok-feature-carousel { position: relative; display: grid; grid-template-columns: minmax(0, 196fr) minmax(0, 680fr) minmax(0, 196fr); align-items: center; gap: 24px; width: 100%; margin: 0 0 35px; }
.library-feature, .shok-feature-carousel #libraryFeature { min-width: 0; min-height: 0; height: auto; aspect-ratio: 17 / 10; margin: 0; border: 0; border-radius: 7px; background: #e4e9ee; box-shadow: none; overflow: hidden; }
.library-feature:not(.shok-feature-carousel .library-feature) { margin-bottom: 30px; }
/* Full-bleed artwork with title art over the scene, not a separate text column. */
.library-feature { --feature-ink: #121d2b; --feature-glow: #536477; }
.library-feature[data-art-theme="gravel"] { --feature-ink: #252320; --feature-glow: #8b6c4c; }
.library-feature[data-art-theme="neon"] { --feature-ink: #10272c; --feature-glow: #376960; }
.library-feature[data-art-theme="moon"] { --feature-ink: #0d2637; --feature-glow: #256456; }
.shok-feature-carousel #libraryFeature { background: radial-gradient(ellipse at 78% 44%, var(--feature-glow), var(--feature-ink) 78%); }
.library-feature::after { z-index: -1; background: linear-gradient(0deg, rgb(3 12 18 / 65%), transparent 55%); }
.library-feature-art { inset: 0; width: 100%; height: 100%; object-fit: cover; mask-image: none; object-position: 50% 8%; filter: none; backdrop-filter: none; opacity: 0; transform: none; transition: opacity 700ms ease-in-out; }
.library-feature-art.is-active { opacity: 1; }
.library-feature[data-motion] .library-feature-art.is-active { animation: shok-feature-drift 4.2s ease-out both; }
.library-feature-art.is-loading { visibility: hidden; }
.library-feature[data-motion="paused"] .library-feature-art.is-active { animation-play-state: paused; }
@keyframes shok-feature-drift { from { transform: scale(1); } to { transform: scale(1.012); } }
.library-feature .library-feature-copy { display: flex; flex-direction: column; justify-content: flex-end; align-self: stretch; width: 100%; min-width: 0; padding: 24px 62px 26px; color: #fff; text-shadow: 0 2px 12px rgb(0 0 0 / 55%); }
.library-feature-title-art { display: none; width: 40%; max-width: 220px; height: auto; object-fit: contain; filter: drop-shadow(0 2px 8px rgb(0 0 0 / 45%)); }
.library-feature h2.has-title-art > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.library-feature h2.has-title-art .library-feature-title-art { display: block; }
.library-feature-motion-controls { position: absolute; z-index: 4; right: 18px; bottom: 16px; display: flex; align-items: center; gap: 8px; color: #fff; }
.library-feature-motion-controls[hidden] { display: none; }
.library-feature-frame-count { font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .08em; text-shadow: 0 1px 5px #000; }
.library-feature-pause { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #ffffff66; border-radius: 50%; color: #fff; background: #10202b99; cursor: pointer; font-size: 13px; }
.library-feature-pause:hover { border-color: #fff; background: #10202be6; }
@media (prefers-reduced-motion: reduce) { .library-feature-art { transition: none; animation: none !important; transform: none; } }
@media (max-width: 600px) {
  .library-feature .library-feature-copy { width: 100%; padding: 16px 38px 18px; }
  .library-feature-art { width: 100%; }
  .library-feature-title-art { width: 42%; max-width: 160px; }
  .library-feature .library-feature-subtitle { font-size: 10px; line-height: 1.6; margin-top: 7px; }
  .library-feature-motion-controls { right: 10px; bottom: 9px; gap: 6px; }
  .library-feature-pause { width: 26px; height: 26px; }
  .library-feature-frame-count { font-size: 9px; }
}
.library-feature-category { display: none; color: rgb(255 255 255 / 76%); font-size: 11px; margin-bottom: 10px; letter-spacing: 0; font-weight: 400; }
.library-feature h2 { color: #fff; font-size: 28px; line-height: 1.3; letter-spacing: -.045em; font-weight: 700; }
.library-feature-byline { display: none; color: rgb(255 255 255 / 85%); margin-top: 10px; }
.library-feature-subtitle { color: rgb(255 255 255 / 84%); max-width: 48ch; margin: 10px 0 0; font-size: 13px; line-height: 1.65; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.library-feature-open { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 7px; color: transparent; background: transparent; font-size: 0; cursor: pointer; }
.library-feature-open:hover { color: transparent; border: 0; background: transparent; }
.library-feature:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; }
.library-feature-open:focus-visible { outline: 0; }
.shok-feature-side { position: relative; isolation: isolate; display: block; aspect-ratio: 196 / 320; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 7px; background: #e9edf2; color: #fff; cursor: pointer; }
.shok-feature-side img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(1.5px); transform: scale(1.03); }
.shok-feature-side::after { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / 48%); pointer-events: none; }
.shok-feature-side span, .shok-feature-side strong { display: none; }
.shok-feature-arrow { position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid #e4e7ed; border-radius: 50%; color: #626977; background: #fff; box-shadow: 0 2px 8px rgb(30 40 65 / 8%); cursor: pointer; transform: translateY(-50%); font-size: 25px; }
.shok-feature-arrow.is-prev { left: calc(18.283582% + 31.223881px); }
.shok-feature-arrow.is-next { right: calc(18.283582% + 31.223881px); }
.shok-feature-arrow:hover { color: var(--accent); border-color: #b9cff6; }
#galleryScreen .topic-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; padding: 0; overflow: visible; }
.topic-chip { min-height: 36px; padding: 7px 13px; color: var(--text); border-color: var(--border); border-radius: 999px; background: #fff; font-size: 13px; font-weight: 400; }
.topic-chip:hover { color: var(--accent); border-color: #b7cdf5; background: #f4f8ff; }
.topic-chip.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.home-section-head { margin-bottom: 15px; }
.home-section-head h2 { color: var(--text); font-size: 19px; line-height: 23px; font-weight: 700; }
#galleryScreen :is(#cards, #homeCuratedCards, .home-collection-cards) { display: grid; grid-auto-flow: row; grid-auto-columns: auto; grid-template-rows: none; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 30px 20px; padding: 0; overflow: visible; width: 100%; min-width: 0; }
#galleryScreen .card, .search-results .card { position: relative; min-width: 0; overflow: hidden; border: 0; background: transparent; border-radius: 7px; }
#galleryScreen .card .poster-bg, .search-results .card .poster-bg, .work-cover { border-radius: 7px; aspect-ratio: 3 / 4; background-color: #edf0f5; }
#galleryScreen .card .work-cover .poster-bg, .search-results .card .work-cover .poster-bg { border-radius: 0; }
#galleryScreen .card .work-cover-copy, .search-results .card .work-cover-copy { display: none; }
#galleryScreen .card .poster-info, .search-results .card .poster-info { position: absolute; z-index: 2; inset: auto 0 0; padding: 42px 10px 10px; background: linear-gradient(transparent, rgb(6 9 13 / 88%) 60%, rgb(6 9 13 / 96%)); }
#galleryScreen .card .cname, .search-results .card .cname { display: block; color: #fff; font-size: 15px; font-weight: 700; line-height: 22px; letter-spacing: -.7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 4px #0005; }
#galleryScreen .card .ctag, .search-results .card .ctag { display: block; min-height: 0; margin-top: 3px; color: #ebedf2; font-size: 12px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 4px #0005; }
#galleryScreen .card .character-tags { display: none; }
.character-tag { background: #f1f3f6; color: var(--muted); border-radius: 999px; }
.character-tag:hover { color: var(--accent); background: #eaf1fe; }
.card .view-images, #galleryScreen .card .view-images, .search-results .card .view-images, .card:focus-within .view-images { display: none !important; }
.card-badge, .card.has-images .card-badge { top: 8px; border-radius: 7px; font-size: 11px; }
.character-byline { color: var(--muted); }

/* Search suggestions remain anchored to the field; submitted results form a page. */
.shok-search-popover { position: absolute; top: calc(100% + 9px); left: 0; right: 0; z-index: 60; min-width: min(340px, calc(100vw - 32px)); max-height: min(480px, 65dvh); overflow-y: auto; padding: 21px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: #fff; box-shadow: var(--shok-shadow); }
.shok-search-popover h3, .shok-search-popover strong { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--shok-ink); }
.shok-search-popover p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.shok-search-popover .search-chips { gap: 7px; margin: 10px 0 22px; }
.shok-search-popover button { font-size: 12px; }
.shok-search-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.shok-search-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 22px; }
.shok-search-chips .search-chip { padding: 7px 10px; }
.shok-tag-recommend { display: block; width: 100%; min-height: 37px; margin-top: 8px; padding: 8px 10px; border: 1px solid #d8e3f7; border-radius: 7px; color: var(--accent); background: #f7faff; text-align: left; cursor: pointer; }
.shok-search-submit { min-height: 40px; padding: 8px 13px; border: 0; border-radius: 7px; color: #fff; background: var(--accent); font-size: 13px; cursor: pointer; }
.shok-search-popover .shok-search-section + .shok-search-section { margin-top: 22px; }
.search-overlay { color: var(--text); background: #fff; }
#homeSearchOverlay.shok-search-page { position: relative; inset: auto; z-index: 1; display: flex; flex: 1 1 auto; flex-direction: column; height: auto; min-height: 0; width: 100%; background: #fff; animation: none; }
.search-head { background: #fff; border-color: var(--border); min-height: 76px; }
.search-field { color: var(--text); border-color: var(--border); border-radius: 7px; background: #f7f8fa; }
.search-field input { color: var(--text); font-weight: 400; }
.search-field:focus-within { border-color: var(--accent); }
.search-body { max-width: 1184px; padding: 32px 32px 64px; }
.search-results { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 30px 20px; }
.search-section-title h2, .search-result-meta b { color: var(--shok-ink); }
.search-chip, .search-tag-facet, .tag-suggestion, .library-tag { color: var(--text); background: #f5f6f8; border: 1px solid var(--border); border-radius: 999px; }
.search-chip:hover, .search-tag-facet:hover, .tag-suggestion:hover, .library-tag:hover { color: var(--accent); background: var(--shok-blue-soft); border-color: #bed2f7; }
.selected-search-tag, .search-tag-facet[aria-pressed="true"] { color: var(--accent); background: var(--shok-blue-soft); border-color: #bed2f7; border-radius: 999px; }
.search-tag-input-label input { color: var(--text); background: #fff; border-color: var(--border); border-radius: 7px; }
.popular-keyword { color: var(--text); border-bottom-color: var(--border); }
.popular-keyword b { color: var(--accent); }
.shok-search-tabs, .shok-search-kinds { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin: 0 0 26px; }
.shok-search-tabs button, .shok-search-kinds button { min-height: 46px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 14px; cursor: pointer; }
.shok-search-tabs [aria-selected="true"], .shok-search-tabs .active, .shok-search-kinds [aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Story details use the same shell as discovery and the conversation. */
#characterDetailDialog.shok-detail-page { position: relative; inset: auto; flex: 1 1 auto; width: 100%; max-width: none; height: auto; min-height: 0; max-height: none; margin: 0; padding: 0; overflow-y: auto; overflow-x: hidden; border: 0; border-radius: 0; color: var(--text); background: #fff; box-shadow: none; }
#characterDetailDialog.shok-detail-page[open] { display: block; }
.shok-detail-page .library-dialog-head { min-height: 62px; padding: 14px 32px; max-width: 1184px; margin-inline: auto; border: 0; }
.shok-detail-page .library-dialog-head h2 { color: var(--muted); font-size: 13px; font-weight: 400; }
.shok-detail-heading { position: relative; width: 100%; max-width: 1184px; margin: 0 auto; padding: 20px 32px 27px; }
.shok-detail-back { display: inline-flex; align-items: center; justify-content: flex-start; width: auto; height: 24px; margin: 0 0 7px; padding: 0; color: var(--muted); font-size: 13px; }
.shok-detail-heading .shok-detail-title { margin: 0; color: var(--text); font-size: 32px; line-height: 44px; font-weight: 700; letter-spacing: -.7px; }
.shok-detail-heading .character-byline { font-size: 13px; line-height: 22px; margin: 0; }
.shok-detail-heading .shok-share { position: absolute; top: 45px; right: 32px; padding: 0; border: 0; }
.shok-detail-heading .shok-share-icon { width: 48px; height: 48px; padding: 13px; }
.shok-detail-heading .shok-detail-title, .shok-detail-heading .character-byline { padding-right: 70px; }
.shok-detail-page .library-detail-body { width: 100%; max-width: 1184px; margin: 0 auto; padding: 12px 32px 44px; overflow: visible; }
.shok-detail-layout { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(240px, 312px); gap: 24px; align-items: start; }
.shok-detail-art, .shok-detail-copy, .shok-detail-start { min-width: 0; }
.shok-detail-art .library-detail-cover, .shok-detail-art > img { display: block; width: 100%; height: auto; max-width: 100%; aspect-ratio: 8 / 11; object-fit: cover; border-radius: 7px; }
.shok-detail-art .work-cover { width: 100%; }
.shok-detail-art .work-cover-copy, .shok-detail-art .work-cover::after { display: none; }
.shok-detail-thumbnails { display: flex; gap: 8px; margin-top: 12px; }
.shok-detail-thumbnails img, .shok-detail-thumbnails button, .shok-detail-thumbnails > span { position: relative; display: grid; place-items: center; width: 52px; height: 60px; object-fit: cover; padding: 0; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; color: var(--muted); background: #f3f5f8; }
.shok-detail-thumbnails button img { width: 100%; height: 100%; border: 0; }
.shok-detail-thumb { cursor: pointer; }
.shok-detail-thumb.is-locked img { filter: blur(4px) brightness(.55); }
.shok-spoiler-lock { display: grid; place-items: center; position: absolute; inset: 0; color: #fff; pointer-events: none; }
.shok-previewing-scene .work-cover-copy, .shok-previewing-scene::after { display: none; }
.shok-detail-copy h1, .library-profile-copy h1 { color: var(--shok-ink); font-size: 29px; line-height: 1.4; letter-spacing: -.7px; margin: 0 0 14px; }
.shok-detail-copy h2 { color: #14171c; font-size: 26px; line-height: 1.4; margin: 0 0 20px; letter-spacing: -.6px; }
.library-tagline, .library-prose { color: var(--text); font-size: 13px; line-height: 1.9; }
.library-meta { color: var(--muted); }
.library-tags { gap: 6px; margin-top: 15px; }
.library-tag { padding: 5px 9px; font-size: 11px; }
.shok-detail-tag-recommend { min-height: 28px; padding: 5px 10px; border: 1px solid #cad9f3; border-radius: 999px; color: var(--accent); background: #fff; font-size: 11px; cursor: pointer; }
.shok-detail-tag-recommend:hover { background: var(--shok-blue-soft); }
.library-text-section { margin-top: 25px; }
.library-text-section h3, .library-text-section > label { color: var(--shok-ink); font-size: 16px; line-height: 1.5; margin-bottom: 12px; }
.library-scene-preview-wrap { background: #f8f9fb; border-radius: 7px; padding: 16px; }
.library-scene-preview-wrap .library-prose, .shok-detail-example { color: var(--muted); font-size: 13px; line-height: 1.9; }
.shok-scene-example .library-prose { color: #9299a6; font-size: 13px; line-height: 1.9; }
.library-guide { font-size: 12px; color: var(--muted); line-height: 1.8; }
.shok-detail-start { display: flex; flex-direction: column; gap: 18px; }
.shok-detail-start-card { padding: 20px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.shok-detail-start-card > h2 { color: var(--text); font-size: 20px; line-height: 30px; margin: 0 0 10px; }
.shok-detail-start-card > label { display: block; margin: 20px 0 9px; color: var(--muted); font-size: 12px; }
.shok-selected-scene { padding: 11px 12px; border: 1px solid var(--border); border-radius: 7px; background: #f8f9fb; color: var(--text); font-size: 13px; line-height: 1.6; }
.shok-detail-start-card .library-detail-actions { padding: 0; margin: 20px 0 0; border: 0; }
.shok-detail-start > section, .shok-detail-start > .library-detail-actions, .shok-detail-start > .shok-play-guide { padding: 20px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.shok-detail-start h2, .shok-detail-start h3 { margin: 0 0 12px; color: var(--shok-ink); font-size: 15px; }
.shok-detail-start p { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.shok-detail-start .library-detail-actions { display: flex; flex-direction: column; margin: 0; }
.shok-detail-start .library-button { width: 100%; min-height: 43px; }
.library-detail-tools { gap: 8px; padding-top: 20px; }
.library-button { color: var(--text); background: #fff; border: 1px solid #dfe4ec; border-radius: 7px; font-size: 12px; min-height: 38px; }
.library-button:hover { color: var(--accent); background: #f5f8ff; border-color: #b9cef5; }
.library-primary, .library-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.library-primary:hover { background: var(--accent-2); }
.shok-detail-start .library-button:not(.library-primary) { color: var(--accent); border-color: var(--accent); background: #fff; }
.shok-detail-start .library-detail-tools { padding-top: 0; }
.shok-detail-start .library-detail-tools .library-button { width: auto; min-height: 36px; color: var(--text); border-color: var(--border); font-weight: 400; }
.shok-share { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted); background: transparent; border: 0; font-size: 11px; }
.shok-share-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 10px; border: 1px solid #aeb5c1; border-radius: 50%; color: var(--text); }
.shok-share-icon svg { width: 18px; height: 18px; }

/* Conversation keeps the tested independent transcript/composer scrolling. */
#chatScreen { padding: 0; background: #fff; align-items: stretch; justify-content: flex-start; }
.chat-stage { width: 100%; max-width: none; min-height: 0; flex: 1; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
.chat-top { min-height: 68px; padding: 12px 32px; background: #fff; border-color: var(--border); }
.chat-name { color: var(--shok-ink); font-size: 16px; font-weight: 600; }
.chat-tag { color: var(--muted); }
.messages { padding: 28px max(24px, calc((100% - 940px) / 2)); background: #fff; gap: 21px; }
.message-stack { max-width: min(82%, 760px); }
.bubble { padding: 14px 18px; border-radius: 7px; font-size: 15px; line-height: 1.85; }
.row.bot .bubble { color: var(--text); background: #f5f6f8; border: 1px solid #edf0f4; }
.row.user .bubble { color: #fff; background: var(--accent); }
.row.bot .bubble.error { color: var(--danger); border-color: #ebc1c8; background: #fff8f9; }
.message-actions, .message-more-menu { color: var(--muted); background: #fff; border-color: var(--border); border-radius: 7px; box-shadow: none; }
.message-action { color: var(--muted); }
.message-action:hover, .message-more-menu button:hover { color: var(--accent); background: #f2f6fd; }
.composer { padding: 16px max(24px, calc((100% - 940px) / 2)) calc(18px + env(safe-area-inset-bottom)); background: #fff; border-color: var(--border); }
#input { min-height: 56px; color: var(--text); background: #f8f9fb; border: 1px solid #dfe4ec; border-radius: 7px; font-size: 15px; }
#input:focus { border-color: var(--accent); background: #fff; }
#input::placeholder { color: #969da9; }
.tool-btn { border-radius: 7px; border-color: var(--border); color: var(--text); background: #fff; font-size: 12px; padding: 8px 12px; }
.tool-btn svg { color: var(--muted); }
.tool-btn.active, .tool-btn.active svg { color: #fff; background: var(--accent); }
#sendBtn { width: 42px; height: 42px; color: #fff; background: var(--accent); border-radius: 7px; }
.suggested-replies { background: #fff; border-color: var(--border); padding-inline: max(24px, calc((100% - 940px) / 2)); }
.suggested-replies button { color: var(--accent); background: #fff; border-color: #c7d8f7; border-radius: 7px; }
.solo-invite-btn, .solo-invite-btn:hover { color: var(--accent); background: #fff; border: 1px solid var(--accent); border-radius: 7px; }
.scenario-switcher, .scenario-picker, .scenario-card { background: #fff; border-color: var(--border); border-radius: 7px; }
.scenario-current, .scenario-arrow { color: var(--text); background: transparent; }

/* Shared play uses the same blue hierarchy. */
.room-topbar, .room-details, .room-play, .room-play-status { color: var(--text); background: #fff; border-color: var(--border); }
.rooms-hub { max-width: 1120px; width: 100%; margin: 0 auto; padding: 36px 32px 64px; }
.room-hub-intro h1 { color: var(--shok-ink); font-size: 29px; }
.room-entry-grid { gap: 20px; margin-top: 28px; }
.room-entry-card, .room-entry-card:nth-child(2) { min-height: 126px; padding: 24px; border: 1px solid var(--accent); border-radius: 7px; background: #fff; color: var(--accent); }
.room-entry-card:first-child { color: #fff; background: var(--accent); }
.room-entry-card:hover { border-color: var(--accent); background: #f4f8ff; }
.room-entry-card:first-child:hover { background: var(--accent-2); }
.room-entry-icon { color: inherit; background: transparent; border: 0; }
.room-entry-card strong { font-size: 17px; color: inherit; }
.room-entry-arrow { color: inherit; }
.room-entry-card > span:not(.room-entry-icon):not(.room-entry-arrow) { color: inherit; opacity: .8; font-size: 12px; }
.room-list-item, .room-list-item:hover { color: var(--text); background: #fff; border-color: var(--border); border-radius: 7px; }
.room-list-item:hover { background: #f8faff; border-color: #c4d5f4; }
.room-empty { background: #fafbfd; border-color: var(--border); border-radius: 7px; }
.room-status-tag { background: var(--shok-blue-soft); color: var(--accent); border-radius: 999px; }
.room-member-avatar { color: var(--text); background: #eef2f8; border-color: var(--border); }
.room-member.is-current .room-member-avatar { border-color: var(--accent); box-shadow: 0 0 0 2px #2163e015; }
.room-invite-code { background: #f7f9fc; border-color: var(--border); border-radius: 7px; }
.room-invite-code code { color: var(--accent); }
.room-link, .room-link:hover { color: var(--accent); }
.room-message-content { color: var(--text); }
.room-message-head strong, .room-message.is-mine .room-message-head strong { color: var(--shok-ink); }
.room-message.is-model { border-color: #b8cef6; }
.room-message.is-model .room-message-head strong { color: var(--accent); }
.room-message.is-system .room-message-content, .room-generating { color: var(--muted); }
.room-ai-notice { color: var(--text); background: #f3f6fb; }
.room-composer { color: var(--text); background: #f8f9fb; border-color: #dfe4ec; border-radius: 7px; }
.room-composer:focus-within { border-color: var(--accent); }
.room-btn { color: var(--text); background: #fff; border-color: #dce2eb; border-radius: 7px; }
.room-btn:hover { color: var(--accent); background: #f4f8ff; border-color: #bbcff3; }
.room-btn-primary, .room-btn-primary:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.room-btn-primary:hover { background: var(--accent-2); }
.room-dialog-tabs button[aria-pressed="true"] { color: var(--accent); }
.room-capacity-options label > span, .room-mode-options label > span { color: var(--text); background: #fff; border-color: var(--border); }
.room-capacity-options input:checked + span, .room-mode-options input:checked + span { color: var(--accent); background: var(--shok-blue-soft); border-color: var(--accent); }
.room-confirm-dialog p { color: var(--text); }
.room-feedback { color: var(--danger); background: #fff7f8; border-color: #ebc5cc; }

/* Six production steps and editing controls. */
.creator-steps { top: 0; background: #fff; border-color: var(--border); backdrop-filter: none; }
.creator-step, .creator-step.done { color: var(--accent); font-size: 13px; }
.creator-step b, .creator-step.done b { width: 32px; height: 32px; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); background: #fff; }
.creator-step.active { color: var(--accent); font-weight: 700; }
.creator-step.active b { color: #fff; background: var(--accent); border-color: var(--accent); }
.creator-step:not(:last-child)::after { background: #dce6f8; }
.creator-layout { width: 100%; max-width: 1184px; padding: 34px 32px 60px; gap: 40px; }
.creator-page-head h1 { color: var(--shok-ink); font-size: 27px; }
.creator-page-head.with-action > button { flex-shrink: 0; white-space: nowrap; }
.creator-page-head code { background: #f1f5fc; color: var(--accent); }
.field input, .field textarea, .field select, .panel-input, #chatPanelBox .panel-input, .room-field input, .room-field select, .room-field textarea, .library-select, .modal-box input, .modal-box textarea { color: var(--text); background: #fff; border: 1px solid #dce2eb; border-radius: 7px; }
.field input:focus, .field textarea:focus, .field select:focus, .room-field input:focus, .room-field select:focus, .room-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #2163e00b; }
.field > span, .room-field, .room-fieldset legend { color: var(--text); }
.field em { color: var(--muted); }
.tag-editor { color: var(--text); background: #fff; border-color: #dce2eb; border-radius: 7px; }
.editable-tag { background: #eef3fd; border-color: #d3e0f8; color: var(--accent); border-radius: 999px; }
.editable-tag button { color: var(--accent); }
.tag-editor-entry button { color: var(--accent); background: #fff; border-color: #c5d6f5; border-radius: 7px; }
.tag-error { color: var(--danger); }
.segmented input:checked + span { color: var(--accent); background: var(--shok-blue-soft); border-color: var(--accent); }
.creator-check, .creator-empty, .asset-guide, .creator-image-settings, .editor-card, .persona-item, .preview-summary div { background: #fafbfd; border-color: var(--border); border-radius: 7px; }
.asset-item, .variable-edit, .scenario-edit, .lore-edit, .asset-item > img { border-radius: 7px; }
.scenario-state-block { border-color: var(--border); border-radius: 7px; background: #f7f9fc; }
.asset-guide code, .state-guide b { color: var(--accent); }
.editor-card-head b { color: var(--accent); background: #edf3fe; }
.preview-card { border-radius: 7px; }
.preview-art { background-color: #eef1f7; background-image: none; }
.preview-adult { background: var(--accent); }
.preview-checks span.ok { color: var(--accent); border-color: #bed0f2; background: #f4f8ff; }
.persona-item.selected { background: var(--shok-blue-soft); border-color: var(--accent); }
.creator-foot .btn { border-radius: 7px; }

/* Dialogs, account, payments and the detailed settings retain functionality. */
.btn, .panel-btn, .btn.compact { border-radius: 7px; }
.btn:not(.ghost):not(.danger), .panel-btn:not(.ghost):not(.danger) { color: #fff; background: var(--accent); }
.btn.ghost, .panel-btn.ghost, #chatPanelBox .panel-btn.ghost { color: var(--text); background: #fff; border: 1px solid #dce2eb; }
.btn.ghost:hover, .panel-btn.ghost:hover, #chatPanelBox .panel-btn.ghost:hover { color: var(--accent); background: #f6f9ff; border-color: #bfd2f4; }
.btn.danger, .panel-btn.danger { color: #fff; background: var(--danger); }
.library-dialog, .room-dialog, .payment-dialog, .age-dialog, .account-profile-dialog, .modal-box, .login-box, .panel, .panel-head, .viewer-overlay, .persona-mgr-header { color: var(--text); background: #fff; border-color: var(--border); border-radius: 7px; box-shadow: var(--shok-shadow); }
.panel, .panel-head { border-radius: 0; box-shadow: none; }
.library-dialog::backdrop, .room-dialog::backdrop, .payment-dialog::backdrop, .age-dialog::backdrop, .account-profile-dialog::backdrop { background: rgb(27 38 57 / 35%); backdrop-filter: blur(2px); }
.room-dialog-footer, .library-detail-actions { background: #fff; border-color: var(--border); }
.library-tab.active { color: var(--accent); background: var(--shok-blue-soft); }
.library-toast, .room-toast { color: var(--text); background: #fff; border-color: #d1d9e7; box-shadow: var(--shok-shadow); }
.library-close:hover { color: var(--accent); background: #f2f6fd; }
.account-popover, .notification-popover { color: var(--text); background: #fff; border-color: var(--border); }
.account-profile-row { background: #f8faff; border-color: var(--border); box-shadow: none; border-radius: 7px; }
.account-profile-row:hover, .account-menu-row:hover { background: #f1f5fc; }
.account-menu-icon { color: var(--accent); background: #eef4ff; }
.account-divider { background: var(--border); }
.account-setting-row select { color: var(--text); background: #f2f4f8; }
.account-credit-row strong { color: var(--accent); }
.account-status { color: var(--muted); }
.account-status .status-dot { background: var(--accent); box-shadow: none; }
.notification-item > span { color: var(--accent); background: #edf3fe; }
.popover-title { border-color: var(--border); }
#chatPanelBox .settings-tab[aria-selected="true"] { color: var(--accent); }
#chatPanelBox .settings-more { border-color: var(--border); border-radius: 7px; }
#chatPanelBox .settings-more:hover { color: var(--accent); background: #f5f8fe; border-color: #bed1f4; }
#chatPanelBox .settings-danger, .message-more-menu button.danger { color: var(--danger); }
.persona-detail-scope, .pi-badge { color: #fff; }
.payment-dialog, .age-dialog, .account-profile-dialog { border-radius: 7px; }
.payment-dialog h2, .account-profile-heading h2, .age-dialog h2, .room-dialog h2 { color: var(--shok-ink); }
.payment-product { border-color: #dce2eb; border-radius: 7px; }
.payment-product[aria-pressed="true"] { background: #f5f8ff; }
.payment-product[aria-pressed="true"] .payment-check { color: #fff; }
.payment-notice, .payment-allowance, .age-dialog p { color: var(--text); }
.payment-price { color: var(--shok-ink); }
.payment-continue, .age-primary { color: #fff; background: var(--accent); border-radius: 7px; }
.payment-continue:disabled, .age-primary:disabled { color: var(--muted); background: #e8ecf3; }
.payment-error, .account-profile-error { color: var(--danger); }
.age-mark { color: var(--accent); border-color: var(--accent); }
.age-dialog .age-status { color: var(--text); }
.age-account-row > span:last-child { color: var(--muted); }
.server-device-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 28px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: #fff; box-shadow: var(--shok-shadow); }
.server-device-dialog::backdrop { background: rgb(27 38 57 / 35%); backdrop-filter: blur(2px); }
.server-device-dialog h2 { margin: 0 0 18px; color: var(--shok-ink); font-size: 23px; }
.server-device-dialog p, .server-device-dialog label { color: var(--text); font-size: 13px; line-height: 1.8; }
.server-device-dialog input { padding: 12px; color: var(--text); background: #f8f9fb; border-color: #dce2eb; border-radius: 7px; font-size: 16px; }
.server-device-dialog button { min-height: 38px; padding: 9px 13px; color: var(--accent); background: #fff; border-color: var(--accent); border-radius: 7px; font-size: 12px; }
.server-device-dialog #serverDeviceCreate, .server-device-dialog #serverDeviceConnect { color: #fff; background: var(--accent); border-color: var(--accent); }
.server-device-dialog #serverDeviceClose { color: var(--text); border-color: var(--border); }
.server-device-dialog #serverDeviceCode { color: var(--accent); font-size: 15px; }
.server-device-dialog #serverDeviceError { color: var(--danger); }
.solo-dialog, .solo-image-dialog, .play-map-dialog, .world-map-svg, .world-map-empty-canvas, .world-map-button, .world-map-field input, .world-map-field textarea, .world-map-field select { border-radius: 7px; }
.solo-image-stage { border-radius: 7px; background: #f5f6f8; }
.solo-status { color: var(--text); background: #fff; border-color: #d1d9e7; border-radius: 7px; box-shadow: var(--shok-shadow); }
.play-map-action { border-radius: 7px; border-color: var(--accent); color: #fff; }
.bottom-nav { display: none !important; }

/* Available-column responsive rules also apply when the 256px sidebar is open. */
@container shok-main (max-width: 1160px) {
  #galleryScreen :is(#cards, #homeCuratedCards, .home-collection-cards), .search-results { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .shok-global-header { gap: 16px !important; padding-inline: 24px !important; }
  .shok-nav { gap: 18px; }
  .shok-global-header .brand { font-size: 17px; }
  #librarySearchForm { max-width: 290px; }
  .shok-detail-layout { grid-template-columns: minmax(190px, 260px) minmax(0, 1fr); gap: 26px; }
  .shok-detail-start { grid-column: 2; flex-direction: row; align-items: stretch; }
  .shok-detail-start > * { flex: 1; min-width: 0; }
}
@container shok-main (max-width: 960px) {
  #galleryScreen :is(#cards, #homeCuratedCards, .home-collection-cards), .search-results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #main > .shok-global-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 16px; padding-block: 14px; }
  .shok-global-header > .brand { flex-basis: auto; }
  .shok-global-header > [data-sidebar-open] { margin-right: 0; }
  .shok-global-header > [data-sidebar-open] { grid-column: 1; grid-row: 1; }
  .shok-global-header > .brand { grid-column: 2; grid-row: 1; }
  .shok-global-header .home-actions { grid-column: 3; grid-row: 1; }
  .shok-global-header .shok-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; gap: 30px; }
  .shok-global-header #librarySearchForm { grid-column: 1 / -1; grid-row: 3; width: 100%; max-width: none; margin: 0; }
  .app-shell:not(.sidebar-collapsed) .shok-global-header .shok-nav { grid-column: 1 / 3; grid-row: 1; justify-content: flex-start; gap: 20px; }
  .app-shell:not(.sidebar-collapsed) .shok-global-header #librarySearchForm { grid-row: 2; }
  .shok-feature-carousel { gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 4fr) minmax(0, 1fr); }
  .shok-feature-arrow.is-prev { left: calc(16.666667% + 21.333333px); }
  .shok-feature-arrow.is-next { right: calc(16.666667% + 21.333333px); }
  .shok-feature-side { aspect-ratio: 1 / 2.5; }
  .shok-feature-side span, .shok-feature-side strong { font-size: 11px; left: 8px; right: 8px; }
  .library-feature-copy { padding: 24px; }
  .library-feature h2 { font-size: 30px; }
  .library-feature-category, .library-feature-byline { display: none; }
  .creator-layout { grid-template-columns: minmax(0, 1fr) 230px; gap: 28px; }
}
@container shok-main (max-width: 720px) {
  #galleryScreen .home-feed { padding: 25px 20px 50px; }
  #galleryScreen :is(#cards, #homeCuratedCards, .home-collection-cards), .search-results { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 25px 14px; }
  .shok-feature-carousel { display: block; margin-bottom: 28px; }
  .shok-feature-arrow.is-prev { left: 8px; }
  .shok-feature-arrow.is-next { right: 8px; }
  .shok-feature-carousel .shok-feature-side { display: none; }
  .shok-feature-carousel #libraryFeature { aspect-ratio: 1.65; }
  .library-feature-copy { padding: 24px 44px; }
  .library-feature h2 { font-size: 28px; }
  .shok-feature-arrow { width: 30px; height: 30px; font-size: 21px; }
  .library-shortcuts { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
  #galleryScreen .home-play-entry { margin: 0; padding: 16px; }
  #galleryScreen .home-play-entry .room-btn { width: auto; margin-top: 0; }
  .home-section-head h2 { font-size: 19px; }
  .shok-detail-page .library-detail-body { padding: 12px 20px 35px; }
  .shok-detail-layout { grid-template-columns: minmax(140px, .75fr) minmax(0, 1fr); gap: 22px; }
  .shok-detail-copy h1 { font-size: 24px; }
  .shok-detail-start { grid-column: 1 / -1; }
  .shok-detail-thumbnails { gap: 5px; }
  .shok-detail-thumbnails img, .shok-detail-thumbnails button, .shok-detail-thumbnails > span { width: 42px; height: 49px; }
  .creator-layout { grid-template-columns: minmax(0, 1fr); padding: 28px 20px 44px; }
  .creator-preview { display: none; }
  .creator-steps { gap: 8px; padding: 17px 16px; overflow-x: auto; justify-content: flex-start; }
  .creator-step { min-width: 70px; font-size: 11px; }
  .creator-step:not(:last-child)::after { display: none; }
  .room-entry-card, .room-entry-card:nth-child(2) { padding: 20px; }
  .room-entry-card strong { font-size: 15px; }
  .search-body { padding: 25px 20px 48px; }
  .chat-top { padding-inline: 20px; }
}
@container shok-main (max-width: 520px) {
  #main > .shok-global-header { padding: 12px 16px; gap: 8px 10px; }
  .shok-global-header > .brand { font-size: 16px; }
  .shok-global-header .shok-nav { gap: 26px; }
  .shok-nav button, .shok-nav a { font-size: 12px; }
  .home-actions, .shok-global-header .home-actions { gap: 8px; }
  .payment-entry { padding: 7px 10px; font-size: 11px; min-height: 34px; }
  .shok-login, .shok-login-button { font-size: 11px; }
  .shok-login-action { min-width: 0; min-height: 34px; padding: 7px 9px; font-size: 11px; }
  .install-pill { display: none; }
  #librarySearchInput { font-size: 16px; }
  #galleryScreen .home-feed { padding: 20px 16px 40px; }
  #galleryScreen :is(#cards, #homeCuratedCards, .home-collection-cards), .search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .library-intro { margin-bottom: 18px; }
  .library-intro h1 { font-size: 20px; }
  .shok-feature-carousel #libraryFeature { aspect-ratio: 1.18; }
  .library-feature-copy { padding: 24px 37px; }
  .library-feature h2 { font-size: 26px; }
  .library-feature-subtitle { font-size: 12px; }
  .library-feature-open { margin-top: 14px; }
  .shok-feature-arrow { width: 27px; height: 27px; }
  #galleryScreen .home-play-entry { align-items: flex-start; flex-direction: column; gap: 12px; }
  #galleryScreen .home-play-entry .room-btn { width: 100%; }
  #galleryScreen .topic-strip { gap: 6px; margin-bottom: 24px; }
  .topic-chip { padding: 6px 11px; min-height: 31px; font-size: 11px; }
  .shok-detail-layout { grid-template-columns: 1fr; gap: 24px; }
  .shok-detail-art { width: min(260px, 100%); margin: 0 auto; }
  .shok-detail-start { grid-column: 1; flex-direction: column; }
  .shok-detail-copy h1 { font-size: 26px; }
  .shok-detail-page .library-detail-body { padding: 8px 20px 32px; }
  .shok-detail-page .library-dialog-head { padding-inline: 20px; }
  .search-body { padding-inline: 16px; }
  .search-head { padding-inline: 12px; gap: 6px; grid-template-columns: 30px minmax(0, 1fr); }
  .search-head .icon-btn { width: 30px; }
  .search-field input { font-size: 16px; }
  .chat-top { padding: 10px 14px; gap: 6px; }
  .chat-name { font-size: 14px; }
  .chat-title .avatar { width: 32px; height: 32px; }
  .chat-top > .icon-btn { flex-basis: 30px; width: 30px; }
  .solo-invite-btn { font-size: 11px; padding: 6px 8px; min-height: 32px; }
  .messages { padding: 21px 16px; gap: 18px; }
  .message-stack { max-width: 92%; }
  .bubble { font-size: 14px; padding: 12px 14px; }
  .composer { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  #input { font-size: 16px; }
  .suggested-replies { padding-inline: 16px; }
  .rooms-hub { padding: 26px 18px 48px; }
  .room-hub-intro h1 { font-size: 25px; }
  .room-entry-grid { grid-template-columns: 1fr; gap: 12px; }
  .room-entry-card, .room-entry-card:nth-child(2) { display: grid; min-height: 104px; padding: 20px; }
  .room-entry-arrow { position: static; }
  .creator-topbar { padding-inline: 14px; gap: 7px; }
  .creator-top-title strong { font-size: 13px; }
  .creator-top-actions { gap: 5px; }
  .creator-top-actions .btn { font-size: 11px; padding: 8px 10px; }
  .creator-layout { padding-inline: 18px; }
  .creator-page-head.with-action { flex-direction: column; align-items: flex-start; gap: 14px; }
  .creator-page-head.with-action > div { width: 100%; }
  .creator-page-head h1 { font-size: 24px; word-break: keep-all; overflow-wrap: anywhere; }
  .creator-page-head p { word-break: keep-all; overflow-wrap: anywhere; }
  .asset-guide { flex-direction: column; align-items: flex-start; gap: 9px; line-height: 1.7; }
  .asset-guide code { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .asset-guide span { min-width: 0; width: 100%; word-break: keep-all; overflow-wrap: anywhere; }
  .asset-toolbar, .asset-item, .form-grid.two, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .asset-toolbar > span { grid-column: 1; }
  .asset-title, .editor-card-head { flex-wrap: wrap; align-items: flex-start; }
  .creator-foot { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .creator-foot .btn { padding: 9px 11px; font-size: 12px; }
  .field input, .field textarea, .field select { font-size: 16px; }
}
@container shok-main (max-width: 320px) {
  #main > .shok-global-header { display: flex; flex-wrap: wrap; padding: 12px; }
  .shok-global-header .home-actions { width: 100%; justify-content: flex-end; }
  .shok-global-header .shok-nav { width: 100%; gap: 12px; justify-content: flex-start; flex-wrap: wrap; }
  .shok-global-header #librarySearchForm { width: 100%; min-width: 0; flex-basis: 100%; }
  #galleryScreen .home-feed { padding-inline: 12px; }
  #galleryScreen :is(#cards, #homeCuratedCards, .home-collection-cards), .search-results { grid-template-columns: 1fr; }
  .library-feature h2 { font-size: 20px; }
  .library-feature-copy { padding: 20px 30px; }
  .library-feature-subtitle { display: none; }
  .shok-feature-carousel #libraryFeature { aspect-ratio: .85; }
  .library-intro { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .library-intro h1, .home-section-head h2 { font-size: 17px; }
  .chat-top { flex-wrap: wrap; }
  .chat-title { min-width: 90px; }
  .creator-topbar { flex-wrap: wrap; }
  .creator-top-actions { width: 100%; justify-content: flex-end; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  :root { --shok-sidebar: clamp(160px, 44vw, 220px); }
  #sidebar .sidebar-head { min-height: 70px; padding: 15px 12px; gap: 7px; }
  #sidebar .sidebar-head .brand { font-size: 15px; letter-spacing: -.6px; }
  #sidebar .sidebar-head .icon-btn { flex-basis: 20px; width: 20px; }
  .shok-sidebar-tabs { padding-inline: 10px; }
  .shok-sidebar-tab { font-size: 12px; padding-inline: 0; }
  .sidebar-recent { padding-inline: 10px; }
  .payment-sidebar { margin-inline: 12px; padding: 10px; font-size: 12px; }
  .shok-sidebar-footer { gap: 14px 7px; padding-inline: 12px; }
  .shok-sidebar-footer > button:not(.payment-sidebar) { font-size: 11px; }
  .recent-av { width: 28px; height: 28px; }
  .recent-name { font-size: 12px; }
  .recent-time { display: none; }
  .recent-snippet { font-size: 11px; }
  .home-popover { right: 12px; max-width: calc(100% - 24px); }
  .main .screen, .main #chatScreen { padding-bottom: 0; }
}
/* Header responds to the viewport, independently of the moving main column. */
@media (max-width: 1160px) {
  #appShell > .shok-global-header { gap: 16px; }
  .shok-global-header .shok-nav { gap: 18px; }
  .shok-global-header #librarySearchForm { max-width: 290px; }
}
@media (max-width: 960px) {
  #appShell > .shok-global-header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px 16px; padding: 14px 20px; }
  .shok-global-header > .brand { grid-column: 1; grid-row: 1; font-size: 18px; }
  .shok-global-header > [data-sidebar-open] { grid-column: 2; grid-row: 1; margin-right: 0; }
  .shok-global-header .home-actions { grid-column: 3; grid-row: 1; }
  .shok-global-header .shok-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; gap: 30px; }
  .shok-global-header #librarySearchForm { grid-column: 1 / -1; grid-row: 3; width: 100%; max-width: none; margin: 0; }
}
@media (max-width: 520px) {
  #appShell > .shok-global-header { padding: 12px 16px; gap: 8px 10px; }
  .shok-global-header > .brand { font-size: 16px; }
  .shok-global-header .shok-nav { gap: 26px; }
  .shok-global-header .shok-nav button { font-size: 12px; }
  .shok-global-header .home-actions { gap: 8px; }
  .shok-global-header .payment-entry { padding: 7px 10px; font-size: 11px; min-height: 34px; }
  .shok-global-header .shok-login-action { min-width: 0; min-height: 34px; padding: 7px 9px; font-size: 11px; }
  .shok-global-header #librarySearchInput { font-size: 16px; }
}
@media (max-width: 350px) {
  .shok-global-header .home-actions .payment-entry { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Generated title artwork overlays selected illustrations only. */
.work-cover-title-art { position: absolute; z-index: 1; width: 90%; height: auto; max-height: 42%; object-fit: contain; left: 5%; bottom: 24%; pointer-events: none; filter: drop-shadow(0 2px 6px #0007); }
#homeCuratedSection { margin-top: 34px; }

/* Genre shelves share the responsive card grid; legacy rails must not create implicit columns. */
#homeCollections { min-width: 0; }
#homeCollections[hidden] { display: none; }
.home-collection { margin-top: 44px; }
.home-collection .home-section-head { align-items: center; }
.home-collection .home-section-head p { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 7px; }
.home-collection-more { flex-shrink: 0; border: 0; background: transparent; padding: 10px 0 10px 12px; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.home-collection-more:hover { color: var(--accent); }
#homeTopics { scroll-margin-top: 105px; }
@container shok-main (max-width: 480px) { .home-collection .home-section-head h2 { font-size: 17px; line-height: 1.4; } .home-collection .home-section-head p { max-width: 230px; } }
