:root {
    /* Exact Palette extracted from Skin/Pele/Piel chart */
    --skin-ivory: #ead8c4;
    --skin-rose-light: #f0d6c9;
    --skin-peach-light: #f5d4cd;
    --skin-fair-1: #e0c8ae;
    --skin-fair-rose: #eac2ba;
    --skin-light-tan: #d2b897;
    --skin-light-peach: #dcb39f;
    --skin-medium-sand: #c4a682;
    --skin-medium-peach: #cfa28b;
    --skin-medium-rose: #d4a093;
    --skin-tan-1: #b4976f;
    --skin-tan-warm: #bd9174;
    --skin-tan-rose: #c68d82;
    --skin-bronze-1: #a5855e;
    --skin-bronze-warm: #ac8063;
    --skin-terracotta: #b27e69;
    --skin-terracotta-rose: #b67c70;
    --skin-chestnut: #8b5f46;
    --skin-chestnut-rose: #905c4f;
    --skin-mahogany: #745036;
    --skin-mahogany-warm: #784d3d;
    --skin-earth: #6d5533;
    --skin-deep-wood: #5d412b;
    --skin-espresso: #463420;
    --skin-deep-ebony: #4e2f2a;
    --skin-dark-base: #281a14;
    
    --card-bg: rgba(40, 26, 20, 0.88);
    --card-border: rgba(207, 162, 139, 0.35);
    --card-border-glow: rgba(234, 194, 186, 0.6);
    
    --accent: #b27e69;
    --accent-hover: #c68d82;
    --accent-glow: rgba(178, 126, 105, 0.45);
    
    --text-primary: #faf1ea;
    --text-secondary: #e0c8ae;
    --text-muted: #a5855e;
    --error-color: #f87171;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --font-papyrus: 'Papyrus', 'Almendra', 'Cinzel Decorative', 'Eagle Lake', fantasy, cursive, serif;
    --font-serif: 'Almendra', 'Cinzel Decorative', 'Papyrus', Georgia, serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    background-color: var(--skin-dark-base);
    background: linear-gradient(
        135deg,
        #463420 0%,
        #5d412b 20%,
        #745036 40%,
        #8b5f46 60%,
        #ac8063 80%,
        #4e2f2a 100%
    );
    background-size: 300% 300%;
    animation: skinPaletteInterpolate 12s ease-in-out infinite alternate;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Multi-stage continuous interpolation across the user's Skin/Pele/Piel chart */
@keyframes skinPaletteInterpolate {
    0% {
        /* Deep Espresso to Rich Chestnut */
        background-position: 0% 0%;
        background-color: #463420;
    }
    20% {
        /* Mahogany & Terracotta (#745036, #784d3d, #b27e69) */
        background-position: 50% 25%;
        background-color: #5d412b;
    }
    40% {
        /* Warm Bronze & Caramel (#8b5f46, #ac8063, #b4976f) */
        background-position: 100% 50%;
        background-color: #745036;
    }
    60% {
        /* Tan, Sand & Peach (#bd9174, #cfa28b, #d4a093) */
        background-position: 70% 100%;
        background-color: #8b5f46;
    }
    80% {
        /* Rosy Fair & Warm Ivory (#dcb39f, #eac2ba, #f0d6c9) */
        background-position: 25% 75%;
        background-color: #6d5533;
    }
    100% {
        /* Deep Ebony Rose & Espresso (#4e2f2a, #7b4b41, #453420) */
        background-position: 0% 0%;
        background-color: #4e2f2a;
    }
}

/* Layered floating skin glow using exact palette highlights */
.skin-ambient-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 750px;
    height: 750px;
    background: radial-gradient(
        circle,
        rgba(207, 162, 139, 0.28) 0%,
        rgba(178, 126, 105, 0.2) 35%,
        rgba(116, 80, 54, 0.12) 60%,
        transparent 75%
    );
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: skinGlowMorph 8s ease-in-out infinite alternate;
}

@keyframes skinGlowMorph {
    0% {
        transform: translate(-50%, -50%) scale(0.85);
        background: radial-gradient(
            circle,
            rgba(240, 214, 201, 0.25) 0%,
            rgba(207, 162, 139, 0.18) 40%,
            transparent 70%
        );
    }
    33% {
        transform: translate(-46%, -54%) scale(1.2);
        background: radial-gradient(
            circle,
            rgba(234, 194, 186, 0.28) 0%,
            rgba(182, 124, 112, 0.2) 45%,
            transparent 70%
        );
    }
    66% {
        transform: translate(-54%, -46%) scale(0.95);
        background: radial-gradient(
            circle,
            rgba(210, 184, 151, 0.28) 0%,
            rgba(165, 133, 94, 0.18) 45%,
            transparent 70%
        );
    }
    100% {
        transform: translate(-50%, -50%) scale(1.15);
        background: radial-gradient(
            circle,
            rgba(198, 141, 130, 0.25) 0%,
            rgba(139, 95, 70, 0.15) 50%,
            transparent 70%
        );
    }
}

.container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Slender, elegant Claude-style geometric sunburst asterisk */
.asterisk-symbol {
    width: 90px;
    height: 90px;
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--skin-light-peach);
    filter: drop-shadow(0 0 18px rgba(220, 179, 159, 0.7)) drop-shadow(0 0 35px rgba(178, 126, 105, 0.45));
    animation: asteriskPulseSize 6s ease-in-out infinite alternate;
    user-select: none;
    transform-origin: center center;
}

.claude-asterisk {
    width: 100%;
    height: 100%;
    display: block;
}

@keyframes asteriskPulseSize {
    0% {
        transform: scale(0.85);
        color: var(--skin-terracotta);
        filter: drop-shadow(0 0 12px rgba(178, 126, 105, 0.6));
    }
    50% {
        transform: scale(1.28);
        color: var(--skin-fair-rose);
        filter: drop-shadow(0 0 25px rgba(234, 194, 186, 0.9)) drop-shadow(0 0 45px rgba(198, 141, 130, 0.6));
    }
    100% {
        transform: scale(0.95);
        color: var(--skin-ivory);
        filter: drop-shadow(0 0 20px rgba(234, 216, 196, 0.8));
    }
}

.logo {
    font-family: var(--font-papyrus);
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--skin-creme);
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.7);
    margin-bottom: 0.25rem;
}

.tagline {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--skin-medium-peach);
    letter-spacing: 0.08em;
    font-weight: 400;
}

.lang-selector {
    display: inline-flex;
    align-items: center;
    background: rgba(30, 20, 15, 0.65);
    border: 1px solid rgba(234, 194, 186, 0.25);
    border-radius: 9999px;
    padding: 3px;
    margin-top: 0.75rem;
    gap: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-lang {
    background: transparent;
    border: none;
    color: var(--skin-tan-1);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 0.32rem 0.85rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.btn-lang:hover {
    color: var(--skin-creme);
    background: rgba(234, 194, 186, 0.1);
}

.btn-lang.active {
    background: linear-gradient(135deg, rgba(182, 124, 112, 0.85), rgba(139, 95, 70, 0.9));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(182, 124, 112, 0.5);
}

.app-version {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--skin-tan-1);
    font-family: ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.08em;
    opacity: 0.75;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 1.85rem;
    box-shadow: 
        0 25px 60px -15px rgba(0, 0, 0, 0.85),
        0 0 0 1px rgba(234, 194, 186, 0.12);
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: var(--card-border-glow);
    box-shadow: 
        0 30px 70px -15px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(178, 126, 105, 0.3);
}

.upload-zone {
    position: relative;
    border: 2px dashed var(--skin-chestnut);
    border-radius: var(--radius-md);
    background: rgba(40, 26, 20, 0.7);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--skin-medium-peach);
    background: rgba(69, 44, 34, 0.65);
}

.upload-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.25rem 1rem;
    cursor: pointer;
    width: 100%;
    height: 100%;
    text-align: center;
}

.upload-icon {
    font-size: 2.6rem;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    margin-bottom: 0.25rem;
}

.upload-text {
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--skin-creme);
    font-family: var(--font-papyrus);
    letter-spacing: 0.05em;
}

.upload-subtext {
    font-size: 0.82rem;
    color: var(--skin-tan-1);
}

.timing-estimate {
    text-align: center;
    font-size: 0.83rem;
    color: var(--skin-medium-peach);
    font-family: var(--font-sans);
    opacity: 0.9;
    letter-spacing: 0.02em;
    margin-top: -0.35rem;
    margin-bottom: 0.25rem;
}

.preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
}

.preview-container img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-sm);
}

.btn-clear {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(40, 26, 20, 0.9);
    color: var(--skin-creme);
    border: 1px solid var(--skin-mahogany);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: #ef4444;
}

.btn-submit {
    width: 100%;
    padding: 1.05rem 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--skin-tan-warm) 100%);
    color: var(--skin-creme);
    border: 1px solid rgba(250, 241, 234, 0.2);
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: 600;
    font-family: var(--font-papyrus);
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 6px 22px var(--accent-glow);
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--skin-medium-peach) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(178, 126, 105, 0.65);
}

.btn-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(250, 241, 234, 0.3);
    border-top-color: var(--skin-creme);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.progress-wrapper {
    background: rgba(30, 18, 13, 0.7);
    border: 1px solid var(--skin-mahogany);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    animation: fadeIn 0.35s ease;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-serif);
    font-size: 0.92rem;
}

.progress-phase {
    color: var(--skin-ivory);
    font-weight: 500;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(18, 11, 8, 0.9);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(178, 126, 105, 0.25);
    position: relative;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--skin-terracotta) 0%, var(--skin-medium-peach) 50%, var(--skin-fair-rose) 100%);
    border-radius: 999px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 12px rgba(234, 194, 186, 0.6);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: progressShimmer 1.8s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    font-family: var(--font-sans);
}

.progress-eta {
    color: var(--skin-medium-peach);
    font-weight: 500;
}

.progress-percent {
    color: var(--skin-tan-1);
    font-weight: 600;
}

.status-msg {
    font-size: 0.95rem;
    text-align: center;
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-serif);
    animation: fadeIn 0.3s ease;
}

.status-msg.error {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--error-color);
}

.status-msg.info {
    background: rgba(178, 126, 105, 0.2);
    border: 1px solid rgba(207, 162, 139, 0.45);
    color: var(--skin-ivory);
}

.result-box {
    background: rgba(30, 18, 13, 0.95);
    border: 1px solid var(--skin-tan-warm);
    border-radius: var(--radius-md);
    padding: 1.6rem;
    animation: fadeIn 0.5s ease;
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.7);
}

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

.result-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(207, 162, 139, 0.3);
}

.result-asterisk {
    color: var(--skin-medium-peach);
    font-size: 1.3rem;
}

.result-title {
    font-family: var(--font-papyrus);
    font-size: 1.45rem;
    letter-spacing: 0.1em;
    color: var(--skin-ivory);
}

.fortune-text {
    font-size: 1.02rem;
    color: var(--text-primary);
    line-height: 1.85;
    font-family: var(--font-serif);
}

.fortune-text h1, .fortune-text h2, .fortune-text h3, .fortune-text h4 {
    font-family: var(--font-papyrus);
    color: var(--skin-ivory);
    margin-top: 1.25rem;
    margin-bottom: 0.65rem;
    letter-spacing: 0.05em;
}

.fortune-text h1, .fortune-text h2:first-child { 
    font-size: 1.45rem;
    margin-top: 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(207, 162, 139, 0.35);
    color: var(--skin-fair-rose);
}

.fortune-text h2 { font-size: 1.3rem; }
.fortune-text h3 { 
    font-size: 1.15rem; 
    color: var(--skin-ivory); 
    border-bottom: 1px dashed rgba(207, 162, 139, 0.25);
    padding-bottom: 0.25rem;
    margin-top: 1.5rem;
}
.fortune-text h4 { font-size: 1.05rem; }

.fortune-text p {
    margin-bottom: 0.95rem;
}

.fortune-text strong, .fortune-text b {
    color: var(--skin-creme);
    font-family: var(--font-papyrus);
    font-weight: 700;
}

.fortune-text em, .fortune-text i {
    color: var(--skin-peach);
    font-style: italic;
}

.fortune-text blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1.15rem;
    border-left: 3px solid var(--accent);
    background: rgba(18, 11, 8, 0.6);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--skin-ivory);
    font-style: italic;
}

.fortune-text blockquote p {
    margin-bottom: 0;
}

.fortune-text ul, .fortune-text ol {
    margin: 0.75rem 0 1rem 1.5rem;
}

.fortune-text li {
    margin-bottom: 0.35rem;
}

.fortune-text hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(207, 162, 139, 0.4) 50%, transparent 100%);
    margin: 1.25rem 0;
}

.streaming-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: var(--skin-fair-rose);
    margin-left: 3px;
    vertical-align: middle;
    animation: blinkCursor 0.8s infinite;
}

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

.footer {
    text-align: center;
}

.privacy-note {
    font-size: 0.8rem;
    font-family: var(--font-serif);
    color: var(--skin-tan-1);
}

.hidden {
    display: none !important;
}
