:root {
    /* Color Palette - Premium Dark Theme */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-primary: #8b5cf6; /* Purple */
    --accent-secondary: #ec4899; /* Pink */
    
    /* UI Elements */
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --btn-primary-bg: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    
    /* Animations */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden; /* Prevent body scroll, handle inside app-container */
    display: flex;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
}

.app-container {
    width: 100%;
    max-width: 480px; /* Mobile first layout */
    height: 100%;
    position: relative;
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-darker) 100%);
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    overflow: hidden;
    transition: background var(--transition-normal);
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    z-index: 10;
}

.content-wrapper {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.content-wrapper.center-content {
    justify-content: center;
    align-items: center;
}

.content-wrapper.scrollable {
    overflow-y: auto;
    padding-bottom: 40px;
}

.content-wrapper.scrollable::-webkit-scrollbar {
    display: none;
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    line-height: 1.3;
}

/* Landing Screen */
.hero-section {
    margin-top: 10vh;
    text-align: center;
    animation: fadeUp 0.8s ease forwards;
}

.subtitle {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.title {
    font-size: 3.5rem;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

.gradient-text {
    background: var(--btn-primary-bg);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.description {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Visual Orbs for Background */
.visual-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glass-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: float 10s infinite ease-in-out alternate;
}

.orb-1 {
    width: 200px;
    height: 200px;
    background: var(--accent-primary);
    top: 20%;
    left: -50px;
    animation-delay: 0s;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: var(--accent-secondary);
    top: 50%;
    right: -100px;
    animation-delay: -3s;
}

.orb-3 {
    width: 150px;
    height: 150px;
    background: #3b82f6; /* Blue */
    bottom: 10%;
    left: 20%;
    animation-delay: -5s;
}

/* Buttons */
.bottom-action {
    margin-top: auto;
    padding-bottom: 40px;
    width: 100%;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: white;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    margin-bottom: 12px;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    position: relative;
    z-index: 10;
}

.app-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background var(--transition-fast);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-spacer {
    width: 40px;
}

/* Cards (Glassmorphism) */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
}

/* Upload Screen */
.guideline-card h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--accent-secondary);
}

.guide-list {
    list-style: none;
}

.guide-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.guide-list li:last-child {
    margin-bottom: 0;
}

.guide-list .icon {
    font-size: 1.2rem;
    margin-right: 12px;
    line-height: 1.4;
}

.guide-list p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.guide-list strong {
    color: var(--text-primary);
}

.upload-area {
    margin-top: auto;
    margin-bottom: 40px;
}

.upload-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    border: 2px dashed var(--accent-primary);
    border-radius: 24px;
    background: rgba(139, 92, 246, 0.05);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.upload-button:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-secondary);
}

.upload-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--btn-primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: white;
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
}

.upload-button span {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Loading Screen */
.scanner-container {
    width: 240px;
    height: 320px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin-bottom: 40px;
    border: 2px solid var(--glass-border);
}

.scan-image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: #2a2a2a;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    filter: grayscale(20%);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-secondary);
    box-shadow: 0 0 20px 5px var(--accent-secondary);
    animation: scanning 2s linear infinite;
}

.loading-status {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 1.3rem;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 1.5s infinite;
}

.loading-subtext {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Result Screen */
.result-header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeUp 0.6s ease;
}

.result-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.result-title {
    font-size: 2.8rem;
    margin-bottom: 16px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.result-badge-container {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
}

.result-desc {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 24px;
    color: var(--text-secondary);
    white-space: pre-line;
}

.color-section {
    margin-bottom: 20px;
}

.color-section:last-child {
    margin-bottom: 0;
}

.color-section h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-chip {
    width: calc(20% - 10px);
    aspect-ratio: 1;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform var(--transition-fast);
    cursor: pointer;
}

.color-chip:hover {
    transform: scale(1.1);
}

.color-chip.worst {
    border-radius: 8px;
    opacity: 0.8;
}

.action-buttons {
    margin-top: 30px;
}

/* Keyframes */
@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(20px, 30px) scale(1.1); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scanning {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-anim 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}
