/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.game-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    text-align: center;
    color: white;
}

/* 游戏标题 */
.game-title h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-title p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* 游戏区域 */
.game-area {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 洋葱角色 */
.onion-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.onion {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.onion-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #d4a574, #c49660);
    border-radius: 50%;
    position: relative;
    box-shadow: 
        inset -10px -10px 20px rgba(0,0,0,0.2),
        inset 10px 10px 20px rgba(255,255,255,0.1),
        0 10px 30px rgba(0,0,0,0.3);
    border: 3px solid #b8864a;
}

/* 洋葱纹理 */
.onion-body::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 80%;
    background: linear-gradient(to bottom, transparent, #a67c52, transparent);
    border-radius: 1px;
}

.onion-body::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%) rotate(15deg);
    width: 2px;
    height: 80%;
    background: linear-gradient(to bottom, transparent, #a67c52, transparent);
    border-radius: 1px;
}

/* 洋葱眼睛 */
.onion-eyes {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 30px;
}

.eye {
    position: absolute;
    width: 25px;
    height: 25px;
    background: white;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.eye::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
}

.left-eye {
    left: 5px;
}

.right-eye {
    right: 5px;
}

/* 洋葱鼻子 */
.onion-nose {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
}

/* 洋葱嘴巴 */
.onion-mouth {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #333;
    border-radius: 2px;
}

/* 洋葱胡须 */
.onion-whiskers {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 80px;
}

.whisker {
    position: absolute;
    width: 40px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.whisker-1 {
    left: 5px;
    transform: translateY(-50%) rotate(-25deg);
    transform-origin: right center;
}

.whisker-2 {
    left: 25px;
    transform: translateY(-50%) rotate(-10deg);
    transform-origin: right center;
}

.whisker-3 {
    right: 25px;
    transform: translateY(-50%) rotate(10deg);
    transform-origin: left center;
}

.whisker-4 {
    right: 5px;
    transform: translateY(-50%) rotate(25deg);
    transform-origin: left center;
}

/* 胡须编号 */
.whisker-number {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 5;
}

/* 胡须状态样式 */
.whisker.removed {
    opacity: 0;
    transform: translateY(-50%) scale(0);
}

.whisker-1.removed {
    transform: translateY(-50%) rotate(-25deg) scale(0);
}

.whisker-2.removed {
    transform: translateY(-50%) rotate(-10deg) scale(0);
}

.whisker-3.removed {
    transform: translateY(-50%) rotate(10deg) scale(0);
}

.whisker-4.removed {
    transform: translateY(-50%) rotate(25deg) scale(0);
}

/* Bad判定时胡须闪烁红色 */
.whisker.bad {
    background: #f44336 !important;
    animation: whiskerBad 0.8s ease-in-out;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

@keyframes whiskerBad {
    0%, 100% { 
        background: #f44336; 
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
    }
    25% { 
        background: #ff6b6b; 
        transform: translateY(-50%) scale(1.2);
        box-shadow: 0 0 15px rgba(255, 107, 107, 0.8);
    }
    50% { 
        background: #f44336; 
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
    }
    75% { 
        background: #ff6b6b; 
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 0 12px rgba(255, 107, 107, 0.6);
    }
}

/* 拔胡须按钮 */
.whisker-button-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.whisker-button {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
}

.whisker-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.whisker-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.whisker-button:disabled {
    background: linear-gradient(45deg, #9E9E9E, #BDBDBD);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 10px rgba(158, 158, 158, 0.3);
    animation: none !important;
}

.whisker-button:disabled.active {
    background: linear-gradient(45deg, #FF6B6B, #FF8E8E) !important;
    cursor: pointer !important;
    animation: none !important; /* 移除动画避免冲突 */
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6) !important;
    border: 2px solid #fff !important;
}

.button-text {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.button-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: normal;
}

/* 按钮激活状态 */
.whisker-button.active {
    background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
    animation: buttonPulse 1.5s infinite;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
    border: 2px solid #fff;
    pointer-events: auto !important;
    cursor: pointer !important;
}

@keyframes buttonPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(255, 107, 107, 0.8);
    }
}

/* 洋葱根部 */
.onion-roots {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 30px;
}

.onion-roots::before,
.onion-roots::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 3px;
    height: 20px;
    background: #daa520;
    border-radius: 2px;
}

.onion-roots::before {
    left: 20px;
    transform: rotate(-15deg);
}

.onion-roots::after {
    right: 20px;
    transform: rotate(15deg);
}

/* 镊子工具 */
.tweezers {
    position: absolute;
    top: 20px;
    right: -30px;
    width: 40px;
    height: 80px;
    transform-origin: bottom center;
    transition: transform 0.1s ease;
}

.tweezers-handle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 60px;
    background: linear-gradient(to bottom, #c0c0c0, #808080);
    border-radius: 3px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tweezers-tip {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 镊子动作动画 */
.tweezers.action {
    animation: tweezersAction 0.2s ease;
}

@keyframes tweezersAction {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-15deg) scale(1.1); }
    100% { transform: rotate(0deg); }
}

/* 节拍指示器 */
.beat-indicator {
    margin: 20px 0;
}

.beat-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.beat-progress {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 4px;
}

.beat-dots {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.beat-dot {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.beat-dot.active {
    background: #4CAF50;
    transform: scale(1.3);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
    animation: beatDotPulse 0.5s ease-in-out;
}

@keyframes beatDotPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1.3); }
}

/* 反馈显示 */
.feedback-display {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
    max-width: 90%;
    text-align: center;
}

.feedback-text {
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    opacity: 0;
    transition: all 0.3s ease;
    line-height: 1.3;
    word-wrap: break-word;
}

.feedback-text.show {
    opacity: 1;
    transform: scale(1.2);
}

.feedback-text.good {
    color: #4CAF50;
}

.feedback-text.bad {
    color: #f44336;
}

/* 游戏状态 */
.game-status {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    font-size: 1.2rem;
    font-weight: bold;
}

.score, .combo {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

/* 控制按钮 */
.controls {
    margin: 20px 0;
}

.control-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 0 10px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 游戏说明 */
.instructions {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: left;
    backdrop-filter: blur(5px);
    margin-top: 20px;
}

.instructions h3 {
    margin-bottom: 15px;
    color: #ffd700;
}

.instructions p {
    margin: 8px 0;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 15px;
    }
    
    .game-title h1 {
        font-size: 2rem;
    }
    
    .onion {
        width: 150px;
        height: 150px;
    }
    
    .tweezers {
        width: 30px;
        height: 60px;
        right: -20px;
    }
    
    .feedback-text {
        font-size: 2.5rem;
    }
    
    .control-btn {
        padding: 12px 25px;
        font-size: 1rem;
        margin: 5px;
    }
    
    .game-status {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .onion {
        width: 120px;
        height: 120px;
    }
    
    .tweezers {
        width: 25px;
        height: 50px;
        right: -15px;
    }
    
    .feedback-text {
        font-size: 2rem;
    }
    
    .beat-dot {
        width: 15px;
        height: 15px;
    }
}

/* 游戏区域点击效果 */
.game-area.clickable {
    cursor: pointer;
    transition: transform 0.1s ease;
}

.game-area.clickable:active {
    transform: scale(0.98);
}

/* 加载动画 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.onion.loading {
    animation: pulse 1s infinite;
}

/* 结算弹窗 */
.settlement-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.settlement-popup.show {
    display: flex;
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.settlement-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.settlement-header h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.settlement-body {
    margin-bottom: 30px;
}

.score-display {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.final-score, .combo-display {
    text-align: center;
}

.score-label, .combo-label {
    display: block;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 5px;
    opacity: 0.8;
}

.score-value, .combo-value {
    display: block;
    color: #ffd700;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.performance-message {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.settlement-footer {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.settlement-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.settlement-btn.primary {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.settlement-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.settlement-btn.secondary {
    background: linear-gradient(45deg, #9E9E9E, #BDBDBD);
    color: white;
    box-shadow: 0 4px 15px rgba(158, 158, 158, 0.3);
}

.settlement-btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(158, 158, 158, 0.4);
}
