* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

/*Debug*/
/* * {
    outline: orange 1px solid;
} */

body {
    /* background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); */
    background-color: hsl(0, 0%, 20%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1000px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#login-page {
    padding: 40px;
}

#game-page {
    display: none;
    padding: 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #ee9208d7;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 1.1em;
}

.login-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #2575fc;
    outline: none;
}

.start-button {
    width: 100%;
    padding: 16px;
    /* background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%); */
    background-color: #156bff;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s;
    margin-top: 20px;
}

.start-button:hover {
    transform: translateY(-2px);
}

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

.player-info h2 {
    color: #333;
    font-size: 1.5em;
}

.incorrect h2 {
    border-radius: 15px;
    border: transparent 1px solid;
    background-color: orange;
}

#review-btn {
    background-color: transparent;
    border: transparent;
    color: #222;
    font-size: 0.9em;
    padding: 10px;
    cursor: pointer;    
}

.score-display {
    text-align: right;
}

.score-display div {
    margin-bottom: 5px;
}

.score-label {
    color: #666;
    margin-right: 10px;
}

.score-value {
    font-weight: bold;
    color: #2575fc;
    font-size: 1.2em;
}

.game-area {
    display: flex;
    gap: 20px;
}

.game-board {
    flex: 2;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.game-info {
    flex: 1;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

#game-canvas {
    background: #fff;
    border: 2px solid #2575fc;
    border-radius: 10px;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.control-button {
    padding: 10px 20px;
    background: #2575fc;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.control-button:hover {
    background: #1a65e0;
}

.control-button.exit {
    background: #ff6b6b;
}

.control-button.exit:hover {
    background: #ff5252;
}

.current-word {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #2575fc;
}

.current-word h3 {
    color: #333;
    margin-bottom: 8px;
}

.pinyin-display {
    font-size: 1.5em;
    font-weight: bold;
    margin: 5px 0;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
}

.hint-text {
    color: #666;
    font-size: 0.9em;
    margin-top: 8px;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 5px;
}

.rules {
    margin-top: 20px;
}

.rules h4 {
    color: #333;
    margin-bottom: 10px;
}

.rules ul {
    list-style: none;
    padding-left: 0;
}

.rules li {
    margin-bottom: 8px;
    color: #666;
    padding-left: 20px;
    position: relative;
}

.rules li:before {
    content: "•";
    color: #2575fc;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.game-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.status-item {
    text-align: center;
    flex: 1;
}

.status-label {
    display: block;
    color: #666;
    font-size: 0.9em;
}

.status-value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #2575fc;
}

.timer {
    color: #ff6b6b;
}

.food-options {
    margin: 15px 0;
}

.food-option {
    margin: 10px 0;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    background: #f5f5f5;
}

.food-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.food-option.selected {
    border-color: #2575fc;
    background: rgba(37, 117, 252, 0.05);
}

@media (max-width: 768px) {
    .game-area {
        flex-direction: column;
    }
    .game-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    .score-display {
        text-align: center;
    }
    #game-canvas {
        width: 100%;
        max-width: 400px;
    }
}

.hearts-display {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    margin: 0 20px;
}

.hearts-display i {
    margin: 0 3px;
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Add to your CSS file */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.popup-container {
  background: white;
  width: 90%;
  max-width: 500px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.popup-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.popup-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: white;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.popup-content {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.wrong-answer-item {
  background: #f9f9f9;
  border-left: 4px solid #ff4757;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  animation: slideInItem 0.3s ease-out;
  animation-fill-mode: both;
}

.wrong-answer-item:nth-child(even) {
  background: #f0f8ff;
}

.correct-answer {
  color: #2ed573;
  font-weight: bold;
}

.wrong-answer {
  color: #ff4757;
  font-weight: bold;
}

.popup-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  text-align: right;
  background: #f8f9fa;
  border-radius: 0 0 12px 12px;
}

#game-page {
  position: relative;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Very high z-index to ensure it's on top */
  animation: fadeIn 0.3s ease-out;
}

/* Ensure other game elements have lower z-index */
.game-header, .game-area, .game-board, .game-info {
  position: relative;
  z-index: 1;
}

#closePopupBtn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

#closePopupBtn:hover {
  background: #5a67d8;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInItem {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Optional: Add delay for each item animation */
.wrong-answer-item {
  animation-delay: calc(var(--item-index) * 0.1s);
}