:root {
    color-scheme: dark;
    --night: #100909;
    --night-deep: #090505;
    --night-soft: #261313;
    --field: #190f0f;
    --field-active: #241414;
    --ink: #fff7f2;
    --muted: #cfaea3;
    --line: rgba(255, 255, 255, 0.14);
    --line-bright: rgba(234, 182, 114, 0.42);
    --red: #d9382c;
    --red-hot: #ff5b45;
    --gold: #eab672;
    --glow: rgba(255, 91, 69, 0.24);
    --shadow: rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    background: var(--night-deep);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: radial-gradient(circle at 50% 0, rgba(121, 39, 31, 0.25), transparent 34rem), var(--night-deep);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

button,
textarea,
input,
select { font: inherit; }

button,
label[for] { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
.native-file:focus-visible + label {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.sr-only,
.native-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

[hidden] { display: none !important; }

.app-shell {
    width: min(100%, 470px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
    background: radial-gradient(circle at 82% 5%, var(--glow), transparent 26rem), linear-gradient(155deg, var(--night-soft), var(--night) 31rem);
    box-shadow: 0 0 70px var(--shadow);
}

.app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: max(22px, env(safe-area-inset-top)) 22px 12px;
}

.wordmark { font-weight: 500; letter-spacing: 0.22em; }

.header-context,
.privacy-mark {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.privacy-mark { justify-self: end; color: var(--gold); font-size: 9px; }

main {
    min-height: calc(100dvh - 132px);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.screen { padding: 18px 22px 38px; }
.screen[hidden] { display: none; }

.screen-kicker,
.section-heading,
.suggestions-label,
.form-feedback,
.dialog-kicker,
.selected-date,
.path-number,
.sparks-heading {
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.screen-kicker { margin-bottom: 10px; }

.birthday-year {
    position: relative;
    margin: 1px 0 23px;
}

.birthday-pixels {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(53, minmax(0, 1fr));
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    gap: 2px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.birthday-pixel {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 1px;
    background: rgba(5, 2, 2, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.birthday-pixel.is-lived {
    background: var(--gold);
    box-shadow: 0 0 5px rgba(234, 182, 114, 0.13);
}

.birthday-pixel.is-today {
    background: var(--red-hot);
    box-shadow: 0 0 8px rgba(255, 91, 69, 0.7);
}

.birthday-countdown {
    position: absolute;
    z-index: 4;
    top: calc(100% + 9px);
    left: 50%;
    width: max-content;
    max-width: 100%;
    transform: translateX(-50%);
    padding: 8px 11px;
    border: 1px solid var(--line-bright);
    border-radius: 10px;
    background: rgba(35, 19, 19, 0.97);
    color: var(--ink);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
    font-size: 11px;
    letter-spacing: 0.025em;
    text-align: center;
    white-space: nowrap;
}

h1,
h2 {
    margin: 0;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.03em;
}

h1 { max-width: 400px; font-size: clamp(34px, 10vw, 46px); line-height: 1; }
h2 { font-size: 29px; line-height: 1.06; }

.screen-subtitle { margin: 12px 0 24px; color: var(--muted); }

.today-path {
    position: relative;
    margin: 0 -5px 18px;
    padding: 21px 18px 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 25px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 50%), rgba(13, 7, 7, 0.44);
}

.today-path::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    content: "";
    background: linear-gradient(90deg, var(--red-hot), transparent 65%);
    opacity: 0.8;
}

.rhythm-path::before { background: linear-gradient(90deg, var(--gold), transparent 65%); }

.path-number { margin-bottom: 9px; }
.today-path > p { margin: 7px 0 16px; color: var(--muted); font-size: 14px; }

.capture {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--field);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.capture:focus-within {
    border-color: var(--line-bright);
    box-shadow: 0 0 0 1px rgba(234, 182, 114, 0.12), 0 12px 32px rgba(234, 182, 114, 0.06);
}

.capture textarea {
    display: block;
    width: 100%;
    min-height: 126px;
    resize: vertical;
    padding: 17px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 22px;
    font-style: italic;
    line-height: 1.22;
}

.capture textarea:focus-visible { outline: none; }
.capture textarea::placeholder { color: var(--muted); opacity: 0.68; }

.signal-connection { border-top: 1px solid var(--line); }

.connection-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 11px 15px;
    border: 0;
    background: rgba(255, 255, 255, 0.018);
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}

.connection-toggle[aria-expanded="true"] { color: var(--gold); }

.connection-panel { padding: 2px 14px 14px; background: rgba(255, 255, 255, 0.018); }
.connection-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

.connection-chip {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
}

.connection-chip.is-selected { border-color: var(--gold); color: var(--ink); background: rgba(234, 182, 114, 0.1); }
.new-signal-label { display: block; margin-top: 13px; color: var(--muted); font-size: 11px; }
.new-signal-row { display: flex; gap: 7px; margin-top: 6px; }
.new-signal-row input { min-width: 0; flex: 1; }

.new-signal-row input,
.dialog-section input,
.dialog-section select,
#organize-moment-form input,
#organize-moment-form select,
.rhythm-fields input,
.rhythm-fields select {
    min-height: 43px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--ink);
}

.new-signal-row button,
.dialog-inline button {
    min-height: 43px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: transparent;
    color: var(--ink);
}

.media-preview { margin: 0; overflow: hidden; border-top: 1px solid var(--line); background: #120a0a; }
.media-preview img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.media-preview img:not([src]) { display: none; }

.capture-tools { display: flex; align-items: center; gap: 8px; padding: 11px; border-top: 1px solid var(--line); background: var(--field-active); }

.tool-button,
.follow-button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 11px;
    border-radius: 12px;
    color: var(--ink);
    cursor: pointer;
}

.tool-button { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; font-size: 13px; }
.follow-button { flex: 1; border: 0; background: linear-gradient(135deg, var(--red-hot), var(--red)); box-shadow: 0 8px 22px var(--glow); font-weight: 500; }
.follow-button:disabled { box-shadow: none; cursor: default; filter: saturate(0.25); opacity: 0.46; }
.form-feedback { min-height: 17px; margin: 9px 1px -2px; }

.rhythm-today-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.rhythm-today-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.rhythm-check {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--gold);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-weight: 700;
}

.rhythm-check.is-done { background: var(--gold); color: var(--night); opacity: 1; }
.rhythm-today-copy { display: flex; min-width: 0; flex-direction: column; }
.rhythm-today-copy strong { overflow: hidden; font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.rhythm-today-copy span { color: var(--muted); font-size: 12px; }

.rhythm-photo {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--gold);
    cursor: pointer;
}

.rhythm-photo.is-saving { animation: pulse 0.8s ease infinite alternate; }
@keyframes pulse { to { opacity: 0.35; transform: scale(0.94); } }

.rhythm-empty { padding: 14px 0 2px; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.rhythm-empty button { display: block; margin-top: 8px; padding: 0; border: 0; background: transparent; color: var(--gold); cursor: pointer; font-family: inherit; font-style: italic; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 25px 0 5px; }
.section-heading span:last-child { color: var(--muted); letter-spacing: 0.02em; text-transform: none; }

.moment-list,
.signal-list,
.history-list { list-style: none; margin: 0; padding: 0; }

.moment-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 15px 0; border-bottom: 1px solid var(--line); }
.moment-time,
.moment-media,
.signal-meta,
.history-item time { color: var(--muted); font-size: 12px; }
.moment-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.22; }
.moment-copy { min-width: 0; }
.moment-signal { display: block; margin-top: 4px; color: var(--gold); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; }
.moment-say-more { margin-top: 5px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-family: Georgia, "Times New Roman", serif; font-size: 12px; font-style: italic; }
.moment-media { display: flex; gap: 5px; color: var(--gold); }
.empty-state { margin: 14px 0 0; padding: 18px 0; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-style: italic; line-height: 1.45; }

.signal-heading { margin-top: 10px; }
.signal-list { border-top: 1px solid var(--line); }
.signal-item { padding: 17px 0; border-bottom: 1px solid var(--line); }
.signal-row { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; gap: 10px; align-items: center; color: var(--ink); }
.signal-number { color: var(--gold); font-size: 12px; }
.signal-copy { min-width: 0; }
.signal-title-row { display: flex; min-width: 0; align-items: center; gap: 7px; }
.signal-title { overflow: hidden; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.08; text-overflow: ellipsis; white-space: nowrap; }
.rhythm-badge { flex: 0 0 auto; padding: 3px 6px; border: 1px solid rgba(234, 182, 114, 0.35); border-radius: 99px; color: var(--gold); font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; }
.signal-meta,
.signal-example { display: block; margin-top: 4px; }
.signal-example { overflow: hidden; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 13px; font-style: italic; text-overflow: ellipsis; white-space: nowrap; }
.signal-thumb { width: 50px; height: 56px; border-radius: 11px; object-fit: cover; }

.signal-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 0 41px; }
.signal-action { min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; }
.signal-action.signal-again { border: 0; background: linear-gradient(135deg, var(--red-hot), var(--red)); }
.signal-action.subtle { color: var(--muted); }

.month-picker { display: flex; align-items: center; justify-content: center; gap: 5px; margin: -5px 0 22px; }
.month-picker button { padding: 3px 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 25px; }
.month-picker button:disabled { opacity: 0.2; }
#chemistry-month,
#journal-month { min-width: 130px; color: var(--ink); font-size: 12px; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.chemistry-heading { margin-top: 7px; }

.timeline { border-top: 1px solid var(--line); }
.timeline-axis { display: flex; justify-content: space-between; margin: 10px 6px 4px calc(38% + 11px); color: var(--muted); font-size: 10px; }
.timeline-row { display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 11px; align-items: center; min-height: 63px; border-bottom: 1px solid var(--line); }
.timeline-label { display: flex; min-width: 0; flex-direction: column; padding: 7px 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.timeline-label strong { overflow: hidden; font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.timeline-label span { color: var(--muted); font-size: 11px; }
.timeline-track { position: relative; height: 27px; margin: 0 7px; background: linear-gradient(to bottom, transparent 13px, var(--line) 13px 14px, transparent 14px), repeating-linear-gradient(to right, transparent 0 calc(16.667% - 1px), rgba(255,255,255,0.05) calc(16.667% - 1px) 16.667%); }
.timeline-dot { position: absolute; top: 50%; width: 14px; height: 14px; padding: 0; transform: translate(-50%, -50%); border: 2px solid transparent; border-radius: 50%; background: var(--red-hot); box-shadow: 0 3px 10px var(--glow); cursor: pointer; }
.timeline-dot.has-photo { border-color: var(--gold); }

.sparks-section { margin-top: 28px; }
.sparks-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sparks-heading div { display: flex; flex-direction: column; }
.sparks-heading small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: 0; text-transform: none; }
.sparks-heading > span { color: var(--muted); letter-spacing: 0; text-transform: none; }
.sparks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 11px; }
.spark-card { position: relative; min-height: 105px; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, var(--field-active), var(--field)); color: var(--ink); cursor: pointer; text-align: left; }
.spark-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.48; }
.spark-card::after { position: absolute; inset: 0; content: ""; background: linear-gradient(to top, rgba(8,4,4,0.92), transparent 80%); }
.spark-copy { position: absolute; z-index: 1; right: 11px; bottom: 10px; left: 11px; display: flex; flex-direction: column; }
.spark-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 400; line-height: 1.12; }
.spark-copy small { margin-top: 4px; color: var(--muted); }

.selected-moment { margin-top: 17px; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: 19px; background: radial-gradient(circle at 90% 12%, var(--glow), transparent 31%), var(--field); }
.selected-title { margin: 6px 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 23px; line-height: 1.08; }
.selected-signal { margin-bottom: 8px; color: var(--gold); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.selected-moment p { margin: 0; color: var(--muted); }
.selected-moment img { display: block; width: 100%; max-height: 300px; margin-top: 13px; border-radius: 13px; object-fit: cover; }
.selected-moment audio { width: 100%; margin-top: 13px; }
.organize-moment-button { width: 100%; min-height: 42px; margin-top: 13px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; }

.journal-weekdays,
.journal-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.journal-weekdays {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-align: center;
}

.journal-day-spacer,
.journal-day-tile { aspect-ratio: 0.82; }

.journal-day-tile {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    cursor: pointer;
}

.journal-day-tile.has-moments {
    border-color: rgba(255, 255, 255, 0.17);
    background: linear-gradient(145deg, var(--field-active), var(--field));
    color: var(--ink);
}

.journal-day-tile.is-today { box-shadow: 0 0 0 1px var(--gold); }
.journal-day-tile:disabled { cursor: default; opacity: 0.24; }

.day-tile-mosaic {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.day-tile-mosaic img { width: 100%; height: 100%; min-width: 0; object-fit: cover; }
.day-tile-mosaic.photos-1 img { grid-column: 1 / -1; grid-row: 1 / -1; }
.day-tile-mosaic.photos-2 img { grid-row: 1 / -1; }
.day-tile-mosaic.photos-3 img:first-child { grid-row: 1 / -1; }

.day-tile-words {
    position: absolute;
    inset: 8px 5px;
    overflow: hidden;
    color: rgba(255, 247, 242, 0.5);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    font-style: italic;
    line-height: 1.1;
}

.day-tile-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 4, 4, 0.82), transparent 72%); }
.day-tile-number { position: absolute; z-index: 1; bottom: 5px; left: 6px; font-size: 11px; }
.day-tile-count { position: absolute; z-index: 1; right: 5px; bottom: 5px; display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: rgba(255, 91, 69, 0.88); color: var(--ink); font-size: 8px; }
.day-tile-reflection { position: absolute; z-index: 1; top: 3px; right: 5px; color: var(--gold); font-size: 15px; line-height: 1; }

.journal-legend { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.journal-back { margin: -7px 0 17px; padding: 4px 0; border: 0; background: transparent; color: var(--gold); cursor: pointer; font-size: 13px; }

.day-collage {
    display: grid;
    width: calc(100% + 44px);
    height: 245px;
    margin: -18px -22px 23px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    overflow: hidden;
    background: var(--field);
}

.day-collage-photo { min-width: 0; min-height: 0; overflow: hidden; padding: 0; border: 0; background: var(--field); cursor: zoom-in; }
.day-collage-photo img { display: block; width: 100%; height: 100%; min-width: 0; object-fit: cover; }
.day-collage.photos-1 .day-collage-photo { grid-column: 1 / -1; grid-row: 1 / -1; }
.day-collage.photos-2 .day-collage-photo { grid-row: 1 / -1; }
.day-collage.photos-3 .day-collage-photo:first-child { grid-row: 1 / -1; }

.day-timeline { position: relative; list-style: none; margin: 7px 0 0; padding: 0; }
.day-timeline::before { position: absolute; top: 13px; bottom: 13px; left: 63px; width: 1px; content: ""; background: linear-gradient(var(--gold), var(--line) 18%, var(--line) 82%, transparent); }
.day-entry { position: relative; display: grid; grid-template-columns: 51px 14px minmax(0, 1fr); gap: 6px; align-items: start; padding: 0 0 18px; }
.day-entry-time { padding-top: 10px; color: var(--muted); font-size: 10px; text-align: right; }
.day-entry-marker { z-index: 1; width: 10px; height: 10px; margin-top: 12px; border: 2px solid var(--night); border-radius: 50%; background: var(--red-hot); box-shadow: 0 0 0 1px rgba(255, 91, 69, 0.4); }

.day-entry-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(255,255,255,0.03), transparent 48%), var(--field); }
.day-entry-photo-button { display: block; width: 100%; overflow: hidden; padding: 0; border: 0; background: var(--field); cursor: zoom-in; }
.day-entry-photo { display: block; width: 100%; max-height: 285px; object-fit: cover; }
.day-entry-copy { padding: 14px; }
.day-entry-copy h2 { font-size: 22px; }
.day-entry-kind { margin-top: 6px; color: var(--gold); font-size: 9px; letter-spacing: 0.07em; text-transform: uppercase; }
.day-entry-note { margin: 12px 0 0; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.55; white-space: pre-wrap; }
.day-entry-audio { width: 100%; margin-top: 12px; }
.say-more-button { margin-top: 12px; padding: 4px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-family: Georgia, "Times New Roman", serif; font-size: 14px; font-style: italic; }

.day-reflection { margin-top: 11px; padding: 20px; border: 1px solid rgba(234, 182, 114, 0.28); border-radius: 22px; background: radial-gradient(circle at 100% 0, rgba(234, 182, 114, 0.08), transparent 55%), var(--field); }
.day-reflection label { display: block; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 22px; font-style: italic; }
.day-reflection > p { margin: 5px 0 12px; color: var(--muted); font-size: 11px; }
.day-reflection textarea,
.journal-writing-dialog textarea { display: block; width: 100%; min-height: 145px; resize: vertical; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,0.2); color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.5; }
.day-reflection button { width: 100%; min-height: 43px; margin-top: 10px; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--gold), #bf7d44); color: var(--night); cursor: pointer; }
.journal-writing-dialog label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }

.selected-moment img[role="button"] { cursor: zoom-in; }

.photo-lightbox {
    position: fixed;
    inset: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(100vw, 900px);
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0 auto;
    overflow: hidden;
    padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
    border: 0;
    background: #050303;
    color: var(--ink);
}

.photo-lightbox[open] { display: grid; }
.photo-lightbox::backdrop { background: rgba(0, 0, 0, 0.96); }
.lightbox-toolbar { display: flex; min-height: 36px; align-items: center; justify-content: space-between; padding: 0 2px 7px; color: var(--muted); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.lightbox-toolbar form { margin: 0; }
.lightbox-close { display: grid; width: 30px; height: 30px; place-items: center; padding: 0 0 2px; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 24px; line-height: 1; }
.lightbox-stage { display: grid; min-height: 0; place-items: center; overflow: auto; overscroll-behavior: contain; }
.lightbox-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; touch-action: pinch-zoom; }
.lightbox-footer { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 3px 0; }
.lightbox-footer > div { min-width: 0; }
.lightbox-date { color: var(--gold); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; }
.lightbox-title { overflow: hidden; margin-top: 4px; font-family: Georgia, "Times New Roman", serif; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-download { flex: 0 0 auto; min-height: 42px; padding: 11px 13px; border: 1px solid var(--line-bright); border-radius: 12px; background: rgba(234,182,114,0.08); color: var(--ink); text-decoration: none; }

.app-nav {
    position: fixed;
    z-index: 10;
    left: 50%;
    bottom: 0;
    display: grid;
    width: min(100%, 470px);
    transform: translateX(-50%);
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(17, 10, 10, 0.94);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.app-nav button { display: flex; min-height: 60px; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.app-nav button[aria-current="page"] { color: var(--ink); }

.flow-dialog {
    width: min(calc(100% - 28px), 430px);
    max-height: min(82vh, 760px);
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: radial-gradient(circle at 85% 5%, var(--glow), transparent 18rem), var(--night-soft);
    color: var(--ink);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.flow-dialog::backdrop { background: rgba(5, 2, 2, 0.76); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.dialog-close { float: right; padding: 0 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 28px; }
.flow-dialog h2 { margin: 7px 30px 17px 0; }
.history-loading { padding: 16px 0; color: var(--muted); }
.history-item { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.history-item > div { min-width: 0; flex: 1; }
.history-item p { margin: 5px 0 0; font-family: Georgia, "Times New Roman", serif; }
.history-photo { width: 68px; height: 68px; border-radius: 12px; object-fit: cover; }

.rhythm-fields { display: grid; grid-template-columns: 1fr 1.35fr; gap: 9px; }
.rhythm-fields label { color: var(--muted); font-size: 12px; }
.rhythm-fields input,
.rhythm-fields select { display: block; width: 100%; margin-top: 6px; color: var(--ink); }
.dialog-primary,
.dialog-secondary { width: 100%; min-height: 45px; margin-top: 14px; border-radius: 12px; color: var(--ink); cursor: pointer; }
.dialog-primary { border: 0; background: linear-gradient(135deg, var(--red-hot), var(--red)); }
.dialog-secondary { border: 1px solid var(--line); background: transparent; }
.dialog-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.dialog-section > label,
#organize-moment-form > label { display: block; margin: 11px 0 6px; color: var(--muted); font-size: 12px; }
.dialog-inline { display: flex; gap: 7px; }
.dialog-inline input { min-width: 0; flex: 1; }
.dialog-section > select,
#organize-moment-form > select,
#organize-moment-form > input { width: 100%; }
.dialog-section small { display: block; margin-top: 8px; color: var(--muted); }
.dialog-feedback { min-height: 18px; margin-top: 10px; color: var(--gold); font-size: 12px; }

.toast { position: fixed; z-index: 20; right: 16px; bottom: 84px; left: 16px; width: min(calc(100% - 32px), 410px); margin: 0 auto; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: #2b1816; color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38); text-align: center; }

@media (min-width: 620px) {
    body { padding: 18px 0; }
    .app-shell { min-height: calc(100vh - 36px); min-height: calc(100dvh - 36px); border: 1px solid var(--line); border-radius: 31px; }
    main { min-height: calc(100dvh - 168px); }
    .app-nav { bottom: 18px; border-radius: 0 0 31px 31px; }
}

@media (max-width: 380px) {
    .app-header,
    .screen { padding-right: 16px; padding-left: 16px; }
    .today-path { margin-right: 0; margin-left: 0; padding-right: 13px; padding-left: 13px; }
    .capture-tools { flex-wrap: wrap; }
    .follow-button { min-width: 185px; }
    .signal-actions { margin-left: 0; }
    .timeline-row { grid-template-columns: 34% minmax(0, 1fr); }
    .timeline-axis { margin-left: calc(34% + 11px); }
}
