* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #87CEEB;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

.hidden {
    display: none !important;
}

/* 3D游戏容器 */
#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#three-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* 顶部状态栏 */
#status-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 10;
}

.status-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 100px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.status-icon {
    font-size: 16px;
}

.status-bar-bg {
    flex: 1;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.status-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.status-bar-fill.happiness {
    background: linear-gradient(90deg, #ffd93d, #ffeb7b);
}

.status-bar-fill.energy {
    background: linear-gradient(90deg, #6bcb77, #8fe39a);
}

.coin-display {
    background: rgba(255, 215, 0, 0.9);
    border-radius: 20px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: #8b6914;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.coin-icon {
    font-size: 18px;
}

.music-display {
    background: rgba(102, 126, 234, 0.9);
    border-radius: 20px;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 13px;
}

.music-display:active {
    transform: scale(0.95);
}

.music-icon {
    font-size: 16px;
    animation: musicSpin 2s linear infinite;
}

.music-display.muted .music-icon {
    animation: none;
    opacity: 0.5;
}

@keyframes musicSpin {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* 底部操作按钮 */
#action-buttons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

.action-btn {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border: none;
    border-radius: 15px;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    min-width: 70px;
}

.action-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-icon {
    font-size: 28px;
}

.btn-text {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

.phone-btn {
    background: linear-gradient(145deg, #667eea, #5a6fd6);
}

.phone-btn .btn-text {
    color: white;
}

/* 对话气泡 */
#dialog-bubble {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    animation: float 2s ease-in-out infinite;
}

.bubble-content {
    background: white;
    padding: 15px 25px;
    border-radius: 20px;
    font-size: 16px;
    color: #333;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    max-width: 250px;
    text-align: center;
}

.bubble-content::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: white;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* 手机界面 */
#phone-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.phone-frame {
    width: 320px;
    height: 640px;
    background: #1a1a1a;
    border-radius: 40px;
    padding: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: phonePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes phonePop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #1a1a1a;
    border-radius: 0 0 15px 15px;
    z-index: 10;
}

.phone-content {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 30px;
    overflow: hidden;
    position: relative;
}

.phone-status-bar {
    height: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

.phone-status-icons {
    display: flex;
    gap: 5px;
}

/* 手机桌面 */
.phone-home-screen {
    height: calc(100% - 30px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding-top: 10px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.app-icon:active {
    transform: scale(0.9);
}

.app-icon-img {
    width: 55px;
    height: 55px;
    background: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.app-name {
    color: white;
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.app-icon.small .app-icon-img {
    width: 45px;
    height: 45px;
    font-size: 24px;
}

.phone-dock {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 10px;
    display: flex;
    justify-content: space-around;
    backdrop-filter: blur(10px);
}

.phone-home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    cursor: pointer;
}

/* 游戏界面通用 */
.game-screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #87CEEB;
}

.game-screen canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.game-hud {
    position: absolute;
    top: 35px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.game-score, .game-lives, .game-combo {
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 14px;
}

.game-back-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
}

.game-start-overlay, .game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 20;
    color: white;
    text-align: center;
    padding: 20px;
}

.game-start-overlay h2, .game-over-overlay h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.start-btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    transition: transform 0.2s ease;
}

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

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* 跳舞游戏箭头 */
.dance-arrows {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 5;
}

.arrow-zone {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    font-weight: bold;
    transition: all 0.1s ease;
}

.arrow-zone.active {
    background: rgba(255, 255, 255, 0.8);
    color: #ff6b6b;
    transform: scale(1.1);
}

/* 歌曲列表 */
.song-list {
    width: 100%;
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 5px;
}

.song-item {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.song-item:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.25);
}

.song-item.selected {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
}

.song-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.song-info {
    flex: 1;
    text-align: left;
}

.song-name {
    font-size: 15px;
    font-weight: bold;
    color: white;
    margin-bottom: 3px;
}

.song-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.song-difficulty {
    font-size: 14px;
    color: #FFD700;
}

/* 应用界面通用 */
.app-screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
}

.app-header {
    height: 50px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.app-header h3 {
    font-size: 18px;
    color: #333;
}

.app-header .back-btn {
    background: none;
    color: #667eea;
    padding: 5px 10px;
    font-size: 18px;
}

/* 商店 */
.shop-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.shop-item {
    background: white;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.item-icon {
    font-size: 40px;
}

.item-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.item-price {
    font-size: 12px;
    color: #ff9500;
    font-weight: bold;
}

.buy-btn {
    background: linear-gradient(145deg, #ff9500, #ff7b00);
    color: white;
    border: none;
    padding: 6px 20px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
}

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

/* 设置 */
.settings-list {
    flex: 1;
    padding: 15px;
}

.setting-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.setting-item span {
    color: #333;
    font-size: 14px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 45px;
    height: 25px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 25px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 19px;
    width: 19px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.reset-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}

.cheat-item {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
}

.cheat-item > span {
    font-size: 14px;
    color: #333;
}

.cheat-input-wrap {
    display: flex;
    gap: 8px;
    width: 100%;
}

.cheat-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.cheat-input:focus {
    border-color: #667eea;
}

.cheat-btn {
    background: linear-gradient(145deg, #667eea, #5a6fd6);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}

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

/* 设置里的音乐选择器 */
.music-select-item {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
}

.music-select-item > span {
    font-size: 14px;
    color: #333;
}

.music-selector-small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.music-btn-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #667eea;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.music-name-small {
    font-size: 13px;
    font-weight: bold;
    color: #667eea;
    min-width: 70px;
    text-align: center;
}

/* 装扮界面 */
.dressup-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.dressup-preview {
    background: linear-gradient(135deg, #87CEEB, #E0F6FF);
    border-radius: 15px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
}

.dressup-preview::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: #7CFC00;
    border-radius: 0 0 15px 15px;
}

.preview-dragon {
    width: 80px;
    height: 100px;
    position: relative;
    transition: all 0.3s ease;
    z-index: 1;
}

.pd-body {
    position: absolute;
    width: 70px;
    height: 85px;
    background: #FFC72E;
    border-radius: 50% 50% 45% 45%;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    transition: background 0.3s, width 0.3s, height 0.3s;
}

.pd-belly {
    position: absolute;
    width: 45px;
    height: 50px;
    background: #FFF0B8;
    border-radius: 50%;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.pd-eye {
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 20px;
    z-index: 2;
}

.pd-eye::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--eye-color, #3CB371);
    border-radius: 50%;
    top: 3px;
    left: 3px;
}

.pd-eye.left {
    left: 15px;
}

.pd-eye.right {
    right: 15px;
}

.pd-mouth {
    position: absolute;
    width: 20px;
    height: 10px;
    border: 2px solid #8B0000;
    border-top: none;
    border-radius: 0 0 20px 20px;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.dressup-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dressup-section {
    background: white;
    border-radius: 12px;
    padding: 12px;
}

.dressup-section h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
}

.color-picker, .eye-color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option, .eye-color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option.selected, .eye-color-option.selected {
    border-color: #333;
    transform: scale(1.1);
}

.slider-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-item span {
    font-size: 12px;
    color: #666;
    min-width: 50px;
}

.slider-item input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
}

.slider-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.slider-item span:last-child {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: #667eea;
}

.music-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.music-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #667eea;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.music-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    min-width: 80px;
    text-align: center;
}

.apply-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.apply-btn:active {
    transform: scale(0.98);
}

.reset-dressup-btn {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    color: #666;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
}

.reset-dressup-btn:active {
    background: #e0e0e0;
}

/* Toast提示 */
#toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    z-index: 1000;
    font-size: 14px;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .phone-frame {
        width: 100%;
        height: 100%;
        border-radius: 0;
        padding: 0;
    }
    
    .phone-notch {
        display: none;
    }
    
    .phone-content {
        border-radius: 0;
    }
    
    #phone-screen {
        background: #1a1a1a;
    }
    
    .phone-home-indicator {
        bottom: 5px;
    }
    
    .status-item {
        max-width: 80px;
        padding: 4px 8px;
    }
    
    .status-icon {
        font-size: 14px;
    }
    
    .action-btn {
        padding: 10px 15px;
        min-width: 60px;
    }
    
    .btn-icon {
        font-size: 24px;
    }
    
    .app-icon-img {
        width: 65px;
        height: 65px;
        font-size: 36px;
    }
    
    .app-icon {
        gap: 10px;
    }
}

/* 横屏适配 */
@media (max-height: 500px) and (orientation: landscape) {
    #action-buttons {
        bottom: 10px;
        gap: 10px;
    }
    
    .action-btn {
        padding: 8px 12px;
        flex-direction: row;
        min-width: auto;
    }
    
    .btn-text {
        display: none;
    }
}
