:root {
    --primary-color: #ff6b9d;
    --secondary-color: #a18fff;
    --accent-color: #ffc2d1;
    --dark-color: #5a4f7c;
    --light-color: #fff8fc;
    --bg-color: #fff8fc;
    --bg-gradient: linear-gradient(135deg, #fff0f5 0%, #e6e6ff 100%);
    --container-bg: rgba(255, 255, 255, 0.95);
    --container-shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
    --subtitle-color: #8a7ca8;
    --border-color: #e8d7e9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Noto Sans SC', sans-serif;
    background: var(--bg-gradient);
    color: var(--dark-color);
    min-height: 100vh;
    padding: 20px;
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--container-bg);
    border-radius: 24px;
    box-shadow: var(--container-shadow);
    padding: 30px 40px;
    overflow: hidden;
    position: relative;
}

.container::before {
    content: "";
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    z-index: -1;
    border-radius: 28px;
    animation: border-pulse 4s infinite alternate;
    opacity: 0.4;
}

@keyframes border-pulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

h1 {
    color: var(--dark-color);
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1::after {
    content: "🎀";
    position: absolute;
    right: -40px;
    top: -10px;
    font-size: 1.8rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.5; transform: scale(1); }
}

.subtitle {
    color: var(--subtitle-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 5px;
}

.disclaimer {
    background-color: #fff0f9;
    border: 2px dashed var(--primary-color);
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 12px;
    position: relative;
}

.disclaimer p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.disclaimer strong {
    color: var(--primary-color);
}

.close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--subtitle-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--primary-color);
}

.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    margin-bottom: 30px;
    background-color: rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(255, 107, 157, 0.1);
    transform: translateY(-5px);
}

.upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.upload-icon {
    color: #ffb6c1;
    width: 64px;
    height: 64px;
    transition: all 0.3s;
}

.upload-area:hover .upload-icon {
    color: var(--primary-color);
    transform: scale(1.1) rotate(5deg);
}

.upload-btn {
    color: var(--primary-color);
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.requirements {
    font-size: 0.9rem;
    color: var(--subtitle-color);
    margin-top: 10px;
}

.preview-container {
    margin-top: 30px;
    width: 100%;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.result-container {
    margin-top: 30px;
    width: 100%;
}

.image-preview-container {
    max-height: 400px;
    overflow: hidden;
    border-radius: 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #faf0f5;
    cursor: pointer;
    border: 3px solid var(--accent-color);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

#preview-image, #image-preview {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 16px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 40px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 182, 193, 0.2);
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
    position: relative;
}

.spinner::before {
    content: "💖";
    position: absolute;
    font-size: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result {
    text-align: center;
    padding: 30px;
    border-radius: 20px;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid var(--accent-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.verdict-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

#verdict {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#verdict-icon {
    font-size: 3.5rem;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.size-comparison {
    display: flex;
    justify-content: space-around;
    margin: 25px 0;
    flex-wrap: wrap;
}

.size-item {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    flex: 1;
    min-width: 120px;
    margin: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.size-item .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 10px 0;
}

.size-item .label {
    font-size: 1rem;
    color: var(--subtitle-color);
}

.cup-chart {
    width: 100%;
    height: 40px;
    background: #e0e0e0;
    border-radius: 20px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.cup-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9ebb, #ff6b9d);
    border-radius: 20px;
    transition: width 1s ease;
    width: 0;
}

.cup-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--subtitle-color);
    flex-wrap: wrap;
}

.cup-labels span {
    flex: 1;
    min-width: 30px;
    text-align: center;
}

#explanation {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 25px 0;
    color: var(--dark-color);
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    text-align: left;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 15px rgba(255, 107, 157, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(255, 107, 157, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #b8a1ff, #8a7ca8);
}

.hidden {
    display: none;
}

@media (max-width: 600px) {
    .container {
        padding: 20px 15px;
    }
    h1 {
        font-size: 2.2rem;
    }
    h1::after {
        right: -30px;
    }
    .upload-area {
        padding: 30px 15px;
    }
    #verdict {
        font-size: 2rem;
    }
    .btn {
        min-width: 140px;
        padding: 14px 20px;
        font-size: 1rem;
    }
}
