:root {
    --green-900: #0b2e22;
    --green-800: #0f3d2e;
    --green-700: #165a43;
    --red: #c8102e;
    --red-dark: #9e0c24;
    --gold: #e0b252;
    --cream: #fbf6ec;
    --paper: #ffffff;
    --ink: #1f2a25;
    --muted: #6b7a72;
    --line: rgba(224, 178, 82, .55);
    --radius: 18px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .18);
    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--cream);
    background:
        radial-gradient(1200px 600px at 50% -200px, var(--green-700), transparent 70%),
        var(--green-900);
    background-attachment: fixed;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ---------- Snow ---------- */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.snow span {
    position: absolute;
    top: -10px;
    left: calc(var(--i) * 5.6%);
    width: calc(3px + (var(--i) * 7 % 4) * 1px);
    height: calc(3px + (var(--i) * 7 % 4) * 1px);
    background: #fff;
    border-radius: 50%;
    opacity: .55;
    animation: fall calc(9s + var(--i) * 0.7s) linear infinite;
    animation-delay: calc(var(--i) * -1.3s);
}
@keyframes fall {
    to { transform: translate3d(calc(sin(var(--i)) * 40px), 105dvh, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .snow { display: none; }
    html { scroll-behavior: auto; }
}

/* ---------- Buttons & forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 48px; padding: .7rem 1.2rem;
    border: 0; border-radius: 999px;
    font: 600 1rem var(--font-body);
    text-decoration: none; cursor: pointer;
    transition: transform .1s ease, background .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(200, 16, 46, .35); }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--green-800); border: 2px solid currentColor; }
.btn-danger { background: transparent; color: var(--red); border: 2px solid currentColor; }
.btn-sm { min-height: 38px; padding: .35rem .9rem; font-size: .875rem; }

input, textarea {
    width: 100%;
    padding: .8rem 1rem;
    font: 1rem var(--font-body); /* >=16px avoids iOS zoom on focus */
    color: var(--ink);
    background: #fff;
    border: 2px solid #d9d2c3;
    border-radius: 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); }

.form-error { color: var(--red); font-size: .9rem; margin: .25rem 0 0; }
.form-error:empty { display: none; }
.form-error ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Login ---------- */
.login {
    position: relative; z-index: 1;
    min-height: 100dvh;
    display: grid; place-items: center;
    padding: 1.5rem;
}
.login-card {
    width: min(100%, 380px);
    background: var(--cream);
    color: var(--ink);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 6px solid var(--red);
}
.login-icon { font-size: 3rem; line-height: 1; }
.login-card h1 { font-size: 2rem; color: var(--green-800); margin-top: .5rem; }
.login-card form { display: grid; gap: .8rem; margin-top: 1.5rem; }

/* ---------- Hero ---------- */
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 0 1rem 3rem; }

.hero { text-align: center; padding: 3.5rem .5rem 2rem; }
.hero-kicker {
    display: inline-block; margin: 0 0 .6rem;
    padding: .25rem .8rem; border-radius: 999px;
    background: rgba(224, 178, 82, .15); color: var(--gold);
    font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.hero-title { font-size: clamp(2.6rem, 13vw, 3.6rem); font-weight: 800; letter-spacing: -.02em; }
.hero-sub { margin: .3rem 0 0; font-size: 1.15rem; color: rgba(251, 246, 236, .8); }
.progress { display: flex; gap: 6px; justify-content: center; margin-top: 1.5rem; }
.progress span { flex: 0 1 32px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .15); }
.progress span.on { background: var(--gold); }
.progress-label { margin: .5rem 0 0; font-size: .85rem; color: rgba(251, 246, 236, .65); }
.hero-jump { display: inline-block; margin-top: 1rem; font-size: .9rem; color: var(--gold); text-decoration: none; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 2.6rem; position: relative; }
.timeline::before {
    content: ""; position: absolute; left: 1.05rem; top: .5rem; bottom: .5rem;
    border-left: 3px dashed var(--line);
}

.stop {
    position: relative; margin-bottom: 1.6rem; scroll-margin-top: 1rem;
    opacity: 0; transform: translateY(24px);
    transition: opacity .6s ease, transform .6s ease;
}
.stop.in { opacity: 1; transform: none; }

.stop-marker {
    position: absolute; left: -2.6rem; top: .9rem;
    width: 2.2rem; height: 2.2rem; border-radius: 50%;
    display: grid; place-items: center;
    font: 800 1rem var(--font-display);
    background: var(--green-700); color: var(--cream);
    border: 3px solid var(--gold);
    z-index: 1;
}
.stop.current .stop-marker {
    background: var(--red); border-color: #fff;
    animation: pulse 2s ease-out infinite;
}
.stop.locked .stop-marker, .stop.mystery .stop-marker {
    background: var(--green-900); color: var(--gold); border-style: dashed;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(200, 16, 46, .7); }
    100% { box-shadow: 0 0 0 16px rgba(200, 16, 46, 0); }
}

.card {
    background: var(--cream); color: var(--ink);
    border-radius: var(--radius); padding: 1.1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.stop.visited .card { opacity: .88; }
.stop.current .card { border-top: 6px solid var(--red); }

.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.card-meta time { font: 800 1.1rem var(--font-display); color: var(--green-800); }
.card-meta time small {
    font: 600 .7rem var(--font-body); color: var(--muted);
    text-transform: uppercase; letter-spacing: .06em; margin-right: .2rem;
}
.badge {
    display: inline-block; padding: .2rem .65rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
}
.badge-now { background: var(--red); color: #fff; }
.badge-done { background: #e4ecdf; color: var(--green-700); }

.card-title { font-size: 1.6rem; color: var(--green-800); }
.card-desc { margin: .8rem 0 0; white-space: pre-line; }

.gallery {
    display: flex; gap: .5rem; overflow-x: auto;
    margin: .9rem -1.1rem 0; padding: 0 1.1rem;
    scroll-snap-type: x mandatory; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery-item {
    flex: 0 0 85%; padding: 0; border: 0; background: none; cursor: zoom-in;
    scroll-snap-align: center; border-radius: 12px; overflow: hidden;
}
.gallery.single .gallery-item { flex-basis: 100%; }
.gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e7e0d2; }

.card-address { margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed #d9d2c3; display: grid; gap: .7rem; }
.card-address p { margin: 0; color: #46524c; }
.card-address .btn { width: 100%; }

.card-locked {
    background: rgba(255, 255, 255, .06); color: var(--cream);
    border: 2px dashed var(--line); box-shadow: none; text-align: center;
}
.card-locked .muted { color: rgba(251, 246, 236, .6); margin: .8rem 0 0; font-size: .9rem; }
.locked-label { margin: 0 0 .8rem; font-weight: 600; }
.hint {
    margin-top: 1rem; padding: .8rem 1rem;
    background: rgba(224, 178, 82, .12); border-left: 4px solid var(--gold); border-radius: 10px;
    text-align: left;
}
.hint-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.hint p { margin: .3rem 0 0; font-family: var(--font-display); font-size: 1.1rem; font-style: italic; white-space: pre-line; }

.countdown { display: flex; justify-content: center; gap: .5rem; }
.countdown > div {
    min-width: 4.2rem; padding: .6rem .3rem;
    background: var(--green-800); border-radius: 12px; border: 1px solid var(--line);
}
.countdown span { display: block; font: 800 2rem/1 var(--font-display); color: var(--gold); font-variant-numeric: tabular-nums; }
.countdown small { display: block; margin-top: .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.countdown .unveil { font: 800 1.5rem var(--font-display); color: var(--gold); margin: .5rem 0; }

.mystery-text { margin: 0; padding: 1rem 0 0; color: rgba(251, 246, 236, .7); font-style: italic; }

.card-finale { text-align: center; border-top: 6px solid var(--gold); }
.card-finale p { margin: .5rem 0 0; }

.foot { text-align: center; margin-top: 2rem; font-size: .8rem; color: rgba(251, 246, 236, .45); }

/* ---------- Lightbox ---------- */
#lightbox {
    padding: 0; border: 0; background: transparent;
    max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh;
}
#lightbox::backdrop { background: rgba(0, 0, 0, .9); }
#lightbox img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Reveal animation (countdown reached zero) ---------- */
body.no-scroll { overflow: hidden; }

.reveal-overlay {
    position: fixed; inset: 0; z-index: 50;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 40%, #4a0716 0%, #1d020a 70%);
    color: var(--cream); text-align: center;
    opacity: 0; transition: opacity .4s ease;
}
.reveal-overlay.play { opacity: 1; }
.reveal-overlay.out { opacity: 0; transition-duration: .6s; pointer-events: none; }

.pour { position: relative; width: 150px; }
.glass { width: 100%; height: auto; overflow: visible; transform-origin: 50% 95%; }

.glass .stream { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); }
.glass .wine-level { transform: translateY(125px); }
.glass .wave { animation: wave 1.1s linear infinite; }

.reveal-overlay.play .stream { animation: stream 2.4s .4s ease-in-out forwards; }
.reveal-overlay.play .wine-level { animation: fill 2.2s .65s cubic-bezier(.3, .1, .3, 1) forwards; }
.reveal-overlay.play .glass { animation: cheers .9s 2.9s ease-in-out both; }

@keyframes stream {
    0% { transform: scaleY(0); opacity: 1; }
    15% { transform: scaleY(1); opacity: 1; }
    85% { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0; }
}
@keyframes fill {
    to { transform: translateY(42px); }
}
@keyframes wave {
    to { transform: translateX(60px); }
}
@keyframes cheers {
    0% { transform: rotate(0) translateY(0); }
    30% { transform: rotate(-14deg) translateY(-10px); }
    55% { transform: rotate(8deg) translateY(-4px); }
    80% { transform: rotate(-3deg) translateY(0); }
    100% { transform: rotate(0); }
}

.sparkle {
    position: absolute; font-size: 1.4rem;
    opacity: 0; transform: scale(0);
}
.sparkle.s1 { top: 22%; left: -18%; }
.sparkle.s2 { top: 8%; right: -16%; font-size: 1.1rem; }
.sparkle.s3 { top: 45%; right: -26%; }
.sparkle.s4 { top: 52%; left: -28%; font-size: 1rem; }
.reveal-overlay.play .sparkle { animation: sparkle 1s ease-out forwards; }
.reveal-overlay.play .s1 { animation-delay: 3.05s; }
.reveal-overlay.play .s2 { animation-delay: 3.15s; }
.reveal-overlay.play .s3 { animation-delay: 3.25s; }
.reveal-overlay.play .s4 { animation-delay: 3.35s; }
@keyframes sparkle {
    0% { opacity: 0; transform: scale(0) rotate(0); }
    40% { opacity: 1; transform: scale(1.3) rotate(20deg); }
    100% { opacity: 0; transform: scale(.8) rotate(40deg) translateY(-14px); }
}

.reveal-cheers {
    margin: 1.4rem 0 0; font: 800 2.6rem var(--font-display); color: var(--gold);
    opacity: 0; transform: scale(.6);
}
.reveal-sub { margin: .3rem 0 0; font-size: 1rem; opacity: 0; }
.reveal-overlay.play .reveal-cheers { animation: pop .6s 2.95s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.reveal-overlay.play .reveal-sub { animation: rise .6s 3.3s ease-out forwards; }
@keyframes pop { to { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: .85; transform: none; } }

/* The newly revealed location */
.stop.just-revealed .card { animation: arrive 1s cubic-bezier(.2, 1.3, .4, 1) both, glow 1.6s 1s ease-out 2; }
.stop.just-revealed .stop-marker { animation: arrive .8s .2s cubic-bezier(.2, 1.6, .4, 1) both, pulse 2s 1s ease-out infinite; }
@keyframes arrive {
    from { opacity: 0; transform: scale(.8) translateY(30px); }
    to { opacity: 1; transform: none; }
}
@keyframes glow {
    0% { box-shadow: var(--shadow), 0 0 0 0 rgba(163, 19, 47, .7); }
    100% { box-shadow: var(--shadow), 0 0 0 22px rgba(163, 19, 47, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .reveal-overlay.play .stream { animation: none; }
    .reveal-overlay.play .wine-level, .glass .wine-level { animation: none; transform: translateY(42px); }
    .glass .wave, .reveal-overlay.play .glass, .reveal-overlay.play .sparkle { animation: none; }
    .reveal-overlay.play .reveal-cheers, .reveal-overlay.play .reveal-sub { animation: none; opacity: 1; transform: none; }
    .stop.just-revealed .card, .stop.just-revealed .stop-marker { animation: none; }
}

/* ---------- Simulation banner ---------- */
.sim-banner {
    position: sticky; top: 0; z-index: 10;
    background: var(--gold); color: var(--green-900);
    text-align: center; font-size: .85rem; padding: .5rem;
}

/* ---------- Admin ---------- */
body.admin { background: #f3efe6; color: var(--ink); }
body.admin .snow { display: none; }
.admin-wrap { max-width: 640px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.admin-head h1 { font-size: 1.8rem; color: var(--green-800); }
.admin-head p { margin: .2rem 0 0; }
.back { font-size: .9rem; color: var(--muted); text-decoration: none; }
.admin-actions { display: flex; gap: .6rem; margin-bottom: 1rem; }
.admin-actions .btn { flex: 1; }
.admin-card {
    background: #fff; border-radius: 14px; padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06); margin: 0 0 1rem;
}
.admin-card h2 { font-size: 1.2rem; color: var(--green-800); margin-bottom: .6rem; }
.preview-form label { display: block; font-weight: 600; margin-bottom: .5rem; }
.inline { display: flex; gap: .5rem; }
.inline input { flex: 1; min-width: 0; }

.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-row-main { display: flex; gap: .9rem; }
.admin-row-main h2 { margin: 0; }
.admin-row-main p { margin: .2rem 0 0; }
.admin-row-time { text-align: center; min-width: 3.4rem; }
.admin-row-time strong { display: block; font: 800 1.2rem var(--font-display); color: var(--red); }
.admin-row-time small { color: var(--muted); }
.admin-row-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .8rem; }

.form { display: grid; gap: .35rem; }
.form label { font-weight: 600; margin-top: .7rem; font-size: .95rem; }
.form .btn { margin-top: 1.2rem; }
.form input[type="file"] { padding: .6rem; background: #faf8f3; }

.flash { background: #e4ecdf; color: var(--green-700); padding: .7rem 1rem; border-radius: 12px; font-weight: 600; }

.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.photo-grid figcaption { display: flex; gap: .4rem; justify-content: space-between; align-items: center; margin-top: .4rem; }
