:root {
    --sour: #DCE35B;
    --sour-dark: #45B649;
    --sweet: #FF6B8A;
    --sweet-dark: #FF8E53;
    --bg: #FFF8F0;
    --card: #FFFFFF;
    --text: #4A3F35;
    --text-light: #8C7B6B;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 背景气泡 ===== */
.bubbles-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.25;
    animation: rise 15s infinite linear;
}

@keyframes rise {
    0% { transform: translateY(100vh) scale(0.5); opacity: 0; }
    10% { opacity: 0.25; }
    90% { opacity: 0.25; }
    100% { transform: translateY(-100px) scale(1.2); opacity: 0; }
}

/* ===== 头部 ===== */
header {
    text-align: center;
    padding: 70px 20px 30px;
    position: relative;
    z-index: 1;
}

.logo {
    font-size: clamp(2.8rem, 7vw, 4.5rem);
    font-weight: 900;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.sway {
    display: inline-block;
    animation: sway 3s infinite ease-in-out;
    background: linear-gradient(135deg, var(--sour-dark), var(--sweet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sway:nth-child(1) { animation-delay: 0s; }
.sway:nth-child(2) { animation-delay: 0.2s; }
.sway:nth-child(3) { animation-delay: 0.4s; }
.sway:nth-child(4) { animation-delay: 0.6s; }

@keyframes sway {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50% { transform: rotate(3deg) translateY(-8px); }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-top: 8px;
}

/* ===== 主内容 ===== */
main {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 心情切换 ===== */
.mood-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 30px;
}

.toggle-track {
    width: 100px;
    height: 48px;
    background: linear-gradient(90deg, var(--sour), var(--sweet));
    border-radius: 24px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.4s;
}

.toggle-thumb {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.sweet-mode .toggle-thumb {
    left: 56px;
}

.mood-label {
    margin-top: 12px;
    color: var(--text-light);
    font-size: 1rem;
    transition: color 0.3s;
}

body.sweet-mode .mood-label {
    color: var(--sweet);
}

/* ===== Hero / 水果舞台 ===== */
.hero {
    text-align: center;
    padding: 20px 0 40px;
}

.fruit-stage {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.fruit-main {
    width: 160px;
    height: 160px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.fruit-main:hover {
    transform: scale(1.08);
}

.fruit-main:active {
    transform: scale(0.95);
}

/* 柠檬 */
.fruit-main.lemon .fruit-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F0E68C, var(--sour));
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 10px 30px rgba(220, 227, 91, 0.4);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-10deg);
}

.fruit-main.lemon .segments {
    position: absolute;
    inset: 15%;
    opacity: 0.15;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
}

.fruit-main.lemon .seg {
    background: #fff;
    border-radius: 50%;
}

.fruit-main.lemon .leaf {
    position: absolute;
    top: -15px;
    right: 20px;
    width: 40px;
    height: 30px;
    background: var(--sour-dark);
    border-radius: 0 80% 0 80%;
    transform: rotate(20deg);
}

/* 草莓 */
.fruit-main.strawberry .fruit-body {
    width: 100%;
    height: 110%;
    background: linear-gradient(180deg, #FF6B8A, #EE5A5A);
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
    box-shadow: 0 10px 30px rgba(255, 107, 138, 0.4);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fruit-main.strawberry .fruit-body::before {
    content: "";
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid #4CAF50;
}

.fruit-main.strawberry .fruit-body::after {
    content: "";
    position: absolute;
    inset: 10%;
    background-image: radial-gradient(circle, rgba(255,255,255,0.25) 1px, transparent 1px);
    background-size: 12px 12px;
    border-radius: inherit;
}

/* 表情 */
.face {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eyes {
    display: flex;
    gap: 14px;
    margin-bottom: 10px;
}

.eye {
    width: 14px;
    height: 16px;
    background: var(--text);
    border-radius: 50%;
    position: relative;
}

.pupil {
    width: 5px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 5px;
}

.mouth {
    width: 22px;
    height: 10px;
    border: 3px solid var(--text);
    border-top: none;
    border-radius: 0 0 20px 20px;
    transition: all 0.3s;
}

.mouth.sour {
    border-radius: 20px 20px 0 0;
    border-top: 3px solid var(--text);
    border-bottom: none;
    width: 16px;
}

.mouth.sweet {
    border-radius: 0 0 20px 20px;
    width: 28px;
    height: 14px;
    background: var(--text);
}

/* 水果切换动画 */
.fruit-main {
    animation: floatFruit 4s infinite ease-in-out;
}

@keyframes floatFruit {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.fruit-main.squash {
    animation: squash 0.5s ease-out;
}

@keyframes squash {
    0% { transform: scale(1, 1); }
    30% { transform: scale(1.15, 0.8); }
    60% { transform: scale(0.9, 1.1); }
    100% { transform: scale(1, 1); }
}

.hint {
    color: var(--text-light);
    margin-top: 16px;
    font-size: 0.95rem;
}

/* ===== 味觉仪表盘 ===== */
.taste-dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 30px 0;
}

.gauge-card {
    background: var(--card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
    text-align: center;
}

.gauge-card h3 {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.gauge {
    height: 16px;
    background: #F0ECE6;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    width: var(--fill);
    background: linear-gradient(90deg, var(--sour-dark), var(--sour));
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.5s;
}

.gauge-fill.sweet {
    background: linear-gradient(90deg, var(--sweet), var(--sweet-dark));
}

.gauge-value {
    display: block;
    margin-top: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    transition: color 0.3s;
}

/* ===== 水果家族 ===== */
.fruit-family {
    padding: 40px 0;
}

.fruit-family h2 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 24px;
}

.fruit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
}

.fruit-item {
    background: var(--card);
    border-radius: 18px;
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.fruit-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.fruit-item:active {
    transform: scale(0.96);
}

.fruit-icon {
    font-size: 2.8rem;
    margin-bottom: 8px;
    display: block;
    transition: transform 0.3s;
}

.fruit-item:hover .fruit-icon {
    transform: scale(1.2) rotate(10deg);
}

.fruit-name {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.taste-bar {
    height: 5px;
    background: #F0ECE6;
    border-radius: 3px;
    overflow: hidden;
}

.taste-bar div {
    height: 100%;
    background: linear-gradient(90deg, var(--sour-dark), var(--sweet));
    border-radius: 3px;
    transition: width 0.6s;
}

/* 选中态 */
.fruit-item.selected {
    box-shadow: 0 0 0 3px var(--sweet), 0 8px 25px rgba(255, 107, 138, 0.2);
}

body.sweet-mode .fruit-item.selected {
    box-shadow: 0 0 0 3px var(--sweet), 0 8px 25px rgba(255, 107, 138, 0.2);
}

body:not(.sweet-mode) .fruit-item.selected {
    box-shadow: 0 0 0 3px var(--sour-dark), 0 8px 25px rgba(69, 182, 73, 0.2);
}

/* ===== 糖果雨 ===== */
.candy-zone {
    padding: 40px 0 70px;
    text-align: center;
}

.candy-zone h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
}

.candy-sky {
    height: 200px;
    background: linear-gradient(180deg, #FFF0F5 0%, #FFF8F0 100%);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px dashed #FFD1DC;
}

.candy {
    position: absolute;
    font-size: 1.6rem;
    animation: candyFall linear forwards;
    pointer-events: none;
}

@keyframes candyFall {
    0% { transform: translateY(-40px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(220px) rotate(360deg); opacity: 0.3; }
}

.btn-rain {
    padding: 14px 36px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, var(--sweet), var(--sweet-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 107, 138, 0.4);
    transition: all 0.3s;
    font-family: inherit;
}

.btn-rain:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

.btn-rain:active {
    transform: scale(0.97);
}

/* ===== 果汁飞溅粒子 ===== */
.splash {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: splashOut 0.6s ease-out forwards;
}

@keyframes splashOut {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ===== 页脚 ===== */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .taste-dashboard {
        grid-template-columns: 1fr;
    }
    .fruit-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .fruit-main {
        width: 130px;
        height: 130px;
    }
}
