:root {
    --bg-color: #000000;
    --text-color: #FFFFFF;
    --btn-bg: #FFFFFF;
    --btn-text: #000000;
    --gear-bg: rgba(255, 255, 255, 0.15);
    --gear-color: #FFFFFF;
}

.light-mode {
    --bg-color: #F0F0F0;
    --text-color: #000000;
    --btn-bg: #000000;
    --btn-text: #FFFFFF;
    --gear-bg: rgba(0, 0, 0, 0.1);
    --gear-color: #000000;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    overscroll-behavior-y: none;
    touch-action: none;
    transition: background-color 0.3s ease;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.pill-btn {
    background-color: var(--btn-bg);
    color: var(--btn-text);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 16px 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 85%;
    max-width: 350px;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform;
}

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

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
}

.screen.active {
    display: flex;
}

#upload-screen {
    justify-content: center;
}

.settings-container {
    position: absolute;
    top: env(safe-area-inset-top, 20px);
    right: 20px;
    width: 44px;
    height: 44px;
    z-index: 100;
}

.gear-btn {
    width: 100%;
    height: 100%;
    background-color: var(--gear-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gear-color);
    pointer-events: none;
}

#settings-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 16px; 
}

.crop-wrapper {
    margin-top: 15vh;
    width: 300px;
    height: 300px;
    position: relative;
    overflow: hidden;
    background-color: #111;
    border: 1px solid rgba(255,255,255,0.8);
    mask-image: -webkit-radial-gradient(white, black);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

#crop-image {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    pointer-events: none;
    will-change: transform;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.crop-overlay::before,
.crop-overlay::after {
    content: '';
    position: absolute;
    background-color: rgba(255, 255, 255, 0.6);
}

.crop-overlay::before { top: 0; left: 50%; width: 1px; height: 100%; transform: translateX(-50%); }
.crop-overlay::after { top: 50%; left: 0; width: 100%; height: 1px; transform: translateY(-50%); }

.previews-container {
    display: flex;
    gap: 30px; 
    width: 300px; 
    margin-top: 30px;
    justify-content: center;
}

.preview-canvas {
    width: 80px;
    height: 80px;
    background-color: #111;
    transform: translateZ(0); 
}

#prev-rounded { border-radius: 18px; }
#prev-circle { border-radius: 50%; }
#prev-square { border-radius: 0; }

.footer-action {
    margin-top: auto; 
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 30px);
    padding-top: 20px;
}

#export-screen {
    justify-content: center;
    gap: 30px;
    padding: 20px;
    text-align: center;
}

#final-image-display {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 2px solid var(--text-color);
    -webkit-touch-callout: default;
}

.instruction-text {
    font-size: 1.2rem;
    font-weight: 500;
    max-width: 80%;
    line-height: 1.4;
}

.sub-text {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: -20px;
}