html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Noto Serif SC", serif;
  background: #000;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.table {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  transition: background-image 0.3s ease;
  overflow: hidden;
}

/* 按钮栏样式 */
.button-bar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  width: auto;
}

button {
  font-size: 18px;
  padding: 10px 25px;
  border: none;
  border-radius: 8px;
  background: rgba(209, 73, 73, 0.9);
  color: #fff;
  cursor: pointer;
  margin: 0;
  box-shadow: 0 3px 5px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}
button:hover { 
  background: rgba(232, 91, 91, 0.95);
  transform: translateY(-2px);
}

/* 钱币容器：强制一行7个+所有行居中 */
#coin-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%);
  width: 750px; 
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  z-index: 5;
}

/* 钱币基础样式 */
.coin {
  position: relative;
  width: 90px;
  height: 90px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-bottom: 25px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

/* 钱币高亮：贴合贴图轮廓的金色光晕（替代大黄框） */
.coin.active {
  transform: scale(1.2);
  filter: 
    drop-shadow(0 0 6px #ffd700)
    drop-shadow(0 0 12px #f9c800)
    drop-shadow(0 0 18px rgba(255, 215, 0, 0.6));
  box-shadow: none;
}

/* 钱币名称：醒目+无重叠+适配高亮 */
.coin-name {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 5px;
  font-size: 15px;
  font-weight: 600;
  color: #ffef9f;
  text-shadow: 0 0 4px #000, 0 0 8px #d4af37, 0 1px 2px #000;
  white-space: nowrap;
  z-index: 10;
  transition: transform 0.3s ease;
}

.coin.active .coin-name {
  transform: translateX(-50%) scale(1.1);
}

/* 抽取结果展示 */
#draw-result {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 800px;
  text-align: center;
  color: #fff9e6;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  max-height: 30vh;
  overflow-y: auto;
}

.effect {
  margin: 10px auto;
  width: 90%;
  background: rgba(255, 249, 230, 0.8);
  border-radius: 8px;
  padding: 10px;
  color: #222;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
  text-align: left;
}

h3 {
  margin-top: 0;
  color: #ffd700;
  font-size: 20px;
}

/* 自定义弹窗样式 */
#custom-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 700px;
  max-height: 80vh;
  background: #fff;
  border: 2px solid #d14949;
  border-radius: 10px;
  padding: 0;
  z-index: 9999;
  display: none;
  overflow: hidden;
  font-family: "Noto Serif SC", serif;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 9998;
  display: none;
}

#custom-alert .alert-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  margin: 0;
  background: #fef0f0;
  border-bottom: 1px solid #f0c0c0;
}

#custom-alert .close-btn {
  padding: 6px 15px;
  border: none;
  border-radius: 6px;
  background: #d14949;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

#custom-alert .close-btn:hover {
  background: rgba(232, 91, 91, 0.95);
}

#alert-content {
  padding: 20px;
  margin-top: 4px;
  color: #333;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
  max-height: calc(80vh - 60px);
  overflow-y: auto;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .coin { 
    width: 70px; 
    height: 70px; 
    margin-bottom: 20px;
  }
  .coin-name {
    font-size: 12px;
    text-shadow: 0 0 3px #000, 0 0 6px #d4af37;
  }
  .coin.active {
    transform: scale(1.15);
    filter: 
      drop-shadow(0 0 4px #ffd700)
      drop-shadow(0 0 8px #f9c800)
      drop-shadow(0 0 12px rgba(255, 215, 0, 0.5));
  }
  #coin-box {
    width: 90%;
    gap: 15px;
  }
  button {
    font-size: 14px;
    padding: 8px 18px;
  }
  .button-bar {
    gap: 10px;
  }
  #custom-alert {
    width: 90%;
    max-height: 85vh;
  }
  #alert-content {
    max-height: calc(85vh - 60px);
    font-size: 14px;
    padding: 15px;
    margin-top: 4px;
  }
  #custom-alert .alert-header {
    padding: 10px 15px;
  }
  #draw-result {
    max-height: 25vh;
    font-size: 14px;
  }
  h3 {
    font-size: 18px;
  }
}

/* 强制PC端样式，防止移动端样式覆盖 */
@media (min-width: 601px) {
  #coin-box {
    width: 750px !important;
    justify-content: center !important;
  }
}
