:root {
    --mario-red: #ff3224;
    --mario-yellow: #FBD000;
    --sky-blue: #6b8cff;
    --brick-face: #cd683d;
    --brick-border: #000;
}

body {
    font-family: 'Press Start 2P', cursive, sans-serif;
    background-color: var(--sky-blue);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    overflow-x: hidden;
}

/* --- 标题与状态栏 --- */
.header {
    margin-top: 15px;
    text-align: center;
    color: white;
    text-shadow: 4px 4px 0 #000;
    z-index: 10;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    width: 95%;
    max-width: 900px;
    background: #000;
    padding: 10px 15px;
    border: 4px solid white;
    color: white;
    margin-bottom: 15px;
    box-sizing: border-box;
    font-size: 0.8em;
    z-index: 10;
}

/* --- 游戏区域 --- */
.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 900px;
    width: 95%;
    z-index: 10;
    padding-bottom: 80px;
}

/* --- 砖块卡片 --- */
.card {
    height: 80px;
    background: var(--brick-face);
    border: 4px solid var(--brick-border);
    box-shadow: inset -4px -4px 0 #8b4513, inset 4px 4px 0 #e6a782;
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    text-align: center; position: relative; transition: transform 0.1s;
    color: white; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    font-size: 0.8em; padding: 5px; line-height: 1.2; word-break: break-word;
}
.card::before { content: ''; position: absolute; top: 4px; left: 4px; width: 4px; height: 4px; background: rgba(0,0,0,0.3); box-shadow: 0 64px 0 rgba(0,0,0,0.3); }
.card::after { content: ''; position: absolute; top: 4px; right: 4px; width: 4px; height: 4px; background: rgba(0,0,0,0.3); box-shadow: 0 64px 0 rgba(0,0,0,0.3); }
.card:active { transform: translateY(4px); }

.card.selected {
    background: var(--mario-yellow); color: #000; text-shadow: none; box-shadow: 4px 4px 0 #000;
    transform: translateY(-4px); border-color: #000;
}

.card.matched {
    background: #333; box-shadow: none; border-color: #555; color: transparent; text-shadow: none;
    pointer-events: none; animation: bump 0.3s;
}
.card.matched::before, .card.matched::after { display: none; }
@keyframes bump { 0%{transform:translateY(0)} 50%{transform:translateY(-10px)} 100%{transform:translateY(0)} }

.card.wrong { background: var(--mario-red); animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* 金币 */
.coin-float {
    position: absolute; color: var(--mario-yellow); font-weight: bold; font-size: 20px;
    text-shadow: 2px 2px 0 #000; animation: coinUp 0.6s ease-out forwards; pointer-events: none; z-index: 20;
}
@keyframes coinUp { 0%{opacity:1;transform:translateY(-20px)} 100%{opacity:0;transform:translateY(-80px)} }

/* --- 装饰 --- */
.scenery {
    position: fixed; bottom: 0; width: 100%; height: 50px;
    background: repeating-linear-gradient(90deg, #78431f 0, #78431f 40px, #000 41px, #000 44px), linear-gradient(#d2691e, #8b4513);
    border-top: 4px solid #000; z-index: 1;
}
.bush {
    position: fixed; bottom: 54px; left: 10%; width: 120px; height: 30px;
    background: #00a800; border-radius: 20px 20px 0 0; border: 4px solid #000; z-index: 1;
}

/* --- 胜利界面 --- */
.victory-scene {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--sky-blue); z-index: 100; flex-direction: column; justify-content: center; align-items: center;
}
.flag-pole { position: absolute; bottom: 54px; left: 30%; width: 8px; height: 260px; background: #28a011; border: 2px solid #000; }
.flag-top { width: 20px; height: 20px; background: #28a011; position: absolute; top: -20px; left: -8px; border: 2px solid #000; border-radius: 50%; }
.flag {
    position: absolute; left: 10px; bottom: 20px; width: 0; height: 0;
    border-top: 20px solid transparent; border-bottom: 20px solid transparent; border-right: 60px solid var(--mario-red);
    transition: bottom 2s ease-in-out;
}
.castle { position: absolute; bottom: 54px; right: 10%; width: 150px; height: 150px; }
.c-body { width:100%; height:80px; background:#fff; position:absolute; bottom:0; border:4px solid #000; background-image: linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000), linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000); background-size: 20px 20px; background-position: 0 0, 10px 10px; opacity: 0.8; }
.c-door { width:40px; height:50px; background:#000; position:absolute; bottom:0; left:55px; border-radius:20px 20px 0 0; }
.c-tower { width:60px; height:50px; background:#fff; position:absolute; bottom:80px; left:45px; border:4px solid #000; border-bottom:none; }

.victory-ui { z-index: 101; text-align: center; color: white; text-shadow: 3px 3px 0 #000; }
.next-btn {
    margin-top: 20px; padding: 15px 30px; background: var(--mario-yellow); border: 4px solid #000;
    font-family: inherit; cursor: pointer; box-shadow: 6px 6px 0 #000; font-size: 1.2em;
}
.next-btn:hover { transform: scale(1.1); }

/* --- 启动遮罩 --- */
#start-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.9); display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 999; color: white; cursor: pointer;
}
.blink { animation: blink 0.8s infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --- 🆕 设置面板样式 --- */
.config-btn {
    position: fixed; top: 20px; right: 20px; z-index: 1000;
    background: #333; color: white; border: 2px solid white; padding: 10px; cursor: pointer;
    font-family: "Microsoft YaHei", sans-serif; font-size: 14px;
}
.config-panel {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 2000; flex-direction: column; align-items: center; justify-content: center;
}
.config-box {
    background: #222; border: 4px solid var(--mario-yellow); padding: 20px; width: 80%; max-width: 600px;
    display: flex; flex-direction: column; gap: 10px;
}
.config-textarea {
    width: 100%; height: 300px; background: #000; color: #0f0; border: 1px solid #555;
    font-family: monospace; font-size: 16px; padding: 10px; box-sizing: border-box;
}
.config-actions { display: flex; gap: 10px; justify-content: flex-end; }
.config-save-btn {
    background: var(--mario-yellow); color: black; border: none; padding: 10px 20px;
    font-weight: bold; cursor: pointer; font-family: inherit;
}
.config-close-btn {
    background: #555; color: white; border: none; padding: 10px 20px; cursor: pointer; font-family: inherit;
}