:root {
    color-scheme: light;
    --bg: #f6f7f4;
    --surface: #ffffff;
    --surface-strong: #eef3ef;
    --ink: #202522;
    --muted: #68706a;
    --border: #d9ded8;
    --primary: #166d67;
    --primary-strong: #0d514d;
    --accent: #b84f3e;
    --shadow: 0 16px 40px rgba(24, 31, 28, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--primary);
}

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

body.modal-open {
    overflow: hidden;
}

body.nav-open {
    overflow: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.brand {
    color: var(--ink);
    font-size: 0.98rem;
    font-weight: 800;
    text-decoration: none;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.nav-toggle-line {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 160ms ease, opacity 160ms ease;
}

.nav-toggle-line:nth-child(1) {
    transform: translateY(-6px);
}

.nav-toggle-line:nth-child(3) {
    transform: translateY(6px);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(1) {
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(3) {
    transform: rotate(-45deg);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 6px;
    padding: 0 7px;
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

.topbar-link.is-active {
    background: #2563eb;
    color: #fff;
}

.notification-link {
    gap: 6px;
}

.topbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    font-size: 1rem;
    line-height: 1;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 20px;
    border-radius: 999px;
    padding: 0 6px;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
}

.notification-badge.is-empty {
    background: var(--surface-strong);
    color: var(--muted);
}

.topbar-link.is-active .notification-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.username {
    color: var(--muted);
    font-size: 0.86rem;
}

.topbar .button.small {
    min-height: 30px;
    padding: 0 9px;
    font-size: 0.84rem;
}

.account-menu {
    position: relative;
}

.account-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    list-style: none;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-menu[open] summary,
.account-menu.is-active summary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.account-menu:not([open]) > .account-menu-panel {
    display: none;
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: grid;
    width: 180px;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.account-menu-name {
    padding: 2px 2px 6px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-link {
    display: flex;
    align-items: center;
    min-height: 34px;
    border-radius: 6px;
    padding: 0 10px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.account-menu-link:hover {
    background: var(--surface-strong);
}

.account-menu-link.is-active {
    background: #2563eb;
    color: #fff;
}

.account-menu form,
.account-menu .button {
    width: 100%;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 48px;
}

.shell.splash-shell,
.shell.home-shell {
    width: 100%;
    padding: 0;
}

.shell.connections-shell {
    min-height: calc(100vh - 58px);
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
}

.shell.origin-shell {
    display: flex;
    flex-direction: column;
    width: calc(100% - 24px);
    height: calc(100dvh - 58px);
    min-height: 0;
    padding: 16px 0;
}

.auth-panel,
.upload-panel,
.timeline-frame {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel {
    width: min(440px, 100%);
    margin: 58px auto;
    padding: 28px;
}

.profile-stack {
    display: grid;
    width: min(560px, 100%);
    gap: 18px;
    margin: 34px auto;
}

.profile-stack .auth-panel {
    width: 100%;
    margin: 0;
}

.setup-progress-panel {
    display: grid;
    gap: 10px;
}

.setup-progress-panel .progress-card-row h1 {
    font-size: 1.4rem;
}

.setup-progress-panel progress {
    width: 100%;
}

.backup-panel {
    display: grid;
    gap: 16px;
}

.backup-panel p {
    margin-bottom: 0;
    line-height: 1.45;
}

.backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.premium-hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(22, 109, 103, 0.28);
    border-radius: 8px;
    padding: 18px;
    background: #f7fbfa;
}

.premium-hero-panel h2 {
    margin: 8px 0 6px;
    color: var(--ink);
    font-size: 1.3rem;
}

.premium-hero-panel p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.premium-status {
    font-weight: 900;
}

.premium-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.premium-feature-grid article {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(24, 31, 28, 0.08);
}

.premium-feature-grid strong {
    color: var(--ink);
    font-size: 1rem;
}

.premium-feature-grid p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.admin-panel {
    display: grid;
    gap: 18px;
}

.admin-action-panel {
    width: 100%;
}

.admin-stats-panel {
    width: 100%;
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-site-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-stat-grid article {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-strong);
}

.admin-stat-grid strong {
    color: var(--primary);
    font-size: 1.45rem;
}

.admin-stat-grid span,
.admin-stat-grid small {
    color: var(--muted);
    font-weight: 800;
}

.admin-job-list {
    display: grid;
    gap: 12px;
}

.admin-job-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-strong);
}

.admin-job-card.is-running {
    border-color: rgba(22, 109, 103, 0.44);
}

.admin-job-card.is-failed {
    border-color: rgba(174, 45, 45, 0.42);
}

.admin-action-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.admin-action-table th,
.admin-action-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

.admin-action-table th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-action-table td {
    font-weight: 700;
}

.admin-action-table td:nth-child(3) {
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 900;
}

.admin-job-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.admin-job-header > div {
    display: grid;
    gap: 2px;
}

.admin-job-header strong {
    color: var(--ink);
}

.admin-job-header span {
    color: var(--muted);
    font-weight: 800;
}

.admin-job-card progress {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}

.admin-job-card progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--border);
}

.admin-job-card progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.admin-job-card progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.birthday-panel {
    position: relative;
    width: min(560px, 100%);
}

.birthday-close {
    position: absolute;
    top: 14px;
    right: 14px;
    text-decoration: none;
}

.danger-note {
    display: grid;
    gap: 8px;
    margin: 18px 0;
    border: 1px solid rgba(159, 53, 40, 0.34);
    border-radius: 8px;
    padding: 14px;
    background: #fff4f1;
    color: var(--ink);
}

.danger-note strong {
    color: #7d281f;
}

.danger-note p,
.danger-note ul {
    margin-bottom: 0;
}

.danger-note ul {
    padding-left: 20px;
}

.auth-link-row {
    margin-top: 14px;
}

.reset-link-box {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-strong);
    word-break: break-word;
}

.reset-link-box p {
    margin-bottom: 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 22px;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.05;
}

h2 {
    margin-bottom: 4px;
    font-size: 1.25rem;
}

h3 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.form-stack,
.upload-form,
.message-form,
.location-form,
.people-form,
.text-entry-form,
.text-entry-edit-form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

fieldset {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
}

legend {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}

input {
    height: 44px;
    padding: 0 12px;
}

select {
    height: 44px;
    padding: 0 12px;
}

input[type="file"] {
    height: auto;
    padding: 10px;
}

.readonly-input {
    background: var(--surface-strong);
    color: var(--muted);
    cursor: default;
}

textarea {
    min-height: 96px;
    resize: vertical;
    padding: 11px 12px;
}

.tag-radio-group {
    display: grid;
    gap: 7px;
}

.location-fields {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr);
    gap: 10px;
    align-items: end;
}

.location-map-field {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.location-map-label,
.location-map-status {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.location-map-picker {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 2 / 1;
    min-height: 132px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    background:
        radial-gradient(circle at 28% 42%, rgba(22, 109, 103, 0.24) 0 10%, transparent 10.5%),
        radial-gradient(circle at 47% 38%, rgba(22, 109, 103, 0.24) 0 8%, transparent 8.5%),
        radial-gradient(circle at 71% 52%, rgba(22, 109, 103, 0.22) 0 13%, transparent 13.5%),
        linear-gradient(0deg, rgba(255, 255, 255, 0.52) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.52) 1px, transparent 1px),
        linear-gradient(135deg, #d8ece6, #eef7f0 48%, #d4e7f3);
    background-size:
        auto,
        auto,
        auto,
        100% 25%,
        12.5% 100%,
        auto;
    cursor: crosshair;
}

.location-map-picker:hover,
.location-map-picker:focus-visible {
    border-color: rgba(22, 109, 103, 0.52);
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 109, 103, 0.14);
}

.location-map-picker::before {
    content: "";
    position: absolute;
    inset: 12% 8%;
    border-radius: 45% 55% 52% 48%;
    background:
        radial-gradient(circle at 22% 44%, rgba(22, 109, 103, 0.38) 0 12%, transparent 12.5%),
        radial-gradient(circle at 46% 35%, rgba(22, 109, 103, 0.34) 0 10%, transparent 10.5%),
        radial-gradient(circle at 76% 54%, rgba(22, 109, 103, 0.32) 0 15%, transparent 15.5%);
    opacity: 0.7;
    pointer-events: none;
}

.location-map-marker {
    position: absolute;
    left: var(--location-x, 50%);
    top: var(--location-y, 50%);
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--accent);
    box-shadow: 0 4px 14px rgba(15, 18, 17, 0.28);
    opacity: 0;
    transform: translate(-50%, -88%) rotate(-45deg);
    transition: opacity 120ms ease;
}

.location-map-marker::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #fff;
}

.location-map-picker.has-point .location-map-marker {
    opacity: 1;
}

.location-map-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.location-map-actions .button {
    width: auto;
    min-width: 96px;
}

.location-map-modal {
    padding: 14px;
}

.location-map-modal-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1280px, 100%);
    height: calc(100dvh - 28px);
    max-height: none;
}

.location-map-modal-panel .modal-header {
    align-items: center;
}

.location-map-fullscreen {
    min-height: 0;
    background: #d8ece6;
}

.location-map-fullscreen .leaflet-container,
.location-map-fullscreen.leaflet-container {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.location-map-fullscreen .leaflet-control-attribution {
    font-size: 0.72rem;
}

.location-summary {
    margin-bottom: 0;
    color: var(--primary);
    font-size: 0.86rem;
    font-weight: 800;
}

.people-field {
    grid-column: 1 / -1;
}

.people-summary {
    margin: 4px 0 0;
    color: var(--primary);
    font-size: 0.86rem;
    font-weight: 900;
}

.people-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    padding: 0 2px;
}

.people-chip {
    max-width: 100%;
    overflow: hidden;
    border: 1px solid rgba(22, 109, 103, 0.24);
    border-radius: 999px;
    padding: 3px 8px;
    background: #f5fbfa;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-radio-list,
.tag-check-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tag-radio,
.tag-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    background: #fff;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 800;
}

.tag-radio span,
.tag-check span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.tag-radio small,
.tag-check small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-radio input,
.tag-check input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    padding: 0;
    accent-color: var(--primary);
}

.button,
.timeline-button,
.month-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover,
.timeline-button:hover,
.month-button:hover,
.entry-thumb:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-strong);
}

.button.secondary {
    background: var(--surface-strong);
    border-color: var(--border);
    color: var(--ink);
}

.button.danger {
    background: #9f3528;
    color: #fff;
}

.button.danger:hover {
    background: #7d281f;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.9rem;
}

.muted {
    color: var(--muted);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-weight: 700;
}

.flash.error {
    border-color: #e2a69c;
    color: #8b2c21;
}

.flash.success {
    border-color: #9bc9af;
    color: #1f6840;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-heading h1 {
    margin-bottom: 0;
}

.month-heading-row,
.local-heading-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.local-settings-menu {
    position: relative;
}

.local-settings-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 900;
    list-style: none;
}

.local-settings-menu summary::-webkit-details-marker {
    display: none;
}

.local-settings-menu[open] summary {
    border-color: rgba(22, 109, 103, 0.42);
    background: #ebf6f3;
    color: var(--primary);
}

.local-settings-icon {
    line-height: 1;
}

.local-settings-menu:not([open]) > .local-settings-popup {
    display: none;
}

.local-settings-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: grid;
    width: min(460px, calc(100vw - 32px));
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.local-settings-popup h2,
.local-settings-popup p {
    margin-bottom: 0;
}

.local-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.local-settings-close {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
}

.local-settings-form {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.timeline-page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
}

.timeline-page-heading h1 {
    flex: 0 0 auto;
    width: 100%;
}

.timeline-page-actions {
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    min-width: 0;
}

.timeline-page-actions > .button,
.timeline-page-actions .privacy-preview-toggle {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
}

.timeline-page-actions .privacy-preview-panel {
    position: relative;
    flex: 0 0 auto;
    margin-bottom: 0;
}

.timeline-page-actions .privacy-preview-toggle {
    width: auto;
    gap: 6px;
}

.timeline-page-actions .privacy-preview-toggle::after {
    width: 14px;
    height: 14px;
    font-size: 0.72rem;
}

.timeline-page-actions .privacy-preview-toggle small {
    font-size: 0.66rem;
}

.timeline-page-actions .privacy-preview-body {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    width: min(520px, calc(100vw - 32px));
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 800;
    text-decoration: none;
}

.timeline-frame {
    padding: 18px;
}

.view-all-button,
.view-random-button {
    width: min(180px, 100%);
    min-height: 46px;
    margin-bottom: 0;
    font-size: 0.98rem;
}

.timeline-frame > .view-all-button + .view-random-button {
    margin-left: 10px;
}

.year-carousel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}

.year-carousel-actions .view-all-button,
.year-carousel-actions .view-random-button {
    flex: 0 1 180px;
}

.year-carousel-actions > .view-all-button + .view-random-button {
    margin-left: 0;
}

.timeline-frame > .year-grid {
    margin-top: 14px;
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
    max-height: min(70vh, 680px);
    overflow-y: auto;
    padding: 2px 4px 2px 2px;
}

.timeline-button {
    width: 100%;
    aspect-ratio: 1;
    min-height: 0;
    height: auto;
    padding: 10px;
    background: #fff;
    border-color: var(--border);
    color: var(--ink);
    font-size: 1.05rem;
}

.timeline-button:hover,
.month-button:hover {
    border-color: var(--primary);
    background: var(--surface-strong);
}

.timeline-button:focus-visible,
.month-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.counted-button {
    position: relative;
    gap: 8px;
    flex-wrap: wrap;
    align-content: center;
    line-height: 1.1;
    text-align: center;
}

.counted-button > span:first-child {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 26px;
    height: 24px;
    border-radius: 999px;
    padding: 0 8px;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
}

.button-progress {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
    display: block;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-strong);
}

.button-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 12px;
}

.month-button {
    width: 100%;
    aspect-ratio: 1;
    min-height: 0;
    height: auto;
    padding: 10px;
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
    font-size: 0.96rem;
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
}

.upload-panel {
    margin-bottom: 20px;
    padding: 18px;
}

.privacy-panel {
    display: grid;
    gap: 14px;
}

.privacy-panel h2 {
    margin-bottom: 4px;
}

.privacy-panel p {
    margin-bottom: 0;
}

details.privacy-toggle-panel {
    display: block;
}

.privacy-toggle-panel:not([open]) > :not(summary) {
    display: none;
}

.privacy-toggle-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    list-style: none;
}

.privacy-toggle-summary::-webkit-details-marker {
    display: none;
}

.privacy-toggle-summary span {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.privacy-toggle-summary strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.privacy-toggle-summary small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.privacy-toggle-summary::after {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px;
    background: var(--surface-strong);
    color: var(--ink);
    content: "Show";
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 900;
}

.privacy-toggle-panel[open] .privacy-toggle-summary {
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.privacy-toggle-panel[open] .privacy-toggle-summary::after {
    content: "Hide";
}

.month-entry-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
    margin-bottom: 12px;
}

.month-entry-actions > .upload-panel.form-toggle-panel {
    margin-bottom: 0;
}

.month-entry-actions > .form-toggle-panel[open] {
    grid-column: 1 / -1;
}

.form-toggle-panel:not([open]) > :not(summary) {
    display: none;
}

.upload-panel.form-toggle-panel {
    margin-bottom: 12px;
    padding: 10px 14px;
}

.form-toggle-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    cursor: pointer;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 900;
    list-style: none;
}

.form-toggle-summary::-webkit-details-marker {
    display: none;
}

.form-toggle-summary::after {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--primary);
    content: "+";
    flex: 0 0 auto;
    font-size: 1.1rem;
    line-height: 1;
}

.form-toggle-panel[open] .form-toggle-summary {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.form-toggle-panel[open] .form-toggle-summary::after {
    content: "-";
}

.privacy-bulk-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.upload-form {
    grid-template-columns: minmax(180px, 0.65fr) minmax(150px, 190px) minmax(320px, 1fr) auto;
    align-items: end;
}

.text-entry-form {
    grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px) minmax(320px, 1fr) auto;
    align-items: end;
}

.upload-form .file-field input[type="file"] {
    width: min(100%, 260px);
}

.upload-form .photo-caption-field {
    grid-column: 1 / -1;
}

.upload-form .photo-caption-field textarea {
    min-height: 76px;
}

.upload-progress {
    display: grid;
    grid-column: 1 / -1;
    gap: 8px;
    min-width: 0;
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 900;
}

.upload-progress progress {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}

.upload-progress progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--border);
}

.upload-progress progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.upload-progress progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 18, 17, 0.64);
}

.processing-overlay[hidden] {
    display: none;
}

.processing-panel {
    display: grid;
    gap: 12px;
    width: min(420px, 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.processing-panel strong {
    font-size: 1.08rem;
}

.processing-copy {
    color: var(--muted);
    font-weight: 800;
    line-height: 1.35;
}

.processing-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 900;
}

.processing-panel progress {
    width: 100%;
    height: 14px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}

.processing-panel progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--border);
}

.processing-panel progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.processing-panel progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.progress-card {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(24, 31, 28, 0.08);
}

.progress-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.progress-card-row h1,
.progress-card-row strong,
.progress-card p {
    margin-bottom: 0;
}

.progress-card-row span,
.progress-card p {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 900;
}

.progress-card progress,
.setup-progress-panel progress,
.chapter-bulk-progress progress,
.carousel-playback-progress progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}

.progress-card progress::-webkit-progress-bar,
.setup-progress-panel progress::-webkit-progress-bar,
.chapter-bulk-progress progress::-webkit-progress-bar,
.carousel-playback-progress progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--border);
}

.progress-card progress::-webkit-progress-value,
.setup-progress-panel progress::-webkit-progress-value,
.chapter-bulk-progress progress::-webkit-progress-value,
.carousel-playback-progress progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.progress-card progress::-moz-progress-bar,
.setup-progress-panel progress::-moz-progress-bar,
.chapter-bulk-progress progress::-moz-progress-bar,
.carousel-playback-progress progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.timeline-completeness-card {
    margin-top: -2px;
}

.heat-map-frame {
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.heat-map-frame img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.anniversary-group-list {
    display: grid;
    gap: 18px;
}

.anniversary-group {
    display: grid;
    gap: 12px;
}

.anniversary-group-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.anniversary-group-header h2 {
    margin: 6px 0 0;
    color: var(--ink);
    font-size: 1.14rem;
}

.anniversary-group-header > span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 900;
    white-space: nowrap;
}

.anniversary-empty-card {
    margin-top: 0;
}

.memory-completeness-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
}

.memory-completeness-summary-row p {
    min-width: 0;
}

.memory-completeness-summary-row .button {
    flex: 0 0 auto;
}

.memory-completeness-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.submit-progress {
    margin-top: 4px;
}

.floating-progress {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 80;
    width: min(360px, calc(100vw - 36px));
    border: 1px solid rgba(22, 109, 103, 0.32);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.floating-progress[hidden] {
    display: none;
}

.import-upload-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 16px;
}

.upload-size-error {
    grid-column: 1 / -1;
    margin: 0;
    border: 1px solid #e2a69c;
    border-radius: 6px;
    padding: 10px 12px;
    color: #8b2c21;
    font-weight: 800;
    line-height: 1.35;
}

.upload-size-error[hidden] {
    display: none;
}

.import-review-form {
    display: grid;
    gap: 16px;
}

.import-review-page-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface);
}

.import-review-page-bar p {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 900;
}

.import-review-page-actions {
    flex: 0 0 auto;
}

.import-review-list {
    display: grid;
    gap: 12px;
}

.import-review-card {
    display: grid;
    grid-template-columns: minmax(160px, 190px) minmax(0, 1fr);
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
}

.import-review-card.has-duplicate {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    border-color: rgba(184, 79, 62, 0.38);
    background: #fffaf8;
}

.import-review-preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.import-review-card.has-duplicate .import-review-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.import-review-preview {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.import-review-preview img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--surface-strong);
    object-fit: cover;
}

.import-review-preview figcaption {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.import-review-preview figcaption strong,
.import-review-preview figcaption span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-review-preview figcaption strong {
    color: var(--ink);
    font-size: 0.82rem;
}

.import-review-preview figcaption span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.import-review-main {
    display: grid;
    align-content: start;
    gap: 14px;
    min-width: 0;
}

.import-review-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 10px;
}

.import-review-title-row h2 {
    overflow: hidden;
    margin-bottom: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-review-badges {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.duplicate-badge {
    background: #fff0eb;
    color: #8b2c21;
}

.import-duplicate-link {
    justify-self: start;
}

.import-review-fields {
    display: grid;
    grid-template-columns: minmax(160px, 200px) minmax(320px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.import-skip-row {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    gap: 8px;
    color: var(--ink);
    font-weight: 900;
    white-space: nowrap;
}

.import-skip-row input {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--primary);
}

.upload-form .tag-radio small,
.text-entry-form .tag-radio small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.text-entry-field textarea {
    max-height: 180px;
    overflow-y: auto;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.public-photo-section {
    min-height: 240px;
}

.public-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    opacity: 1;
    transition: opacity 300ms ease;
}

.public-photo-grid.is-refreshing {
    opacity: 0;
}

.public-photo-item {
    position: relative;
    display: grid;
    gap: 8px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
}

.public-photo-card {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 6px;
    padding: 0;
    background: transparent;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease;
}

.public-photo-card:hover {
    transform: translateY(-1px);
}

.public-photo-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    background: var(--surface-strong);
    object-fit: cover;
}

.home-photo-zoom-trigger {
    display: grid;
    min-width: 0;
    min-height: 0;
    border: 0;
    padding: 0;
    background: #101412;
    cursor: zoom-in;
}

.home-photo-zoom-trigger:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.82);
    outline-offset: -3px;
}

.home-photo-zoom-panel {
    width: min(1120px, 100%);
}

.home-photo-zoom-body {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #101412;
}

.home-photo-zoom-nav {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: 900;
    transform: translateY(-50%);
}

.home-photo-zoom-nav.is-left {
    left: 12px;
}

.home-photo-zoom-nav.is-right {
    right: 12px;
}

.home-photo-zoom-nav:disabled {
    cursor: default;
    opacity: 0.38;
}

.public-photo-meta {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.35;
}

.public-photo-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-photo-owner-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
}

.public-photo-owner-row strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 0.98rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-photo-owner-row .button,
.public-photo-owner-row .status-badge {
    flex: 0 0 auto;
}

.home-live-page {
    --home-grid-gap: 4px;
    --home-grid-pad: 4px;
    --home-tile-size: min(calc((100vw - 44px) / 10), calc((100dvh - 94px) / 8));
    position: relative;
    width: 100%;
    height: calc(100dvh - 58px);
    min-height: 460px;
    overflow: hidden;
    background: #111714;
}

.home-photo-grid {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-content: center;
    grid-template-columns: repeat(10, var(--home-tile-size));
    grid-auto-rows: var(--home-tile-size);
    gap: var(--home-grid-gap);
    padding: var(--home-grid-pad);
    overflow: hidden;
}

.home-photo-tile {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    min-height: 0;
    border-radius: 2px;
    background: #27302b;
    background-position: center;
    background-size: cover;
    object-fit: cover;
    opacity: 1;
    filter: saturate(0.96) contrast(0.96);
    transition: opacity var(--home-fade-out, 900ms) ease;
}

.home-photo-tile.is-fading-in {
    animation: homeTileFadeIn var(--home-fade-in, 1800ms) ease forwards;
    opacity: 0;
}

.home-photo-grid.is-fading-out .home-photo-tile:not(.home-photo-reserved) {
    animation: none;
    opacity: 0;
}

.home-photo-placeholder {
    background: #b8bdb9;
    filter: none;
}

.home-photo-reserved {
    animation: none;
    opacity: 1;
    transition: none;
}

@keyframes homeTileFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.home-photo-status {
    position: absolute;
    top: 18px;
    left: 50%;
    z-index: 2;
    margin: 0;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    background: rgba(17, 23, 20, 0.76);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
}

.home-copy-field {
    --home-copy-line: calc(0.92rem * 1.38);
    position: absolute;
    top: calc(50% + 53px);
    left: 50%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: calc((var(--home-tile-size) * 6) + (var(--home-grid-gap) * 5));
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    padding: calc(var(--home-copy-line) * 2) 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 48px rgba(9, 13, 11, 0.28);
    color: var(--ink);
    text-align: center;
}

.home-copy-field p {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 850;
    line-height: 1.38;
}

.home-copy-field p + p {
    margin-top: 10px;
}

.splash-page {
    position: relative;
    display: grid;
    width: 100%;
    height: calc(100dvh - 58px);
    min-height: 420px;
    overflow: hidden;
    background: #101412;
}

.splash-grid {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 3px;
    padding: 3px;
    overflow: hidden;
}

.splash-page-meta {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    align-items: center;
    max-width: min(560px, calc(100% - 92px));
    gap: 10px;
    border-radius: 8px;
    padding: 8px;
    background: rgba(16, 20, 18, 0.72);
    color: #fff;
}

.splash-page-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.splash-size-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    gap: 6px;
    border-radius: 8px;
    padding: 6px;
    background: rgba(16, 20, 18, 0.72);
}

.splash-size-controls button {
    min-width: 58px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.92);
    color: #202522;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 900;
}

.splash-size-controls button:hover,
.splash-size-controls button:focus-visible,
.splash-size-controls button[aria-pressed="true"] {
    background: var(--primary);
    color: #fff;
}

.has-splash-size-controls .splash-grid {
    padding-top: 58px;
}

.has-splash-size-controls .splash-status {
    right: 12px;
    left: auto;
    transform: none;
}

.admin-full-splash-page .splash-size-controls {
    right: 10px;
    left: auto;
}

.admin-full-splash-meta span {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 900;
}

.chapter-splash-page .splash-grid {
    padding-top: 64px;
}

.splash-thumb {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    border: 0;
    border-radius: 2px;
    padding: 0;
    overflow: hidden;
    background: #101412;
    cursor: zoom-in;
}

.splash-thumb.is-selected::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 3px solid #fff;
    border-radius: 5px;
    box-shadow: 0 0 0 3px var(--primary);
    pointer-events: none;
}

.splash-thumb[aria-pressed="true"] {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
}

.splash-thumb:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
}

.splash-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.splash-page-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 72px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(16, 20, 18, 0.55);
    color: #fff;
    cursor: pointer;
    font-size: 1.8rem;
    font-weight: 900;
    transform: translateY(-50%);
}

.splash-page-button:hover,
.splash-page-button:focus-visible {
    background: rgba(22, 109, 103, 0.88);
}

.splash-page-button[hidden] {
    display: none;
}

.splash-page-prev {
    left: 10px;
}

.splash-page-next {
    right: 10px;
}

.splash-status,
.splash-page-count {
    position: absolute;
    z-index: 2;
    margin: 0;
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(16, 20, 18, 0.72);
    color: #fff;
    font-size: 0.84rem;
    font-weight: 900;
}

.splash-status {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.splash-status[hidden],
.splash-page-count[hidden] {
    display: none;
}

.splash-page-count {
    right: 12px;
    bottom: 12px;
}

.chapter-bulk-page-progress {
    display: grid;
    min-width: 110px;
    gap: 5px;
}

.chapter-bulk-page-progress progress {
    width: 100%;
    height: 5px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}

.chapter-bulk-page-progress progress::-webkit-progress-bar {
    background: rgba(255, 255, 255, 0.28);
}

.chapter-bulk-page-progress progress::-webkit-progress-value {
    background: #fff;
}

.chapter-bulk-page-progress progress::-moz-progress-bar {
    background: #fff;
}

.chapter-bulk-select-page {
    padding-top: 70px;
}

.chapter-bulk-toolbar {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(16, 20, 18, 0.78);
    color: #fff;
}

.chapter-bulk-toolbar strong,
.chapter-bulk-toolbar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-bulk-toolbar .button {
    flex: 0 0 auto;
}

.chapter-bulk-progress {
    display: grid;
    flex: 0 1 260px;
    min-width: 180px;
    gap: 4px;
    margin-left: auto;
}

.chapter-bulk-progress-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
}

.chapter-bulk-progress-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-bulk-progress progress {
    height: 7px;
}

.chapter-bulk-progress progress::-webkit-progress-value {
    background: #fff;
}

.chapter-bulk-progress progress::-moz-progress-bar {
    background: #fff;
}

.chapter-bulk-thumb {
    position: relative;
    border: 3px solid transparent;
    cursor: pointer;
}

.chapter-bulk-thumb.is-selected {
    border-color: #fff;
    box-shadow: inset 0 0 0 3px var(--primary);
}

.chapter-bulk-thumb.is-selected img {
    filter: brightness(0.72) saturate(1.05);
}

.chapter-bulk-check {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    border-radius: 999px;
    padding: 5px 7px;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 6px 16px rgba(16, 20, 18, 0.28);
}

.chapter-bulk-thumb.is-selected .chapter-bulk-check {
    display: inline-flex;
}

.month-bulk-actions-toolbar {
    display: grid;
    grid-template-columns: auto auto minmax(180px, 1fr);
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
}

.month-bulk-actions-page {
    padding-top: 92px;
}

.month-bulk-actions-toolbar > .button {
    grid-column: 1;
    grid-row: 1;
    z-index: 1;
}

.month-bulk-actions-toolbar > strong {
    grid-column: 2;
    grid-row: 1;
    z-index: 1;
}

.month-bulk-action-controls {
    display: flex;
    align-items: end;
    justify-content: center;
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    width: max-content;
    max-width: 100%;
    flex: none;
    min-width: 0;
    margin: 0;
    gap: 8px;
}

.month-bulk-actions-toolbar .chapter-bulk-progress {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    width: min(260px, 100%);
    margin-left: 0;
    z-index: 1;
}

.month-bulk-control {
    display: grid;
    flex: 0 1 170px;
    min-width: 150px;
    gap: 3px;
}

.month-bulk-action-controls .month-bulk-delete-form {
    flex: 0 0 auto;
    min-width: 0;
}

.month-bulk-action-controls .chapter-bulk-action-status:empty {
    display: none;
}

.month-bulk-control span {
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
}

.chapter-bulk-save-form {
    display: flex;
    align-items: center;
    flex: 0 1 320px;
    min-width: 220px;
    gap: 8px;
    border-radius: 8px;
    padding: 0;
    background: transparent;
}

.chapter-bulk-save-form label {
    flex: 1 1 auto;
    min-width: 0;
}

.chapter-bulk-chapter-select {
    width: 100%;
    min-height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 900;
}

.chapter-bulk-chapter-select:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.chapter-bulk-action-status {
    flex: 0 1 140px;
    min-height: 18px;
    min-width: 0;
    overflow: hidden;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-bulk-action-status.is-error,
.chapter-bulk-new-form .form-status.is-error,
.chapter-new-form .form-status.is-error,
.chapter-add-status.is-error {
    color: #ffd7d1;
}

.chapter-bulk-new-panel,
.chapter-new-panel {
    width: min(520px, 100%);
}

.chapter-bulk-new-form,
.chapter-new-form {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.chapter-bulk-new-form label,
.chapter-new-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 900;
}

.chapter-bulk-new-form input,
.chapter-bulk-new-form textarea,
.chapter-new-form input,
.chapter-new-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.chapter-bulk-new-form textarea,
.chapter-new-form textarea {
    min-height: 120px;
    resize: vertical;
}

.no-date-organizer {
    display: grid;
    gap: 12px;
}

.no-date-splash-toolbar {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(120px, 160px) auto auto minmax(90px, 1fr);
    align-items: end;
    gap: 10px;
}

.no-date-splash-toolbar label {
    margin-bottom: 0;
}

.no-date-selected-count {
    align-self: center;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 900;
}

.no-date-splash-page {
    height: min(720px, calc(100dvh - 220px));
    min-height: 360px;
    border-radius: 8px;
}

.no-date-splash-page .splash-thumb {
    cursor: pointer;
}

.splash-thumb-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.splash-thumb-wrap .splash-thumb {
    width: 100%;
    height: 100%;
}

.no-date-photo-edit-button {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    min-height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 999px;
    padding: 0 9px;
    background: rgba(16, 20, 18, 0.76);
    color: #fff;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 900;
}

.no-date-photo-edit-button:hover,
.no-date-photo-edit-button:focus-visible {
    background: var(--primary);
}

.splash-suggestion-chip {
    position: absolute;
    right: 6px;
    bottom: 6px;
    left: 6px;
    z-index: 2;
    overflow: hidden;
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(16, 20, 18, 0.78);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-date-edit-panel {
    max-width: 460px;
}

.no-date-edit-form {
    display: grid;
    gap: 12px;
}

.no-date-edit-exact-date {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.reaction-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.entry-card > .reaction-bar,
.public-photo-item > .reaction-bar,
.chapter-preview-wrap > .reaction-bar {
    position: absolute;
    z-index: 6;
}

.entry-card > .reaction-bar {
    top: 10px;
    right: 10px;
}

.public-photo-item > .reaction-bar {
    top: 14px;
    right: 14px;
}

.chapter-preview-wrap > .reaction-bar {
    top: 6px;
    right: 6px;
}

.reaction-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(24, 31, 28, 0.18);
    backdrop-filter: blur(8px);
    font-size: 0.82rem;
    font-weight: 900;
    gap: 4px;
    line-height: 1;
}

.reaction-button:hover,
.reaction-button.is-active {
    border-color: rgba(22, 109, 103, 0.55);
    background: rgba(235, 246, 243, 0.96);
    color: var(--primary);
}

.reaction-icon {
    display: inline-grid;
    place-items: center;
    min-width: 16px;
    font-size: 1rem;
    line-height: 1;
}

.reaction-count {
    min-width: 1ch;
    font-size: 0.72rem;
    line-height: 1;
}

.entry-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
}

.entry-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    background: var(--surface);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
    transition: transform 140ms ease, border-color 140ms ease;
}

.photo-card-meta {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 0 2px;
}

.photo-card-meta strong,
.photo-card-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-card-meta strong {
    color: var(--ink);
    font-size: 0.9rem;
}

.photo-card-meta span {
    display: -webkit-box;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.entry-thumb .thumb-date {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    overflow: hidden;
    border-radius: 6px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-thumb .privacy-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 4;
    max-width: calc(100% - 16px);
    overflow: hidden;
    border-radius: 6px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-thumb:has(.thumb-date) .privacy-badge {
    bottom: 42px;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 24px;
    overflow: hidden;
    border-radius: 6px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-thumb-content .privacy-badge {
    margin: 0;
    background: rgba(255, 255, 255, 0.92);
}

.text-thumb {
    text-align: left;
}

.text-thumb-content {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: 8px;
    padding: 14px 12px 78px 14px;
    scrollbar-gutter: stable;
    text-align: left;
}

.text-thumb-preview {
    margin-bottom: 0;
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.chapter-add-panel {
    display: grid;
    gap: 8px;
}

.chapter-add-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 900;
    list-style: none;
}

.chapter-add-panel summary::-webkit-details-marker {
    display: none;
}

.chapter-add-panel summary::after {
    color: var(--primary);
    content: "+";
    font-size: 1rem;
    line-height: 1;
}

.chapter-add-panel[open] summary::after {
    content: "-";
}

.chapter-add-panel:not([open]) > .chapter-add-form {
    display: none;
}

.chapter-add-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
}

.chapter-add-form label {
    gap: 4px;
    font-size: 0.78rem;
}

.chapter-add-form .button {
    width: 100%;
}

.chapter-add-form select {
    height: 34px;
    padding: 0 8px;
    font-size: 0.84rem;
}

.chapter-add-status {
    min-height: 16px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1.2;
}

.chapter-add-status.is-error {
    color: #9c2f22;
}

.chapter-create-link {
    width: 100%;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.thumb-tag-list {
    margin-top: 10px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 8px;
    background: var(--surface-strong);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
}

.empty-state {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.empty-state.compact {
    font-size: 0.9rem;
}

[hidden] {
    display: none !important;
}

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

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 22px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 17, 0.72);
}

.modal-panel {
    position: relative;
    width: min(1080px, 100%);
    max-height: min(90vh, 820px);
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.confirmation-modal {
    z-index: 120;
}

.confirmation-panel {
    width: min(460px, 100%);
}

.confirmation-body {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.confirmation-body p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.confirmation-actions {
    justify-content: flex-end;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header > div:first-child {
    min-width: 0;
}

.modal-header h2,
.modal-header p {
    overflow-wrap: anywhere;
}

.modal-header p {
    margin-bottom: 0;
}

.privacy-summary {
    margin-top: 4px;
    color: var(--primary);
    font-size: 0.86rem;
    font-weight: 900;
}

.privacy-preview-panel {
    margin-bottom: 18px;
}

.privacy-preview-toggle {
    width: fit-content;
    gap: 10px;
    list-style: none;
}

.privacy-preview-toggle::-webkit-details-marker {
    display: none;
}

.privacy-preview-toggle::marker {
    content: "";
}

.privacy-preview-toggle::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #fff;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 900;
}

.privacy-preview-panel[open] .privacy-preview-toggle::after {
    content: "-";
}

.privacy-preview-toggle small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.privacy-preview-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
    border: 1px solid rgba(22, 109, 103, 0.26);
    border-radius: 8px;
    padding: 12px 14px;
    background: #f7fbfa;
}

.privacy-preview-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.privacy-preview-copy strong {
    color: var(--ink);
    font-size: 0.96rem;
}

.privacy-preview-copy span {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.privacy-preview-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.photo-caption-view {
    margin: 6px 0 0;
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.all-items-title-row {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 14px;
}

.all-items-title-row h2 {
    flex: 0 0 auto;
    margin-bottom: 0;
}

#all-items-meta {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: baseline;
    min-width: 0;
    gap: 10px;
    white-space: nowrap;
}

.all-items-controls {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
}

.carousel-speed-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.speed-step-button {
    min-width: 34px;
    padding: 0 10px;
}

.carousel-speed-label {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 900;
}

.carousel-speed-value {
    min-width: 44px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 900;
    text-align: center;
}

.carousel-control-button {
    min-width: 82px;
}

.carousel-step-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.carousel-step-controls[hidden] {
    display: none;
}

.carousel-step-button {
    min-width: 34px;
    padding: 0 10px;
}

.carousel-counter {
    font-size: 0.9rem;
    font-weight: 800;
}

.carousel-date-label {
    color: var(--ink);
    font-size: clamp(1.25rem, 2.5vw, 1.85rem);
    font-weight: 900;
}

.carousel-privacy-label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 900;
}

.modal-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 900;
}

.modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    min-height: 420px;
    max-height: calc(90vh - 76px);
}

.photo-modal-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: min(820px, calc(100dvh - 44px));
    max-height: calc(100dvh - 44px);
}

.photo-modal-panel .modal-body {
    min-height: 0;
    max-height: none;
    overflow: hidden;
}

#modal-image,
#readonly-modal-image,
#carousel-photo-modal-image,
.modal-image {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: calc(90vh - 76px);
    object-fit: contain;
    background: #101412;
}

.carousel-photo-modal-body {
    display: grid;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #101412;
}

.carousel-photo-modal-panel {
    width: min(1080px, 100%);
}

.splash-photo-modal-panel {
    width: min(1120px, 100%);
}

.splash-photo-modal-actions,
.splash-chapter-add-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.splash-photo-modal-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.splash-chapter-add-form select {
    width: min(220px, 36vw);
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.splash-chapter-status {
    min-width: 92px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 900;
}

.splash-chapter-status.is-error {
    color: #9c2f22;
}

.splash-photo-modal-nav-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 54px;
    min-width: 36px;
    padding: 0;
    transform: translateY(-50%);
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.splash-photo-modal-nav-button:hover,
.splash-photo-modal-nav-button:focus-visible {
    border-color: rgba(255, 255, 255, 0.72);
    background: #fff;
}

.splash-photo-modal-nav-button:disabled {
    opacity: 0.35;
}

.splash-photo-modal-nav-button.is-left {
    left: 16px;
}

.splash-photo-modal-nav-button.is-right {
    right: 16px;
}

.splash-photo-modal-body {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #101412;
}

.all-items-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1180px, 100%);
    height: min(820px, calc(100dvh - 44px));
    max-height: calc(100dvh - 44px);
}

.all-items-panel.is-filtering {
    grid-template-rows: auto auto;
    width: min(520px, 100%);
    height: auto;
}

.carousel-filter-panel {
    padding: 24px;
}

.carousel-filter-form {
    display: grid;
    gap: 18px;
}

.carousel-filter-form h3 {
    margin-bottom: 4px;
}

.carousel-filter-form p {
    margin-bottom: 0;
}

.carousel-stage {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 24px;
    background: #101412;
}

.carousel-playback-progress {
    position: absolute;
    top: 10px;
    left: 24px;
    right: 24px;
    z-index: 3;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}

.carousel-playback-progress[hidden] {
    display: none;
}

.carousel-playback-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fff;
}

.carousel-playback-progress progress {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.carousel-card {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 0;
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 320ms ease, transform 320ms ease;
}

.carousel-card.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.carousel-card.is-fading {
    opacity: 0;
}

.carousel-card.is-shifting {
    opacity: 0.58;
    transform: translateX(-18px);
}

.carousel-window {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.carousel-window-item {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) minmax(130px, 32%);
    gap: 10px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 12px;
    background: #ffffff;
}

.carousel-window-item.is-current {
    border-color: rgba(22, 109, 103, 0.42);
}

.carousel-item-meta {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.carousel-item-counter,
.carousel-item-privacy {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.carousel-item-photo-title,
.carousel-item-caption {
    overflow: hidden;
    text-overflow: ellipsis;
}

.carousel-item-photo-title {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 900;
    white-space: nowrap;
}

.carousel-item-caption {
    display: -webkit-box;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.carousel-item-date {
    overflow: hidden;
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.carousel-window-media {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #101412;
}

.carousel-image-button {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
}

.carousel-image-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.82);
    outline-offset: -3px;
}

.carousel-window-media .carousel-image {
    max-width: 100%;
    max-height: 100%;
    cursor: zoom-in;
}

.carousel-window-media .carousel-text {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 14px;
    font-size: 0.95rem;
    line-height: 1.45;
}

.carousel-window-item .carousel-message-panel {
    gap: 8px;
    border-radius: 8px;
    padding: 10px;
}

.carousel-window-item .carousel-message-list {
    gap: 8px;
}

.carousel-window-item .message-item {
    padding: 8px;
}

.carousel-window-item .message-item p {
    font-size: 0.84rem;
}

.carousel-window-item .carousel-message-form textarea {
    min-height: 52px;
    max-height: 82px;
}

.carousel-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - 168px);
    display: block;
    object-fit: contain;
}

.carousel-photo-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 18px;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.carousel-photo-media {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.carousel-photo-layout .carousel-image {
    max-height: 100%;
}

.carousel-message-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
    padding: 16px;
    background: #f7faf7;
}

.carousel-message-panel h3 {
    margin-bottom: 0;
}

.carousel-message-list {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.carousel-message-form {
    display: grid;
    gap: 8px;
}

.carousel-message-form textarea {
    width: 100%;
    min-height: 82px;
    max-height: 150px;
    resize: vertical;
}

.carousel-message-form .button {
    justify-self: stretch;
}

.carousel-message-error {
    margin-bottom: 0;
}

.carousel-text {
    width: min(680px, 100%);
    max-height: 100%;
    overflow-y: auto;
    border-radius: 8px;
    padding: 22px;
    background: #f7faf7;
    color: var(--ink);
    font-size: clamp(1rem, 2vw, 1.35rem);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.carousel-empty {
    color: #fff;
}

.text-modal-panel {
    width: min(760px, 100%);
}

.text-modal-body {
    display: grid;
    gap: 12px;
    max-height: calc(90vh - 76px);
    overflow-y: auto;
    padding: 18px;
}

.text-entry-view {
    max-height: calc(90vh - 130px);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-strong);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.text-entry-edit-form[hidden] {
    display: none;
}

.text-entry-edit-form textarea {
    min-height: 260px;
    max-height: calc(90vh - 250px);
    overflow-y: auto;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.compact-modal {
    max-width: 420px;
}

.stacked-actions {
    align-items: stretch;
    flex-direction: column;
}

.message-panel {
    display: grid;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 12px;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    border-left: 1px solid var(--border);
}

.message-panel h3 {
    margin-bottom: 0;
}

.message-panel .location-fields {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
}

.message-panel .location-form .button,
.message-panel .message-form .button {
    width: 100%;
}

.message-panel .location-map-actions .button {
    width: auto;
}

.tags-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
}

.photo-details-form {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.guided-prompts {
    display: grid;
    gap: 8px;
    border: 1px solid rgba(22, 109, 103, 0.22);
    border-radius: 8px;
    padding: 10px;
    background: #f7fbfa;
}

.guided-prompts[hidden] {
    display: none;
}

.guided-prompts h3 {
    margin-bottom: 0;
    color: var(--ink);
    font-size: 0.88rem;
}

.guided-prompt-list {
    display: grid;
    gap: 7px;
}

.guided-prompt-button {
    display: grid;
    gap: 3px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}

.guided-prompt-button:hover,
.guided-prompt-button:focus-visible {
    border-color: rgba(22, 109, 103, 0.46);
    outline: none;
}

.guided-prompt-button strong {
    font-size: 0.84rem;
}

.guided-prompt-button span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-details-form textarea {
    min-height: 72px;
    max-height: 160px;
}

.photo-details-form .button {
    width: 100%;
}

.people-form {
    gap: 10px;
}

.people-form .button {
    width: 100%;
}

.tags-form .tag-radio small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.tags-form .button {
    width: 100%;
}

.readonly-message-panel {
    grid-template-rows: auto minmax(0, 1fr);
}

.message-list {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 72px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.search-panel {
    margin-bottom: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: end;
    gap: 16px;
}

.search-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 12px;
}

.search-filter-grid input,
.search-filter-grid select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.search-quick-links a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 900;
    text-decoration: none;
}

.search-quick-links a:hover {
    border-color: rgba(22, 109, 103, 0.42);
    color: var(--accent-dark);
}

.people-results,
.timeline-people-list,
.request-list {
    display: grid;
    gap: 10px;
}

.activity-list {
    display: grid;
    gap: 10px;
}

.conversation-list {
    display: grid;
    gap: 10px;
}

.activity-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
}

.conversation-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
    text-decoration: none;
}

.activity-card.is-unread {
    border-color: rgba(22, 109, 103, 0.38);
    background: #f7fbfa;
}

.conversation-card.is-unread {
    border-color: rgba(22, 109, 103, 0.38);
    background: #f7fbfa;
}

.activity-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.conversation-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.activity-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.activity-main strong {
    color: var(--ink);
    font-size: 1rem;
}

.conversation-main strong {
    color: var(--ink);
    font-size: 1rem;
}

.activity-main span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.conversation-main span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.activity-main p {
    margin-bottom: 0;
    line-height: 1.4;
}

.conversation-main p {
    margin-bottom: 0;
    color: var(--ink);
    line-height: 1.4;
}

.person-row,
.request-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
}

.request-card {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.person-summary {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.person-summary strong {
    color: var(--ink);
    font-size: 1rem;
}

.person-summary span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-summary .relationship-badge,
.relationship-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 8px;
    background: var(--surface-strong);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
}

.person-actions {
    display: flex;
    justify-content: flex-end;
}

.person-relationship-panel {
    align-items: end;
}

.person-relationship-form {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}

.person-relationship-form select {
    min-width: 190px;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--surface-strong);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: capitalize;
    white-space: nowrap;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.checkbox-line input {
    width: auto;
}

.connection-modal-panel {
    width: min(480px, 100%);
}

.connection-modal-form {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.connection-section {
    display: grid;
    gap: 14px;
    margin-bottom: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.connection-section h2 {
    margin-bottom: 0;
}

.connections-pane {
    flex: 1;
    min-height: 420px;
    grid-template-rows: auto minmax(0, 1fr);
}

.connections-pane .table-wrap {
    min-height: 0;
    overflow: auto;
}

.private-message-thread {
    gap: 18px;
}

.private-message-list {
    display: grid;
    gap: 10px;
}

.private-message-bubble {
    display: grid;
    justify-self: start;
    width: min(620px, 86%);
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-strong);
}

.private-message-bubble.is-mine {
    justify-self: end;
    border-color: rgba(22, 109, 103, 0.34);
    background: #f7fbfa;
}

.private-message-bubble strong {
    color: var(--ink);
    font-size: 0.9rem;
}

.private-message-bubble p {
    margin: 0;
    line-height: 1.42;
}

.private-message-bubble time {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.private-message-form {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.collections-layout {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    align-items: start;
    gap: 18px;
}

.saved-views-panel,
.save-view-panel,
.collection-results {
    display: grid;
    gap: 14px;
    margin-bottom: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.saved-view-list,
.collection-result-list {
    display: grid;
    gap: 10px;
}

.saved-view-card,
.collection-result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.saved-view-card a,
.collection-result-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.saved-view-card a {
    color: var(--ink);
}

.saved-view-card strong,
.collection-result-main h3 {
    margin-bottom: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-view-card span,
.collection-result-main span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-filter-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    align-items: end;
    gap: 14px;
}

.collection-filter-actions,
.save-view-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.save-view-form label {
    flex: 1 1 260px;
}

.collection-result-main p {
    display: -webkit-box;
    margin-bottom: 0;
    overflow: hidden;
    color: var(--ink);
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.chapter-form {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) minmax(260px, 1.1fr) auto;
    align-items: end;
    gap: 14px;
}

.chapter-form textarea {
    min-height: 72px;
    max-height: 140px;
}

.chapter-draft-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.chapter-draft-entry p {
    margin-bottom: 0;
}

.chapter-draft-filter-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
    align-items: end;
    gap: 12px;
}

.chapter-draft-create-form {
    display: grid;
    gap: 14px;
}

.chapter-draft-list {
    display: grid;
    gap: 8px;
}

.chapter-draft-item {
    display: grid;
    grid-template-columns: auto 34px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    color: var(--ink);
}

.chapter-draft-item input {
    width: 18px;
    height: 18px;
    margin-top: 5px;
}

.chapter-draft-position {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
}

.chapter-draft-main {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.chapter-bulk-review-form {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(240px, 1fr);
    align-items: end;
    gap: 14px;
}

.chapter-bulk-review-form textarea,
.chapter-bulk-review-form .tag-radio-group,
.chapter-bulk-review-form .button {
    grid-column: 1 / -1;
}

.chapter-bulk-review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.chapter-bulk-review-photo {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.chapter-bulk-review-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--surface-strong);
    object-fit: cover;
}

.chapter-bulk-review-photo div {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.chapter-draft-main strong,
.chapter-draft-main span,
.chapter-draft-main small,
.chapter-draft-main em,
.chapter-bulk-review-photo strong,
.chapter-bulk-review-photo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-draft-main strong {
    color: var(--ink);
    font-size: 0.95rem;
}

.chapter-draft-main span,
.chapter-draft-main em {
    color: var(--muted);
    font-size: 0.82rem;
    font-style: normal;
    font-weight: 800;
}

.chapter-draft-main small {
    color: var(--ink);
    font-size: 0.86rem;
    line-height: 1.35;
}

.chapter-bulk-review-photo strong {
    color: var(--ink);
}

.chapter-bulk-review-photo span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}
.chapter-invite-form,
.chapter-share-link-form {
    display: grid;
    grid-template-columns: minmax(220px, 360px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 14px;
}

.chapter-invite-list,
.chapter-share-link-list {
    display: grid;
    gap: 10px;
}

.chapter-invite-card,
.chapter-share-link-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.chapter-invite-card div,
.chapter-share-link-card div {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.chapter-invite-card span,
.chapter-share-link-card span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.chapter-card {
    display: grid;
    grid-template-areas:
        "cover main"
        "cover actions";
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.chapter-card-cover,
.chapter-hero-cover {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
}

.chapter-card-cover {
    grid-area: cover;
    width: 96px;
    aspect-ratio: 1;
}

.chapter-card-cover img,
.chapter-hero-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chapter-card-text-cover,
.chapter-card-empty-cover,
.chapter-hero-text-cover,
.chapter-hero-empty-cover {
    height: 100%;
    overflow: hidden;
    padding: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.chapter-card-empty-cover,
.chapter-hero-empty-cover {
    display: grid;
    place-items: center;
    text-align: center;
}

.chapter-card-main {
    display: grid;
    grid-area: main;
    min-width: 0;
    gap: 6px;
}

.chapter-card-main h3,
.chapter-card-main p {
    margin-bottom: 0;
}

.chapter-card-main p {
    color: var(--muted);
    line-height: 1.4;
}

.chapter-card-main span {
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 900;
}

.chapter-card-actions {
    display: flex;
    grid-area: actions;
    align-items: flex-start;
    gap: 8px;
}

.chapter-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.chapter-title-row h1 {
    margin-bottom: 0;
}

.chapter-hero-panel {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.shared-chapter-hero {
    align-items: stretch;
}

.shared-chapter-summary {
    display: grid;
    align-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    background: #fff;
}

.shared-chapter-summary h2,
.shared-chapter-summary p {
    margin-bottom: 0;
}

.chapter-hero-cover {
    aspect-ratio: 4 / 3;
}

.chapter-settings-panel {
    align-self: start;
}

.chapter-settings-panel summary {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}

.chapter-settings-panel summary::-webkit-details-marker {
    display: none;
}

.chapter-settings-panel[open] summary {
    border-color: rgba(22, 109, 103, 0.42);
    background: #ebf6f3;
    color: var(--primary);
}

.chapter-settings-panel:not([open]) > .chapter-settings-form {
    display: none;
}

.chapter-settings-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr);
    gap: 14px;
    margin-top: 14px;
}

.chapter-settings-form textarea,
.chapter-settings-form .tag-radio-group,
.chapter-settings-form .button {
    grid-column: 1 / -1;
}

.chapter-sequence {
    display: grid;
    gap: 10px;
}

.chapter-sequence-item {
    display: grid;
    grid-template-columns: 28px 38px 104px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.chapter-sequence-item.is-dragging {
    opacity: 0.48;
}

.chapter-sequence-item.is-drop-target {
    border-color: rgba(22, 109, 103, 0.55);
    background: #f5fbf8;
}

.chapter-drag-handle {
    display: inline-grid;
    place-items: center;
    width: 28px;
    min-height: 34px;
    border-radius: 6px;
    color: var(--muted);
    cursor: grab;
    font-weight: 900;
    letter-spacing: 1px;
}

.chapter-sequence-item:active .chapter-drag-handle {
    cursor: grabbing;
}

.chapter-position {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 900;
}

.chapter-preview-wrap {
    position: relative;
    width: 104px;
}

.chapter-preview {
    display: block;
    width: 104px;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--ink);
    text-decoration: none;
}

.chapter-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chapter-text-preview {
    height: 100%;
    overflow: hidden;
    padding: 10px;
    color: var(--ink);
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.chapter-item-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.chapter-item-main strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-item-main span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-cover-note {
    justify-self: start;
    border-radius: 999px;
    padding: 2px 8px;
    background: var(--surface-strong);
    color: var(--primary) !important;
    font-size: 0.78rem !important;
}

.chapter-item-main p {
    max-height: 3.9em;
    overflow: hidden;
    margin-bottom: 0;
    color: var(--ink);
    line-height: 1.3;
}

.chapter-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compact-status {
    margin-bottom: 0;
    font-size: 0.88rem;
}

.inline-form {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
}

.connection-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.connection-table th,
.connection-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px;
    text-align: left;
}

.connection-table th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.connection-table td {
    font-weight: 700;
}

.connection-table .empty-table-cell {
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}

.connection-actions-menu {
    position: relative;
    width: max-content;
}

.connection-actions-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    list-style: none;
}

.connection-actions-menu summary::-webkit-details-marker {
    display: none;
}

.connection-actions-menu[open] summary {
    border-color: rgba(22, 109, 103, 0.42);
    background: #ebf6f3;
    color: var(--primary);
}

.connection-actions-panel {
    display: grid;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    width: min(260px, calc(100vw - 48px));
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(16, 24, 20, 0.16);
}

.connection-type-form,
.connection-type-form label {
    display: grid;
    gap: 8px;
}

.connection-type-form label span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.connection-type-form select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.connection-actions-panel .button {
    width: 100%;
    white-space: nowrap;
}

.timeline-search-list {
    display: grid;
    gap: 12px;
}

.timeline-search-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.timeline-search-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.timeline-search-thumb {
    width: 72px;
    height: 72px;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface);
}

.person-text-memory-thumb {
    display: -webkit-box;
    overflow: hidden;
    padding: 8px;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.person-memory-card .people-chip-list {
    margin-top: 2px;
}

.timeline-search-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.timeline-search-main h2 {
    overflow: hidden;
    margin-bottom: 0;
    color: var(--ink);
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-search-main h3 {
    overflow: hidden;
    margin-bottom: 0;
    color: var(--ink);
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-search-main span:not(.status-badge) {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-search-main p {
    margin-bottom: 0;
    color: var(--ink);
    line-height: 1.4;
}

.timeline-search-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.timeline-search-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.review-stat-link {
    color: inherit;
    text-decoration: none;
}

.review-stat-link:hover {
    border-color: rgba(22, 109, 103, 0.42);
}

.memory-score-panel {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(22, 109, 103, 0.3);
    border-radius: 8px;
    padding: 18px;
    background: #f7fbfa;
    box-shadow: var(--shadow);
}

.memory-score-meter {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border: 10px solid rgba(22, 109, 103, 0.18);
    border-radius: 50%;
    background: #fff;
    text-align: center;
}

.memory-score-meter strong {
    color: var(--primary);
    font-size: 1.9rem;
    line-height: 1;
}

.memory-score-meter span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.memory-score-main {
    display: grid;
    gap: 8px;
}

.memory-score-main h2,
.memory-score-main p {
    margin-bottom: 0;
}

.memory-score-main progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}

.memory-score-main progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--border);
}

.memory-score-main progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.memory-score-main progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.memory-score-main p {
    color: var(--muted);
    line-height: 1.45;
}

.review-focus-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(22, 109, 103, 0.28);
    border-radius: 8px;
    padding: 18px;
    background: #f7fbfa;
}

.review-focus-panel h2,
.review-issue-header h2 {
    margin: 6px 0 4px;
    color: var(--ink);
    font-size: 1.12rem;
}

.review-focus-panel p,
.review-issue-header p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.review-queue-list {
    display: grid;
    gap: 14px;
}

.guided-review-shell {
    display: grid;
    grid-template-columns: minmax(220px, 0.32fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.guided-review-progress,
.guided-review-main {
    display: grid;
    gap: 12px;
}

.guided-review-progress {
    position: sticky;
    top: 78px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.guided-review-progress strong {
    color: var(--ink);
    font-size: 1.08rem;
}

.guided-review-progress progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}

.guided-review-progress progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--border);
}

.guided-review-progress progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.guided-review-progress progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.guided-review-progress p,
.guided-review-progress > span:not(.status-badge),
.guided-review-step p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.guided-review-progress > span:not(.status-badge) {
    font-size: 0.86rem;
    font-weight: 900;
}

.guided-review-step {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid rgba(22, 109, 103, 0.28);
    border-radius: 8px;
    padding: 18px;
    background: #f7fbfa;
}

.guided-review-step h2 {
    margin: 6px 0 4px;
    color: var(--ink);
    font-size: 1.24rem;
}

.guided-review-card {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
}

.guided-review-thumb {
    width: 150px;
    height: 150px;
}

.guided-review-actions {
    width: 100%;
    min-width: 0;
}

.guided-review-card .timeline-search-content {
    align-items: start;
}

.guided-review-card .review-prompt-form {
    grid-template-columns: minmax(140px, 0.45fr) minmax(0, 1fr) auto;
}

.guided-review-card .review-prompt-place-form {
    grid-template-columns: minmax(140px, 0.45fr) minmax(150px, 1fr) minmax(68px, 82px) minmax(68px, 82px) auto;
}

.guided-review-card .review-prompt-stack {
    width: 100%;
}

.review-issue-card {
    display: grid;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.review-issue-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
}

.review-sample-list {
    display: grid;
    gap: 10px;
}

.review-sample-card {
    align-items: stretch;
    box-shadow: none;
}

.review-card-actions {
    display: grid;
    align-content: center;
    gap: 8px;
    min-width: min(100%, 340px);
}

.review-inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
}

.review-place-form {
    grid-template-columns: minmax(150px, 1fr) minmax(72px, 88px) minmax(72px, 88px) auto;
}

.review-prompt-stack {
    display: grid;
    gap: 10px;
}

.review-prompt-form {
    grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr) auto;
    align-items: start;
    border: 1px solid rgba(22, 109, 103, 0.2);
    border-radius: 8px;
    padding: 10px;
    background: #f7fbfa;
}

.review-prompt-place-form {
    grid-template-columns: minmax(120px, 0.7fr) minmax(130px, 1fr) minmax(68px, 82px) minmax(68px, 82px) auto;
}

.review-prompt-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.review-prompt-copy strong {
    color: var(--ink);
    font-size: 0.88rem;
    line-height: 1.25;
}

.review-prompt-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
}

.review-inline-form label {
    display: grid;
    gap: 4px;
}

.review-inline-form span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.review-inline-form input,
.review-inline-form select,
.review-inline-form textarea {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
}

.review-inline-form textarea {
    min-height: 68px;
    padding: 8px 10px;
    line-height: 1.35;
    resize: vertical;
}

.review-duplicate-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-intelligence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.photo-intelligence-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin: 14px 0;
}

.photo-intelligence-toolbar span {
    color: var(--muted);
}

.photo-intelligence-card {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: var(--surface);
}

.photo-intelligence-select-card {
    position: relative;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.photo-intelligence-select-card:hover {
    border-color: var(--primary);
}

.photo-intelligence-select-card:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(20, 126, 117, 0.18);
}

.photo-intelligence-select-card input {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--primary);
    z-index: 1;
}

.photo-intelligence-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    background: var(--surface-muted);
}

.photo-intelligence-card div {
    display: grid;
    gap: 3px;
}

.photo-intelligence-card strong,
.photo-intelligence-card span {
    overflow-wrap: anywhere;
}

.photo-intelligence-card span {
    color: var(--muted);
    font-size: 0.86rem;
}

.photo-similar-group-list {
    display: grid;
    gap: 14px;
}

.photo-similar-group {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface);
}

.photo-similar-group header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.photo-similar-group header span {
    color: var(--muted);
    font-size: 0.9rem;
}

.story-room-invite-picker {
    display: grid;
    gap: 10px;
}

.story-room-check-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.story-room-check-list label {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--surface);
}

.story-room-check-list small {
    grid-column: 2;
    color: var(--muted);
    font-weight: 700;
}

.story-room-inline-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 10px;
}

.story-room-invite-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.story-room-contribution-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.story-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.story-room-item {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--surface);
}

.story-room-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    background: var(--surface-muted);
}

.story-room-item h3 {
    margin: 0;
    font-size: 1rem;
}

.story-room-item p,
.story-room-item span {
    overflow-wrap: anywhere;
}

.story-room-item span {
    color: var(--muted);
    font-size: 0.86rem;
}

.story-room-text-preview {
    min-height: 150px;
    max-height: 210px;
    overflow: auto;
    border-radius: 6px;
    padding: 10px;
    background: var(--surface-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.origin-form {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.origin-shell .page-heading {
    flex: 0 0 auto;
    margin-bottom: 12px;
}

.origin-count-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.origin-settings-menu .local-settings-popup {
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 32px));
}

.origin-settings-popup .origin-count-controls {
    justify-content: space-between;
    width: 100%;
}

.origin-settings-reset-form,
.origin-settings-reset-form .button {
    width: 100%;
}

.origin-autosave-status {
    min-width: 6ch;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.origin-autosave-status.is-error {
    color: var(--danger);
}

.origin-count-control-form {
    display: inline-flex;
    margin: 0;
}

.origin-count-controls .button {
    width: 32px;
    min-height: 28px;
    padding: 0;
}

.origin-count-controls strong {
    min-width: 1.5ch;
    color: var(--ink);
    text-align: center;
}

.origin-zoom-controls strong {
    min-width: 4ch;
}

.origin-board-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: scroll;
    scrollbar-gutter: stable both-edges;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.origin-board {
    position: relative;
    display: grid;
    --origin-cell-width: 112px;
    --origin-cell-height: 176px;
    --origin-label-font-size: 12.8px;
    --origin-input-font-size: 12.5px;
    --origin-label-padding: 5px 6px 2px;
    --origin-input-padding: 5px;
    --origin-input-height: 34px;
    --origin-thumbnail-height: 100px;
    --origin-slot-border-width: 2px;
    --origin-selection-border-width: 3px;
    --origin-focus-outline-width: 2px;
    grid-template-columns: repeat(var(--origin-cols), var(--origin-cell-width));
    grid-template-rows: repeat(var(--origin-rows), var(--origin-cell-height));
    min-width: calc(var(--origin-cols) * var(--origin-cell-width));
    padding: 22px;
    background-image:
        linear-gradient(to right, #e5e9e3 1px, transparent 1px),
        linear-gradient(to bottom, #e5e9e3 1px, transparent 1px);
    background-size: var(--origin-cell-width) var(--origin-cell-height);
    background-position: 22px 22px;
    cursor: cell;
    user-select: none;
}

.origin-board:focus {
    outline: var(--origin-focus-outline-width) solid var(--primary);
    outline-offset: -2px;
}

.origin-selection-marker {
    z-index: 5;
    min-width: 0;
    min-height: 0;
    border: var(--origin-selection-border-width) solid #2563eb;
    border-radius: 3px;
    background: rgba(37, 99, 235, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
    pointer-events: none;
}

.origin-selection-marker[hidden] {
    display: none;
}

.origin-path-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    background: #92d050;
    color: #182114;
    font-size: var(--origin-label-font-size);
    font-weight: 900;
    line-height: 1;
    overflow: hidden;
}

.origin-slot {
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, var(--origin-thumbnail-height)) auto;
    align-content: start;
    align-self: stretch;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: var(--origin-slot-border-width) solid #111;
    background: #fff;
}

.origin-slot.is-plain {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.8);
}

.origin-slot > span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    padding: var(--origin-label-padding);
    color: #111;
    font-size: var(--origin-label-font-size);
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.origin-photo-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: var(--origin-thumbnail-height);
    max-width: var(--origin-thumbnail-height);
    justify-self: center;
    overflow: hidden;
    border: 0;
    border-top: max(1px, var(--origin-slot-border-width)) solid var(--border);
    padding: max(1px, calc(var(--origin-slot-border-width) * 0.5));
    background: var(--surface-strong);
    color: var(--muted);
    cursor: pointer;
}

.origin-photo-button:hover,
.origin-photo-button:focus-visible {
    background: #dfe9e5;
}

.origin-photo-button img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 3px;
    object-fit: cover;
}

.origin-photo-placeholder {
    overflow: hidden;
    color: var(--muted);
    font-size: var(--origin-input-font-size);
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.origin-slot input {
    width: 100%;
    height: var(--origin-input-height);
    min-width: 0;
    border: 0;
    border-top: max(1px, var(--origin-slot-border-width)) solid var(--border);
    border-radius: 0;
    padding: var(--origin-input-padding);
    background: #fff;
    color: var(--ink);
    font-size: var(--origin-input-font-size);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    user-select: text;
    cursor: text;
}

.origin-slot.is-plain input {
    border: 1px solid var(--border);
    border-radius: 4px;
}

.origin-slot input:focus {
    outline: var(--origin-focus-outline-width) solid var(--primary);
    outline-offset: -2px;
}

.origin-photo-picker-panel {
    width: min(960px, calc(100vw - 32px));
    max-height: min(780px, calc(100vh - 32px));
}

.origin-photo-picker-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px 0;
}

.origin-photo-picker-controls strong {
    min-width: 7ch;
    text-align: center;
}

.origin-photo-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    gap: 5px;
    min-height: 240px;
    max-height: min(600px, calc(100vh - 190px));
    overflow: auto;
    padding: 16px;
}

.origin-photo-picker-thumb {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0;
    background: #111;
    cursor: pointer;
}

.origin-photo-picker-thumb:hover,
.origin-photo-picker-thumb:focus-visible {
    border-color: var(--primary);
    outline: 2px solid rgba(22, 109, 103, 0.25);
    outline-offset: 1px;
}

.origin-photo-picker-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 640px) {
    .story-room-inline-form {
        grid-template-columns: 1fr;
    }
}

.review-action-status {
    min-height: 18px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.review-action-status.is-error {
    color: var(--danger);
}

.timeline-map-panel {
    margin-bottom: 18px;
}

.map-filter-form {
    grid-template-columns: minmax(140px, 180px) minmax(160px, 220px) auto;
}

.timeline-map-canvas {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(32, 37, 34, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(32, 37, 34, 0.08) 1px, transparent 1px),
        radial-gradient(circle at 22% 35%, rgba(22, 109, 103, 0.16), transparent 18%),
        radial-gradient(circle at 52% 42%, rgba(184, 79, 62, 0.14), transparent 16%),
        radial-gradient(circle at 74% 56%, rgba(78, 105, 125, 0.16), transparent 18%),
        #dfe8e3;
    background-size: 10% 20%, 10% 20%, auto, auto, auto, auto;
    box-shadow: var(--shadow);
}

.compact-map-canvas {
    min-height: 300px;
}

.timeline-map-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 49.8%, rgba(32, 37, 34, 0.14) 50%, transparent 50.2%),
        linear-gradient(0deg, transparent 49.8%, rgba(32, 37, 34, 0.14) 50%, transparent 50.2%);
    pointer-events: none;
}

.timeline-map-marker {
    position: absolute;
    z-index: 2;
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(32, 37, 34, 0.3);
    transform: translate(-50%, -50%);
}

.timeline-map-marker.text {
    background: var(--primary);
}

.timeline-map-marker.place {
    width: 34px;
    height: 34px;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
}

.timeline-map-marker span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #fff;
}

.timeline-map-marker.place span {
    display: inline-grid;
    place-items: center;
    width: auto;
    height: auto;
    min-width: 1.4em;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
}

.map-empty {
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(90%, 320px);
    transform: translate(-50%, -50%);
}

.map-place-clusters {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.map-place-clusters h2,
.map-place-list h2 {
    margin-bottom: 0;
}

.map-place-cluster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.map-place-cluster-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(24, 31, 28, 0.08);
}

.map-place-cluster-card:hover {
    border-color: rgba(22, 109, 103, 0.45);
}

.map-place-cluster-card h3 {
    overflow: hidden;
    margin-bottom: 3px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-place-cluster-card span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.map-place-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.map-place-counts span {
    border-radius: 999px;
    padding: 4px 8px;
    background: var(--surface-strong);
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 900;
}

.hub-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.hub-stat {
    display: grid;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.hub-stat strong {
    color: var(--ink);
    font-size: 1.25rem;
}

.hub-stat span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
}

.hub-insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.hub-insight-panel {
    display: grid;
    align-content: start;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.hub-insight-panel h2,
.hub-insight-panel p {
    margin-bottom: 0;
}

.hub-insight-panel p {
    color: var(--muted);
    font-weight: 800;
}

.legacy-notes-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
    border: 1px solid rgba(22, 109, 103, 0.24);
    border-radius: 8px;
    padding: 16px;
    background: #f7fbfa;
}

.legacy-notes-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.legacy-notes-header h2 {
    margin: 6px 0 4px;
    color: var(--ink);
    font-size: 1.08rem;
}

.legacy-notes-header p {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 800;
    line-height: 1.45;
}

.legacy-note-form {
    display: grid;
    grid-template-columns: minmax(140px, 0.42fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}

.legacy-note-form label {
    display: grid;
    gap: 5px;
}

.legacy-note-form span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.legacy-note-form input,
.legacy-note-form textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
}

.legacy-note-form textarea {
    min-height: 84px;
    padding: 9px 10px;
    line-height: 1.4;
    resize: vertical;
}

.legacy-note-list {
    display: grid;
    gap: 10px;
}

.legacy-note-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.legacy-note-card h3 {
    margin-bottom: 5px;
    color: var(--ink);
    font-size: 0.98rem;
}

.legacy-note-card p {
    margin-bottom: 6px;
    color: var(--ink);
    line-height: 1.45;
    white-space: pre-wrap;
}

.legacy-note-card span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.hub-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.hub-chip-list a,
.hub-related-row {
    color: var(--ink);
    text-decoration: none;
}

.hub-chip-list a {
    border: 1px solid rgba(22, 109, 103, 0.24);
    border-radius: 999px;
    padding: 5px 9px;
    background: #f5fbfa;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 900;
}

.hub-related-row {
    display: grid;
    gap: 3px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.hub-related-row:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.hub-related-row strong,
.hub-related-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hub-related-row span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.map-place-list {
    display: grid;
    gap: 12px;
}

.map-place-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.map-place-card.needs-coordinates {
    border-style: dashed;
}

.map-place-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.map-place-main h2,
.map-place-main p {
    margin-bottom: 0;
}

.map-place-main h2 {
    font-size: 1rem;
}

.map-place-main span:not(.status-badge),
.map-place-main small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-form {
    min-height: 0;
}

.message-form textarea {
    min-height: 72px;
    max-height: 120px;
    overflow-y: auto;
}

.message-item {
    display: grid;
    gap: 5px;
    padding: 10px;
    border-radius: 8px;
    background: var(--surface-strong);
}

.message-author {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 900;
}

.message-item p {
    margin-bottom: 0;
    line-height: 1.35;
}

.message-item time {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

@media (max-width: 760px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0;
        min-height: 58px;
        padding: 0;
    }

    .topbar-main {
        min-height: 58px;
        padding: 0 12px 0 16px;
    }

    .nav-toggle {
        position: relative;
        display: inline-flex;
    }

    .topbar-actions {
        position: fixed;
        top: 58px;
        right: 0;
        left: 0;
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        max-height: calc(100dvh - 58px);
        overflow-y: auto;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px 14px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: var(--shadow);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
        visibility: hidden;
    }

    .topbar-actions.is-open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        visibility: visible;
    }

    .topbar-link {
        width: 100%;
        min-height: 46px;
        justify-content: flex-start;
        padding: 0 12px;
        font-size: 0.94rem;
    }

    .notification-link {
        justify-content: space-between;
    }

    .username {
        display: block;
        border-top: 1px solid var(--border);
        margin-top: 4px;
        padding: 10px 12px 4px;
    }

    .topbar-actions form,
    .topbar .button.small {
        width: 100%;
    }

    .topbar .button.small {
        min-height: 46px;
    }

    .shell {
        width: min(100% - 24px, 1120px);
        padding-top: 24px;
    }

    .shell.splash-shell,
    .shell.home-shell {
        width: 100%;
        padding: 0;
    }

    .privacy-preview-body {
        align-items: stretch;
        flex-direction: column;
    }

    .privacy-preview-actions {
        justify-content: flex-start;
    }

    .splash-page {
        height: calc(100dvh - 58px);
        min-height: 360px;
    }

    .home-live-page {
        --home-grid-gap: 3px;
        --home-grid-pad: 3px;
        --home-tile-size: min(calc((100vw - 33px) / 10), calc((100dvh - 85px) / 8));
        height: calc(100dvh - 58px);
        min-height: 420px;
    }

    .home-photo-grid {
        grid-template-columns: repeat(10, var(--home-tile-size));
        grid-auto-rows: var(--home-tile-size);
        gap: var(--home-grid-gap);
        padding: var(--home-grid-pad);
    }

    .home-copy-field {
        --home-copy-line: calc(0.82rem * 1.34);
        padding: calc(var(--home-copy-line) * 2) 14px;
    }

    .home-copy-field p {
        font-size: 0.82rem;
        line-height: 1.34;
    }

    .chapter-bulk-select-page {
        padding-top: 188px;
    }

    .no-date-splash-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .no-date-splash-toolbar .button,
    .no-date-selected-count {
        width: 100%;
    }

    .no-date-splash-page {
        height: min(620px, calc(100dvh - 260px));
        min-height: 320px;
    }

    .splash-grid {
        gap: 2px;
        padding: 2px;
    }

    .splash-page-button {
        width: 38px;
        height: 58px;
        font-size: 1.45rem;
    }

    .splash-page-prev {
        left: 6px;
    }

    .splash-page-next {
        right: 6px;
    }

    .chapter-bulk-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .month-bulk-actions-toolbar {
        display: flex;
    }

    .chapter-bulk-toolbar .button {
        width: 100%;
    }

    .chapter-bulk-progress {
        flex-basis: auto;
        margin-left: 0;
        width: 100%;
    }

    .chapter-bulk-save-form {
        width: 100%;
        flex-basis: auto;
    }

    .month-bulk-action-controls {
        align-items: stretch;
        flex-direction: column;
        flex-basis: auto;
        width: 100%;
    }

    .month-bulk-control {
        min-width: 0;
    }

    .chapter-bulk-chapter-select {
        width: 100%;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .timeline-page-actions {
        flex-wrap: wrap;
    }

    .timeline-page-actions .privacy-preview-body {
        left: 0;
        right: auto;
    }

    .progress-card-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .memory-completeness-summary-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .memory-completeness-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .anniversary-group-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .legacy-notes-header {
        flex-direction: column;
    }

    .floating-progress {
        right: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
    }

    .month-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .month-entry-actions {
        grid-template-columns: 1fr;
    }

    .view-all-button,
    .view-random-button,
    .year-carousel-actions .view-all-button,
    .year-carousel-actions .view-random-button {
        width: 100%;
        flex-basis: 100%;
    }

    .timeline-frame > .view-all-button + .view-random-button {
        margin-left: 0;
        margin-top: 10px;
    }

    .upload-form,
    .import-upload-form,
    .text-entry-form,
    .search-form,
    .review-inline-form,
    .review-place-form,
    .review-prompt-form,
    .review-prompt-place-form,
    .legacy-note-form,
    .collection-filter-form,
    .tags-form,
    .location-form,
    .privacy-bulk-form,
    .chapter-form,
    .chapter-draft-filter-form,
    .chapter-bulk-review-form,
    .chapter-invite-form,
    .chapter-share-link-form {
        grid-template-columns: 1fr;
    }

    .import-review-card,
    .import-review-card.has-duplicate,
    .import-review-preview-grid,
    .import-review-card.has-duplicate .import-review-preview-grid,
    .import-review-fields {
        grid-template-columns: 1fr;
    }

    .import-review-preview img {
        max-height: 240px;
    }

    .import-review-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .import-review-title-row h2 {
        white-space: normal;
    }

    .location-fields {
        grid-template-columns: 1fr;
    }

    .search-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .person-row,
    .request-card,
    .activity-card,
    .conversation-card,
    .timeline-search-card,
    .premium-hero-panel,
    .review-focus-panel,
    .memory-score-panel,
    .review-issue-header,
    .legacy-note-card,
    .map-place-card,
    .collections-layout,
    .guided-review-shell,
    .guided-review-step,
    .saved-view-card,
    .collection-result-card,
    .chapter-invite-card,
    .chapter-share-link-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .guided-review-progress {
        position: static;
    }

    .memory-score-meter {
        width: min(132px, 100%);
        justify-self: center;
    }

    .person-actions,
    .request-card .button,
    .activity-card .button,
    .conversation-card .button,
    .timeline-search-card .button,
    .premium-hero-panel .button,
    .review-focus-panel .button,
    .review-issue-header .button,
    .review-card-actions,
    .review-inline-form .button,
    .review-duplicate-actions .button,
    .legacy-note-card .button,
    .map-place-card .button,
    .saved-view-card .button,
    .collection-result-card .button,
    .chapter-invite-card .button,
    .chapter-share-link-card .button,
    .inline-form {
        width: 100%;
    }

    .timeline-search-main h2,
    .timeline-search-main h3,
    .timeline-search-main span:not(.status-badge),
    .saved-view-card strong,
    .saved-view-card span,
    .collection-result-main h3,
    .collection-result-main span,
    .map-place-main span:not(.status-badge),
    .map-place-main small,
    .chapter-invite-card span,
    .chapter-share-link-card span {
        white-space: normal;
    }

    .timeline-search-content {
        align-items: start;
    }

    .save-view-form,
    .collection-filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .timeline-map-canvas {
        min-height: 300px;
    }

    .chapter-card,
    .chapter-sequence-item {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .chapter-card {
        grid-template-areas:
            "cover"
            "main"
            "actions";
    }

    .chapter-draft-entry {
        align-items: stretch;
        flex-direction: column;
    }

    .chapter-draft-entry .button {
        width: 100%;
    }

    .chapter-draft-main strong,
    .chapter-draft-main span,
    .chapter-draft-main small,
    .chapter-draft-main em,
    .hub-related-row strong,
    .hub-related-row span {
        white-space: normal;
    }

    .chapter-card-cover {
        width: 100%;
        aspect-ratio: 4 / 3;
    }

    .chapter-hero-panel,
    .chapter-settings-form {
        grid-template-columns: 1fr;
    }

    .chapter-card-actions,
    .chapter-item-actions {
        flex-wrap: wrap;
    }

    .chapter-preview-wrap,
    .chapter-preview {
        width: min(100%, 220px);
    }

    .chapter-item-main strong,
    .chapter-item-main span {
        white-space: normal;
    }

    .tag-radio-list,
    .tag-check-list {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .all-items-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .all-items-title-row,
    #all-items-meta {
        flex-wrap: wrap;
        white-space: normal;
    }

    .all-items-controls {
        align-self: flex-end;
        flex-wrap: wrap;
        justify-content: flex-end;
        min-width: 0;
        width: 100%;
    }

    .modal {
        padding: 10px;
    }

    .all-items-panel {
        height: calc(100dvh - 20px);
        max-height: calc(100dvh - 20px);
    }

    .photo-modal-panel {
        height: calc(100dvh - 20px);
        max-height: calc(100dvh - 20px);
    }

    .modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(220px, 46vh) minmax(260px, 1fr);
    }

    .carousel-stage {
        padding: 14px;
    }

    .carousel-window {
        gap: 8px;
    }

    .carousel-window-item {
        grid-template-rows: auto minmax(0, 1fr) minmax(92px, 28%);
        gap: 7px;
        padding: 8px;
    }

    .carousel-item-counter,
    .carousel-item-privacy {
        font-size: 0.66rem;
    }

    .carousel-item-date {
        font-size: 0.78rem;
    }

    .carousel-window-media .carousel-text {
        padding: 9px;
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .carousel-window-item .carousel-message-panel {
        padding: 8px;
    }

    .carousel-window-item .carousel-message-panel h3 {
        font-size: 0.78rem;
    }

    .carousel-window-item .message-item {
        padding: 6px;
    }

    .carousel-window-item .message-item p,
    .carousel-window-item .message-item time {
        font-size: 0.68rem;
    }

    .carousel-window-item .carousel-message-form textarea {
        min-height: 44px;
        max-height: 64px;
    }

    .carousel-image {
        max-height: calc(100dvh - 132px);
    }

    .carousel-photo-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(130px, 34%);
        gap: 12px;
    }

    .carousel-photo-layout .carousel-image {
        max-height: 100%;
    }

    .message-panel {
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}
