/* ============================================
 * Snowycatbot 历史刷题工具 - 全局样式
 * ============================================ */

/* ===== CSS 变量 ===== */
:root {
  --primary: #4A90D9;
  --primary-dark: #357ABD;
  --primary-light: #6FAEDB;
  --accent: #FF6B6B;
  --accent-dark: #E55555;
  --success: #4ECDC4;
  --warning: #FFE66D;
  --bg-main: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-classroom: #1A1A2E;
  --text-dark: #1A1A2E;
  --text-medium: #555;
  --text-light: #999;
  --border: #E0E0E0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --cat-size: 80px;
  --cat-size-lg: 120px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

/* ===== 应用容器 ===== */
#app {
  min-height: 100vh;
}

/* ===== 通用组件 ===== */
.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #E8EDF2;
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #DDE3EA;
}

.btn-danger {
  background: var(--accent);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-lg {
  padding: 14px 36px;
  font-size: 16px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.tag-blue { background: #E3F0FF; color: var(--primary); }
.tag-green { background: #E0F5F0; color: #2A9D8F; }
.tag-orange { background: #FFF3E0; color: #E76F51; }
.tag-red { background: #FFEBEE; color: var(--accent); }
.tag-yellow { background: #FFF9E6; color: #B8860B; }
.tag-gray { background: #F0F0F0; color: #666; }

/* ===== 题集创建弹窗V2 ===== */
.qs-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0 8px;
  flex-wrap: wrap;
}
.qs-batch-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.qs-count {
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}
.qs-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.qs-filter-bar select,
.qs-filter-bar input {
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: #fff;
  outline: none;
  min-width: 100px;
}
.qs-filter-bar input {
  flex: 1;
  min-width: 120px;
}

/* ===== 入口选择页 ===== */
.entry-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #E3F0FF 0%, #F0F4F8 50%, #E8F5E9 100%);
  padding: 40px 20px;
}

.entry-header {
  text-align: center;
  margin-bottom: 40px;
}

.entry-header .logo {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.entry-header .subtitle {
  font-size: 18px;
  color: var(--text-medium);
}

.entry-header .brand {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-light);
}

.entry-cards {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
}

.entry-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  width: 260px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.entry-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.entry-card .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.entry-card .title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.entry-card .desc {
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.6;
}

/* ===== 入口页备案号 ===== */
.entry-footer {
  margin-top: 40px;
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}
.entry-footer .footer-copyright {
  margin-bottom: 4px;
}
.entry-footer .footer-beian a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
}
.entry-footer .footer-beian a:hover {
  color: var(--primary);
}
.entry-footer .footer-sep {
  margin: 0 8px;
  color: var(--border);
}

/* ===== 通用备案号底栏 ===== */
.scb-footer {
  padding: 12px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  background: rgba(0,0,0,0.02);
  border-top: 1px solid var(--border);
}
.scb-footer a {
  color: var(--text-light);
  text-decoration: none;
}
.scb-footer a:hover {
  color: var(--primary);
}
.scb-footer .footer-sep {
  margin: 0 8px;
  color: var(--border);
}
.scb-footer.on-dark {
  background: rgba(255,255,255,0.05);
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
}
.scb-footer.on-dark a {
  color: rgba(255,255,255,0.5);
}
.scb-footer.on-dark a:hover {
  color: rgba(255,255,255,0.8);
}

/* ===== 老师端通用布局 ===== */
.teacher-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.teacher-header {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.teacher-header .brand {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.teacher-header .nav {
  display: flex;
  gap: 4px;
}

.teacher-header .nav-item {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  color: rgba(255,255,255,0.7);
}

.teacher-header .nav-item.active,
.teacher-header .nav-item:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.teacher-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.teacher-header .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--primary);
}

.teacher-body {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== 微信登录页 ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4A90D9 0%, #357ABD 100%);
}

.login-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  width: 90%;
}

.login-box .logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.login-box .subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 28px;
}

.qr-placeholder {
  width: 200px;
  height: 200px;
  margin: 0 auto 20px;
  border: 3px solid #07C160;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F5F5F5;
  position: relative;
}

.qr-placeholder .qr-grid {
  width: 160px;
  height: 160px;
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border-radius: 4px;
}

.qr-placeholder .scan-line {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  background: #07C160;
  border-radius: 2px;
  animation: scan 2s linear infinite;
  box-shadow: 0 0 10px #07C160;
}

@keyframes scan {
  0% { top: 10px; }
  50% { top: 180px; }
  100% { top: 10px; }
}

.login-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 12px;
}

/* ===== 首次登录学科选择 ===== */
.setup-page {
  max-width: 500px;
  margin: 40px auto;
  padding: 0 20px;
}

.setup-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.setup-card h2 {
  font-size: 20px;
  margin-bottom: 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
  border-color: var(--primary);
}

/* ===== 老师首页仪表盘 ===== */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.dashboard-card .icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.dashboard-card .info .label {
  font-size: 13px;
  color: var(--text-light);
}

.dashboard-card .info .value {
  font-size: 24px;
  font-weight: 800;
}

/* ===== 题库管理 ===== */
.question-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-group select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #fff;
  outline: none;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.search-box::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--text-light);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/></svg>") center / contain no-repeat;
}

.question-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s;
}

.question-item:hover {
  box-shadow: var(--shadow-lg);
}

.question-item .q-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.question-item .q-content {
  flex: 1;
}

.question-item .q-text {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.question-item .q-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.question-item .q-option {
  font-size: 12px;
  color: var(--text-medium);
  padding: 2px 8px;
  background: #F5F5F5;
  border-radius: 4px;
}

.question-item .q-option.correct {
  background: #E0F5F0;
  color: #2A9D8F;
  font-weight: 600;
}

.question-item .q-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.question-item .q-actions {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

/* ===== AI生成弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #F0F0F0;
}

.modal-body {
  padding: 24px;
}

.ai-gen-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.ai-gen-form .form-row {
  display: flex;
  gap: 12px;
}

.ai-gen-form .form-row > * {
  flex: 1;
}

.ai-loading {
  text-align: center;
  padding: 40px 20px;
}

.ai-loading .cat-loading {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.ai-loading .cat-loading svg {
  animation: bounce 0.8s ease-in-out infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.ai-loading p {
  color: var(--text-medium);
  font-size: 14px;
}

.ai-result-item {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.ai-result-item .ai-q-text {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
}

.ai-result-item .ai-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-result-item .ai-option {
  padding: 6px 10px;
  background: #F5F5F5;
  border-radius: 4px;
  font-size: 13px;
}

.ai-result-item .ai-option.correct {
  background: #E0F5F0;
  color: #2A9D8F;
  font-weight: 600;
}

.ai-result-item .ai-explanation {
  font-size: 12px;
  color: var(--text-light);
  background: #FAFAFA;
  padding: 8px;
  border-radius: 4px;
}

.ai-result-item .ai-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ===== 手动录入表单 ===== */
.manual-form .form-group {
  margin-bottom: 16px;
}

.manual-form .option-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.manual-form .option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  cursor: pointer;
}

.manual-form .option-letter input {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.manual-form .option-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ===== 班级码管理 ===== */
.classcode-card {
  background: linear-gradient(135deg, #4A90D9, #357ABD);
  border-radius: var(--radius-lg);
  padding: 28px;
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
}

.classcode-card .label {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.classcode-card .code {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 8px;
  margin-bottom: 8px;
}

.classcode-card .validity {
  font-size: 13px;
  opacity: 0.9;
}

.classcode-card .actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.classcode-card .actions button {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.classcode-card .actions button:hover {
  background: rgba(255,255,255,0.3);
}

.history-codes {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.history-codes h4 {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.history-code-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #F0F0F0;
  font-size: 13px;
}

.history-code-item:last-child {
  border-bottom: none;
}

.history-code-item .code-text {
  font-weight: 600;
  letter-spacing: 2px;
}

.history-code-item .status {
  font-size: 12px;
}

/* ===== 题集管理 ===== */
.question-set-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.question-set-item:hover {
  box-shadow: var(--shadow-lg);
}

.question-set-item .qs-info .qs-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.question-set-item .qs-info .qs-meta {
  font-size: 12px;
  color: var(--text-light);
}

.qs-checkbox-list {
  max-height: 400px;
  overflow-y: auto;
  margin: 16px 0;
}

.qs-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.qs-checkbox-item:hover {
  background: #F5F8FB;
}

.qs-checkbox-item.selected {
  background: #E3F0FF;
}

.qs-checkbox-item input {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ===== 课堂模式选择 ===== */
.class-start-page {
  max-width: 600px;
  margin: 0 auto;
}

.mode-selector {
  display: flex;
  gap: 16px;
  margin: 20px 0;
}

.mode-card {
  flex: 1;
  background: #fff;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-card:hover,
.mode-card.selected {
  border-color: var(--primary);
  background: #F0F7FF;
}

.mode-card .mode-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.mode-card .mode-name {
  font-weight: 700;
  font-size: 15px;
}

.mode-card .mode-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ===== 课堂端全屏布局 ===== */
.classroom {
  width: 100vw;
  height: 100vh;
  background: var(--bg-classroom);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
}

.classroom-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  height: 48px;
  flex-shrink: 0;
}

.classroom-top-bar .top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.classroom-top-bar .timer-display {
  font-size: 20px;
  font-weight: 800;
  font-family: "Courier New", monospace;
}

.classroom-top-bar .timer-display.urgent {
  color: var(--accent);
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.6; }
}

/* SnowycatBot 角色图片动画 */
@keyframes catPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.classroom-top-bar .controls {
  display: flex;
  gap: 8px;
}

.classroom-top-bar .controls button {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.classroom-top-bar .controls button:hover {
  background: rgba(255,255,255,0.25);
}

/* 学生答题区域容器 */
.student-areas {
  flex: 1;
  display: flex;
  gap: 4px;
  padding: 8px;
  align-items: stretch;
}

/* ===== V2 学生区域 ===== */
.student-area {
  flex: 1;
  background: #fff;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  transition: all 0.3s;
}

.student-area.reviewing {
  background: #F8F9FE;
}

.student-area.finished {
  background: linear-gradient(135deg, #F0F4FF, #E8F4FD);
  justify-content: center;
  align-items: center;
}

/* 状态栏（顶部，始终显示） */
.sa-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.sa-paper {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
}
.sa-progress {
  font-size: 12px;
  color: var(--text-medium);
  font-weight: 600;
}

/* 题目区 */
.sa-question {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  color: var(--text-dark);
  line-height: 1.5;
  flex-shrink: 0;
}

/* 选项 */
.sa-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex-shrink: 0;
}
.sa-options .option-btn {
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  color: var(--text-dark);
  text-align: center;
  transition: all 0.15s;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sa-options .option-btn:active {
  transform: scale(0.95);
}
.sa-options .option-btn:hover {
  border-color: var(--primary);
  background: #F0F6FF;
}

/* 个人倒计时 */
.sa-timer {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  font-family: "Courier New", monospace;
  margin-top: 6px;
  flex-shrink: 0;
}
.sa-timer.urgent {
  color: var(--accent);
  animation: pulse 0.5s ease-in-out infinite alternate;
}

/* 答题后结果区 */
.sa-result-badge {
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.sa-result-badge.correct {
  background: #E0F5F0;
  color: #2A9D8F;
}
.sa-result-badge.wrong {
  background: #FFEBEE;
  color: var(--accent);
}
.sa-your-answer {
  font-size: 12px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.sa-correct-answer {
  font-size: 13px;
  font-weight: 700;
  color: #2A9D8F;
  text-align: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.sa-explanation {
  font-size: 11px;
  color: var(--text-medium);
  line-height: 1.6;
  margin-bottom: 8px;
  flex: 1;
  overflow-y: auto;
  flex-shrink: 1;
}
.sa-next-btn {
  margin-top: auto !important;
  width: 100% !important;
  font-size: 14px !important;
  padding: 10px !important;
  flex-shrink: 0;
}

/* 个人成绩（finished状态） */
.sa-personal-result {
  text-align: center;
  padding: 16px;
}
.sa-trophy {
  font-size: 40px;
  margin-bottom: 8px;
}
.sa-final-score {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}
.sa-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.sa-stat {
  font-size: 11px;
  color: var(--text-medium);
}
.sa-stat-val {
  font-weight: 700;
  font-size: 13px;
}
.sa-stat-val.sa-correct { color: #2A9D8F; }
.sa-stat-val.sa-fast { color: var(--warning); }
.sa-stat-val.sa-wrong { color: var(--accent); }
.sa-stat-val.sa-timeout { color: #999; }
.sa-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* 单人模式居中 */
.student-areas.single .student-area {
  max-width: 50%;
  margin: 0 auto;
}

/* 底部猫猫状态栏 */
.classroom-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 24px;
  background: rgba(0,0,0,0.3);
  height: 72px;
  flex-shrink: 0;
}

.classroom-bottom-bar .cat-mascot {
  flex-shrink: 0;
}

.classroom-bottom-bar .status-text {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.classroom-bottom-bar .progress-text {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}

/* ===== 最终结算页 ===== */
.final-page {
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 20px;
  overflow-y: auto;
}

.final-page .title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 500px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.ranking-item .rank-icon {
  font-size: 28px;
}

.ranking-item .rank-name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

.ranking-item .rank-score {
  font-size: 24px;
  font-weight: 800;
  color: var(--warning);
}

.ranking-item.first {
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,215,0,0.05));
  border: 1px solid rgba(255,215,0,0.3);
}

.final-cat {
  margin: 16px 0;
}

.final-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.final-actions button {
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.final-actions .btn-primary {
  background: var(--primary);
  color: #fff;
}

.final-actions .btn-secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ===== 题目回顾 ===== */
.review-container {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.review-search {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  font-size: 14px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  outline: none;
  margin-bottom: 16px;
}

.review-search::placeholder {
  color: rgba(255,255,255,0.5);
}

.review-search:focus {
  border-color: var(--primary);
}

.review-item {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.review-item:hover {
  background: rgba(255,255,255,0.12);
}

.review-item .ri-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 4px;
}

.review-item .ri-question {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.review-item .ri-answer {
  font-size: 13px;
  color: var(--success);
  margin-bottom: 4px;
}

.review-item .ri-rate {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

.review-item .ri-explanation {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  display: none;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.review-item.expanded .ri-explanation {
  display: block;
}

/* ===== 课后练习端 ===== */
.practice-layout {
  min-height: 100vh;
  background: linear-gradient(135deg, #E3F0FF 0%, #F0F4F8 100%);
  display: flex;
  flex-direction: column;
}

.practice-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.practice-header .brand {
  font-size: 16px;
  font-weight: 700;
}

.practice-body {
  flex: 1;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* 班级码输入页 */
.code-entry-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 50px);
  padding: 20px;
}

.code-entry-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
  width: 100%;
  max-width: 380px;
}

.code-entry-box .logo {
  margin-bottom: 16px;
}

.code-entry-box h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.code-entry-box p {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.code-input-group {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
}

.code-input-group input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  outline: none;
}

.code-input-group input:focus {
  border-color: var(--primary);
}

.code-error {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 20px;
}

/* 练习选题页 */
.practice-select-page {
  padding: 20px;
}

.filter-section {
  margin-bottom: 20px;
}

.filter-section h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.filter-pill.active {
  border-color: var(--primary);
  background: #E3F0FF;
  color: var(--primary-dark);
}

/* 练习答题页 */
.practice-quiz-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.practice-progress {
  width: 100%;
  max-width: 500px;
  margin-bottom: 20px;
}

.progress-bar {
  height: 8px;
  background: #E0E0E0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.practice-question-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 500px;
  text-align: center;
}

.practice-question-card .pq-tags {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.practice-question-card .pq-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 24px;
}

.practice-question-card .pq-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practice-question-card .pq-option {
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  text-align: left;
  background: #fff;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.practice-question-card .pq-option:active {
  transform: scale(0.98);
}

.practice-question-card .pq-option .opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F0F0F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.practice-question-card .pq-option.selected {
  border-color: var(--primary);
  background: #E3F0FF;
}

.practice-question-card .pq-option.correct {
  border-color: var(--success);
  background: #E0F5F0;
}

.practice-question-card .pq-option.correct .opt-letter {
  background: var(--success);
  color: #fff;
}

.practice-question-card .pq-option.wrong {
  border-color: var(--accent);
  background: #FFEBEE;
}

.practice-question-card .pq-option.wrong .opt-letter {
  background: var(--accent);
  color: #fff;
}

.practice-feedback {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: left;
  display: none;
}

.practice-feedback.show {
  display: block;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.practice-feedback.correct {
  background: #E0F5F0;
  border: 1px solid var(--success);
}

.practice-feedback.wrong {
  background: #FFEBEE;
  border: 1px solid var(--accent);
}

.practice-feedback .feedback-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}

.practice-feedback .feedback-text {
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.6;
}

.practice-cat {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* 练习结果页 */
.practice-result-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 50px);
  padding: 20px;
}

.result-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
  width: 100%;
  max-width: 400px;
}

.result-card .result-cat {
  margin-bottom: 16px;
}

.result-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.result-card .score {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  margin: 12px 0;
}

.result-card .score-label {
  font-size: 14px;
  color: var(--text-light);
}

.result-stats {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.result-stats .stat-item {
  text-align: center;
}

.result-stats .stat-value {
  font-size: 24px;
  font-weight: 800;
}

.result-stats .stat-label {
  font-size: 12px;
  color: var(--text-light);
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* 错题列表 */
.wrong-questions-list {
  margin-top: 16px;
}

.wrong-question-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.wrong-question-item .wq-text {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.wrong-question-item .wq-answer {
  font-size: 13px;
  color: var(--success);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state .text {
  font-size: 14px;
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 9999;
  animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .entry-cards {
    flex-direction: column;
  }

  .teacher-header .nav {
    display: none;
  }

  .student-area .option-grid {
    grid-template-columns: 1fr 1fr;
  }

  .student-area .question-text {
    font-size: 12px;
  }

  .student-area .option-btn {
    font-size: 12px;
    padding: 10px 6px;
  }

  .classroom-top-bar {
    padding: 8px 12px;
  }

  .classroom-top-bar .timer-display {
    font-size: 16px;
  }
}

@media (min-width: 1920px) {
  .student-area .option-btn {
    font-size: 18px;
    padding: 20px 12px;
  }

  .student-area .question-text {
    font-size: 18px;
  }

  .student-area .student-label {
    font-size: 20px;
  }
}
