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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    background: #f0f4f8;
    overflow: hidden;
}

/* 加载屏幕 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    color: white;
    font-size: 18px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 游戏容器 */
.game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #87ceeb 0%, #e0f6ff 100%);
}

/* 背景 */
.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
    z-index: 0;
}

/* 开始屏幕 */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.start-content {
    text-align: center;
    color: white;
}

.start-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.start-content p {
    font-size: 20px;
    margin-bottom: 30px;
}

.start-btn {
    padding: 15px 40px;
    font-size: 20px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.start-btn:hover,
.start-btn:active {
    background: #ff5252;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* 游戏屏幕 */
.game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* 顶部UI */
.top-ui {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
}

.mute-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mute-btn:active {
    transform: scale(0.95);
}

.mute-btn.muted {
    background: rgba(255, 107, 107, 0.8);
}

/* 状态文字 */
.status-text {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #333;
    text-align: center;
    z-index: 20;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
}

/* 麦克风容器 */
.microphone-container {
    position: absolute;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 25;
}

/* 麦克风按钮 */
.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #667eea;
    background: rgba(102, 126, 234, 0.1);
    font-size: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.mic-btn:active {
    transform: scale(0.95);
}

.mic-btn.recording {
    background: #ff6b6b;
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 音频可视化 */
.audio-visualizer {
    display: none;
    gap: 4px;
}

.audio-visualizer.active {
    display: flex;
}

.vis-bar {
    width: 4px;
    height: 30px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    animation: visualize 0.5s ease-in-out infinite;
}

@keyframes visualize {
    0%, 100% { height: 10px; }
    50% { height: 30px; }
}

/* 猫 */
.cat {
    position: absolute;
    left: 50%;
    top: 35%;
    transform: translateX(-50%);
    width: 180px;
    height: 180px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 猫咪图片 */
.cat-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: all 0.3s ease;
}

.cat-image.hold {
    /* 听声音状态 */
}

.cat-image.pointing-left {
    /* 指向纸巾 - 显示 l.png */
    animation: pointingLeftAnim 2.5s ease-in-out forwards;
}

.cat-image.pointing-right {
    /* 指向萝卜 - 显示 r.png */
    animation: pointingRightAnim 2.5s ease-in-out forwards;
}

.cat-image.eating {
    /* 吃东西状态 */
    animation: catEatingPNG 0.6s ease-in-out;
}

.cat-image.happy {
    /* 开心状态（可选） */
}

/* 指向左动画 */
@keyframes pointingLeftAnim {
    0% { 
        transform: rotateZ(0deg);
    }
    100% { 
        transform: rotateZ(0deg);
    }
}

/* 指向右动画 */
@keyframes pointingRightAnim {
    0% { 
        transform: rotateZ(0deg);
    }
    100% { 
        transform: rotateZ(0deg);
    }
}

@keyframes catEatingPNG {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 猫的确认动画 */
.cat.confirming .cat-image {
    animation: catConfirm 0.6s ease-in-out;
}

@keyframes catConfirm {
    0% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0); }
}

/* 物品容器 */
.items-container {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 350px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 15;
    gap: 40px;
}

/* 物品样式 */
.item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex: 1;
    opacity: 0.6;
}

.item.highlighted {
    opacity: 1;
    animation: highlight 0.5s ease-in-out;
}

@keyframes highlight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.item-sprite {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.item:hover .item-sprite {
    transform: scale(1.1);
}

/* 物品标签 */
.item-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

/* 投喂冻干按钮 */
.treat-button-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

.treat-btn {
    padding: 15px 30px;
    font-size: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.treat-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.treat-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.treat-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.treat-emoji {
    font-size: 24px;
}

.treat-label {
    display: inline-block;
}

/* 反馈容器 */
.feedback-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* 飘浮文字效果 */
.floating-text {
    position: absolute;
    font-size: 32px;
    font-weight: bold;
    pointer-events: none;
}

.floating-text.hearts {
    color: #ff6b6b;
}

.floating-text.stars {
    color: #ffd93d;
}

@keyframes float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.8);
    }
}

.floating-text {
    animation: float 1.5s ease-out forwards;
}

/* 粒子效果 */
.particle {
    position: absolute;
    pointer-events: none;
}

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

.particle {
    animation: particleFloat 1.2s ease-out forwards;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .start-content h1 {
        font-size: 32px;
    }

    .start-content p {
        font-size: 16px;
    }

    .items-container {
        bottom: 50px;
        gap: 10px;
    }

    .item-sprite {
        width: 70px;
        height: 70px;
        font-size: 50px;
    }

    .item-label {
        font-size: 12px;
    }

    .cat {
        width: 120px;
        height: 120px;
    }

    .cat::before {
        font-size: 120px;
        line-height: 120px;
    }
}

/* 触摸优化 */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* 禁用长按菜单 */
html {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 禁用橡皮筋效果（iOS） */
body {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 响应式 - 小屏幕调整 */
@media (max-width: 480px) {
    .status-text {
        font-size: 16px;
        padding: 8px 15px;
    }

    .microphone-container {
        top: 140px;
    }

    .mic-btn {
        width: 70px;
        height: 70px;
        font-size: 35px;
    }

    .cat {
        width: 140px;
        height: 140px;
        top: 30%;
    }

    .cat::before {
        font-size: 140px;
        line-height: 140px;
    }

    .items-container {
        bottom: 140px;
        gap: 30px;
    }

    .item-sprite {
        width: 70px;
        height: 70px;
        font-size: 50px;
    }

    .treat-btn {
        padding: 12px 25px;
        font-size: 16px;
    }

    .treat-emoji {
        font-size: 20px;
    }
}
