:root { color-scheme: dark; --bg: #14161d; --panel: #1b1e27; --line: #2c3040; --text: #dfe3ee; --dim: #8b92a8; --accent: #e8903c; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 system-ui, sans-serif; }
[hidden] { display: none !important; }
#gate { padding: 48px 24px; max-width: 520px; margin: 0 auto; font-size: 16px; }
#app { display: flex; flex-direction: column; height: 100%; }
#menubar { display: flex; gap: 2px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 2px 6px; position: relative; z-index: 20; }
.menu { position: relative; }
.menu > button { background: none; border: 0; color: var(--text); padding: 5px 10px; cursor: pointer; border-radius: 4px; font: inherit; }
.menu > button:hover, .menu.open > button { background: #2a2f40; }
.menu .items { display: none; position: absolute; top: 100%; left: 0; min-width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px; box-shadow: 0 8px 24px #0008; }
.menu.open .items { display: block; }
.menu .items button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 6px 10px; border-radius: 4px; cursor: pointer; font: inherit; }
.menu .items button:hover:not(:disabled) { background: #2a2f40; }
.menu .items button:disabled { color: var(--dim); cursor: default; }
.menu .items hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
#zones { flex: 1; display: flex; min-height: 0; }
#zones > section { display: flex; flex-direction: column; min-width: 120px; min-height: 0; background: var(--bg); }
.splitter { width: 5px; cursor: col-resize; background: var(--line); flex: none; }
.splitter:hover, .splitter.drag { background: var(--accent); }
.bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.bar .grow, .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, select, input, textarea { font: inherit; color: var(--text); background: #232736; border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; }
button { cursor: pointer; } button:hover:not(:disabled) { border-color: var(--accent); } button:disabled { opacity: .5; cursor: default; }
#stage { flex: 1; min-height: 0; position: relative; background: #0d0f16; }
#stage ferret-player { position: absolute; inset: 0; }
#log { height: 22%; min-height: 60px; overflow: auto; padding: 6px 8px; font: 12px/1.4 ui-monospace, Consolas, monospace; border-top: 1px solid var(--line); background: var(--panel); white-space: pre-wrap; }
#log .err { color: #ff8a80; } #log .ok { color: #9ccc65; }
#tree { height: 30%; min-height: 80px; overflow: auto; padding: 4px 0; border-bottom: 1px solid var(--line); background: var(--panel); }
#tree .row { padding: 1px 8px; cursor: pointer; white-space: nowrap; user-select: none; }
#tree .row:hover { background: #2a2f40; } #tree .row.sel { background: #3a3150; }
#tree .dir { color: var(--dim); }
#code { flex: 1; min-height: 0; }
#chat-log { flex: 1; overflow: auto; padding: 8px; } .hint { color: var(--dim); }
#chat-form { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
#modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 50; }
#modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; min-width: 360px; max-width: 80vw; max-height: 85vh; overflow: auto; }
#modal h2 { margin: 0 0 12px; font-size: 15px; }
#modal label { display: flex; gap: 8px; align-items: center; margin: 6px 0; } #modal label span { width: 120px; color: var(--dim); }
#modal label input:not([type=checkbox]), #modal label select, #modal label textarea { flex: 1; }
#modal .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#modal table { border-collapse: collapse; width: 100%; } #modal td, #modal th { padding: 2px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.msg { margin: 6px 0; padding: 6px 8px; border-radius: 6px; white-space: pre-wrap; } .msg.user { background: #2a3350; } .msg.caroline { background: #1f2a22; } .msg.error { background: #43211f; }
.tool { color: var(--dim); font-size: 12px; margin: 2px 0 2px 8px; }
.changes { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; padding: 6px; border: 1px solid var(--line); border-radius: 6px; } .changes button { text-align: left; }
#chat-form.busy button { background: #7a3030; }

#signin { padding: 48px 24px; max-width: 420px; margin: 0 auto; font-size: 16px; }
#signin[hidden] { display: none; }
#signin form { display: flex; flex-direction: column; gap: 12px; }
#signin label { display: flex; flex-direction: column; gap: 4px; }
#signin input { font: inherit; padding: 6px 8px; }
#signin button { font: inherit; padding: 8px; cursor: pointer; }
#signin-error { color: #e5484d; min-height: 1.2em; margin: 0; }
