:root {
    --bg: #fbf4f6;
    --bg-deep: #f4e3e8;
    --paper: #fff8f8;
    --ink: #3a2430;
    --muted: #7d5c68;
    --pine: #9a3d5c;
    --pine-soft: #b45b78;
    --moss: #c98496;
    --amber: #d46a86;
    --blush: #f6d5de;
    --line: rgba(122, 62, 82, 0.14);
    --shadow: 0 18px 50px rgba(154, 61, 92, 0.1);
    --font-heading: "Fraunces", Georgia, serif;
    --font-body: "DM Sans", sans-serif;
    --radius: 22px;
    --primary-color: var(--pine);
    --bg-card: var(--paper);
    --text-primary: var(--ink);
    --text-muted: var(--muted);
    --border-color: var(--line);
    --danger-color: #9c3b32;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --shadow-soft: var(--shadow);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16.5px;
    line-height: 1.55;
    background:
        radial-gradient(900px 420px at -10% -20%, rgba(212, 106, 134, 0.28), transparent 55%),
        radial-gradient(800px 480px at 110% 0%, rgba(246, 213, 222, 0.9), transparent 48%),
        linear-gradient(180deg, #fff7f8 0%, var(--bg) 42%, var(--bg-deep) 100%);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cpath fill='%239a3d5c' d='M70 118s-28-18-28-40a16 16 0 0 1 28-10 16 16 0 0 1 28 10c0 22-28 40-28 40z'/%3E%3C/svg%3E");
    background-size: 140px 140px;
}
#app, .admin-container, .screen-overlay { position: relative; z-index: 1; }
body.modal-open { overflow: hidden; }
img { max-width: 100%; display: block; }
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 560; letter-spacing: -0.03em; line-height: 1.15; margin: 0; }
p { margin: 0; }
::selection { background: #f6d5de; }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--pine);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.primary-button,
.ghost-button,
.text-button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 12px 18px;
    border: 1px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.primary-button,
.btn-primary {
    background: var(--pine);
    color: #f7f3ec;
}
.ghost-button,
.btn-outline,
.btn-secondary {
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
}
.text-button {
    background: transparent;
    color: var(--pine);
    padding-inline: 8px;
}
.btn-danger {
    background: transparent;
    color: var(--danger-color);
    border-color: rgba(156, 59, 50, 0.35);
}
.primary-button:hover,
.ghost-button:hover,
.btn:hover { transform: translateY(-1px); }
.primary-button:focus-visible,
.ghost-button:focus-visible,
.text-button:focus-visible,
.day-card:focus-visible,
.choice:focus-visible,
.chip:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

.password-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
}
.password-container {
    width: min(440px, 100%);
    background: rgba(255, 250, 244, 0.9);
    border: 1px solid var(--line);
    border-radius: 32px;
    box-shadow: var(--shadow);
    padding: 36px 28px 28px;
    text-align: center;
}
.password-icon img { width: 36px; height: 36px; margin: 0 auto 14px; }
.password-container h1 { font-size: clamp(2.2rem, 6vw, 3.3rem); margin-bottom: 10px; }
.password-description { color: var(--muted); }
.password-hint {
    display: inline-block;
    margin: 14px 0 22px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--blush);
    color: var(--pine);
    letter-spacing: 0.08em;
}
.password-form { display: grid; gap: 12px; }
.input-wrapper input,
.field input,
.field textarea,
.stack-form input,
.input-group input,
.admin-select,
.admin-textarea,
.code-input {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 13px 14px;
    outline: none;
}
.form-error, .error-msg { min-height: 1.2em; color: var(--danger-color); font-size: 0.92rem; }

.main-app { padding-bottom: 40px; }
.section-container { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }
.joke-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
}
.joke-card {
    width: min(480px, 100%);
    background: rgba(255, 248, 248, 0.94);
    border: 1px solid var(--line);
    border-radius: 32px;
    box-shadow: var(--shadow);
    padding: 36px 28px 28px;
    text-align: center;
    animation: rise 0.45s ease both;
}
.joke-locks { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; }
.joke-locks img { width: 32px; height: 32px; }
.joke-card h1 { font-size: clamp(2rem, 6vw, 3.1rem); margin: 10px 0 22px; }
.joke-actions { display: grid; gap: 10px; }
.joke-punch {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    color: var(--pine);
    margin: 0 0 22px;
}
.site-header {
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(16px);
    background: rgba(251, 244, 246, 0.86);
    border-bottom: 1px solid transparent;
}
.header-inner {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand, .header-status { display: flex; align-items: center; gap: 10px; }
.brand-icon img { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--font-heading); font-size: 1.25rem; }
.brand-subtitle, .header-status { color: var(--muted); font-size: 0.92rem; }
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--moss);
    box-shadow: 0 0 0 5px rgba(109, 143, 114, 0.18);
}

.hero-section { padding: 42px 0 10px; }
.hero-content { width: min(760px, calc(100% - 32px)); margin: 0 auto; }
.hero-content h1 { font-size: clamp(3rem, 8vw, 5.6rem); margin-bottom: 14px; }
.hero-content h1 span { font-style: italic; color: var(--pine); }
.hero-content p { max-width: 36rem; color: var(--muted); font-size: 1.12rem; }
.hero-button { margin-top: 22px; }

.progress-section, .days-section, .unlock-section, .extended-plan-section { padding: 28px 0; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 16px;
}
.section-heading h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.progress-counter {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--pine);
}
.progress-counter span:last-child { color: var(--muted); font-size: 1rem; }
.progress-bar { height: 8px; border-radius: 999px; background: rgba(47, 74, 60, 0.1); overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pine), var(--amber)); border-radius: inherit; }
.progress-text, .tempo-note { margin-top: 10px; color: var(--muted); }
.tempo-note { color: var(--amber); }

.days-container { display: grid; grid-template-columns: 1fr; gap: 14px; }
.day-card {
    text-align: left;
    background: rgba(255, 250, 244, 0.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 16px 14px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}
.day-card.is-today { border-color: rgba(154, 61, 92, 0.55); box-shadow: var(--shadow); }
.day-card.is-locked { opacity: 0.78; }
.day-card.is-sealed {
    text-align: center;
    opacity: 1;
    cursor: default;
    background:
        radial-gradient(140px 90px at 50% 0%, rgba(246, 213, 222, 0.95), transparent 72%),
        rgba(255, 248, 248, 0.92);
}
.seal-lock { width: 36px; height: 36px; margin: 14px auto 6px; }
.song-section { padding: 6px 0 8px; }
.song-card {
    display: grid;
    gap: 10px;
    background: rgba(255, 248, 248, 0.94);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 22px 22px 18px;
}
.song-card h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.song-card p { color: var(--muted); }
.song-dock {
    position: static;
    margin-top: 8px;
    padding: 10px 12px 28px;
    background: rgba(255, 248, 248, 0.96);
    border-top: 1px solid var(--line);
}
.song-dock-inner {
    width: min(1080px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(150px, 240px) 1fr;
    gap: 12px;
    align-items: center;
}
.song-meta p { margin: 0; }
#song-title { font-family: var(--font-heading); font-size: 1.25rem; }
.song-results { display: grid; gap: 8px; }
.song-option {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
}
.song-option img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.song-option span { display: flex; flex-direction: column; min-width: 0; }
.song-option strong { font-size: 0.98rem; }
.song-option small { color: var(--muted); }
#song-audio { width: 100%; height: 40px; }
@media (max-width: 720px) {
    .song-dock-inner { grid-template-columns: 1fr; }
}
.mini-lock { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; margin-right: 4px; }
.day-card-top, .day-card-foot, .action-row, .map-toolbar, .chip-row, .stack-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.day-index { font-family: var(--font-heading); font-size: 1.4rem; color: var(--pine); }
.day-status, .place-area, .day-kicker {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.day-card h3 { font-size: 1.35rem; margin: 6px 0; }
.day-summary { color: var(--muted); min-height: 2.8em; }
.day-card-foot { margin-top: 14px; color: var(--muted); font-size: 0.88rem; }
.day-card.is-done .day-status { color: var(--pine-soft); }

.unlock-card, .evening-card, .host-note, .modal-dialog, .admin-panel-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}
.unlock-card { padding: 28px 22px; }
.unlock-card h2, .modal-content h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 8px; }
.unlock-card p, .intention { color: var(--muted); }
.action-row { flex-wrap: wrap; margin-top: 16px; }
.action-row.center { justify-content: flex-start; }

.site-footer { padding: 10px 0 36px; color: var(--muted); }
.footer-date { display: block; margin-top: 6px; font-size: 0.85rem; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(42, 38, 34, 0.38); }
.modal-dialog {
    position: relative;
    width: min(680px, 100%);
    max-height: min(92dvh, 900px);
    overflow: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 22px 18px 28px;
}
.modal-close {
    position: sticky;
    top: 0;
    float: right;
    border: 0;
    background: var(--bg);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    z-index: 1;
}
.modal-kicker { color: var(--amber); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }
.intention { margin: 10px 0 16px; }
.fine-print { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }
.field { display: grid; gap: 6px; margin-top: 12px; }
.field span { font-size: 0.88rem; color: var(--muted); }

.leaflet-map {
    height: 280px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #e7efe6;
    touch-action: none;
    position: relative;
    z-index: 0;
}
.map-pin span {
    display: block;
    width: 22px;
    height: 22px;
    margin: 2px;
    background: var(--amber);
    border: 3px solid #fffaf4;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 6px 14px rgba(42, 38, 34, 0.28);
}
.selected-banner {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px dashed var(--line);
    color: var(--muted);
}
.selected-banner.is-set {
    border-style: solid;
    border-color: var(--pine);
    color: var(--ink);
    background: #eef4ef;
}
.form-status { min-height: 1.2em; margin: 8px 0 0; color: var(--danger-color); }
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: 12px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 250, 244, 0), var(--paper) 28%);
}
.map-toolbar, .chip-row, .stack-form { justify-content: flex-start; flex-wrap: wrap; margin: 8px 0 12px; }
.chip, .choice, .place-card, .joke, .dice, .memory-box, .envelope {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 16px;
    text-align: left;
}
.chip { border-radius: 999px; padding: 8px 12px; }
.chip.selected, .choice.selected, .place-card.selected { border-color: var(--pine); background: #eef4ef; }
.place-list, .choice-grid, .joke-list { display: grid; gap: 8px; }
.place-card, .choice, .joke { padding: 12px; display: grid; gap: 3px; }
.choice span, .place-card span, .song-list span, .joke strong { color: var(--muted); font-weight: 400; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
.selected-label { margin-top: 10px; }
.rule-list, .recap, .song-list, .check-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rule-list li, .check, .song-list li, .recap li {
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
}
.recap { list-style: none; }
.recap li { display: flex; gap: 10px; color: var(--muted); }
.recap li.done { color: var(--ink); }
.recap span { font-family: var(--font-heading); color: var(--pine); }
.check { display: flex; gap: 10px; align-items: center; }
.song-list li { display: flex; justify-content: space-between; align-items: center; }
.song-list li div { display: grid; }
.song-list button { border: 0; background: transparent; font-size: 1.3rem; }
.empty-row { color: var(--muted); }
.stack-form input { flex: 1; min-width: 140px; }

.timer-face { position: relative; width: min(220px, 70vw); margin: 8px auto 12px; }
.timer-svg { width: 100%; height: auto; }
.ring-bg, .ring-fg { fill: none; stroke-width: 4; }
.ring-bg { stroke: rgba(47, 74, 60, 0.12); }
.ring-fg { stroke: var(--amber); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.timer-readout {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
}
.timer-readout strong { font-family: var(--font-heading); font-size: 2rem; }
.timer-readout span { color: var(--muted); }

.memory-box, .envelope, .dice {
    width: 100%;
    min-height: 110px;
    padding: 18px;
    margin-bottom: 8px;
}
.memory-inside, .joke strong, .host-note { display: none; }
.memory-box.is-open .memory-lid, .joke.is-open span { display: none; }
.memory-box.is-open .memory-inside, .joke.is-open strong, .envelope.is-open + .host-note, .host-note:not(.hidden) { display: block; }
.joke strong { display: none; color: var(--ink); font-family: var(--font-heading); font-size: 1.2rem; font-weight: 560; }
.joke.is-open strong { display: block; }
.host-note {
    margin: 12px 0;
    padding: 16px;
    white-space: pre-wrap;
    color: var(--ink);
}
.evening-card { padding: 18px; margin-bottom: 12px; }
.evening-card p + p { margin-top: 8px; color: var(--muted); }
.memory-photo { width: 100%; border-radius: 18px; margin: 10px 0; max-height: 360px; object-fit: cover; }
.quiz-q { border: 0; margin: 0 0 14px; padding: 0; }
.quiz-q legend { font-family: var(--font-heading); font-size: 1.25rem; margin-bottom: 8px; }
.recipe-line { min-height: 1.4em; margin-top: 8px; }
.dice { font-family: var(--font-heading); font-size: 1.6rem; text-align: center; }
.confetti { position: relative; height: 0; }
.confetti i {
    position: absolute;
    left: calc((var(--i) * 6.2%));
    top: -8px;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    background: var(--amber);
    animation: fall 1.5s ease-in both;
    animation-delay: calc(var(--i) * 35ms);
}
.confetti i:nth-child(odd) { background: var(--pine); }

.toast {
    position: fixed;
    left: 50%;
    top: calc(14px + env(safe-area-inset-top));
    z-index: 80;
    transform: translateX(-50%) translateY(-12px);
    max-width: min(420px, calc(100% - 24px));
    background: var(--ink);
    color: #f7f3ec;
    padding: 12px 14px;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.screen-overlay {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}
.password-card, .admin-card {
    width: min(440px, 100%);
    background: var(--paper);
    border-radius: 28px;
    padding: 28px 22px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    text-align: center;
}
.password-card h2 { font-family: var(--font-heading); font-size: 2rem; margin-bottom: 8px; }
.subtitle, .panel-desc { color: var(--muted); }
.input-group { margin: 16px 0; }
.card-icon img { width: 36px; height: 36px; margin: 0 auto 10px; }
.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 8px;
    background: var(--blush);
    color: var(--pine);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
