:root {
    --night: #061019;
    --night-soft: #0b1622;
    --stone: #76808a;
    --stone-deep: #20262d;
    --ivory: #e7ddd0;
    --rose: #8d1626;
    --rose-soft: #bc4655;
    --cream: #d8c4ad;
    --gold: #a98350;
    --mist: rgba(216, 228, 238, 0.08);
    --panel: rgba(10, 17, 25, 0.68);
    --panel-border: rgba(203, 213, 225, 0.16);
    --shadow: rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at top, rgba(30, 54, 82, 0.36), transparent 32%),
        linear-gradient(180deg, #04070d 0%, #07111b 48%, #05080d 100%);
    color: var(--ivory);
    font-family: ui-serif, Georgia, "Times New Roman", serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow: auto;
}

body.memorial-page {
    overflow: hidden;
}

.memorial-shell {
    position: relative;
    min-height: 100vh;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#memorial-canvas,
.scene-vignette {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.scene-vignette {
    pointer-events: none;
    background:
        radial-gradient(circle at center, transparent 34%, rgba(4, 6, 10, 0.32) 72%, rgba(3, 5, 8, 0.86) 100%),
        linear-gradient(90deg, rgba(4, 8, 12, 0.12), rgba(4, 8, 12, 0) 45%, rgba(4, 8, 12, 0.46));
}

.memorial-panel {
    --panel-shift-x: 0;
    position: absolute;
    top: 50%;
    right: clamp(1rem, 4vw, 3.5rem);
    transform: translate(var(--panel-shift-x), -50%);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--panel-border);
    border-radius: 1.5rem;
    background:
        linear-gradient(180deg, rgba(17, 27, 40, 0.82), rgba(8, 13, 19, 0.72)),
        rgba(7, 10, 16, 0.5);
    box-shadow: 0 1.5rem 4rem var(--shadow);
    backdrop-filter: blur(22px);
    transition: transform 220ms ease, opacity 220ms ease;
    overflow: visible;
    z-index: 14;
}

.memorial-panel-scroll {
    max-height: calc(100vh - 2rem);
    padding: clamp(1.25rem, 2vw, 2rem);
    overflow-y: auto;
}

.memorial-inscription {
    position: absolute;
    left: 0;
    bottom: clamp(1rem, 5vh, 3rem);
    width: 100%;
    max-width: 300px;
    padding: 1.2rem 1.35rem;
    border: 1px solid rgba(213, 196, 170, 0.18);
    border-radius: 1.25rem;
    background: linear-gradient(180deg, rgba(15, 20, 29, 0.64), rgba(8, 12, 18, 0.42));
    box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(14px);
    font-size: 0.9rem;
}

.left-panel {
    --left-panel-shift-x: calc(-100% + 1.7rem);
    transform: translateX(var(--left-panel-shift-x));
    transition: transform 220ms ease, opacity 220ms ease;
    z-index: 12;
    opacity: 0.96;
    overflow: visible;
}

.left-panel.is-open {
    --left-panel-shift-x: 0;
}

.left-panel-content {
    display: grid;
    gap: 0.7rem;
}

.left-panel-toggle {
    position: absolute;
    top: 50%;
    left: calc(100% - 3.05rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 9.75rem;
    padding: 0.85rem 1rem;
    border: 0;
    border-radius: 0.95rem 0.95rem 0 0;
    background: linear-gradient(135deg, #d0a24a, #b9842c 65%, #8a5d18);
    color: #1c1206;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transform: translateY(-50%) rotate(90deg);
    transform-origin: center;
    box-shadow: 0 1rem 2rem rgba(75, 47, 10, 0.28);
    transition: filter 180ms ease;
}

.left-panel-toggle:hover {
    filter: brightness(1.06);
}

.memorial-inscription p {
    margin: 0.2rem 0;
    color: rgba(239, 231, 221, 0.82);
    line-height: 1.5;
}

.memorial-inscription-date {
    color: rgba(231, 208, 170, 0.96);
    font-size: 1.05rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.memorial-inscription-title {
    color: rgba(245, 232, 201, 0.92);
    font-size: 0.98rem;
}

.eyebrow {
    margin: 0 0 0.6rem;
    color: rgba(232, 210, 176, 0.78);
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-size: 0.78rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.4rem, 4vw, 4.3rem);
    line-height: 0.94;
    font-weight: 600;
}

.memorial-title {
    font-size: clamp(1.85rem, 2.6vw, 2.45rem);
    line-height: 1.1;
}

.intro,
.instruction,
.panel-footer,
.form-message,
.field-label {
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

.intro,
.instruction,
.panel-footer p {
    color: rgba(233, 225, 214, 0.78);
    line-height: 1.6;
}

.intro {
    margin: 1rem 0 0.75rem;
    max-width: 28rem;
}

.instruction {
    margin: 0 0 1.5rem;
    max-width: 26rem;
}

.memorial-welcome {
    max-width: 420px;
    font-size: 14px;
    line-height: 1.6;
    color: #cfcfcf;
    opacity: 0.9;
    margin-bottom: 18px;
}

.memorial-welcome strong {
    color: #ffffff;
}

.tribute-form {
    display: grid;
    gap: 0.85rem;
}

.panel-toggle {
    position: absolute;
    top: 50%;
    right: calc(100% - 2.65rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.75rem;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 0.95rem 0.95rem 0 0;
    background: linear-gradient(135deg, #a31b2d, #7a111f 68%, #560b15);
    color: #f8eee5;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center;
    box-shadow: 0 1rem 2rem rgba(62, 8, 18, 0.34);
    transition: filter 180ms ease, opacity 180ms ease;
}

.panel-toggle:hover {
    filter: brightness(1.06);
}

.right-panel {
    --panel-shift-x: calc(100% - 0.95rem);
    opacity: 0.92;
}

.right-panel.is-open {
    --panel-shift-x: 0;
    opacity: 1;
}

.field-label {
    font-size: 0.93rem;
    color: rgba(231, 221, 208, 0.86);
}

.tribute-form input {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(222, 226, 232, 0.18);
    border-radius: 999px;
    background: rgba(244, 237, 229, 0.07);
    color: var(--ivory);
    font-size: 1rem;
    outline: none;
    transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.tribute-form input[type="date"] {
    color-scheme: dark;
}

.tribute-form input::placeholder {
    color: rgba(232, 223, 210, 0.36);
}

.tribute-form input:focus {
    border-color: rgba(196, 160, 111, 0.72);
    background: rgba(244, 237, 229, 0.12);
    box-shadow: 0 0 0 0.25rem rgba(169, 131, 80, 0.12);
}

.tribute-form button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #8d1626, #6d0f1d 62%, #4f0a15);
    color: #f8eee5;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    box-shadow: 0 1.2rem 2rem rgba(62, 8, 18, 0.34);
}

.tribute-form button:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.tribute-form button:disabled {
    cursor: wait;
    opacity: 0.74;
}

.form-message {
    min-height: 1.5rem;
    margin: 0;
    color: rgba(236, 228, 216, 0.76);
}

.form-message.is-error {
    color: #f0b4b4;
}

.form-message.is-success {
    color: #d9c7a0;
}

.panel-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(221, 228, 235, 0.08);
}

.tribute-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 1.5s ease;
}

.tribute-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.tribute-content {
    text-align: center;
    color: #ffffff;
    padding: 1.5rem;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.6),
        0 0 25px rgba(255, 255, 255, 0.3);
}

.tribute-label {
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 20px;
    opacity: 0.8;
    text-transform: uppercase;
}

.tribute-name {
    font-size: 64px;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1.08;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
}

.rose-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    z-index: 3000;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.24);
}

.rose-tooltip strong,
.rose-tooltip small {
    display: block;
}

.rose-tooltip small {
    margin-top: 0.2rem;
    color: rgba(255, 255, 255, 0.7);
}

.rose-tooltip.hidden {
    display: none;
}

.admin-link {
    position: fixed;
    right: 18px;
    bottom: 12px;
    z-index: 40;
    color: #888;
    font-size: 12px;
    opacity: 0.6;
    white-space: nowrap;
    text-decoration: none;
    transition: opacity 180ms ease;
}

.admin-link:hover {
    opacity: 1;
}

.memorial-footer {
    position: fixed;
    left: 50%;
    bottom: 12px;
    z-index: 35;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 15px;
    color: #d4b06a;
    opacity: 0.88;
    text-shadow: 0 0 12px rgba(164, 126, 58, 0.18);
}

.memorial-footer-brand {
    display: inline-flex;
    align-items: center;
}

.memorial-footer-logo {
    display: block;
    width: auto;
    height: 2rem;
    opacity: 0.9;
}

.memorial-footer a {
    color: #d4b06a;
    text-decoration: none;
}

.memorial-footer a:hover {
    opacity: 1;
}

.auth-shell,
.dashboard-shell {
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.auth-card,
.dashboard-sidebar,
.dashboard-section,
.metric-card,
.tribute-card {
    border: 1px solid rgba(206, 214, 226, 0.14);
    background: linear-gradient(180deg, rgba(16, 24, 34, 0.88), rgba(9, 14, 21, 0.82));
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.22);
}

.auth-card {
    width: min(28rem, 100%);
    padding: 2rem;
    border-radius: 1.6rem;
}

.auth-copy,
.dashboard-copy,
.empty-state {
    color: rgba(232, 224, 214, 0.78);
    line-height: 1.6;
}

.auth-form,
.dashboard-form,
.search-form,
.danger-form {
    display: grid;
    gap: 0.85rem;
}

.auth-form input,
.dashboard-form input,
.search-form input {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(222, 226, 232, 0.18);
    border-radius: 1rem;
    background: rgba(244, 237, 229, 0.07);
    color: var(--ivory);
    font-size: 1rem;
}

.auth-form button,
.dashboard-form button,
.search-form button,
.danger-button,
.secondary-button,
.dashboard-link-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.9rem 1.2rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, #8d1626, #6d0f1d 62%, #4f0a15);
    color: #f8eee5;
    font-size: 0.98rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(232, 224, 214, 0.86);
}

.checkbox-field input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #a98350;
}

.secondary-button {
    background: rgba(228, 219, 204, 0.1);
    border: 1px solid rgba(228, 219, 204, 0.18);
}

.dashboard-link-button {
    width: 100%;
    background: rgba(228, 219, 204, 0.08);
    border: 1px solid rgba(228, 219, 204, 0.14);
}

.danger-button {
    background: linear-gradient(135deg, #7f1928, #54101a 60%, #3b0b12);
}

.auth-error,
.field-error {
    color: #f0b4b4;
    margin: 0;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
}

.dashboard-sidebar {
    min-height: 100vh;
    padding: 2rem 1.25rem;
    border-radius: 0;
    border-left: 0;
    border-top: 0;
    border-bottom: 0;
}

.dashboard-title {
    margin: 0 0 1.5rem;
    font-size: 2rem;
}

.dashboard-nav {
    display: grid;
    gap: 0.65rem;
}

.dashboard-nav a {
    color: rgba(244, 235, 222, 0.88);
    text-decoration: none;
    padding: 0.8rem 0.95rem;
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.04);
}

.dashboard-content {
    padding: 2rem;
}

.dashboard-section {
    padding: 1.5rem;
    border-radius: 1.6rem;
}

.dashboard-section + .dashboard-section {
    margin-top: 1.5rem;
}

.dashboard-hero,
.section-header,
.form-actions,
.danger-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.metric-card {
    min-width: 13rem;
    padding: 1rem 1.2rem;
    border-radius: 1.2rem;
    text-align: right;
}

.metric-card span,
.tribute-meta,
.tribute-summary dt {
    display: block;
    color: rgba(232, 224, 214, 0.7);
}

.metric-card strong {
    display: block;
    font-size: 2.2rem;
    margin-top: 0.4rem;
}

.tribute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.tribute-card {
    padding: 1rem;
    border-radius: 1.2rem;
}

.tribute-card h4,
.section-header h2,
.dashboard-section h2,
.dashboard-section h3 {
    margin: 0 0 0.4rem;
}

.inline-link,
.table-actions a {
    color: rgba(231, 208, 170, 0.92);
    text-decoration: none;
}

.danger-link {
    color: #f3b7b7;
}

.table-wrap {
    overflow: auto;
}

.tribute-table {
    width: 100%;
    border-collapse: collapse;
}

.tribute-table th,
.tribute-table td {
    padding: 0.95rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.table-actions {
    display: flex;
    gap: 0.85rem;
}

.narrow-section {
    max-width: 46rem;
}

.tribute-summary {
    display: grid;
    gap: 0.85rem;
    margin: 1.2rem 0 1.5rem;
}

.tribute-summary div {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.04);
}

.tribute-summary dd,
.tribute-summary dt {
    margin: 0;
}

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

@media (max-width: 920px) {
    body.memorial-page {
        overflow: auto;
    }

    .memorial-panel {
        top: auto;
        right: 1rem;
        bottom: 1rem;
        left: 1rem;
        transform: none;
        width: auto;
        max-width: none;
    }

    .panel-toggle {
        top: 50%;
        right: calc(100% - 2.5rem);
        min-width: 7.35rem;
        padding: 0.75rem 0.9rem;
        border-radius: 0.95rem 0.95rem 0 0;
        transform: translateY(-50%) rotate(-90deg);
    }

    h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .tribute-name {
        font-size: clamp(2.3rem, 10vw, 4rem);
    }

    .tribute-label {
        font-size: 0.95rem;
        letter-spacing: 0.22em;
    }

    .memorial-footer {
        display: grid;
        justify-items: center;
        left: 1rem;
        right: 1rem;
        transform: none;
        text-align: center;
    }

    .memorial-footer-logo {
        height: 1.7rem;
    }

    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar,
    .dashboard-content {
        min-height: auto;
        padding: 1.25rem 1rem;
    }

    .dashboard-hero,
    .section-header,
    .form-actions,
    .danger-form,
    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .left-panel {
        --left-panel-shift-x: calc(-100% + 1.5rem);
        left: 0;
        right: 1rem;
        bottom: auto;
        width: auto;
        max-width: none;
    }

    .left-panel-toggle {
        left: calc(100% - 2.8rem);
        min-width: 9rem;
        padding: 0.75rem 0.9rem;
        font-size: 0.8rem;
    }

    .right-panel {
        top: auto;
        right: 1rem;
        bottom: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
        transform: translate(var(--panel-shift-x), 0);
        --panel-shift-x: calc(100% - 1.1rem);
    }

    .right-panel.is-open {
        --panel-shift-x: 0;
    }

    .panel-toggle {
        right: calc(100% - 2.4rem);
        min-width: 7.1rem;
    }

    body.facebook-in-app .memorial-panel {
        left: 0.7rem;
        right: 0.7rem;
        bottom: 0.7rem;
    }

    body.facebook-in-app .left-panel {
        right: 0.7rem;
    }

    body.facebook-in-app .memorial-panel-scroll {
        max-height: calc(100vh - 1.4rem);
        padding: 1rem 0.95rem 1.05rem;
    }

    body.facebook-in-app .memorial-title {
        font-size: clamp(1.55rem, 6vw, 1.95rem);
    }

    body.facebook-in-app .eyebrow {
        font-size: 0.72rem;
        letter-spacing: 0.22em;
    }

    body.facebook-in-app .intro,
    body.facebook-in-app .instruction,
    body.facebook-in-app .memorial-welcome,
    body.facebook-in-app .field-label,
    body.facebook-in-app .panel-footer p,
    body.facebook-in-app .tribute-form input,
    body.facebook-in-app .tribute-form button {
        font-size: 0.92rem;
    }

    body.facebook-in-app .left-panel-toggle,
    body.facebook-in-app .panel-toggle {
        font-size: 0.74rem;
    }

    body.facebook-in-app .memorial-footer {
        bottom: 0.7rem;
    }
}
