:root {
    /* Colors */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --bg-color: #FAFAFA;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    
    /* Layout */
    --max-width: 1440px;
    --nav-height: 72px;
    
    /* Camera */
    --camera-frame-color: transparent;
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Shadows & Radii */
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.05);
    --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}
.btn-secondary {
    background-color: white;
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.btn-secondary:hover {
    background-color: var(--bg-color);
}
.btn-text {
    color: var(--primary);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-text:hover {
    text-decoration: underline;
}

/* Navigation */
.premium-nav {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    height: var(--nav-height);
    z-index: 100;
    display: flex;
    align-items: center;
}
.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
}
.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
}
.badge {
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text-muted);
}
.btn-signin {
    font-weight: 600;
    color: var(--text-main);
}

/* Ads Placeholder */
.ad-container {
    display: flex;
    justify-content: center;
    margin: 32px auto;
    width: 100%;
}
.ad-placeholder {
    background: #E5E7EB;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    border: 1px dashed #D1D5DB;
}
.ad-leaderboard-top .ad-placeholder,
.ad-bottom .ad-placeholder {
    width: 728px;
    height: 90px;
}
.ad-middle .ad-placeholder {
    width: 970px;
    height: 250px;
}
.ad-footer .ad-placeholder {
    width: 100%;
    max-width: 1200px;
    height: 90px;
}
@media (max-width: 1024px) {
    .ad-leaderboard-top, .ad-middle, .ad-bottom { display: none; } /* Simplified for mobile */
}

/* Hero */
.app-hero {
    text-align: center;
    padding: 64px 24px 48px;
    max-width: 800px;
    margin: 0 auto;
}
.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 16px;
}
.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}
.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Layout */
.korean-color-app {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}
.app-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 64px;
}
.camera-section {
    order: -1; /* Show camera first on mobile */
}
@media (min-width: 1024px) {
    .app-layout {
        display: grid;
        grid-template-columns: 280px 1fr 300px;
    }
    .camera-section {
        order: 0;
    }
}

/* Panels */
.panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.8);
}
.panel-title {
    font-size: 1.25rem;
    margin-bottom: 24px;
}

/* Palettes */
.palette-group {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}
.palette-group:last-child {
    border-bottom: none;
}
.palette-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    padding: 8px 0;
}
.palette-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 16px;
}
.swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}
.swatch:hover, .swatch.active {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.recent-colors {
    margin-top: 32px;
}
.sub-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.recent-swatches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Camera Hero */
.camera-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.camera-frame {
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #E5E7EB;
    border-radius: 40px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-soft);
}
#webcam-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror by default */
}
/* Palette Overlay */
.camera-palette-overlay {
    position: absolute;
    bottom: -20px;
    left: -20px;
    right: -20px;
    height: 40%;
    background-color: var(--camera-frame-color);
    transition: background-color 0.25s ease-in-out;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    filter: drop-shadow(0 -10px 20px rgba(0,0,0,0.1));
    z-index: 10;
}

/* Overlays */
.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 20;
    overflow-y: auto;
}
.overlay-card {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 400px;
    box-shadow: var(--shadow-hover);
}
.icon-circle {
    width: 64px;
    height: 64px;
    background: #EFF6FF;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px;
}
.icon-circle.error {
    background: #FEF2F2;
    color: #DC2626;
}
.overlay-card h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}
.overlay-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
}
.privacy-list {
    list-style: none;
    text-align: left;
    margin-bottom: 32px;
}
.privacy-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-main);
}
.privacy-list i {
    color: #10B981;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.overlay-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 480px) {
    .camera-overlay {
        align-items: flex-start; /* Allow scrolling from top */
        padding: 16px;
    }
    .overlay-card {
        padding: 20px;
        margin: auto; /* Keeps it centered if height allows */
    }
    .icon-circle {
        width: 48px;
        height: 48px;
        font-size: 24px;
        margin-bottom: 12px;
    }
    .overlay-card h3 {
        font-size: 1.25rem;
        margin-bottom: 8px;
    }
    .overlay-card p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    .privacy-list {
        margin-bottom: 16px;
    }
    .privacy-list li {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
}

/* Camera Controls */
.camera-controls {
    display: flex;
    gap: 16px;
    background: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-soft);
}
.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--text-main);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.control-btn:hover, .control-btn.active {
    background: var(--primary);
    color: white;
}

/* Tools Panel */
/* Custom Color Picker */
.custom-color-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.8);
}
.custom-color-header h3 {
    font-size: 1.125rem;
    margin-bottom: 4px;
}
.custom-color-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.picker-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
#iro-color-picker {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}
/* Iro.js overrides if needed */
.IroColorPicker {
    width: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.IroSlider {
    margin-top: 16px !important;
}

/* Inputs styling matching the image */
.color-inputs-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.hex-row {
    display: flex;
    gap: 8px;
}
.hex-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 44px;
}
.hex-input-wrapper input {
    border: none;
    outline: none;
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
    background: transparent;
    text-transform: uppercase;
}
.label-inline {
    font-size: 0.75rem;
    color: #9CA3AF;
    font-weight: 600;
}
.btn-copy {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-main);
    transition: background 0.2s;
}
.btn-copy:hover {
    background: var(--bg-color);
}
.rgb-row {
    display: flex;
    gap: 8px;
}
.rgb-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 0;
    background: transparent;
}
.rgb-input input {
    border: none;
    outline: none;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    background: transparent;
    /* hide arrows */
    -moz-appearance: textfield;
}
.rgb-input input::-webkit-outer-spin-button,
.rgb-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.rgb-input label {
    font-size: 0.7rem;
    color: #9CA3AF;
    font-weight: 600;
}

/* Sections */
.outfit-recommendations, .educational-content, .related-articles, .how-it-works-section {
    padding: 64px 0;
    border-top: 1px solid var(--border-color);
}
section h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    text-align: center;
}

/* How It Works */
.how-it-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 32px;
}
.step-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    position: relative;
    border: 1px solid rgba(255,255,255,0.8);
}
.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.step-card h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}
.step-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Recommendations */
.recommendations-scroll {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 24px;
    scrollbar-width: none;
}
.recommendations-scroll::-webkit-scrollbar {
    display: none;
}
.outfit-card {
    min-width: 300px;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}
.outfit-img {
    height: 200px;
    width: 100%;
}
.outfit-info {
    padding: 24px;
}
.outfit-info h3 {
    font-size: 1.125rem;
    margin-bottom: 12px;
}

/* Education */
.edu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
}
@media (min-width: 1024px) {
    .edu-grid { grid-template-columns: 2fr 1fr; }
}
.edu-text h3 {
    margin: 32px 0 16px;
    font-size: 1.5rem;
}
.edu-text p {
    margin-bottom: 16px;
    color: var(--text-muted);
}
.seasons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.season-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}
.dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}
.dot.spring { background: #FCD34D; }
.dot.summer { background: #7DD3FC; }
.dot.autumn { background: #D97706; }
.dot.winter { background: #1D4ED8; }

details {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
}
summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
summary::-webkit-details-marker {
    display: none;
}
details p {
    margin-top: 12px;
    color: var(--text-muted);
}

/* Related */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}
.article-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s;
}
.article-card:hover {
    transform: translateY(-4px);
}
.article-img {
    height: 150px;
    background: #E5E7EB;
}
.article-card h3 {
    padding: 16px;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .camera-palette-overlay {
        height: 50%;
    }
}
