/* ============================================================
   学习大冒险 🎮 Summer Adventure — Styles
   沪教版英语 + 北师大数学 双主题
   ============================================================ */

/* --- Variables --- */
:root {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f2;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font: -apple-system, 'PingFang SC', 'Helvetica Neue', 'Noto Sans SC', sans-serif;
  --en-primary: #7C5CBF;
  --en-light: #A78BDB;
  --en-gradient: linear-gradient(135deg, #7C5CBF, #5A3D9E);
  --en-bg: linear-gradient(135deg, rgba(124,92,191,0.12), rgba(124,92,191,0.04));
  --math-primary: #E67E22;
  --math-light: #F0B27A;
  --math-gradient: linear-gradient(135deg, #E67E22, #D35400);
  --math-bg: linear-gradient(135deg, rgba(230,126,34,0.12), rgba(230,126,34,0.04));
  --success: #27AE60;
  --danger: #E74C3C;
  --warning: #F39C12;
}

/* --- Reset --- */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { height:100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Background decoration --- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,92,191,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(230,126,34,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* --- Page container --- */
.page {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 20px;
  animation: fadeIn .3s ease;
}
.page.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

.container {
  max-width: 480px;
  margin: 0 auto;
}

/* --- Typography --- */
h1 { font-size: 28px; font-weight: 800; letter-spacing: 1px; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
.subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }

/* --- PIN 输入框 --- */
.pin-input {
  width: 100%;
  max-width: 220px;
  text-align: center;
  font-size: 22px;
  letter-spacing: 6px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}
.pin-input:focus {
  border-color: var(--en-light);
}
.pin-input::placeholder {
  font-size: 14px;
  letter-spacing: 0;
  font-weight: 400;
  font-family: var(--font);
}

/* --- User Card (头像+星星+成绩 一体框) --- */
.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.user-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.user-card-header .avatar { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; font-size: 24px; cursor: pointer; flex-shrink: 0; }
.user-card-header .user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}
.user-card-header:active { opacity: .7; }
.header-stats-inline {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.header-calendar-link {
  font-size: 12px;
  color: var(--en-primary);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid rgba(124,92,191,0.3);
  border-radius: 12px;
  background: rgba(124,92,191,0.06);
  transition: .2s;
}
.header-calendar-link:active { transform: scale(.95); background: rgba(124,92,191,0.12); }
.user-card-stats {
  display: flex;
  gap: 4px;
  padding-top: 12px;
}
.user-stat-item {
  flex: 1;
  text-align: center;
}
.user-stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}
.user-stat-value.high { color: #27AE60; }
.user-stat-value.mid { color: #F39C12; }
.user-stat-value.low { color: #E74C3C; }
.user-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.user-card-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 20px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: .2s;
}
.header .user-badge:active { transform: scale(.97); }
.header .user-badge .avatar { font-size: 20px; }
.header .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
  text-decoration: none;
}
.header .back-btn:active { transform: scale(.97); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  color: #fff;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--en-gradient); }
.btn-math { background: var(--math-gradient); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-block { width: 100%; display: flex; }

/* --- Input --- */
.input {
  width: 100%;
  padding: 14px 18px;
  background: #FFF9E6;
  border: 1px solid #F0E6C0;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: .2s;
}
.input:focus { border-color: var(--en-light); }
.input::placeholder { color: var(--text-tertiary); }

/* --- Fill-in-the-blank input --- */
.fill-input {
  width: 100%;
  max-width: 320px;
  text-align: center;
  font-size: 18px;
  padding: 12px 16px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font);
}
.fill-input:focus {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}
.fill-input::placeholder {
  color: var(--text-tertiary);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: .2s;
}

/* --- Login Page --- */
#page-login { padding-top: 40px; }
.login-hero {
  text-align: center;
  padding: 40px 0 30px;
}
.login-hero .logo {
  font-size: 56px;
  margin-bottom: 8px;
}
.login-hero h1 {
  font-size: 32px;
  font-weight: 800;
}
.login-hero h1 .e { background:linear-gradient(135deg,#7C5CBF,#A78BDB); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.login-hero h1 .m { background:linear-gradient(135deg,#E67E22,#F0B27A); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.avatar-item {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: .2s;
}
.avatar-item:hover { background: var(--bg-card-hover); }

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-card-header .avatar .avatar-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
  vertical-align: middle;
}
.tier-avatar .tier-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-item.selected { border-color: var(--en-light); background: rgba(124,92,191,0.15); }

/* --- 返回按钮（全局）--- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
  text-decoration: none;
}
.back-btn:active { transform: scale(.97); }

/* --- 跨设备提示卡片 --- */
.cross-device-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(124,92,191,0.08), rgba(124,92,191,0.03));
  border: 1px solid rgba(124,92,191,0.15);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.cross-device-hint .hint-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.5;
}
.cross-device-hint .hint-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- 用户下拉框 --- */
.user-dropdown-wrapper {
  margin-bottom: 4px;
}
.user-dropdown {
  position: relative;
  z-index: 10;
}
.dropdown-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: .2s;
  min-height: 48px;
}
.dropdown-selected:active { background: var(--bg-card-hover); }
.dropdown-placeholder {
  font-size: 14px;
  color: var(--text-tertiary);
  flex: 1;
}
.dropdown-arrow {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: .2s;
}
.option-name-selected {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
}
.dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: .15s;
}
.dropdown-option:hover { background: var(--bg-card-hover); }
.dropdown-option:active { background: var(--bg-card-hover); transform: scale(.98); }
.dropdown-option.selected { background: rgba(124,92,191,0.08); }
.dropdown-option + .dropdown-option { border-top: 1px solid var(--border); }
.option-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.option-avatar .avatar-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
}
.option-avatar .avatar-emoji {
  font-size: 22px;
  line-height: 1;
}
.option-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

/* --- 内联 PIN 输入 --- */
.pin-inline {
  animation: fadeIn .3s ease;
}

/* --- 分割线 --- */
.or-divider {
  text-align: center;
  color: var(--text-tertiary);
  margin: 20px 0;
  font-size: 13px;
}

/* --- 创建新用户警告 --- */
.create-warning {
  padding: 12px 14px;
  background: rgba(243,156,18,0.1);
  border: 1px solid rgba(243,156,18,0.25);
  border-radius: var(--radius);
  font-size: 13px;
  color: #B8860B;
  line-height: 1.6;
  margin-bottom: 16px;
  text-align: center;
}
.create-warning .link {
  color: var(--en-primary);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}
.create-warning .link:hover { opacity: 0.8; }

/* --- 登录页 60% 宽度 --- */
.login-60w {
  width: 60%;
  min-width: 200px;
  margin-left: auto !important;
  margin-right: auto !important;
  display: block !important;
}

/* --- 下拉框的 PIN 输入框适应 --- */
.pin-inline .pin-input {
  max-width: 100%;
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}
.pin-inline .pin-input::placeholder {
  font-size: 14px;
  letter-spacing: 0;
  font-weight: 400;
  font-family: var(--font);
}

.existing-users {
  margin-top: 24px;
}
.existing-users h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-align: center;
}
.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: .2s;
}
.user-item:active { transform: scale(.98); background: var(--bg-card-hover); }
.user-item .avatar { font-size: 32px; }
.user-item .info { flex: 1; }
.user-item .info .name { font-size: 16px; font-weight: 600; }
.user-item .info .meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.user-item .arrow { color: var(--text-tertiary); font-size: 18px; }

/* --- Home Page --- */
.home-hero {
  text-align: center;
  padding: 24px 0 16px;
}
.home-hero .greeting {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.home-hero .status {
  font-size: 13px;
  color: var(--text-secondary);
}

.subject-grid {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-top: 8px;
}
.subject-card {
  flex: 1;
  border-radius: var(--radius-lg);
  padding: 10px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .3s;
  text-decoration: none;
  display: block;
  color: #fff;
  min-width: 0;
}
.subject-card:active { transform: scale(.97); }
.subject-card.en { background: linear-gradient(135deg, #7C5CBF, #5A3D9E); }
.subject-card.math { background: linear-gradient(135deg, #E67E22, #D35400); }
.subject-card .icon { font-size: 24px; margin-bottom: 2px; }
.subject-card h2 { font-size: 14px; font-weight: 800; margin: 2px 0; }
.subject-card p { font-size: 10px; color: rgba(0,0,0,0.7); margin-top: 2px; line-height: 1.4; }
.subject-card .stats {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  font-size: 10px;
  color: rgba(0,0,0,0.6);
}
.subject-card .stats span { display: flex; align-items: center; gap: 4px; }

.home-footer {
  margin-top: 32px;
  text-align: center;
}
.home-footer .parent-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
}
.home-footer .parent-link:active { transform: scale(.97); }

/* --- Day Selection --- */
.day-header {
  padding: 20px 0;
}
.day-header .subject-title {
  font-size: 26px;
  font-weight: 800;
  margin-top: 12px;
}
.day-header .subject-title.en-title { background:linear-gradient(135deg,#7C5CBF,#A78BDB); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.day-header .subject-title.math-title { background:linear-gradient(135deg,#E67E22,#F0B27A); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.day-header .subject-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.day-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.day-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: .2s;
  cursor: pointer;
}
.day-card:active { transform: scale(.98); background: var(--bg-card-hover); }
.day-card .num {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.day-card.en .num { background: linear-gradient(135deg, #A78BDB, #7C5CBF); }
.day-card.math .num { background: linear-gradient(135deg, #F0B27A, #E67E22); }
.day-card .info { flex: 1; }
.day-card .info h3 { font-size: 15px; font-weight: 600; }
.day-card .info .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.day-card .status-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  flex-shrink: 0;
}
.day-card .status-badge.done { background: rgba(39,174,96,0.2); color: var(--success); }
.day-card .status-badge.pending { background: rgba(243,156,18,0.15); color: var(--warning); }
.day-card .status-badge.locked { background: rgba(0,0,0,0.02); color: var(--text-tertiary); }
.day-card .arrow { color: var(--text-tertiary); font-size: 16px; flex-shrink: 0; }

/* --- Game Placeholder --- */
#page-game .game-header { padding: 20px 0; }
#page-game .game-title {
  font-size: 24px;
  font-weight: 800;
  margin-top: 12px;
}
#page-game .game-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.game-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.game-placeholder .icon { font-size: 72px; margin-bottom: 16px; }
.game-placeholder h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.game-placeholder p { font-size: 14px; color: var(--text-secondary); max-width: 280px; line-height: 1.6; }

/* --- Dashboard (Parent) --- */
.parent-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px;
  text-align: center;
}
.parent-gate .lock-icon { font-size: 48px; margin-bottom: 12px; }
.parent-gate h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.parent-gate p { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.parent-gate .input {
  max-width: 200px;
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
}
.parent-gate .pin-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  display: none;
}
.parent-gate .btn { margin-top: 16px; }

.dashboard-content {
  display: none;
  padding-top: 20px;
}

/* --- Stars indicator --- */
.stars-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px 4px 8px;
  background: rgba(241,196,15,0.1);
  border: 1px solid rgba(241,196,15,0.2);
  border-radius: 16px;
  font-size: 13px;
  color: #F1C40F;
}
.stars-inline {
  font-size: 12px;
  color: #F1C40F;
  background: rgba(241,196,15,0.1);
  padding: 2px 10px 2px 8px;
  border-radius: 12px;
  margin-left: 4px;
  white-space: nowrap;
  font-weight: 600;
}

/* --- Animations --- */
@keyframes slideUp {
  from { opacity:0; transform:translateY(20px); }
  to { opacity:1; transform:translateY(0); }
}
.slide-up { animation: slideUp .4s ease; }

/* --- Toast --- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  z-index: 100;
  animation: slideUp .3s ease;
  display: none;
  max-width: 90%;
  text-align: center;
}
.toast.show { display: block; }

/* --- Responsive --- */
@media (max-width: 400px) {
  .page { padding: 14px; }
  .login-hero .logo { font-size: 44px; }
  .login-hero h1 { font-size: 26px; }
  .avatar-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .avatar-item { font-size: 24px; }
  .subject-card { padding: 24px 18px; }
  .subject-card .icon { font-size: 40px; }
  .day-card { padding: 12px 14px; }
  .day-card .num { width: 38px; height: 38px; font-size: 16px; }
}

/* ============================================================
   Game Engine Styles
   ============================================================ */

/* Question options */
.game-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: #FFF9E6;
  border: 1px solid #F0E6C0;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.game-option:active { transform: scale(.98); background: #F5EDD0; }
.game-option:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.game-option:hover { background: #F5EDD0; }

.opt-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0,0,0,0.03);
  flex-shrink: 0;
}
.opt-text { flex: 1; line-height: 1.4; }

/* Timer bar */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.timer-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(0,0,0,0.03);
  border-radius: 4px;
  overflow: hidden;
}
.timer-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s linear;
}
.timer-text {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* Stage badge */
.game-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Feedback overlay */
.feedback-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.feedback-overlay .feedback-icon { font-size: 52px; margin-bottom: 8px; }
.feedback-overlay .feedback-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.feedback-overlay .feedback-detail { font-size: 14px; color: var(--text-secondary); margin-top: 8px; max-width: 320px; line-height: 1.6; }
.feedback-overlay .feedback-explain { font-size: 13px; color: var(--text-tertiary); margin-top: 12px; max-width: 280px; line-height: 1.5; }
.feedback-overlay .feedback-countdown { font-size: 14px; color: var(--text-secondary); margin-top: 20px; }

/* Question text */
.question-text {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.7;
  padding: 4px 0;
}

/* Progress */
.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Score display */
.score-display {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Stage completion */
.stage-result-grid {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}
.stage-result-item {
  text-align: center;
}
.stage-result-count {
  font-size: 20px;
  font-weight: 700;
}
.stage-result-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.stage-result-score {
  font-size: 20px;
  font-weight: 700;
}
.stage-result-accuracy {
  font-size: 20px;
  font-weight: 700;
}
.stage-result-divider {
  width: 1px;
  background: var(--border);
}

/* Game complete stats grid */
.game-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 20px 0;
}
.game-stat-card {
  text-align: center;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.game-stat-value {
  font-size: 22px;
  font-weight: 700;
}
.game-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Stage summary row */
.stage-summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
}

/* Reward stars */
.reward-stars {
  font-size: 18px;
  margin-bottom: 16px;
}

/* Speaking challenge */
.speaking-text {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
}
.speaking-mic {
  font-size: 48px;
  margin-bottom: 16px;
}
.speaking-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 12px;
}

/* --- Hammer animation --- */
@keyframes hammerHit {
  0%   { transform: translateY(-50px) rotate(-25deg); }
  15%  { transform: translateY(0) rotate(0deg); }
  30%  { transform: translateY(-25px) rotate(-12deg); }
  50%  { transform: translateY(0) rotate(0deg); }
  70%  { transform: translateY(-8px) rotate(-4deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
@keyframes scaleIn {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}
.hammer-icon {
  display: inline-block;
  animation: hammerHit 0.55s ease-out;
}
.hammer-icon img { display: block; width: 80px; height: 80px; }


/* --- Speaking Challenge --- */
.speaking-sentence {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  margin: 16px 0;
  padding: 20px;
  background: rgba(0,0,0,0.02);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-weight: 500;
}
.speaking-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
  flex-wrap: wrap;
}
.speaking-status {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 12px 0;
  min-height: 28px;
}
.speaking-result-card {
  margin: 16px auto;
  max-width: 300px;
  padding: 16px;
  border-radius: 12px;
  display: none;
}
.speaking-result-card.show { display: block; }
.speaking-result-card .score-icon { font-size: 28px; margin-bottom: 4px; }
.speaking-result-card .score-value { font-size: 20px; font-weight: 700; }
.speaking-result-card .score-feedback { font-size: 14px; color: var(--text-secondary); margin-top: 6px; }
.speaking-result-card .recognized-text {
  font-size: 13px; color: var(--text-tertiary); margin-top: 8px;
  padding: 8px; background: rgba(0,0,0,0.04); border-radius: 8px;
}
.speaking-actions {
  display: none;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.speaking-actions.show { display: flex; }
.speaking-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 16px;
}

/* Recording animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.recording-active { animation: pulse 0.8s ease-in-out infinite; color: #E74C3C; }


/* --- Ranking Card --- */
.ranking-card {
  background: linear-gradient(135deg, rgba(124,92,191,0.08), rgba(230,126,34,0.04));
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  margin-top: 12px;
}
.ranking-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ranking-item { text-align: center; }
.ranking-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}
.ranking-value.high { color: #27AE60; }
.ranking-value.mid { color: #F39C12; }
.ranking-value.low { color: #E74C3C; }
.ranking-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.ranking-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

/* --- Dashboard --- */
.dashboard-section {
  margin-bottom: 20px;
}
.dashboard-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

/* Calendar grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: .15s;
  background: #f8f8fa;
  color: var(--text-secondary);
}
.cal-day:active { transform: scale(.92); }
.cal-day.cal-done-high {
  background: rgba(39,174,96,0.25);
  color: #27AE60;
  font-weight: 700;
}
.cal-day.cal-done-low {
  background: rgba(243,156,18,0.2);
  color: #F39C12;
  font-weight: 700;
}
.cal-day.cal-future {
  background: rgba(0,0,0,0.02);
  color: var(--text-tertiary);
}

/* Modal */
.modal { position: fixed; z-index: 200; top: 0; left: 0; right: 0; bottom: 0; }


/* --- Podium (Leaderboard - three-stage) --- */
.podium-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
  margin-top: 0px;
  color: var(--text);
}
.podium-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-top: 0;
  width: 100%;
}
.podium-bg {
  background: url('img/podium-bg.png') no-repeat center bottom;
  background-size: contain;
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 5%;
  box-sizing: border-box;
}
.podium-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 4px 0;
  box-sizing: border-box;
  text-align: center;
  position: relative;
}
.podium-stage.empty { opacity: 0.25; }
/* 布局：左银牌#2 | 中金牌#1 | 右铜牌#3 */
.podium-stage.gold {
  width: 16.7%;
  margin-bottom: 25%;
  order: 2;
}
.podium-stage.silver {
  width: 33.3%;
  margin-bottom: 15%;
  order: 1;
  align-items: flex-start;
  text-align: left;
}
.podium-stage.bronze {
  width: 50%;
  margin-bottom: 10%;
  order: 3;
  align-items: flex-end;
  text-align: right;
}
.podium-avatars {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  width: 100%;
}
/* 领奖台网格布局：金牌2列、银牌3列、铜牌4列 */
.podium-avatars.gold-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0;
  justify-content: center;
}
.podium-avatars.silver-grid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 0;
  justify-content: start;
  justify-items: start;
}
.podium-avatars.bronze-grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 0;
  justify-content: end;
  justify-items: end;
}
}
/* 领奖台头像图片 */
.podium-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
/* 统一头像大小为金牌规格 */
.podium-stage.gold .podium-avatar-img,
.podium-stage.silver .podium-avatar-img,
.podium-stage.bronze .podium-avatar-img {
  width: 32px;
  height: 32px;
}
.podium-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.podium-avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.9);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.podium-stage.gold .podium-avatar-circle,
.podium-stage.silver .podium-avatar-circle,
.podium-stage.bronze .podium-avatar-circle {
  width: 32px;
  height: 32px;
  font-size: 18px;
}
.podium-avatar-name {
  font-size: 10px;
  color: #333 !important;
  max-width: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}
.podium-stage.silver .podium-avatar-wrap,
.podium-stage.bronze .podium-avatar-wrap {
  gap: 0 !important;
}
.podium-stage.silver .podium-avatar-name,
.podium-stage.bronze .podium-avatar-name {
  color: #333 !important;
  line-height: 1.1 !important;
  font-size: 10px;
}
.podium-avatar-wrap.is-me .podium-avatar-img,
.podium-avatar-wrap.is-me .podium-avatar-circle {
  border-color: #FFD700;
  box-shadow: 0 0 8px rgba(255,215,0,0.8);
}
.podium-avatar-wrap.is-me .podium-avatar-name {
  color: #B8860B;
  font-weight: bold;
}

/* Subject tabs */
.subject-tab {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
  font-family: var(--font);
}
.subject-tab.active {
  background: linear-gradient(135deg, #7C5CBF, #5A3D9E);
  border-color: #7C5CBF;
  color: #fff;
}
.subject-tab:active { transform: scale(.97); }
/* Settings */
.btn-mini {
  width:28px;height:28px;border:none;border-radius:6px;background:rgba(255,255,255,0.1);
  color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;
}
.btn-mini:hover { background:rgba(255,255,255,0.2); }
.btn-mini:active { transform:scale(.92); }

/* Voice toggle switch (男女声单开关) */
.voice-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  transition: all .2s;
}
.voice-switch:active { transform: scale(.95); }
.voice-switch-label {
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-secondary);
  user-select: none;
}
.voice-switch-track {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  position: relative;
  transition: background 0.3s;
  border: 1px solid var(--border);
}
.voice-switch-track.male {
  background: rgba(52,152,219,0.3);
  border-color: rgba(52,152,219,0.5);
}
.voice-switch-track.female {
  background: rgba(255,105,180,0.3);
  border-color: rgba(255,105,180,0.5);
}
.voice-switch-thumb {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 1px;
  transition: left 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.voice-switch-thumb.left { left: 1px; }
.voice-switch-thumb.right { left: 17px; }

/* Voice toggle buttons (保留旧版兼容) */
.voice-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  background: rgba(0,0,0,0.03);
  color: var(--text-secondary);
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.voice-btn:active { transform: scale(.95); }
.voice-btn.voice-female.active {
  background: #FF69B4;
  border-color: #FF69B4;
  color: #fff;
}
.voice-btn.voice-male.active {
  background: #3498DB;
  border-color: #3498DB;
  color: #fff;
}


.author-contact {
  text-align: center;
  padding: 24px 0 30px;
  margin-top: 20px;
}
.author-text {
  font-size: 14px;
  color: #999;
  margin: 0 0 10px;
}
.author-qrcode {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
}
.icp-info {
  display: inline-block;
  font-size: 11px;
  color: #999;
  text-decoration: none;
  margin: 8px 0 0;
}
.icp-info:hover {
  text-decoration: underline;
}
