/*全域*/
body {
  /*background-image: url("../img/bg.png");*/
  background-color:#0c192c;
  overflow: hidden;
  margin: 0px;
  font-family: "Noto Sans TC", system-ui;
  font-optical-sizing: auto;
  font-style: normal;
}
a {
  text-decoration: none;
}
* {
  font-weight: 600;
}

/* 整體頁面 */
.page-layout {
  display: flex;
  height: 100vh; /* 占滿視窗高度 */
  margin: 0;
  padding: 0;
}

/* 浮動圖片樣式 */
@keyframes float {
  0% {
    transform: translate(-50%, -50%) translateX(-10px); /* 向左移動 */
  }
  50% {
    transform: translate(-50%, -50%) translateX(10px);  /* 向右移動 */
  }
  100% {
    transform: translate(-50%, -50%) translateX(-10px); /* 回到初始位置 */
  }
}

/* 浮動圖片樣式 */
.floating-image {
  position: absolute;
  top: 50%;   
  left: 50%;
  transform: translate(-50%, -50%);
  /*width: 67%;*/
  height: auto;
  z-index: 10;
  pointer-events: none;
  animation: float 3s ease-in-out infinite; /* 持續晃動的動畫 */
}



/*左欄位(地圖)*/
.left-panel {
  flex: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 0;
  height: 100vh;
}

/* 棋盤 */
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  width: 100%;
  height: 100%;
  max-width: 90%;
  max-height: 90%;
  transform: scale(0.9);
  aspect-ratio: 1;
}

/* 地圖格子樣式 */
div#cell0 > div.content > strong > i{
  font-size:1.8em;
}
.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  border: 0px solid #ccc;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  aspect-ratio: auto;
}
/* 格子內容 */
.content {
  font-size: 1.4vw;
  text-align: center;
  padding: 5px;
}

/* 格子樣式 */
/* START */
.cell:nth-child(2) {
  background-color: #009944;
  color: white;
}
/* 公平待客十大原則 */
.cell:nth-child(8),.cell:nth-child(23) {
  background-color: #0077b6;
  color: white;
}
/* 等候叫號 */
.cell:nth-child(50) {
  background-color: #ffc72c;
}
/* 友善京城 */
.cell:nth-child(43),.cell:nth-child(44) {
  border: 2px solid #e64709;
}
/* 第一排 */
.cell:nth-child(3),.cell:nth-child(4),.cell:nth-child(5),.cell:nth-child(6),.cell:nth-child(7) {
  border-bottom: 8px solid red;
}
/* 右排 */
.cell:nth-child(15),.cell:nth-child(22),.cell:nth-child(29),.cell:nth-child(36) {
  border-left: 8px solid #0077b6;
}
/* 左排 */
.cell:nth-child(9),.cell:nth-child(16),.cell:nth-child(30),.cell:nth-child(37) {
  border-right: 8px solid #ffc72c;
}
/* 下排 */
.cell:nth-child(45),.cell:nth-child(46),.cell:nth-child(47),.cell:nth-child(48),.cell:nth-child(49) {
  border-top: 8px solid #094;
}
/* 指向時抬起動畫 */
.cell:hover {
  transform: translateY(-8px);
}

/* 玩家圖案 */
.player {
  width: 60px;
  height: 60px;
  background-image: url("../img/player.png");
  background-size: contain;
  background-repeat: no-repeat;
  position: absolute;
}

/* 右欄位(操作盤) */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  /*background-color: #ffffff;*/
  padding: 20px;
  box-sizing: border-box;
  height: 100vh;
}

/* 標題文字 */
.title-text {
  font-size: 2rem;
  color: #FFF;
  text-align: center;
  margin-bottom: 20px;
  padding: 10px;
  background: rgb(255,0,0);
  background: linear-gradient(to bottom, #ff2f2f, #c10000);
  border: 2px solid #FFF;
  font-weight: 900;
  background-color:#FFF;
  border-radius:3px;
  box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.1);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  outline: 1px solid #adadad; 
}

/* 現在位置文字 */
#diceResult,#currentCellContent {
  font-size: 1.2rem;
}

/* 右側操作欄位內容 */
.center-display {
  width: 100%;
  position: static;
  top: auto;
  left: auto;
  transform: none;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  box-sizing: border-box;
  text-align: center;
  padding:5px;
  /*
  border: 15px solid transparent;
  outline: 4px solid #0077b6;
  outline-offset: -10px;
  background: linear-gradient(#e78700 0 0) top, linear-gradient(#e78700 0 0) left, linear-gradient(#e78700 0 0) bottom, linear-gradient(#e78700 0 0) right;
  background-size: 200% 4px, 4px 200%;
  background-origin: padding-box;
  background-repeat: no-repeat;
  */
  background-color:#FFF;
  border-radius:10px;
  box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.1);

}

/* Modal視窗 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Modal內容區塊 */
.modal-content {
  background: linear-gradient(135deg, #ffffff, #f0f0f0);
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  border-radius: 15px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  width: 80%;
  max-width: 800px;
  transform: scale(0);
  transition: transform 0.3s ease;
  color: #333;
  border-top: 40px solid transparent;
  animation: modalFadeIn 0.3s ease-out;
  opacity: 0;
  transform: scale(0.8);
  animation-fill-mode: forwards;
}
/* Modal內容動畫 */
@keyframes modalFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.modal-content p {
  font-size: 1.2em;
  line-height: 1.4S;
  text-align: center;
}
#modalMessage > p:nth-child(2){
  text-align: left;
}
#modalMessage > p > img{
  width:40%;
}
/* Modal按鈕 */
.modal-button {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1.2em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.modal-button:hover {
  background-color: #45a049;
}

/* Modal關閉鈕 */
.close {
  display:none;
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close:hover,
.close:focus {
  color: #333;
  text-decoration: none;
}

/* 擲骰子鈕 */
.game-button {
  position: relative;
  top: 0;
  cursor: pointer;
  outline: none;
  font-size: 20px;
  line-height: 1.5em;
  letter-spacing: 0.1em;
  border: none;
  margin: 15px 15px 30px;
  border-bottom: 3px solid rgba(16, 91, 146, 0.5);
  border-top: 3px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 8px;
  padding: 8px 15px 10px;
}
.game-button:hover {
  top: 2px;
}
.game-button.orange {
  background: repeating-linear-gradient(
    45deg,
    #ffc800,
    #ffc800 5px,
    #ffc200 5px,
    #ffc200 10px
  );
  box-shadow: 0 6px 0 #b76113, 0 8px 1px 1px rgba(0, 0, 0, 0.3),
    0 10px 0 5px #75421f, 0 12px 0 5px #8a542b, 0 15px 0 5px #593116,
    0 15px 1px 6px rgba(0, 0, 0, 0.3);
  border-bottom: 3px solid rgba(205, 102, 0, 0.5);
  text-shadow: 2px 2px 1px #e78700, -2px 2px 1px #e78700, 2px -2px 1px #e78700,
    -2px -2px 1px #e78700, 0px 2px 1px #e78700, 0px -2px 1px #e78700,
    0px 4px 1px #c96100, 2px 4px 1px #c96100, -2px 4px 1px #c96100;
}
.game-button.orange:hover {
  top: 2px;
  box-shadow: 0 4px 0 #b76113, 0 6px 1px 1px rgba(0, 0, 0, 0.3),
    0 8px 0 5px #75421f, 0 10px 0 5px #8a542b, 0 13px 0 5px #593116,
    0 13px 1px 6px rgba(0, 0, 0, 0.3);
}

/* 骰子圖示 */
.dice {
  font-size: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 骰子動畫 */
.roll-animation {
  animation: roll 0.3s ease;
}
@keyframes roll {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(90deg);
  }
  50% {
    transform: rotate(180deg);
  }
  75% {
    transform: rotate(270deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 能量條及徽章容器 */
.energy-and-badge-container {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  position: static;
  transform: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  text-align: center;
  padding:10px;
}


/* 能量條容器 */
.energy-bar-wrapper {
  flex: 1;
  display: none;
 /* display: flex; /*暫時隱藏友善能量*/
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  text-align: center;
  padding: 15px;
  border-bottom:2px dotted #ffc72c;
  
}

/* 能量條、徽章文字 */
.energy-bar-label,.badge-bar-label {
  font-size: 1.4vw;
  font-weight: 900;
  color: #333;
  margin-bottom: 10px;
  text-align: left;
  width: 100%;
}

/* 能量條 */
.energy-bar-container {
  width: 95%;
  height: 30px;
  background-color: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}

/* 能量條填充 */
.energy-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #ffd700, #ffec8b);
  border-radius: 5px;
  transition: width 0.3s ease;
}
/* 能量條動畫閃爍動畫 */
.energy-bar.full {
  animation: shimmer 3s infinite linear; /* 閃爍效果 */
}
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: 200px 0;
  }
}

/* 徽章容器 */
.badge-container {
  flex: 1;
  text-align: center;
  flex-direction: column;
  display: flex;
  width: 100%;
  text-align: center;
  /*border-bottom:2px dotted #ffc72c;*/
  border-radius: 10px;
  background-color:#FFF;
  box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.1);
  align-items: center;
  padding: 10px;


}

/* 徽章 */
/* 徽章容器 */
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  /*max-width: calc(5 * 35px + 40px); /* 根據需要調整 */
}

/* 徽章樣式 */
.badge {
  font-size: 1.2rem;
  padding: 5px;
  border-radius: 5px;
}

/* 遊戲設定區域 */
.toggle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background-color: #FFF;
  border-radius: 10px;
  padding: 10px;
  width: 100%;
  box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.1);

  position: static;
  transform: none;
  justify-content: center;
  box-sizing: border-box;
}
/* 舊樣式
.toggle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background-color: #f2f2f2;
  border-radius: 10px;
  padding: 10px;
  width: 100%;
}
*/

/* 設定文字 */
.settings-title {
  font-size: 1.2vw;
  font-weight: 900;
  color: #333;
  margin-bottom: 10px;
  text-align: left;
  width: 100%;

}

/* 遊戲控制容器 */
.toggle-group {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 15px;
}

/* 開關樣式 */
.voice-toggle,.music-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 開關文字 */
.toggle-label {
  font-size: 1em;
  color: #333;
}

/* 開關 */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 26px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider:before {
  transform: translateX(24px);
}
.slider:before {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 手機版操作介面 */
.dice-button,.toggle-button{
  display:none;
}

/*////////////////////////////////*/
/*手機版優化版面*/
/*////////////////////////////////*/



/* 手機優化：當螢幕寬度小於 768px 時 */
@media (max-width: 768px) {
  .page-layout {
    flex-direction: column;
  }
  .left-panel, .right-panel {
    width: 100%;
    height: auto;
  }
  .right-panel{
    background-color:#f7f8f0;
  }
  .board {
    width: 90vw;
    height: 90vw;
  }
  .center-display {
    margin-bottom: 15px;
    font-size: 4vw;
  }
  .game-button {
    font-size: 3.5vw;
    padding: 10px 20px;
  }
  .content {
    font-size: 2.5vw;
  }
  .center-display {
    font-size: 3vw;
  }
  .energy-and-badge-container {
    flex-direction: column;
    gap: 10px;
  }
  .energy-bar-wrapper, .badge-container {
    width: 100%;
    max-width: none;
  }
  .energy-bar-container {
    height: 25px;
  }
  .badge-bar-label {
    font-size: 4vw;
  }
  .badges {
    gap: 5px;
  }
  .badge {
    /*width: 30px;
    height: 30px;*/
    font-size: 1.2rem;
  }
  .modal-content {
    width: 90%;
    max-width: none;
    padding: 15px;
  }
  .modal-button {
    font-size: 1.5rem;
    padding: 10px 20px;
  }
  #modalMessage {
    font-size: 1.2rem;
  }
  .title-text {
    font-size: 2.5rem;
  }
  .energy-bar-label, .badge-bar-label {
    font-size: 4vw;
  }
  .toggle-label {
    font-size: 1.2rem;
  }
  .switch {
    width: 45px;
    height: 24px;
  }
  .slider:before {
    width: 22px;
    height: 22px;
  }
/* 手機操作按鈕 */
.button {
  position: fixed;
  top: 10px;
  background-color: #333;
  border: none;
  color: white;
  padding: 10px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 5px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}
.dice-button {
  right: 60px;
  display: block;
  z-index: 0;
}
.toggle-button {
  right: 10px;
  display: block;
  z-index: 3;
}
.button:hover {
  background-color: #555;
}
  .right-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100vh;
    /*background-color: #fff;*/
    z-index: 1;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease-in-out;
    overflow-y: auto;
    justify-content: start;
  }
  .right-panel.active {
    bottom: 0;
  }    
.left-panel {
  flex: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 0;
  height: 100vh;
  perspective: 800px;
}
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  width: 100%;
  height: 100%;
  max-width: 90%;
  max-height: 90%;
  transform: rotateX(45deg) rotateY(0deg) scale(0.85);
  transform-style: preserve-3d;
  aspect-ratio: 1;
  transition: transform 0.5s ease, translate 0.5s ease;
}
}



/* 平板 */
@media (min-width: 601px) and (max-width: 1024px) {
  .page-layout {
    flex-direction: column;
  }

  .left-panel, .right-panel {
    width: 100%;
    height: auto;
  }
  .right-panel{
    background-color:#f7f8f0;
  }
  .left-panel{
    display: flex;
    align-items: flex-start;
    overflow: hidden;
    padding: 0;
    align-content: stretch;
    justify-content: space-around;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    height: auto;
  }
  .content {
    font-size: 2.15vw;
  }
  .right-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100vh;
    /*background-color: #fff;*/
    z-index: 1;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease-in-out;
    overflow-y: auto;
    justify-content: start;
  }

  .right-panel.active {
    bottom: 0;
  }
  .toggle-button {
    position: fixed;
    right: 10px;
    top: 10px;
    display: block;
    background-color: #333;
    border: none;
    color: white;
    padding: 10px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
  }

  .dice-button {
    position: fixed;
    right: 60px;
    top: 10px;
    display: block;
    background-color: #333;
    border: none;
    color: white;
    padding: 10px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
  }

  .button:hover {
    background-color: #555;
  }
  .energy-bar-label, .badge-bar-label {
    font-size: 1.8vw;
}
.energy-bar-wrapper {
  max-width: 100%;
  }
  .toggle-group {
    justify-content: center;
    }
  .board {
    width: 90vw;
    height: 90vw;
    max-width: 90vw;
    max-height: 90vw;
  }
}


/*廢棄沒用到*/

/* 主容器樣式 
.container {
  display: none;
}


.modal-content h3 {
  margin-top: 0;
  font-size: 1.5em;
  color: #009944; 
}


/* 新增展開動畫 
.modal.show .modal-content {
  transform: scale(1); /
}
/* 
.dice-container {
  display: flex;
  justify-content: center;
  align-items: center; 
  gap: 20px; 
  margin-top: 20px;
}
  
/* 添加縮放效果
.start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #f4f4f4;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 999;
  text-align: center;
  transform: scale(1);
  transition: transform 1s ease-in-out;
}

.start-screen.hidden {
  transform: scale(0);
}

.game-container {
  display: none;
  transform: scale(0);
  transition: transform 1s ease-in-out;
}

.game-container.show {
  display: block;
  transform: scale(1);
}

/* 定義旋轉動畫
@keyframes rotate-border {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}