* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #F3EEF9;
    color: #2a1a3e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: #5B4B8A;
    color: white;
    padding: 20px 16px;
    text-align: center;
}
header h1 { font-size: 1.9rem; margin-bottom: 4px; font-family: 'Satisfy', cursive; letter-spacing: 0.01em; }
.header-sub { font-size: 0.9rem; opacity: 0.85; font-family: 'Nunito', sans-serif; font-weight: 700; }

/* Main */
main { flex: 1; padding: 16px; max-width: 900px; margin: 0 auto; width: 100%; }

/* Footer */
footer {
    background: #5B4B8A;
    color: rgba(255,255,255,0.75);
    text-align: center;
    padding: 12px;
    font-size: 0.8rem;
}

/* Timeline header */
.timeline-header { text-align: center; margin: 16px 0; }
.event-date { font-size: 1rem; font-weight: 600; color: #2a1a3e; margin-bottom: 6px; }
.event-countdown { font-size: 1.15rem; font-weight: 700; color: #5B4B8A; letter-spacing: 0.02em; }
.event-countdown.now { color: #27ae60; }

/* Blocks grid */
.blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.block-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(91,75,138,0.1);
    border: 2px solid transparent;
}
.block-card.booked { border-color: #5B4B8A; background: #EDE0FF; }
.block-card.completed { border-color: #aaa; background: #f0f0f0; opacity: 0.7; }

.block-number { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.block-time { font-size: 0.85rem; color: #666; margin-bottom: 8px; }
.block-buyer { font-size: 0.85rem; color: #555; margin-top: 4px; }
.block-price { font-size: 0.85rem; color: #888; margin-bottom: 8px; }

.available-badge { color: #27ae60; font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; }
.booked-badge { color: #5B4B8A; font-weight: 600; font-size: 0.85rem; }
.completed-badge { color: #999; font-weight: 600; font-size: 0.85rem; }

/* Buttons */
.btn-book {
    display: inline-block;
    background: #FFD93D;
    color: #2a1a3e;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    margin-top: 8px;
    width: 100%;
    text-align: center;
}
.btn-book:hover { background: #f5cc2a; }
.btn-book.btn-large { font-size: 1rem; padding: 14px; margin-top: 16px; }
.btn-book.small { width: auto; padding: 6px 14px; font-size: 0.85rem; margin-top: 0; }

.btn-secondary {
    background: #eee;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 8px;
}
.btn-secondary:hover { background: #ddd; }
.btn-secondary.small { padding: 6px 12px; }

/* Book section */
.book-section { max-width: 620px; margin: 0 auto; }
.book-section h2 { margin-bottom: 4px; font-size: 1.4rem; }
.block-est-time { color: #666; margin-bottom: 16px; font-size: 0.9rem; }

.info-box {
    background: #EDE0FF;
    border-left: 4px solid #5B4B8A;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.6;
}
.info-box p { margin-bottom: 6px; }
.info-box p:last-child { margin-bottom: 0; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
.optional { font-weight: 400; color: #888; font-size: 0.85rem; }

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: #333;
    background: white;
}
.form-group textarea { resize: vertical; }
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #5B4B8A;
}

.char-info { font-size: 0.82rem; color: #666; margin-bottom: 6px; }

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    font-size: 0.9rem;
    margin-top: 8px;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.extend-note { color: #888; font-size: 0.82rem; }

.time-display {
    background: #EDE0FF;
    border: 1px solid #c9b8e8;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
}

/* Song rows */
.song-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.song-num { font-weight: 600; font-size: 0.9rem; min-width: 20px; }
.song-title, .song-artist {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.song-warning {
    color: #c0392b;
    font-size: 0.85rem;
    margin-top: 8px;
    background: #fff0ee;
    border-left: 3px solid #c0392b;
    padding: 8px 12px;
    border-radius: 4px;
}
.hidden { display: none; }

/* Amount buttons */
.amount-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.amount-btn {
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
}
.amount-btn.active { border-color: #5B4B8A; background: #FFD93D; color: #2a1a3e; }
.amount-btn:hover:not(.active) { border-color: #999; }

/* Stripe card element */
#card-element {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    background: white;
}
.card-errors { color: #c0392b; font-size: 0.85rem; margin-top: 8px; }

/* Success */
.success-section { max-width: 500px; margin: 40px auto; text-align: center; }
.success-box {
    background: white;
    border-radius: 12px;
    padding: 32px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.success-box h2 { margin-bottom: 16px; color: #27ae60; }
.success-box p { margin-bottom: 12px; line-height: 1.6; }
.tax-note { font-size: 0.85rem; color: #888; }

/* Host */
.host-header { margin-bottom: 20px; }
.host-header h2 { margin-bottom: 8px; }
.event-form { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.event-form label { font-weight: 600; }
.event-form input { border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px; font-size: 0.9rem; }
.host-note { font-size: 0.85rem; color: #666; margin-bottom: 16px; }

.blocks-host { display: flex; flex-direction: column; gap: 10px; }

.block-host-card {
    background: white;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-left: 4px solid #ccc;
}
.block-host-card.booked { border-left-color: #5B4B8A; }
.block-host-card.completed { border-left-color: #aaa; opacity: 0.6; }

.block-host-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.drag-handle { cursor: grab; font-size: 1.2rem; color: #aaa; }
.block-host-header strong { font-size: 1rem; }
.block-host-header .block-time { color: #666; font-size: 0.85rem; }

.block-badge {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: auto;
}
.block-badge.available { background: #eafaf1; color: #27ae60; }
.block-badge.booked { background: #EDE0FF; color: #5B4B8A; }
.block-badge.completed { background: #eee; color: #999; }

.block-host-detail { margin-top: 12px; font-size: 0.9rem; line-height: 1.7; }
.block-host-detail blockquote {
    background: #f9f9f9;
    border-left: 3px solid #ccc;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 4px 0 8px;
    font-style: italic;
}
.block-host-detail ol { padding-left: 20px; }

.btn-complete { margin-top: 10px; }

/* Login */
.login-section { max-width: 360px; margin: 40px auto; }
.login-section h2 { margin-bottom: 16px; }
.error { color: #c0392b; margin-bottom: 12px; font-size: 0.9rem; }

/* ---------------------------------------------------------------------------
   Background Flower Layer
--------------------------------------------------------------------------- */
#flower-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.28;
    overflow: hidden;
}

header, main, footer { position: relative; z-index: 1; }

/* ─── Sway animation ─── */
@keyframes sway {
    0%   { transform: rotate(-4deg); }
    100% { transform: rotate(4deg);  }
}
.sprouting-flower {
    animation: sway linear infinite alternate;
    transform-origin: bottom center;
    display: block;
}

/* ─── Card wrapper (allows flowers to overflow above card) ─── */
.memorial-card-wrapper {
    position: relative;
    padding-top: 60px;
    cursor: pointer;
}
.memorial-card-wrapper:hover .memorial-card {
    box-shadow: 0 6px 20px rgba(91,75,138,0.22);
    border-color: #9b80d0;
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

.card-flower {
    position: absolute;
    top: 0;
    pointer-events: none;
    transform: translateX(-50%);
}

/* ---------------------------------------------------------------------------
   Memorial Board
--------------------------------------------------------------------------- */
.memorial-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

/* Memorial Card (booked/completed) */
.memorial-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(91,75,138,0.12);
    border: 2px solid #c9b8e8;
    transition: all 0.2s ease;
}
.memorial-card.completed {
    opacity: 0.65;
    border-color: #ccc;
}

.memorial-card-header {
    padding: 12px 14px 10px;
    background: #EDE0FF;
    border-bottom: 1px solid #c9b8e8;
}
.memorial-block-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #2a1a3e;
    margin-bottom: 6px;
    line-height: 1.3;
}
.memorial-block-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.memorial-block-time { font-size: 0.82rem; color: #888; }

.memorial-status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}
.memorial-status.reserved { background: #FFD93D; color: #2a1a3e; }
.memorial-status.played { background: #e0e0e0; color: #777; }

/* Photos */
.memorial-photos {
    display: grid;
    gap: 2px;
}
.memorial-photos.count-1 { grid-template-columns: 1fr; }
.memorial-photos.count-2 { grid-template-columns: 1fr 1fr; }
.memorial-photos.count-3 { grid-template-columns: 1fr 1fr 1fr; }

.memorial-photo { aspect-ratio: 1; overflow: hidden; background: #f0f0f0; }
.memorial-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Dedication content */
.memorial-dedication-name {
    font-size: 1rem;
    font-weight: 700;
    color: #5B4B8A;
    padding: 12px 14px 4px;
}
.memorial-dedication-text {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.65;
    padding: 6px 14px 14px;
    font-style: italic;
}

/* Available Card */
.available-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(91,75,138,0.08);
    border: 2px dashed #c9b8e8;
}
.available-block-num { font-weight: 700; font-size: 0.95rem; color: #2a1a3e; margin-bottom: 4px; }
.available-block-time { font-size: 0.82rem; color: #888; margin-bottom: 8px; }
.available-label { color: #27ae60; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.available-price { font-size: 0.82rem; color: #999; margin-bottom: 10px; }

/* ---------------------------------------------------------------------------
   Photo Upload (booking form)
--------------------------------------------------------------------------- */
.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.photo-slot { position: relative; }
.photo-input { display: none; }

.photo-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 2px dashed #c9b8e8;
    border-radius: 10px;
    background: #F3EEF9;
    cursor: pointer;
    font-size: 0.82rem;
    color: #888;
    gap: 4px;
    transition: border-color 0.2s;
}
.photo-upload-label:hover { border-color: #5B4B8A; color: #5B4B8A; }
.photo-plus { font-size: 1.6rem; font-weight: 300; color: #5B4B8A; }

.photo-preview {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    border: 2px solid #c9b8e8;
}

/* ---------------------------------------------------------------------------
   Host View
--------------------------------------------------------------------------- */
.host-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.host-title-row h2 { margin: 0; }

.blocks-host { display: flex; flex-direction: column; gap: 8px; }

.host-card {
    background: white;
    border-radius: 10px;
    border-left: 5px solid #c9b8e8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    overflow: hidden;
}
.host-card.booked { border-left-color: #5B4B8A; }
.host-card.done { border-left-color: #bbb; opacity: 0.55; }

.host-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #F3EEF9;
    flex-wrap: wrap;
}
.drag-handle { cursor: grab; color: #aaa; font-size: 1.1rem; }
.host-block-num { font-weight: 700; font-size: 0.95rem; }
.host-block-time { font-size: 0.85rem; color: #666; }
.host-music-time { font-size: 0.8rem; background: #FFD93D; color: #2a1a3e; padding: 2px 8px; border-radius: 20px; font-weight: 600; }

.host-badge {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}
.host-badge.booked { background: #EDE0FF; color: #5B4B8A; }
.host-badge.empty { background: #eee; color: #aaa; }
.host-badge.done { background: #e0e0e0; color: #888; }

.host-card-body { padding: 12px 14px 14px; }
.host-dedication-name { font-size: 1rem; font-weight: 700; color: #5B4B8A; margin-bottom: 10px; }

.host-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #999;
    margin-bottom: 4px;
    margin-top: 10px;
}
.host-section-label:first-of-type { margin-top: 0; }

.host-dedication {
    font-size: 1rem;
    line-height: 1.65;
    color: #2a1a3e;
    background: #F3EEF9;
    border-left: 3px solid #5B4B8A;
    padding: 10px 12px;
    border-radius: 4px;
    font-style: italic;
}

.host-songs {
    padding-left: 20px;
    font-size: 0.92rem;
    line-height: 1.8;
    color: #333;
}

.btn-played { margin-top: 12px; background: #27ae60; color: white; }
.btn-played:hover { background: #219a52; }

/* Tap hint */
.memorial-tap-hint {
    text-align: center;
    font-size: 0.75rem;
    color: #b0a0cc;
    padding: 8px 0 10px;
    font-style: italic;
    letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   Lightbox
--------------------------------------------------------------------------- */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
#lightbox.active { display: flex; }

#lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 10, 35, 0.9);
}

#lightbox-content {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 18px;
    max-width: 580px;
    width: 93%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 30px 24px 34px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    animation: lbIn 0.22s ease;
}

@keyframes lbIn {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

#lightbox-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #bbb;
}
#lightbox-close:hover { color: #555; }

#lightbox-block-info {
    font-size: 0.78rem;
    color: #aaa;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

#lightbox-dedication-name {
    font-size: 1.55rem;
    font-weight: 700;
    color: #5B4B8A;
    line-height: 1.3;
    margin-bottom: 18px;
}

#lightbox-photos {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

#lightbox-photo-display {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
}
#lightbox-photo-display img {
    width: 100%;
    display: block;
    max-height: 360px;
    object-fit: contain;
}

.photo-nav {
    background: rgba(91,75,138,0.12);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #5B4B8A;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.photo-nav:hover { background: rgba(91,75,138,0.25); }

#lightbox-dedication-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
    font-style: italic;
    border-left: 4px solid #FFD93D;
    padding-left: 16px;
    margin-bottom: 20px;
}

.lb-songs-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 8px;
}
.lb-songs-list {
    padding-left: 20px;
    font-size: 0.95rem;
    line-height: 1.9;
    color: #333;
}

/* ---------------------------------------------------------------------------
   Mobile
--------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .memorial-board { grid-template-columns: 1fr; }
    .photo-upload-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .song-row { flex-wrap: wrap; }
    .song-title, .song-artist { flex: 1 1 100%; }
    .amount-options { gap: 6px; }
    .amount-btn { padding: 7px 12px; font-size: 0.88rem; }
    .host-card-header { gap: 6px; }
}
