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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #fff;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading-screen p {
    font-size: 14px;
    opacity: 0.7;
}

#error-screen .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

#error-screen h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

#error-screen p {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 24px;
    text-align: center;
    max-width: 280px;
}

/* Name screen */
#name-screen {
    z-index: 30;
    gap: 12px;
    padding: 32px;
}

#name-screen .icon {
    font-size: 64px;
    margin-bottom: 8px;
}

#name-screen h2 {
    font-size: 22px;
    margin-bottom: 4px;
}

#name-screen .subtitle {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 16px;
}

#name-input {
    width: 100%;
    max-width: 260px;
    padding: 14px 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 18px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

#name-input:focus {
    border-color: #ffd700;
}

#name-input::placeholder {
    color: rgba(255,255,255,0.4);
}

#name-btn {
    margin-top: 8px;
    padding: 14px 40px;
    border: none;
    border-radius: 24px;
    background: #fff;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

#name-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Error */
#error-screen .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

#error-screen button {
    padding: 12px 32px;
    border: 1px solid #fff;
    background: transparent;
    color: #fff;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
}

#viewport {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#counter-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 10;
}

#counter-current {
    color: #ffd700;
}

#shutter-btn {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    padding: 0;
}

/* Pending uploads badge */
#pending-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(4px);
}

#pending-badge.hidden {
    display: none;
}

.shutter-outer {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.shutter-inner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.1s, background 0.1s;
}

#shutter-btn:active .shutter-outer {
    transform: scale(0.92);
}

#shutter-btn:active .shutter-inner {
    background: #ccc;
    transform: scale(0.85);
}

#hint {
    position: absolute;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    opacity: 0.5;
    z-index: 10;
    white-space: nowrap;
}

#done-screen .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

#done-screen h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

#done-screen .sub {
    font-size: 14px;
    opacity: 0.6;
    margin-top: 8px;
}

@keyframes flash {
    0% { background: rgba(255,255,255,0.8); }
    100% { background: transparent; }
}

.flash-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    animation: flash 0.3s ease-out;
    pointer-events: none;
}