:root {
    --bg-color: #F5F3ED;
    --bg-light: #FAF9F6;
    --shadow-light: #ffffff;
    --shadow-dark: #d1cfc8;
    --arrow-color: #6B6B6B;
    --accent-brown: #C8956C;
    --accent-gold: #D4A574;
    --text-dark: #4A4A4A;
    --text-light: #8A8A8A;
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bg-cream {
    background-color: var(--bg-color);
}

/* 新拟态核心样式：凸起效果 */
.neumorphic-panel {
    background: var(--bg-light);
    box-shadow:
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    border: 1px solid rgba(255,255,255,0.5);
    transition: all 0.2s ease;
}

.neumorphic-btn {
    background: var(--bg-light);
    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    border: 1px solid rgba(255,255,255,0.5);
    transition: all 0.2s ease;
}

/* 按钮点击：凹陷效果 */
.neumorphic-btn:active {
    box-shadow:
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
    transform: scale(0.95);
}

/* 凹槽样式（用于网格背景） */
.neumorphic-inset {
    background: var(--bg-color);
    box-shadow:
        inset 6px 6px 12px var(--shadow-dark),
        inset -6px -6px 12px var(--shadow-light);
    border-radius: 16px;
}

/* HUD 顶部卡片样式 */
.hud-card {
    background: var(--bg-light);
    box-shadow:
        4px 4px 10px var(--shadow-dark),
        -2px -2px 6px var(--shadow-light);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.6);
}

/* 棕色渐变按钮 */
.btn-brown {
    background: linear-gradient(180deg, var(--accent-gold) 0%, var(--accent-brown) 100%);
    color: white;
    box-shadow:
        0 4px 8px rgba(200, 149, 108, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: none;
    font-weight: 600;
}

.btn-brown:active {
    transform: scale(0.95);
    box-shadow:
        0 2px 4px rgba(200, 149, 108, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 绿色按钮 */
.btn-green {
    background: linear-gradient(180deg, #7DC67D 0%, #5CB85C 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(92, 184, 92, 0.3);
    border: none;
}

/* 黄色按钮 */
.btn-yellow {
    background: linear-gradient(180deg, #F5D76E 0%, #E8C547 100%);
    color: #6B5B3E;
    box-shadow: 0 4px 8px rgba(232, 197, 71, 0.3);
    border: none;
}

/* 丝带标题栏 */
.ribbon-title {
    background: linear-gradient(180deg, var(--accent-gold) 0%, var(--accent-brown) 100%);
    color: white;
    padding: 12px 32px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 8px rgba(200, 149, 108, 0.4);
    position: relative;
}

/* 星星样式 */
.star {
    color: #D4A574;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.star-empty {
    color: #D1CFC8;
}

/* 滑块样式 */
.slider {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-color);
    box-shadow:
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--accent-gold) 0%, var(--accent-brown) 100%);
    box-shadow: 0 2px 6px rgba(200, 149, 108, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:active {
    transform: scale(0.9);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--accent-gold) 0%, var(--accent-brown) 100%);
    box-shadow: 0 2px 6px rgba(200, 149, 108, 0.5);
    cursor: pointer;
    border: none;
}

/* 开关按钮基础样式 */
.toggle-btn,
.toggle-off {
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 开关按钮 ON 状态 */
.toggle-btn {
    background: linear-gradient(180deg, #D4A574 0%, #C8956C 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(200, 149, 108, 0.4);
}

/* 开关按钮 OFF 状态 */
.toggle-off {
    background: var(--bg-color);
    color: var(--text-light);
    box-shadow: inset 2px 2px 4px var(--shadow-dark),
                inset -2px -2px 4px var(--shadow-light);
}

/* 底部圆形按钮 */
.circle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-light);
    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    border: 1px solid rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.circle-btn:active {
    box-shadow:
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    transform: scale(0.95);
}

/* 金币显示 */
.coin-display {
    background: var(--bg-light);
    border-radius: 20px;
    padding: 4px 12px;
    box-shadow: 2px 2px 4px var(--shadow-dark);
}

/* 关卡开始提示横幅 */
.level-banner-content {
    background: linear-gradient(180deg, #E85D5D 0%, #C94444 100%);
    padding: 16px 60px;
    border-radius: 12px;
    box-shadow:
        0 6px 20px rgba(200, 68, 68, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    transform: scale(0);
    animation: banner-show 0.4s ease-out forwards;
}

.level-banner-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#banner-level {
    color: white;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#banner-moves {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

@keyframes banner-show {
    0% {
        transform: scale(0) rotate(-5deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes banner-hide {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

.level-banner-content.hiding {
    animation: banner-hide 0.3s ease-in forwards;
}

/* 首页样式 */
#home-screen {
    background: var(--bg-color);
}

.home-logo h1 {
    text-shadow:
        3px 3px 6px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
    animation: logo-float 3s ease-in-out infinite;
}

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

/* z-index for home screen */
.z-60 {
    z-index: 60;
}

/* 首页按钮 hover 效果 */
#home-screen .neumorphic-btn:hover {
    box-shadow:
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
}

#home-screen .btn-brown:hover {
    filter: brightness(1.05);
}

/* 首页背景漂浮箭头 */
.home-bg-arrows {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-arrow {
    position: absolute;
    left: var(--x);
    top: var(--y);
    font-size: 3rem;
    color: var(--shadow-dark);
    opacity: 0.15;
    animation: arrow-float 6s ease-in-out infinite;
    animation-delay: var(--delay);
}

.bg-arrow:nth-child(odd) {
    animation-name: arrow-float-alt;
}

@keyframes arrow-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.15;
    }
    25% {
        opacity: 0.25;
    }
    50% {
        transform: translateY(-20px) rotate(10deg);
        opacity: 0.2;
    }
    75% {
        opacity: 0.25;
    }
}

@keyframes arrow-float-alt {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.15;
    }
    25% {
        opacity: 0.2;
    }
    50% {
        transform: translateY(15px) rotate(-8deg);
        opacity: 0.25;
    }
    75% {
        opacity: 0.2;
    }
}

/* 首页进入/退出过渡动画 */
#home-screen {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#home-screen.hidden {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

#home-screen.entering {
    animation: home-enter 0.6s ease-out forwards;
}

#home-screen.exiting {
    animation: home-exit 0.4s ease-in forwards;
}

@keyframes home-enter {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes home-exit {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* Logo 进入动画 */
#home-screen.entering .home-logo {
    animation: logo-enter 0.7s ease-out 0.1s both;
}

@keyframes logo-enter {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 按钮进入动画 */
#home-screen.entering #btn-continue-game {
    animation: btn-enter 0.5s ease-out 0.3s both;
}

#home-screen.entering #btn-start-game {
    animation: btn-enter 0.5s ease-out 0.4s both;
}

@keyframes btn-enter {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 背景箭头进入动画 */
#home-screen.entering .home-bg-arrows {
    animation: bg-arrows-enter 0.8s ease-out 0.2s both;
}

@keyframes bg-arrows-enter {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* 抖动动画（金币不足提示） */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* 撒花容器 */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

/* 单个彩纸片 */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confetti-fall linear forwards;
}

.confetti::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--confetti-color, #D4A574);
    border-radius: 2px;
    animation: confetti-spin linear infinite;
    animation-duration: var(--spin-duration, 1s);
}

/* 彩纸下落动画 */
@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* 彩纸旋转动画 */
@keyframes confetti-spin {
    0% { transform: rotateX(0) rotateY(0); }
    25% { transform: rotateX(180deg) rotateY(0); }
    50% { transform: rotateX(180deg) rotateY(180deg); }
    75% { transform: rotateX(0) rotateY(180deg); }
    100% { transform: rotateX(0) rotateY(0); }
}

/* ========== 关卡选择界面 ========== */

/* z-index for level select screen */
.z-55 {
    z-index: 55;
}

/* 关卡选择界面过渡动画 */
#level-select-screen {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#level-select-screen.hidden {
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
}

#level-select-screen.entering {
    animation: slide-in-right 0.3s ease-out forwards;
}

#level-select-screen.exiting {
    animation: slide-out-right 0.3s ease-in forwards;
}

@keyframes slide-in-right {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-out-right {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* 关卡网格容器 */
.level-grid-container {
    height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 关卡网格 */
.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

/* 关卡按钮 */
.level-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

/* 已解锁关卡 */
.level-btn.unlocked {
    background: var(--bg-light);
    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    border: 1px solid rgba(255,255,255,0.5);
}

.level-btn.unlocked:active {
    box-shadow:
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    transform: scale(0.95);
}

/* 已通关关卡 */
.level-btn.completed {
    background: linear-gradient(180deg, var(--bg-light) 0%, #f0ede5 100%);
}

/* 锁定关卡 */
.level-btn.locked {
    background: var(--bg-color);
    box-shadow:
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 关卡编号 */
.level-btn .level-num {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.level-btn.locked .level-num {
    color: var(--text-light);
}

/* 锁图标 */
.level-btn .lock-icon {
    font-size: 1rem;
    color: var(--text-light);
}

/* 星星容器 */
.level-btn .level-stars {
    display: flex;
    gap: 2px;
    font-size: 0.65rem;
}

.level-btn .level-stars .star-filled {
    color: var(--accent-gold);
}

.level-btn .level-stars .star-empty {
    color: var(--shadow-dark);
}

/* 当前关卡高亮 */
.level-btn.current {
    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light),
        0 0 0 3px var(--accent-gold);
}

/* 超难关标记 */
.level-btn .hard-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: linear-gradient(180deg, #E85D5D 0%, #C94444 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: white;
    box-shadow: 0 2px 4px rgba(200, 68, 68, 0.4);
}

/* ========== 新手教程 ========== */

/* z-index for tutorial overlay */
.z-100 {
    z-index: 100;
}

/* 教程半透明背景 */
.tutorial-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

/* 教程内容容器 */
.tutorial-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 120px;
    pointer-events: none;
}

/* 教程对话框 */
.tutorial-dialog {
    background: var(--bg-light);
    border-radius: 20px;
    padding: 20px 24px;
    max-width: 320px;
    width: calc(100% - 40px);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.5);
    pointer-events: auto;
    animation: dialog-appear 0.3s ease-out;
}

@keyframes dialog-appear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 教程文本 */
.tutorial-text {
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 16px;
}

/* 教程导航按钮区域 */
.tutorial-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* 跳过按钮 */
.tutorial-skip {
    flex: 1;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--bg-color);
    color: var(--text-light);
    border: none;
    cursor: pointer;
    box-shadow:
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
    transition: all 0.2s ease;
}

.tutorial-skip:active {
    transform: scale(0.95);
}

/* 下一步按钮 */
.tutorial-next {
    flex: 2;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    background: linear-gradient(180deg, var(--accent-gold) 0%, var(--accent-brown) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(200, 149, 108, 0.4);
    transition: all 0.2s ease;
}

.tutorial-next:active {
    transform: scale(0.95);
}

/* 手指指示动画 */
.tutorial-hand {
    position: absolute;
    font-size: 2.5rem;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: hand-tap 1s ease-in-out infinite;
}

@keyframes hand-tap {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(0.9);
    }
}

/* 高亮区域（用于聚焦特定元素） */
.tutorial-highlight {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: all 0.3s ease;
}

/* 教程步骤指示器 */
.tutorial-steps {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.tutorial-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--shadow-dark);
    transition: all 0.3s ease;
}

.tutorial-step-dot.active {
    background: var(--accent-gold);
    transform: scale(1.2);
}

.tutorial-step-dot.completed {
    background: var(--accent-brown);
}

/* 教程箭头样式提示 */
.tutorial-arrow-demo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 12px;
    box-shadow:
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.tutorial-arrow-demo .arrow-icon {
    font-size: 2rem;
    color: var(--arrow-color);
}

.tutorial-arrow-demo .arrow-label {
    font-size: 0.85rem;
    color: var(--text-light);
}
