html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: "Poppins", sans-serif;
    background: linear-gradient(180deg, #f5f1ea 0%, #faf7f2 42%, #ffffff 100%);
    color: #1d1d1d;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

:root {
    --ff-ink: #181512;
    --ff-muted: #6f645c;
    --ff-accent: #ea6b2d;
    --ff-accent-dark: #b74b18;
    --ff-surface: rgba(255, 255, 255, 0.86);
    --ff-surface-strong: #ffffff;
    --ff-outline: rgba(24, 21, 18, 0.08);
    --ff-shadow: 0 18px 40px rgba(20, 14, 8, 0.1);
    --ff-radius: 24px;
    --ff-top-bar-height: 62px;
    --ff-bottom-bar-height: 50px;
    --ff-safe-top: env(safe-area-inset-top, 0px);
    --ff-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.content {
    position: absolute;
    top: var(--ff-top-bar-height);
    bottom: calc(var(--ff-bottom-bar-height) + var(--ff-safe-bottom));
    left: 0;
    right: 0;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 18px 16px calc(66px + var(--ff-safe-bottom));
}

.page-shell {
    display: grid;
    gap: 18px;
    max-width: 1080px;
    margin: 0 auto;
}

.page-hero {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 244, 236, 0.98));
    border: 1px solid rgba(234, 107, 45, 0.14);
    border-radius: var(--ff-radius);
    padding: 22px 20px;
    box-shadow: var(--ff-shadow);
}

.page-kicker {
    display: inline-block;
    margin: 0 0 10px;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ff-accent-dark);
    font-weight: 700;
}

.page-hero h1,
.page-hero h2,
.page-hero h3,
.page-hero h4 {
    margin: 0 0 10px;
    color: var(--ff-ink);
}

.page-hero p {
    margin: 0;
    color: var(--ff-muted);
    line-height: 1.6;
}

.panel-grid {
    display: grid;
    gap: 16px;
}

.panel-card {
    background: var(--ff-surface);
    border: 1px solid var(--ff-outline);
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 10px 28px rgba(20, 14, 8, 0.08);
    backdrop-filter: blur(12px);
}

.panel-card h3,
.panel-card h4 {
    margin: 0 0 8px;
    color: var(--ff-ink);
}

.panel-card p {
    margin: 0;
    color: var(--ff-muted);
    line-height: 1.6;
}

.stack-list {
    display: grid;
    gap: 12px;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(234, 107, 45, 0.1);
    color: var(--ff-accent-dark);
    font-size: 0.88rem;
    font-weight: 600;
}

.empty-state,
.loading-state {
    display: grid;
    gap: 10px;
    text-align: center;
    justify-items: center;
    padding: 36px 20px;
    border-radius: 22px;
    background: var(--ff-surface);
    border: 1px dashed rgba(24, 21, 18, 0.14);
    color: var(--ff-muted);
}

.empty-state h3,
.loading-state h3 {
    margin: 0;
    color: var(--ff-ink);
}

.camera-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-logo {
    height: auto;
    max-height: calc(var(--ff-top-bar-height) - 18px);
    max-width: min(64vw, 720px);
    width: auto;
    object-fit: contain;
}

.video-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000000;
}

video {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 50px);
    object-fit: contain;
}

.capture-button {
    position: fixed;
    bottom: 80px;
    left: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s;
    transform: translateX(-50%);
}

.activate-camera {
    position: fixed;
    top: 45px;
    left: 5%;
    transform: translateX(-50%);
    background-color: white;
    color: black;
    border: 1px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 7px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s, background-color 0.3s;
}

.capture-button img {
    width: 99%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.capture-button:hover {
    transform: translateX(-50%) scale(1.3);
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(8px + var(--ff-safe-top)) 18px 8px;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.94);
    width: 100%;
    z-index: 1000;
    top: 0;
    position: fixed;
    height: calc(var(--ff-top-bar-height) + var(--ff-safe-top));
    box-shadow: 0 10px 24px rgba(20, 14, 8, 0.08);
    backdrop-filter: blur(12px);
}

body {
    padding-top: calc(var(--ff-top-bar-height) + var(--ff-safe-top));
}

.top-bar-status {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
}

.status-label {
    font-size: 0.75rem;
    color: var(--ff-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.snaps-badge {
    background: linear-gradient(135deg, var(--ff-accent), #ff935d);
    color: white;
    font-weight: bold;
    font-size: 13px;
    border-radius: 999px;
    min-width: 32px;
    height: 28px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-bar {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(24, 21, 18, 0.08);
    min-height: calc(var(--ff-bottom-bar-height) + max(0px, calc(var(--ff-safe-bottom) - 4px)));
    height: auto;
    padding-bottom: max(0px, calc(var(--ff-safe-bottom) - 12px));
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 -10px 20px rgba(20, 14, 8, 0.06);
    backdrop-filter: blur(14px);
}

.tabs {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
    min-height: var(--ff-bottom-bar-height);
    padding: 4px 0 2px;
    box-sizing: border-box;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    cursor: pointer;
    font-size: 10px;
    line-height: 1.05;
    color: var(--ff-muted);
    transition: color 0.3s, transform 0.2s;
    min-width: 64px;
    min-height: calc(var(--ff-bottom-bar-height) - 8px);
    gap: 2px;
}

.tab-item img {
    width: 26px;
    height: 26px;
    margin-bottom: 0;
}

.tab-item:hover {
    color: var(--ff-accent);
    transform: translateY(-2px);
}

.tab-item.active {
    color: var(--ff-accent);
    font-weight: bold;
}

.tab-item.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.user-summary-card {
    align-content: start;
}

.user-stat-list {
    display: grid;
    gap: 14px;
}

.user-stat {
    display: grid;
    gap: 4px;
}

.user-stat-label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ff-muted);
    font-weight: 700;
}

.user-action-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.user-action-button {
    min-height: 48px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #181512, #2d231c);
    color: white;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.user-action-button:hover {
    transform: translateY(-1px);
}

.user-action-button-secondary {
    background: rgba(24, 21, 18, 0.08);
    color: var(--ff-ink);
}

#loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background-color: #ffffff;
    position: fixed;
    top: 0;
    left: 0;
}

#loading-logo {
    max-height: 150px;
    max-width: 80%;
    object-fit: contain;
    margin-bottom: 20px;
}

.loading-progress {
    width: 100px;
    height: 100px;
    position: relative;
}

.loading-progress circle:first-child {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 6;
}

.loading-progress circle:last-child {
    fill: none;
    stroke: #1b6ec2 !important;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 125.6;
    stroke-dashoffset: 125.6;
    transform-origin: center;
    transform: rotate(-90deg);
    animation: progressAnimation 3s linear forwards;
}

@keyframes progressAnimation {
    from {
        stroke-dashoffset: 125.6;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.loading-progress-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1b6ec2 !important;
    margin-top: 125px;
    text-align: center;
}

body.paused {
    pointer-events: none;
    user-select: none;
    overflow: hidden;
}

#pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.14);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#pause-icon {
    width: 200px;
    height: auto;
}

.transparent-gif {
    width: 100vw;
    height: 100dvh;
    object-fit: cover;
    opacity: 0.24;
}

@media (min-width: 720px) {
    .panel-grid.two-up {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    :root {
        --ff-top-bar-height: 56px;
        --ff-bottom-bar-height: 48px;
    }

    .content {
        padding: 16px 14px calc(62px + var(--ff-safe-bottom));
    }

    .top-bar {
        padding: 6px 14px;
    }

    .app-logo {
        max-width: calc(100% - 112px);
        max-height: calc(var(--ff-top-bar-height) - 16px);
    }

    .top-bar-status {
        right: 12px;
        gap: 6px;
    }

    .status-label {
        font-size: 0.68rem;
        letter-spacing: 0.08em;
    }

    .snaps-badge {
        min-width: 30px;
        height: 26px;
        padding: 0 8px;
        font-size: 12px;
    }

    .tab-item {
        font-size: 9.5px;
        min-width: 60px;
        min-height: 38px;
    }

    .tab-item img {
        width: 25px;
        height: 25px;
    }
}

@media (max-width: 420px) {
    :root {
        --ff-top-bar-height: 52px;
        --ff-bottom-bar-height: 44px;
    }

    .top-bar {
        padding: 6px 10px;
    }

    .app-logo {
        max-width: calc(100% - 92px);
        max-height: calc(var(--ff-top-bar-height) - 18px);
    }

    .top-bar-status {
        right: 8px;
        gap: 4px;
        max-width: 84px;
    }

    .status-label {
        font-size: 0.6rem;
        letter-spacing: 0.05em;
    }

    .snaps-badge {
        min-width: 28px;
        height: 24px;
        padding: 0 7px;
        font-size: 11px;
    }

    .content {
        padding-bottom: calc(58px + var(--ff-safe-bottom));
    }

    .bottom-bar {
        padding-bottom: max(0px, calc(var(--ff-safe-bottom) - 14px));
    }

    .tab-item {
        font-size: 8.5px;
        min-width: 52px;
        min-height: 34px;
        gap: 1px;
    }

    .tab-item img {
        width: 22px;
        height: 22px;
    }

    .tabs {
        padding: 3px 0 1px;
    }
}

@media (max-width: 420px) {
    .top-bar-status .status-label {
        display: none !important;
    }
}

@media (max-width: 360px) {
    :root {
        --ff-top-bar-height: 50px;
        --ff-bottom-bar-height: 42px;
    }

    .top-bar {
        padding: 5px 8px;
    }

    .app-logo {
        max-width: calc(100% - 96px);
        max-height: 20px;
    }

    .top-bar-status {
        right: 6px;
        gap: 3px;
        max-width: 78px;
    }

    .snaps-badge {
        min-width: 26px;
        height: 22px;
        padding: 0 6px;
        font-size: 10px;
    }

    .content {
        padding-bottom: calc(56px + var(--ff-safe-bottom));
    }

    .tab-item {
        font-size: 8px;
        min-width: 48px;
        min-height: 32px;
    }

    .tab-item img {
        width: 21px;
        height: 21px;
    }
}
