/* styles.css */

/* 全局 */
/* 本地字体定义 */
@font-face {
  font-family: 'Chewy';
  src: url('assets/fonts/Chewy-VTT.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'XimaiTi';
  src: url('assets/fonts/XimaiTi.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'FZZangTi';
  src: url('assets/fonts/FZZangTi.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'Smiley Sans Oblique';
  src: url('assets/fonts/SmileySans-Oblique.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
/* 其他备用字体无需定义，使用系统字体 */

/* 注意：移除了非标准的 zoom: 1.8，改用 transform: scale(1.8) 在 body 上实现缩放效果
   但更好的做法是通过调整字体大小和布局来实现响应式设计
   这里先移除 zoom 以解决浏览器兼容性问题 */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: sans-serif;
}

:root {
  --topic-panel-top-gap: 72px;
  --topic-panel-bottom-gap: 32px;
  --topic-panel-viewport-height: 100vh;
}
.hidden { display: none !important; }

/* 通用背景（铺满） */
.panel-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;          /* 强制拉伸铺满 */
  object-position: center;
  background-color: #000;
  z-index: 0;
}

/* 封面页 - 使用透明背景，实际背景由 .panel-bg 提供 */
.cover-page {
  position: absolute;
  inset: 0;
  background: transparent;
}

/* 通用辩题显示（可拖拽） */
#topicDisplay {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  white-space: pre-wrap;
  text-align: center;
  font-weight: bold;
  cursor: grab;
  color: #fff;
  z-index: 1;
}
#topicDisplay.grabbing { cursor: grabbing; }

/* 选择面板 */
#topicPanel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--topic-panel-top-gap) 20px var(--topic-panel-bottom-gap);
  box-sizing: border-box;
  z-index: 2;
}

/* 设置框 */
#topicPanel .panel-content {
  width: 100%;
  max-width: 420px;
  max-height: calc(var(--topic-panel-viewport-height) - var(--topic-panel-top-gap) - var(--topic-panel-bottom-gap));
  overflow-y: auto;
  background: rgba(255,255,255,0.88);
  padding: 20px 24px 28px;
  border-radius: 8px;
  z-index: 1;
  user-select: none;
  color: #000;
  box-sizing: border-box;
  margin: 0 auto;
  flex: 0 0 auto;
}

/* 自定义滚动条样式 */
#topicPanel .panel-content::-webkit-scrollbar {
  width: 8px;
}
#topicPanel .panel-content::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}
#topicPanel .panel-content::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
}
#topicPanel .panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.4);
}
#topicPanel textarea {
  width: 100%;
  height: 50px;
  margin: 10px 0;
  color: #000;
}
#topicPanel select,
#topicPanel input[type="number"] {
  width: 100%;
  padding: 6px;
  margin: 5px 0;
}
#topicPanel .buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
#topicPanel .buttons button {
  padding: 8px 12px;
  cursor: pointer;
  color: #000;
}

.debate-size-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
  color: #111;
}
.debate-size-group label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: 600;
}
.debate-size-group.disabled {
  opacity: 0.42;
}
.debate-size-group.disabled label {
  cursor: not-allowed;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.modal.hidden { display: none; }
.modal-content {
  background: #fff;
  color: #000;
  padding: 20px;
  border-radius: 8px;
  width: 60%;
  max-height: 80%;
  overflow: auto;
}
.modal-buttons button {
  margin-left: 10px;
  padding: 6px 12px;
  color: #000;
}

/* 计时界面容器 */
#container {
  position: absolute;
  top: 120px;        /* 整体下移 */
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

/* 标题 */
#title {
  margin: 15px 0;
  font-size: 2em;
  font-family: "Chewy", cursive;
  text-align: center;
}

/* 主场宝石：放在右上角，避免与单计时器/中心计时器撞版 */
.animal-badge {
  position: fixed;
  top: 92px;
  right: 86px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  cursor: grab;
}
.animal-badge.grabbing {
  cursor: grabbing;
}
.animal-badge img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}
.animal-badge.gem-glow img {
  filter:
    drop-shadow(0 0 4px rgba(255, 239, 174, 0.72))
    drop-shadow(0 0 9px rgba(255, 211, 71, 0.28))
    drop-shadow(0 4px 8px rgba(0,0,0,0.42));
}
.animal-badge div {
  display: none;
}

.gem-glow-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  color: #333;
  cursor: pointer;
  user-select: none;
}
.gem-glow-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #d69a16;
}

.advanced-settings-toggle-row {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 10px;
}
.advanced-settings-toggle {
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 5px 11px;
  background: rgba(0,0,0,0.18);
  color: #fff;
  cursor: pointer;
  font-size: 0.85em;
}
#advancedSettingsSection.collapsed {
  display: none;
}

.change-home-gem-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed #d89a13;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff8df, #ffedab);
  color: #6f4700;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.change-home-gem-btn:hover {
  background: linear-gradient(135deg, #fff1ba, #ffe08a);
}
.home-gem-modal-content {
  width: 620px !important;
  max-width: 92%;
}
.home-gem-grid .skill-option.current-home,
.home-gem-grid .skill-option:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.9);
}
.home-gem-grid .skill-option.selected-home {
  outline: 2px solid #ffd35a;
  background: rgba(255, 205, 51, 0.18);
}
.home-gem-action {
  min-width: 104px;
  min-height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.home-gem-action:hover {
  transform: translateY(-1px);
}
.home-gem-cancel {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  box-shadow: 0 3px 9px rgba(15,23,42,0.08);
}
.home-gem-cancel:hover {
  background: #f8fafc;
}
.home-gem-confirm {
  border: 1px solid #b97800;
  background: linear-gradient(135deg, #f8c84d, #d89108);
  color: #3d2600;
  box-shadow: 0 6px 14px rgba(184,121,0,0.22);
}
.home-gem-confirm:hover {
  background: linear-gradient(135deg, #ffda70, #e7a51b);
}

/* 计时区（核心栅格） */
#timerArea {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 80%;
  gap: 24px;              /* 面板间距 */
}

/* 左右两侧面板（side）与中间面板（center）始终保持等宽
   —— 这样 double/triple 的左右初始位置完全一致 */
.side,
#centerSide {
  flex: 1 1 0;
  min-width: 0;
  max-width: 33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
}
.side.grabbing { cursor: grabbing; }

/* 中间面板：默认作为“双计时控制条”留出上边距 */
#centerSide { margin-top: 140px; }

/* 一旦存在中心时间（single 或 triple），与左右对齐（取消上边距） */
#timerArea:has(#centerTime) #centerSide { margin-top: 0; }

/* 提示：不要再缩小无中心时间时的 #centerSide 宽度，
   以保证 double 与 triple 的左右位置一致 */

/* 标签与时间 */
.label {
  font-size: 1.2em;
  margin-bottom: 5px;
}
.time {
  font-size: 3.5em;
  margin-bottom: 10px;
  transition: color 0.3s;
}

/* 全局按钮样式 */
button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  transition: background 0.2s, transform 0.1s;
}
button:hover { background: rgba(255,255,255,0.2); }
button:active {
  background: rgba(255,255,255,0.3);
  transform: scale(0.98);
}
button:focus { outline: none; }

/* 按钮区 */
.buttons,
#centerSide .buttons {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

/* 翻页按钮 */
#navButtons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}
#navButtons button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.2em;
  cursor: pointer;
}

/* 返回按钮 */
#returnButton {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 3;
}
#returnButton button {
  padding: 6px 12px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}
#returnButton button:hover {
  background: rgba(0,0,0,0.62) !important;
  border-color: rgba(255,255,255,0.82);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45), 0 0 10px rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

/* 统一设置按钮样式 */
#returnButton #settingsBtn {
  background: rgba(255,255,255,0.2) !important;
}

#returnButton #skillBtn {
  background: rgba(255,255,255,0.2) !important;
}

/* “技能 / 设置”有更高优先级的基础色，需单独覆盖才能与“返回”保持同一悬停反馈。 */
#returnButton #settingsBtn:hover,
#returnButton #skillBtn:hover {
  background: rgba(0,0,0,0.62) !important;
  border-color: rgba(255,255,255,0.82);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45), 0 0 10px rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.skill-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #f8f8f8;
  color: #222;
  text-align: left;
  cursor: pointer;
}
.skill-option:hover {
  background: #eef6ff;
  border-color: #9fc5ff;
}
.skill-option img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 auto;
}
.skill-option strong,
.skill-option span {
  display: block;
}
.skill-option strong {
  font-size: 16px;
  margin-bottom: 4px;
}
.skill-option span span {
  color: #666;
  font-size: 13px;
}

.skill-action-modal {
  position: relative;
  width: 420px !important;
  max-width: 92% !important;
  border-radius: 18px;
  padding: 26px 28px 28px !important;
  background: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(239,246,255,0.98));
  box-shadow: 0 24px 70px rgba(0,0,0,0.35);
}
.skill-action-modal h3 {
  margin: 0 36px 8px 0;
  font-size: 24px;
  color: #101828;
}
.skill-action-modal p {
  margin: 0 0 20px;
  color: #475467;
  line-height: 1.55;
}
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(16,24,40,0.08);
  color: #101828;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-close-btn:hover {
  background: rgba(16,24,40,0.16);
}
.side-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.side-choice-btn {
  min-height: 88px;
  border: none;
  border-radius: 16px;
  font-size: 28px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.side-choice-btn.pro {
  background: linear-gradient(135deg, #1677ff, #0b4cc2);
}
.side-choice-btn.con {
  background: linear-gradient(135deg, #ff7a1a, #c2410c);
}
.side-choice-btn.ok {
  min-height: 44px;
  padding: 0 22px;
  font-size: 16px;
  background: linear-gradient(135deg, #1677ff, #0b4cc2);
}

/* 设置面板按钮悬停效果 */
#saveTemplateBtn,
#loadTemplateBtn,
#resetBtn {
  transition: all 0.2s ease;
  cursor: pointer;
}

#saveTemplateBtn:hover,
#loadTemplateBtn:hover,
#resetBtn:hover {
  background-color: #e0e0e0 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  border-color: #bbb !important;
}

#saveTemplateBtn:active,
#loadTemplateBtn:active,
#resetBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 更换背景按钮悬停效果 */
#changeBackgroundBtn {
  transition: all 0.2s ease;
  cursor: pointer;
}

#changeBackgroundBtn:hover {
  background-color: #45a049 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
}

#changeBackgroundBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.2) !important;
}

/* 主按钮 - 开始比赛 */
#startBtn {
  background: #4CAF50 !important;
  color: white !important;
  border: none !important;
  padding: 10px 24px !important;
  border-radius: 6px !important;
  font-weight: bold !important;
  font-size: 1.1em !important;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
  transition: all 0.25s ease !important;
  cursor: pointer;
}

#startBtn:hover {
  background: #45a049 !important;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4) !important;
}

#startBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3) !important;
}
