/* 专项训练中心（training.html）的页面级样式。
   顶栏 / .wrap / .card / .page-title 这些通用外观继续用 css/tournament.css，
   这里只补「题目卡片」这一组新组件，不改任何已有页面的样式。

   移动端优先：默认就是单列，够宽才铺多列。
   点击区域整张卡片（>= 44px 高），正文字号不低于 14px，别为了塞内容缩字。 */

.lead {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.7;
  color: rgb(245 241 230 / 82%);
}

/* ---- 专项训练：分类 + 题目卡片 ---- */

.drill-groups {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cat-name {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 17px;
  letter-spacing: 1px;
}

/* 默认单列。题目卡片是主要点击区域，宁可多占一行也不要挤在一起点不准。 */
.drill-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* 题目卡片是 <button>：要显式把浏览器默认样式清掉，
   否则会出现原生按钮的边框、居中文字和继承来的字号。 */
.drill-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;

  /* 深底 + 金描边，和木纹底的 .card 拉开层次，卡片才像「能点的题」 */
  background: rgb(0 0 0 / 22%);
  border: 1px solid rgb(231 198 107 / 35%);
  color: var(--paper);
  transition:
    transform 0.1s ease,
    border-color 0.1s ease;
}

.drill-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.drill-card:active {
  transform: translateY(1px);
}

/* 键盘可达性：Tab 到卡片时要有明显焦点框 */
.drill-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.drill-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drill-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

/* 难度三档：入门绿 / 进阶橙 / 高手红 */
.diff {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.diff-1 {
  background: #2f7d4f;
  color: #eaf7ee;
}

.diff-2 {
  background: #b5791f;
  color: #fff6e2;
}

.diff-3 {
  background: #a33b34;
  color: #ffeeeb;
}

.drill-goal {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.82;
}

.drill-best {
  margin-top: 10px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
}

/* 「我的进度」区块里几个分区的小标题（按分类达标率 / 最近成绩）。
   完整定义在 css/progress.css，这里只补训练页用到的那一条。 */

.progress-sub {
  margin: 20px 0 10px;
  color: var(--gold);
  font-size: 17px;
  letter-spacing: 1px;
}

/* ---- 题库空状态 / 加载态 ---- */

.empty,
.loading {
  margin: 0;
  padding: 26px 16px;
  border-radius: 12px;
  background: rgb(0 0 0 / 18%);
  border: 1px dashed rgb(231 198 107 / 40%);
  color: rgb(245 241 230 / 70%);
  font-size: 16px;
  text-align: center;
}

/* ---- 考核认证 ---- */

.exam-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.exam-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(var(--wood-light), var(--wood));
  border: 1px solid rgb(231 198 107 / 45%);
  color: var(--paper);
  text-decoration: none;
}

.exam-card:hover {
  border-color: var(--gold);
}

.exam-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.exam-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

.exam-desc {
  font-size: 14px;
  opacity: 0.8;
}

/* ---- 我的进度 ---- */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgb(0 0 0 / 18%);
}

.stat-value {
  color: var(--gold);
  font-size: 26px;
  font-weight: 700;
}

.stat-label {
  font-size: 15px;
  opacity: 0.8;
}

/* ---- 顶部训练进度条 ---- */

/* 粘在顶栏下面，练的过程中一直能看见自己在第几题、有没有达标。 */
.drill-progress {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgb(0 0 0 / 55%);
  border: 1px solid rgb(231 198 107 / 40%);
  backdrop-filter: blur(4px);
}

.drill-progress-index {
  flex: none;
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
}

/* 题名可能比较长，窄屏时先让它自己截断，别把「是否达标」挤出去 */
.drill-progress-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drill-badge {
  flex: none;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 14%);
  font-size: 13px;
  font-weight: 700;
}

.drill-badge.is-pass {
  background: #2f7d4f;
  color: #eaf7ee;
}

.drill-badge.is-fail {
  background: #a33b34;
  color: #ffeeeb;
}

.drill-badge.is-done {
  background: rgb(231 198 107 / 22%);
  color: var(--gold);
}

/* ---- 达标 / 未达标提示条 ---- */

/* 固定在底部居中，不占文档流，免得球桌 iframe 一开就把提示条顶到看不见的地方。
   里面的 .notification-banner / .notification-title 等类全部来自
   css/notification.css，这里只调尺寸，不重画样式。 */
.drill-result {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 2100;
  width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%);
}

.drill-result .notification-banner {
  min-width: 0;
  width: 100%;
}

.drill-result .notification-actions {
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 var(--notification-space-4) var(--notification-space-3);
}

.drill-result .notification-actions button {
  flex: 1;
  min-width: 120px;
  padding: var(--notification-space-2) var(--notification-space-4);
  font-size: 15px;
}

.drill-result.is-pass .notification-icon {
  color: #5fe3a1;
}

.drill-result.is-fail .notification-icon {
  color: #ff9d94;
}

/* ---- 球桌浮层 ---- */

.drill-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgb(0 0 0 / 78%);
}

.drill-overlay.active {
  display: flex;
}

.drill-game {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}

#gameIframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* 关闭按钮浮在球桌右上角，不能挡住游戏自己的菜单 */
.drill-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: rgb(0 0 0 / 65%);
  color: var(--paper);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.drill-close:hover {
  background: rgb(0 0 0 / 85%);
}

.drill-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---- 宽屏才铺多列；手机与平板保持单列 ---- */

@media (width >= 720px) {
  .drill-grid,
  .exam-grid,
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width >= 1000px) {
  .drill-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
