/* CSS Variables for easy customization */
:root {
    /* --header-height-hero: 500px; */
    --header-height-hero: 75vh;
    --header-height-sticky: 54px;
    --border-radius: 32px;
    --transition-speed: 0s;
    --safe-area-inset-top: env(safe-area-inset-top, 0px);

    /* UI chrome — respond to color scheme, independent of event theming */
    color-scheme: light dark;
    --ui-surface: #ffffff;
    --ui-surface-2: #fafafa;
    --ui-glass-bg: rgba(255, 255, 255, 0.55);
    --ui-glass-border: rgba(255, 255, 255, 0.6);
    --ui-muted: #71717a;
    --ui-muted-2: #a1a1aa;
    --ui-caption: #3f3f46;
    --ui-subtle: #52525b;
    --ui-placeholder: #969696;
    --ui-border: #e4e4e7;
    --ui-separator: rgba(0, 0, 0, 0.08);
    --ui-overlay: rgba(0, 0, 0, 0.06);
    --ui-danger-hover: #fef2f2;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-page-bg: #0a0a0b;
        --color-text: #ecedee;
        --ui-surface: #1c1c1e;
        --ui-surface-2: #2c2c2e;
        --ui-glass-bg: rgba(28, 28, 30, 0.82);
        --ui-glass-border: rgba(255, 255, 255, 0.1);
        --ui-muted: #8e8e93;
        --ui-muted-2: #636366;
        --ui-caption: #aeaeb2;
        --ui-subtle: #8e8e93;
        --ui-placeholder: #808080;
        --ui-border: #3a3a3c;
        --ui-separator: rgba(255, 255, 255, 0.08);
        --ui-overlay: rgba(255, 255, 255, 0.08);
        --ui-danger-hover: rgba(239, 68, 68, 0.15);
    }
}

html {
    background-color: var(--color-page-bg);
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--color-page-bg);
    color: var(--color-text);
    /* Stops the browser from altering scroll position when the header shrinks */
    overflow-anchor: none;
    /* overscroll-behavior: contain; */
}

/* 1. Main Container & States */
.hero-header {
    position: relative;
    margin: calc(env(safe-area-inset-top) + 5px) auto 0;
    width: calc(100% - 20px);
    max-width: 1200px;
    height: var(--header-height-hero);
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Sticky header — slides in from the top once the hero scrolls past */
.sticky-header {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 5px);
    left: 0;
    right: 0;
    margin: 0 auto;
    width: calc(100% - 20px);
    max-width: 1200px;
    min-height: var(--header-height-sticky);
    background: var(--ui-glass-bg);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), inset 0 0 0 1px var(--ui-glass-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateY(calc(-100% - 100px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 1, 1);
}

.sticky-header .top-bar {
    color: var(--color-text);
    padding: 10px 16px;
}

.sticky-header.is-visible {
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.sticky-header .settings-btn {
    padding: 5px 10px 5px 8px;
    background: var(--ui-overlay);
    border-color: var(--ui-separator);
    color: var(--color-text);
    font-size: 11px;
    gap: 5px;
}

.sticky-header .settings-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-text);
}

.sticky-header .settings-btn.is-featured {
    background: linear-gradient(180deg, rgba(255, 223, 128, 0.32), rgba(245, 184, 51, 0.22));
    border-color: rgba(214, 154, 18, 0.38);
    color: #8a5a00;
    box-shadow: inset 0 1px 0 rgba(255, 249, 214, 0.45);
}

.sticky-header .settings-btn.is-featured svg {
    stroke: #8a5a00;
}

@media (prefers-color-scheme: dark) {
    .sticky-header .settings-btn.is-featured {
        background: rgba(218, 165, 32, 0.2);
        border-color: rgba(218, 165, 32, 0.35);
        color: #ffd700;
    }

    .sticky-header .settings-btn.is-featured svg {
        stroke: #ffd700;
    }
}

.sticky-header .logo-left {
    text-shadow: none;
}

/* Compact logo + title are always shown in the sticky header */
.sticky-header .logo-compact {
    position: static;
    opacity: 1;
    transform: none;
}

.sticky-header .center-title {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Full-card blur overlay — sits above the background image, below all content */
.card-blur-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: var(--border-radius);
    /* Static filter + composited opacity — much cheaper than animating blur intensity */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
}

/* 2. Top Bar (Always Visible) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px;
    z-index: 10;
    color: white;
}

.logo-left {
    font-weight: 700;
    font-size: 1.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    align-items: center;
}

.logo-hero {
    display: inline-flex;
    text-decoration: none;
    color: inherit;
    transition: opacity var(--transition-speed), transform var(--transition-speed);
}

.logo-hero:hover {
    opacity: 0.8;
}

.logo-hero svg {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 1));
}

.logo-compact {
    position: absolute;
    left: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity var(--transition-speed), transform var(--transition-speed);
    white-space: nowrap;
}

.center-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    font-weight: 600;
    opacity: 0;
    transition: opacity var(--transition-speed), transform var(--transition-speed);
    /* text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); */
}

.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 6px 12px 6px 10px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    font-size: 12px;
    font-weight: 600;
    height: auto;
    white-space: nowrap;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.settings-btn.is-featured {
    background: rgba(218, 165, 32, 0.25);
    border-color: rgba(218, 165, 32, 0.4);
    color: #ffd700;
}

.settings-btn.is-featured:hover {
    background: rgba(218, 165, 32, 0.35);
}

.settings-btn.is-featured svg {
    stroke: #ffd700;
}

.settings-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Camera sheet */
.camera-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.camera-preview-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #09090b;
    border-radius: 16px;
    overflow: hidden;
}

.camera-preview-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-preview-wrap video.is-mirrored {
    transform: scaleX(-1);
}

.camera-preview-wrap .camera-unavailable {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ui-muted);
    font-size: 0.9rem;
}

.camera-preview-wrap .camera-unavailable[hidden] {
    display: none;
}

.camera-preview-wrap .camera-unavailable svg {
    width: 36px;
    height: 36px;
    stroke: var(--ui-subtle);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.camera-flip-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.camera-flip-btn:hover {
    background: rgba(0, 0, 0, 0.65);
}

.camera-flip-btn svg {
    width: 18px;
    height: 18px;
    stroke: white;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.camera-flip-btn[hidden] {
    display: none;
}

/* GIF capture progress badge */
.camera-gif-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 9999px;
    letter-spacing: 0.04em;
    pointer-events: none;
    z-index: 5;
}

.camera-gif-badge[hidden] {
    display: none;
}

/* Mode switcher — identical style to .tab-nav */
.camera-mode-nav {
    background: var(--ui-surface);
    border-radius: 14px;
    padding: 5px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 4px;
}

.camera-mode-btn {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ui-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.camera-mode-btn:hover {
    background: var(--color-page-bg);
    color: var(--color-accent);
}

.camera-mode-btn.is-active {
    background: var(--color-accent);
    color: white;
}

/* Mode info explainer */
.camera-mode-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: var(--ui-surface);
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px var(--ui-border);
}

.camera-mode-info-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--color-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-mode-info-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.camera-mode-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.camera-mode-info-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.camera-mode-info-desc {
    font-size: 0.8rem;
    color: var(--ui-muted);
    line-height: 1.45;
}

/* Controls row */
.camera-controls {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    align-items: center;
    padding: 4px 0 8px;
}

.camera-aux-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid var(--ui-border);
    background: var(--ui-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.camera-aux-btn:hover {
    border-color: var(--color-accent);
    background: var(--color-page-bg);
}

.camera-aux-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--ui-subtle);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.camera-aux-btn.timer-active {
    border-color: var(--color-accent);
    background: var(--color-accent);
}

.camera-aux-btn.timer-active svg {
    stroke: white;
}

.camera-capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid var(--ui-border);
    background: var(--ui-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    position: relative;
}

.camera-capture-btn::after {
    content: '';
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-accent);
    transition: transform 0.12s ease;
}

.camera-capture-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.camera-capture-btn:active {
    transform: scale(0.94);
}

.camera-capture-btn:active::after {
    transform: scale(0.88);
}

/* Stop state — shown during GIF capture */
.camera-capture-btn.is-stop {
    border-color: #ef4444;
}

.camera-capture-btn.is-stop::after {
    background: #ef4444;
    border-radius: 6px;
    width: 28px;
    height: 28px;
}

.camera-capture-btn.is-stop:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

/* Timer countdown overlay */
.camera-timer-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 16px;
    font-size: 5rem;
    font-weight: 700;
    color: white;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.camera-timer-overlay.is-visible {
    opacity: 1;
}

/* Preview sheet */
.preview-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-polaroid {
    background: var(--ui-surface);
    padding: 10px 10px 0;
    border-radius: 2px;
    box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    margin: 32px 8px;
    transform: rotate(-2.5deg);
    transform-origin: center center;
}

.preview-polaroid-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--ui-border);
}

.preview-polaroid-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.preview-polaroid-image video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #000;
}

.preview-polaroid-image video[hidden] {
    display: none;
}

/* Video playback overlay */
.preview-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.preview-video-overlay[hidden] {
    display: none;
}

.preview-video-play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.preview-video-overlay.is-paused .preview-video-play-btn {
    opacity: 1;
    transform: scale(1);
}

.preview-video-play-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
    stroke: none;
}

.preview-caption-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 8px 20px;
    border: none;
    outline: none;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--ui-caption);
    text-align: center;
    background: transparent;
}

.preview-caption-input::placeholder {
    color: var(--ui-placeholder);
}

.preview-caption-counter {
    text-align: center;
    font-size: 0.8rem;
    color: var(--ui-muted-2);
    transition: color 0.2s;
}

.preview-caption-counter.is-near-limit {
    color: #f59e0b;
}

.preview-caption-counter.is-at-limit {
    color: #ef4444;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--color-accent);
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.preview-submit-btn:hover {
    opacity: 0.88;
}

.preview-submit-btn:active {
    opacity: 0.75;
}

.preview-secondary-actions {
    display: flex;
    gap: 8px;
}

.preview-text-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ui-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.preview-text-btn:hover {
    background: var(--color-page-bg);
}

.preview-text-btn--danger {
    color: #ef4444;
}

.preview-text-btn--danger:hover {
    background: var(--ui-danger-hover);
}

/* View / share sheet */
.view-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.view-polaroid {
    background: var(--ui-surface);
    padding: 10px 10px 0;
    border-radius: 2px;
    box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    margin: 32px 8px;
    transform: rotate(-2.5deg);
    transform-origin: center center;
    border-radius: 6px;
}

.view-polaroid-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 4px;
    overflow: hidden;
    background: var(--ui-border);
}

.view-polaroid-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.view-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(180, 30, 30, 0.35);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, transform 0.12s ease;
    z-index: 2;
}

.view-delete-btn:hover {
    background: rgba(180, 30, 30, 0.55);
}

.view-delete-btn:active {
    transform: scale(0.92);
}

.view-delete-btn svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.view-polaroid-caption {
    padding: 14px 8px 20px;
    min-height: 32px;
    text-align: center;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--ui-caption);
}

.view-actions {
    display: flex;
    gap: 10px;
}

.view-action-btn {
    flex: 1;
    padding: 14px 12px;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.12s ease;
}

.view-action-btn:active {
    transform: scale(0.97);
}

.view-action-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.view-action-btn--primary {
    background: var(--color-accent);
    color: white;
}

.view-action-btn--primary:hover {
    opacity: 0.88;
}

.view-action-btn--secondary {
    background: var(--ui-surface);
    color: var(--ui-subtle);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 0 0 1.5px var(--ui-border);
}

.view-action-btn--secondary:hover {
    background: var(--color-page-bg);
}

/* hide share button when Web Share API is unavailable */
.view-action-btn--share[hidden] {
    display: none;
}

/* Author block in view sheet */
.view-author {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ui-surface);
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px var(--ui-border);
}

.view-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-accent);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.view-author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.view-author-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ui-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-author-label {
    font-size: 0.75rem;
    color: var(--ui-muted);
}

.view-author-time {
    font-size: 0.78rem;
    color: var(--ui-muted);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}

.view-author-crown {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: #c9960c;
    flex-shrink: 0;
    vertical-align: middle;
}

.view-author-crown svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    stroke: none;
}

.view-author[hidden] {
    display: none;
}

/* Featured status badge in settings */
.featured-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 195, 0, 0.12), rgba(255, 140, 0, 0.08));
    box-shadow: inset 0 0 0 1px rgba(255, 195, 0, 0.35);
}

.featured-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #c9960c;
    width: 32px;
}

.featured-status-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    stroke: none;
}

.featured-status-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.featured-status-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #b8860b;
}

.featured-status-desc {
    font-size: 0.75rem;
    color: var(--ui-muted);
}

.featured-status[hidden] {
    display: none;
}

/* Discard confirmation sheet */
.confirm-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 4px;
}

.confirm-sheet-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    margin: 0 0 4px;
}

.confirm-sheet-desc {
    font-size: 0.875rem;
    color: var(--ui-muted);
    text-align: center;
    margin: 0 0 8px;
    line-height: 1.5;
}

.confirm-danger-btn {
    width: 100%;
    padding: 15px;
    background: #ef4444;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.confirm-danger-btn:hover {
    opacity: 0.88;
}

.confirm-danger-btn:active {
    opacity: 0.75;
}

.confirm-cancel-btn {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ui-muted);
    cursor: pointer;
    transition: background 0.2s;
}

.confirm-cancel-btn:hover {
    background: var(--color-page-bg);
}

/* Settings form */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-form h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.settings-form p.subtitle {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--ui-muted);
    line-height: 1.5;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.field-label-optional {
    font-weight: 400;
    color: var(--ui-muted-2);
}

.form-field input {
    padding: 12px 14px;
    border: 1.5px solid var(--ui-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background: var(--ui-surface-2);
    outline: none;
    transition: border-color 0.2s;
}

.form-field input:focus {
    border-color: var(--color-accent);
    background: var(--ui-surface);
}

.form-field input::placeholder {
    color: var(--ui-muted-2);
}

.form-field .field-hint {
    font-size: 0.8rem;
    color: var(--ui-muted-2);
}

.form-field .field-error {
    font-size: 0.8rem;
    color: var(--color-error, #c0392b);
    display: none;
}

.form-field.has-error input {
    border-color: var(--color-error, #c0392b);
}

.form-field.has-error .field-error {
    display: block;
}

.settings-save-btn {
    padding: 14px;
    background: var(--color-accent);
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.settings-save-btn:hover {
    opacity: 0.88;
}

.settings-save-btn:active {
    opacity: 0.75;
}

/* Welcome / onboarding sheet */
.welcome-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 8px 0 4px;
}

.welcome-icon {
    width: 72px;
    height: 72px;
    background: var(--color-accent);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.welcome-icon svg {
    width: 100%;
    height: 100%;
}

.welcome-hero h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.welcome-hero p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ui-muted);
    line-height: 1.5;
}

/* 3. Center Logo (Hero state only) */
.center-logo-large {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    margin-bottom: 180px;
    /* Replace with an actual img if needed */
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: opacity calc(var(--transition-speed) - 0.2s);
}

/* 4. Bottom Content (Text & Gradual Blur) */
.bottom-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 2;
    transition: transform var(--transition-speed);
}

/* The Gradual Blur Magic
   We apply the blur uniformly, but use a linear-gradient mask to make the blur fade in from top to bottom.
*/
.blur-backdrop {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    mask-image: linear-gradient(to bottom, transparent 0%, black 30%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%);
    z-index: 1;
}

/* Adds a dark gradient underneath the blur so white text remains readable on bright background images */
.blur-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
}

.text-content {
    position: relative;
    text-align: center;
    z-index: 2;
    padding: 24px;
    color: white;
}

.text-content h1 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.text-content p {
    margin: 0;
    font-size: 1.05rem;
    opacity: 0.9;
    line-height: 1.5;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

/* New photos notification button */
.new-photos-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto 20px;
    padding: 7px 16px;
    border: 1px solid rgba(132, 13, 13, 0.25);
    border-radius: 9999px;
    background: rgba(132, 13, 13, 0.07);
    color: var(--color-accent);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    animation: new-photos-appear 0.3s ease;
}

.new-photos-btn:hover {
    background: rgba(132, 13, 13, 0.13);
    border-color: rgba(132, 13, 13, 0.45);
    transform: translateY(-1px);
}

.new-photos-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.new-photos-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background: var(--color-accent);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.new-photos-btn[hidden] {
    display: none;
}

@keyframes new-photos-appear {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page content */
.page-content {
    padding: 24px 10px 100px;
    max-width: 1200px;
    margin: 0 10px 10px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--ui-subtle);
}

/* Gallery grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

/* Polaroid card */
.polaroid {
    background: var(--ui-surface);
    padding: 8px 8px 0;
    border-radius: 6px;
    box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    margin: 0;
    transform: rotate(-1.5deg);
    transform-origin: center center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.polaroid:nth-child(4n+2) {
    transform: rotate(1.2deg);
}

.polaroid:nth-child(4n+3) {
    transform: rotate(-0.7deg);
}

.polaroid:nth-child(4n+4) {
    transform: rotate(1.8deg);
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.28);
    z-index: 2;
}

.polaroid-image {
    position: relative;
    width: 100%;
    border-radius: 4px;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: var(--ui-border);
    flex-shrink: 0;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
}

.polaroid-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.polaroid-caption {
    padding: 0 6px 0;
    text-align: center;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ui-caption);
    line-height: 1.3;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
}

/* Featured: spans both columns — image is 2× wider, reads as 4 Polaroids */
.polaroid[data-featured] {
    grid-column: span 2;
    transform: none;
}

.polaroid[data-featured]:hover {
    transform: scale(1.01);
}

.polaroid[data-featured] .polaroid-caption {
    font-size: 1.25rem;
    padding: 14px 8px 20px;
}

/* Bottom Navigation */
/* Floating action buttons */
.fab {
    position: fixed;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 100;
}

.fab:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    transform: scale(1.06);
}

.fab:active {
    transform: scale(0.94);
}

.fab svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fab-upload {
    left: 20px;
    background: var(--ui-surface);
    color: var(--ui-subtle);
}

.fab-capture {
    right: 20px;
    background: var(--color-accent);
    color: white;
}

.fab-capture svg {
    width: 26px;
    height: 26px;
}

.tab-nav {
    z-index: 90;
    max-width: 1200px;
    margin: 16px 10px;
    background: var(--ui-glass-bg);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-radius: 9999px;
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), inset 0 0 0 1px var(--ui-glass-border);
    display: flex;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ui-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    position: relative;
}

.tab-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-accent);
}

.tab-btn.is-active {
    background: var(--color-accent);
    color: white;
}

.tab-badge {
    position: absolute;
    top: -5px;
    right: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background: var(--color-accent);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--ui-glass-bg);
}

.tab-btn.is-active .tab-badge {
    background: white;
    color: var(--color-accent);
    border: 1px solid white;
    box-shadow: 0 0 0 2px var(--color-accent);
}

.tab-badge[hidden] {
    display: none;
}

/* Sticky header tab row */
.sticky-header-tabs {
    display: flex;
    gap: 6px;
    padding: 0 10px;
    width: 80%;
    margin: 0 auto;

    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
}

.sticky-header.has-tabs .sticky-header-tabs {
    max-height: 56px;
    opacity: 1;
    padding: 10px 10px 10px;
    border-top: 1px solid var(--ui-separator);
}

.sticky-tab-btn {
    flex: 1;
    padding: 6px 10px;
    position: relative;
    border: none;
    border-radius: 20px;
    background: transparent;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ui-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.sticky-tab-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-text);
}

.sticky-tab-btn.is-active {
    background: var(--color-accent);
    color: white;
}

.sticky-tab-btn .tab-badge {
    background: rgba(132, 13, 13, 0.15);
    color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(132, 13, 13, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sticky-tab-btn.is-active .tab-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px 32px;
    text-align: center;
}

.empty-state[hidden] {
    display: none;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--ui-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--ui-muted);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ui-muted);
    line-height: 1.5;
    max-width: 260px;
}

.empty-state-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin-top: 8px;
}

.empty-cta-btn {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.12s ease;
}

.empty-cta-btn:active {
    transform: scale(0.97);
}

.empty-cta-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.empty-cta-btn--primary {
    background: var(--color-accent);
    color: white;
}

.empty-cta-btn--primary:hover {
    opacity: 0.88;
}

.empty-cta-btn--secondary {
    background: var(--ui-surface);
    color: var(--ui-subtle);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 0 0 1.5px var(--ui-border);
}

.empty-cta-btn--secondary:hover {
    background: var(--color-page-bg);
}

@keyframes cameraFlash {
    0% {
        opacity: 0.85;
    }

    100% {
        opacity: 0;
    }
}