* { box-sizing: border-box; }
:root { color-scheme: dark; font-family: "Segoe UI", system-ui, sans-serif; }
body {
  --bg: #120e0b; --accent: #ff9750; --ink: #fff0e6; --muted: #d2aea0;
  --panel: color-mix(in srgb, var(--bg) 90%, white);
  --line: color-mix(in srgb, var(--accent) 30%, var(--panel));
  --action: color-mix(in srgb, var(--accent) 12%, var(--panel));
  margin: 0; min-height: 100svh; color: var(--ink);
  background: radial-gradient(ellipse at 48% 0, color-mix(in srgb, var(--accent) 12%, var(--bg)), var(--bg) 52%);
}
body.light { --ink: #2b1a12; --muted: #634332; --panel: color-mix(in srgb, var(--bg) 97%, black); color-scheme: light; }
a { color: var(--ink); }
a:hover { text-decoration-color: var(--accent); }
.site { width: min(100% - 36px, 1380px); margin: 0 auto; }
.topbar { min-height: 77px; display: flex; gap: 14px 28px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 4px 8px; flex-wrap: wrap; }
.topbar a { text-decoration: none; }
.topbar nav a, .profile-link { padding: 7px 10px; border-radius: 7px; }
.topbar nav a:hover, .topbar nav a[aria-current], .profile-link:hover { background: var(--action); }
.wordmark { font: 700 clamp(1.2rem, 3vw, 1.6rem)/1.2 Georgia, serif; white-space: nowrap; }
.wordmark span, .wordmark em { color: var(--accent); }
.profile-link { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 30px; aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.avatar-initial { display: grid; place-items: center; background: var(--action); border: 1px solid var(--line); }
.large-avatar { width: 100px; margin-bottom: 18px; }
main { padding: 26px 0 50px; }
h1, h2, h3 { font-family: Georgia, serif; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); margin: 0; font-weight: 500; }
h2 { margin: 0 0 12px; font-weight: 500; }
h3 a { text-decoration-thickness: 1px; text-underline-offset: 4px; }
p { line-height: 1.55; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-heading p { margin: 5px 0 0; color: var(--muted); }
main:has(> .page-heading), main:has(> .back-link) { max-width: 1000px; margin-inline: auto; }
.panel { padding: clamp(15px, 3vw, 26px); margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.stack { display: grid; gap: 13px; }
.stack > .panel { margin: 0; }
.stack button { justify-self: start; }
label { display: grid; gap: 6px; }
input, textarea, select, button { font: inherit; color: inherit; }
input:not([type=range]), textarea, select { min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 5px; padding: 8px 10px; }
input[type=color] { width: 70px; height: 42px; padding: 4px; }
textarea { resize: vertical; width: 100%; }
button { padding: 7px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--action); cursor: pointer; }
button:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 23%, var(--panel)); }
button:disabled { opacity: .65; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.muted, .helptext, figcaption { color: var(--muted); }
.error, .errorlist { color: #ef755e; }
.login-card { max-width: 480px; margin: clamp(22px, 12vh, 120px) auto; padding: clamp(23px, 4vw, 44px); }
.login-mark { font-size: 2rem; display: block; margin-bottom: 12px; color: var(--accent); }
.login-card form > div { display: grid; gap: 5px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tabs a { padding: 9px 12px; text-decoration: none; border: 1px solid var(--line); border-radius: 6px; }
.tabs a[aria-current] { background: var(--action); }
summary { cursor: pointer; font-weight: 650; }
details[open] summary { margin-bottom: 15px; }
.prose { overflow-wrap: anywhere; line-height: 1.65; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 18px; text-align: center; }
.calendar-grid > * { min-height: 40px; display: grid; place-content: center; border-radius: 6px; }
.calendar-grid > a { border: 1px solid var(--line); text-decoration: none; }
.calendar-grid > a:hover, .calendar-grid .marked { background: var(--action); }
.calendar-grid .marked span { color: var(--accent); }
.calendar-grid .empty { opacity: .28; }
.date-link { display: block; width: fit-content; padding: 6px 0; }
.back-link { display: block; margin-bottom: 15px; }
.diary-entry { margin-bottom: 14px !important; }
.diary-entry figure { margin: 16px 0; }
.diary-entry img { display: block; max-width: 100%; max-height: 560px; border-radius: 7px; }
.block { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 11px; display: grid; gap: 8px; }
.block-actions button { font-size: .86rem; }
.editor-preview { width: 130px; max-height: 130px; object-fit: cover; border-radius: 5px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr)); gap: 12px; }
.photos figure { margin: 0; }
.photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; }
.collage { grid-auto-flow: dense; }
.collage figure:nth-child(4n + 1) { grid-column: span 2; }
figcaption { padding-top: 5px; font-size: .88rem; }
.terminal { overflow: hidden; border: 1px solid #785037; border-radius: 14px; background: #15100e; color: #ffeadc; font-family: Consolas, "Courier New", monospace; box-shadow: 0 24px 70px #0005; }
.terminal-bar { padding: 13px 20px; border-bottom: 1px solid #785037; background: #251811; font-size: 14px; }
.terminal-bar span, .prompt { color: #f9bd90; }
.terminal-body { padding: 15px clamp(10px, 3vw, 32px); }
.prompt { margin: 0; overflow-wrap: anywhere; }
.prompt span { color: #ff924d; }
canvas { display: block; width: 100%; height: clamp(345px, 68svh, 780px); background: radial-gradient(ellipse at 50% 44%, #321c16 0, transparent 64%); }
.terminal-footer { border-top: 1px solid #62402e; padding-top: 13px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.terminal-footer p { margin: 0; }
.player { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 8px 10px; border: 1px solid #7d5136; border-radius: 8px; background: #241710; font-size: 14px; }
.player button { background: #432819; border-color: #875736; }
.track { display: grid; gap: 3px; max-width: 220px; overflow-wrap: anywhere; }
.track span, .volume, #audio-status { color: #e6bfa6; }
.volume { display: flex; align-items: center; gap: 7px; }
.volume input { width: 65px; accent-color: #ff9750; }
#audio-status { flex-basis: 100%; }
.disc { flex: 0 0 40px; aspect-ratio: 1; border-radius: 50%; border: 1px solid #a57251; background: radial-gradient(circle, #1c1410 0 10%, #f2a664 11% 15%, transparent 16%), repeating-radial-gradient(circle, transparent 0 2px, #1d161060 3px 4px), conic-gradient(#553728, #efae78, #512d25, #ac7056, #553728); animation: rotate-disc 3s linear infinite paused; }
.player.is-playing .disc { animation-play-state: running; }
@keyframes rotate-disc { to { transform: rotate(1turn); } }
@media (max-width: 600px) {
  .site { width: min(100% - 20px, 1380px); }
  .topbar { padding: 12px 0; gap: 5px; }
  .topbar nav { order: 3; flex-basis: 100%; gap: 0; }
  canvas { height: clamp(335px, 56svh, 525px); }
  .collage figure:nth-child(4n + 1) { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { .disc { animation: none; } }

.site-mark { width: 1.9em; height: 1.3em; vertical-align: -.25em; margin-right: .15em; }
.login-mark { width: 74px; height: auto; }
.home-intro { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 16px; }
.home-intro p { margin: 0; color: var(--muted); }
.relationship-clock { display: flex; flex-wrap: wrap; gap: 6px; }
.relationship-clock div { display: grid; place-items: center; min-width: 55px; padding: 5px 9px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; }
.relationship-clock strong { font: 650 1.3rem/1.25 Consolas, monospace; font-variant-numeric: tabular-nums; }
.relationship-clock span { font-size: .75rem; color: var(--muted); }
.terminal {
  --terminal-bg: color-mix(in srgb, var(--bg) 75%, #090709);
  --terminal-line: color-mix(in srgb, var(--accent) 45%, var(--terminal-bg));
  border-color: var(--terminal-line);
  background: var(--terminal-bg);
}
.light .terminal { --terminal-bg: color-mix(in srgb, var(--accent) 15%, #131014); }
.terminal-bar, .player { background: color-mix(in srgb, var(--accent) 11%, var(--terminal-bg)); border-color: var(--terminal-line); }
.terminal-bar span, .prompt span { color: var(--accent); }
.terminal canvas { background: radial-gradient(ellipse at 50% 44%, color-mix(in srgb, var(--accent) 13%, var(--terminal-bg)), transparent 64%); }
.terminal-footer { border-color: var(--terminal-line); }
.player button { background: color-mix(in srgb, var(--accent) 22%, var(--terminal-bg)); border-color: var(--terminal-line); }
.player .track { width: clamp(130px, 24vw, 250px); max-width: min(100%, 250px); }
.player .track select { width: 100%; padding: 4px 7px; background: var(--terminal-bg); border-color: var(--terminal-line); color: #ffeadc; color-scheme: dark; }
.player .music-icon { flex: 0 0 35px; width: 35px; height: 35px; display: grid; place-items: center; padding: 0; }
.play-icon, .skip-icon { display: block; width: 15px; height: 16px; background: currentColor; }
.play-icon { clip-path: polygon(18% 0, 100% 50%, 18% 100%); }
.is-playing .play-icon { clip-path: polygon(9% 0, 38% 0, 38% 100%, 9% 100%, 9% 0, 61% 0, 90% 0, 90% 100%, 61% 100%, 61% 0); }
.skip-icon { clip-path: polygon(0 0, 71% 48%, 71% 0, 92% 0, 92% 100%, 71% 100%, 71% 52%, 0 100%); }
.favorites-section { margin-top: 25px; }
.favorite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.favorite-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; text-decoration: none; margin: 0; padding: 13px; }
.favorite-card span { color: var(--accent); grid-row: span 2; font-size: 1.5rem; }
.favorite-card strong { overflow-wrap: anywhere; }
.favorite-card time { font-size: .85rem; color: var(--muted); }
.record-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.favorite-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; font-size: 1.3rem; }
.calendar-grid a.today { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700; }
.month-group + .month-group { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 5px; }
.month-group h3 { text-transform: capitalize; }
.button-link { display: inline-block; text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 7px 11px; background: var(--action); }
.diary-actions { margin: 0 0 18px; }
.rich-editor { border: 1px solid var(--line); border-radius: 9px; min-width: 0; overflow: hidden; background: var(--bg); }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px; border-bottom: 1px solid var(--line); background: var(--panel); }
.rich-toolbar button, .rich-toolbar select { font-size: .83rem; min-height: 34px; padding: 4px 7px; }
.rich-surface { min-height: 140px; padding: 10px; cursor: text; }
.rich-surface:focus-visible { outline-offset: -2px; }
.prose blockquote { border-inline-start: 3px solid var(--accent); margin: 14px 0; padding: 5px 15px; }
.prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.theme-fieldset { border: 0; padding: 0; margin: 10px 0 0; min-width: 0; }
.theme-fieldset legend { margin-bottom: 9px; font-weight: 600; }
.theme-options { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-option { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.theme-option:has(input:checked) { background: var(--action); outline: 1px solid var(--accent); }
.theme-option input { accent-color: var(--accent); margin: 0; }
.theme-option i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: linear-gradient(135deg, var(--swatch, var(--accent)) 50%, var(--swatch-bg, var(--bg)) 50%); }
.custom-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 6px; }
.custom-palette output { color: var(--muted); }
@media (max-width: 600px) {
  .topbar { row-gap: 9px; }
  .topbar .wordmark { font-size: 1rem; white-space: normal; }
  .topbar nav a { padding: 6px 7px; }
  .player .track { width: 135px; }
}
