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

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    display: block;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ui-layer * {
    pointer-events: auto;
}

#player-stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    min-width: 110px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.stat-item .label {
    color: #666;
    font-size: 10px;
    font-weight: 500;
}

.stat-item .value {
    color: #2d8b2d;
    font-size: 14px;
    font-weight: bold;
}

.stat-bar-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-bar-container .label {
    color: #666;
    font-size: 9px;
    width: 25px;
}

.stat-bar {
    flex: 1;
    height: 7px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.stat-bar .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.3s ease;
}

.small-value {
    color: #888;
    font-size: 11px;
}

#inventory-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 12px;
}

.inv-item {
    background: linear-gradient(145deg, #d4a574, #c19a6b);
    padding: 10px 18px;
    border-radius: 12px;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.25),
        inset 0 2px 3px rgba(255, 255, 255, 0.3),
        inset 0 -2px 3px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    border: 2px solid #8b6914;
    position: relative;
    overflow: hidden;
}

#rename-btn {
    background: linear-gradient(145deg, #a78bfa, #8b5cf6);
}
#rename-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(167, 139, 250, 0.4);
}

.inv-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}

.inv-item .icon {
    font-size: 26px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
    animation: iconFloat 2s ease-in-out infinite;
}

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

.inv-item span:last-child {
    color: #fef3c7;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    font-family: 'Segoe UI', sans-serif;
}

#full-inventory {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, #2d3748, #1a202c);
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    pointer-events: auto;
    border: 1px solid #4a5568;
}

.inventory-header {
    display: none;
}

.inventory-grid {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inventory-slot {
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid #1a202c;
    box-shadow: 
        inset 0 1px 2px rgba(0,0,0,0.3),
        inset 0 -1px 1px rgba(255,255,255,0.05);
    transition: all 0.2s ease;
}

.inventory-slot:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 2px 8px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(0,0,0,0.3),
        inset 0 -1px 1px rgba(255,255,255,0.05);
    border-color: #f6ad55;
}

.inventory-slot::before {
    display: none;
}

.slot-icon {
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.eat-btn {
    font-size: 8px;
    padding: 2px 4px;
    border: none;
    border-radius: 4px;
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: #fff;
    cursor: pointer;
    margin-left: auto;
    font-weight: bold;
    opacity: 0.8;
}

.eat-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.slot-count {
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.4);
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}

.slot-name {
    color: #a0aec0;
    font-size: 8px;
    font-weight: 500;
}

#pet-adoption {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    min-width: 90px;
}

#pet-adoption h3 {
    color: #ff6b9d;
    font-size: 12px;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 600;
}

.adoption-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.adoption-buttons button {
    font-size: 10px;
    padding: 6px 8px;
    background: linear-gradient(145deg, #ff99cc, #ff6699);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.adoption-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 107, 157, 0.3);
}

.buy-all-btn {
    display: block;
    width: 100%;
    margin: 6px 0 8px 0;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #f59e0b, #d97706);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.buy-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.4);
}

#pet-panel {
    position: absolute;
    top: 125px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    min-width: 110px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    display: none;
}

#pet-panel h3 {
    color: #ff6b9d;
    font-size: 12px;
    margin-bottom: 6px;
    text-align: center;
    font-weight: 600;
}

.pet-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    justify-content: center;
}

.pet-selector button {
    font-size: 10px;
    padding: 2px 6px;
    border: none;
    border-radius: 4px;
    background: linear-gradient(145deg, #fbbf24, #f59e0b);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pet-selector button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.4);
}

.pet-selector span {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

#pet-mode-btn {
    font-size: 9px;
    padding: 2px 6px;
    background: linear-gradient(145deg, #60a5fa, #3b82f6);
}

.pet-info {
    margin-bottom: 8px;
}

.pet-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.pet-detail .label {
    color: #666;
    font-size: 10px;
}

.pet-detail span:last-child {
    color: #333;
    font-size: 10px;
    font-weight: 500;
}

.pet-bar-item {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
}

.pet-bar-item .label {
    color: #666;
    font-size: 9px;
    width: 25px;
}

.pet-bar-bg {
    flex: 1;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.pet-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.pet-bar-fill.hunger {
    background: linear-gradient(90deg, #4ade80, #22c55e);
}

.pet-bar-fill.happiness {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.pet-bar-fill.cleanliness {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.pet-bar-fill.fatness {
    background: linear-gradient(90deg, #f97316, #ef4444);
}

.pet-bar-fill.fullness {
    background: linear-gradient(90deg, #a855f7, #7c3aed);
}

.pet-bar-item span:last-child {
    color: #333;
    font-size: 9px;
    font-weight: 500;
    width: 20px;
    text-align: right;
}

.pet-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.pet-actions button {
    font-size: 9px;
    padding: 4px 6px;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

#feed-pet {
    background: linear-gradient(145deg, #f97316, #ea580c);
}

#feed-pet:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
}

#pet-pet {
    background: linear-gradient(145deg, #ec4899, #db2777);
}

#pet-pet:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(236, 72, 153, 0.4);
}

#play-pet {
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
}

#play-pet:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
}

#train-pet {
    background: linear-gradient(145deg, #f43f5e, #e11d48);
}

#train-pet:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
}

#heal-pet {
    background: linear-gradient(145deg, #22c55e, #16a34a);
}

#heal-pet:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
}

#sleep-pet {
    background: linear-gradient(145deg, #64748b, #475569);
}

#sleep-pet:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(100, 116, 139, 0.4);
}

.release-btn {
    background: linear-gradient(145deg, #ef4444, #dc2626) !important;
    color: #fff;
    grid-column: span 2;
    font-size: 9px;
    padding: 4px 6px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.release-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

.revive-btn {
    background: linear-gradient(145deg, #f59e0b, #d97706) !important;
    color: #fff;
    grid-column: span 2;
    font-size: 9px;
    padding: 4px 6px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    animation: revive-pulse 1.5s ease-in-out infinite;
}

.revive-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.5);
}

@keyframes revive-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#garden-panel {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    min-width: 100px;
}

#garden-panel h3 {
    color: #2d8b2d;
    font-size: 12px;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 600;
}

.garden-seeds, .garden-harvests {
    display: flex;
    justify-content: space-around;
    margin-bottom: 6px;
}

.seed-item, .harvest-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.seed-item span:first-child, .harvest-item span:first-child {
    font-size: 14px;
}

.seed-item span:last-child, .harvest-item span:last-child {
    font-size: 9px;
    color: #666;
    font-weight: 500;
}

.garden-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.garden-buttons button {
    font-size: 9px;
    padding: 4px 8px;
    background: linear-gradient(145deg, #4ade80, #22c55e);
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.garden-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(74, 222, 128, 0.3);
}

#start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 45px 65px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    animation: fadeIn 0.5s ease;
}

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

#start-screen h1 {
    color: #2d8b2d;
    font-size: 38px;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(45, 139, 45, 0.3);
}

#start-screen p {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

.controls-info {
    display: flex;
    gap: 25px;
    justify-content: center;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.key {
    display: inline-block;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 10px 15px;
    border-radius: 10px;
    color: #2d8b2d;
    font-weight: bold;
    font-size: 13px;
    border: 2px solid #2d8b2d;
    box-shadow: 0 4px 10px rgba(45, 139, 45, 0.2);
    min-width: 55px;
    text-align: center;
}

.control-item span:last-child {
    color: #888;
    font-size: 12px;
}

#start-btn {
    background: linear-gradient(145deg, #4ade80, #22c55e);
    border: none;
    padding: 14px 45px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

#start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 222, 128, 0.5);
}

/* ========== 初始界面游戏指南 ========== */
.guide-section {
    margin-top: 20px;
    text-align: left;
}
#guide-toggle {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: bold;
    background: linear-gradient(145deg, #f0fdf4, #dcfce7);
    border: 2px solid #4ade80;
    border-radius: 10px;
    cursor: pointer;
    color: #166534;
    transition: all 0.2s ease;
    text-align: center;
}
#guide-toggle:hover {
    background: linear-gradient(145deg, #dcfce7, #bbf7d0);
}
#guide-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0 0 10px 10px;
    border: 2px solid transparent;
    padding: 0 12px;
}
#guide-content.open {
    max-height: 520px;
    overflow-y: auto;
    padding: 12px;
    border-color: #bbf7d0;
    margin-top: -2px;
}
.guide-block {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}
.guide-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.guide-block h4 {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #374151;
}
.guide-block p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #6b7280;
}
.guide-block .hl {
    color: #f59e0b;
    font-weight: bold;
}

/* 手机端适配 */
@media (max-width: 480px) {
    #start-screen {
        padding: 24px 20px;
        width: 88vw;
        max-height: 90vh;
        overflow-y: auto;
    }
    #start-screen h1 {
        font-size: 26px;
    }
    .controls-info {
        gap: 12px;
    }
    #guide-content.open {
        max-height: 400px;
    }
}

.reset-btn {
    position: absolute;
    top: 65px;
    right: 15px;
    padding: 6px 14px;
    font-size: 11px;
    background: linear-gradient(145deg, #f59e0b, #d97706);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    pointer-events: auto;
    font-weight: 500;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4);
}

.bot-btn {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    font-size: 11px;
    background: linear-gradient(145deg, #6366f1, #4f46e5);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    pointer-events: auto;
    font-weight: 500;
    z-index: 100;
    opacity: 0.7;
}

.bot-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
    opacity: 1;
}

.bot-btn.active {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    opacity: 1;
}

.bot-btn.active:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.6);
}

/* 家具编辑模式按钮 */
#furniture-edit-buttons {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    gap: 20px;
    z-index: 100;
    pointer-events: none;
}
#furniture-edit-buttons .edit-btn {
    pointer-events: auto;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.6);
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
#furniture-edit-buttons .confirm-btn {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: #fff;
}
#furniture-edit-buttons .confirm-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}
#furniture-edit-buttons .cancel-btn {
    background: linear-gradient(145deg, #ef4444, #dc2626);
    color: #fff;
}
#furniture-edit-buttons .cancel-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.hidden {
    display: none;
}

.music-btn {
    position: absolute;
    bottom: 50px;
    right: 15px;
    padding: 8px 16px;
    font-size: 12px;
    background: linear-gradient(145deg, #fbbf24, #f59e0b);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
    pointer-events: auto;
    font-weight: 600;
}

.music-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

.music-btn.playing {
    background: linear-gradient(145deg, #4ade80, #22c55e);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
}

.music-btn.playing:hover {
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.5);
}

.shop-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 8px 18px;
    font-size: 12px;
    background: linear-gradient(145deg, #60a5fa, #3b82f6);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    pointer-events: auto;
    font-weight: 600;
}

.shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.settings-btn {
    position: absolute;
    bottom: 15px;
    left: 15px;
    padding: 8px 16px;
    font-size: 12px;
    background: linear-gradient(145deg, #a78bfa, #8b5cf6);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    pointer-events: auto;
    font-weight: 600;
    z-index: 110;
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

#settings-panel {
    position: fixed;
    bottom: 55px;
    left: 15px;
    background: rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

#settings-panel.hidden {
    display: none;
}

.settings-content {
    background: #fff;
    border-radius: 16px;
    width: 280px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid #f0f0f0;
}

.settings-header h2 {
    font-size: 18px;
    color: #333;
}

.settings-header button {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.settings-header button:hover {
    color: #333;
}

.settings-body {
    padding: 20px;
}

.settings-section h3 {
    font-size: 14px;
    color: #555;
    margin-bottom: 12px;
}

.redeem-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

#redeem-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    letter-spacing: 2px;
}

#redeem-input:focus {
    border-color: #8b5cf6;
}

#redeem-btn {
    padding: 10px 20px;
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#redeem-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.redeem-msg {
    font-size: 13px;
    min-height: 20px;
    padding: 4px 0;
}

.redeem-msg.success {
    color: #22c55e;
}

.redeem-msg.error {
    color: #ef4444;
}

.save-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}
.save-row input {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.save-row input:focus {
    border-color: #8b5cf6;
}
.save-row button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
#save-game-btn {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: #fff;
}
#save-game-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}
#load-game-btn {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: #fff;
}
#load-game-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.save-msg {
    font-size: 12px;
    min-height: 18px;
    padding: 4px 0;
}
.save-msg.success {
    color: #22c55e;
}
.save-msg.error {
    color: #ef4444;
}
.save-info p {
    font-size: 12px;
    color: #666;
    margin: 8px 0 0 0;
}
#current-user {
    font-weight: 600;
    color: #8b5cf6;
}

#shop-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeInOverlay 0.3s ease;
}

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

#shop-panel.hidden {
    display: none;
}

.shop-content {
    background: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUpShop 0.3s ease;
}

@keyframes slideUpShop {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.shop-header h2 {
    color: #3b82f6;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

#close-shop {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}

#close-shop:hover {
    background: #e2e8f0;
    color: #333;
    transform: rotate(90deg);
}

.shop-coins {
    background: linear-gradient(145deg, #fffbeb, #fef3c7);
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 16px;
    font-weight: 700;
    color: #d97706;
    text-align: center;
    border: 1px solid #fde68a;
}

.shop-section {
    margin-bottom: 16px;
}

.shop-section:last-child {
    margin-bottom: 0;
}

.shop-section h3 {
    color: #444;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    padding-left: 6px;
    border-left: 3px solid #3b82f6;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.shop-item:hover {
    background: #f1f5f9;
    transform: translateX(2px);
}

.shop-item span:first-child {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.shop-item span:nth-child(2) {
    font-size: 13px;
    color: #d97706;
    font-weight: 700;
}

.shop-item button {
    font-size: 12px;
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.shop-item button:hover {
    transform: translateY(-1px);
}

.shop-items:nth-child(2) .shop-item button {
    background: linear-gradient(145deg, #4ade80, #22c55e);
    color: #fff;
}

.shop-items:nth-child(2) .shop-item button:hover {
    box-shadow: 0 3px 10px rgba(74, 222, 128, 0.4);
}

.shop-items:nth-child(3) .shop-item button {
    background: linear-gradient(145deg, #f59e0b, #d97706);
    color: #fff;
}

.shop-items:nth-child(3) .shop-item button:hover {
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.4);
}

.shop-item .count {
    font-size: 13px;
    color: #999;
    margin-left: 6px;
}

.furniture-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.furniture-tab {
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8fafc;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.furniture-tab:hover {
    background: #e2e8f0;
    border-color: #3b82f6;
}

.furniture-tab.active {
    background: linear-gradient(145deg, #60a5fa, #3b82f6);
    color: #fff;
    border-color: #3b82f6;
}

#fridge-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fridge-panel.hidden {
    display: none;
}

.fridge-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 340px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.fridge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(145deg, #e0f2fe, #bae6fd);
}

.fridge-header h2 {
    font-size: 18px;
    color: #0369a1;
    margin: 0;
}

.fridge-header button {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.fridge-header button:hover {
    color: #333;
}

.fridge-body {
    padding: 16px 20px;
}

.fridge-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fridge-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.fridge-item span {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}

.fridge-item button {
    padding: 6px 18px;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.fridge-item button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.furniture-category {
    display: none;
}

.furniture-category.active {
    display: block;
}

#dialog-panel {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    min-width: 300px;
    max-width: 500px;
    animation: fadeIn 0.3s ease;
}

#dialog-panel .dialog-name {
    font-size: 16px;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 10px;
    text-align: center;
}

#dialog-panel .dialog-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 15px;
    text-align: center;
}

#dialog-panel button {
    display: block;
    margin: 0 auto;
    padding: 8px 25px;
    font-size: 13px;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

#dialog-panel button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ========== PC / 手机版切换 ========== */
.mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}
.mode-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}
.mode-option input[type="radio"] {
    display: none;
}
.mode-option:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}
.mode-option:hover {
    border-color: #93c5fd;
}

/* ========== 手机版浮动互动按钮 ========== */
#mobile-action-btns {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
    overflow: hidden;
}
#mobile-action-btns .action-btn {
    position: absolute;
    pointer-events: auto;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: bold;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 20px;
    cursor: pointer;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.1s ease, opacity 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
#mobile-action-btns .action-btn:active {
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0,0,0,0.85);
}

/* ========== 手机版虚拟摇杆 ========== */
#joystick-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: 3px solid rgba(255,255,255,0.5);
    z-index: 999;
    display: none;
    touch-action: none;
}
#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    border: 2px solid rgba(255,255,255,0.9);
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: none;
}

/* ========== 手机版控件自动隐藏 ========== */
#joystick-container.mobile-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.4s ease;
}
#joystick-container {
    transition: opacity 0.4s ease;
}

/* ========== 改名弹窗 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
.modal-overlay:not(.hidden) {
    display: flex;
}
.rename-modal-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px;
    padding: 24px;
    width: 340px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    color: #fff;
}
.rename-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.rename-modal-header h2 {
    margin: 0;
    font-size: 20px;
}
.rename-close-btn {
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
}
.rename-close-btn:hover {
    opacity: 1;
}
.rename-modal-body p {
    margin: 8px 0;
    font-size: 14px;
    opacity: 0.9;
}
.rename-modal-body #rename-input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    margin: 12px 0;
    box-sizing: border-box;
    outline: none;
}
.rename-modal-body #rename-input:focus {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5);
}
.rename-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}
.rename-modal-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s;
}
.rename-modal-actions button:active {
    transform: scale(0.97);
}
.rename-modal-actions .btn-secondary {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.login-msg.error {
    color: #ff6b6b;
    font-weight: 500;
}
.login-msg.success {
    color: #51cf66;
    font-weight: 500;
}
.rename-modal-actions .btn-primary {
    background: #fff;
    color: #667eea;
}
@media (max-width: 768px) {
    .rename-modal-content {
        width: 85vw;
        padding: 20px;
    }
    .rename-modal-header h2 {
        font-size: 18px;
    }
    .rename-modal-body #rename-input {
        font-size: 14px;
    }
}

/* ========== 登录弹窗 ========== */
.login-modal-content {
    background: linear-gradient(135deg, #1e3a5f, #2d5a87);
    border-radius: 20px;
    padding: 30px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    color: #fff;
}
.login-modal-header {
    text-align: center;
    margin-bottom: 20px;
}
.login-modal-header h2 {
    margin: 0;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.login-modal-body p {
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 14px;
    opacity: 0.8;
}
.login-modal-body input {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    margin: 8px 0;
    box-sizing: border-box;
    outline: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.login-modal-body input::placeholder {
    color: rgba(255,255,255,0.6);
}
.login-modal-body input:focus {
    box-shadow: 0 0 0 3px rgba(100,200,255,0.5);
    background: rgba(255,255,255,0.2);
}
.login-msg {
    height: 20px;
    text-align: center;
    font-size: 13px;
    margin: 10px 0;
    min-height: 20px;
}
.login-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}
.login-modal-actions button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.1s;
}
.login-modal-actions button:active {
    transform: scale(0.98);
}
.login-modal-actions .btn-primary {
    background: linear-gradient(145deg, #4facfe, #00f2fe);
    color: #fff;
    box-shadow: 0 4px 15px rgba(79,172,254,0.4);
}
.login-modal-actions .btn-secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}
.login-modal-actions .btn-secondary:hover {
    background: rgba(255,255,255,0.25);
}

/* ========== 横屏提示 ========== */
#landscape-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #1a1a2e;
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
}
#landscape-overlay .rotate-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: rotateDevice 2s ease-in-out infinite;
}
#landscape-overlay p {
    font-size: 18px;
    text-align: center;
    max-width: 300px;
}
@keyframes rotateDevice {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* ========== 双人版 ========== */
.multiplayer-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.multiplayer-row input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    letter-spacing: 4px;
    font-weight: 600;
    outline: none;
}
.multiplayer-row input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.multiplayer-row button {
    font-size: 11px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: #fff;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.multiplayer-row button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59,130,246,0.4);
}
#room-status {
    font-size: 11px;
    color: #666;
}

/* ========== 对方玩家标签 ========== */
.other-player-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.8);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}

/* ========== 宠物面板折叠 ========== */
.pet-toggle {
    display: block;
    padding: 6px 10px;
    background: linear-gradient(145deg, #a855f7, #7c3aed);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    user-select: none;
    margin-bottom: 8px;
}
.pet-toggle:active {
    transform: scale(0.96);
}
#pet-panel-body.collapsed {
    display: none !important;
}

/* ========== 手机版使用说明 ========== */
#mobile-help {
    position: fixed;
    bottom: 120px;
    right: 15px;
    z-index: 998;
}
#mobile-help.hidden .help-content {
    display: none;
}
#help-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.8);
    border: 2px solid rgba(255,255,255,0.5);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(59,130,246,0.3);
    transition: all 0.2s ease;
}
#help-btn:active {
    transform: scale(0.9);
}
#mobile-help .help-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}
.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}
.help-header h3 {
    font-size: 14px;
    color: #333;
    margin: 0;
}
.help-header button {
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}
.help-body {
    padding: 12px 16px;
}
.help-body p {
    font-size: 12px;
    color: #555;
    margin: 4px 0;
    line-height: 1.6;
}
.help-body hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 8px 0;
}
.help-body strong {
    color: #333;
}