:root {
  --accent: #a51d24;
  --accent-hover: #84151b;
  --ink: #252328;
  --muted: #747078;
  --line: #eae7eb;
  --soft: #fff8f8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fff;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
body.space-background { background: transparent; isolation: isolate; }
body.space-background::before { content:""; position:fixed; inset:0; z-index:-1; background-image:linear-gradient(#ffffffea,#ffffffea),var(--space-background); background-size:cover; background-position:center; filter:saturate(.72); }
button, input, textarea { font: inherit; }
button, a, input, textarea { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.site-header {
  max-width: 1040px; margin: auto; padding: 24px 32px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; font-size: 17px; font-weight: 650; color: var(--accent); letter-spacing: -.4px; }
main { max-width: 1040px; margin: auto; padding: 0 32px 64px; }
main:focus { outline: none; }
h1, h2, h3 { letter-spacing: -.7px; line-height: 1.25; font-weight: 600; }
h1 { font-size: 30px; margin: 0 0 28px; }
h2 { font-size: 19px; margin: 0 0 20px; }
h3 { font-size: 19px; margin: 14px 0 10px; }
p { line-height: 1.65; }
.hidden { display: none !important; }
.welcome { max-width: 360px; margin: 80px auto 0; }
.login-card h1 { font-size: 26px; }
label:not(.search):not(.upload-label):not(.notification-choice) { display: block; font-size: 14px; font-weight: 500; margin: 24px 0 9px; }
input:not([type=file]):not([type=checkbox]), textarea {
  width: 100%; padding: 13px 14px; border: 1px solid #dcd8df;
  border-radius: 8px; background: #fff; color: var(--ink); font-size: 16px;
}
input::placeholder, textarea::placeholder { color: #96919a; }
textarea { resize: vertical; line-height: 1.7; }
.primary, .record-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 12px 18px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 550;
}
.primary:hover, .record-button:hover { background: var(--accent-hover); }
.wide { width: 100%; }
#login-form .primary { margin-top: 20px; }
.quiet, .back {
  background: transparent; border: 0; color: var(--muted); padding: 12px 0; font-size: 14px;
}
.quiet:hover, .back:hover { color: var(--accent); }
.danger { color: #8b2027; }
.danger:hover { color: #681218; }
.back { margin-bottom: 24px; }
.error { color: #a0253c; font-size: 14px; white-space: pre-line; }
.error:empty { margin: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 48px 0 30px; }
.page-heading h1 { margin: 0; }
.library-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 20px; font-size: 13px; color: var(--muted); }
.search { width: 260px; }
.search input { font-size: 14px; padding: 11px 13px; }
.memory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.memory-card {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  width: 100%; min-height: 170px; padding: 22px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); transition: border-color .15s;
}
.memory-card:hover { border-color: #ca777c; }
.memory-card h3 { overflow-wrap: anywhere; }
.memory-card p { font-size: 14px; color: var(--muted); margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.card-author { color: var(--muted); font-size: 12px; margin: -4px 0 12px; }
.card-meta { display: flex; justify-content: space-between; width: 100%; gap: 12px; color: var(--muted); font-size: 12px; }
.card-meta .audio-label { color: var(--accent); }
.media-kind { display:inline-flex;align-items:center;gap:6px;color:var(--accent); }
.media-kind svg { width:19px;height:19px;flex-shrink:0; }
.media-kind > span { color:var(--muted); }
.install-footer {text-align:center;padding:0 20px 130px;}
.install-footer:has(.hidden) {display:none;}
.install-dialog p,.install-dialog li {font-size:14px;line-height:1.65;}
.install-dialog ol {padding-left:22px;}
.install-dialog li {margin:12px 0;}
.install-dialog .capture-actions {gap:12px;flex-wrap:wrap;}
.empty { grid-column: 1 / -1; padding: 64px 16px; text-align: center; }
.empty h2 { color: var(--muted); font-size: 17px; font-weight: 400; }
.empty p { color: var(--muted); font-size: 14px; }
.editor, .detail { max-width: 680px; margin: 32px auto 0; }
.audio-panel { padding: 24px; margin-bottom: 28px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.record-button { border-radius: 24px; }
.record-button.recording { background: #a0253c; }
#record-status { font-size: 13px; color: var(--muted); margin: 12px 0; }
#record-status:empty { display: none; }
.upload-label { display: block; color: var(--accent); cursor: pointer; font-size: 14px; margin: 20px 0 10px; }
input[type=file] { max-width: 100%; font-size: 12px; color: var(--muted); }
input[type=file]::file-selector-button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 8px; color: var(--ink); margin-right: 10px; cursor: pointer; }
.fine-print { color: var(--muted); font-size: 12px; margin-bottom: 0; }
.optional { color: var(--muted); font-weight: 400; font-size: 12px; }
audio { width: 100%; display: block; margin: 20px auto; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 24px; }
.context { border-left: 2px solid var(--accent); padding: 10px 14px; margin: 0 0 24px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.detail h1 { margin-bottom: 12px; overflow-wrap: anywhere; }
.detail-meta { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.story-text { font-size: 17px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; margin: 28px 0; }
.status-note { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 20px 0; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; margin: 32px 0; }
.related-section { border-top: 1px solid var(--line); padding-top: 28px; margin-top: 40px; }
.related-list { display: grid; gap: 12px; }
.related-list .memory-card { min-height: 130px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 14px 20px; max-width: 90vw; border-radius: 8px; background: var(--ink); color: #fff; font-size: 14px; z-index: 20; }
.loading { padding: 60px 0; color: var(--muted); font-size: 14px; }
.skip { position: absolute; top: -100px; }
.skip:focus { top: 10px; background: #fff; padding: 12px; z-index: 10; }
details { margin-top: 24px; font-size: 13px; color: var(--muted); }
summary { cursor: pointer; }
details p { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .site-header { padding: 18px 20px; }
  main { padding: 0 20px 40px; }
  .brand { font-size: 16px; }
  .welcome { margin-top: 48px; }
  .page-heading { padding-top: 32px; gap: 14px; }
  .page-heading h1 { font-size: 26px; }
  .page-heading .primary { padding: 12px 14px; font-size: 13px; }
  .library-bar { align-items: stretch; flex-direction: column; gap: 14px; }
  .search { width: 100%; }
  .memory-grid { grid-template-columns: 1fr; }
  .memory-card { padding: 20px; min-height: 150px; }
  .editor, .detail { margin-top: 20px; }
  .editor h1, .detail h1 { font-size: 27px; }
  .audio-panel { padding: 22px 16px; }
  .form-actions .primary { width: 100%; }
  .detail-actions { gap: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.library { padding-top: 36px; padding-bottom: 110px; }
.capture-dock { position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 10px; border: 1px solid var(--line); border-radius: 50px; background: #fffffff5; box-shadow: 0 4px 22px #0000000b; }
.capture-button { width: 64px; height: 64px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.capture-button:hover { background: var(--accent-hover); }
.capture-button svg { width: 27px; height: 27px; }
.video-capture {position:absolute;right:calc(100% + 76px);width:48px;height:48px;display:grid;place-items:center;border:1px solid var(--line);background:#fff;border-radius:50%;color:var(--accent);}
.video-capture svg {width:23px;height:23px;}
.video-capture:hover {border-color:var(--accent);}
video {width:100%;max-height:70vh;background:#111;border-radius:8px;}
progress {display:block;width:100%;margin-top:20px;accent-color:var(--accent);}
.alternative-capture { position: absolute; left: calc(100% + 16px); width: 42px; height: 42px; display: grid; place-items: center; background: #fff; color: var(--muted); border: 1px solid var(--line); border-radius: 50%; }
.alternative-capture svg { width: 18px; height: 18px; }
.capture-dialog { width: min(400px, calc(100vw - 32px)); padding: 32px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff; }
.capture-dialog::backdrop { background: #17131555; }
.capture-dialog h2 { margin: 0 0 24px; font-size: 22px; }
.capture-recording { text-align: center; }
.capture-time { display: block; font-size: 36px; font-variant-numeric: tabular-nums; margin: 24px 0; letter-spacing: -1px; }
.capture-stop { margin: 0 auto 16px; width: 64px; height: 64px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.capture-stop span { width: 21px; height: 21px; background: currentColor; border-radius: 3px; }
.capture-dialog .capture-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; }
.capture-dialog label { margin-top: 0 !important; }
.capture-dialog .error { margin-bottom: 0; }
.capture-dialog .quiet { min-height: 44px; }
.toast { bottom: 126px; }
@media (max-width: 620px) { .library { padding-top: 24px; } .capture-dialog { padding: 28px 24px; } }

.photo-capture { position: absolute; right: calc(100% + 16px); width: 48px; height: 48px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--line); border-radius: 50%; background: #fff; }
.photo-capture svg { width: 23px; height: 23px; }
.photo-capture:hover, .alternative-capture:hover { border-color: var(--accent); }
.card-photo { width: calc(100% + 44px); margin: -22px -22px 18px; height: 210px; object-fit: cover; border-radius: 9px 9px 0 0; }
.photo-dialog { width: min(480px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff; }
.photo-dialog::backdrop { background: #17131555; }
.photo-dialog h2 { font-size: 22px; }
.photo-dialog .photo-help { font-size: 13px; color: var(--muted); margin-top: 0; }
.photo-selection { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 18px 0; }
.photo-selection img { width: 100%; height: 96px; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; }
.photo-dialog .capture-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; }
.photo-gallery { display: grid; gap: 20px; margin: 28px 0; }
.photo-figure { margin: 0; }
.photo-view { display: block; width: 100%; height: auto; max-height: 75vh; object-fit: contain; border-radius: 8px; background: #fafafa; }
.photo-download { display: inline-block; font-size: 12px; color: var(--muted); text-decoration: none; margin-top: 10px; padding: 4px 0; }
.photo-download:hover { color: var(--accent); }
.photo-related { color: var(--accent); }
@media (max-width:620px) { .card-photo { width: calc(100% + 40px); margin: -20px -20px 16px; height: 200px; } .photo-dialog { padding: 24px; } }

.header-actions {display:flex;align-items:center;gap:20px;}
.notification-choice {display:flex;align-items:flex-start;gap:10px;font-size:13px;line-height:1.5;margin:22px 0 16px;color:var(--muted);cursor:pointer;}
.notification-choice input {width:17px;height:17px;flex-shrink:0;margin:1px 0 0;accent-color:var(--accent);}
.notification-email {font-size:14px;color:var(--muted);overflow-wrap:anywhere;}
.notification-state {font-size:13px;color:var(--muted);line-height:1.6;}
@media(max-width:620px){.header-actions{gap:16px;}.header-actions .quiet{font-size:12px;}}

.admin-dashboard { padding: 44px 0 80px; }
.admin-title, .space-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; }
.admin-title { margin-bottom:28px; }
.admin-title h1, .space-heading h2 { margin:0; }
.spaces-list { display:grid; gap:20px; }
.space-card { border:1px solid var(--line); border-radius:12px; padding:26px; }
.space-count, .field-help { color:var(--muted); font-size:13px; margin:5px 0 0; }
.space-card > label { margin-top:24px !important; }
.invite-row { display:flex; gap:10px; }
.invite-row input { font-size:13px !important; color:var(--muted); }
.quiet-button { border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); padding:10px 14px; }
.quiet-button:hover { border-color:var(--accent); }
.space-members { margin:26px 0 0; }
.space-members h3 { font-size:14px; margin:0 0 10px; }
.member-list { border-top:1px solid var(--line); }
.member-row { display:flex; justify-content:space-between; gap:20px; padding:11px 0; border-bottom:1px solid var(--line); font-size:13px; }
.member-row strong, .member-row span { display:block; }
.member-row span, .member-row time { color:var(--muted); }
.knowledge { border-top:1px solid var(--line); margin-top:26px; padding-top:18px; }
.knowledge summary { color:var(--ink); font-size:14px; font-weight:550; }
.knowledge form { margin-top:18px; }
.admin-field label { margin-top:18px !important; }
.admin-field textarea { font-size:14px; }
.knowledge .primary { margin-top:22px; }
.new-space { display:flex; gap:10px; padding:18px; margin-bottom:20px; background:var(--soft); border-radius:10px; }
.background-editor { display:flex; align-items:center; gap:16px; margin:22px 0 4px; padding:14px; background:#faf9fa; border-radius:10px; }
.background-preview { width:92px; height:62px; flex:0 0 auto; overflow:hidden; border-radius:7px; background:#eeebee; }
.background-preview img { width:100%; height:100%; object-fit:cover; }
.background-editor label { margin:0 !important; }
.background-editor input[type=file] { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.background-editor .field-help { flex:1; }
@media(max-width:620px){.admin-dashboard{padding-top:28px}.admin-title{align-items:center}.space-card{padding:20px}.space-heading{display:block}.space-count{display:block;margin-top:8px}.invite-row,.new-space{flex-direction:column}.member-row{display:block}.member-row time{display:block;margin-top:5px}}
