:root {
    --bg: #faf7f2;
    --card: #ffffff;
    --text: #3d3a34;
    --muted: #8b8578;
    --accent: #b08d57;
    --accent-dark: #96723f;
    --danger: #b0574f;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(61, 58, 52, .12);
}

* { box-sizing: border-box; }

/* hidden-Attribut muss auch gegen display:flex der Overlays gewinnen */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Jost', system-ui, sans-serif;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

h1, h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    margin: 0;
}

/* ------------------------------------------------------------------
   Startseite
------------------------------------------------------------------ */
.welcome-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(176, 141, 87, .10), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(176, 141, 87, .10), transparent 45%),
        var(--bg);
}

.welcome-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 44px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.ornament {
    color: var(--accent);
    font-size: 88px;
    margin-bottom: 12px;
}

.welcome-card h1 {
    font-size: 40px;
    font-style: italic;
    line-height: 1.1;
}

.welcome-sub {
    color: var(--accent);
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: 12px;
    margin: 10px 0 22px;
}

.welcome-text {
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 28px;
}

.welcome-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.welcome-form label {
    font-size: 14px;
    color: var(--muted);
}

.welcome-form input {
    font: inherit;
    font-size: 17px;
    padding: 13px 16px;
    border: 1px solid #ddd5c8;
    border-radius: 10px;
    background: #fffdfa;
    color: var(--text);
    outline: none;
}

.welcome-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(176, 141, 87, .18);
}

.welcome-form button {
    font: inherit;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: .06em;
    margin-top: 8px;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background .15s;
}

.welcome-form button:hover { background: var(--accent-dark); }

.form-error {
    color: var(--danger);
    font-size: 14px;
    margin: 0;
}

/* Trenner "oder" zwischen Galerie und Getränkekarte */
.welcome-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: .15em;
    text-transform: uppercase;
    margin: 22px 0;
}

.welcome-divider::before,
.welcome-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(176, 141, 87, .35);
}

.welcome-secondary {
    display: block;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: .06em;
    padding: 14px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    color: var(--accent);
    text-decoration: none;
    text-align: center;
    transition: background .15s, color .15s;
}

.welcome-secondary:hover {
    background: var(--accent);
    color: #fff;
}

/* Getränkekarten-Button auf der Startseite: Icon drüber + goldener Hintergrund,
   damit er neben dem Formular nicht untergeht */
.welcome-drinks {
    background: rgba(176, 141, 87, .10);
    border-width: 2px;
    padding: 18px 14px;
}

.drinks-icon {
    display: block;
    font-size: 78px;
    line-height: 1;
    margin-bottom: 8px;
}

/* ------------------------------------------------------------------
   Getränkekarte
------------------------------------------------------------------ */
.drinks-page {
    align-items: flex-start;
}

.drinks-card {
    max-width: 480px;
}

.drinks-section {
    text-align: left;
    margin-top: 26px;
}

.drinks-section h2 {
    font-size: 24px;
    font-style: italic;
    color: var(--accent-dark);
    text-align: center;
    margin-bottom: 10px;
}

.drinks-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.drinks-section li {
    display: flex;
    flex-direction: column;
    padding: 9px 0;
    border-bottom: 1px dotted rgba(176, 141, 87, .35);
}

.drinks-section li:last-child { border-bottom: none; }

.drink-name { font-size: 17px; }

.drink-info {
    color: var(--muted);
    font-size: 14px;
}

.drinks-back { margin-top: 30px; }

/* ------------------------------------------------------------------
   Galerie
------------------------------------------------------------------ */
.gallery-page main {
    padding: 8px 8px calc(96px + env(safe-area-inset-bottom));
    max-width: 1100px;
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(250, 247, 242, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(176, 141, 87, .25);
}

.topbar h1 {
    font-size: 24px;
    font-style: italic;
}

.topbar-guest {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select-toggle {
    font: inherit;
    font-size: 14px;
    padding: 6px 12px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: none;
    color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}

.select-toggle:hover {
    background: var(--accent);
    color: #fff;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

@media (min-width: 640px)  { .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 960px)  { .grid { grid-template-columns: repeat(5, 1fr); gap: 8px; } }

.cell {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    background: #eee7db;
    cursor: pointer;
    border: none;
    padding: 0;
}

.cell img,
.cell video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cell .badge {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    pointer-events: none;
}

.empty-hint {
    text-align: center;
    color: var(--muted);
    line-height: 1.8;
    margin-top: 18vh;
    font-size: 17px;
}

/* ------------------------------------------------------------------
   Auswahlmodus (mehrere Fotos speichern/teilen)
------------------------------------------------------------------ */
.cell .check {
    display: none;
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, .35);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
    color: #fff;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    pointer-events: none;
}

.grid.select-mode .check { display: block; }

.cell.selected .check {
    background: var(--accent);
}

.cell.selected .check::after {
    content: '\2713';
}

.cell.selected img,
.cell.selected video {
    opacity: .6;
}

.cell.selected {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

.select-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(250, 247, 242, .95);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(176, 141, 87, .25);
}

#select-count {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.select-share {
    font: inherit;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: .04em;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background .15s;
}

.select-share:hover:not(:disabled) { background: var(--accent-dark); }

.select-share:disabled {
    opacity: .45;
    cursor: default;
}

/* ------------------------------------------------------------------
   Upload-Button (+)
------------------------------------------------------------------ */
.fab {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(150, 114, 63, .45);
    transition: transform .12s, background .15s;
    z-index: 20;
}

.fab:hover { background: var(--accent-dark); }
.fab:active { transform: scale(.92); }

/* ------------------------------------------------------------------
   Upload-Fortschritt
------------------------------------------------------------------ */
.upload-panel {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(61, 58, 52, .45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.upload-panel-inner {
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 60dvh;
    overflow-y: auto;
    padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
}

.upload-panel-inner h2 {
    font-size: 22px;
    margin-bottom: 14px;
}

#upload-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#upload-list li {
    font-size: 14px;
}

.up-name {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}

.up-name .up-file {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.up-status { color: var(--muted); flex-shrink: 0; }
.up-status.ok { color: #5a8a5d; }
.up-status.err { color: var(--danger); }

.up-bar {
    height: 6px;
    border-radius: 3px;
    background: #eee7db;
    overflow: hidden;
}

.up-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width .2s;
}

/* ------------------------------------------------------------------
   Lightbox
------------------------------------------------------------------ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 14, 12, .96);
    display: flex;
    flex-direction: column;
}

.lb-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 10px;
}

.lb-media img,
.lb-media video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
}

.lb-btn {
    position: absolute;
    z-index: 41;
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.lb-close { top: calc(14px + env(safe-area-inset-top)); right: 14px; }
.lb-prev  { left: 10px;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 10px; top: 50%; transform: translateY(-50%); }

.lb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    color: #cfc9be;
    font-size: 14px;
}

#lb-caption {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-actions {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.lb-action {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

.lb-action-danger { color: #e08a83; }
