@layer reset, base, layout, components, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; width: 100%; max-width: 100%; min-height: 100%; overflow: hidden; }
  button, input, textarea { font: inherit; color: inherit; }
  button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; border: 0; background: none; }
  button:disabled { cursor: default; }
  h1, h2, h3, h4, p { margin: 0; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { color-scheme: dark; --canvas: #111216; --surface: #191a20; --panel: #202127; --surface-raised: #2a2c34; --line: #33353e; --line-soft: #282a32; --text: #f3f3f6; --muted: #a3a6b4; --subtle: #8b8f9e; --blue: #1681ff; --danger: #fca5a5; --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
  body { background: var(--canvas); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
  a { color: inherit; text-decoration: none; }
  input, textarea { border: 0; outline: 0; background: transparent; }
  textarea { resize: none; }
  ::selection { color: white; background: #285fae; }
  :focus-visible { outline: 2px solid #75a7ff; outline-offset: 3px; }
  svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
  .svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .eyebrow { display: block; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.4; }
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-thumb { background: #39414e; border-radius: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
}
@layer layout {
  .app-shell { height: 100vh; height: 100dvh; min-height: 350px; display: flex; flex-direction: column; overflow: hidden; }
  .app-header { height: 58px; flex: 0 0 58px; display: flex; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--line-soft); gap: 24px; background: #16171b; }
  .workspace { flex: 1; min-width: 0; min-height: 0; width: 100%; display: grid; grid-template-columns: 320px minmax(0,1fr); }
  .conversations { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); background: var(--surface); }
  .chat-panel { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--canvas); }
  .notebook { position: fixed; z-index: 20; right: 0; top: 0; width: 360px; max-width: calc(100% - 24px); height: 100dvh; display: flex; min-width: 0; min-height: 0; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); transform: translateX(100%); visibility: hidden; pointer-events: none; transition: transform .22s ease, visibility .22s; box-shadow: -20px 0 80px #0006; }
  .notebook.open { transform: translateX(0); visibility: visible; pointer-events: auto; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 19; background: #06070b88; backdrop-filter: blur(5px); }
  .notebook-scroll { overflow-y: auto; padding: 0 24px 24px; min-height: 0; }
}
@layer components {
  .brand { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 650; letter-spacing: -.4px; }
  .brand-mark { width: 19px; height: 19px; position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
  .brand-mark span { background: #6ca2ff; border-radius: 3px; }
  .brand-mark span:nth-child(2) { opacity: .6; }.brand-mark span:nth-child(3) { opacity: .8; }
  .story-name { display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: 12px; min-width: 0; }
  .story-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .story-clock { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; white-space: nowrap; line-height: 1.3; }
  .story-clock-label { color: var(--subtle); font-size: 10px; letter-spacing: .02em; }
  .story-clock time { color: #d7d9e2; font-size: 12px; font-variant-numeric: tabular-nums; }
  .header-rule { width: 1px; height: 18px; background: var(--line); }
  .header-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
  .connection-pill { color: var(--muted); display: flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; }
  .status-dot { width: 5px; height: 5px; background: #8290a4; border-radius: 50%; }
  .connection-pill[data-state="ready"] .status-dot { background: #74b3a0; }
  .connection-pill[data-state="busy"] .status-dot { background: #75a7ff; animation: status-pulse 1.5s ease-in-out infinite; }
  .connection-pill[data-state="offline"] { color: var(--danger); }.connection-pill[data-state="offline"] .status-dot { background: var(--danger); }
  .text-button { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 550; padding: 8px 11px; border: 1px solid var(--line-soft); border-radius: 9px; color: var(--muted); }
  .text-button svg { width: 13px; height: 13px; }.text-button:hover { background: var(--surface-raised); color: var(--text); }
  .icon-button { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: var(--muted); position: relative; transition: color .15s, background-color .15s; }
  .icon-button:hover { background: var(--surface-raised); color: var(--text); }
  .mobile-back { display: none; }
  .notebook-toggle { margin-left: auto; width: auto; gap: 8px; padding: 0 12px; font-size: 12px; font-weight: 550; background: #23252c; border: 1px solid var(--line-soft); flex-shrink: 0; }
  .notebook-toggle svg { width: 17px; height: 17px; }
  .panel-heading { padding: 28px 24px 22px; display: flex; align-items: center; justify-content: space-between; }
  .panel-heading h1 { font-size: 27px; line-height: 1.2; letter-spacing: -.85px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
  .count-badge { font-size: 10px; font-weight: 600; line-height: 19px; min-width: 20px; padding: 0 5px; text-align: center; background: #29313e; color: #bbc7d8; border-radius: 10px; letter-spacing: 0; }
  .inbox-glyph { display: none; }
  .search-box { display: flex; align-items: center; gap: 9px; margin: 0 18px 24px; height: 42px; padding: 0 13px; border: 1px solid #ffffff04; border-radius: 12px; background: #25262e; color: var(--subtle); }
  .search-box:focus-within { border-color: #527bb8; }.search-box svg { width: 15px; height: 15px; }
  .search-box input { width: 100%; min-width: 0; font-size: 13px; }.search-box input::placeholder { color: #85909f; opacity: 1; }
  .search-box input::-webkit-search-cancel-button { display: none; }
  .search-clear { display: grid; place-items: center; width: 23px; height: 26px; padding: 0; flex-shrink: 0; color: var(--muted); border-radius: 5px; }.search-clear:hover { color: var(--text); background: #343b47; }.search-clear svg { width: 14px; height: 14px; }
  .search-result { display: block; width: 100%; text-align: left; padding: 12px 11px; margin-bottom: 3px; border-radius: 8px; }.search-result:hover,.search-conversation:hover { background: #252e3b; }
  .search-result-heading { display: flex; align-items: baseline; gap: 9px; margin-bottom: 3px; }.search-result-channel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }.search-result-date { flex-shrink: 0; font-size: 10px; color: var(--subtle); }
  .search-result-sender { display: block; color: #8fa6c8; font-size: 10px; margin-bottom: 5px; }.search-result-snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; font-size: 12px; line-height: 1.55; color: var(--muted); }.search-result-snippet mark { color: #dceaff; background: #354b70; border-radius: 2px; }
  .search-conversation-heading { margin-top: 19px; }.search-conversation { display: block; width: 100%; text-align: left; padding: 10px 11px; border-radius: 7px; font-size: 13px; }
  .thread-list { flex: 1; overflow-y: auto; min-height: 0; padding: 0 12px 20px; }
  .thread-section-label { padding: 0 12px 9px; color: var(--subtle); font-size: 11px; font-weight: 550; }
  .thread-section-label:not(:first-child) { padding-top: 24px; }
  .thread-item { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 13px 11px; border-radius: 14px; margin-bottom: 5px; border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
  .thread-item:hover { background: #23252d; }.thread-item.active { background: #223047; border-color: #35507888; }.thread-item.active .thread-name { color: #f7faff; }.thread-item.active .thread-time { color: #a7bedf; }
  .avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--avatar-fg,#c1cede); background: var(--avatar-bg,#303a49); box-shadow: inset 0 0 0 1px #ffffff09; }
  .avatar.group-avatar { background: #244c83; color: #b7d7ff; }
  .group-symbol { display: grid; grid-template-columns: 6px 6px; grid-template-rows: 6px 6px; gap: 3px; }.group-symbol i { border-radius: 2px; background: currentColor; }.group-symbol i:nth-child(2) { opacity: .55; }.group-symbol i:nth-child(3) { opacity: .75; }
  .thread-info { min-width: 0; flex: 1; }.thread-topline { display: flex; align-items: baseline; gap: 7px; margin-bottom: 4px; }
  .thread-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }.thread-time { font-size: 11px; color: var(--subtle); flex-shrink: 0; font-variant-numeric: tabular-nums; }
  .thread-bottomline { display: flex; align-items: center; gap: 8px; }.thread-preview { font-size: 12px; line-height: 1.6; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; flex: 1; min-width: 0; }.thread-item.active .thread-preview { color: #b0bfd4; }
  .unread-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 10px; color: white; background: var(--blue); font-size: 10px; line-height: 17px; text-align: center; font-weight: 600; }
  .threads-empty { padding: 25px 16px; color: var(--muted); font-size: 12px; }
  .inbox-footer { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); margin: 0 24px; padding: 20px 0; }
  .player-avatar { width: 36px; height: 36px; border-radius: 50%; background: #303b4d; color: #a9c6f2; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
  .inbox-footer strong { display: block; font-weight: 550; font-size: 13px; }.player-label { margin-left: auto; color: var(--subtle); font-size: 11px; }
  .chat-header { height: 80px; flex-shrink: 0; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; padding: 0 32px; background: #18191e; }
  .avatar-header { width: 44px; height: 44px; }.chat-heading { min-width: 0; }.chat-heading h2 { font-size: 16px; font-weight: 600; line-height: 1.3; }.chat-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.channel-label { display: none; }
  .inbox-placeholder { display: none; flex: 1; align-items: center; justify-content: center; flex-direction: column; gap: 16px; color: var(--muted); font-size: 16px; }
  .inbox-placeholder svg { width: 38px; height: 38px; color: #666f83; stroke-width: 1.2; }
  .app-shell.inbox-view .chat-panel > :not(.inbox-placeholder) { display: none; }
  .app-shell.inbox-view .inbox-placeholder { display: flex; }
  .message-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable both-edges; padding: 0 32px; }
  .message-stream { min-height: 100%; max-width: 960px; margin: 0 auto; padding: 28px 0 12px; }
  .date-divider { width: fit-content; margin: 8px auto 28px; padding: 5px 12px; border-radius: 99px; color: #b4b6c3; background: #202128; font-size: 11px; font-weight: 550; }
  .system-message { margin: 10px auto 22px; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.6; max-width: 360px; }.system-message .system-icon { display: none; }
  .system-message time { display: block; margin-top: 3px; font-size: 10px; color: var(--subtle); font-variant-numeric: tabular-nums; }
  .message-row { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 22px; }.message-row.follow-on { margin-top: -10px; }
  .message-row .avatar { width: 30px; height: 30px; font-size: 10px; margin-bottom: 22px; }.message-row.follow-on .avatar { visibility: hidden; }
  .message-content { max-width: min(82%,620px); min-width: 65px; }.message-author { font-size: 12px; font-weight: 550; margin: 0 0 6px 4px; color: #b9c9e0; }
  .message-bubble { border-radius: 19px 19px 19px 5px; background: #282a32; color: #f1f2f6; padding: 11px 16px; font-size: 15px; line-height: 1.55; box-shadow: 0 1px 2px #0001; overflow-wrap: anywhere; white-space: pre-wrap; }
  .message-meta { display: flex; align-items: center; gap: 6px; color: var(--subtle); font-size: 11px; margin: 5px 4px 0; min-height: 14px; }.message-meta time { font-variant-numeric: tabular-nums; }.message-meta svg { height: 11px; width: 11px; }
  .message-row.search-highlight .message-bubble { box-shadow: 0 0 0 3px #86b3ff; }.system-message.search-highlight { outline: 2px solid #86b3ff; outline-offset: 6px; border-radius: 5px; }.message-row[tabindex="-1"]:focus,.system-message[tabindex="-1"]:focus:not(.search-highlight) { outline: none; }
  .scheduled-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; color: var(--muted); }
  .message-row.own { justify-content: flex-end; margin-left: 25px; }.message-row.own .message-bubble { border-radius: 19px 19px 5px 19px; background: #137df0; color: white; }.message-row.own .message-meta { justify-content: flex-end; }.message-row.pending .message-bubble { opacity: .65; }.message-row.failed .message-bubble { outline: 1px solid var(--danger); }.message-row.new-arrival { animation: arrive .18s ease-out; }
  .new-messages-pill { position: absolute; right: 28px; bottom: 115px; display: flex; align-items: center; gap: 8px; color: white; background: var(--blue); border-radius: 99px; padding: 8px 12px; box-shadow: 0 4px 20px #0005; font-size: 11px; z-index: 2; }.new-messages-pill svg { width: 12px; height: 12px; transform: rotate(180deg); }
  .typing-row { flex-shrink: 0; height: 30px; width: calc(100% - 72px); max-width: 952px; margin: 0 auto; display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); visibility: hidden; }.typing-row.visible { visibility: visible; }.typing-dots { display: none; gap: 3px; padding: 5px 2px; }.typing-row[data-state="typing"] .typing-dots { display: flex; }.typing-dots i { width: 3px; height: 3px; border-radius: 50%; background: #9aa9bf; }.typing-row[data-state="typing"] .typing-dots i { animation: typing 1.1s ease-in-out infinite; }.typing-row[data-state="typing"] .typing-dots i:nth-child(2) { animation-delay: .14s; }.typing-row[data-state="typing"] .typing-dots i:nth-child(3) { animation-delay: .28s; }.waiting-status { position: absolute; inset: 0 60px 0 18px; display: flex; align-items: center; gap: 8px; color: #a5a7b1; font-size: 14px; pointer-events: none; min-width: 0; }
  .waiting-status > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.waiting-icon { width: 15px; height: 15px; flex-shrink: 0; color: #898c97; }
  .composer.is-waiting textarea:disabled { opacity: 0; }
  .composer-area { flex-shrink: 0; width: calc(100% - 64px); max-width: 960px; margin: 0 auto; padding: 0 0 18px; }.composer { position: relative; display: flex; align-items: flex-end; gap: 12px; padding: 8px 8px 8px 18px; background: #22242b; border: 1px solid #363943; border-radius: 27px; box-shadow: 0 2px 8px #0002; transition: background-color .15s, border-color .15s, box-shadow .15s; }.composer:focus-within { border-color: #4e83c5; box-shadow: 0 0 0 3px #1681ff12; }.composer.is-disabled { background: #2b2c31; border-color: #383a42; }.composer.is-disabled:focus-within { border-color: #383a42; box-shadow: none; }
  .composer textarea { flex: 1; min-width: 0; height: 38px; min-height: 38px; max-height: 142px; padding: 7px 0; font-size: 15px; line-height: 1.5; overflow-y: auto; }.composer textarea::placeholder { color: #8994a4; opacity: 1; }.composer textarea:disabled { color: #96999f; -webkit-text-fill-color: #96999f; opacity: 1; cursor: not-allowed; }.composer textarea:disabled::placeholder { color: #888b91; -webkit-text-fill-color: #888b91; }
  .send-button { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: white; flex-shrink: 0; display: grid; place-items: center; }.send-button svg { width: 18px; height: 18px; stroke-width: 2; }.send-button:hover:enabled { background: #528eff; }.send-button:disabled { color: #838996; background: #363b47; }.send-spinner { display: none; width: 14px; height: 14px; border: 1.5px solid #748093; border-top-color: white; border-radius: 50%; animation: spin .75s linear infinite; }.send-button.sending svg { display: none; }.send-button.sending .send-spinner { display: block; }
  .composer-caption { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-height: 24px; padding: 8px 10px 0; color: #8b8f9e; font-size: 10px; }.keyboard-hint { white-space: nowrap; }.keyboard-hint span { padding: 0 4px; }kbd { font-family: inherit; }.composer-error { padding: 7px 2px; color: var(--danger); font-size: 12px; }
  .composer.is-disabled + .composer-caption .keyboard-hint { visibility: hidden; }.composer-caption:has(#composer-hint:not([hidden])) { justify-content: flex-start; flex-wrap: wrap; }.composer-caption #composer-hint { color: var(--muted); }.composer-caption:has(#composer-hint:not([hidden])) .keyboard-hint,.composer-caption:has(#waiting-status:not([hidden])) .keyboard-hint { display: none; }
  .connection-banner { display: flex; align-items: flex-start; gap: 8px; padding: 11px 26px; background: #352c29; color: #dac2b8; border-bottom: 1px solid #4a3b36; font-size: 12px; }.connection-banner svg { width: 15px; height: 15px; margin-top: 1px; }.connection-banner button { margin-left: auto; text-decoration: underline; font-size: 11px; white-space: nowrap; padding: 0; }
  .opening-empty { min-height: 180px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 25px; color: var(--subtle); font-size: 13px; }
  .notebook-heading { height: 88px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }.notebook-heading h2 { font-size: 18px; font-weight: 600; }.notebook-heading-icon { display: none; }
  .objective-card { padding: 16px; margin-bottom: 24px; border: 1px solid var(--line-soft); border-radius: 14px; background: #202229; }.objective-card .eyebrow { font-size: 11px; color: var(--subtle); }.objective-card p { margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--muted); }
  .notebook-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: #25262e; }.notebook-tab { position: relative; display: flex; align-items: center; gap: 6px; flex: 1; justify-content: center; padding: 7px 0; border-radius: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }.notebook-tab.active { color: #e4ebfa; background: #3a3d48; box-shadow: 0 1px 3px #0003; }.notebook-tab > span:not(.notes-mark) { padding: 1px 5px; border-radius: 8px; background: #293343; color: #a0bce4; font-size: 9px; }.notes-mark { width: 4px; height: 4px; background: #78a9fc; border-radius: 50%; }
  .notebook-page { padding-top: 16px; }.clues-empty { padding: 36px 12px; text-align: center; color: var(--subtle); font-size: 13px; }.clue-card { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #21232a; margin-bottom: 10px; }.clue-card-header { display: flex; gap: 8px; align-items: flex-start; }.clue-number { color: #8098bb; font-size: 10px; padding-top: 2px; flex-shrink: 0; font-variant-numeric: tabular-nums; }.clue-card h4 { font-size: 12px; font-weight: 600; }.clue-card p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
  #personal-notes { width: 100%; min-height: 260px; font-size: 13px; line-height: 1.7; color: #d2d9e4; padding: 0; }#personal-notes::placeholder { color: var(--subtle); }.notes-footer { font-size: 10px; color: var(--subtle); margin: 10px 0 0; }.notes-rule { display: none; }.notification-dot { position: absolute; width: 5px; height: 5px; background: #75a7ff; top: 5px; right: 4px; border-radius: 50%; }
  .thread-skeleton { height: 66px; margin: 0 10px; display: flex; align-items: center; gap: 11px; opacity: .7; }.thread-skeleton > span { width: 40px; height: 40px; background: #2b313b; border-radius: 50%; }.thread-skeleton > div { flex: 1; }.thread-skeleton i { height: 8px; width: 65%; background: #303742; display: block; border-radius: 3px; margin: 9px 0; animation: status-pulse 1.5s ease-in-out infinite; }.thread-skeleton i + i { width: 88%; height: 6px; }
  .confirm-dialog { color: var(--text); border: 1px solid #3b4350; border-radius: 14px; padding: 27px; background: #1d222a; max-width: 390px; width: calc(100% - 34px); box-shadow: 0 24px 100px #0008; }.confirm-dialog::backdrop { background: #06090dc9; }.dialog-icon { display: none; }.confirm-dialog h2 { font-size: 20px; font-weight: 600; line-height: 1.3; margin-bottom: 12px; }.confirm-dialog p { color: var(--muted); font-size: 13px; line-height: 1.65; }.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }.primary-button, .secondary-button { padding: 9px 15px; font-size: 12px; border-radius: 7px; display: flex; justify-content: center; align-items: center; gap: 7px; font-weight: 600; }.primary-button { background: var(--blue); color: white; }.primary-button:hover { background: #528eff; }.primary-button:disabled { opacity: .6; }.primary-button svg { display: none; }.secondary-button { border: 1px solid #414b5b; color: #c3cddc; }.secondary-button:hover { background: #2b3443; }.dialog-error { margin-top: 16px; color: var(--danger) !important; }
  @keyframes typing { 0%,65%,100% { transform: translateY(0); opacity: .4; }30% { transform: translateY(-3px); opacity: 1; } }
  @keyframes spin { to { transform: rotate(360deg); } }@keyframes arrive { from { opacity: 0; transform: translateY(4px); }to { opacity: 1; transform: none; } }@keyframes status-pulse { 50% { opacity: .45; } }
}
@layer responsive {
  @media (min-width:1700px) { .workspace { grid-template-columns: 350px minmax(0,1fr); }.thread-preview { font-size: 13px; }.thread-name { font-size: 15px; } }
  @media (max-width:1000px) and (min-width:701px) { .workspace { grid-template-columns: 280px minmax(0,1fr); }.story-name { max-width: 180px; }.connection-pill { display: none; }.app-header { gap: 16px; }.chat-header { padding-inline: 22px; }.message-scroll { padding-inline: 20px; }.composer-area { width: calc(100% - 40px); }.typing-row { width: calc(100% - 48px); }.keyboard-hint { display: none; }.composer-caption { min-height: 0; padding-top: 0; } }
  @media (max-width:700px) {
    .app-header { height: 58px; flex-basis: 58px; padding: 0 18px; gap: 12px; }
    .brand > span:last-child,.story-name,.connection-pill,.new-game-button span { display: none; }
    .story-clock time { font-size: 12px; }.story-clock-label { font-size: 9px; }
    .header-actions { gap: 2px; }.new-game-button { padding: 10px; border: 0; }.new-game-button svg { width: 17px; height: 17px; }
    .workspace { display: block; position: relative; }.conversations,.chat-panel { position: absolute; inset: 0; width: 100%; }
    .conversations { border: 0; z-index: 2; }.chat-panel { z-index: 1; visibility: hidden; }.app-shell.mobile-chat .conversations { display: none; }.app-shell.mobile-chat .chat-panel { visibility: visible; z-index: 3; }
    .mobile-back { display: flex; margin-left: -10px; width: 29px; height: 40px; color: #75adff; }
    .panel-heading { padding: 26px 24px 22px; }.panel-heading h1 { font-size: 30px; }.search-box { margin-inline: 18px; height: 44px; }.search-box input { font-size: 16px; }
    .thread-list { padding-inline: 12px; }.thread-item { padding: 15px 12px; gap: 13px; }.thread-item .avatar { width: 48px; height: 48px; font-size: 13px; }.thread-name { font-size: 16px; }.thread-time { font-size: 11px; }.thread-preview { font-size: 13px; }
    .inbox-footer { padding-bottom: max(20px,env(safe-area-inset-bottom)); }
    .chat-header { height: 72px; padding: 0 17px; gap: 10px; }.chat-heading h2 { font-size: 16px; }.chat-heading p { font-size: 11px; }.avatar-header { width: 37px; height: 37px; font-size: 11px; }
    .notebook-toggle { width: 36px; padding: 0; background: transparent; border: 0; }.notebook-toggle > span:not(.notification-dot) { display: none; }.notebook-toggle svg { width: 20px; height: 20px; }
    .message-scroll { padding: 0 12px; scrollbar-gutter: auto; }.message-stream { padding-top: 22px; }.message-bubble { font-size: 15px; padding: 10px 14px; }.message-content { max-width: 85%; }.message-row { gap: 7px; margin-bottom: 19px; }.message-row .avatar { width: 24px; height: 24px; font-size: 8px; }.message-author { font-size: 11px; }.message-meta { font-size: 10px; }.message-row.own { margin-left: 14px; }
    .composer-area { width: calc(100% - 24px); padding: 0 0 max(12px,env(safe-area-inset-bottom)); }.composer { padding-left: 16px; }.composer textarea { font-size: 16px; line-height: 1.5; }.waiting-status { left: 16px; font-size: 15px; }
    .composer-caption { min-height: 0; padding: 0; }.keyboard-hint { display: none; }.composer-caption:has(#composer-hint:not([hidden])) { padding: 8px 5px 0; }
    .typing-row { width: calc(100% - 36px); height: 28px; font-size: 11px; }.connection-banner { padding-inline: 17px; }.new-messages-pill { bottom: 99px; right: 18px; }.notebook { width: 340px; }#personal-notes { font-size: 16px; }
  }
  @media (max-width:360px) { .message-row .avatar { display: none; }.message-content { max-width: 92%; }.app-header { padding-inline: 14px; }.dialog-actions { flex-direction: column-reverse; } }
  @media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
}

@layer components {
  .avatar { position: relative; overflow: hidden; }
  .avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
  .portrait-control { cursor: zoom-in; }
  .hint-button { color: #d9c398; gap: 7px; white-space: nowrap; }
  .hint-button svg { width: 17px; height: 17px; }
  .message-photo { margin: 0 0 5px; width: min(360px,100%); overflow: hidden; border: 1px solid #ffffff12; border-radius: 15px; background: #202127; }
  .photo-open { position: relative; display: block; width: 100%; padding: 0; cursor: zoom-in; }
  .photo-open img { display: block; width: 100%; height: auto; aspect-ratio: 3/2; object-fit: cover; }
  .photo-expand { position: absolute; right: 10px; bottom: 10px; border-radius: 20px; padding: 4px 9px; background: #101116b8; color: #fff; font-size: 10px; backdrop-filter: blur(8px); }
  .message-photo figcaption { padding: 9px 12px; color: #bbc0cc; font-size: 11px; }
  .hint-dialog, .photo-dialog { color: var(--text); background: #1d1f25; border: 1px solid #42434a; border-radius: 22px; padding: 28px; width: min(480px,calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; box-shadow: 0 35px 100px #0009; }
  .hint-dialog::backdrop, .photo-dialog::backdrop { background: #07090dbd; backdrop-filter: blur(9px); }
  .hint-heading, .photo-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .hint-heading .eyebrow { color: #d9c398; letter-spacing: .03em; }
  .hint-mark { width: 44px; height: 44px; margin: 12px 0 18px; display: grid; place-items: center; border-radius: 14px; background: #d9c39812; color: #d9c398; }
  .hint-mark svg { width: 24px; height: 24px; }
  .hint-dialog h2 { font-weight: 550; font-size: 24px; letter-spacing: -.6px; }
  #hint-text { font-size: 16px; line-height: 1.7; margin: 16px 0; color: #e0e2e9; }
  .hint-privacy { font-size: 12px; line-height: 1.6; color: var(--muted); padding-top: 16px; border-top: 1px solid var(--line); }
  .hint-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
  .hint-actions .primary-button { background: #d9c398; color: #222020; }
  .hint-actions .secondary-button { background: #ffffff09; }
  .photo-dialog { width: fit-content; max-width: min(1000px,calc(100vw - 24px)); padding: 18px; }
  .photo-heading { margin-bottom: 14px; }
  .photo-heading h2 { font-size: 15px; font-weight: 550; }
  #photo-image { display: block; max-width: 100%; max-height: calc(100dvh - 190px); width: auto; height: auto; border-radius: 10px; object-fit: contain; }
  #photo-caption { max-width: 70ch; margin-top: 13px; color: var(--muted); font-size: 12px; }
}
@layer responsive {
  @media (max-width:700px) {
    .header-actions { gap: 12px; }
    .hint-button { font-size: 12px; }
    .hint-button span { display: inline; }
    .message-photo { width: min(310px,100%); }
    .hint-dialog { padding: 22px; }
    .hint-dialog h2 { font-size: 22px; }
    #hint-text { font-size: 15px; }
    .hint-actions { flex-direction: column; }
    .hint-actions button { justify-content: center; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  }
}
@layer responsive {
  @media (max-width:360px) {
    .hint-button span { display: none; }
    .hint-button { width: 37px; height: 37px; padding: 10px; justify-content: center; }
    .header-actions { gap: 4px; }
  }
}

/* ---- Episode layer: evidence, clue toasts, title, cold open, ending ---------------
   One added colour: lamp amber, taken from the loft photos. It only ever means evidence. */
@layer base {
  :root { --lamp: #e2b878; --lamp-deep: #3a2d1c; --lamp-line: #7a5f3a; --night: #07080b; }
  body.overlay-open .app-shell { visibility: hidden; }
}
@layer components {
  /* Composer: attach clues */
  .composer { padding-left: 8px; }
  .waiting-status { left: 58px; }  /* 8px padding + 38px paperclip + 12px gap: where typed text starts */
  .attach-button { position: relative; width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; color: var(--muted); align-self: flex-end; }
  .attach-button:hover:not(:disabled), .attach-button[aria-expanded="true"] { color: var(--lamp); background: #2c2a26; }
  .attach-button:disabled { opacity: .35; }
  .attach-button svg { width: 19px; height: 19px; }
  .attach-count { position: absolute; top: 3px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--lamp); color: #231b10; font-size: 9px; font-weight: 700; line-height: 15px; }
  .evidence-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 8px; }
  .evidence-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 4px 4px 4px 10px; border: 1px solid var(--lamp-line); border-radius: 15px; background: var(--lamp-deep); color: #f3dcb6; font-size: 12px; }
  .evidence-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .evidence-chip-remove { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #d8bd92; }
  .evidence-chip-remove:hover { background: #ffffff14; }.evidence-chip-remove svg { width: 12px; height: 12px; }
  .evidence-picker { margin: 0 0 10px; max-height: min(46vh, 380px); overflow-y: auto; padding: 14px; border: 1px solid #3d3a33; border-radius: 16px; background: #1c1b19; box-shadow: 0 18px 60px #000a; }
  .evidence-picker-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
  .evidence-picker-note { color: var(--subtle); font-size: 11px; margin-top: 8px; }
  .evidence-option { display: flex; gap: 11px; align-items: flex-start; padding: 10px; border-radius: 10px; cursor: pointer; }
  .evidence-option:hover { background: #ffffff08; }
  .evidence-option input { margin: 3px 0 0; accent-color: var(--lamp); width: 16px; height: 16px; flex-shrink: 0; }
  .evidence-option-words { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .evidence-option-words strong { font-size: 13px; font-weight: 600; }
  .evidence-option-words span { color: var(--muted); font-size: 12px; line-height: 1.55; }
  .shared-evidence { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
  .shared-clue { display: flex; flex-direction: column; gap: 2px; padding: 9px 13px; border-radius: 13px; border-left: 3px solid var(--lamp); background: #24211c; }
  .message-row.own .shared-clue { background: #1b2a3f; }
  .shared-clue-title { color: var(--lamp); font-size: 12px; font-weight: 650; }
  .shared-clue-text { color: #d8d4cc; font-size: 13px; line-height: 1.5; }
  .clue-source { margin-top: 10px; padding: 0; color: #d4b07a; font-size: 11px; font-weight: 550; }
  .clue-source:hover { text-decoration: underline; text-underline-offset: 3px; }
  .sound-button { width: 34px; height: 34px; }
  .sound-button svg { width: 17px; height: 17px; }

  /* Clue toast */
  .toast-stack { position: fixed; z-index: 40; top: 70px; left: 50%; transform: translateX(-50%); width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
  .toast { pointer-events: auto; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 12px 12px 12px 16px; border: 1px solid var(--lamp-line); border-radius: 14px; background: #221e17f2; backdrop-filter: blur(10px); box-shadow: 0 14px 50px #000b; animation: toast-in .32s cubic-bezier(.2,.9,.3,1.2); transition: opacity .4s, transform .4s; }
  .toast.leaving { opacity: 0; transform: translateY(-8px); }
  .toast-kicker { color: #c9a773; font-size: 11px; font-weight: 600; }
  .toast-title { grid-row: 2; font-size: 14px; font-weight: 600; color: #f7e6c9; }
  .toast-action { grid-row: 1 / span 2; grid-column: 2; padding: 8px 11px; border-radius: 9px; color: #f3dcb6; font-size: 12px; font-weight: 600; background: #ffffff0d; }
  .toast-action:hover { background: #ffffff1a; }

  /* Case closed banner */
  .case-banner { flex-shrink: 0; width: calc(100% - 64px); max-width: 960px; margin: 6px auto 4px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 12px 12px 18px; border: 1px solid var(--lamp-line); border-radius: 16px; background: #1f1c17; }
  .case-banner p { color: #d9cfbf; font-size: 13px; }.case-banner strong { color: var(--lamp); }
  .case-banner .primary-button { background: var(--lamp); color: #231b10; flex-shrink: 0; }.case-banner .primary-button:hover { background: #efc98f; }

  /* Title screen */
  .title-screen, .lockscreen { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--night); color: var(--text); }
  .title-wallpaper, .lock-wallpaper { position: fixed; inset: 0; background: url('/assets/history/loft.webp') center / cover no-repeat; pointer-events: none; }
  .title-wallpaper { opacity: .22; filter: saturate(.7) blur(2px); mask-image: linear-gradient(180deg, #000 0%, #0008 45%, transparent 85%); }
  .title-body { position: relative; min-height: 100%; max-width: 640px; padding: max(48px, 16vh) 40px 48px; display: flex; flex-direction: column; justify-content: flex-end; }
  .title-kicker { color: #c2b39b; font-size: 13px; margin-bottom: 14px; }
  .title-heading { font-size: clamp(40px, 8vw, 76px); line-height: .98; letter-spacing: -.045em; font-weight: 700; text-wrap: balance; }
  .title-logline { margin-top: 22px; color: #dcdde3; font-size: clamp(17px, 2.2vw, 20px); line-height: 1.5; max-width: 30em; text-wrap: pretty; }
  .title-rules { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 9px; color: var(--muted); font-size: 14px; line-height: 1.55; }
  .title-rules li { padding-left: 18px; position: relative; }
  .title-rules li::before { content: ''; position: absolute; left: 0; top: .68em; width: 7px; height: 1px; background: #6d7180; }
  .title-notes { margin-top: 26px; color: var(--subtle); font-size: 12px; }
  .access-form { margin-top: 30px; display: grid; gap: 8px; max-width: 320px; }
  .access-form label { color: var(--muted); font-size: 13px; }
  .access-form input { padding: 13px 14px; font-size: 16px; border-radius: 12px; border: 1px solid #414b5b; background: #12161cd9; color: var(--text); letter-spacing: .02em; }
  .access-form input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
  .access-error { color: var(--danger); font-size: 13px; }
  .access-form + .title-actions { margin-top: 16px; }
  .title-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
  .title-actions .primary-button, .title-actions .secondary-button { padding: 13px 22px; font-size: 14px; border-radius: 12px; }

  /* Cold open: the lock screen at 00:12 */
  .lock-wallpaper { opacity: .5; filter: saturate(.8) brightness(.55); }
  .lock-wallpaper::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #07080b66 0%, #07080bcc 60%, #07080b 100%); }
  .lock-body { position: relative; max-width: 440px; margin: 0 auto; min-height: 100%; padding: max(40px, 9vh) 16px 36px; display: flex; flex-direction: column; align-items: stretch; }
  .lock-date { text-align: center; color: #e7e8ee; font-size: 17px; font-weight: 550; }
  .lock-time { text-align: center; font-size: clamp(76px, 22vw, 108px); line-height: 1; font-weight: 250; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: #f5f5f8; margin-top: 2px; }
  .lock-meridiem { font-size: .24em; font-weight: 450; letter-spacing: 0; margin-left: .18em; color: #d9dae2; }
  .lock-notifications { list-style: none; padding: 0; margin: 34px 0 0; display: flex; flex-direction: column; gap: 8px; }
  .lock-note { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 20px; background: #2a2b31d9; backdrop-filter: blur(18px); box-shadow: 0 6px 24px #0006; animation: note-in .45s cubic-bezier(.2,.9,.25,1.15); }
  .lock-avatar { width: 36px; height: 36px; font-size: 10px; }
  .lock-note-body { min-width: 0; flex: 1; }
  .lock-note-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
  .lock-note-top span { color: #a9abb6; font-size: 12px; }
  .lock-note p { color: #e6e7ec; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
  .lock-setup { margin-top: 30px; text-align: center; animation: fade-in .8s ease; }
  .lock-setup p { display: flex; flex-direction: column; gap: 4px; color: #d6d7de; font-size: 16px; line-height: 1.5; }
  .lock-setup .primary-button { margin: 22px auto 0; padding: 13px 26px; font-size: 14px; border-radius: 26px; }
  .lock-skip { margin: auto auto 0; padding: 10px 14px; color: #9ea1ad; font-size: 12px; }
  .lock-skip:hover { color: var(--text); }

  /* Ending debrief */
  .debrief { width: min(720px, 100%); max-width: 100%; height: min(100dvh, 920px); max-height: 100dvh; padding: 0; border: 1px solid #3a352d; border-radius: 18px; background: #15140f; color: var(--text); box-shadow: 0 30px 120px #000c; overflow-y: auto; }
  .debrief::backdrop { background: #050506e6; }
  .debrief-inner { position: relative; padding: 44px 48px 40px; }
  .debrief-close { position: absolute; top: 14px; right: 14px; }
  .debrief-kicker { color: var(--lamp); font-size: 13px; font-weight: 600; }
  .debrief-heading { font-size: clamp(28px, 5vw, 40px); line-height: 1.08; letter-spacing: -.03em; font-weight: 700; margin-top: 8px; text-wrap: balance; }
  .debrief-summary { margin-top: 16px; color: #cfc8bb; font-size: 15px; line-height: 1.6; max-width: 36em; }
  .debrief-timeline { list-style: none; padding: 0; margin: 34px 0 0; border-left: 1px solid #3a352d; }
  .debrief-event { position: relative; display: grid; grid-template-columns: 92px 1fr; gap: 4px 16px; padding: 0 0 20px 22px; }
  .debrief-event::before { content: ''; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #5a5448; }
  .debrief-event.found::before { background: var(--lamp); box-shadow: 0 0 0 4px #e2b8781f; }
  .debrief-event time { color: #9b927f; font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
  .debrief-event p { color: #ece6da; font-size: 15px; line-height: 1.55; }
  .debrief-event.missed p { color: #8c8577; }
  .debrief-missed { grid-column: 2; color: #7d766a; font-size: 12px; font-style: italic; }
  .debrief-subheading { margin-top: 18px; font-size: 16px; font-weight: 650; }
  .debrief-secrets { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; color: #c9c2b5; font-size: 14px; line-height: 1.6; }
  .debrief-secrets strong { color: #f0e9dc; font-weight: 600; margin-right: 4px; }
  .debrief-epilogue { margin-top: 34px; font-size: 18px; line-height: 1.5; color: #f3ead9; text-wrap: pretty; }
  .debrief-coda { margin-top: 30px; }
  .debrief-coda-label { color: #9b927f; font-size: 12px; margin-bottom: 12px; }
  .coda-row { display: flex; align-items: flex-end; gap: 10px; }
  .coda-row .message-meta { margin: 6px 0 0 4px; color: #8a8375; font-size: 11px; }
  .debrief-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 38px; }
  .debrief-actions .primary-button { background: var(--lamp); color: #231b10; }.debrief-actions .primary-button:hover { background: #efc98f; }
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
@keyframes note-in { from { opacity: 0; transform: translateY(-18px) scale(.96); } }
@keyframes fade-in { from { opacity: 0; } }
@layer responsive {
  @media (max-width:700px) {
    .composer { padding-left: 8px; }
    .waiting-status { left: 58px; }
    .case-banner { width: calc(100% - 24px); flex-direction: column; align-items: stretch; }
    .toast-stack { top: 12px; }
    .title-body { padding: 48px 16px 32px; }
    .debrief { border-radius: 0; height: 100dvh; border: 0; }
    .debrief-inner { padding: 52px 16px 32px; }
    .debrief-event { grid-template-columns: 1fr; padding-left: 16px; }
    .debrief-missed { grid-column: 1; }
    .evidence-picker { max-height: 50vh; }
  }
}
