* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --red: #cd2847; --accent: #ed405f; --pink: #fff0f2; --ink: #25262a; --muted: #646a73;
  --line: #e3e5e9; --paper: #fff; --canvas: #f9fafb; --col: 33.3%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.5;
}
body, h1, h2, h3, p, dl, dd { margin: 0; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
button, input, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: transparent; cursor: pointer; padding: 0; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid #a42340; outline-offset: 2px; }
[hidden] { display: none !important; }
#demo-loading { margin: auto; padding: 20px; text-align: center; }
#demo-loading a { color: var(--red); text-decoration: underline; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; margin: -1px; }
[data-icon] { display: inline-flex; flex: none; width: 16px; height: 16px; align-items: center; justify-content: center; }
[data-icon] svg { width: 100%; height: 100%; }
#app { display: grid; grid-template-columns: minmax(300px, var(--col)) 6px minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; }
#chat { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: white; }
.titlebar { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); min-height: 58px; padding: 0 18px; flex: none; }
.titlebar h1 { display: inline-flex; align-items: center; gap: 6px; color: #111116; font-size: 24px; letter-spacing: -1.5px; font-weight: 780; line-height: 1; }
.brand-mark { position: relative; display: inline-block; width: 39px; height: 24px; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; top: 4px; width: 22px; height: 16px; border: 4px solid #ed153a; border-radius: 65% 54%; transform: rotate(32deg); box-sizing: border-box; }
.brand-mark::before { left: 1px; }
.brand-mark::after { right: 1px; top: 2px; height: 20px; border-radius: 57% 65%; transform: rotate(-27deg); }
.demo-tag { padding: 2px 6px; border: 1px solid #e0e2e5; border-radius: 5px; font-size: 12px; color: #5b6068; white-space: nowrap; }
.title-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.titlebar { container-type: inline-size; container-name: titlebar; }
#portfolio-home > span { display: none; }
@container titlebar (min-width: 445px) {
  #portfolio-home { gap: 4px; padding-inline: 5px; }
  #portfolio-home > span { display: inline; font-size: 12px; }
}
@media (min-width: 375px) and (max-width: 800px) {
  #portfolio-home { gap: 4px; padding-inline: 5px; }
  #portfolio-home > span { display: inline; font-size: 12px; }
}
.icon-button, .chat-tool { display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; height: 34px; min-width: 32px; color: #656a74; }
.chat-tool { gap: 5px; padding: 0 9px; color: var(--red); background: var(--pink); font-size: 14px; }
.icon-button:hover, .minor-actions button:hover, .week-nav button:hover { background: #f1f2f4; }
#chat-body { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.thread { padding: 18px 22px 8px; overflow-y: auto; min-height: 0; flex: 1; overscroll-behavior: contain; }
.thread-date { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 12px; color: var(--muted); }
.thread-date b { font-weight: 450; }
.thread-date::after { content: ""; height: 1px; flex: 1; background: #eeeff1; }
.message { margin-bottom: 18px; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.sender { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.sender-dot, .event-dot { width: 6px; height: 6px; border-radius: 50%; background: #a8adb7; }
.agent-face { width: 15px; height: 15px; display: inline-grid; place-items: center; background: #ffeaee; color: #b72244; border-radius: 4px; font: bold 13px/1 Georgia, serif; }
.proposal-slots { margin: 10px 0; padding: 3px 0 3px 12px; border-left: 2px solid #ebbac3; list-style: none; }
.proposal-slots li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; font-size: 14px; padding: 3px 0; }
.proposal-slots time { font-variant-numeric: tabular-nums; }
#source-detail summary { color: #9e2943; cursor: pointer; font-size: 14px; }
#source-detail p { background: #f7f7f8; border-radius: 7px; padding: 8px 10px; margin-top: 5px; font-size: 14px; }
.chat-dock { padding: 10px 16px 16px; flex: none; }
.event-card { margin-inline: min(2vw, 17px); background: #fff; border: 1px solid var(--line); border-bottom: 0; border-radius: 11px 11px 0 0; padding: 12px 13px 11px; box-shadow: 0 -5px 19px #20242e06; }
.event-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.event-dot { background: #cb8a49; }
.event-card h2 { font-size: 15px; font-weight: 550; line-height: 1.5; margin: 5px 0 8px; }
.event-primary { display: block; width: 100%; padding: 8px 11px; text-align: left; font-size: 14px; border: 1px solid #e7e8eb; background: #f5f5f7; border-radius: 6px; min-height: 36px; }
.event-primary:hover { background: #edeef1; }
#adopt { background: #fff0f2; border-color: #f4c5cf; color: #9c2840; font-weight: 600; }
#adopt:hover { background: #ffe2e8; }
.minor-actions { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.minor-actions button { color: #636873; font-size: 13px; padding: 6px; border-radius: 4px; }
.composer { border: 1px solid #dcdee4; border-radius: 10px; padding: 12px 12px 8px; box-shadow: 0 2px 8px #25293205; }
.composer textarea { display: block; width: 100%; height: 41px; border: 0; resize: none; outline: 0; line-height: 1.45; font-size: 14px; background: white; }
.composer:focus-within { border-color: #c797a2; }
.composer textarea::placeholder, input::placeholder { color: #717781; }
.composer-tools { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.manual { display: inline-flex; align-items: center; gap: 4px; color: #96632e; }
.manual [data-icon] { width: 14px; height: 14px; }
#composer-status { margin-left: auto; }
.send { display: grid; place-items: center; width: 30px; height: 29px; border-radius: 7px; background: var(--accent); color: white; }
.send:disabled { background: #e8eaee; color: #7a818b; }
.notice { flex: none; font-size: 13px; padding: 5px 10px; color: #75431d; background: #fff5e8; border-top: 1px solid #ebdbc7; text-align: center; }
#splitter { position: relative; background: #eeeef0; cursor: col-resize; touch-action: none; z-index: 2; }
#splitter span { position: absolute; left: 50%; top: 49%; transform: translate(-50%, -50%); width: 17px; height: 44px; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; color: #8a8f99; background: #fafafb; font-size: 14px; }
.small-nav { display: none; }
#desk { min-width: 0; min-height: 0; padding: 15px 16px; overflow: auto; background: var(--canvas); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); padding: 14px 0; border-radius: 13px; border: 1px solid var(--line); background: white; }
.metrics div { padding: 0 15px; }
.metrics div + div { border-left: 1px solid #eeeef1; }
.metrics dt { color: #5d626a; font-size: 13px; }
.metrics dd { display: flex; align-items: center; gap: 7px; font-size: 29px; line-height: 1.2; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.metrics small { letter-spacing: .03em; color: #666b74; background: #f4f5f7; border-radius: 5px; padding: 2px 5px; font: 500 10px/1.2 system-ui, sans-serif; }
.desk-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid #e4e6ea; margin: 6px 0 15px; }
[role=tablist] { display: inline-flex; gap: 19px; }
[role=tab] { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; font-size: 14px; border-bottom: 2px solid transparent; color: #575c65; }
[role=tab][aria-selected=true] { color: var(--red); border-bottom-color: var(--accent); font-weight: 600; }
.local-note { font-size: 12px; color: var(--muted); }
.calendar-shell, .library-card, .analytics-card { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.calendar-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 11px; min-height: 44px; padding: 4px 9px; }
.week-nav, .filters, .search { display: inline-flex; align-items: center; }
.week-nav button { font-size: 13px; border-radius: 5px; min-height: 30px; }
.week-nav .icon-button { min-width: 22px; height: 30px; }
.week-nav .icon-button i { width: 13px; }
#week-range { font-weight: 550; }
.filters { gap: 2px; }
.filters button { min-height: 29px; padding: 3px 9px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.filters button[aria-pressed=true] { background: #eeeef1; color: #272830; }
.filters span { color: #6a6e75; }
#due-filter { color: #9b6735; }
.search { gap: 4px; margin-left: auto; color: #757a83; }
.search i { width: 14px; }
.search input { border: 0; background: transparent; font-size: 13px; padding-block: 5px; width: 105px; min-width: 0; }
#calendar { border-collapse: collapse; width: 100%; table-layout: fixed; text-align: center; }
#calendar th, #calendar td { border-top: 1px solid var(--line); }
#calendar thead { background: #f7f8fa; }
#calendar thead th { color: #61656f; padding: 8px 2px; font-weight: 500; font-size: 12px; }
#calendar thead th b { font-weight: 500; margin-right: 4px; }
#calendar time { white-space: nowrap; }
#calendar .first-day { color: #b62040; }
#calendar .first-day time { background: var(--accent); padding: 2px 5px; border-radius: 12px; color: white; }
#calendar .channel-col { width: clamp(124px, 15.1vw, 215px); padding: 10px 12px; text-align: left; }
#calendar tbody td { height: 86px; border-left: 1px solid #edeef1; padding: 7px 4px; }
.channel-name, .narrow-channel { display: flex; align-items: center; gap: 7px; }
.channel-name strong { font-size: 14px; font-weight: 550; }
.avatar { flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center; color: #1a5561; background: #daeae9; border-radius: 8px; font-family: "Songti SC", serif; font-weight: bold; }
.channel-col small { display: inline-block; font-size: 11px; font-weight: 450; color: #6b7078; background: #f4f5f7; padding: 1px 5px; border-radius: 4px; margin-top: 6px; }
.awaiting, .cover { display: flex; width: 100%; height: 52px; border-radius: 6px; justify-content: center; align-items: center; }
.awaiting { font-size: 12px; background: #f9fafc; color: #727985; }
.cover { position: relative; flex-direction: column; justify-content: flex-end; align-items: flex-start; padding: 4px 6px; background: linear-gradient(0deg, #102c35 3%, transparent 95%), url("assets/sea-letter.webp") 78% center / cover; color: white; text-align: left; font-size: 12px; line-height: 1.2; transition: box-shadow .15s; }
.cover:hover { box-shadow: 0 0 0 2px var(--accent); }
.cover[data-episode="2"] { background-position: center, 95% center; }
.cover small { font-size: 11px; }
.narrow-channel { display: none; }
.empty-filter { text-align: center; padding: 22px; color: var(--muted); border-top: 1px solid var(--line); font-size: 14px; }
.library-head, .library-foot, .receipt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.library-head { margin: 18px 0 12px; }
.library-head h2, .analytics-card h3 { font-size: 17px; font-weight: 600; }
.library-head span, .muted { color: var(--muted); font-size: 13px; }
.library-card { display: grid; grid-template-columns: minmax(120px, 26%) minmax(0,1fr); padding: 17px; gap: 20px; }
.film-poster { min-height: 175px; border-radius: 7px; display: flex; align-items: flex-end; background: linear-gradient(0deg, #173644 0%, transparent 75%), url("assets/sea-letter.webp") 83% center / cover; }
.film-poster strong { color: white; padding: 13px; font: 600 30px/1.1 "Songti SC", serif; letter-spacing: .1em; }
.film-content h3 { font-size: 21px; font-weight: 650; }
#choices { margin: 10px 0; padding: 0; border: 0; }
#choices legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 5px; }
.choice { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; cursor: pointer; }
.choice + .choice { margin-top: 5px; }
.choice:has(input:checked) { border-color: #efafbb; background: #fff6f8; }
.choice input { width: 17px; height: 17px; margin-left: auto; accent-color: var(--red); }
.library-foot { color: var(--muted); font-size: 13px; }
.accent { padding: 7px 13px; background: var(--red); color: #fff; border-radius: 7px; font-size: 14px; }
.accent:disabled { color: #666d77; background: #ecedf0; }
.analytics-card { padding: 20px; }
.analytics-card dl { display: flex; gap: 40px; margin: 15px 0; }
.analytics-card dt, .analytics-card p { color: var(--muted); font-size: 14px; }
.analytics-card dd { font-size: 24px; }
dialog { color: var(--ink); padding: 0; border: 1px solid #dfe1e6; border-radius: 13px; width: min(470px, calc(100% - 28px)); max-height: 87dvh; box-shadow: 0 16px 65px #20232d33; }
dialog::backdrop { background: #25293552; }
.detail-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.detail-top h2 { font-size: 17px; }
.detail-body { padding: 18px; }
.detail-series { display: flex; align-items: center; gap: 13px; }
.detail-series img { width: 95px; height: 72px; object-fit: cover; object-position: 83% center; border-radius: 6px; }
.status-tag { background: var(--pink); color: #aa2942; border-radius: 5px; padding: 2px 6px; font-size: 12px; }
.detail-series h3 { font-size: 17px; margin-top: 5px; }
.detail-series p { color: var(--muted); font-size: 13px; }
.receipt-head { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.receipt-head h3 { font-size: 16px; }
code { font-size: .89em; color: #585c65; }
.trace { display: grid; gap: 10px; margin: 13px 0 2px; font-size: 14px; }
.trace div { display: grid; grid-template-columns: 5em minmax(0,1fr); gap: 6px; }
.trace dt { color: var(--muted); }
.trace dd { overflow-wrap: anywhere; }
@media (min-width: 801px) and (max-width: 1130px) {
  #calendar thead th b { display: block; margin: 0 0 2px; }
  .titlebar { padding-inline: 10px; gap: 5px; }
  [role=tablist] { gap: 11px; }
  .local-note { font-size: 11px; }
}
@media (max-width: 800px) {
  #app { grid-template-columns: minmax(0,1fr); grid-template-rows: auto auto minmax(0,1fr); }
  #chat { display: contents; }
  #splitter, .chat-tool, .local-note { display: none; }
  .titlebar { grid-row: 1; background: white; min-height: 49px; padding: 0 13px; }
  .small-nav { display: flex; grid-row: 2; padding: 4px 12px; gap: 6px; border-bottom: 1px solid var(--line); background: white; }
  .small-nav button { flex: 1; min-height: 34px; border-radius: 6px; font-size: 14px; color: var(--muted); }
  .small-nav button[aria-pressed=true] { background: var(--pink); color: var(--red); font-weight: 600; }
  #chat-body, #desk { grid-column: 1; grid-row: 3; min-width: 0; }
  #chat-body { background: white; }
  [data-pane=chat] #desk, [data-pane=desk] #chat-body { display: none; }
  .thread { padding: 14px 16px 4px; }
  .chat-dock { padding: 6px 10px max(10px, env(safe-area-inset-bottom)); }
  .event-card { margin-inline: 8px; }
  #desk { padding: 10px; }
  .metrics { padding-block: 10px; }
  .metrics div { padding-inline: 8px; }
  .metrics dt { font-size: 12px; min-height: 33px; }
  .metrics dd { font-size: 23px; margin: 1px 0 0; }
  .desk-nav { margin-bottom: 9px; }
  [role=tablist] { width: 100%; justify-content: space-between; gap: 5px; }
  [role=tab] { padding-inline: 3px; min-height: 41px; }
  .calendar-tools { padding: 5px 6px; gap: 5px 4px; }
  .week-nav .icon-button { min-width: 25px; }
  .filters { margin-left: auto; }
  .filters button { padding-inline: 5px; }
  .search { width: 100%; border-top: 1px solid #f0f1f2; }
  .search input { flex: 1; }
  .search input, .composer textarea { font-size: 16px; }
  #calendar .channel-col { display: none; }
  .narrow-channel { display: flex; border-top: 1px solid var(--line); padding: 7px; font-size: 14px; }
  .narrow-channel .avatar { width: 23px; height: 23px; }
  #calendar thead th { padding: 4px 0; }
  #calendar thead th b { display: block; margin: 0; }
  #calendar tbody td { height: 62px; padding: 4px 1px; }
  .awaiting { font-size: 11px; }
  .cover { padding-inline: 2px; align-items: center; }
  .library-card { grid-template-columns: 71px minmax(0,1fr); padding: 10px; gap: 10px; }
  .film-poster { min-height: 105px; max-height: 115px; }
  .film-poster strong { font-size: 22px; padding: 7px; }
  .choice { gap: 7px; padding-inline: 7px; min-height: 44px; }
  .library-foot { flex-wrap: wrap; }
  .accent, .event-primary, .icon-button, .minor-actions button, .home-link { min-height: 39px; }
}
@media (max-height: 590px) {
  .chat-dock { max-height: 55dvh; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
