:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #26232e; background: #fff; }
#gate { max-width: 560px; margin: 50px auto; padding: 24px; overflow: auto; }
#gate input { display: block; margin: 12px 0; padding: 10px; max-width: 100%; font-size: 16px; }
#book-list a { display: block; padding: 12px 0; }
body:not(.gated) #gate { display: none; }
body.gated > header, body.gated > main, body.gated > nav { display: none; }
.message { margin: 12px 0; padding: 10px; border-left: 3px solid #8660b0; background: #faf8fd; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.raven { border-color: #303947; background: #f3f5f7; }
.message.child { margin-left: 12px; }
.message .byline, .message .parent-preview { font-size: 12px; color: #665d70; }
.message button { min-height: 30px; font-size: 13px; margin-top: 6px; }
#thread-messages { max-height: 30vh; overflow: auto; }
#note .note-head { position: sticky; top: -16px; z-index: 2; background: white; padding: 6px 0; }
#reply-target { font-size: 13px; color: #665d70; }
#selection-tools { max-width: calc(100% - 16px); gap: 5px; font-size: 13px; }
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; padding: max(6px, env(safe-area-inset-top)) 16px 6px; border-bottom: 1px solid #ddd9e4; background: white; }
.title { font-weight: 650; font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#settings-open { flex-shrink: 0; border: none; font-size: 14px; }
#settings { width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 18px; color: #26232e; background: white; border: 1px solid #c8c0d2; border-radius: 12px; overflow: auto; }
#settings::backdrop { background: #21152f45; }
#settings .controls { margin-top: 20px; gap: 10px; }
#settings #diagnostics { margin-top: 18px; padding: 12px 0 0; max-height: none; background: white; }
#notice { position: fixed; top: 60px; left: 16px; right: 16px; z-index: 6; padding: 10px; background: #fff3e8; border: 1px solid #a75a20; font-size: 14px; }
small { display: inline-block; font-size: 12px; color: #625d6b; font-weight: 400; margin-left: 6px; }
.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; font-size: 14px; }
button, select, textarea { font: inherit; }
button, select { min-height: 40px; border: 1px solid #c8c0d2; border-radius: 7px; background: #fff; color: #49336b; padding: 6px 10px; }
button:disabled { opacity: .45; }
button:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #70519c; outline-offset: 2px; }
#status { font-size: 13px; color: #595361; margin: 8px 0 0; min-height: 18px; }
#workspace { flex: 1; min-height: 0; display: flex; position: relative; }
#pagination { display: flex; flex-shrink: 0; justify-content: center; align-items: center; gap: 18px; padding: 6px 12px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid #ddd9e4; font-size: 14px; }
#page-number { min-width: 100px; text-align: center; }
#selection-tools { bottom: calc(68px + env(safe-area-inset-bottom)) !important; }
#reader { display: block; border: 0; width: 100%; height: 100%; background: #fff; }
#note { background: #fff; border-top: 1px solid #cfc5db; position: fixed; z-index: 5; left: 0; right: 0; bottom: var(--keyboard-bottom, 0px); max-height: min(62vh, calc(var(--visual-height, 100vh) - 12px)); overflow-y: auto; padding: 16px 18px max(16px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 28px #2314311a; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
blockquote { border-left: 3px solid #8461ad; padding-left: 12px; margin: 12px 0; font-size: 15px; line-height: 1.6; max-height: 90px; overflow: auto; white-space: pre-wrap; }
label[for=draft] { display: block; font-size: 14px; margin-bottom: 7px; }
textarea { display: block; width: 100%; min-height: 90px; resize: vertical; font-size: 16px; line-height: 1.6; padding: 10px; border: 1px solid #bcb0c9; border-radius: 6px; color: #302439; background: #fff; }
#done { margin-top: 8px; }
#save-state { font-size: 13px; margin-bottom: 0; }
#selection-tools { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(45px + env(safe-area-inset-bottom)); display: flex; gap: 8px; white-space: nowrap; padding: 8px; background: #fff; box-shadow: 0 2px 16px #2918402b; border: 1px solid #c9bfd5; border-radius: 9px; z-index: 4; }
[hidden] { display: none !important; }
#diagnostics { flex: 0 0 auto; font-size: 12px; border-top: 1px solid #ddd9e4; padding: 8px 16px max(8px, env(safe-area-inset-bottom)); max-height: 35vh; overflow: auto; background: #faf9fc; }
summary { cursor: pointer; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.editing #reader { pointer-events: none; }
@media (min-width: 900px) { #workspace { padding-right: 340px; } #note { top: 54px; bottom: 54px; left: auto; width: 340px; max-height: none; border-left: 1px solid #ddd9e4; box-shadow: none; } }
