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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #fdf6f0 0%, #f5e6d8 50%, #e8d5e0 100%);
    min-height: 100vh;
    color: #2d2d2d;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

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

/* ========== Auth Section ========== */
.auth-card {
    max-width: 420px;
    margin: 0 auto;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    background: rgba(0,0,0,0.04);
    border-radius: 12px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background: white;
    color: #4a3a4a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease;
    background: rgba(255,255,255,0.8);
}

.form-group input:focus {
    border-color: #c06c84;
}

.auth-error {
    color: #e04060;
    font-size: 0.8rem;
    min-height: 20px;
}

.auth-trust {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.06);
    color: #888;
    font-size: 0.78rem;
    line-height: 1.5;
}

.auth-trust svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #6c9;
}

.auth-trust strong {
    color: #666;
}

/* User Bar */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.5);
    border-radius: 12px;
}

.user-bar span {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.btn-text {
    background: none;
    border: none;
    color: #a06080;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-full {
    width: 100%;
    text-align: center;
}

/* Upload Section */
.title {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #c06c84, #6c5b7b, #355c7d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: #777;
    margin-bottom: 40px;
    font-weight: 300;
}

.drop-zone {
    border: 3px dashed #c9a7b8;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #a06080;
    background: rgba(255,255,255,0.8);
    transform: scale(1.01);
}

.upload-icon {
    color: #b08090;
    margin-bottom: 16px;
}

.drop-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: #666;
}

.drop-or {
    color: #999;
    margin: 12px 0;
    font-size: 0.9rem;
}

.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 50px;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #c06c84, #6c5b7b);
    color: white;
    box-shadow: 0 4px 15px rgba(192,108,132,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192,108,132,0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255,255,255,0.7);
    color: #6c5b7b;
    border: 2px solid #c06c84;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.btn-secondary:hover {
    background: rgba(192,108,132,0.1);
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.85rem;
    background: rgba(192,108,132,0.15);
    color: #8a4a6a;
    border-radius: 50px;
}

.btn-small:hover {
    background: rgba(192,108,132,0.25);
}

.btn-small.active {
    background: linear-gradient(135deg, #c06c84, #6c5b7b);
    color: white;
}

.tips {
    margin-top: 40px;
    padding: 24px;
    background: rgba(255,255,255,0.4);
    border-radius: 16px;
}

.tips h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
}

.tips ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tips li {
    font-size: 0.85rem;
    color: #777;
    padding-left: 20px;
    position: relative;
}

.tips li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: #a06080;
    font-weight: 600;
}

/* ========== Person Selection ========== */
.select-subtitle {
    text-align: center;
    color: #777;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.select-canvas-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.select-canvas-wrapper canvas {
    max-width: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    cursor: pointer;
}

.selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.selected-chip {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.selected-chip.unselected {
    background: rgba(0,0,0,0.06);
    color: #999;
}

.selected-chip.selected {
    background: linear-gradient(135deg, #c06c84, #6c5b7b);
    color: white;
    box-shadow: 0 2px 10px rgba(192,108,132,0.3);
}

.chip-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 4px;
    border: 2px solid rgba(255,255,255,0.5);
}

.selected-chip {
    display: inline-flex;
    align-items: center;
}

/* ========== Person Tabs ========== */
.person-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.person-tab {
    padding: 8px 24px;
    border-radius: 50px;
    border: 2px solid rgba(192,108,132,0.3);
    background: rgba(255,255,255,0.5);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
}

.person-tab.active {
    background: linear-gradient(135deg, #c06c84, #6c5b7b);
    color: white;
    border-color: transparent;
}

.person-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tab-thumb {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.6);
}

/* Result thumbnail */
.result-thumb {
    margin: 0 auto 16px;
}

.result-thumb img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(192,108,132,0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Analyzing Section */
#section-analyzing .container,
#section-detecting .container {
    text-align: center;
}

#section-analyzing h2,
#section-detecting h2,
#section-select h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: #4a3a4a;
    text-align: center;
}

.analyzing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.preview-wrapper {
    max-width: 400px;
    border-radius: 16px;
    overflow: hidden;
    border: 4px solid rgba(192,108,132,0.3);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.preview-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(192,108,132,0.2);
    border-top-color: #c06c84;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.analyzing-text {
    color: #888;
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Results Section */
.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #4a3a4a;
    margin-bottom: 20px;
}

.season-badge {
    display: inline-block;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.season-badge.spring { background: linear-gradient(135deg, #f6d365, #fda085); }
.season-badge.summer { background: linear-gradient(135deg, #a1c4fd, #c2e9fb); color: #3a5a7a; }
.season-badge.autumn { background: linear-gradient(135deg, #cd6133, #e2a76f); }
.season-badge.winter { background: linear-gradient(135deg, #0f2027, #2c5364); }

.season-description {
    color: #666;
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Cards */
.card {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a3a4a;
    margin-bottom: 16px;
}

/* Detected Colors */
.detected-colors {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.detected-color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.detected-color-item span {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

.color-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.8);
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

/* Axes */
.axis-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.axis {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.axis-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #999;
}

.axis-title {
    font-weight: 600;
    color: #666;
}

.axis-track {
    height: 12px;
    border-radius: 6px;
    position: relative;
    overflow: visible;
}

#undertoneTrack {
    background: linear-gradient(to right, #5b8bd4, #ddd, #d4855b);
}

#valueTrack {
    background: linear-gradient(to right, #333, #ddd, #f5f0eb);
}

#chromaTrack {
    background: linear-gradient(to right, #b0a8a0, #ddd, #e84393);
}

.axis-marker {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid #4a3a4a;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: left 0.8s ease;
}

/* Override */
.card-override {
    border: 2px dashed rgba(192,108,132,0.3);
    background: rgba(255,255,255,0.5);
}

.card-override p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 12px;
}

.override-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.override-preview {
    text-align: center;
}

.override-preview canvas {
    max-width: 100%;
    border-radius: 12px;
    cursor: crosshair;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.pick-instructions {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #a06080;
    font-weight: 500;
}

/* Palette Grid */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
}

.palette-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.swatch-color {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border: 2px solid rgba(255,255,255,0.8);
    transition: transform 0.2s ease;
}

.swatch-color:hover {
    transform: scale(1.08);
}

.swatch-name {
    font-size: 0.72rem;
    color: #888;
    text-align: center;
    font-weight: 500;
}

.swatch-hex {
    font-size: 0.65rem;
    color: #aaa;
    font-family: monospace;
}

.palette-avoid .swatch-color {
    opacity: 0.7;
    position: relative;
}

.palette-avoid .swatch-color::after {
    content: "\00D7";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: rgba(255,255,255,0.7);
    font-weight: 700;
}

/* Fabrics */
.fabric-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.fabric-card {
    background: rgba(255,255,255,0.6);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
}

.style-text {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.8;
}

/* Actions */
.actions {
    text-align: center;
    margin-top: 30px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: #aaa;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .tips ul {
        grid-template-columns: 1fr;
    }

    .detected-colors {
        gap: 20px;
    }

    .color-circle {
        width: 55px;
        height: 55px;
    }

    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .override-controls {
        flex-wrap: wrap;
    }

    .container {
        padding: 24px 16px;
    }

    .auth-card {
        padding: 28px 20px;
    }
}

/* No Detection Warning Overlay */
.warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.warning-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 460px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.warning-icon {
    margin-bottom: 16px;
}

.warning-card h3 {
    font-size: 1.4rem;
    color: #2d3748;
    margin-bottom: 10px;
}

.warning-card > p {
    color: #718096;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.warning-tips {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    margin-bottom: 24px;
}

.warning-tips p {
    font-size: 0.9rem;
    color: #c53030;
    margin-bottom: 8px;
}

.warning-tips ul {
    list-style: none;
    padding: 0;
}

.warning-tips li {
    font-size: 0.88rem;
    color: #4a5568;
    padding: 3px 0 3px 18px;
    position: relative;
}

.warning-tips li::before {
    content: "\2022";
    color: #e74c3c;
    position: absolute;
    left: 4px;
}
