:root {
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #e9e8e0;
  font-size: 13px;
  background: transparent;
  --surface: #1a1c19;
  --line: #ffffff0d;
  --muted: #979c8e;
  --accent: #c1cd99;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; display: grid; place-items: center; background: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
#panel { position: relative; display: flex; flex-direction: column; width: min(1040px, 92vw); max-height: 92vh; overflow: hidden; background: var(--surface); border: 1px solid #ffffff12; border-radius: 16px; box-shadow: 0 32px 100px #0008, 0 4px 18px #0004; animation: arrive .22s ease-out; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 22px 32px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 43px; border-radius: 10px; background: #c1cd9910; border: 1px solid #c1cd9925; color: var(--accent); }
.brand-mark svg { width: 25px; height: 25px; }
.brand-name { margin: 0 0 5px; font-size: 16px; font-weight: 600; letter-spacing: -.4px; }
.brand-name span { color: var(--accent); }
.brand-studio { margin: 0; font-size: 8px; letter-spacing: 2px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.private-badge { color: var(--muted); font-size: 11px; display: flex; gap: 7px; align-items: center; }
.private-badge svg { width: 14px; height: 14px; color: var(--accent); }
.topbar-divider { width: 1px; height: 22px; background: var(--line); }
.icon { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.icon:hover { color: #eeeee5; background: #ffffff08; }
.book-heading { display: flex; justify-content: space-between; align-items: center; padding: 32px 36px 31px; flex-shrink: 0; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: 1.8px; font-weight: 500; margin: 0 0 12px; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; }
h1 { font-size: 38px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -1.2px; }
h1 span { color: var(--accent); }
#subtitle { color: var(--muted); margin: 0; font-size: 12px; line-height: 1.6; }
.book-total { text-align: right; padding: 0 3px 0 28px; border-left: 1px solid #ffffff10; }
.book-total span { display: block; color: var(--muted); font-size: 10px; }
.book-total #total { font-family: Georgia, serif; font-size: 37px; line-height: 1.2; color: var(--accent); margin-bottom: 6px; }
.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; border-top: 1px solid var(--line); overflow: auto; }
#memories { padding: 24px 22px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: #15171366; min-width: 0; }
.library-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 3px; }
.library-heading label { margin: 0; color: #bbbfb1; letter-spacing: 1.5px; }
.count-badge { display: grid; place-items: center; min-width: 24px; height: 20px; padding: 0 6px; background: #ffffff07; border: 1px solid #ffffff0a; border-radius: 5px; color: #abae9f; font-size: 10px; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: #ffffff03; border: 1px solid #ffffff10; border-radius: 7px; }
.search-box > svg { color: #8b907f; width: 16px; height: 16px; }
.search-box:focus-within { border-color: #c1cd9970; }
.search-box input { padding: 12px 0; min-width: 0; border: 0; background: transparent; font-size: 11px; }
.search-box input:focus { outline: none; box-shadow: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .icon { width: 20px; height: 24px; flex-shrink: 0; }
.search-box .icon svg { width: 14px; height: 14px; }
.list-heading { display: flex; justify-content: space-between; margin: 23px 3px 12px; font-size: 8px; letter-spacing: 1.1px; color: #939a85; }
.list-heading span:last-child { color: #797f71; letter-spacing: .9px; }
#list { display: grid; align-content: start; gap: 6px; max-height: 284px; overflow-y: auto; padding: 2px; margin: -2px; scrollbar-gutter: stable; }
.memory { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-width: 0; padding: 12px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #d4d7cb; transition: background .15s, border-color .15s; }
.memory:hover { background: #ffffff04; }
.memory.selected { border-color: #c1cd992b; background: #c1cd990b; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; color: #bfc99e; background: #bfc99e0d; border: 1px solid #bfc99e18; font-size: 12px; font-weight: 500; letter-spacing: .5px; }
.avatar.tone-1 { color: #c4b1a0; background: #c4b1a00d; border-color: #c4b1a018; }
.avatar.tone-2 { color: #a5bbbf; background: #a5bbbf0d; border-color: #a5bbbf18; }
.avatar.tone-3 { color: #b6acc7; background: #b6acc70d; border-color: #b6acc718; }
.memory-copy { min-width: 0; flex: 1; }
.memory strong { display: block; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memory small { display: block; color: #959b8a; margin-top: 6px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memory-arrow { width: 15px; height: 15px; color: #929a7f; opacity: 0; }
.memory.selected .memory-arrow, .memory:hover .memory-arrow, .memory:focus-visible .memory-arrow { opacity: 1; }
.library-empty { padding: 24px 8px; text-align: center; color: var(--muted); line-height: 1.7; font-size: 11px; }
.library-empty > svg { color: var(--accent); width: 28px; height: 28px; margin-bottom: 4px; }
#empty-title { color: #c6cabe; }
.library-tip { display: flex; align-items: flex-start; gap: 9px; padding: 19px 5px 0; margin-top: auto; color: #b5bba7; }
.tip-dot { width: 4px; height: 4px; border-radius: 50%; background: #aab88b; margin-top: 6px; flex-shrink: 0; }
.library-tip p { margin: 0; font-size: 10px; line-height: 1.8; }
.library-tip strong, .privacy strong { font-weight: inherit; }
.library-tip span:not(.tip-dot) { color: #939a86; }
.editor { padding: 28px 34px 22px; min-width: 0; display: flex; flex-direction: column; }
.editor-empty { flex: 1; min-height: 328px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 0 10px; }
.journal-art { width: 160px; height: 146px; margin-bottom: 14px; }
.journal-art svg { width: 100%; height: 100%; }
.art-orbit { stroke: #c1cd9911; stroke-dasharray: 3 6; }
.art-orbit.inner { stroke: #c1cd990b; stroke-dasharray: none; }
.art-book { fill: #c1cd9905; stroke: #b6c193; stroke-width: 1.5; }
.art-lines { stroke: #b6c19660; }
.art-spark { stroke: #b6c19670; }
.art-dot { fill: #a4b27970; stroke: none; }
.editor-empty .eyebrow { color: #9ba887; font-size: 8px; letter-spacing: 1.6px; }
.editor-empty h2 { margin: 1px 0 12px; font-size: 27px; letter-spacing: -.5px; }
.editor-empty > p:not(.eyebrow) { color: var(--muted); line-height: 1.9; font-size: 11px; margin: 0; }
.empty-shortcut { display: flex; align-items: center; gap: 12px; font-size: 9px; color: #969e87; margin-top: 26px; }
.shortcut-line { width: 18px; height: 1px; background: #c1cd9920; }
.empty-shortcut kbd { color: #c6ceb5; font-family: inherit; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-heading .eyebrow { margin-bottom: 10px; font-size: 8px; }
.editor-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.65px; overflow-wrap: anywhere; line-height: 1.25; }
.editor-avatar { width: 45px; height: 45px; font-size: 15px; border-radius: 13px; }
.editor-description { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 12px 0 27px; }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.field-heading label { color: #d3d7c9; font-size: 11px; }
.field-tag { color: #9ca68b; font-size: 7px; letter-spacing: 1.1px; padding: 4px 6px; border: 1px solid #c1cd9915; border-radius: 4px; }
.optional { color: #959d89; font-size: 10px; margin-left: 4px; }
input, textarea, select { color-scheme: dark; width: 100%; border: 1px solid #ffffff13; border-radius: 7px; padding: 13px 14px; background: #12140f60; color: #e4e7dc; outline: none; transition: border-color .15s; }
input:focus, textarea:focus, select:focus { border-color: #c1cd9960; box-shadow: 0 0 0 3px #c1cd9905; }
input:disabled, textarea:disabled { opacity: .45; }
input::placeholder, textarea::placeholder { color: #949b88; }
textarea { resize: vertical; min-height: 118px; max-height: 200px; line-height: 1.9; font-size: 12px; }
.field-caption { display: flex; justify-content: space-between; gap: 12px; color: #989f8e; font-size: 9px; line-height: 1.7; margin: 7px 0 0; }
.counter { flex-shrink: 0; color: #a1a992; font-variant-numeric: tabular-nums; }
.counter.invalid { color: #e7a79b; }
.note-heading { margin-top: 23px; }
.note-heading svg { width: 14px; height: 14px; color: #8d957e; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
.actions button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 15px; border-radius: 6px; border: 1px solid transparent; font-size: 11px; font-weight: 500; transition: background .15s; }
.actions button svg { width: 15px; height: 15px; }
#save, #pick { background: var(--accent); color: #242b19; min-width: 135px; margin-left: auto; }
#save:hover:not(:disabled), #pick:hover:not(:disabled) { background: #d1dcb1; }
.danger { background: transparent; color: #d8a29a; }
.danger:hover:not(:disabled) { background: #d8a29a0c; border-color: #d8a29a20; }
.secondary { background: #ffffff08; color: #d4d8cb; }
.secondary:hover { background: #ffffff10; }
#message { min-height: 16px; color: var(--accent); font-size: 11px; margin: 10px 0 8px; line-height: 1.5; }
#message.error { color: #e7a79b; }
.privacy { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: auto; }
.privacy > svg { width: 18px; height: 18px; color: #a2af8b; }
.privacy p { font-size: 10px; line-height: 1.7; color: #b5bca8; margin: 0; }
.privacy p span { display: block; font-size: 9px; color: #969e87; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 28px; border-top: 1px solid var(--line); background: #14161280; color: #989f8d; font-size: 9px; flex-shrink: 0; }
.footer-signature { display: flex; align-items: center; gap: 7px; font-size: 7px; letter-spacing: 1px; }
.status-dot { width: 5px; height: 5px; background: #a9b98c; border-radius: 50%; box-shadow: 0 0 7px #a9b98c20; }
.escape-hint { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.escape-hint kbd { font-family: inherit; font-size: 8px; color: #bfc5b3; padding: 3px 5px; border-radius: 4px; border: 1px solid #ffffff15; background: #ffffff03; }
#confirmation { position: absolute; inset: 0; z-index: 2; background: #0c0e0bef; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.confirm-card { background: #1e211b; border: 1px solid #ffffff13; border-radius: 13px; padding: 30px; max-width: 400px; width: 100%; box-shadow: 0 20px 50px #0005; }
.confirm-symbol { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #d8a29a0c; color: #d8a29a; margin-bottom: 24px; }
.confirm-card .eyebrow { color: #c5a498; font-size: 8px; }
.confirm-card h2 { font-size: 28px; margin: 0 0 16px; }
.confirm-card p:not(.eyebrow) { color: #aab29c; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
#confirm-alias { color: #e0e4d8; font-weight: 500; }
.confirm-card .danger { background: #d8a29a12; border-color: #d8a29a20; }
.confirm-card .actions { justify-content: space-between; margin-top: 24px; }
#panel.target { max-width: 590px; }
#panel.target .layout { grid-template-columns: 1fr; }
#panel.target .book-heading { padding: 26px 32px; }
#panel.target h1 { font-size: 32px; }
#panel.target .footer-help { display: none; }
.picker-hint { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 12px 0 0; }
select { cursor: pointer; text-overflow: ellipsis; font-size: 12px; }
select option { background: var(--surface); color: #e4e7dc; }
/* Picker: compact and low on screen so the numbers over people's heads stay visible. */
#panel.pick { align-self: end; margin-bottom: 5vh; }
#panel.pick .book-heading, #panel.pick footer, #panel.pick .privacy, #panel.pick .editor-description { display: none; }
#panel.pick #pick-form { margin-top: 22px; }
* { scrollbar-width: thin; scrollbar-color: #8e9a7040 transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #8e9a7040; border-radius: 10px; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-height: 800px) and (min-width: 761px) {
  .topbar { padding-top: 15px; padding-bottom: 15px; }
  .book-heading { padding-top: 22px; padding-bottom: 22px; }
  .editor { padding-top: 22px; }
  .editor-description { margin-bottom: 20px; }
  #list { max-height: 248px; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 270px minmax(0, 1fr); }
  .topbar { padding: 18px 22px; }
  .book-heading { padding: 26px; }
  h1 { font-size: 32px; }
  #memories { padding: 22px 16px; }
  .editor { padding: 24px 22px 18px; }
  .field-tag, .footer-help, .shortcut-line { display: none; }
  .editor-heading h2 { font-size: 25px; }
  .editor-avatar { width: 37px; height: 37px; }
  .field-caption { font-size: 8px; }
  .empty-shortcut { font-size: 8px; }
  footer { padding: 14px 22px; }
}
@media (max-width: 600px) {
  #panel { max-height: 94vh; width: 94vw; border-radius: 12px; }
  .topbar { padding: 16px 20px; }
  .topbar-actions { gap: 10px; }
  .private-badge { font-size: 0; gap: 0; }
  .private-badge svg { width: 16px; height: 16px; }
  .book-heading { padding: 22px 20px; gap: 12px; }
  .book-heading .eyebrow { font-size: 7px; letter-spacing: 1.2px; }
  h1 { font-size: 29px; }
  #subtitle { font-size: 10px; }
  .book-total { padding-left: 15px; }
  .book-total #total { font-size: 28px; }
  .book-total span { font-size: 8px; max-width: 60px; }
  .layout { grid-template-columns: 1fr; }
  #memories { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; }
  #list { max-height: 160px; }
  .library-tip { display: none; }
  .list-heading { margin-top: 18px; }
  .editor { padding: 24px 20px 20px; }
  .editor-empty { min-height: 260px; }
  .journal-art { width: 130px; height: 115px; }
  .privacy p span { font-size: 8px; }
  .actions button { padding: 11px 12px; font-size: 10px; }
  footer { padding: 13px 20px; gap: 8px; }
  .footer-signature { font-size: 6px; letter-spacing: .6px; }
  #panel.target .book-heading { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) { #panel { animation: none; } * { transition: none !important; } }
