/* Theme variables */
:root {
    --camera-bg: #fff;
    --camera-fg: #0e0e78;
    --accent: rgb(7, 85, 174);
    --accent-soft: rgba(7, 85, 174, 0.5);
    --overlay-bg: #fff;
    --overlay-fg: #fff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --camera-bg: rgb(80, 8, 8);
        --camera-fg: orange;
        --accent: orange;
        --accent-soft: rgba(255, 165, 0, 0.5);
        --overlay-bg: rgb(53, 20, 20);
        --overlay-fg: orange;
    }
}

* {
    box-sizing: border-box;
    transition: all 0.2s ease-in;
    margin: 0;
    padding: 0;
}

/* Reset body */
body {
    margin: 0;
    overflow: hidden;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--camera-bg);
    color: var(--camera-fg);
}

/* Camera container */
#camera-container {
    position: relative;
    width: 100vw;
    height: 100vh;

    background-color: var(--camera-bg);
    color: var(--camera-fg);
}

#switch-camera {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    border-radius: 50%;
    background: var(--camera-bg);
}

#open-settings {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    border-radius: 50%;
    background: var(--camera-bg);
}

/* Canvas fills container */
#camera-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Shutter button */
#shutter {
    z-index: 2;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;

    background-color: var(--accent-soft);
    border-radius: 50%;
    border: 4px solid var(--accent);

    cursor: pointer;

    bottom: calc(20px + env(safe-area-inset-bottom));
}

/* Press effect */
#shutter:active {
    background-color: var(--accent);
    transform: translateX(-50%) scale(0.95);
}

/* Flash overlay */
#flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: var(--accent);
    opacity: 0;
    pointer-events: none;
    z-index: 3;

    transition: opacity 0.1s ease-out;
}

/* Photo overlay */
#photo-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);

    display: flex;
    justify-content: center;
    align-items: start;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;

    z-index: 9999;
}

#photo-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-inner {
    max-width: 100%;
    max-height: 100%;

    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    gap: 16px;
}

#overlay-image {
    width: 85%;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--accent);
    border-radius: 12px;
}

.overlay-controls {
    width: 100%;
    padding: 16px 24px;
    text-align: center;
    color: var(--camera-fg);

    display: flex;
    justify-content: space-between;
}

a,
button,
.overlay-buttons a,
.overlay-buttons button {
    border: none;
    background: none;
    text-decoration: none;
    color: var(--accent);
}

svg {
    width: 60px;
    height: 50px;
}

.settings-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    color: var(--overlay-fg);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.settings-overlay.active {
    display: flex;
}

.settings-inner {
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
}
