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

body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'ZCOOL KuaiLe', cursive, sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    overflow: hidden;
}

#cloud-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 65vh; /* 只在天空区域 */
    pointer-events: none;
    z-index: 2; /* 背景图之上，canvas 之下 */
    overflow: hidden;
}

.cloud {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at 35% 35%, rgba(255,255,255,0.95) 0%, rgba(230,242,255,0.80) 50%, rgba(200,225,255,0) 100%);
    /* 每朵云有自己的 animation，在 JS 里通过 style 设置 */
}

@keyframes cloudDrift {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(-100vw - 400px)); }
}

#bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('assets/bg.png');
    background-size: cover;
    background-position: center;
    z-index: 1;
}

#gameCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
}

#chameleon {
    position: absolute;
    bottom: -5vh;
    left: 50%;
    transform: translateX(-50%);
    height: 60vh;
    width: auto;
    max-width: none;
    z-index: 3;
    pointer-events: none;
    mix-blend-mode: multiply; /* 隐容 PNG 白底 */
    filter: contrast(1.15) brightness(1.1) saturate(2);
    transition: filter 0.5s ease;
}

#agi-tattoo {
    position: absolute;
    bottom: 22vh; /* 根据画布高度落在了背脊骨上 */
    left: 48%; /* 根据背部弧度偏移 */
    transform: translateX(-50%) rotate(-8deg); /* 背部倾斜 */
    font-size: 80px;
    font-weight: 900;
    z-index: 6; /* 叠在肚子等UI之前，但在图上方 */
    pointer-events: none;
    letter-spacing: 8px;
    background: linear-gradient(135deg, #00f0ff, #78ffd6, #ff007f);
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent;
    opacity: 0.95;
    filter: drop-shadow(4px 4px 5px rgba(0,0,0,0.9)) drop-shadow(0 0 20px rgba(0,255,255,0.7));
}

/* UI 样式 */
#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#score-board {
    position: absolute;
    top: 30px;
    left: 40px;
    font-size: 40px;
    font-weight: bold;
    z-index: 30; /* 始终浮在弹窗之上 */
    pointer-events: none;
}

#time-board {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 40px;
    font-weight: bold;
    z-index: 30; /* 始终浮在弹窗之上 */
    pointer-events: none;
}

#stomach {
    position: absolute;
    bottom: 30px;
    left: 40px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(5px);
}

#stomach-items {
    display: flex;
    gap: 15px;
    font-size: 40px;
    min-height: 50px;
}

.stomach-item {
    background: rgba(255,255,255,0.2);
    width: 50px; height: 50px;
    display: flex; justify-content: center; align-items: center;
    border-radius: 50%;
    animation: popIn 0.3s ease-out;
    box-shadow: 0 0 10px rgba(255,255,255,0.3);
}

@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

#message-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    transition: opacity 0.5s;
    z-index: 20;
    pointer-events: auto; /* 核心修复：解除从 #ui-layer 继承的点击穿透限制 */
}

#message-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#gemini-message {
    font-size: 40px;
    line-height: 1.5;
    color: #ffd700;
    margin-bottom: 30px;
    max-width: 80%;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#gemini-score {
    font-size: 100px;
    font-family: inherit;
    font-weight: bold;
    color: #ff3366;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); text-shadow: 0 0 20px #ff3366; }
    to { transform: scale(1.1); text-shadow: 0 0 40px #ff3366; }
}

#start-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: auto;
    z-index: 30;
}

#start-screen h1 {
    font-size: 80px;
    color: #a8ff78;
    margin-bottom: 20px;
    text-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

#start-screen p {
    font-size: 28px;
    margin-bottom: 15px;
}

#start-btn {
    margin-top: 50px;
    padding: 20px 60px;
    font-size: 36px;
    font-family: inherit;
    background: linear-gradient(to right, #78ffd6, #a8ff78);
    border: none;
    border-radius: 40px;
    color: #000;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 10px 20px rgba(120, 255, 214, 0.4);
    transition: all 0.2s;
}

#start-btn:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 25px rgba(120, 255, 214, 0.6);
}

#restart-btn {
    margin-top: 40px;
    padding: 15px 50px;
    font-size: 30px;
    font-family: inherit;
    background: linear-gradient(to right, #ff007f, #00f0ff);
    border: none;
    border-radius: 30px;
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(255, 0, 127, 0.4);
    transition: all 0.2s;
    /* 配合 script.js 里的 .hidden 一起工作。若无 inline display block 就自动靠样式消除 */
}

#restart-btn:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 240, 255, 0.6);
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-3px, 3px, 0); }
    20%, 80% { transform: translate3d(6px, -3px, 0); }
    30%, 50%, 70% { transform: translate3d(-12px, 6px, 0); }
    40%, 60% { transform: translate3d(12px, -6px, 0); }
}

/* 三连触发：变色龙爆炸变身 */
#chameleon.combo-burst {
    animation: comboBurst 1.5s ease-out forwards !important;
}

@keyframes comboBurst {
    0%   { transform: translateX(-50%) scale(1);    filter: contrast(1.2) brightness(1.1) hue-rotate(0deg)   saturate(1.4); }
    15%  { transform: translateX(-50%) scale(1.3);  filter: contrast(1.4) brightness(1.4) hue-rotate(120deg) saturate(5); }
    30%  { transform: translateX(-50%) scale(0.92); filter: contrast(1.3) brightness(1.2) hue-rotate(240deg) saturate(4); }
    55%  { transform: translateX(-50%) scale(1.18); filter: contrast(1.4) brightness(1.3) hue-rotate(60deg)  saturate(4.5); }
    80%  { transform: translateX(-50%) scale(1.05); filter: contrast(1.2) brightness(1.1) hue-rotate(180deg) saturate(2.5); }
    100% { transform: translateX(-50%) scale(1);    filter: contrast(1.2) brightness(1.1) hue-rotate(360deg) saturate(1.4); }
}

/* 浮动得分飞字动画 */
@keyframes floatUp {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    20%  { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-130px) scale(0.8); }
}

