/* 🌟 全局样式 */
body {
  font-family: 'Microsoft YaHei', sans-serif;
  background-color: #fff8f0;
  margin: 0;
  padding: 0;
  text-align: center;
  color: #333;
}

/* 🌀 页面加载遮罩 */
#loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #fff8f0;
  z-index: 9999;
}

/* 🎬 打字机区域 */
.intro {
  margin-top: 20px;
  font-size: 1.2rem;
  color: #555;
  height: 60px;
  line-height: 1.6;
}

/* 📢 主标题 */
h1 {
  margin: 20px 0;
  font-size: 2rem;
  color: #d2691e;
}

/* 🏠 九宫格布局 */
.canteen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

/* 🍱 食堂格子样式 */
.canteen-box {
  padding: 20px;
  background-color: #ffe5b4;
  border-radius: 10px;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.3s;
}

.canteen-box:hover {
  transform: scale(1.05);
  background-color: #ffd399;
}

/* 🎲 摇骰子区域 */
.dice-area {
  margin: 40px 0;
}

#dice {
  width: 80px;
  transition: transform 0.5s;
  cursor: pointer;
}

/* 🎲 摇骰子动画 */
.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0% { transform: rotate(0); }
  25% { transform: rotate(30deg); }
  50% { transform: rotate(-30deg); }
  75% { transform: rotate(15deg); }
  100% { transform: rotate(0); }
}

/* 📦 通用隐藏类 */
.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* 加上这个，确保初始时隐藏 */
.modal.hidden {
  display: none;
}

/* 弹窗弹出时才显示为 flex */
.modal:not(.hidden) {
  display: flex;
}


/* 💬 弹窗内容 */
.modal-content {
  background-color: #fffdf5;
  padding: 30px;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
  position: relative;
}

/* ❌ 弹窗关闭按钮 */
.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 20px;
  cursor: pointer;
  color: #999;
}

/* 🍽️ 弹窗按钮 */
.modal-buttons button {
  margin: 10px;
  padding: 10px 15px;
  border: none;
  background-color: #f4a460;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.95rem;
}

.modal-buttons button:hover {
  background-color: #e38b3c;
}

/* 🧾 食堂信息弹窗 */
.info-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff5e6;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  z-index: 1001;
  max-width: 300px;
  width: 90%;
  text-align: left;
}

.info-popup h3 {
  margin-top: 0;
  color: #d2691e;
}

.info-popup ul {
  padding-left: 20px;
  margin: 0;
}

.info-popup button {
  margin-top: 15px;
  background-color: #ff9800;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
}

.info-popup button:hover {
  background-color: #e08900;
}

/* 📱 响应式优化 */
@media (max-width: 500px) {
  .canteen-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .canteen-box {
    padding: 16px;
    font-size: 0.95rem;
  }

  #dice {
    width: 60px;
  }
}
