/* --- 全局與佈局 (所有頁面共用) --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&display=swap');

:root {
  --primary-color: #00aaff;
  --dark-bg: #1a1a2e;
  --panel-bg: rgba(13, 27, 42, 0.85);
  --light-text: #e0e0e0;
  --white-text: #ffffff;
  --player-color: #00aaff; /* 我方顏色 */
  --enemy-color: #ff5252;  /* 敵方顏色 */
}

body {
  font-family: 'Noto Sans TC', sans-serif;
  background-color: var(--dark-bg);
  color: var(--light-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  box-sizing: border-box;
}

h1 {
  color: var(--white-text);
  text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 30px;
}

/* --- 通用元件 (按鈕、面板) --- */
button {
  background-color: #1e3a5f;
  color: var(--light-text);
  border: 2px solid var(--primary-color);
  padding: 10px 20px;
  border-radius: 5px;
  font-family: 'Noto Sans TC', sans-serif;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.3s;
  font-size: 1rem;
  margin: 5px;
}

button:hover, button:focus {
  background-color: #2a528a;
  box-shadow: 0 0 15px rgba(0, 170, 255, 0.6);
  outline: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  background-color: #1e3a5f;
}

/* 內容面板樣式 */
.container {
  background-color: var(--panel-bg);
  padding: 25px;
  border-radius: 10px;
  border: 1px solid var(--primary-color);
  backdrop-filter: blur(5px);
  width: 90%;
  max-width: 650px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  margin-bottom: 20px;
  text-align: center;
}

/* --- 遊戲主頁與對戰模式 (index.html, vs.html) --- */
.board {
  position: relative;
  width: 400px;
  height: 500px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: repeat(8, 50px);
  grid-template-rows: repeat(10, 50px);
  border: 3px solid var(--primary-color);
  border-radius: 8px;
  background-image: url('PACK.PNG');
  background-size: cover;
  box-shadow: 0 0 20px rgba(0, 170, 255, 0.7);
}

.cell {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(153, 204, 255, 0.3);
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
  transition: background-color 0.3s;
}

.cell:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 棋子符號的圓圈背景樣式 */
.cell .symbol, .elephant .symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.9);
  font-weight: bold;
  font-size: 30px;
  color: var(--dark-bg);
}

.hp {
  position: absolute;
  top: -15px;
  font-size: 16px;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

/* 棋子圓圈樣式 */
.cell .symbol, .elephant .symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: white;
  font-weight: bold;
  font-size: 30px;
  line-height: 1;
}

.player .symbol {
    border: 2px solid var(--player-color);
    box-shadow: 0 0 5px var(--player-color);
    color: var(--dark-bg);
}
.enemy .symbol {
    border: 2px solid var(--enemy-color);
    box-shadow: 0 0 5px var(--enemy-color);
    color: var(--dark-bg);
}

.elephant { position: absolute; display: flex; align-items: center; justify-content: center; }
.elephant .symbol {
    width: 96px;
    height: 96px;
    font-size: 60px;
}
.elephant .hp {
    top: -10px;
    left: 10px;
}

.hidden { display: none; }
#toolbar { margin-top: 20px; }

/* 動畫效果 */
.hit { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
.attack { animation: rise 0.3s ease-out; }

@keyframes shake {
  0%, 100% { transform: translate(0); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-2px, 0); }
  20%, 40%, 60%, 80% { transform: translate(2px, 0); }
}
@keyframes rise {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

/* --- 抽獎頁 (lottery.html) --- */
#cards { width: 360px; margin: 20px auto; display: flex; justify-content: center; gap: 20px; }
.row { display: flex; justify-content: center; }
.card {
  width: 80px;
  height: 100px;
  border: 2px solid var(--primary-color);
  margin: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(145deg, #2a2a4e, #1a1a2e);
  color: var(--primary-color);
  text-shadow: 0 0 5px var(--primary-color);
  border-radius: 8px;
  transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 170, 255, 0.5);
}
.card.revealed { 
    background: var(--light-text);
    color: var(--dark-bg);
    text-shadow: none;
}
#timer { margin: 20px; font-size: 1.2rem; }

/* --- 戰績頁 (billboard.html) --- */
#stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
    text-align: center;
}
#stats-grid > div {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.3);
}
#stats-grid > div p {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--primary-color);
    font-weight: bold;
}
#stats-grid > div span {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--white-text);
    text-shadow: 0 0 8px var(--primary-color);
}
#last-win { list-style: none; padding: 0; margin-top: 20px; }
#last-win li {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    border-left: 3px solid var(--primary-color);
}
h2 {
    color: var(--white-text);
    text-shadow: 0 0 5px var(--primary-color);
    margin-top: 30px;
}

/* --- 倉庫頁表格樣式 (box.html) --- */
#pieces-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    font-size: 1.1rem;
    table-layout: fixed;
}
#pieces-table th, #pieces-table td {
    padding: 18px 20px;
    border: 1px solid rgba(0, 170, 255, 0.2);
    text-align: left;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}
#pieces-table th {
    background-color: var(--primary-color);
    color: var(--dark-bg);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#pieces-table td:nth-child(4) { text-align: center; }
#pieces-table tr:nth-child(even) { background-color: rgba(0, 0, 0, 0.15); }
#pieces-table tr:hover { background-color: rgba(0, 170, 255, 0.1); }
#pieces-table td .symbol {
    display: inline-flex;
    width: 30px;
    height: 30px;
    font-size: 20px;
    margin-right: 15px;
}
.status-owned { color: #4CAF50; font-weight: bold; }
.status-unowned { color: #FFC107; }

/* 說明按鈕樣式 */
.desc-btn {
    background-color: var(--primary-color);
    color: var(--dark-bg);
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s;
}
.desc-btn:hover { background-color: #0088cc; }

/* --- 遊戲結束通知畫面樣式 --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}
.modal-content {
  background-color: var(--panel-bg);
  padding: 30px 40px;
  border-radius: 10px;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 30px rgba(0, 170, 255, 0.5);
  text-align: center;
  max-width: 400px;
  width: 80%;
  animation: fadeIn 0.3s ease-out;
}
.modal-content h2 {
  color: var(--white-text);
  margin-top: 0;
  font-size: 2rem;
  text-shadow: 0 0 10px var(--primary-color);
}
.modal-content p {
  font-size: 1.1rem;
  margin-bottom: 25px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.modal-overlay.hidden { display: none; }


#piece-stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-family: sans-serif;
}

#piece-stats-table th, 
#piece-stats-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

#piece-stats-table th {
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #555;
  background-color: transparent;
}

#piece-stats-table tbody tr:first-child td {
  border-top: 2px solid #333; /* 在表格內容上方加粗線條 */
}

#piece-stats-table tbody tr:hover {
  background-color: #f0f0f0;
}

/* main.css */

.cell.move-option {
  background-color: #aed6f1; /* 藍色背景，表示可移動 */
  cursor: pointer;
}

.cell.attack-option {
  background-color: #f5b7b1; /* 紅色背景，表示可攻擊 */
  cursor: pointer;
}