/* Codex 随行 — touch-first shell, shared by Safari and the Home Screen app. */
:root {
  --bg:#fff; --panel:#f6f7fb; --card:#fff; --soft:#f0f2f7; --hover:#e9edf4;
  --text:#1c2432; --muted:#818997; --border:#e2e6ed; --line:#edf0f5;
  --accent:#2868dc; --accent-soft:#e9f0ff; --selected:#e9f0ff;
  --bubble:#eaf1ff; --bubble-text:#1e3d70; --link:#2868dc;
  --shadow:0 12px 40px #1b335215; --width:860px;
}
:root[data-theme=dark] {
  --bg:#111317; --panel:#171a20; --card:#1c2028; --soft:#222631; --hover:#2b303b;
  --text:#ecedf2; --muted:#959cab; --border:#303642; --line:#292e38;
  --accent:#84aaff; --accent-soft:#253b61; --selected:#253b61;
  --bubble:#203b66; --bubble-text:#edf3ff; --link:#9fbdff;
  --shadow:0 12px 40px #0005;
}
[hidden] { display:none!important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
body.library-app { grid-template-columns:338px minmax(0,1fr); font-size:15px; letter-spacing:-.015em; }
.library-app button,.library-app a,.library-app summary { -webkit-tap-highlight-color:transparent; }
.library-app button { cursor:pointer; }
.library-app button:disabled { cursor:default; opacity:.45; }
.library-app .icon-button { width:40px; height:40px; border-radius:12px; color:var(--muted); }
.new-thread-button svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.library-app .new-thread-button { color:var(--accent); }
.thread-panel { background:var(--panel); border-right:1px solid var(--border); }
.list-heading { height:auto; min-height:84px; padding:25px 17px 12px 13px; align-items:center; }
.list-heading h1 { font-size:25px; font-weight:700; letter-spacing:-1px; }
.list-heading .icon-button { width:36px; height:40px; font-size:20px!important; }
.count-badge { font-size:12px; margin-right:2px; }
.search-wrap { margin:9px 20px 17px; padding:11px 13px; border-radius:13px; background:var(--hover); gap:9px; }
.search-wrap input { font-size:15px; }
.search-wrap .icon { width:17px; height:17px; }
.bridge-indicator { display:flex; align-items:center; gap:7px; margin:0 24px 2px; padding:0; background:none; border:0; color:var(--muted); text-align:left; font-size:11px!important; min-height:24px; }
.bridge-indicator.connected { color:var(--muted); }
.bridge-indicator .status-dot { width:6px; height:6px; background:#b1b8c5; }
.bridge-indicator.connected .status-dot { background:#4d9b76; box-shadow:0 0 0 3px #4d9b7610; }
.bridge-arrow { margin-left:auto; font-size:17px; color:var(--muted); }
.thread-list { padding:0 13px 20px; }
.thread-group { font-size:11px; letter-spacing:.04em; padding:0 11px; margin:18px 0 8px; color:var(--muted); }
.thread-item { border-radius:15px; margin-bottom:4px; padding:15px 13px; min-height:76px; transition:background .15s; }
.thread-item.active { background:var(--selected); }
.thread-item-title { font-size:14px; font-weight:550; line-height:1.5; }
.thread-item-meta { font-size:10px; margin-top:7px; }
.thread-date { font-size:10px; margin-left:12px; }
.list-footer { min-height:57px; padding:10px 14px 12px 22px; background:var(--panel); }
.list-footer select { width:79px; font-size:11px; }
.sync-short { font-size:10px!important; gap:7px; }
.library-app .list-footer .icon-button { width:34px; height:34px; font-size:20px!important; }
.reader-header { min-height:80px; padding:19px 30px 14px; background:var(--bg); }
.reader-heading h2 { font-size:16px; font-weight:650; letter-spacing:-.3px; }
.reader-meta { font-size:11px; margin-top:4px; }
.reader-context { margin:0 30px; padding:0 0 13px; min-height:36px; }
.reader-tag { font-size:10px; padding:4px 7px; border-radius:6px; }
.version-label select { font-size:11px; }
.library-app #conversation { padding:28px 34px 30px; font-size:16px; line-height:1.75; }
.library-app .user { border-radius:21px; border-bottom-right-radius:7px; font-size:16px; padding:13px 18px; line-height:1.7; }
.library-app .prose p { margin-bottom:16px; }
.library-app .process>summary { font-size:12px; }
.history-more-wrap { display:flex; justify-content:center; padding:0 20px; }
.history-more { display:block; margin:22px auto 0; padding:9px 14px; border:1px solid var(--border); border-radius:20px; background:var(--card); color:var(--muted); font-size:12px!important; }
.history-more:hover { color:var(--accent); border-color:var(--accent); }
.reader-footer { padding:0 20px 9px; font-size:9px; color:var(--muted); }
.empty { min-height:max(260px,calc(100dvh - 390px)); }
.empty-mark { font-size:45px; opacity:.6; color:var(--accent); margin-bottom:23px; }
.empty h2 { font-size:24px; font-weight:650; letter-spacing:-.7px; }
.library-app .empty p { font-size:14px; line-height:1.8; max-width:290px; }
.composer-area { flex-shrink:0; width:100%; max-width:var(--width); margin:0 auto; padding:9px 28px 2px; background:var(--bg); }
.composer-form { padding:13px 14px 10px; border:1px solid var(--border); border-radius:24px; background:var(--card); box-shadow:0 3px 18px #1b335206; }
.composer-form:focus-within { border-color:color-mix(in srgb,var(--accent) 45%,var(--border)); box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 6%,transparent); }
.composer-form textarea { display:block; border:0; outline:0; resize:none; background:transparent; width:100%; min-height:36px; max-height:170px; overflow:auto; color:var(--text); font:16px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC",sans-serif; letter-spacing:0; padding:1px 5px 8px; box-sizing:border-box; }
.composer-form textarea::placeholder { color:var(--muted); }
.composer-controls { display:flex; align-items:center; gap:10px; justify-content:space-between; }
.composer-selects { display:flex; gap:4px; align-items:center; min-width:0; }
.composer-action-buttons { display:flex; gap:7px; align-items:center; flex-shrink:0; }
.stop-button { display:flex; align-items:center; gap:5px; border:0; background:var(--soft); color:var(--muted); height:33px; padding:0 10px; border-radius:12px; font-size:11px!important; }
.stop-button span { font-size:9px; }
.composer-choice { min-width:0; display:block; }
.library-app .composer-choice select { display:block; min-height:31px; max-width:190px; border:0; padding:5px 22px 5px 9px; font-size:11px; font-weight:500; border-radius:11px; background:var(--soft); color:var(--muted); text-overflow:ellipsis; }
.library-app .composer-choice:nth-child(2) select { max-width:110px; }
.send-button { display:grid; place-content:center; width:35px; height:35px; flex:0 0 35px; border:0; border-radius:50%; background:var(--accent); color:#fff; transition:transform .15s,opacity .15s; }
.send-button svg { width:23px; height:23px; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; fill:none; }
.send-button:active { transform:scale(.92); }
.send-button:disabled { opacity:1!important; background:var(--soft); color:var(--muted); }
.send-button.sending svg { animation:blink 1.2s ease-in-out infinite; }
.composer-caption { display:flex; align-items:center; justify-content:space-between; gap:15px; min-height:28px; padding:2px 10px; font-size:10px; color:var(--muted); }
.composer-caption button { padding:4px 0 4px 12px; border:0; background:none; font:11px ui-monospace,SFMono-Regular,Menlo,monospace!important; color:var(--muted); }
.composer-caption button:hover { color:var(--accent); }
.live-notice { padding:9px 12px; margin:0 3px 8px; background:var(--soft); border-radius:12px; font-size:12px; line-height:1.6; color:var(--muted); overflow-wrap:anywhere; }
.live-notice[data-kind=error],.live-notice[data-kind=attention] { color:var(--danger); background:color-mix(in srgb,var(--danger) 7%,var(--bg)); }
.live-conversation { width:min(100%,var(--width)); margin:0 auto; padding:0 34px 28px; font-size:16px; line-height:1.75; }
.live-turn + .live-turn { margin-top:35px; }
.live-turn-user .user { margin-left:auto; }
.live-process { border:1px solid var(--border); border-radius:16px; background:var(--card); margin:18px 0 23px; overflow:hidden; }
.live-process>summary { list-style:none; display:flex; align-items:center; gap:9px; color:var(--muted); padding:12px 15px; font-size:12px; cursor:pointer; }
.live-process>summary::-webkit-details-marker { display:none; }
.live-process>summary .chevron { margin-left:auto; }
.live-process-dot { width:6px; height:6px; border-radius:50%; background:var(--muted); }
.live-turn[data-status=running] .live-process-dot { background:var(--accent); box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 10%,transparent); animation:blink 1.7s ease-in-out infinite; }
.live-turn[data-status=failed] .live-process-dot,.live-turn[data-status=error] .live-process-dot { background:var(--danger); }
.live-process-body { padding:1px 16px 14px; font-size:14px; color:var(--muted); }
.live-process-body .prose { color:var(--muted); }
.live-activity { margin:10px 0 17px; min-width:0; }
.live-activity+.live-activity { border-top:1px solid var(--line); padding-top:14px; }
.live-activity-heading { display:flex; align-items:flex-start; gap:9px; margin-bottom:9px; font-size:12px; color:var(--text); }
.live-activity-symbol { font:13px/1.7 ui-monospace,SFMono-Regular,monospace; color:var(--muted); flex:0 0 16px; }
.live-activity-title { flex:1; min-width:0; overflow-wrap:anywhere; }
.live-activity-status { flex-shrink:0; color:var(--muted); font-size:10px; padding-top:2px; }
.live-tool-output { max-height:320px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; margin:9px 0; padding:12px; background:var(--soft); color:var(--muted); border:0; border-radius:10px; font:11px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace; }
.live-file-path { font:12px/1.6 ui-monospace,SFMono-Regular,monospace; overflow-wrap:anywhere; }
.live-output-limit { font-size:10px; color:var(--muted); line-height:1.6; }
.live-commentary { margin:10px 0 18px; }
.live-final { margin:17px 0 5px; }
.live-final .prose { color:var(--text); }
.sidebar { top:74px; bottom:67px; width:310px; left:13px; padding:14px 13px 0; border-radius:20px; }
.nav-link { min-height:43px; border-radius:11px; }
.menu-popover { min-width:210px; padding:7px; border-radius:16px; }
.menu-popover button,.menu-popover a { padding:12px; font-size:14px; border-radius:9px; }
.library-app dialog { border-radius:23px; padding:25px; }
.dialog-heading h2 { font-size:20px; font-weight:650; }
.library-app dialog label { font-size:13px; }
.library-app dialog input,.library-app #deep-link-input { font-size:16px; padding:13px; border-radius:12px; }
.library-app dialog .primary-button { padding:11px 18px; font-size:14px!important; border-radius:12px; }
.settings-section { padding:6px 0 20px; margin-bottom:18px; border-bottom:1px solid var(--line); }
.settings-section h3 { font-size:14px; font-weight:600; margin:0 0 9px; }
.settings-section p { font-size:13px; line-height:1.75; color:var(--muted); margin:5px 0; }
.settings-section .subtle-button { padding-left:0; color:var(--accent); min-height:35px; }
.auth-device { display:flex; align-items:center; justify-content:space-between; padding:13px 0; border-bottom:1px solid var(--line); }
.auth-device:last-child { border-bottom:0; }
.auth-device-title strong { display:block; font-size:14px; font-weight:550; }
.auth-device-title span { display:block; font-size:11px; margin-top:4px; color:var(--muted); }
.auth-device .subtle-button { color:var(--danger); }
.logout-button { width:100%; padding:13px; border:1px solid var(--border); background:var(--soft); color:var(--danger); border-radius:13px; font-size:14px!important; }
.auth-screen { position:fixed; z-index:100; inset:0; background:var(--panel); display:grid; place-items:center; padding:calc(30px + env(safe-area-inset-top)) 28px calc(30px + env(safe-area-inset-bottom)); overflow:auto; }
.auth-card { width:min(100%,360px); margin:auto; text-align:center; }
.auth-icon { display:block; margin:0 auto 27px; border-radius:19px; box-shadow:0 9px 28px #1734611c; }
.eyebrow { font-size:10px; font-weight:650; letter-spacing:.2em; color:var(--muted); margin:0 0 13px; }
.auth-card h1 { font-size:29px; line-height:1.35; font-weight:700; letter-spacing:-.9px; margin:0 0 13px; }
.auth-description { color:var(--muted); font-size:14px; line-height:1.8; margin:0 0 32px; }
.auth-card form { text-align:left; }
.auth-card label { display:block; margin:0 0 9px 3px; font-size:12px; color:var(--muted); }
.auth-card input[type=password] { width:100%; border:1px solid var(--border); border-radius:15px; background:var(--card); color:var(--text); padding:15px 16px; outline:0; font-size:17px; line-height:1.4; box-shadow:0 3px 14px #1b335204; }
.auth-card input[type=password]:focus { border-color:var(--accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 8%,transparent); }
.auth-card .primary-button { display:block; width:100%; margin:17px 0 0; border:0; border-radius:15px; padding:15px; background:var(--accent); color:#fff; font-size:15px!important; font-weight:600; }
.auth-card .inline-error { margin:12px 0 0; font-size:12px; }
.auth-footnote { color:var(--muted); font-size:11px; text-align:center; line-height:1.6; margin:17px 0 0; }
.auth-status { color:var(--muted); font-size:12px; line-height:1.6; margin:17px 0 0; }
.auth-card #auth-retry { color:var(--accent); font-size:14px!important; min-height:44px; }
body.auth-locked> :not(#auth-screen):not(#notice) { display:none!important; }
.library-app.clean .composer-area { display:none; }
@media(max-width:1000px) and (min-width:701px) {
  body.library-app { grid-template-columns:290px minmax(0,1fr); }
  .list-heading h1 { font-size:22px; }
  .reader-header { padding-left:22px; padding-right:18px; }
  .reader-context { margin-left:22px; margin-right:22px; }
  .composer-area { padding-left:20px; padding-right:20px; }
  .composer-choice:first-child { max-width:170px; }
}
@media(max-width:700px) {
  body.library-app { display:block; height:var(--app-height,100dvh); position:relative; top:var(--app-top,0px); }
  .thread-panel,.reader { height:100%; }
  .list-heading { padding:calc(18px + env(safe-area-inset-top)) 19px 9px 12px; min-height:81px; }
  .list-heading h1 { font-size:29px; }
  .list-heading .icon-button { width:40px; height:43px; }
  .count-badge { font-size:12px; }
  .bridge-indicator { margin:0 26px 3px; font-size:12px!important; }
  .search-wrap { margin:10px 20px 12px; padding:12px 13px; border-radius:13px; }
  .search-wrap input { font-size:16px; }
  .search-wrap kbd { display:none; }
  .thread-list { padding:0 13px 17px; }
  .thread-group { margin:20px 0 8px; font-size:11px; }
  .thread-item { padding:16px 14px; min-height:80px; border-radius:16px; background:var(--card); margin-bottom:6px; }
  .thread-item-title { font-size:15px; }
  .thread-item-meta { font-size:11px; margin-top:7px; }
  .thread-date { font-size:10px; }
  .thread-item.active { background:var(--selected); }
  .list-footer { padding:9px 15px calc(9px + env(safe-area-inset-bottom)) 24px; min-height:55px; }
  .sync-short { font-size:10px!important; }
  .list-footer select { font-size:12px; width:84px; }
  .reader-header { padding:calc(9px + env(safe-area-inset-top)) 12px 9px 7px; gap:5px; min-height:63px; border-bottom:1px solid var(--line); }
  .reader-heading h2 { font-size:15px; font-weight:650; }
  .reader-meta { font-size:10px; margin-top:3px; }
  .reader-actions { gap:0; }
  .library-app #back-to-list { width:38px; height:42px; font-size:36px!important; color:var(--accent); }
  .reader-actions .icon-button { width:37px; height:40px; }
  .reader-context { padding:8px 0; margin:0 18px; min-height:34px; border-bottom:1px solid var(--line); gap:5px; }
  .reader-tag { font-size:9px; padding:3px 6px; border-radius:5px; max-width:140px; }
  .reader-context .secondary-tag { display:none; }
  .version-label select { max-width:92px; font-size:10px; padding-right:0; }
  .library-app #conversation { padding:24px 20px 18px; font-size:16px; line-height:1.75; }
  .library-app .user { max-width:94%; padding:12px 16px; font-size:16px; border-radius:20px; border-bottom-right-radius:6px; }
  .library-app .prose pre { font-size:12px; padding:12px; }
  .library-app .archive-turn+.archive-turn { margin-top:31px; }
  .library-app .activity,.library-app .file-change { font-size:12px; }
  .library-app .archive-tool-body { margin-left:0; }
  .library-app .process-content>.prose { font-size:14px; }
  .composer-area { padding:7px 13px calc(3px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); }
  .composer-form { border-radius:23px; padding:12px 11px 9px; }
  .composer-form textarea { padding-left:5px; min-height:35px; }
  .library-app .composer-choice select { font-size:11px; max-width:190px; min-height:31px; padding-left:8px; }
  .composer-controls { gap:5px; }
  .composer-caption { min-height:25px; font-size:9px; padding-left:6px; padding-right:6px; }
  .composer-caption button { min-height:26px; }
  .reader-footer { display:none; }
  .live-notice { font-size:11px; margin:0 1px 7px; padding:8px 10px; }
  .live-conversation { padding:0 20px 23px; }
  .live-process { margin:14px 0 20px; border-radius:15px; }
  .live-process-body { padding:0 13px 10px; font-size:14px; }
  .live-process>summary { padding:12px 13px; }
  .live-tool-output { max-height:260px; font-size:10px; padding:10px; }
  .live-activity-status { font-size:9px; }
  .sidebar { top:calc(72px + env(safe-area-inset-top)); bottom:calc(65px + env(safe-area-inset-bottom)); left:12px; width:min(350px,calc(100% - 24px)); }
  .sidebar-shade { background:#0002; backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px); }
  .library-app dialog { width:calc(100% - 24px); max-height:calc(var(--app-height,100dvh) - 32px); padding:22px; border-radius:24px; }
  .library-app .raw-dialog { width:calc(100% - 18px); height:calc(var(--app-height,100dvh) - 32px); padding:18px; }
  .auth-screen { top:calc(-1 * var(--app-top,0px)); height:100dvh; }
  .auth-card h1 { font-size:28px; }
  .auth-card { padding-bottom:20px; }
  .empty { min-height:max(240px,calc(var(--app-height,100dvh) - 320px)); }
  .empty h2 { font-size:23px; }
  .empty-mark { font-size:42px; margin-bottom:22px; }
  .library-app .empty p { font-size:13px; }
  .history-more { margin-top:17px; font-size:11px!important; min-height:35px; }
  .keyboard-visible .composer-area { padding-bottom:3px; }
  .keyboard-visible .composer-caption { min-height:23px; }
  .keyboard-visible .reader-context { display:none; }
  .keyboard-visible .auth-screen { height:var(--app-height,100dvh); padding-top:24px; padding-bottom:20px; }
  .keyboard-visible .auth-icon { width:48px; height:48px; margin-bottom:16px; border-radius:13px; }
  .keyboard-visible .auth-description { margin-bottom:20px; }
  .keyboard-visible .auth-card h1 { font-size:24px; }
}
@media(max-width:370px) {
  .library-app .composer-choice:first-child select { max-width:145px; }
  .library-app .composer-choice:nth-child(2) select { max-width:85px; }
  .list-heading h1 { font-size:26px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; scroll-behavior:auto!important; }
}
@media print {
  .composer-area,.auth-screen,.bridge-indicator,.history-more-wrap { display:none!important; }
  .live-process { break-inside:avoid; }
}

/* Official Lucide SVGs share existing native controls and their accessible names. */
.library-app .icon-button>.icon { width:20px; height:20px; }
.library-app .nav-symbol { width:16px; height:16px; flex:0 0 16px; }
.library-app .thread-pin { width:12px; height:12px; flex:0 0 12px; }
.library-app .is-pinned>.icon { fill:currentColor; }
.brand-mark { padding-right:0; }
.brand-mark>.icon { width:18px; height:18px; }
.empty-mark { padding-right:0; letter-spacing:normal; }
.empty-mark>.icon { width:46px; height:46px; }
.sync-icon,.bridge-arrow { width:15px; height:15px; flex:0 0 15px; }
.live-activity-symbol { width:16px; height:16px; margin-top:3px; }
.stop-button .stop-icon { width:10px; height:10px; fill:currentColor; }

/* Native details/summary and checkbox reuse the existing control system. */
.execution-group { margin:16px 0 22px; min-width:0; color:var(--muted); }
.execution-group>summary { display:flex; align-items:center; width:fit-content; min-height:36px; padding:2px 0; list-style:none; cursor:pointer; font-size:13px; user-select:none; border-radius:5px; }
.execution-group>summary::-webkit-details-marker { display:none; }
.execution-group>summary:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
.execution-group>summary .chevron { margin-left:9px; width:15px; height:15px; transform:rotate(-90deg); }
.execution-group[open]>summary .chevron { transform:rotate(0deg); }
.execution-group-dots { display:inline-block; width:1.3em; font-family:ui-monospace,monospace; }
.execution-group-body { margin-top:8px; padding:1px 0 4px 16px; border-left:1px solid var(--line); font-size:14px; min-width:0; }
.execution-group-body>.prose { color:var(--muted); }
.library-app .setting-toggle { display:flex; align-items:center; justify-content:space-between; gap:18px; min-height:40px; margin:0; font-size:14px; cursor:pointer; }
.library-app .setting-toggle input { width:21px; height:21px; min-height:0; margin:0; padding:0; accent-color:var(--accent); flex:0 0 auto; cursor:pointer; }
