:root {
  color-scheme: light;
  --bg: #f3f6fb; --panel: #fff; --line: #e2e8f0; --muted: #64748b;
  --text: #22314b; --accent: #4268d6; --terminal-width: 78%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
button,input,textarea { font: inherit; }
button { cursor: pointer; background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 6px; padding: 6px 9px; transition: background .15s,color .15s; }
button:hover { background: #eaf0fb; color: #3156bd; }
button:focus-visible,a:focus-visible,input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
header { height: 56px; background: #ffffffed; border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: #263758; text-decoration: none; font-size: 22px; font-weight: 650; letter-spacing: -.8px; }
.brand-icon { width: 30px; height: 30px; background: #e7edff; border-radius: 9px; color: var(--accent); display: grid; place-items: center; font-size: 24px; }
.brand-caption { font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: .5px; margin-left: 12px; }
.top-right { display: flex; align-items: center; gap: 11px; font-size: 12px; }
.status { display: flex; align-items: center; gap: 7px; color: #61718a; }
.status i,.live-dot,.footer-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.status.connected i,.live-dot,.footer-dot { background: #3b9a79; box-shadow: 0 0 0 3px #e7f4ee; }
.status.error i { background: #ce8043; box-shadow: none; }
.separator { height: 18px; width: 1px; background: var(--line); margin: 0 3px; }
.avatar { height: 27px; width: 27px; border-radius: 50%; background: #eaf0fb; color: #4f69a6; display: grid; place-items: center; font-size: 10px; font-weight: 600; }
main { width: 100%; height: calc(100dvh - 56px); min-height: 440px; padding: 12px 20px 8px; display: flex; flex-direction: column; }
.intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-shrink: 0; min-height: 34px; margin-bottom: 10px; }
.intro>div:first-child { display: flex; align-items: center; gap: 12px; }
h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: .3px; }
.intro p { color: #8290a5; margin: 0; font-size: 11px; }
.eyebrow { font-size: 10px; letter-spacing: 2px; color: #6f82a6; font-weight: 600; }
.workspace-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tiny-label { font-size: 10px; letter-spacing: .3px; color: var(--muted); white-space: nowrap; }
code { font-family: "SFMono-Regular",Consolas,monospace; color: #53698c; font-size: 11px; background: #eaf0f8; padding: 5px 9px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace { display: flex; flex: 1; min-height: 0; border: 1px solid #dce4ef; border-radius: 10px; overflow: hidden; background: white; box-shadow: 0 3px 14px #243c6406; }
.terminal-pane { width: var(--terminal-width); min-width: 0; background: #fff; display: flex; flex-direction: column; }
.pane-heading { height: 42px; flex-shrink: 0; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #f9fbfe; }
.pane-heading>div { display: flex; align-items: center; gap: 9px; }
.pane-heading strong { font-size: 12px; font-weight: 600; }
.heading-icon { color: #617fb4; font-family: monospace; font-size: 15px; }
.tag { font-size: 9px; color: #7387a8; letter-spacing: .5px; padding: 3px 6px; background: #eef2fa; border-radius: 4px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { gap: 2px!important; }
.tools button { font-size: 11px; padding: 5px 7px; }
.terminal-sub { display: flex; justify-content: space-between; font-size: 10px; color: #8291a8; padding: 10px 18px 5px; letter-spacing: .3px; flex-shrink: 0; }
.terminal-sub .live-dot { margin-right: 7px; width: 5px; height: 5px; box-shadow: none; }
#terminal { flex: 1; min-height: 0; padding: 8px 10px 6px 18px; }
.xterm { height: 100%; }
.xterm-viewport { scrollbar-width: thin; scrollbar-color: #c9d4e4 transparent; }
.terminal-footer { height: 25px; flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 15px; border-top: 1px solid #edf1f6; font-size: 10px; color: #8593a7; }
#divider { width: 5px; flex-shrink: 0; background: #edf1f7; cursor: col-resize; transition: background .15s; }
#divider:hover,#divider:focus { background: #adc0ef; }
.files-pane { flex: 1; min-width: 270px; background: #fff; display: flex; flex-direction: column; }
.count { font-size: 10px; background: #eaf0f8; color: #7386a4; padding: 2px 5px; border-radius: 4px; }
.file-path { height: 39px; flex-shrink: 0; display: flex; align-items: center; padding: 0 9px; gap: 6px; font-family: monospace; font-size: 11px; color: #627490; border-bottom: 1px solid #edf1f6; }
.file-path span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-wrap { margin: 11px 13px 10px; display: flex; align-items: center; background: #f7f9fd; border: 1px solid #e2e8f1; border-radius: 6px; padding: 8px 9px; gap: 7px; color: #7c8faa; }
.search-wrap input { min-width: 0; width: 100%; border: 0; background: none; color: var(--text); outline: none; font-size: 11px; }
.search-wrap input::placeholder { color: #8b9ab0; }
kbd { font-family: inherit; font-size: 9px; border: 1px solid #dbe3ef; border-radius: 3px; padding: 1px 4px; white-space: nowrap; color: #94a0b3; }
.list-label { display: flex; justify-content: space-between; font-size: 10px; color: #91a0b4; padding: 0 20px 9px; border-bottom: 1px solid #edf1f7; }
#file-list { overflow: auto; flex: 1; min-height: 0; padding: 5px 8px; scrollbar-width: thin; scrollbar-color: #c9d4e4 transparent; }
.file-row { display: flex; align-items: center; width: 100%; text-align: left; border-radius: 5px; }
.file-row:hover { background: #f0f5fd; }
.file-open { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; text-align: left; padding: 9px 8px; color: #42536e; }
.file-open:hover { background: transparent; }
.file-icon { color: #7f9fce; font-size: 17px; width: 19px; text-align: center; }
.file-row.directory .file-icon { color: #ccad67; }
.file-row.directory { padding-right: 29px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-size: 12px; }
.file-size { font-family: monospace; font-size: 10px; color: #90a0b5; }
.file-download { font-size: 15px; padding: 5px 8px; color: #91a3bd; }
.file-footer { height: 32px; flex-shrink: 0; border-top: 1px solid #e8eef6; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; color: #8b9ab0; font-size: 10px; gap: 5px; }
.file-footer button { font-size: 10px; white-space: nowrap; color: #627eaf; }
.empty { padding: 50px 10px; text-align: center; color: #91a0b4; font-size: 12px; line-height: 2; }
.empty b { display: block; font-size: 26px; font-weight: 400; color: #bac9df; margin-bottom: 8px; }
.page-footer { display: flex; justify-content: space-between; align-items: center; height: 18px; flex-shrink: 0; color: #9aa8bc; font-size: 9px; margin-top: 7px; }
.page-footer>span:last-child { letter-spacing: 1.5px; font-size: 8px; }
.footer-dot { width: 4px; height: 4px; margin-right: 7px; vertical-align: middle; box-shadow: none; }
.overlay { position: fixed; inset: 0; background: #f1f5fbe8; backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 20; }
.gate-card { text-align: center; max-width: 460px; padding: 45px; border: 1px solid #e0e7f3; border-radius: 16px; background: #fff; box-shadow: 0 20px 90px #314d7910; }
.gate-icon { background: #eaf0ff; color: #5673b8; width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 26px; font-size: 37px; display: grid; place-items: center; }
.gate-card h2 { font-weight: 500; font-size: 22px; margin: 22px 0 14px; }
.gate-card p { color: #7c8da6; font-size: 13px; line-height: 1.9; }
.gate-note { margin-top: 30px; color: #94a5bd; font-size: 10px; letter-spacing: 1px; }
[hidden] { display: none!important; }
dialog { background: #fff; color: var(--text); border: 1px solid #dbe3ee; border-radius: 12px; padding: 0; box-shadow: 0 25px 100px #243a5c26; }
dialog::backdrop { background: #35476a44; backdrop-filter: blur(4px); }
#editor { width: min(1050px,92vw); height: 85dvh; }
#editor[open] { display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line); background: #f9fbfe; }
h3 { font-weight: 500; font-size: 15px; margin: 6px 0; overflow-wrap: anywhere; }
#editor-content { flex: 1; min-height: 0; resize: none; border: 0; outline: none; background: #fff; color: #33445f; padding: 22px; font-family: monospace; font-size: 14px; line-height: 1.7; tab-size: 2; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.editor-actions span { margin-right: auto; color: var(--muted); font-size: 11px; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: #3356be; color: white; }
#name-dialog { padding: 24px; width: 360px; }
#name-dialog label { display: block; margin-top: 18px; color: var(--muted); font-size: 12px; }
#name-input { display: block; width: 100%; margin: 9px 0 20px; background: #f8faff; border: 1px solid #dce5f1; border-radius: 5px; padding: 10px; color: var(--text); }
#name-dialog .editor-actions { padding: 14px 0 0; }
#toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: #fff; color: #385377; border: 1px solid #d8e3f3; border-radius: 8px; padding: 12px 22px; box-shadow: 0 8px 30px #2d456719; z-index: 50; max-width: 90vw; }
#dev-banner { flex-shrink: 0; font-size: 10px; color: #9a875e; background: #fcfaf3; border: 1px solid #efe9d9; border-radius: 5px; padding: 5px 10px; margin-bottom: 9px; }
body.focus-mode>header,body.focus-mode .intro,body.focus-mode #dev-banner,body.focus-mode .page-footer { display: none; }
body.focus-mode main { height: 100dvh; padding: 8px; }
@media(max-width:800px) {
  header { padding: 0 14px; height: 50px; }
  .brand { font-size: 20px; gap: 8px; }
  .brand-caption,.separator,.intro p { display: none; }
  main { height: auto; min-height: calc(100dvh - 50px); padding: 10px 10px 5px; }
  .intro { min-height: 30px; gap: 8px; }
  h1 { font-size: 15px; white-space: nowrap; }
  .workspace-info .tiny-label { display: none; }
  .workspace-info { flex: 1; justify-content: flex-end; }
  .workspace-info code { max-width: 58vw; font-size: 10px; }
  .workspace { flex: none; flex-direction: column; }
  .terminal-pane { width: 100%; height: max(560px,78dvh); }
  .files-pane { flex: none; height: 360px; border-top: 1px solid var(--line); }
  #divider { display: none; }
  .top-right { gap: 6px; }
  #user { max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
  .top-right .quiet { padding: 5px; }
  .gate-card { margin: 20px; padding: 30px; }
  body.focus-mode main { height: auto; }
  body.focus-mode .terminal-pane { height: calc(100dvh - 18px); }
}
.preview-form { margin-top: 24px; text-align: left; }
.preview-form input { display: block; width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #dbe4f1; border-radius: 7px; background: #f8faff; color: var(--text); }
.preview-form button { width: 100%; padding: 12px 18px; }
#error { color: #b4534c; font-size: 12px; min-height: 18px; margin: 12px 0 0; }

.brand{white-space:nowrap;font-size:20px}.terminal-footer{gap:12px}.terminal-footer #terminal-hint{white-space:normal}@media(max-width:600px){.brand{font-size:16px}.brand-caption{display:none}.terminal-footer{font-size:10px}}

.chat-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; padding: 8px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.chat-options button { padding: 6px 3px; font-size: 11px; color: #4169bc; background: #f3f7ff; border: 1px solid #dce6f7; white-space: nowrap; }
.file-delete { padding: 5px; font-size: 11px; }
.file-delete:hover { color: #b54343; background: #fff0f0; }
#image-preview { width: min(1000px,92vw); max-height: 90dvh; }
#image-preview[open] { display: flex; flex-direction: column; }
.image-body { min-height: 0; overflow: auto; padding: 16px; text-align: center; background: #f3f6fb; }
#preview-image { display: block; max-width: 100%; max-height: 65dvh; object-fit: contain; margin: auto; }
@media(max-width:800px) {
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); }
  .files-pane { display: contents; }
  .chat-options { grid-row: 1; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .chat-options button { white-space: normal; }
  .terminal-pane { grid-row: 2; }
  #file-list { min-height: 140px; max-height: 300px; }
}
