/* Playful Design System — 开心格 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&family=Noto+Sans+SC:wght@400;500;700;900&family=Fredoka:wght@500;600;700&display=swap');

/* 阿里巴巴普惠体 3.0 ExtraBold —— 仅用于派对游戏封面大标题（已子集化到标题字符，约 10KB） */
@font-face {
  font-family: 'AlibabaPuHuiTi';
  src: url('../fonts/AlibabaPuHuiTi-title.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

/* 派对游戏封面 · 共用组件（瞎掰人 / 谁是卧底 一致） */
.game-title-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.game-help-btn { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--dark); background: #fff; color: var(--dark);
  font-size: 0.8rem; font-weight: 900; line-height: 1; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; }
.game-help-btn:hover { transform: scale(1.12); }
.game-help-pop { text-align: left; background: var(--light); border: 2px solid var(--dark);
  border-radius: 12px; padding: 10px 12px; font-size: 0.85rem; line-height: 1.6;
  color: #5a6472; margin: 4px 0 12px; }
.game-help-pop b { color: var(--dark); }
.game-help-pop[hidden] { display: none; }


:root {
  --red: #FF5A5A;
  --blue: #4A90FF;
  --green: #00C853;
  --yellow: #FFD93D;
  --dark: #2C3E50;
  --light: #F5F7FA;
  --white: #FFFFFF;
  --purple: #A78BFA;
  --orange: #FF9234;
  /* Softer, friendlier success green for "answered correctly" states */
  --success: #2EB872;
  --success-soft: #E7F8EF;
  /* 拼音注音用标准灰黑色，避免浅蓝在白底/彩底上突兀 */
  --pinyin: #555555;
  --shadow: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background: var(--light);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout */
.container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(135deg, #4A90FF, #00C853);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header h1 .site-logo {
  height: 1.8em;
  width: 1.8em;
  object-fit: contain;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* 顶栏左侧：汉堡按钮 + 标题（汉堡仅手机端显示，桌面端不变） */
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.footer-ver { color: inherit; opacity: .8; letter-spacing: .3px; }
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 0;
  position: relative;
}
.nav-toggle span {
  position: absolute;
  left: 9px;
  right: 9px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}
.nav-toggle span:nth-child(1) { top: 12px; }
.nav-toggle span:nth-child(2) { top: 18.5px; }
.nav-toggle span:nth-child(3) { top: 25px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { top: 18.5px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { top: 18.5px; transform: rotate(-45deg); }

/* 抽屉遮罩 + 抽屉内关闭按钮（默认隐藏，手机端抽屉模式启用） */
.nav-backdrop { display: none; }
.sidebar-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: 1.7rem;
  line-height: 1;
  color: #98a0ac;
  cursor: pointer;
  z-index: 1;
}
.sidebar-close:hover { color: var(--dark); }

.header .username {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Header avatar + profile trigger */
.user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 14px 5px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s, transform 0.2s;
}

.user-profile-trigger:hover {
  background: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}

.user-profile-trigger:active {
  transform: translateY(0);
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  object-fit: cover;
  background: rgba(255,255,255,0.2);
}

/* Register avatar */
.register-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.register-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  object-fit: cover;
  background: var(--light);
}

.avatar-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: var(--light);
  cursor: pointer;
  color: var(--blue);
  transition: all 0.2s;
}

.avatar-refresh-btn:hover {
  background: var(--yellow);
  transform: translateY(-1px);
}

/* Profile modal */
.profile-modal {
  max-width: 400px;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  object-fit: cover;
  background: var(--light);
}

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

.profile-upload-btn {
  cursor: pointer;
}

.profile-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.profile-cancel-btn {
  color: var(--dark) !important;
  border-color: #ccc !important;
}

.profile-delete-btn {
  margin-left: auto;
  background: none;
  color: #aaa;
  border: none;
  font-size: 0.78rem;
  padding: 6px 12px;
}

.profile-delete-btn:hover {
  color: var(--red);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 26px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-primary {
  background: var(--red);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--blue);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-yellow {
  background: var(--yellow);
  color: var(--dark);
  box-shadow: var(--shadow);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,0.5);
}

/* Forms */
.form-card {
  background: var(--white);
  border: 2px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 40px;
  max-width: 420px;
  margin: 60px auto;
}

.form-card h2 {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 24px;
  letter-spacing: 1px;
  text-align: center;
}

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

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: var(--light);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,144,255,0.2);
}

.form-error {
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
}

.form-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
}

.form-link a {
  color: var(--blue);
  font-weight: 700;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: calc(100vh - 62px);
  overflow-x: hidden;
}

.sidebar {
  width: clamp(140px, 13vw, 200px);
  background: var(--white);
  color: var(--dark);
  padding: 24px 0;
  flex-shrink: 0;
  border-right: 2px solid #e0e0e0;
}

.sidebar-section {
  padding: 0 14px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.4;
  margin-bottom: 16px;
}
/* 第二个分区标题（如「挑战」）与上方课程区拉开间距 */
.sidebar-section-top {
  margin-top: 22px;
  border-top: 2px solid #f0f0f0;
  padding-top: 18px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 56px;
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-item:hover {
  background: var(--light);
}

.sidebar-item.active {
  background: linear-gradient(135deg, rgba(74,144,255,0.12), rgba(0,200,83,0.08));
  border-left-color: var(--blue);
  color: var(--dark);
}

/* 占位课程（如英语：敬请期待）—— 不可点、淡化 */
.sidebar-item-soon {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-icon { font-size: 1.4rem; }
.sidebar-zh { font-size: 0.95rem; }
.sidebar-en { font-size: 0.72rem; opacity: 0.55; margin-top: 2px; }

/* Sidebar group + submenu */
.sidebar-group .sidebar-item { position: relative; }
.sidebar-arrow {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
  border-radius: 6px;
  color: var(--dark);
  opacity: 0.45;
  cursor: pointer;
  transition: transform 0.25s, opacity 0.15s, background 0.15s;
}
.sidebar-arrow:hover { opacity: 0.9; background: rgba(0,0,0,0.06); }
.sidebar-group.open .sidebar-arrow { transform: rotate(180deg); }
.sidebar-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}
.sidebar-group.open .sidebar-submenu { max-height: 260px; }
.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 20px 8px 18px;
  min-height: 56px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--dark);
  opacity: 0.65;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border-left: 4px solid transparent;
}
.sidebar-subicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex-shrink: 0;
}
.sidebar-subitem:hover { opacity: 1; background: var(--light); }
.sidebar-subitem.active {
  opacity: 1;
  color: var(--blue);
  border-left-color: var(--blue);
  background: rgba(74,144,255,0.06);
}
.sidebar-subitem.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.coming-soon-tag {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--light);
  color: var(--dark);
  opacity: 0.7;
  margin-left: 4px;
  vertical-align: middle;
}

.main-content {
  flex: 1;
  padding: 20px 24px 48px;
  overflow-y: auto;
  position: relative;
  min-width: 0;
}

.main-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.page-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.page-mode-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--blue);
  border: 2px solid var(--blue);
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.header-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.difficulty-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #888;
  margin-right: 4px;
}

.diff-btn {
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: var(--light);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.diff-btn:hover:not(:disabled) { background: var(--yellow); }

.diff-btn.active {
  background: var(--dark);
  color: var(--light);
  border-color: var(--dark);
}

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

/* Score counts in panel header */
.progress-counts {
  display: flex;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--white);
  border: none;
}

.count-correct {
  background: var(--green);
  box-shadow: 0 2px 8px rgba(0, 200, 83, 0.4);
}

.count-wrong {
  background: var(--red);
  box-shadow: 0 2px 8px rgba(255, 90, 90, 0.4);
}

.count-pending {
  background: #bbb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Question Panel */
.question-panel {
  width: clamp(200px, 20vw, 300px);
  background: var(--white);
  border-left: 2px solid #e0e0e0;
  padding: 0 12px 24px;
  flex-shrink: 0;
  overflow-y: auto;
}

.panel-sticky-top {
  position: sticky;
  top: 0;
  background: var(--white);
  padding-top: 24px;
  padding-bottom: 12px;
  z-index: 10;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 0px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

.question-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 6px;
  padding-top: 4px;
}

.q-card {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid #ccc;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #eee;
  color: #999;
  border-radius: 8px;
}

.q-card:hover { transform: scale(1.08); box-shadow: var(--shadow-sm); }

/* Locked while the current round's fact card is unconfirmed — same visual language as .nav-arrow:disabled */
.question-cards.nav-locked .q-card {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.question-cards.nav-locked .q-card:hover { transform: none; box-shadow: none; }

.q-card.current {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue);
  color: var(--dark);
}

.q-card.correct {
  background: #00C853;
  color: var(--white);
  border-color: #00a844;
}

.q-card.wrong {
  background: var(--red);
  color: var(--white);
  border-color: #e55a5a;
}

/* Puzzle Toolbar */
.puzzle-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar-btns {
  display: flex;
  gap: 8px;
}

.nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid #e0e0e0;
  background: var(--white);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.nav-arrow:hover:not(:disabled) {
  background: var(--yellow);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nav-arrow:active:not(:disabled) {
  transform: translateY(0);
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-arrow-side {
  width: 48px;
  height: 48px;
  align-self: center;
}

.puzzle-main-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  max-width: 100%;
}

.puzzle-board-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.puzzle-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  text-align: center;
}

.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  background: var(--yellow);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.hint-btn svg {
  flex-shrink: 0;
}

.hint-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.hint-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.hint-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  cursor: pointer;
  animation: fadeIn 0.2s;
}

.hint-popup {
  background: var(--white);
  border: 2px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
}

.hint-popup img:not(.combined-hint-img) {
  width: 320px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: left top;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 14px;
}

.hint-popup p {
  font-weight: 700;
  color: var(--dark);
  font-size: 2rem;
}

/* Override for combined hint — prevent parent .hint-popup p from applying */
.combined-hint-popup .combined-hint-text {
  font-size: 1.1rem;
  font-weight: 400;
  color: #444;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Text popup — interactive step-by-step */
.text-popup {
  padding: 56px 80px;
  min-width: 420px;
  cursor: pointer;
  user-select: none;
}

.text-step {
  margin-bottom: 16px;
}

.text-step-animate {
  animation: textReveal 0.4s ease-out;
}

@keyframes textReveal {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.text-popup-zh {
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: 0.25em;
}

.text-popup-pinyin-ruby {
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: 0.25em;
}

.text-popup-pinyin-ruby ruby rt {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.5em;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: -0.02em;
}

.text-popup-en {
  font-size: 3.2rem;
  color: var(--red);
  margin-top: 16px;
  font-weight: 900;
  letter-spacing: 1px;
}

.text-tap-hint {
  font-size: 0.85rem;
  color: #aaa;
  margin-top: 16px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.text-step-hint {
  border-top: 1px dashed #ddd;
  padding-top: 14px;
  margin-top: 20px;
}

/* Puzzle Result Popup */
.puzzle-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  animation: fadeIn 0.2s;
}

.puzzle-result-modal {
  background: var(--white);
  border: 2px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  min-width: 260px;
}

.puzzle-result-icon {
  margin-bottom: 12px;
}

.puzzle-result-text {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.puzzle-result-modal.correct .puzzle-result-text {
  color: var(--success);
}

.puzzle-result-modal.wrong .puzzle-result-text {
  color: var(--red);
}

.puzzle-result-btn {
  min-width: 120px;
}

/* Game Area */
.game-container {
  text-align: center;
  padding: 12px 0;
}

/* Puzzle Grid */
.puzzle-board {
  display: inline-grid;
  gap: 4px;
  background: var(--dark);
  border: 4px solid var(--dark);
  border-radius: 8px;
  padding: 4px;
}

.puzzle-slot {
  background: var(--light);
  border: 2px dashed #aaa;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Faint position hint number (1..N) centered in each empty slot */
.slot-num {
  font-size: 0.95rem;
  font-weight: 800;
  color: #c2c8d0;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.puzzle-slot.filled {
  border: none;
  cursor: grab;
}

.puzzle-slot.filled .slot-num {
  display: none;
}

/* Solved & frozen — no grab cursor, nothing draggable */
.puzzle-board.locked .puzzle-slot,
.puzzle-board.locked .puzzle-slot.filled {
  cursor: default;
}

.puzzle-slot.dragging {
  opacity: 0.4;
}

.puzzle-slot.drag-over {
  background: var(--yellow);
  opacity: 0.7;
}

/* Puzzle Pieces */
.pieces-area {
  display: grid;
  align-content: start;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: var(--white);
  border: 2px solid #ddd;
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.pieces-area.all-placed {
  border-style: dashed;
  border-color: #ddd;
}

.pieces-area.all-placed::after {
  content: '拼图块已全部放置';
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px 0;
  color: #bbb;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.puzzle-piece {
  border: 2px solid var(--dark);
  border-radius: 4px;
  cursor: grab;
  transition: all 0.2s ease;
}

.puzzle-piece:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

.puzzle-piece.dragging {
  opacity: 0.5;
}

/* Spelling answer strip (拼词) — shows the word being built, in order, as the
   child taps correct letters out of the pool below. Display-only, no drag. */
.spelling-board {
  display: inline-flex;
  gap: 4px;
  background: var(--dark);
  border: 4px solid var(--dark);
  border-radius: 8px;
  padding: 4px;
}

.spelling-slot {
  width: 40px;
  height: 40px;
  background: var(--light);
  border: 2px dashed #aaa;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--dark);
  user-select: none;
  flex-shrink: 0;
}

.spelling-slot.filled {
  background: var(--white);
  border: 2px solid var(--dark);
}

/* Letter pool — scattered white letter chips over a colored plate. Tap in
   word order; a wrong tap is a free no-op (just shakes), no drag needed —
   built for beginners who only need to recognize the right letter. */
.letter-pool {
  position: relative;
  width: 100%;
  min-height: 160px;
  background: var(--blue);
  border-radius: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.letter-tile {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--white);
  color: var(--blue);
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15), var(--shadow-sm);
  transition: transform 0.15s ease, opacity 0.25s ease;
  user-select: none;
}

.letter-tile:hover {
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.08);
}

.letter-tile:active {
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.94);
}

.letter-tile.placed {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.4);
}

.letter-tile.shake {
  animation: letterShake 0.4s ease;
}

@keyframes letterShake {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); }
  25% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) translateX(-6px); }
  75% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) translateX(6px); }
}

.letter-pool.all-placed::after {
  content: '全部拼对啦！';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  pointer-events: none;
}

/* Quiz Section */
.quiz-section {
  background: var(--white);
  border: 2px solid #ddd;
  border-radius: 16px;
  padding: 30px;
  margin: 32px auto 28px;
  max-width: 85%;
  box-shadow: var(--shadow-sm);
}

.quiz-section h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

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

.quiz-option {
  padding: 18px 14px 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: var(--light);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.6;
}

.quiz-option:hover {
  background: var(--yellow);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.quiz-option:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.quiz-option.correct {
  background: var(--success);
  color: var(--white);
  border-color: #25a05f;
  animation: correctBounce 0.4s ease;
}

.quiz-option.wrong {
  background: var(--red);
  color: var(--white);
  border-color: #e55a5a;
  animation: gentleShake 0.4s ease;
}

/* 选中(对/错)时整块变彩底，拼音注音 + 英文一并转白，避免和背景色冲突 */
.quiz-option.correct ruby rt,
.quiz-option.wrong ruby rt,
.quiz-option.correct .quiz-option-en,
.quiz-option.wrong .quiz-option-en {
  color: var(--white);
}

@keyframes correctBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Result Card */
.result-card {
  background: var(--white);
  border: 2px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  margin: 32px auto 28px;
  max-width: 85%;
}

.result-flag {
  width: 300px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: left top;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.result-name {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.result-name-ruby {
  margin-bottom: 8px;
}

.result-pinyin {
  font-size: 1.1rem;
  color: var(--blue);
  font-weight: 600;
  margin-bottom: 4px;
}

.result-layout {
  display: flex;
  gap: 28px;
  text-align: left;
}

.result-left {
  flex: 1;
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-right {
  width: 35%;
  flex-shrink: 0;
  border-left: 2px solid #eee;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  width: 100%;
}

.result-actions .tts-btn {
  margin: 0;
}

.knowledge-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.5px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
  margin-bottom: 4px;
}

.knowledge-fact {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.8;
  display: inline;
}

.knowledge-fact-wrap {
  line-height: 1.8;
}

.knowledge-tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--blue);
  vertical-align: middle;
  margin-left: 4px;
  padding: 0;
  box-shadow: none;
}

.knowledge-tts-btn:hover {
  color: var(--red);
}

.knowledge-img {
  width: 100%;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  object-fit: cover;
  object-position: left top;
  aspect-ratio: 3 / 2;
}

.knowledge-loading,
.knowledge-empty {
  font-size: 0.85rem;
  color: #aaa;
  text-align: center;
  padding: 20px 0;
}

/* Interactive "tap to hear a fun fact" reveal */
.knowledge-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 18px 16px;
  margin-top: 4px;
  border: 2px dashed var(--blue);
  border-radius: 12px;
  background: rgba(74, 144, 255, 0.06);
  color: var(--blue);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s;
  animation: knowledgePulse 1.8s ease-in-out infinite;
}

.knowledge-reveal:hover {
  background: var(--blue);
  color: var(--white);
  border-style: solid;
}

.knowledge-reveal-spk {
  display: inline-flex;
}

@keyframes knowledgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.knowledge-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.knowledge-body-animate {
  animation: knowledgeFadeIn 0.35s ease;
}

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

/* "下一面" gated until the kid taps to hear the fun fact */
.btn-locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn-ready {
  animation: nextReady 1.6s ease-in-out 2;
}

@keyframes nextReady {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(46, 184, 114, 0.35); }
}

.result-english {
  font-size: 3rem;
  font-weight: 900;
  color: var(--red);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

/* Highlight difficult Chinese characters */
.char-hard {
  color: var(--red);
}

/* Ruby pinyin — shared styles */
ruby {
  ruby-align: center;
  letter-spacing: 0.15em;
}

ruby rt {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.5em;
  color: var(--pinyin);
  font-weight: 600;
  letter-spacing: -0.02em;
  padding-bottom: 5px;
}

.ruby-fallback {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.ruby-fallback .ruby-pinyin {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6em;
  color: var(--pinyin);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Quiz option ruby */
.quiz-option-ruby {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  display: block;
  margin-bottom: 4px;
}

.quiz-option-ruby ruby rt {
  font-size: 0.6em;
}

.quiz-option-en {
  display: block;
  font-size: 1.5rem;
  color: var(--blue);
  font-weight: 600;
  margin-top: 0;
  letter-spacing: 0.5px;
}

/* Result card ruby */
.result-ruby {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.result-ruby ruby rt {
  font-size: 0.6em;
}

.result-name-ruby {
  margin-bottom: 8px;
}

/* TTS Button */
.tts-btn {
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  margin: 12px auto;
  transition: all 0.2s ease;
}

.tts-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.tts-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Admin Tabs */
.admin-tab {
  padding: 10px 24px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  color: #888;
  margin-bottom: -3px;
  transition: all 0.2s;
  border-radius: 8px 8px 0 0;
}

.admin-tab:hover { color: var(--dark); }

.admin-tab.active {
  color: var(--dark);
  border-bottom-color: var(--blue);
}

.tab-content { }

/* Admin */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-table th, .admin-table td {
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: var(--dark);
  color: var(--light);
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 0.8rem;
}

.admin-table img {
  width: 48px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

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

.modal {
  background: var(--white);
  border: 2px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 480px;
}

.modal h3 {
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

/* 个人邀请码展示框 */
.invite-code-box {
  display: flex;
  align-items: center;
  background: var(--light);
  border: 2px dashed var(--blue);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--blue);
  font-family: 'Segoe UI', monospace;
}
/* 老用户一次性自定义邀请码的输入行 */
.invite-code-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}
.invite-code-edit input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 2px dashed var(--blue);
  border-radius: 10px;
  background: var(--light);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--blue);
  font-family: 'Segoe UI', monospace;
  outline: none;
}
.invite-code-edit .btn { flex-shrink: 0; }
.invite-code-hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--dark);
  opacity: 0.7;
  line-height: 1.4;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 27px;
  background: var(--light);
  border: 2px solid #e0e0e0;
  margin-bottom: 0;
  border-radius: 14px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A90FF, #00C853);
  transition: width 0.4s ease;
  border-radius: 12px;
}

/* Responsive */
@media (max-width: 960px) {
  .app-layout {
    flex-direction: column;
  }
  /* 手机端：导航收成左上角汉堡 + 左滑抽屉，正文占满宽度 */
  .nav-toggle { display: inline-flex; }
  .sidebar-close { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 268px;
    max-width: 82vw;
    z-index: 120;
    padding: 18px 0;
    border-right: 2px solid #e0e0e0;
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.16);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 26, 38, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 110;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .question-panel {
    width: 100%;
    border-left: none;
    border-top: 2px solid #e0e0e0;
    padding-top: 0;
  }
  .panel-sticky-top {
    position: static;
  }
  .question-cards {
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  }
}

@media (max-width: 640px) {
  .puzzle-main-row {
    flex-direction: column;
    align-items: center;
  }
  .pieces-area {
    width: auto;
  }
  .quiz-options {
    grid-template-columns: 1fr;
  }
  .form-card {
    margin: 20px 10px;
    padding: 24px;
  }
  /* 手机端：顶栏两侧 padding 收紧，汉堡更靠左、退出更靠右 */
  .header { padding-left: 12px; padding-right: 12px; }
  .header h1 {
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  /* 手机端顶栏空间紧：名字省略，保留可点头像（点头像看资料/邀请码） */
  .header .username { display: none; }
  .header-actions { gap: 8px; }
  .user-profile-trigger { padding: 4px; }
  .main-header-row {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .main-content {
    padding: 16px;
  }
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  font-weight: 700;
  font-size: 1.1rem;
}

/* Combined hint popup (text description + image reveal) */
.combined-hint-popup {
  max-width: 360px;
  padding: 20px 24px;
  cursor: default;
  text-align: left;
}

.combined-hint-text {
  font-size: 1.1rem;
  font-weight: 400;
  color: #444;
  line-height: 1.5;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.combined-hint-tts {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 2px solid var(--blue);
  background: rgba(74,144,255,0.08);
  cursor: pointer;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 14px;
  margin-bottom: 14px;
  border-radius: 20px;
  box-shadow: none;
  transition: all 0.15s;
}

.combined-hint-tts:hover {
  background: var(--blue);
  color: var(--white);
}

.combined-hint-img-area {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.combined-hint-img-area.revealed {
  border: none;
}

.combined-hint-img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: left top;
}

.combined-hint-img-cover {
  position: absolute;
  inset: 0;
  background: var(--light);
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  transition: opacity 0.3s;
}

.combined-hint-img-cover span {
  font-size: 0.78rem;
  font-weight: 500;
  color: #aaa;
  letter-spacing: 0.3px;
}

.combined-hint-img-cover:hover {
  border-color: var(--blue);
}

.combined-hint-img-cover:hover span { color: var(--blue); }

.combined-hint-img-cover.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Reset button in panel header */
.reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  background: var(--light);
  cursor: pointer;
  color: #999;
  padding: 0;
  transition: all 0.2s;
  margin-left: 8px;
}

.reset-btn:hover {
  background: var(--yellow);
  color: var(--dark);
  border-color: var(--yellow);
  transform: translateY(-1px);
}

/* Site Footer — 备案页脚 · 极简基线(透明、居中、窄屏自动换行) */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px 14px;
  flex-wrap: wrap;
  padding: 14px 24px 16px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(27, 31, 46, 0.42);   /* 主题墨色 #1B1F2E @ 42%，低调不刺眼 */
  background: transparent;          /* 无背景条，融入页面 */
  margin-top: auto;                 /* 内容不足时仍贴底 */
}

.footer-copyright { white-space: nowrap; }

.footer-sep {
  width: 1px;
  height: 12px;
  background: rgba(27, 31, 46, 0.15);
}

.footer-beian {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-beian:hover {
  color: #4A8DFF;                   /* 主题蓝，hover 提示可点击 */
  text-decoration: underline;
}

/* Daily challenge (game/swchallenge) */
.bonus-page-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.bonus-hint {
  text-align: center;
  font-weight: 700;
  color: #666;
  margin-bottom: 20px;
}

.bonus-card {
  background: var(--card-bg, #fff);
  border: 3px solid var(--dark);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 6px 6px 0 var(--dark);
}

.bonus-card-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.bonus-question {
  font-size: 1.1rem;
  line-height: 1.55;
  margin: 0 0 24px;
  font-weight: 600;
}

.bonus-form {
  margin-bottom: 8px;
}

.bonus-success-title {
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0 0 8px;
}

.bonus-qr-note {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.45;
  margin: 0 0 16px;
}

.bonus-qr {
  text-align: center;
  margin-bottom: 12px;
}

.bonus-qr img {
  max-width: min(260px, 100%);
  height: auto;
  border: 3px solid var(--dark);
  border-radius: 8px;
}

.bonus-no-qr {
  font-size: 0.9rem;
  color: #888;
  text-align: center;
}

.bonus-footnote {
  margin: 20px 0 0;
  font-size: 0.78rem;
  color: #888;
  text-align: center;
}

.bonus-question-media {
  margin: 16px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}

.bonus-question-img {
  max-width: min(100%, 420px);
  height: auto;
  border: 3px solid var(--dark);
  border-radius: 8px;
}

.bonus-question-vid {
  max-width: min(100%, 480px);
  max-height: 280px;
  border: 3px solid var(--dark);
  border-radius: 8px;
  background: #000;
}

.bonus-video-embed-wrap {
  width: 100%;
  max-width: 640px;
}

.bonus-question-iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--dark);
  border-radius: 8px;
  background: #000;
}

/* Admin: 活动开关滑块 */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cfd8dc;
  border: 3px solid var(--dark);
  border-radius: 28px;
  transition: background 0.2s, box-shadow 0.2s;
}

.switch .slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background: var(--white);
  border: 2px solid var(--dark);
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + .slider {
  background: var(--green);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.switch input:focus-visible + .slider {
  box-shadow: 0 0 0 3px rgba(74, 144, 255, 0.45);
}

/* Admin: sidebar + main (align with game flag / swchallenge) */
.admin-app-layout {
  display: flex;
  min-height: calc(100vh - 62px);
  align-items: stretch;
  background: var(--light);
}

.admin-sidebar {
  width: clamp(200px, 24vw, 280px);
  flex-shrink: 0;
  background: var(--white);
  border-right: 2px solid #e0e0e0;
  padding: 20px 0 32px;
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
  background: #fafbfc;
}

button.admin-side-nav.sidebar-item {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
  margin: 0;
}

@media (max-width: 900px) {
  .admin-app-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 2px solid #e0e0e0;
  }
}

/* Hidden */
.hidden { display: none !important; }

/* =====================================================================
   Login Page — Playful Pop
   ===================================================================== */
.popA {
  --pop-primary: #4A8DFF;
  --pop-primary-dark: #2E5FB8;
  --pop-accent: #FFC83D;
  --pop-accent-dark: #C99622;
  --pop-green: #2BBF7C;
  --pop-green-dark: #1C8757;
  --pop-coral: #FF6B6B;
  --pop-coral-dark: #C24545;
  --pop-bg: #FFF6E3;
  --pop-ink: #1B1F2E;
  --pop-glow1: #FFD84D44;
  --pop-glow2: #6BB1FF33;
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  font-feature-settings: "palt" 1;
  background: var(--pop-bg);
}
.popA::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, var(--pop-glow1) 0, transparent 28%),
    radial-gradient(circle at 78% 78%, var(--pop-glow2) 0, transparent 30%);
  pointer-events: none;
}

.popA button { font-family: inherit; cursor: pointer; border: none; }
.popA input { font-family: inherit; }
.popA input:focus { outline: none; }

/* Floating decorative shapes ------------------------------------------ */
.popA .sparkle {
  position: absolute;
  width: 24px; height: 24px;
  background: var(--pop-accent);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  pointer-events: none;
  z-index: 0;
}
.popA .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
  z-index: 0;
}

/* Left column — brand --------------------------------------------------- */
.popA .left {
  flex: 1.15;
  padding: 44px 56px 40px;
  position: relative;
  display: flex;
  flex-direction: column;
  z-index: 1;
}
.popA .crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--pop-ink);
  color: var(--pop-accent);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  width: fit-content;
  margin-bottom: 28px;
  font-family: "Fredoka", "Noto Sans SC", sans-serif;
}
.popA .crumb .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 4px #4ADE8033;
}
.popA h1 {
  font-size: 108px;
  line-height: 0.95;
  margin: 0 0 14px;
  font-weight: 900;
  color: var(--pop-ink);
  letter-spacing: -0.04em;
  position: relative;
}
.popA h1 .wink {
  display: inline-block;
  background: var(--pop-accent);
  color: var(--pop-ink);
  padding: 10px 16px;
  border-radius: 22px;
  transform: rotate(-3deg);
  box-shadow: 6px 6px 0 var(--pop-ink);
  line-height: 1;
}
.popA .sub {
  font-size: 28px;
  font-weight: 700;
  color: var(--pop-ink);
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
}
.popA .sub-en {
  font-family: "Fredoka", sans-serif;
  font-size: 13px;
  color: var(--pop-ink);
  opacity: 0.6;
  letter-spacing: 0.32em;
  font-weight: 600;
}
/* 两条学习线（学国旗 / 学英语）—— 兼作首页卖点展示 */
.popA .courses {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;
  padding-top: 36px;
  width: 100%;
  max-width: 440px;
}
.popA .course-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 3px solid var(--pop-ink);
  border-radius: 22px;
  padding: 14px 18px;
  box-shadow: 6px 6px 0 var(--pop-ink);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.popA .course-card:hover { transform: translateY(-3px); }
.popA .course-ic {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2.5px solid var(--pop-ink);
}
.popA .course-flag .course-ic { background: var(--pop-primary); }
.popA .course-en .course-ic { background: var(--pop-coral); }
.popA .course-meta { display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0; }
.popA .course-title { font-size: 22px; font-weight: 900; color: var(--pop-ink); line-height: 1.1; }
.popA .course-desc {
  font-size: 12.5px;
  font-weight: 600;
  color: color-mix(in oklab, var(--pop-ink) 58%, transparent);
}
.popA .course-soon {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--pop-coral-dark);
  background: #FFE2D6;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
}
.popA .course-en { opacity: 0.94; }

/* Right column — login card ------------------------------------------- */
.popA .right {
  flex: 1;
  padding: 56px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}
.popA .card {
  background: white;
  border-radius: 36px;
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  box-shadow: 12px 12px 0 var(--pop-ink);
  border: 3px solid var(--pop-ink);
  position: relative;
}
.popA .mascot {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  width: 76px;
  height: 76px;
  background: var(--pop-accent);
  border: 3px solid var(--pop-ink);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 0 var(--pop-ink);
}
.popA .mascot::before,
.popA .mascot::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  background: var(--pop-ink);
  border-radius: 50%;
  top: 24px;
}
.popA .mascot::before { left: 18px; }
.popA .mascot::after  { right: 18px; }
.popA .mascot .smile {
  position: absolute;
  bottom: 18px;
  width: 24px; height: 12px;
  border: 3px solid var(--pop-ink);
  border-top: none;
  border-radius: 0 0 24px 24px;
}
.popA .card h2 {
  font-size: 32px;
  font-weight: 900;
  color: var(--pop-ink);
  margin: 16px 0 6px;
  text-align: center;
}
.popA .card .tag {
  text-align: center;
  color: var(--pop-ink);
  opacity: 0.6;
  margin-bottom: 28px;
  font-size: 14px;
  font-weight: 500;
}
.popA .field { margin-bottom: 18px; }
.popA .field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--pop-ink);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.popA .field .inp {
  display: flex;
  align-items: center;
  background: var(--pop-bg);
  border: 2.5px solid var(--pop-ink);
  border-radius: 16px;
  padding: 0 16px;
  height: 56px;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.popA .field .inp:focus-within { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--pop-ink); }
.popA .field input {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--pop-ink);
  min-width: 0;
}
.popA .field input::placeholder {
  color: color-mix(in oklab, var(--pop-ink) 35%, transparent);
  font-weight: 500;
}
.popA .field .icn { display: flex; align-items: center; }
.popA .field .icn.eye { margin-left: auto; cursor: pointer; opacity: 0.4; transition: opacity 0.15s; }
.popA .field .icn.eye.on { opacity: 1; }

.popA .form-error {
  min-height: 18px;
  color: var(--pop-coral);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.popA .cta {
  width: 100%;
  height: 60px;
  background: var(--pop-primary);
  color: white;
  border-radius: 18px;
  font-size: 20px;
  font-weight: 900;
  border: 2.5px solid var(--pop-ink);
  box-shadow: 0 6px 0 var(--pop-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.popA .cta:hover  { transform: translateY(2px); box-shadow: 0 4px 0 var(--pop-ink); }
.popA .cta:active { transform: translateY(6px); box-shadow: 0 0 0 var(--pop-ink); }

.popA .alt {
  text-align: center;
  font-size: 13px;
  color: color-mix(in oklab, var(--pop-ink) 65%, transparent);
  margin-top: 18px;
  font-weight: 500;
}
.popA .alt a {
  color: var(--pop-primary);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 2px solid var(--pop-primary);
}

/* 备案信息(从页面底部移入登录卡内)；复用 footer-copyright/sep/beian 样式 */
.popA .card-beian {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(27, 31, 46, 0.08);
  font-size: 11px;
  font-weight: 500;
  color: rgba(27, 31, 46, 0.42);
  line-height: 1.5;
}

/* 登录页：整屏自适应，电脑/手机都不滚动 */
/* 登录页底色与 popA 内容一致(桌面米色/手机白),透明页脚才能无缝融入 */
body.auth-screen { height: 100dvh; min-height: 100dvh; overflow: hidden; background: #FFF6E3; }
body.auth-screen .popA { flex: 1; min-height: 0; }
body.auth-screen .site-footer {
  flex-shrink: 0;
  padding: 7px 16px;
  font-size: 0.64rem;
  gap: 6px;
}

/* Responsive ---------------------------------------------------------- */
@media (max-width: 1080px) {
  .popA h1 { font-size: 92px; }
  .popA .left { padding: 40px 36px 32px; }
  .popA .right { padding: 36px; }
  .popA .course-ic { width: 50px; height: 50px; }
  .popA .course-title { font-size: 20px; }
}

@media (max-width: 860px) {
  .popA { flex-direction: column; overflow-y: auto; background: #fff; }
  /* 手机端登录页：纯白背景 + 去掉渐变光晕/装饰光斑(页脚已全局透明,自动融入白底) */
  body.auth-screen { background: #fff; }
  .popA::before { display: none; }
  .popA .blob,
  .popA .sparkle { display: none; }
  .popA .left { flex: none; padding: 28px 24px 18px; align-items: center; text-align: center; }
  .popA .crumb { margin-left: auto; margin-right: auto; margin-bottom: 16px; }
  .popA h1 { font-size: 60px; margin-bottom: 8px; }
  /* 手机端更简洁：隐藏课程卡、标语与吉祥物，只保留品牌标题 + 登录卡 */
  .popA .sub,
  .popA .sub-en,
  .popA .courses,
  .popA .mascot { display: none; }
  .popA .right { flex: none; padding: 24px 22px 18px; }
  .popA .card { box-shadow: 8px 8px 0 var(--pop-ink); }
}

@media (max-width: 480px) {
  .popA .left { padding: 18px 18px 8px; }
  .popA .crumb { margin-bottom: 10px; }
  .popA h1 { font-size: 46px; }
  .popA .right { padding: 22px 20px 14px; }
  .popA .card { padding: 26px 20px 18px; border-radius: 26px; }
  .popA .card h2 { font-size: 22px; margin: 6px 0 4px; }
  .popA .card .tag { margin-bottom: 14px; font-size: 13px; }
  .popA .field { margin-bottom: 11px; }
  .popA .field .inp { height: 50px; }
  .popA .cta { height: 50px; font-size: 18px; margin-top: 4px; }
  .popA .alt { margin-top: 12px; }
}

/* 矮屏手机(如 iPhone SE 667 / 横向矮窗)：进一步压缩，确保整屏不滚动 */
@media (max-width: 860px) and (max-height: 700px) {
  .popA .left { padding: 10px 18px 6px; }
  .popA .crumb { margin-bottom: 8px; padding: 5px 12px; font-size: 11px; }
  .popA h1 { font-size: 36px; }
  .popA .right { padding: 16px 20px 8px; }
  .popA .card { padding: 22px 18px 14px; }
  .popA .card h2 { font-size: 19px; margin: 4px 0 2px; }
  .popA .card .tag { margin-bottom: 10px; font-size: 12px; }
  .popA .field { margin-bottom: 8px; }
  .popA .field label { margin-bottom: 5px; }
  .popA .field .inp { height: 46px; }
  .popA .cta { height: 46px; margin-top: 4px; }
  .popA .alt { margin-top: 8px; }
}

/* ══════════════ 竞赛模式 (contest) ══════════════ */
.new-tag {
  display: inline-block;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--red);
  color: var(--white);
  margin-left: 4px;
  vertical-align: middle;
}

.page-mode-tag.contest-tag {
  color: var(--success);
  border-color: var(--success);
}

.contest-wrap {
  max-width: 760px;
  margin: 0 auto;
}

.contest-view.hidden { display: none; }

.contest-card {
  background: var(--white);
  border: 2px solid #e8ebf0;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.07);
  padding: 32px;
}

/* ── 开始页 ── */
.contest-intro-card { text-align: center; }
.contest-intro-title { font-size: 1.6rem; font-weight: 900; margin-bottom: 10px; }
.contest-intro-desc { color: #667; font-size: 0.95rem; line-height: 1.7; margin-bottom: 22px; }

/* 像素奖杯样式见 css/pixel.css（.pixel-trophy） */
.contest-trophy-slot { margin-bottom: 10px; }

/* 设置摘要 + 齿轮按钮 */
.contest-setup-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.contest-setup-summary {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--dark);
  background: var(--light);
  border: 2px solid #e8ebf0;
  border-radius: 20px;
  padding: 6px 14px;
}
.contest-gear-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue);
  background: rgba(74,144,255,0.08);
  border: 2px solid var(--blue);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s;
}
.contest-gear-btn:hover { background: var(--blue); color: var(--white); }

.contest-config-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.contest-config-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark);
  flex-shrink: 0;
}
.contest-opt-row { display: flex; gap: 8px; }
.contest-opt {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border: 2px solid #e0e4ea;
  border-radius: 10px;
  background: var(--light);
  color: var(--dark);
  cursor: pointer;
  transition: all 0.15s;
}
.contest-opt:hover { border-color: var(--blue); }
.contest-opt.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.contest-start-btn { min-width: 200px; font-size: 1.05rem; padding: 14px 28px; }
.contest-error { color: var(--red); font-size: 0.85rem; min-height: 1.2em; margin-top: 10px; }

/* ── 配置弹窗 ── */
.contest-config-modal { max-width: 420px; }
.contest-config-modal .contest-config-group:last-of-type { margin-bottom: 8px; }
.contest-reward-row { padding-top: 4px; }
.contest-config-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

/* 开关 */
.contest-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.contest-switch input { display: none; }
.contest-switch-slider {
  position: relative;
  width: 42px;
  height: 24px;
  background: #cfd6e0;
  border-radius: 14px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.contest-switch-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.contest-switch input:checked + .contest-switch-slider { background: var(--success); }
.contest-switch input:checked + .contest-switch-slider::after { transform: translateX(18px); }
.contest-switch-text { font-size: 0.85rem; font-weight: 700; color: var(--dark); }

.contest-history { margin-top: 28px; border-top: 2px solid #eef0f4; padding-top: 18px; }
.contest-history-title { font-size: 0.8rem; font-weight: 700; color: #889; letter-spacing: 0.5px; margin-bottom: 10px; }
.contest-history-list { display: flex; flex-direction: column; gap: 6px; }
.contest-history-item {
  display: flex; align-items: center; gap: 12px;
  justify-content: center;
  font-size: 0.85rem;
}
.contest-history-score { font-weight: 800; }
.contest-history-score.good { color: var(--success); }
.contest-history-score.mid { color: var(--orange); }
.contest-history-score.low { color: var(--red); }
.contest-history-meta { color: #aab; font-size: 0.78rem; }

/* ── 答题页 ── */
.contest-exambar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.contest-progress { font-size: 0.95rem; font-weight: 800; color: var(--dark); }
.contest-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
  background: rgba(74,144,255,0.1);
  padding: 5px 12px;
  border-radius: 20px;
  transition: all 0.2s;
}
.contest-timer.urgent {
  color: var(--red);
  background: rgba(255,90,90,0.12);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.contest-progress-track {
  height: 8px;
  background: #eef0f4;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.contest-progress-fill {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 8px;
  transition: width 0.3s ease;
}

.contest-question-card { text-align: center; }
.contest-flag {
  width: 320px;
  max-width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: left top;
  border: 2px solid #e0e4ea;
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.contest-question-hint { font-size: 1.1rem; font-weight: 700; margin-bottom: 18px; }

.contest-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.contest-option {
  padding: 16px 14px;
  font-family: inherit;
  border: 2px solid #e0e4ea;
  border-radius: 12px;
  background: var(--light);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
  text-align: center;
  line-height: 1.5;
}
.contest-option:hover { background: var(--yellow); transform: translateY(-2px); }
.contest-option.chosen {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
  transform: scale(1.02);
}
.contest-option.chosen .contest-option-en { color: rgba(255,255,255,0.85); }
.contest-option.chosen ruby rt { color: var(--white); }
.contest-option-ruby { display: block; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.15em; }
.contest-option-en { display: block; font-size: 1rem; font-weight: 600; color: var(--pinyin); margin-top: 2px; }

/* ── 成绩页（百分制 + 星星 + 红包，儿童风） ── */
.contest-result-card { text-align: center; }

.contest-stars { margin-bottom: 6px; }
.contest-star {
  font-size: 2.2rem;
  color: #e0e4ea;
  margin: 0 2px;
  display: inline-block;
}
.contest-star.on {
  color: var(--yellow);
  text-shadow: 0 2px 0 #E0A21A;
  animation: starPop 0.4s ease backwards;
}
.contest-star.on:nth-child(1) { animation-delay: 0.05s; }
.contest-star.on:nth-child(2) { animation-delay: 0.18s; }
.contest-star.on:nth-child(3) { animation-delay: 0.31s; }
@keyframes starPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  70% { transform: scale(1.3) rotate(8deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.contest-scorebig {
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--success);
}
.contest-score-pct { font-size: 4.2rem; letter-spacing: 1px; }
.contest-score-unit { font-size: 1.6rem; margin-left: 2px; }
.contest-score-detail { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.contest-result-sub { color: #667; font-size: 0.95rem; margin-bottom: 20px; }

/* 红包奖励 */
.contest-reward {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.redpacket {
  position: relative;
  width: 96px;
  height: 116px;
  background: linear-gradient(160deg, #FF5A5A, #E63946);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(230,57,70,0.35);
  animation: rewardPop 0.5s ease backwards;
}
@keyframes rewardPop {
  0% { transform: scale(0.3) translateY(20px); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.redpacket-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 46px;
  background: linear-gradient(160deg, #FF7A7A, #FF5A5A);
  border-radius: 10px 10px 50% 50% / 10px 10px 38px 38px;
  border-bottom: 3px solid rgba(0,0,0,0.08);
}
.redpacket-coin {
  position: absolute;
  top: 38px; left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  background: radial-gradient(circle at 35% 30%, #FFE899, #FFC72C);
  border: 3px solid #E0A21A;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  color: #B8860B;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  z-index: 2;
}
.redpacket.locked { filter: grayscale(0.9); opacity: 0.7; box-shadow: none; animation: none; }
.contest-reward-text { font-size: 1rem; font-weight: 700; color: var(--red); }
.contest-reward-text b { color: var(--red); }

.contest-result-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 8px; }

.contest-review { margin-top: 24px; border-top: 2px solid #eef0f4; padding-top: 18px; text-align: left; }
.contest-review-title { font-size: 0.8rem; font-weight: 700; color: #889; letter-spacing: 0.5px; margin-bottom: 12px; }
.contest-review-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
}
.contest-review-item.is-wrong { background: rgba(255,90,90,0.06); }
.contest-review-flag {
  width: 54px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: left top;
  border: 1px solid #e0e4ea;
  border-radius: 5px;
  flex-shrink: 0;
}
.contest-review-info { min-width: 0; }
.contest-review-name { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.contest-review-en { font-weight: 500; color: var(--pinyin); font-size: 0.85rem; }
.contest-review-mark { font-weight: 900; }
.contest-review-mark.ok { color: var(--success); }
.contest-review-mark.no { color: var(--red); }
.contest-review-wrong { font-size: 0.78rem; color: var(--red); }
.contest-review-empty { color: #aab; font-size: 0.85rem; text-align: center; padding: 8px 0; }

@media (max-width: 640px) {
  .contest-card { padding: 22px 16px; }
  .contest-config-group { flex-direction: column; align-items: stretch; gap: 8px; }
  .contest-opt-row { justify-content: space-between; }
  .contest-opt { flex: 1; }
  .contest-option-ruby { font-size: 1.2rem; }
  .contest-option-en { font-size: 0.9rem; }
  .contest-score-pct { font-size: 3.2rem; }
  .contest-reward-row { flex-direction: row; align-items: center; }
}
