/* ClaudeWriter web editor. No animations or transitions anywhere, by design. */
:root {
  color-scheme: light dark;
  --bg: #ffffff; --panel: #f5f5f4; --line: #dcdcda; --text: #1c1c1a; --muted: #6b6b68; --dim: #a3a3a0;
  --accent: #6d3fd6; --accent-text: #ffffff; --note: #8b3fd9; --note-bg: rgba(139, 63, 217, 0.13);
  --add-bg: rgba(46, 160, 67, 0.24); --del: #cf3535; --del-bg: rgba(207, 53, 53, 0.12); --link: #1a6fd6;
  --serif: "New York", ui-serif, "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e; --panel: #262626; --line: #3a3a3a; --text: #ecece8; --muted: #a0a09c; --dim: #6e6e6a;
    --accent: #8f63f0; --note: #c77dff; --note-bg: rgba(199, 125, 255, 0.16);
    --add-bg: rgba(63, 185, 80, 0.26); --del: #ff6b6b; --del-bg: rgba(255, 107, 107, 0.14); --link: #6cb0ff;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 var(--sans); }
[hidden] { display: none !important; }
.spacer { flex: 1; }
button, select, input, textarea { font: inherit; color: inherit; }
button, select { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:disabled { color: var(--dim); cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
input, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; }
h1, h2 { margin: 0; }
.error { color: var(--del); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }

/* Home */
#home { min-height: 100%; display: flex; align-items: flex-start; justify-content: center; padding: 9vh 20px; }
.home-card { width: 100%; max-width: 520px; }
.home-card h1 { font: 700 34px var(--serif); }
.home-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 30px 0 8px; }
.lede { color: var(--muted); font-size: 16px; margin: 10px 0 24px; }
#code-row { margin-bottom: 14px; }
#code-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
#new-doc { padding: 9px 18px; font-size: 15px; }
#open-form { display: flex; gap: 8px; }
#recents { list-style: none; margin: 0; padding: 0; }
#recents li { border-top: 1px solid var(--line); }
#recents a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; color: var(--text); text-decoration: none; }
#recents a span:last-child { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Editor shell */
#app { height: 100%; display: flex; flex-direction: column; }
#bar, #review-bar, #status { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--panel); }
#bar { border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#review-bar { border-bottom: 1px solid var(--line); }
#status { border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); padding: 4px 12px; }
#home-link { font-weight: 700; color: var(--accent); text-decoration: none; padding: 2px 4px; }
#doc-title { font-weight: 600; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#model { max-width: 190px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; min-width: 210px; max-height: 70vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 5px; padding: 6px 10px; }
.menu button:hover { background: var(--panel); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
#hunk-menu { position: fixed; right: auto; top: 0; left: 0; }
main { flex: 1; display: flex; min-height: 0; }
#stage { flex: 1; position: relative; min-width: 0; }
#editor, #review { position: absolute; inset: 0; overflow: auto; }
#presence .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
#message { margin-right: 14px; }

/* Text column, shared by the editor and the review view */
#review-text { max-width: 780px; margin: 0 auto; padding: 34px 24px 40vh; }
#review-text { font: 17px/1.62 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
#review-text.streaming { color: var(--muted); }
.cm-selectionBackground { background: rgba(120, 140, 255, 0.28) !important; }
.cw-note, .cw-note * { color: var(--note) !important; }
.cw-note { background: var(--note-bg); border-radius: 3px; }
.cw-caret { position: relative; border-left: 2px solid; margin-left: -1px; margin-right: -1px; }
.cw-caret-label { position: absolute; bottom: 100%; left: -2px; font: 600 9px var(--sans); color: #fff; padding: 0 4px; border-radius: 2px; white-space: nowrap; line-height: 13px; user-select: none; }
.cm-panels { background: var(--panel); color: var(--text); border-color: var(--line); }
.cm-panels input, .cm-panels button { width: auto; }

/* Review */
.hunk { cursor: pointer; border-radius: 3px; }
.hunk del { color: var(--del); background: var(--del-bg); }
.hunk ins { background: var(--add-bg); text-decoration: none; }
ins { background: var(--add-bg); text-decoration: none; }
del { color: var(--del); background: var(--del-bg); }

/* Assistant */
#assistant { width: 340px; flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); }
.assistant-head { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
#chat-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: color-mix(in srgb, var(--accent) 18%, transparent); padding: 6px 10px; border-radius: 10px; max-width: 90%; }
.msg-actions { display: flex; gap: 10px; margin-top: 4px; }
.msg-actions button { background: none; border: 0; padding: 0; color: var(--link); font-size: 12px; }
#chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
#chat-input { resize: none; }
@media (max-width: 760px) { #assistant { position: absolute; inset: 0; width: auto; z-index: 20; } main { position: relative; } }

/* Dialogs */
dialog { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(520px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog h2 { font-size: 17px; margin-bottom: 8px; }
dialog label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.copy-row { display: flex; gap: 8px; }
.dialog-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#versions-dialog { width: min(920px, 94vw); padding: 0; }
#versions-dialog .dialog-actions { padding: 10px 14px; margin: 0; border-top: 1px solid var(--line); }
.versions { display: flex; height: min(560px, 70vh); }
#version-list { width: 260px; flex: none; overflow: auto; border-right: 1px solid var(--line); padding: 6px; }
#version-list button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; }
#version-list button.selected { background: var(--accent); color: var(--accent-text); }
#version-list small { display: block; opacity: 0.75; }
.version-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#version-note { padding: 8px 16px; margin: 0; border-bottom: 1px solid var(--line); }
#version-preview { flex: 1; overflow: auto; padding: 16px; font: 15px/1.6 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
