body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 800px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    font-size: 1.2em;
}

.info-item {
    background: #f0f0f0;
    padding: 10px 20px;
    border-radius: 10px;
    min-width: 120px;
}

/* 重要：讓遊戲區對手機更友善（不會超出畫面） */
.game-area {
    position: relative;
    width: min(600px, 90vw);
    /* <-- 改動：寬度在桌面為600px，但手機用90vw */
    height: min(400px, 60vh);
    /* <-- 改動：高度改成 min(400px, 60vh) */
    margin: 30px auto;
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px solid #dee2e6;
    overflow: hidden;
    /* 確保按鈕不會露出 */
}

.number-btn {
  position: absolute;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);

  /* ✅ 只給「桌機 hover / active」用的轉場（滑順放大縮回）
     手機 hover 我們用 animation，不靠 transition
  */
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

/* 用圖片顯示數字的樣式 */
.number-btn.image-mode {
    background-size: 140% 140% !important;
    /* 放大 */
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    color: #000000;
    text-shadow: 
    0 1px 1px rgba(0,0,0,0.6),  /* 黑色陰影: x偏移0, y偏移1px, 模糊半徑1px, 透明度0.6 → 主要陰影，讓文字浮起來 */
    0 2px 0 rgba(255,255,255,0.1); /* 白色陰影: x偏移0, y偏移2px, 模糊0px, 透明度0.1 → 微光感，增加立體感 */
    -webkit-text-stroke: 1px rgba(0, 0, 0, .2);
}

/* ✅ 桌機（有滑鼠 hover）：
   hover 會一直維持，直到滑鼠離開才結束
*/
@media (hover: hover) and (pointer: fine) {
  .number-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
  }
}

/* ✅ 手機/觸控（沒有真正 hover）：
   若瀏覽器「模擬 hover」而黏住，也只播放一次 0.1 秒動畫，不會一直放大
*/
@media (hover: none) and (pointer: coarse) {
  .number-btn:hover {
    animation: hoverPulse 0.1s ease;
  }
}

/* hoverPulse：放大一下再回來（一次性） */
@keyframes hoverPulse {
  0%   { transform: scale(1);    box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
  50%  { transform: scale(1.08); box-shadow: 0 6px 12px rgba(0,0,0,0.3); }
  100% { transform: scale(1);    box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
}

/* ✅ 按下回饋（手機/桌機都會有） */
.number-btn:active {
  transform: scale(0.95);
}

/* ✅ 避免點完保留 focus 造成「看起來卡住」 */
.number-btn:focus {
  outline: none;
}

.control-buttons {
    margin: 20px 0;
}

.btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    margin: 0 10px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.leaderboard {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
}

.leaderboard h3 {
    color: #333;
    margin-bottom: 15px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rank {
    font-weight: bold;
    color: #007bff;
}

.game-status {
    font-size: 1.5em;
    margin: 20px 0;
    font-weight: bold;
}

.ready {
    color: #28a745;
}

.playing {
    color: #007bff;
}

.finished {
    color: #dc3545;
}

/* =============================== */
/* 🎉 結果視窗（覆蓋式） */
/* =============================== */
.result-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.88);
    padding: 22px 16px;
    border-radius: 18px;
    width: 80%;
    max-width: 360px;
    display: none;
    z-index: 10;  /* 只蓋遊戲區，不蓋按鈕 */
    color: #fff;            /* 🔥 文字變白 */
    text-align: center;     /* 🔥 置中 */
}

/* --- 讓結果視窗文字排版跟 Popcat 一樣 --- */
.result-overlay p {
    display: block;
    width: 100%;
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.1rem;
    line-height: 1.45;
    color: #fff; 
    text-align: center;
}


/* 金色商品按鈕 */
#resultProductBtn {
    background: linear-gradient(180deg, #FFEFA8 0%, #FFD438 45%, #E6B700 100%);
    color: #3a2a00;
    font-size: 1.3rem;
    font-weight: 900;
    padding: 16px 22px;
    border-radius: 14px;
    border: 3px solid #E6B700;
    width: 100%;
    cursor: pointer;
    margin-bottom: 12px;
}

