body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    flex-direction: column;
    overflow: hidden;
}
/* 首页卡通蛇样式 */
.snake-icon {
    position: absolute;
    top: 30px; /* 调整到合适的位置 */
    left: 50%;
    transform: translateX(-50%);
    width: 120px; /* 调整尺寸 */
    height: 100px;
    /* 全新设计的Q萌静态蛇，嘴里叼着单词 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'%3E%3Cdefs%3E%3Cfilter id='shadow' x='-10%25' y='-10%25' width='120%25' height='120%25'%3E%3CfeDropShadow dx='2' dy='2' stdDeviation='1.5' flood-color='%23000' flood-opacity='0.3'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23shadow)'%3E%3C!-- Head --%3E%3Cpath d='M60,20 C40,20 20,40 20,60 S40,80 60,80 C80,80 100,60 100,40 80,20 60,20 Z' fill='%23AED581'/%3E%3Cpath d='M62,22 C42,22 22,42 22,62 S42,82 62,82 C82,82 102,62 102,42 82,22 62,22 Z' fill='%238BC34A'/%3E%3C!-- Tail --%3E%3Cpath d='M20,60 Q5,70 20,80' stroke='%238BC34A' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3C!-- Eyes --%3E%3Ccircle cx='45' cy='45' r='5' fill='white'/%3E%3Ccircle cx='75' cy='45' r='5' fill='white'/%3E%3Ccircle cx='46' cy='46' r='2' fill='black'/%3E%3Ccircle cx='76' cy='46' r='2' fill='black'/%3E%3C!-- Word Block --%3E%3Crect x='70' y='10' width='30' height='15' fill='%23FFC107' rx='3'/%3E%3Ctext x='75' y='22' font-size='10' fill='black'%3Eword%3C/text%3E%3C/g%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* 移除动画 */
}
/* 移除爬行动画 */
.snake-icon path:last-child {
    stroke-width: 8; /* 加粗尾巴 */
    stroke-linecap: round; /* 让尾巴更圆润 */
    d: path('M20,60 Q5,70 20,85'); /* 调整尾巴的形状 */
}

.phone-container {
    width: 390px;
    height: 844px;
    max-width: 100vw;
    max-height: 100vh;
    background-color: #8BC34A; /* A more game-like background */
    border: 8px solid #333;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.screen {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15px;
    padding-top: -5px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #a8e063 0%, #56ab2f 100%);
    transform: translateY(-30px);
}
#game-screen {
     background: #e8f5e9;
}
.screen.active {
    display: flex;
}
h1 {
    font-size: 2.8em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}
p {
    color: #fff;
    font-size: 1.2em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
.button {
    background-color: #4CAF50;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.5em;
    cursor: pointer;
    text-decoration: none;
    margin-top: 30px;
    transition: background-color 0.3s;
}
.button:hover {
    background-color: #45a049;
}

/* Game Screen Specific Styles */
#game-screen {
    justify-content: flex-start;
}
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
}
.score, .target-word {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.temp-button {
    font-size: 0.8em;
    padding: 5px 10px;
    background-color: #f44336;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}
.game-canvas {
    width: 100%;
    flex-grow: 1;
    background-color: #e8f5e9;
    position: relative; /* Needed for positioning game elements */
    overflow: hidden;
}
.snake-segment {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #4CAF50;
    border-radius: 5px;
    border: 1px solid #388E3C;
}
.snake-head {
    background-color: #388E3C; /* Darker head */
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; /* Egg shape */
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 5; /* Make sure head is on top */
}
.eye {
    width: 4px;
    height: 4px;
    background-color: white;
    border-radius: 50%;
}
.food-item {
    position: absolute;
    padding: 6px 10px;
    background-color: #FFC107;
    border-radius: 10px;
    font-weight: bold;
    color: #333;
    border: 3px solid #FFA000;
    box-shadow: 0 2px 8px rgba(255, 160, 0, 0.4);
    transform: translate(-50%, -50%);
    min-width: 70px;
    text-align: center;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.word-english {
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.word-chinese {
    font-size: 0.75em;
    font-weight: normal;
    color: #555;
    opacity: 0.9;
}

.food-item.target-food {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    border-color: #FF5252;
    animation: targetFoodPulse 1.5s ease-in-out infinite;
}

@keyframes targetFoodPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.6);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 6px 20px rgba(255, 107, 107, 0.8);
    }
}

/* Game Over Screen Specific Styles */
#game-over-screen h2 {
    font-size: 2.5em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}
#final-score {
    font-size: 4em;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.description {
    margin-top: 20px;
    font-size: 0.9em;
    color: #777;
}

/* Controls Styles */
.controls {
    position: absolute;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-areas:
        ". up ."
        "left pause right"
        ". down .";
    gap: 12px;
    opacity: 0.7;
    z-index: 100;
    pointer-events: auto;
}
.control-btn {
    width: 55px;
    height: 55px;
    background-color: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 1.8em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    -webkit-user-select: none; /* For Safari */
    user-select: none;
}
.control-btn:active {
    background-color: rgba(0, 0, 0, 0.6);
}
#btn-up { grid-area: up; }
#btn-left { grid-area: left; }
#btn-pause { grid-area: pause; font-size: 1.5em; }
#btn-right { grid-area: right; }
#btn-down { grid-area: down; }

/* Word Card Modal Styles */
.word-card-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
}
.word-card-modal.active {
    display: flex;
}
.word-card {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    width: 50%;
    max-width: 140px;
    text-align: left;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}
.word-card h3 {
    font-size: 1.2em;
    margin: 0 0 6px;
    color: #333;
    display: flex;
    align-items: center;
}
.pronunciation {
    font-size: 1.2em;
    margin-left: 10px;
    cursor: pointer;
    color: #888;
}
.word-card .definition {
    font-size: 0.8em;
    color: #555;
    margin-bottom: 10px;
}
.word-card .example {
    font-size: 0.7em;
    color: #777;
    border-left: 3px solid #4CAF50;
    padding-left: 10px;
    font-style: italic;
    line-height: 1.4;
}
.card-button {
    display: block;
    width: 100%;
    margin-top: 20px;
    text-align: center;
}
.game-over-icon {
    font-size: 5em;
    margin-bottom: 15px;
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}
.encouragement {
    margin-top: 20px;
    font-size: 1.1em;
    color: #f0f0f0;
}
@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}