html {
  font-size: 87.5%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #f0f0f0;
  color: #333;
  line-height: 1.6;
  padding: 0.5rem;
}

header {
  text-align: center;
  margin-bottom: 1rem;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header h1 a:hover {
  opacity: 0.7;
}

.assessment-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0.5rem;
  z-index: 100;
  background: #fff;
  padding: 0.25rem 0.3rem;
  margin: 0 auto 0.5rem;
  max-width: 800px;
  border: 1px solid #000;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.assessment-item {
  font-weight: bold;
  font-size: 0.8rem;
}

.summary {
  max-width: 800px;
  margin: 0 auto 0.5rem;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

body > h2 {
  max-width: 1200px;
  margin: 1rem auto 0.5rem;
  padding: 0 0.75rem;
}

.summary h2 {
  margin-bottom: 0.5rem;
}

.assessment {
  font-weight: bold;
}

.assessment.unknown {
  color: #888;
}

.assessment.beginner {
  color: #ef4444;
}

.assessment.novice {
  color: #f97316;
}

.assessment.learner {
  color: #f59e0b;
}

.assessment.developing {
  color: #eab308;
}

.assessment.intermediate {
  color: #84cc16;
}

.assessment.competent {
  color: #22c55e;
}

.assessment.proficient {
  color: #10b981;
}

.assessment.advanced {
  color: #14b8a6;
}

.assessment.expert {
  color: #06b6d4;
}

.assessment.master {
  color: #8b5cf6;
}

#shotList {
  list-style: none;
  font-size: 0.85rem;
}

@media (width >= 600px) {
  #shotList {
    columns: 2;
    column-gap: 8rem;
  }
}

#shotList li {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px solid #eee;
  break-inside: avoid;
}

#shotList a {
  color: inherit;
  text-decoration: none;
}

#shotList a:hover {
  text-decoration: underline;
}

.status-unknown {
  color: #888;
}

.status-pass {
  color: #22c55e;
}

.status-fail {
  color: #ef4444;
}

.question-block {
  max-width: 1200px;
  margin: 0 auto 0.75rem;
  background: #fff;
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-margin-top: 4rem;
}

@media (width >= 768px) {
  .question-block {
    flex-direction: row;
    align-items: flex-start;
  }

  .question-text {
    flex: 1;
  }

  .question-diagram {
    flex: 2;
  }
}

.question-diagram svg.billiards-table {
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* SVG Diagram Style Overrides */
.manual-line {
  opacity: 0.5;
}

.fine-stroke {
  stroke-dasharray: 0.06 0.03;
}

.play-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.375rem 0.75rem;
  background-color: #2563eb;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.play-btn:hover {
  background-color: #1d4ed8;
}

@keyframes ring-expand-green {
  0% {
    box-shadow: 0 0 0 0 rgb(34 197 94 / 80%);
    color: inherit;
  }

  50% {
    color: #16a34a;
  }

  100% {
    box-shadow: 0 0 0 20px rgb(34 197 94 / 0%);
    color: inherit;
  }
}

@keyframes ring-expand-red {
  0% {
    box-shadow: 0 0 0 0 rgb(239 68 68 / 80%);
    color: inherit;
  }

  50% {
    color: #dc2626;
  }

  100% {
    box-shadow: 0 0 0 20px rgb(239 68 68 / 0%);
    color: inherit;
  }
}

.q-stats.updated.q-pass {
  animation: ring-expand-green 2s ease-out 2;
}

.q-stats.updated.q-fail {
  animation: ring-expand-red 2s ease-out 2;
}

.reset-btn {
  padding: 0.25rem 0.5rem;
  background-color: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 0.25rem;
}

.reset-btn:hover {
  background-color: #dc2626;
}

.lobby-btn {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: #2563eb;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.lobby-btn:hover {
  background-color: #1d4ed8;
}

/* Iframe overlay */
#gameOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 80%);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

#gameOverlay.active {
  display: flex;
}

.iframe-container {
  width: 80%;
  height: 80%;
  background: #000;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  color: #000;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-weight: bold;
}

/* ---- 中文考核页：题名层级、成绩单、打印 ---- */

/* 中文题名在上、英文原题名压成小字，保留原题对照但不抢视觉 */
.q-title-zh {
  display: block;
  font-size: 1.05rem;
  line-height: 1.4;
}

.q-title-en {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: italic;
  color: #94a3b8;
  letter-spacing: 0.01em;
}

.q-desc-zh {
  margin-top: 8px;
  line-height: 1.7;
}

.q-desc-en {
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #64748b;
}

/* 判定标准提示：让人明确看到标准没有被放宽 */
.q-criteria {
  margin-top: 6px;
  font-size: 0.74rem;
  color: #475569;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
  padding: 4px 8px;
  border-radius: 0 4px 4px 0;
}

.q-ref {
  margin-top: 6px;
  font-size: 0.74rem;
}

/* 题目列表里的英文小字 */
.q-list-en {
  font-size: 0.7rem;
  color: #94a3b8;
  font-style: italic;
}

/* 顶部中英切换 */
.lang-switch {
  margin: 0 0 8px;
  font-size: 0.78rem;
}

.lang-switch a {
  color: #64748b;
  text-decoration: none;
  border-bottom: 1px dotted #94a3b8;
}

.lang-switch a:hover {
  color: #111827;
}

/* 成绩单 */
.report-btn {
  background: #002147;
  color: #fff;
  border: 1px solid #002147;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.report-btn:hover {
  background: #0b3a6b;
}

.report {
  margin: 16px 0;
  border: 1px solid #cbd5e1;
  border-top: 4px solid #002147;
  border-radius: 6px;
  background: #fff;
  padding: 16px 20px;
}

.report[hidden] {
  display: none;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.report-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #002147;
}

.report-actions {
  display: flex;
  gap: 8px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 10px;
  margin: 0;
}

.report-cell {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px 10px;
}

.report-cell dt {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.report-cell dd {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.report-grade {
  color: #002147;
}

.report-grade.grade-expert {
  color: #047857;
}

.report-grade.grade-intermediate {
  color: #b45309;
}

.report-grade.grade-beginner {
  color: #b91c1c;
}

.report-note,
.report-rules,
.report-footer {
  font-size: 0.78rem;
  line-height: 1.7;
  margin: 12px 0 0;
}

.report-rules {
  color: #475569;
  border-top: 1px dashed #cbd5e1;
  padding-top: 8px;
}

.report-footer {
  color: #94a3b8;
}

/* 打印 / 存为 PDF：只留成绩单，其余全部隐藏 */
@media print {
  body.print-report {
    background: #fff;
    padding: 0;
  }

  body.print-report > *:not(#report) {
    display: none !important;
  }

  body.print-report #report {
    border: none;
    margin: 0;
    padding: 0;
  }

  body.print-report .report-actions {
    display: none !important;
  }

  body.print-report .report-cell {
    border: 1px solid #94a3b8;
  }
}
