/* =========================
   1. RESET + TOKENS
   ========================= */

* {
  box-sizing: border-box;
  font-family: system-ui, 'Segoe UI', Roboto, sans-serif;
  word-break: break-word;
  overflow-wrap: break-word;
}

:root{
  --bg: #eef3fb;
  --panel: rgba(255,255,255,0.78);
  --panel-strong: rgba(255,255,255,0.9);
  --card: rgba(255,255,255,0.72);
  --surface-1: rgba(255,255,255,0.74);
  --surface-2: rgba(255,255,255,0.84);
  --surface-3: rgba(255,255,255,0.92);

  --text: #18233f;
  --muted: #6f7b95;

  --line: rgba(130, 148, 190, 0.18);
  --border-soft: rgba(130,148,190,0.16);
  --border-strong: rgba(79,107,255,0.18);

  --accent: #4f6bff;
  --accent-2: #7c5cff;
  --success: #22c55e;
  --warn: #ffb84d;

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --radius-card: 24px;
  --radius-panel: 30px;
  --radius-control: 16px;

  --shadow-xs: 0 4px 10px rgba(24,35,63,0.04);
  --shadow-sm: 0 8px 20px rgba(24,35,63,0.06);
  --shadow-md: 0 14px 30px rgba(24,35,63,0.08);
  --shadow-lg: 0 20px 40px rgba(24,35,63,0.10);

  --shadow-soft: 0 10px 30px rgba(40, 60, 120, 0.08);
  --shadow-card: 0 8px 20px rgba(24, 35, 63, 0.06);

  --blur: blur(16px);
}

/* =========================
   2. PAGE + LAYOUT
   ========================= */

body{
  margin: 0;
  padding: 20px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  background:
    radial-gradient(circle at 20% 20%, rgba(124,92,255,0.10), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(79,107,255,0.10), transparent 24%),
    linear-gradient(180deg, #f6f8fe 0%, #eef3fb 100%);
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 24px;
  min-height: 100vh;
  align-items: flex-start;
}

.mobile-split-handle {
  display: none;
}

/* =========================
   3. MAIN PANELS
   ========================= */

.trainer-panel,
.text-panel{
  position: relative;
  flex: 1 1 0;
  width: 0;
  min-height: calc(100vh - 40px);

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);

  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.trainer-panel {
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.text-panel {
  min-width: 360px;
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

/* glass top sheen */
.trainer-panel::before,
.text-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.28) 0%,
      transparent 22%,
      transparent 70%,
      rgba(255,255,255,0.10) 100%
    );
  opacity: 0.75;
}

.trainer-panel::after,
.text-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.46),
    inset 0 0 0 1px rgba(255,255,255,0.06);
}

/* =========================
   4. TYPOGRAPHY
   ========================= */

h1 {
  font-size: clamp(1.75rem, 2vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 900;
  color: #14203b;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.text-panel h3 {
  margin-top: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #18233f;
  text-align: center;
}

.text-panel h4 {
  text-align: center;
}

.subnote,
.topic-card-meta,
.gap-hint,
.wf-hint,
.wf-base,
.feedback-footer,
#leaderboardTimer {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #72809d;
}

.text-content {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 1rem;
  line-height: 1.72;
  color: #24314f;
}

/* =========================
   5. SURFACE CARDS
   ========================= */

.user-bar,
.topic-selector,
.question-card,
.leaderboard,
.stats-card,
.stats-card-experimental,
.auth-panel,
.guest-landing,
.guest-result {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.question-card,
.leaderboard,
.auth-panel {
  box-shadow: var(--shadow-md);
}

.user-rank,
#topicProgressContainer,
#customStats,
#customStatsExperimental {
  text-align: center !important;
}

/* =========================
   6. BUTTONS + CONTROLS
   ========================= */

button {
  position: relative;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: 1px solid rgba(79,107,255,0.18);
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 18px rgba(79,107,255,0.16);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79,107,255,0.20);
}

button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px solid transparent;
  transition: border-color 0.2s ease;
  pointer-events: none;
}

button:hover::after {
  border-color: rgba(30, 60, 114, 0.35);
}

.start-actions {
  max-width: 920px;
  margin: 0 auto 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

body.trainer-active .start-actions {
  display: none !important;
}

.guest-intro {
  flex: 1 1 100%;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

#startGuestBtn {
  min-height: 46px;
  padding: 0 22px;
}

.admin-mobile-entry {
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #5b3fd6, #1e3c72);
  color: #fff;
  font-weight: 800;
}

.guest-demo-mount {
  max-width: 920px;
  width: 100%;
  margin: 0 auto 22px;
  transition: opacity 0.2s ease;
}

.guest-limit-card {
  max-width: 720px;
  margin: 34px auto;
  padding: 24px;
  border-radius: 24px;
  background: rgba(255,255,255,0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.guest-limit-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(79,107,255,0.08);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.guest-limit-card h2 {
  margin: 0 0 10px;
  color: var(--text);
}

.guest-limit-card p {
  max-width: 520px;
  margin: 0 auto 18px;
  color: var(--muted);
  line-height: 1.5;
}

.guest-limit-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

#logoutBtn {
  background: rgba(23,31,56,0.92);
  color: #fff;
}

#profileBtn {
  background: rgba(255,255,255,0.78);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

#offlineDownloadBtn {
  background: rgba(255,255,255,0.78);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}


.small-btn,
.topic-browser-toggle,
.topic-back-btn,
.register-tab,
.speak-btn {
  background: rgba(255,255,255,0.72) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}

.small-btn:hover,
.topic-browser-toggle:hover,
.topic-back-btn:hover,
.register-tab:hover,
.speak-btn:hover {
  background: rgba(255,255,255,0.95) !important;
  border-color: rgba(79,107,255,0.28) !important;
}

.small-btn {
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 0.75rem;
}

#refreshLeaderboardBtn {
  background-color: #1e3c72;
  color: white;
  border: none;
}

#refreshLeaderboardBtn.leaderboard-refresh-btn {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(30, 60, 114, 0.22);
  white-space: nowrap;
}

#refreshLeaderboardBtn:hover {
  background-color: #0f2b4f;
}

#refreshLeaderboardBtn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.leaderboard-cooldown {
  margin-left: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #667085;
  white-space: nowrap;
}

@media (max-width: 640px) {
  #leaderboard h4 {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
  }

  #leaderboard h4::after {
    grid-column: 2;
    grid-row: 1;
  }

  #leaderboard h4 > div {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: minmax(44px, 0.8fr) minmax(58px, 1fr) minmax(44px, 0.8fr);
    gap: 6px !important;
    width: 100%;
    margin-left: 0 !important;
  }

  #leaderboard h4 .leaderboard-toggle {
    min-width: 0;
    white-space: nowrap;
  }

  #leaderboard h4 .report-btn {
    justify-self: end;
  }

  #refreshLeaderboardBtn.leaderboard-refresh-btn {
    min-width: 0;
    width: 100%;
    padding: 6px 8px !important;
    font-size: 0.74rem !important;
  }
}

select,
.auth-slide-form input,
.gap-input,
.wf-input,
.wf-choice-current,
.wf-choice-btn,
.topic-search {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  box-shadow: none;
}

select {
  padding: 6px 12px;
  font-size: 0.9rem;
}

/* =========================
   7. USER BAR + SCORE
   ========================= */

.user-bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-level-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.profile-level-control select {
  min-width: 150px;
  max-width: 210px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.82rem;
  color: var(--text);
}

.user-info {
  font-weight: bold;
  color: #1e3c72;
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  letter-spacing: -0.01em;
}

.total-score {
  background: linear-gradient(135deg, rgba(255,214,92,0.96), rgba(255,184,77,0.96));
  color: #3f2b00;
  border-radius: 40px;
  padding: 4px 12px;
  font-size: 0.9rem;
  font-weight: bold;
  border: 1px solid rgba(255,255,255,0.28);
  box-shadow:
    0 10px 20px rgba(255,184,77,0.18),
    inset 0 1px 0 rgba(255,255,255,0.32);
}

/* =========================
   8. TOPIC SELECTOR + BROWSER
   ========================= */

.topic-selector {
  margin-bottom: 20px;
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}

.topic-selector select {
  max-width: 100%;
  box-sizing: border-box;
}

.reset-topic-btn {
  background: #ffc107;
  color: #1e3c72;
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 10px;
  font-weight: bold;
}

.reset-topic-btn:hover {
  background: #e0a800;
}

.topic-browser {
  margin: 14px 0 18px;
}

.topic-category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.topic-category-tab {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.72);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.topic-category-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.topic-category-tab:active {
  transform: scale(0.97);
}

.topic-category-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow:
    0 10px 20px rgba(79,107,255,0.18),
    0 0 0 1px rgba(255,255,255,0.16) inset;
}

.topic-category-tab .category-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
}

.topic-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.topic-card {
  width: 100%;
  max-width: 100%;
  min-height: 68px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 11px;
  cursor: pointer;
  box-shadow: none;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.topic-card:active {
  transform: scale(0.97);
}

.topic-card.active {
  background: rgba(79,107,255,0.08);
  border: 1px solid rgba(79,107,255,0.28);
  box-shadow:
    0 10px 22px rgba(79,107,255,0.14),
    0 0 0 1px rgba(255,255,255,0.16) inset;
}

.topic-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.topic-card-title {
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.22;
  letter-spacing: 0;
  font-size: 0.9rem;
}

.topic-card-meta {
  font-size: 0.75rem;
}

.topic-browser-toggle {
  margin: 10px 0;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  color: #1e3c72;
}

.topic-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.topic-search-btn {
  border: 1px solid #ddd;
  background: #f1f3f5;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 16px;
}

.topic-search {
  width: 100%;
  flex: 1;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.topic-back-btn {
  padding: 7px 12px;
  font-weight: 700;
  border-radius: 999px;
}

/* =========================
   9. STAGE NAV
   ========================= */

.stage-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
  align-items: center;
}

.stage-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.72) !important;
  color: var(--text) !important;
  border: 1px solid rgba(130,148,190,0.18) !important;
  box-shadow:
    0 4px 12px rgba(24,35,63,0.04),
    inset 0 1px 0 rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.stage-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.22) 42%,
    transparent 68%
  );
  transform: translateX(-140%);
  transition: transform 0.7s ease;
}

.stage-btn:hover::before {
  transform: translateX(140%);
}

.stage-btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.92) !important;
  border-color: rgba(79,107,255,0.22) !important;
  box-shadow:
    0 10px 24px rgba(79,107,255,0.10),
    inset 0 1px 0 rgba(255,255,255,0.75);
}

.stage-btn.active:not(.completed) {
  background: linear-gradient(135deg, rgba(79,107,255,0.96), rgba(124,92,255,0.96)) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow:
    0 14px 30px rgba(79,107,255,0.24),
    0 0 0 1px rgba(255,255,255,0.16) inset,
    0 0 20px rgba(124,92,255,0.12) !important;
}

.stage-btn.completed {
  background: linear-gradient(135deg, rgba(34,197,94,0.92), rgba(22,163,74,0.92)) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 10px 22px rgba(34,197,94,0.18);
}

.stage-btn.completed:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(34,197,94,0.22);
}

.stage-btn.active:not(.completed):hover {
  box-shadow: 0 16px 32px rgba(79,107,255,0.26);
}

.stage-btn:disabled,
.stage-btn.locked {
  opacity: 0.45;
  filter: grayscale(0.1);
  cursor: not-allowed;
}

.stage-header {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 18px 0 14px;
  padding: 10px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(79,107,255,0.10), rgba(124,92,255,0.08));
  color: #18233f;
  border: 1px solid rgba(130,148,190,0.18);
  box-shadow:
    0 8px 20px rgba(24,35,63,0.05),
    inset 0 1px 0 rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 900;
  font-size: 0.86rem;
}

.stage-header.practice {
  background: linear-gradient(135deg, rgba(239,68,68,0.14), rgba(220,53,69,0.10)) !important;
  color: #7f1d1d !important;
}

/* =========================
   10. TOPIC PROGRESS
   ========================= */

#topicProgressContainer {
  margin: 14px 0 10px 0 !important;
}

#topicProgressContainer > div:first-child {
  margin-bottom: 6px;
  color: #5f6d8c;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topic-progress-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 120px;
}

.progress-save-status {
  display: none;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(130,148,190,0.22);
  background: rgba(255,255,255,0.72);
  color: #69758f;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(30,45,84,0.08);
}

.progress-save-status.is-visible {
  display: inline-flex;
}

.progress-save-status.is-saving {
  border-color: rgba(124,92,255,0.24);
  color: #5a4dcf;
}

.progress-save-status.is-saved {
  border-color: rgba(50,171,109,0.22);
  background: rgba(237,250,244,0.86);
  color: #32805a;
}

.progress-save-status.is-error {
  border-color: rgba(214,80,80,0.22);
  background: rgba(255,244,244,0.9);
  color: #a33a3a;
}

#topicProgressContainer > div:last-child {
  position: relative;
  height: 12px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.62) !important;
  border: 1px solid rgba(130,148,190,0.16);
  box-shadow:
    inset 0 1px 2px rgba(24,35,63,0.06),
    0 4px 10px rgba(24,35,63,0.04);
  overflow: hidden;
}

#topicProgressBar {
  position: relative;
  height: 100% !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, rgba(79,107,255,0.96), rgba(124,92,255,0.96)) !important;
  box-shadow:
    0 0 16px rgba(79,107,255,0.18),
    inset 0 1px 0 rgba(255,255,255,0.28);
}
#sectionProgressContainer {
  margin: 10px 0 10px 0 !important;
}

#sectionProgressContainer > div:first-child {
  margin-bottom: 6px;
  color: #5f6d8c;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#sectionProgressContainer > div:last-child {
  position: relative;
  height: 12px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.62) !important;
  border: 1px solid rgba(130,148,190,0.16);
  box-shadow:
    inset 0 1px 2px rgba(24,35,63,0.06),
    0 4px 10px rgba(24,35,63,0.04);
  overflow: hidden;
}

#sectionProgressBar {
  position: relative;
  height: 100% !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, rgba(124,92,255,0.96), rgba(79,107,255,0.96)) !important;
  box-shadow:
    0 0 16px rgba(124,92,255,0.18),
    inset 0 1px 0 rgba(255,255,255,0.28);
}

#sectionProgressBar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.28) 45%,
    transparent 70%
  );
  transform: translateX(0);
}

#sectionProgressPercent {
  font-weight: 800;
  color: #4e3fb8;
}

#topicProgressBar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.28) 45%,
    transparent 70%
  );
  transform: translateX(0);
}

/* =========================
   11. QUESTION CARD
   ========================= */

#mainApp {
  flex: 1;
}

#mainContent {
  min-height: 360px;
}

.auth-home-state {
  width: min(100%, 680px);
  margin: 28px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.84);
  box-shadow: 0 12px 28px rgba(24,35,63,0.08);
  text-align: left;
}

.auth-home-kicker {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-home-state h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 1.2;
}

.auth-home-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.question-card {
  position: relative;
  min-height: 190px;
  border-radius: 32px !important;
  background:
    radial-gradient(circle at 85% 30%, rgba(124,92,255,0.08), transparent 18%),
    rgba(255,255,255,0.82) !important;
  border: 1px solid var(--line);
  box-shadow: 0 16px 34px rgba(24,35,63,0.08) !important;
  padding: 24px;
  margin: 16px 0;
  transition: all 0.2s ease;
}

.question-card.correct-highlight {
  background:
    radial-gradient(circle at 85% 30%, rgba(34,197,94,0.08), transparent 18%),
    rgba(255,255,255,0.88) !important;
  border: 1px solid rgba(34,197,94,0.28);
  box-shadow: 0 16px 34px rgba(34,197,94,0.10) !important;
}

.question-text {
  font-size: clamp(1.08rem, 1.15vw, 1.28rem) !important;
  line-height: 1.5 !important;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: #18233f !important;
  margin-bottom: 20px;
  border-left: 4px solid rgba(255,184,77,0.9) !important;
  padding-left: 16px;
}

.sentence-source-cue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -8px 0 16px 20px;
  color: #5f6d8c;
  font-size: 0.86rem;
  font-weight: 700;
}

.sentence-source-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(79,107,255,0.24) !important;
  background: rgba(79,107,255,0.08) !important;
  color: #24345f !important;
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  cursor: pointer;
}

.sentence-source-btn:hover {
  background: rgba(79,107,255,0.14) !important;
  border-color: rgba(79,107,255,0.36) !important;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px !important;
  margin: 20px 0;
}

/* =========================
   12. ANSWER OPTIONS
   ========================= */

.option {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 16px !important;

  background: rgba(255,255,255,0.82) !important;
  border: 1px solid var(--line) !important;
  border-radius: 18px !important;

  color: #18233f !important;
  font-size: 0.96rem !important;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;

  box-shadow: none !important;
  transition: all 0.2s ease;
}

.option:hover {
  background: rgba(79,107,255,0.06) !important;
  border-color: rgba(79,107,255,0.28) !important;
  color: #18233f !important;
  transform: translateX(2px) !important;
  box-shadow: 0 8px 18px rgba(79,107,255,0.08) !important;
}

.option.correct-answer {
  background: rgba(34,197,94,0.12) !important;
  border-color: rgba(34,197,94,0.38) !important;
  color: #14532d !important;
  font-weight: 700;
}

.option.wrong-answer {
  background: rgba(239,68,68,0.12) !important;
  border-color: rgba(239,68,68,0.34) !important;
  color: #7f1d1d !important;
  text-decoration: line-through;
}

.sentence-option {
  display: block;
}

.sentence-option-diff {
  font-weight: 900;
  color: #111827;
  background: rgba(255, 214, 102, 0.32);
  border-radius: 6px;
  padding: 0 3px;
}

.correct-answer-highlight {
  background: #ffeb3b;
  color: #000;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 12px;
  margin-left: 8px;
  font-size: 0.8rem;
}

/* =========================
   13. GAP / WF INPUTS
   ========================= */

.gap-container,
.wf-container {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px;
  flex-wrap: wrap;
}

.gap-input,
.wf-input {
  width: 160px;
  padding: 4px 8px;
  font-size: 0.9rem;
  color: #18233f !important;
}

.gap-input::placeholder,
.wf-input::placeholder {
  color: #7b88a4;
}

.gap-correct,
.wf-correct {
  background: rgba(34,197,94,0.14) !important;
  border-color: rgba(34,197,94,0.38) !important;
  color: #14532d !important;
}

.gap-wrong,
.wf-wrong {
  background: rgba(239,68,68,0.12) !important;
  border-color: rgba(239,68,68,0.34) !important;
  color: #7f1d1d !important;
}

.gap-feedback,
.wf-feedback {
  font-size: 0.7rem;
  margin-left: 4px;
  color: #dc3545;
}


/* =========================
   15. TRAINER TYPOGRAPHY INHERITANCE
   ========================= */

.trainer-panel {
  font-size: 1rem;
  overflow-x: auto;
}

.trainer-panel,
.trainer-panel * {
  font-size: inherit !important;
}

.trainer-panel .question-text,
.trainer-panel .option,
.trainer-panel .wf-choice-wrap,
.trainer-panel .wf-choice-current,
.trainer-panel .wf-choice-btn,
.trainer-panel .gap-input,
.trainer-panel .wf-input,
.trainer-panel .stage-header,
.trainer-panel .stage-btn {
  font-size: inherit !important;
}

/* =========================
   16. DESKTOP BALANCE
   ========================= */

@media (min-width: 801px) {
  .wf-choice-wrap,
  .gap-container,
  .wf-container {
    min-width: 0 !important;
    max-width: 100%;
  }

  .wf-choice-current,
  .wf-choice-btn,
  .gap-input,
  .wf-input {
    max-width: 100%;
  }

  .question-card {
    overflow-x: hidden;
  }
}
/* =========================
   17. TEXT TOOLBAR
   ========================= */

.text-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
  width: 100%;
}

.text-zoom-controls {
  position: relative;
  display: inline-flex;
  gap: 6px;
  margin-left: 0 !important;
  vertical-align: middle;
  pointer-events: auto !important;
}

.text-zoom-controls * {
  pointer-events: auto !important;
}

#textZoomOutBtn,
#textZoomResetBtn,
#textZoomInBtn {
  position: relative;
  z-index: 5;
}

.text-zoom-controls .small-btn {
  min-width: 48px;
  text-align: center;
}

/* =========================
   18. LEADERBOARD
   ========================= */

.leaderboard {
  padding: 14px !important;
  border-radius: 22px !important;
  text-align: center;
  position: relative;
  cursor: default;
}

.leaderboard h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  margin: 0 0 10px 0 !important;
  font-size: 0.95rem !important;
}

.leaderboard h4:hover {
  opacity: 0.8;
}

.leaderboard h4::after {
  content: "⌄";
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.leaderboard:not(.collapsed) h4::after {
  transform: rotate(180deg);
}

.leaderboard::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #d0d7e2;
  opacity: 0.8;
}

.leaderboard.collapsed table,
.leaderboard.collapsed #leaderboardTable,
.leaderboard.collapsed .user-rank {
  display: none !important;
}

.leaderboard:not(.collapsed) {
  box-shadow: 0 12px 28px rgba(0,0,0,0.15);
}

.leaderboard-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.leaderboard-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(130,148,190,0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: #4f6bff;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(36,48,84,0.08);
}

.leaderboard-help-link:hover {
  background: rgba(245,247,255,0.96);
  border-color: rgba(79,107,255,0.22);
}

#leaderboardTable {
  width: 100%;
  border-collapse: collapse;
  display: block !important;
  max-height: 260px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  margin: 0 auto;
}

#leaderboardTable thead,
#leaderboardTable tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.leaderboard th,
.leaderboard td {
  padding: 7px 8px !important;
  text-align: left;
  border-bottom: 1px solid rgba(130,148,190,0.12) !important;
}

.leaderboard-admin-shadow-row {
  opacity: 0.46;
  filter: saturate(0.75);
}

.leaderboard-admin-shadow-row td {
  padding-top: 10px !important;
  border-top: 1px dashed rgba(130,148,190,0.22) !important;
  background: rgba(248, 250, 252, 0.52);
}

.leaderboard-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  box-shadow: 0 5px 12px rgba(36, 48, 84, 0.14);
}

.leaderboard-rank-badge--1 {
  background: linear-gradient(135deg, #ffd86b, #d99619);
}

.leaderboard-rank-badge--2 {
  background: linear-gradient(135deg, #dfe7f3, #8c9bb8);
}

.leaderboard-rank-badge--3 {
  background: linear-gradient(135deg, #e8b17e, #a6602b);
}

.leaderboard th {
  background: rgba(79,107,255,0.06) !important;
  font-weight: bold;
}

.leaderboard td:last-child,
.leaderboard th:last-child {
  font-weight: 800;
}

.leaderboard .current-user {
  background: rgba(255, 184, 77, 0.16) !important;
  font-weight: bold;
}

.leaderboard th:first-child,
.leaderboard td:first-child {
  width: 55px;
  text-align: center;
  white-space: nowrap;
}

.leaderboard th:last-child,
.leaderboard td:last-child {
  width: 70px;
  text-align: right;
  white-space: nowrap;
}

.leaderboard th:nth-child(2),
.leaderboard td:nth-child(2) {
  word-break: break-word;
  white-space: normal;
}

.report-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(141, 152, 186, 0.35);
  background: rgba(255, 255, 255, 0.82);
  color: #6b7280;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.report-btn:hover,
.admin-reports-btn.has-reports {
  background: #fff7ed;
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.55);
}

.stage-report-btn {
  flex: 0 0 auto;
}

.admin-reports-btn {
  position: relative;
  min-width: 46px;
}

.admin-reports-btn.has-reports::after {
  content: attr(data-count);
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  line-height: 18px;
}

.profile-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  z-index: 100000;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.profile-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border-radius: 18px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  margin: auto 0;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.profile-modal-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
  color: #64748b;
}

.profile-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 800;
}

.profile-field input,
.profile-field select {
  width: 100%;
  min-height: 40px;
}

.profile-level-field {
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid rgba(99, 91, 255, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(247,249,255,0.96), rgba(255,255,255,0.96));
}

.profile-level-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.profile-level-current > div strong,
.profile-level-current > div span {
  display: block;
}

.profile-level-current > div strong {
  color: var(--text);
  font-size: 0.92rem;
}

.profile-level-current > div span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-level-preview {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid rgba(99, 91, 255, 0.26);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(99, 91, 255, 0.1);
  cursor: pointer;
}

.profile-level-preview strong,
.profile-level-preview span {
  min-width: 0;
}

.profile-level-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}

.profile-level-preview span {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-level-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.34);
}

.profile-level-picker {
  width: min(680px, 100%);
  max-height: min(78vh, 660px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(20, 30, 60, 0.25);
}

.profile-level-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.profile-level-picker-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.profile-level-picker-header span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-level-picker-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(141, 152, 186, 0.24);
  background: rgba(248, 250, 252, 0.92);
  color: #64748b;
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-level-picker-list {
  display: grid;
  gap: 9px;
  overflow-y: auto;
  padding: 8px 18px 18px;
}

.profile-level-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  padding: 11px 12px 16px;
  border: 1px solid rgba(141, 152, 186, 0.26);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.94);
  color: var(--text);
  text-align: left;
}

.profile-level-option.selected {
  border-color: #635bff;
  background: rgba(99, 91, 255, 0.1);
}

.profile-level-option-main,
.profile-level-option-main strong,
.profile-level-option-main span,
.profile-level-option-side {
  display: block;
}

.profile-level-option-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.96rem;
}

.profile-level-option-main span {
  margin-top: 3px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-level-option-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.profile-level-status,
.profile-level-badge {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.profile-level-status.complete {
  background: rgba(46, 160, 103, 0.12);
  color: #2f8a5b;
}

.profile-level-status.partial {
  background: rgba(245, 158, 11, 0.15);
  color: #9a650b;
}

.profile-level-status.not-started {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}

.profile-level-badge {
  background: rgba(99, 91, 255, 0.12);
  color: #5247d8;
}

.profile-level-meter {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(141, 152, 186, 0.18);
}

.profile-level-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f64ff, #2fbf8f);
}

.profile-level-callout {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(79, 107, 255, 0.07);
  color: var(--text);
}

.profile-level-callout strong,
.profile-level-callout span {
  display: block;
}

.profile-level-callout strong {
  font-size: 0.86rem;
  margin-bottom: 3px;
}

.profile-level-callout span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-avatar-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
}

.profile-avatar-current strong,
.profile-avatar-current span {
  display: block;
}

.profile-avatar-current strong {
  color: var(--text);
  font-size: 0.92rem;
}

.profile-avatar-current div span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-avatar-preview {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid rgba(99, 91, 255, 0.34);
  background: #fff;
  box-shadow: 0 10px 24px rgba(99, 91, 255, 0.12);
  cursor: pointer;
}

.profile-avatar-preview span {
  font-size: 1.55rem;
  line-height: 1;
}

.profile-avatar-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.34);
}

.profile-avatar-picker {
  width: min(620px, 100%);
  max-height: min(76vh, 620px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(20, 30, 60, 0.25);
}

.profile-avatar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.profile-avatar-picker-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.profile-avatar-picker-header span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-avatar-picker-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(141, 152, 186, 0.24);
  background: rgba(248, 250, 252, 0.92);
  color: #64748b;
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 9px;
  overflow-y: auto;
  padding: 8px 18px 18px;
}

.profile-avatar-option {
  min-width: 48px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(141, 152, 186, 0.35);
  background: rgba(248, 250, 252, 0.95);
  box-shadow: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.profile-avatar-option.selected {
  border-color: #635bff;
  background: rgba(99, 91, 255, 0.12);
}

@media (max-width: 560px) {
  .profile-level-picker-overlay,
  .profile-avatar-picker-overlay {
    padding: 0;
  }

  .profile-level-picker,
  .profile-avatar-picker {
    width: 100%;
    max-height: 82vh;
    border-radius: 22px 22px 0 0;
  }

  .profile-level-option {
    grid-template-columns: 1fr;
  }

  .profile-level-option-side {
    justify-content: flex-start;
  }
}

.profile-offline-panel {
  display: grid;
  gap: 10px;
  margin: 16px 0 6px;
  padding: 12px;
  border: 1px solid rgba(99, 91, 255, 0.16);
  border-radius: 14px;
  background: rgba(247, 249, 255, 0.82);
  color: var(--text);
}

.profile-offline-panel strong,
.profile-offline-panel span {
  display: block;
}

.profile-offline-panel strong {
  font-size: 0.9rem;
}

.profile-offline-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-sync-panel {
  display: grid;
  gap: 6px;
  margin: 10px 0 6px;
  padding: 12px;
  border: 1px solid rgba(50, 171, 109, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.92), rgba(255, 255, 255, 0.94));
}

.profile-sync-panel strong,
.profile-sync-panel span {
  display: block;
}

.profile-sync-panel strong {
  font-size: 0.9rem;
}

.profile-sync-panel span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-sync-pill {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(50, 171, 109, 0.24);
  background: rgba(237, 250, 244, 0.92);
  color: #32805a !important;
}

.profile-sync-pill.warn {
  border-color: rgba(214, 80, 80, 0.24);
  background: rgba(255, 244, 244, 0.94);
  color: #a33a3a !important;
}

.profile-offline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-offline-btn {
  margin: 0;
}

.profile-offline-status:empty {
  display: none !important;
}

.profile-modal-actions {
  position: sticky;
  bottom: -22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 12px;
  padding-bottom: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), #fff 42%);
}

.profile-save-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  background: #635bff;
  color: #fff;
}

.admin-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  z-index: 100000;
}

.admin-modal-content {
  width: min(1120px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  color: var(--text);
}

.admin-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.admin-panel-header h2 {
  margin: 0;
  font-size: 1.28rem;
}

.admin-panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-modal-close {
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

.admin-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}

.admin-quick-actions button,
.admin-search-row input {
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.96);
}

.admin-quick-actions button {
  padding: 8px 12px;
  color: #25304d;
  font-weight: 800;
  cursor: pointer;
}

.admin-panel-section {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(141, 152, 186, 0.22);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.7);
}

.admin-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-section-title span {
  font-weight: 900;
}

.admin-section-title small {
  color: var(--muted);
  font-weight: 700;
}

.admin-panel-details {
  padding: 0;
}

.admin-panel-details > .admin-section-title {
  cursor: pointer;
  margin: 0;
  padding: 12px 14px;
  list-style: none;
}

.admin-panel-details > .admin-section-title::-webkit-details-marker {
  display: none;
}

.admin-panel-details > .admin-section-title::after {
  content: '+';
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(141, 152, 186, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: #536179;
  font-weight: 900;
}

.admin-panel-details[open] > .admin-section-title {
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(141, 152, 186, 0.16);
}

.admin-panel-details[open] > .admin-section-title::after {
  content: '−';
}

.admin-panel-details > .admin-summary-window {
  margin: 0 14px 14px;
}

.admin-search-row {
  margin-bottom: 10px;
}

.admin-search-row input {
  width: min(320px, 100%);
  padding: 9px 11px;
  color: var(--text);
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  min-width: 980px;
}

.admin-table th {
  color: #64748b;
  font-size: 0.76rem;
  text-align: left;
  padding: 0 8px 4px;
}

.admin-table td {
  padding: 8px;
  background: #fff;
  border-top: 1px solid rgba(141, 152, 186, 0.16);
  border-bottom: 1px solid rgba(141, 152, 186, 0.16);
  vertical-align: top;
}

.admin-table td:first-child {
  border-left: 1px solid rgba(141, 152, 186, 0.16);
  border-radius: 10px 0 0 10px;
}

.admin-table td:last-child {
  border-right: 1px solid rgba(141, 152, 186, 0.16);
  border-radius: 0 10px 10px 0;
}

.admin-table button,
.admin-table select {
  margin: 2px 3px 2px 0 !important;
  border-radius: 8px;
  border: 1px solid rgba(141, 152, 186, 0.24);
  padding: 5px 7px;
  font-size: 0.76rem;
  font-weight: 800;
}

.admin-actions-cell {
  min-width: 420px;
}

.admin-action-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 100%;
  margin: 0 6px 6px 0;
  padding: 6px;
  border: 1px solid rgba(141, 152, 186, 0.18);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.78);
  vertical-align: top;
}

.admin-action-group-title {
  flex: 0 0 100%;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.admin-sync-status {
  margin-top: 5px;
  max-width: 260px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
}

.admin-sync-status.ok {
  color: #32805a;
}

.admin-sync-status.warn {
  color: #a33a3a;
}

.admin-summary-window {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.92);
  color: var(--text);
}

.admin-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-summary-head h3,
.admin-summary-grid h4 {
  margin: 0;
}

.admin-summary-head span,
.admin-summary-grid span,
.admin-summary-grid p,
.admin-summary-empty {
  color: #64748b;
}

.admin-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.admin-summary-metrics div {
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(141, 152, 186, 0.22);
}

.admin-owner-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-owner-card {
  min-height: 94px;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid rgba(141, 152, 186, 0.22);
  background: #fff;
}

.admin-owner-card span,
.admin-owner-card small {
  display: block;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 800;
}

.admin-owner-card strong {
  display: block;
  margin: 5px 0 4px;
  color: var(--text);
  font-size: 1.24rem;
  line-height: 1.08;
}

.admin-owner-card.ok {
  border-color: rgba(71, 178, 122, 0.28);
  background: rgba(240, 253, 244, 0.76);
}

.admin-owner-card.warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(255, 251, 235, 0.82);
}

.admin-summary-metrics strong {
  display: block;
  font-size: 1.35rem;
}

.admin-summary-metrics span,
.admin-summary-grid p,
.admin-summary-grid li {
  font-size: 0.85rem;
}

.admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-summary-grid ul {
  padding-left: 18px;
  margin: 8px 0 0;
}

.admin-summary-grid li {
  margin: 4px 0;
}

.admin-readiness-public details {
  margin-top: 8px;
}

.admin-readiness-public summary {
  cursor: pointer;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 700;
}

.admin-readiness-public code,
.admin-readiness-public pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.admin-readiness-public pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: #eef4ff;
  border: 1px solid rgba(99, 102, 241, 0.18);
  color: #24324f;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .admin-owner-grid,
  .admin-summary-metrics,
  .admin-summary-grid {
    grid-template-columns: 1fr;
  }
}

.report-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  z-index: 100000;
  padding: 18px;
}

.report-modal-content {
  width: min(520px, 100%);
  border-radius: 18px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  position: relative;
}

.report-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
  color: #64748b;
}

.report-modal-meta {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

#reportMessage {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border: 1px solid rgba(141, 152, 186, 0.35);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
}

.report-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.report-submit-btn,
.report-cancel-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

.report-submit-btn {
  background: #635bff;
  color: #fff;
}

.report-cancel-btn {
  background: #eef2ff;
  color: #334155;
}

.reports-admin-content {
  max-width: 760px;
}

.reports-admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 12px;
  flex-wrap: wrap;
}

.reports-admin-toolbar select,
.report-status-select {
  border: 1px solid rgba(141, 152, 186, 0.35);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font: inherit;
  padding: 7px 10px;
}

.reports-status-summary {
  color: #64748b;
  font-size: 0.9rem;
}

.report-admin-item {
  text-align: left;
  border: 1px solid rgba(141, 152, 186, 0.22);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  background: #fff;
}

.report-admin-item.report-status-new {
  border-color: rgba(245, 158, 11, 0.55);
  background: #fffbeb;
}

.report-admin-item.report-status-in_progress {
  border-color: rgba(99, 91, 255, 0.38);
  background: #f5f7ff;
}

.report-admin-item.report-status-fixed,
.report-admin-item.report-status-not_reproduced {
  background: #f8fafc;
}

.report-admin-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
}

.report-admin-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
}

.report-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
  background: #eef2ff;
}

.report-status-pill-new {
  color: #92400e;
  background: #fef3c7;
}

.report-status-pill-in_progress {
  color: #3730a3;
  background: #e0e7ff;
}

.report-status-pill-fixed {
  color: #166534;
  background: #dcfce7;
}

.report-status-pill-not_reproduced {
  color: #475569;
  background: #e2e8f0;
}

.report-admin-message {
  margin: 10px 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(99, 91, 255, 0.07);
  white-space: pre-wrap;
}

.report-reviewed,
.report-empty {
  color: #64748b;
}

.leaderboard-hint {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #1e3c72;
  color: white;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.leaderboard-hint::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e3c72;
}

.leaderboard.show-hint .leaderboard-hint {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes hintPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(30, 60, 114, 0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(30, 60, 114, 0.15);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(30, 60, 114, 0);
  }
}

.leaderboard.show-hint .leaderboard-toggle {
  display: inline-block;
  animation: hintPulse 1.2s ease-in-out 2;
  border-radius: 10px;
}

.leaderboard.show-hint {
  box-shadow: 0 0 0 2px rgba(30, 60, 114, 0.25);
}

/* =========================
   19. STATS CARDS
   ========================= */

.stats-card {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(130,148,190,0.18);
  box-shadow: 0 8px 20px rgba(24,35,63,0.06);
  text-align: center;
  color: #4b587c;
  line-height: 1.45;
}

.stats-card-experimental {
  background:
    radial-gradient(circle at 85% 20%, rgba(124,92,255,0.08), transparent 28%),
    rgba(255,255,255,0.78);
  border-color: rgba(79,107,255,0.18);
}

.stats-card-experimental > div:first-child {
  font-weight: 800;
  margin-bottom: 6px;
  color: #24345f;
}

/* =========================
   20. PREMIUM POPUP
   ========================= */

#premiumBadge {
  position: fixed;
  top: 12px;
  right: 12px;
  background: rgba(255, 215, 0, 0.15);
  color: #b8860b;
  border: 1px solid rgba(255, 215, 0, 0.40);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0.88;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

#premiumBadge strong {
  font-weight: 700;
}

#premiumCtaButton {
  position: fixed;
  right: 12px;
  bottom: 16px;
  z-index: 9999;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 215, 0, 0.92);
  color: #3b2f00;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#premiumCtaButton:hover {
  transform: translateY(-1px);
}

#premiumPopupOverlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000 !important;
  padding: 16px;
}

#premiumPopup {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  color: #1f1f1f;
  border-radius: 16px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
  padding: 22px 20px 18px;
}

#premiumPopup h3 {
  margin: 0 0 12px 0;
  font-size: 22px;
  line-height: 1.2;
}

#premiumPopup p {
  margin: 0 0 12px 0;
  line-height: 1.5;
  font-size: 15px;
}

#premiumPopup .premium-popup-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

#premiumPopup .premium-popup-primary,
#premiumPopup .premium-popup-secondary {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#premiumPopup .premium-popup-primary {
  background: rgba(255, 215, 0, 0.92);
  color: #3b2f00;
}

#premiumPopup .premium-popup-secondary {
  background: #ececec;
  color: #333333;
}

#premiumPopup .premium-popup-note {
  font-size: 13px;
  color: #666666;
  margin-top: 6px;
}

/* =========================
   21. COMPLETION MODAL
   ========================= */

.completion-overlay {
  position: fixed !important;
  inset: 0 !important;
  background:
    radial-gradient(circle at 18% 18%, rgba(124,92,255,0.14), transparent 28%),
    rgba(248, 250, 255, 0.78);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.completion-card {
  width: min(680px, 92vw) !important;
  max-width: 680px !important;
  padding: 34px 34px 28px !important;

  background:
    radial-gradient(circle at 16% 10%, rgba(124,92,255,0.16), transparent 26%),
    radial-gradient(circle at 86% 18%, rgba(255,184,77,0.16), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,255,0.98)) !important;

  color: #1f2a44;
  border-radius: 34px !important;
  border: 1px solid rgba(124,92,255,0.14);

  box-shadow:
    0 24px 70px rgba(79,107,255,0.18),
    0 8px 24px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.9) !important;

  text-align: center;
  animation: popIn 0.3s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.completion-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(124,92,255,0.09);
  border: 1px solid rgba(124,92,255,0.16);
  color: #4b4f8f;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.completion-title {
  font-size: clamp(1.9rem, 2.5vw, 2.5rem) !important;
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 900;
  margin-bottom: 14px !important;
  color: #1f2a44 !important;
}

.completion-current-wrap {
  margin-top: 6px;
  margin-bottom: 16px;
}

.completion-current-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #667085;
  margin-bottom: 8px;
}

.completion-current {
  font-size: clamp(1.25rem, 1.7vw, 1.7rem);
  line-height: 1.18;
  font-weight: 900;
  color: #25304d;
}

.completion-divider {
  width: 72px;
  height: 1px;
  margin: 8px auto 18px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(124,92,255,0.22),
    transparent
  );
}

.completion-next-label {
  font-size: 0.95rem !important;
  font-weight: 700;
  color: #667085 !important;
  margin-top: 12px !important;
  margin-bottom: 12px !important;
  letter-spacing: 0.01em;
}

.completion-rec-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 18px 0 24px !important;
  text-align: left;
}

.completion-rec {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 18px 22px !important;
  border-radius: 24px !important;
  border: 1px solid rgba(124,92,255,0.12);
  box-shadow: 0 10px 26px rgba(79,107,255,0.10);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.completion-rec:hover {
  transform: translateY(-2px);
}

.completion-rec--hero {
  background:
    radial-gradient(circle at 12% 20%, rgba(255,184,77,0.16), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(239,236,255,0.96)) !important;
  border-color: rgba(124,92,255,0.18) !important;
  box-shadow:
    0 16px 34px rgba(124,92,255,0.14),
    0 0 0 1px rgba(255,255,255,0.9) inset !important;
}

.completion-rec:not(.completion-rec--hero) {
  opacity: 0.94;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(247,249,255,0.94)) !important;
  box-shadow: 0 8px 18px rgba(79,107,255,0.08) !important;
}

.completion-rec-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: #667085 !important;
  margin-bottom: 6px;
}

.completion-rec--hero .completion-rec-label {
  color: #7c5cff !important;
  font-weight: 900 !important;
  letter-spacing: 0.01em;
}

.completion-rec--warmup {
  border-color: rgba(46, 170, 92, 0.22) !important;
  background:
    radial-gradient(circle at 12% 20%, rgba(46, 170, 92, 0.12), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,0.97), rgba(240,251,246,0.97)) !important;
}

.completion-rec--warmup .completion-rec-label {
  color: #2f8a53 !important;
}

.completion-rec-title {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 850;
  color: #24304d !important;
}

.completion-rec--hero .completion-rec-title {
  font-size: 1.12rem;
}

.completion-rec-meta {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #667085;
}

.completion-actions {
  margin-top: 10px !important;
  display: flex;
  justify-content: center;
}

.completion-actions .btn-next,
.completion-actions .btn-choose {
  min-width: 220px !important;
  padding: 13px 20px !important;
  border-radius: 999px !important;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: -0.01em;
  margin: 6px;
}

.completion-actions .btn-next {
  background: #ffffff;
  color: #25304d;
  border: 1px solid rgba(124,92,255,0.18);
}

.completion-actions .btn-choose {
  background: linear-gradient(135deg, rgba(79,107,255,0.98), rgba(124,92,255,0.98)) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    0 16px 34px rgba(79,107,255,0.24),
    0 0 0 1px rgba(255,255,255,0.12) inset !important;
}

.completion-actions .btn-choose:hover {
  transform: translateY(-1px) scale(1.01);
}

.btn-next {
  background: #ffffff;
  color: #1e3c72;
}

.btn-choose {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* =========================
   22. SOFT SCI-FI AMBIENCE
   ========================= */

body {
  position: relative;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(124,92,255,0.10), transparent 20%),
    radial-gradient(circle at 82% 14%, rgba(79,107,255,0.10), transparent 18%),
    radial-gradient(circle at 78% 74%, rgba(255,184,77,0.08), transparent 16%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
  filter: blur(8px);
}


/* =========================
   23. MISC
   ========================= */

.feedback-footer {
  margin-top: 20px;
  font-size: 0.75rem;
  text-align: center;
  border-top: 1px solid rgba(130,148,190,0.12);
  padding-top: 12px;
  color: var(--muted);
}

.mobile-scroll-hint {
  display: none;
}

.skip-toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -45%) scale(0.96);
  background: rgba(255, 239, 242, 0.96);
  color: #6b2434;
  padding: 16px 22px;
  border-radius: 22px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  min-width: 280px;
  max-width: min(520px, calc(100% - 32px));
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 10001;
  border: 1px solid rgba(214, 92, 120, 0.25);
  box-shadow: 0 12px 36px rgba(107, 36, 52, 0.20);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.skip-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: skipToastPulse 1.2s ease-in-out infinite;
}

@keyframes skipToastPulse {
  0%, 100% {
    box-shadow: 0 12px 36px rgba(107, 36, 52, 0.18);
  }
  50% {
    box-shadow: 0 16px 44px rgba(107, 36, 52, 0.28);
  }
}

.clean-btn {
  background: #a13e3e;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 10px;
}

.clean-btn:hover {
  background: #7a2e2e;
}

/* =========================
   24. MOBILE
   ========================= */

@media (max-width: 800px) {
  body {
    margin: 0;
    padding: 0;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body::after {
    opacity: 0.65;
    filter: blur(10px);
    animation: none;
  }

  .app-container {
    min-height: 100svh !important;
    min-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    overflow: visible !important;
    max-width: 100%;
    margin: 0;
  }

  .trainer-panel,
  .text-panel {
    width: 100%;
    min-width: auto !important;
    min-height: 120px !important;
    margin: 0;
    border-radius: 0 !important;
    position: relative !important;
    top: auto !important;
    overflow-y: auto !important;
    padding: 16px;
    box-sizing: border-box;
  }

  .trainer-panel {
    flex: 0 0 auto !important;
    max-height: none !important;
    border-bottom: 1px solid rgba(130,148,190,0.18);
  }

  .text-panel {
    flex: 1 1 auto !important;
    border-top: 1px solid rgba(130,148,190,0.18);
  }

  .trainer-panel::before,
  .text-panel::before,
  .trainer-panel::after,
  .text-panel::after {
    display: none;
  }

  h1 {
    font-size: 1.5rem !important;
    margin-top: 0;
  }

  #mainContent {
    min-height: 0;
  }

  .question-text {
    font-size: 1rem !important;
  }

  .sentence-source-cue {
    align-items: flex-start;
    margin: -4px 0 12px 0;
    font-size: 0.78rem;
  }

  .sentence-source-btn {
    min-height: 32px;
    padding: 6px 10px !important;
    font-size: 0.76rem !important;
  }

  .text-content {
    line-height: 1.62 !important;
  }

  .user-bar,
  .topic-selector {
    margin-bottom: 8px;
    flex-wrap: wrap;
  }

  .stage-header {
    margin: 8px 0;
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .question-card {
    padding: 12px;
    margin: 8px 0;
  }

  .option {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .topic-selector {
    gap: 8px;
    padding: 12px;
  }

  .topic-browser {
    margin: 10px 0 12px;
  }

  .topic-category-tabs {
    margin-bottom: 8px;
  }

  .topic-card-list {
    gap: 7px;
  }

  .topic-card {
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .topic-level-complete {
    align-items: stretch;
    flex-direction: column;
  }

  .topic-card-title {
    margin-bottom: 2px;
    font-size: 0.82rem;
    line-height: 1.18;
  }

  .topic-card-status {
    margin-top: 0;
    padding: 1px 6px;
    font-size: 0.58rem;
  }

  .topic-card-progress {
    height: 4px;
    margin-top: 5px;
  }

  .topic-selector select {
    width: 100%;
    max-width: 100%;
    flex: none;
  }

  button {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .text-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .text-zoom-controls {
    display: flex;
    justify-content: center;
    margin-top: 0 !important;
  }

  .leaderboard th:first-child,
  .leaderboard td:first-child {
    width: 45px;
  }

  .leaderboard th:last-child,
  .leaderboard td:last-child {
    width: 55px;
  }

  .skip-toast {
    top: 46%;
    width: calc(100% - 28px);
    min-width: 0;
    padding: 15px 16px;
    font-size: 0.95rem;
  }

  .completion-card {
    width: 94vw !important;
    padding: 24px 18px 22px !important;
    border-radius: 26px !important;
  }

  .completion-title {
    font-size: 1.7rem !important;
  }

  .completion-current {
    font-size: 1.15rem !important;
  }

  .completion-rec {
    padding: 16px 16px !important;
    border-radius: 20px !important;
  }

  .completion-actions .btn-choose,
  .completion-actions .btn-next {
    width: 100%;
    min-width: 0;
  }

  .mobile-split-handle {
    display: flex !important;
    flex: 0 0 auto !important;
    min-height: 30px !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(238,243,251,0.94), rgba(255,255,255,0.86));
    border-top: 1px solid rgba(130,148,190,0.22);
    border-bottom: 1px solid rgba(130,148,190,0.22);
    color: #5f6d8c;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    cursor: default;
    touch-action: auto;
    position: relative;
  }

  .mobile-split-handle::before,
  .mobile-split-handle::after {
    content: "";
    flex: 1 1 auto;
    max-width: 88px;
    height: 1px;
    background: rgba(130,148,190,0.42);
  }

  .mobile-split-handle span {
    flex: 0 0 auto;
    padding: 0 10px;
  }

  .user-bar {
    align-items: stretch;
  }

  .user-bar .total-score {
    display: none;
  }


  .user-bar > button,
  .user-bar > .admin-mobile-entry {
    min-height: 38px;
  }

  #adminPanelBtn.admin-mobile-entry {
    order: -1;
    flex: 1 1 110px;
    min-width: 104px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  body {
    overflow-y: auto !important;
  }

  .app-container {
    min-height: 100svh !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }

  .trainer-panel,
  .text-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .text-panel {
    display: flex !important;
    min-height: 55svh !important;
    min-height: 55dvh !important;
  }
}

@media (max-width: 600px) {
  .auth-row {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-row button {
    width: 100%;
    white-space: normal;
  }

  #loginPanel {
    padding: 16px 12px;
  }

  .trainer-panel {
    padding-bottom: 24px;
  }

  body {
    background-size: contain;
    background-color: #f0f2f5;
  }
}

@media (min-width: 801px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-height: 600px) {
  .trainer-panel {
    overflow-y: visible;
  }

  #loginPanel {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after,
  #topicProgressBar::after {
    animation: none !important;
  }

  .topic-card,
  .topic-category-tab,
  .option {
    transition: none !important;
  }
}

/* ===== WF unified final ===== */

.wf-question-text {
  line-height: 1.78 !important;
}

.wf-container {
  display: inline;
}

.wf-inline-block {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  vertical-align: middle !important;
  margin: 0 3px 3px !important;
  position: relative !important;
}

.wf-choice-wrap,
.wf-choice-wrap.compact {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0 4px 6px;
  vertical-align: baseline;
  max-width: 100%;
}

.wf-choice-current {
  min-height: 32px !important;
  padding: 4px 11px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.94) !important;
  border: 1px solid rgba(130,148,190,0.18) !important;
  color: #1f2b49 !important;
  font-size: 0.9rem !important;
  line-height: 1.05 !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.wf-choice-current:empty,
.wf-choice-current.is-empty {
  color: #7b88a4 !important;
  font-weight: 600 !important;
}

.wf-choice-current:hover {
  border-color: rgba(79,107,255,0.28) !important;
  background: rgba(255,255,255,0.98) !important;
}

.wf-choice-current.correct {
  background: rgba(34,197,94,0.10) !important;
  border-color: rgba(34,197,94,0.28) !important;
  color: #14532d !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em;
}

.wf-choice-current.wrong {
  background: rgba(239,68,68,0.045) !important;
  border-color: rgba(239,68,68,0.14) !important;
  color: #a53030 !important;
  font-weight: 740 !important;
  letter-spacing: -0.01em;
}

.wf-mark {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.68;
  font-size: 0.92em;
  font-weight: 800;
}

.wf-base,
.wf-base.compact {
  display: inline-flex;
  align-items: center;
  margin-top: 0 !important;
  padding: 1px 6px !important;
  border-radius: 999px !important;
  background: rgba(79,107,255,0.07);
  color: #6f7b95 !important;
  font-size: 0.62rem !important;
  line-height: 1 !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85 !important;
}

.wf-feedback,
.wf-feedback.compact {
  margin-top: 1px !important;
  font-size: 0.72rem !important;
  line-height: 1.15 !important;
  color: #b42318 !important;
}

.wf-feedback .wf-reason {
  color: #7b88a4 !important;
  font-weight: 600 !important;
}

.wf-correct-answer,
.wf-correct-answer.compact {
  display: inline-flex;
  align-items: center;
  margin-top: 1px !important;
  padding: 2px 6px !important;
  border-radius: 999px !important;
  background: rgba(255, 228, 92, 0.48) !important;
  color: #18233f !important;
  font-size: 0.72rem !important;
  line-height: 1.05 !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

.wf-choice-list,
.wf-choice-list.inline-popup {
  display: flex;
  flex-direction: column;
  gap: 5px !important;
  margin-top: 5px !important;
  padding: 7px !important;
  min-width: 150px !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(130,148,190,0.18) !important;
  box-shadow: 0 10px 24px rgba(24,35,63,0.08);
  z-index: 3;
}

.wf-choice-btn {
  padding: 6px 10px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.92) !important;
  border: 1px solid rgba(130,148,190,0.18) !important;
  color: #24345f !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.wf-choice-btn:hover {
  background: rgba(79,107,255,0.06) !important;
  border-color: rgba(79,107,255,0.28) !important;
}

.question-card .wf-inline-block + .wf-inline-block {
  margin-left: 6px !important;
}

/* ===== Login panel refinement ===== */

#loginPanel.auth-panel {
  max-width: 920px;
  margin: 0 auto 22px;
  padding: 18px 20px !important;
  gap: 14px;
}

.auth-tabs {
  width: 100%;
  justify-content: flex-start !important;
}

.auth-tab {
  min-width: 138px;
}

.auth-slide-form {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}
.auth-slide-form.open {
    max-height: 260px;
    opacity: 1;
}

.auth-slide-form .auth-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.auth-slide-form input {
  flex: 1 1 220px;
  min-width: 0;
  height: 40px;
  border-radius: 18px !important;
  font-size: 1rem;
}

#loginBtn,
#registerBtn {
  height: 46px;
  padding: 0 20px !important;
  border-radius: 18px !important;
  white-space: nowrap;
}

#registerFormWrap:not(.open),
#loginFormWrap:not(.open) {
  display: none;
}

@media (max-width: 800px) {
  #loginPanel.auth-panel {
    max-width: 100%;
    padding: 14px 14px !important;
  }

  .auth-slide-form .auth-row {
    flex-direction: column;
    align-items: stretch;
  }

  #loginBtn,
  #registerBtn {
    width: 100%;
  }
}
/* Удалён конфликтующий мобильный фикс: он принудительно ломал login/mainApp и переключение форм. */


#speakTextBtn {
    display: none !important;
}


/* Кнопки аудиоплеера – улучшенный дизайн */
#audioPrevBtn,
#audioPlayPauseBtn,
#audioNextBtn,
#audioStopBtn {
    min-width: 80px;          /* ширина для комфортного нажатия */
    padding: 8px 12px;
    background: linear-gradient(135deg, #1e3c72, #2a5298) !important;
    color: white !important;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 40px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

#audioPrevBtn:hover,
#audioPlayPauseBtn:hover,
#audioNextBtn:hover,
#audioStopBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.audio-btn {
    transition: transform 0.1s ease, background 0.2s;
}

.audio-btn:active {
    transform: scale(0.96);
}

.current-sentence {
  display: inline;
  color: #18233f;
  font-weight: 700;

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.58),
      rgba(255,255,255,0.36)
    ),
    linear-gradient(
      135deg,
      rgba(124,92,255,0.14),
      rgba(79,107,255,0.18)
    );

  border: 1px solid rgba(124, 92, 255, 0.18);
  border-radius: 10px;

  padding: 2px 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;

  box-shadow:
    0 6px 16px rgba(124, 92, 255, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.45);

  transition: all 0.2s ease;
}
.audio-btn {
    transition: transform 0.1s ease, background 0.2s;
}
.audio-btn:active {
    transform: scale(0.96);
}
.level-badge {
    background: #4f6bff20;
    border-radius: 40px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e3c72;
    border: 1px solid #4f6bff40;
}
.text-panel h3 {
    position: sticky;
    top: 0;
    background: inherit;         /* фон подложки */
    backdrop-filter: blur(12px); /* чтобы не просвечивал текст */
    z-index: 5;
    padding: 12px 0;
    margin-top: 0;
}
.highlight-word {
    background: #ffeb3b;
    color: #1e3c72;
    font-weight: bold;
    border-radius: 8px;
    padding: 2px 4px;
    transition: background 0.2s;
}
/* Для десктопа и мобильных – единая высота 44px */
.auth-slide-form input,
#regLevel,
#loginBtn,
#registerBtn {
    height: 44px;
    box-sizing: border-box;
}

/* На мобильных – поля в столбец, отступы */
@media (max-width: 800px) {
    .auth-slide-form .auth-row {
        gap: 8px;
    }
    .auth-slide-form input,
    #regLevel,
    #loginBtn,
    #registerBtn {
        width: 100%;
    }
}
.auth-slide-form input,
#regLevel {
    padding: 12px 16px;
    height: auto;
    font-size: 1rem;
}
#regLevel {
    height: 44px;           /* или padding: 12px 16px */
    border-radius: 18px;
    background-color: var(--surface-3);
}
/* Мобильная форма регистрации — комфортная высота и вертикальное расположение */
@media (max-width: 800px) {
  .auth-row {
    flex-direction: column;
    gap: 12px;
  }

  .auth-slide-form input,
  #regLevel {
    width: 100%;
    box-sizing: border-box;
    height: 48px;            /* комфортно для нажатия пальцем */
    padding: 0 16px;
    font-size: 16px;         /*防止 масштабирования на iOS */
    border-radius: 24px !important;
  }

  #loginBtn,
  #registerBtn {
    width: 100%;
    height: 48px;
    font-size: 16px;
    margin-top: 4px;
  }

  /* Дополнительно — отступы и внешний вид */
  .auth-slide-form {
    margin-top: 8px;
  }
}
/* Вертикальная ориентация телефона (узкие экраны) – уменьшаем высоту полей */
@media (max-width: 600px) {
  .auth-slide-form input,
  #regLevel,
  #loginBtn,
  #registerBtn {
    height: 34px;           /* было 40px – станет аккуратнее */
    padding: 0 12px;
    font-size: 14px;
  }
  /* Если используете height: auto – просто уменьшите отступы */
  .auth-slide-form input {
    padding: 6px 12px;
    height: auto;
  }
  #loginBtn, #registerBtn {
    line-height: 1.2;
  }
}
/* Мобильные устройства – плоские поля без скруглений, компактная высота */
@media (max-width: 600px) {
  .auth-slide-form input,
  #regLevel,
  #loginBtn,
  #registerBtn {
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 6px !important;
  }
}
.topic-category-tab .category-label {
  position: relative;
  z-index: 2;
  display: inline-block;
}

.topic-category-tab .category-progress {
  z-index: 1;
}
.exercise-nav-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

.exercise-nav-btn {
  background: rgba(255,255,255,0.82) !important;
  color: #1f2b49 !important;
  border: 1px solid rgba(130,148,190,0.18) !important;
  border-radius: 999px !important;
  padding: 8px 14px !important;
  font-size: 0.85rem !important;
  font-weight: 700;
  box-shadow: none !important;
}

.exercise-nav-btn:hover {
  background: rgba(79,107,255,0.06) !important;
  border-color: rgba(79,107,255,0.28) !important;
  transform: translateY(-1px);
}
.question-card {
  touch-action: pan-y;
}
.exercise-nav-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(79,107,255,0.08);
  color: #24345f;
  font-size: 0.85rem;
  font-weight: 800;
  border: 1px solid rgba(130,148,190,0.18);
}

.exercise-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.exercise-progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 3px 0 5px;
}

.exercise-progress-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0;
  border: none;
  box-shadow: none;
  line-height: 1;
  opacity: 0.42;
}

.exercise-progress-chip.solved {
  background: rgba(46, 170, 92, 0.07);
  color: rgba(47, 138, 83, 0.88);
}

.exercise-progress-chip.skipped {
  background: rgba(255, 184, 77, 0.08);
  color: rgba(154, 101, 0, 0.82);
}

.stage-btn-label {
  position: relative;
  z-index: 1;
}

.stage-skipped-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 184, 77, 0.16);
  color: #9a6500;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.stage-btn.active .stage-skipped-badge {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.stage-btn.completed .stage-skipped-badge {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.topic-card-status {
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  opacity: 0.65;
}

.topic-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.topic-card-stats {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: #70809f;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.topic-card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(130,148,190,0.16);
}

.topic-card-status--done {
  background: rgba(46, 170, 92, 0.08);
  color: #2f8a53;
}

.topic-card-status--progress {
  background: rgba(255, 184, 77, 0.10);
  color: #9a6500;
}

.topic-card-status--new {
  background: rgba(79,107,255,0.07);
  color: #4d5c7f;
}

.topic-card-status--locked {
  background: rgba(220, 53, 69, 0.08);
  color: #9f1d2d;
}

.guest-topic-limit-note {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.topic-level-complete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(46, 170, 92, 0.18);
  border-radius: 12px;
  background: rgba(46, 170, 92, 0.07);
  color: var(--text);
}

.topic-level-complete strong,
.topic-level-complete span {
  display: block;
}

.topic-level-complete strong {
  font-size: 0.86rem;
  margin-bottom: 2px;
}

.topic-level-complete span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.topic-level-complete button {
  flex: 0 0 auto;
  border: 1px solid rgba(46, 170, 92, 0.28);
  background: #fff;
  color: #236d42;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 0.78rem;
}

.topic-level-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(99, 91, 255, 0.16);
  border-radius: 12px;
  background: rgba(79, 107, 255, 0.06);
  color: var(--text);
}

.topic-level-switch strong,
.topic-level-switch span {
  display: block;
}

.topic-level-switch strong {
  font-size: 0.86rem;
  margin-bottom: 2px;
}

.topic-level-switch span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.topic-level-switch button {
  flex: 0 0 auto;
  border: 1px solid rgba(99, 91, 255, 0.24);
  background: #fff;
  color: #4248a9;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 0.78rem;
}

.topic-card-progress {
  width: 100%;
  height: 5px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(130,148,190,0.12);
  overflow: hidden;
}

.topic-card-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(79,107,255,0.96), rgba(124,92,255,0.96));
}
.text-panel-top {
  position: sticky;
  top: 0;
  z-index: 24;
  width: 100%;
  max-height: 190px;
  overflow: hidden;
  padding: 0 0 8px;
  margin: 0 0 8px;
  background: linear-gradient(
    180deg,
    rgba(248,250,255,0.94) 0%,
    rgba(248,250,255,0.84) 72%,
    rgba(248,250,255,0.00) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    max-height 0.25s ease,
    padding 0.22s ease,
    margin 0.22s ease;
}

.text-title-wrap {
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 10px 6px;
  border-radius: 16px;
  background: rgba(255,255,255,0.52);
  border: 1px solid rgba(130,148,190,0.10);
  box-shadow: 0 6px 14px rgba(24,35,63,0.03);
}

.text-panel-subtitle {
  margin-top: 4px;
  font-size: 0.74rem;
  line-height: 1.3;
  color: #7d879c;
  font-weight: 600;
}

.text-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 6px;
  padding: 7px 9px;
  border-radius: 16px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(130,148,190,0.12);
  box-shadow: 0 6px 14px rgba(24,35,63,0.03);
}

#textPanelTitle {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  color: #22304d;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.text-zoom-controls {
  display: inline-flex;
  gap: 6px;
  margin-left: 0 !important;
  vertical-align: middle;
  pointer-events: auto !important;
}


.text-panel.leaderboard-mode .text-panel-top {
  opacity: 0;
  transform: translateY(-10px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  pointer-events: none;
}
#textContent {
  width: 100%;
  padding: 6px 4px 2px;
  line-height: 1.72;
  color: #2a3550;
}

#textContent br + br {
  content: "";
}

.leaderboard {
  margin-top: 8px;
}
.text-panel-top {
  position: sticky;
  top: 0;
  z-index: 24;
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 0 0 4px;
  margin: 0 0 4px;
  background: linear-gradient(
    180deg,
    rgba(248,250,255,0.92) 0%,
    rgba(248,250,255,0.78) 62%,
    rgba(248,250,255,0.00) 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    max-height 0.25s ease,
    padding 0.22s ease,
    margin 0.22s ease;
}

.text-title-wrap {
  width: 100%;
  margin-bottom: 4px;
  padding: 5px 8px 4px;
  border-radius: 14px;
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(130,148,190,0.08);
  box-shadow: 0 4px 10px rgba(24,35,63,0.02);
}

#textPanelTitle {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.18;
  color: #22304d;
  font-weight: 800;
  letter-spacing: 0;
}

.text-title-separator {
  color: #7d879c;
  font-weight: 700;
}

.text-title-ru {
  font-size: 0.86em;
  font-weight: 700;
  color: #4d5c7f;
}

.text-panel-subtitle {
  margin-top: 2px;
  font-size: 0.62rem;
  line-height: 1.2;
  color: #8a94a8;
  font-weight: 600;
}

.text-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 4px;
  padding: 5px 7px;
  border-radius: 14px;
  background: rgba(255,255,255,0.50);
  border: 1px solid rgba(130,148,190,0.10);
  box-shadow: 0 4px 10px rgba(24,35,63,0.02);
}


#textContent {
  width: 100%;
  padding: 2px 4px 2px;
  line-height: 1.68;
  color: #2a3550;
}
.text-toolbar {
  position: relative;
}

.audio-dock-toggle {
  min-width: 40px;
  min-height: 34px;
  font-size: 0.95rem;
  border-radius: 12px !important;
}

.text-audio-toggle {
  min-width: 82px;
  gap: 5px;
  font-weight: 800;
  color: #1e3c72 !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(235,242,255,0.98)) !important;
  border: 1px solid rgba(79,107,255,0.26) !important;
  box-shadow: 0 6px 16px rgba(79,107,255,0.12);
}

.audio-toggle-label {
  font-size: 0.82rem;
  line-height: 1;
}

.audio-dock {
  width: 100%;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  margin: 0;
  transition:
    max-height 0.28s ease,
    opacity 0.2s ease,
    transform 0.2s ease,
    margin 0.2s ease;
}

.audio-dock.open {
  max-height: 260px;
  opacity: 1;
  transform: translateY(0);
  margin: 0;
}

.starter-nav-row {
  justify-content: space-between;
  margin-top: 12px;
}

.audio-dock-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(130,148,190,0.14);
  box-shadow:
    0 6px 14px rgba(24,35,63,0.04),
    inset 0 1px 0 rgba(255,255,255,0.82);
}

#audioPrevBtn,
#audioPlayPauseBtn,
#audioNextBtn,
#audioStopBtn {
  min-width: 44px;
  min-height: 34px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #1e3c72, #2a5298) !important;
  color: white !important;
  border: 1px solid rgba(79,107,255,0.18) !important;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 999px !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
}

#audioPrevBtn:hover,
#audioPlayPauseBtn:hover,
#audioNextBtn:hover,
#audioStopBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}

.audio-btn {
  transition: transform 0.1s ease, background 0.2s;
}

.audio-btn:active {
  transform: scale(0.96);
}

#audioProgress {
  background: rgba(79,107,255,0.08) !important;
  color: #31456d !important;
  border-radius: 999px !important;
  padding: 4px 9px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
}
.compact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.soft-btn {
  opacity: 0.7;
}

.soft-btn:hover {
  opacity: 1;
}

.soft-meta {
  opacity: 0.8;
}

.soft-meta-btn {
  opacity: 0.8;
}

.soft-meta-btn:hover {
  opacity: 1;
}

.exercise-nav-meta.soft-meta {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.35);
}
.dots-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.nav-icon-btn {
  min-width: 34px;
  padding: 4px 8px;
  font-size: 0.9rem;
}

.exercise-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  overflow: visible;
  max-width: 100%;
  padding: 2px 0;
  row-gap: 6px;
}

.exercise-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  border: 1px solid rgba(130,148,190,0.22);
  background: rgba(130,148,190,0.18);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.exercise-dot:hover {
  transform: scale(1.15);
}

.exercise-dot.pending {
  background: rgba(130,148,190,0.16);
  border-color: rgba(130,148,190,0.20);
}

.exercise-dot.correct {
  background: rgba(46,170,92,0.88);
  border-color: rgba(46,170,92,0.92);
}

.exercise-dot.wrong {
  background: rgba(220,53,69,0.82);
  border-color: rgba(220,53,69,0.88);
}

.exercise-dot.skipped {
  background: rgba(255,184,77,0.22);
  border-color: rgba(255,184,77,0.72);
}

.exercise-dot.current {
  background: rgba(124,92,255,0.96);
  border-color: rgba(124,92,255,1);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.14);
  transform: scale(1.12);
}

.highlight,
.highlight-word {
  display: inline;
  color: #18233f;
  font-weight: 700;

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.58),
      rgba(255,255,255,0.36)
    ),
    linear-gradient(
      135deg,
      rgba(124,92,255,0.14),
      rgba(79,107,255,0.18)
    );

  border: 1px solid rgba(124, 92, 255, 0.18);
  border-radius: 10px;

  padding: 2px 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;

  box-shadow:
    0 6px 16px rgba(124, 92, 255, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.45);

  transition: all 0.2s ease;
}
.sound-toggle-btn {
  opacity: 0.85;
}

.sound-toggle-btn:hover {
  opacity: 1;
}

.word-translation-word {
  position: relative;
  display: inline;
  border-bottom: 2px solid rgba(31, 124, 107, 0.45);
  cursor: help;
  text-decoration: none;
  outline: none;
  background: linear-gradient(180deg, rgba(255,255,255,0) 58%, rgba(70, 201, 174, 0.20) 58%);
  border-radius: 3px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.word-translation-phrase {
  border-bottom-style: double;
  background: linear-gradient(180deg, rgba(255,255,255,0) 54%, rgba(255, 211, 102, 0.30) 54%);
}

.word-translation-word:hover,
.word-translation-word:focus,
.word-translation-word.active {
  color: #18233f;
  background: linear-gradient(180deg, rgba(255, 249, 224, 0.92), rgba(255, 236, 168, 0.86));
  border-bottom-color: rgba(31, 124, 107, 0.95);
}

.word-translation-popover {
  position: fixed;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 7px 10px;
  border: 1px solid rgba(111, 191, 172, 0.26);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(250, 254, 253, 0.99)),
    #ffffff;
  color: #18233f;
  box-shadow: 0 10px 22px rgba(24, 35, 63, 0.10);
  font-size: 0.9rem;
  line-height: 1.25;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.word-translation-popover.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.word-translation-popover-translation {
  min-width: 0;
  color: #18233f;
  font-size: 0.92rem;
  font-weight: 650;
}

.exercise-controls-row {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  margin: 4px 8px 6px auto;
  min-height: 0;
  padding: 5px;
  border: 1px solid rgba(130,148,190,0.20);
  border-radius: 999px;
  background: rgba(255,255,255,0.90);
  box-shadow: 0 12px 26px rgba(24,35,63,0.09);
  backdrop-filter: blur(10px);
  z-index: 9;
}

.exercise-zoom-controls {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.exercise-zoom-controls .small-btn {
  min-width: 50px;
  min-height: 34px;
  border-radius: 999px !important;
  font-weight: 800;
}

.zoom-menu-host {
  position: relative;
}

.zoom-percent-trigger {
  min-width: 64px !important;
  padding-inline: 10px !important;
}

.zoom-percent-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: none;
  grid-template-columns: repeat(3, minmax(54px, 1fr));
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(120, 142, 190, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(31, 41, 73, 0.14);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.zoom-menu-host.zoom-menu-open .zoom-percent-menu {
  display: grid;
}

.zoom-percent-option {
  height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(132, 150, 190, 0.26);
  border-radius: 999px;
  background: rgba(247, 249, 255, 0.94);
  color: #31456d;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.zoom-percent-option:hover,
.zoom-percent-option:focus-visible {
  background: rgba(238, 242, 255, 0.98);
  border-color: rgba(116, 94, 255, 0.36);
  outline: none;
}

.zoom-percent-option.selected {
  background: linear-gradient(135deg, #7567ff, #6a5cff);
  border-color: rgba(116, 94, 255, 0.72);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(116, 94, 255, 0.22);
}

.exercise-audio-controls {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.exercise-audio-controls::before {
  content: '';
  width: 1px;
  height: 24px;
  margin: 0 2px;
  border-radius: 999px;
  background: rgba(130,148,190,0.22);
}

@media (max-width: 640px) {
  .exercise-controls-row {
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
    margin: 2px 0 6px auto;
    border-radius: 22px;
  }

  .exercise-zoom-controls {
    gap: 5px;
  }
}

.exercise-audio-controls .small-btn {
  min-width: 42px;
  min-height: 34px;
  border-radius: 999px !important;
  font-size: 0.92rem;
  box-shadow: none !important;
}

.exercise-audio-controls .stage-report-btn {
  width: 42px;
  height: 34px;
  min-width: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #31456d;
  box-shadow: none !important;
}

.exercise-audio-rate-toggle {
  min-width: 58px !important;
  padding: 5px 10px !important;
  font-weight: 800;
  color: #31456d !important;
}

.exercise-audio-rate-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: none;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(120, 142, 190, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(31, 41, 73, 0.14);
  backdrop-filter: blur(12px);
  z-index: 18;
}

.exercise-audio-controls.rate-menu-open .exercise-audio-rate-menu {
  display: flex;
}

.exercise-audio-rate-option {
  min-width: 56px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(132, 150, 190, 0.26);
  border-radius: 999px;
  background: rgba(247, 249, 255, 0.92);
  color: #31456d;
  font-weight: 800;
  font-size: 0.88rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.exercise-audio-rate-option:hover,
.exercise-audio-rate-option:focus-visible {
  background: rgba(238, 242, 255, 0.98);
  border-color: rgba(116, 94, 255, 0.36);
  outline: none;
}

.exercise-audio-rate-option.selected {
  background: linear-gradient(135deg, #7567ff, #6a5cff);
  border-color: rgba(116, 94, 255, 0.72);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(116, 94, 255, 0.22);
}

.exercise-sound-toggle.sound-toggle-btn.sound-off {
  opacity: 1;
  background: rgba(124,92,255,0.10) !important;
  border-color: rgba(124,92,255,0.22) !important;
  color: #4b4f7a !important;
}

.sound-toggle-btn.sound-off {
  opacity: 1 !important;
  background: rgba(220, 53, 69, 0.14) !important;
  border: 1px solid rgba(220, 53, 69, 0.28) !important;
  color: #a61e2d !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.5) inset;
}

.sound-toggle-btn.sound-off:hover {
  background: rgba(220, 53, 69, 0.18) !important;
  color: #8f1624 !important;
}

body:not(.trainer-active) .mobile-split-handle {
  display: none !important;
}

body:not(.trainer-active) .leaderboard h4::after {
  content: "";
}

@media (max-width: 800px) {
  body:not(.trainer-active) .app-container {
    height: auto !important;
    min-height: 100svh !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
  }

  body:not(.trainer-active) .trainer-panel {
    flex: 1 0 auto !important;
    min-height: 100svh !important;
    min-height: 100dvh !important;
    height: auto !important;
    max-height: none !important;
  }

  body:not(.trainer-active) .text-panel {
    display: none !important;
  }

  .start-actions {
    align-items: stretch;
    min-width: 0;
  }

  .guest-intro {
    font-size: 0.9rem;
  }

  #startGuestBtn {
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
  }
}

/* ===== AUTH FORM HARD RESET ===== */

#loginPanel.auth-panel {
  max-width: 920px !important;
  margin: 0 auto 22px !important;
  padding: 18px 20px !important;
  flex: 0 0 auto !important;
  max-height: min(760px, calc(100vh - 28px)) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

#loginPanel .auth-tabs {
  display: flex !important;
  gap: 10px !important;
  width: 100% !important;
  justify-content: flex-start !important;
  margin-bottom: 10px !important;
}

#loginPanel .auth-tab {
  min-width: 138px !important;
}

#loginPanel .auth-slide-form {
  display: none !important;
  opacity: 1 !important;
  max-height: none !important;
  overflow: visible !important;
  margin-top: 8px !important;
}

#loginPanel .auth-slide-form.open {
  display: block !important;
}

#loginPanel .auth-row {
  display: flex !important;
  gap: 10px !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}

#loginPanel input[type="text"],
#loginPanel input[type="password"],
#loginPanel select {
  flex: 1 1 220px !important;
  width: auto !important;
  min-width: 0 !important;
  height: 40px !important;
  max-height: 40px !important;
  padding: 0 14px !important;
  margin: 0 !important;
  display: block !important;
  border-radius: 18px !important;
  font-size: 1rem !important;
  line-height: 40px !important;
  background: rgba(255,255,255,0.96) !important;
  color: #18233f !important;
  border: 1px solid rgba(130,148,190,0.18) !important;
  box-shadow: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

#loginPanel select {
  line-height: normal !important;
}

#registerFormWrap .auth-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: stretch !important;
}

#registerFormWrap input,
#registerFormWrap select,
#registerFormWrap #registerBtn {
  width: 100% !important;
  min-width: 0 !important;
}

#registerFormWrap #registerBtn {
  grid-column: 1 / -1 !important;
}

#loginPanel #loginBtn,
#loginPanel #registerBtn {
  width: auto !important;
  min-width: 180px !important;
  height: 46px !important;
  max-height: 46px !important;
  padding: 0 20px !important;
  margin: 0 !important;
  white-space: nowrap !important;
  align-self: center !important;
}

@media (max-width: 800px) {
  #loginPanel.auth-panel {
    max-width: 100% !important;
    padding: 14px !important;
  }

  #loginPanel .auth-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  #loginPanel input[type="text"],
  #loginPanel input[type="password"],
  #loginPanel select {
    width: 100% !important;
    height: 44px !important;
    max-height: 44px !important;
    line-height: 44px !important;
    padding: 0 14px !important;
    border-radius: 18px !important;
  }

  #registerFormWrap .auth-row {
    grid-template-columns: 1fr !important;
  }

  #loginPanel #loginBtn,
  #loginPanel #registerBtn {
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    max-height: 44px !important;
  }
}

/* ===== на мобильном улучшаем верхний хвост чтоб не мешал читать текст ===== */
@media (max-width: 800px) {
  .text-panel-top {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 0 8px !important;
    margin: 0 0 10px !important;
  }

  .text-panel.leaderboard-mode .text-panel-top {
    opacity: 1 !important;
    transform: none !important;
    max-height: none !important;
    pointer-events: auto !important;
    margin: 0 0 10px !important;
    padding: 0 0 8px !important;
  }

  .text-toolbar {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .text-zoom-controls {
    display: inline-flex !important;
    justify-content: flex-start !important;
  }

  #textContent {
    padding-top: 0 !important;
  }
}

.leaderboard-level-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.15;
  color: rgba(39, 49, 82, 0.42);
  background: rgba(39, 49, 82, 0.045);
  vertical-align: middle;
  white-space: nowrap;
}

.leaderboard-trophy-badge,
.leaderboard-door-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.1;
  vertical-align: middle;
  white-space: nowrap;
}

.leaderboard-trophy-badge {
  color: #7a5a11;
  background: rgba(255, 206, 86, 0.13);
  border: 1px solid rgba(180, 126, 22, 0.12);
}

.leaderboard-door-badge {
  color: rgba(63, 95, 143, 0.74);
  background: rgba(79, 107, 255, 0.06);
  border: 1px solid rgba(79, 107, 255, 0.10);
}

.sound-toggle-inline-btn {
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sound-toggle-inline-btn:hover {
  opacity: 1;
  transform: scale(1.05);
}

.sound-toggle-inline-btn.sound-off {
  opacity: 1;
  filter: saturate(1.1);
}
.guest-soft-signup-prompt {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(30, 60, 114, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(24, 35, 63, 0.18);
  color: #18233f;
}

.telegram-webview-notice {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(640px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf0, #ffffff);
  box-shadow: 0 16px 42px rgba(146, 64, 14, 0.22);
  color: #18233f;
}

.telegram-webview-notice div {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.telegram-webview-notice strong {
  font-size: 0.95rem;
  color: #8a3f05;
}

.telegram-webview-notice span {
  color: #4c5f82;
  font-size: 0.86rem;
  line-height: 1.3;
}

.telegram-webview-notice a,
.telegram-webview-notice button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.telegram-webview-notice a {
  padding: 9px 12px;
  background: #1e3c72;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.help-warning-section {
  border-color: rgba(245, 158, 11, 0.28) !important;
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.96)) !important;
}

#telegramNoticeClose {
  width: 32px;
  height: 32px;
  background: #eef2f8;
  color: #263a5f;
  font-size: 1.1rem;
}

@media (max-width: 560px) {
  .telegram-webview-notice {
    align-items: stretch;
    flex-direction: column;
    top: 10px;
  }

  #telegramNoticeClose {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}

.guest-soft-signup-prompt div {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.guest-soft-signup-prompt strong {
  font-size: 0.95rem;
}

.guest-soft-signup-prompt span {
  color: #4c5f82;
  font-size: 0.86rem;
  line-height: 1.3;
}

.guest-soft-signup-prompt button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

#guestSoftSignupBtn {
  padding: 9px 12px;
  background: #1e3c72;
  color: #fff;
}

#guestSoftSignupClose {
  width: 32px;
  height: 32px;
  background: #eef2f8;
  color: #263a5f;
  font-size: 1.1rem;
}

@media (max-width: 560px) {
  .guest-soft-signup-prompt {
    align-items: stretch;
    flex-direction: column;
  }

  #guestSoftSignupClose {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}


.offline-status {
    color: #1e3c72;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    border: 1px solid #d6e0f5;
    border-radius: 10px;
    background: #f7f9ff;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(130,148,190,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.58);
}
.mode-switch-btn {
  min-height: 30px;
  padding: 5px 10px !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: #263a5f !important;
  border: 0 !important;
  box-shadow: none !important;
  font-size: 0.78rem !important;
}
.mode-switch-btn.active {
  background: linear-gradient(135deg, #1e3c72, #2a5298) !important;
  color: #fff !important;
}
.ranked-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  color: #66728c;
  font-size: 0.8rem;
  font-weight: 700;
}
.ranked-answer-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.ranked-answer-form input {
  flex: 1 1 220px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(130,148,190,0.24);
}
.ranked-feedback {
  margin-top: 12px;
  font-weight: 800;
}
.ranked-feedback.ok { color: #20824a; }
.ranked-feedback.bad { color: #a61e2d; }


body.practice-calm-mode .question-card {
  box-shadow: 0 4px 10px rgba(24,35,63,0.03) !important;
  transition: none !important;
}

body.practice-calm-mode {
  background: #f4f6fa !important;
}

body.practice-calm-mode .trainer-panel,
body.practice-calm-mode .text-panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.practice-calm-mode .option {
  box-shadow: none !important;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease !important;
}

body.practice-calm-mode .option:hover {
  transform: none !important;
  box-shadow: none !important;
}

body.practice-calm-mode .exercise-dot,
body.practice-calm-mode .stage-btn,
body.practice-calm-mode .exercise-nav-btn {
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease !important;
}


body.practice-low-motion-mode #topicProgressBar::after,
body.practice-low-motion-mode #sectionProgressBar::after,
body.practice-low-motion-mode .leaderboard-toggle,
body.practice-low-motion-mode .question-card,
body.practice-low-motion-mode .option,
body.practice-low-motion-mode .exercise-dot,
body.practice-low-motion-mode .stage-btn,
body.practice-low-motion-mode .exercise-nav-btn,
body.practice-low-motion-mode .small-btn,
body.practice-low-motion-mode .audio-btn {
  animation: none !important;
  transition: none !important;
}

body.practice-low-motion-mode .trainer-panel,
body.practice-low-motion-mode .text-panel,
body.practice-low-motion-mode .question-card,
body.practice-low-motion-mode .option,
body.practice-low-motion-mode .leaderboard,
body.practice-low-motion-mode .stats-card,
body.practice-low-motion-mode .stats-card-experimental {
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.practice-low-motion-mode {
  background: #f6f7fa !important;
}

body.practice-low-motion-mode .trainer-panel::before,
body.practice-low-motion-mode .trainer-panel::after,
body.practice-low-motion-mode .text-panel::before,
body.practice-low-motion-mode .text-panel::after,
body.practice-low-motion-mode button::after,
body.practice-low-motion-mode button:hover::after {
  display: none !important;
}

body.practice-low-motion-mode .trainer-panel,
body.practice-low-motion-mode .text-panel {
  background: #fff !important;
}

body.practice-low-motion-mode .option:hover,
body.practice-low-motion-mode .small-btn:hover,
body.practice-low-motion-mode .audio-btn:hover {
  transform: none !important;
  box-shadow: none !important;
}


body.practice-bare-mode {
  background: #f7f8fb !important;
}

body.practice-bare-mode button {
  background: #eef2f8 !important;
  color: #1f2d49 !important;
  border-color: rgba(130,148,190,0.28) !important;
  box-shadow: none !important;
}

body.practice-bare-mode button::after,
body.practice-bare-mode button:hover::after {
  display: none !important;
}

body.practice-bare-mode::after,
body.practice-bare-mode .trainer-panel::before,
body.practice-bare-mode .trainer-panel::after,
body.practice-bare-mode .text-panel::before,
body.practice-bare-mode .text-panel::after,
body.practice-bare-mode #topicProgressBar::after,
body.practice-bare-mode #sectionProgressBar::after,
body.practice-bare-mode .leaderboard-hint,
body.practice-bare-mode .leaderboard-toggle::after,
body.practice-bare-mode .leaderboard::before {
  display: none !important;
}

body.practice-bare-mode *,
body.practice-bare-mode *::before,
body.practice-bare-mode *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

body.practice-bare-mode .trainer-panel,
body.practice-bare-mode .text-panel,
body.practice-bare-mode .question-card,
body.practice-bare-mode .leaderboard,
body.practice-bare-mode .audio-dock-inner,
body.practice-bare-mode .option,
body.practice-bare-mode .small-btn,
body.practice-bare-mode .stage-btn,
body.practice-bare-mode .exercise-nav-btn,
body.practice-bare-mode .exercise-dot {
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.practice-bare-mode .trainer-panel,
body.practice-bare-mode .text-panel {
  background: #fff !important;
  border-color: rgba(130,148,190,0.22) !important;
  border-radius: 10px !important;
  padding: 14px !important;
}

body.practice-bare-mode .question-card {
  background: #fff !important;
  border-color: rgba(130,148,190,0.24) !important;
}

body.practice-bare-mode .option {
  background: #fff !important;
  border-color: rgba(130,148,190,0.28) !important;
  transform: none !important;
}

body.practice-bare-mode .option:hover,
body.practice-bare-mode .small-btn:hover,
body.practice-bare-mode .stage-btn:hover,
body.practice-bare-mode .exercise-nav-btn:hover {
  background: #f3f6fb !important;
  transform: none !important;
  box-shadow: none !important;
}

body.practice-bare-mode .option.correct-answer,
body.practice-bare-mode .question-card.correct-highlight {
  background: #eaf8ef !important;
  border-color: rgba(34,197,94,0.45) !important;
}

body.practice-bare-mode .option.wrong-answer {
  background: #fdecec !important;
  border-color: rgba(239,68,68,0.42) !important;
}

body.practice-bare-mode .audio-dock,
body.practice-bare-mode .audio-dock.open {
  transform: none !important;
}

.exp-stats-meta {
  margin-top: 4px;
  color: #7a849c;
  font-size: 0.74rem;
  font-weight: 650;
}

.tiny-link-btn {
  margin-top: 6px;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: #5167c9;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
}

.tiny-link-btn:hover {
  text-decoration: underline;
}

body.practice-focus-mode {
  background: #f9fafc !important;
}

body.practice-focus-mode .feedback-footer,
body.practice-focus-mode .topic-browser,
body.practice-focus-mode .topic-browser-inline,
body.practice-focus-mode .topic-category-tabs,
body.practice-focus-mode .topic-card-progress,
body.practice-focus-mode .stats-card,
body.practice-focus-mode .stats-card-experimental {
  display: none !important;
}

body.practice-focus-mode .app-container {
  gap: 10px !important;
}

body.practice-focus-mode .trainer-panel,
body.practice-focus-mode .text-panel {
  border-radius: 10px !important;
  padding: 14px !important;
}

body.practice-focus-mode .question-card {
  min-height: 0 !important;
  margin: 8px 0 !important;
  padding: 14px !important;
  border-radius: 10px !important;
}

body.practice-focus-mode .question-text {
  margin-bottom: 10px !important;
  padding-left: 10px !important;
  line-height: 1.42 !important;
}

body.practice-focus-mode .options {
  gap: 6px !important;
  margin: 10px 0 !important;
}

body.practice-focus-mode .option {
  min-height: 36px !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
}

body.practice-focus-mode .text-panel {
  gap: 8px !important;
}

body.practice-focus-mode .text-panel-top,
body.practice-focus-mode .text-toolbar,
body.practice-focus-mode .text-zoom-controls {
  display: none !important;
}

body.practice-focus-mode #textContent {
  line-height: 1.5 !important;
  padding: 0 !important;
}

/* Lightweight one-shot coach tip. Static asset, no continuous animation. */
.coach-tip {
  position: absolute;
  z-index: 60;
  display: block;
  pointer-events: auto;
  animation: coachTipIn 0.18s ease-out both;
}

.coach-tip-leaderboard {
  top: 38px;
  left: 8px;
  right: auto;
}

.coach-tip-profile {
  left: var(--coach-tip-left, 8px);
  top: var(--coach-tip-top, calc(100% + 8px));
}

.coach-tip-auth,
.coach-tip-report,
.coach-tip-topics,
.coach-tip-navigation,
.coach-tip-text-audio,
.coach-tip-sound {
  left: var(--coach-tip-left, 8px);
  top: var(--coach-tip-top, calc(100% + 8px));
}

.coach-tip-report .coach-tip-bubble {
  max-width: 250px;
}

.coach-tip-topics .coach-tip-bubble {
  max-width: 252px;
}

.coach-tip-navigation .coach-tip-bubble {
  max-width: 312px;
}

.coach-tip-text-audio .coach-tip-bubble {
  max-width: 308px;
}

.coach-tip-profile .coach-tip-bubble {
  max-width: 270px;
}

.coach-tip-auth .coach-tip-bubble {
  max-width: 292px;
}

.coach-tip-sound .coach-tip-bubble {
  max-width: 292px;
}

.coach-tip-mascot {
  width: 64px;
  height: auto;
  flex: 0 0 auto;
  align-self: flex-end;
  transform: translateY(4px);
  filter: drop-shadow(0 8px 14px rgba(24,35,63,0.18));
}

.coach-tip-bus {
  width: 78px;
  transform: translateY(6px);
}

.coach-tip-cab {
  width: 96px;
  transform: translateY(7px);
}

.coach-tip-raven {
  width: 74px;
  transform: translateY(7px);
}

.coach-tip-phone {
  width: 54px;
  transform: translateY(5px);
}

.coach-tip-mic {
  width: 54px;
  transform: translateY(5px);
}

.coach-tip-bubble {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 280px;
  padding: 9px 13px 9px 8px;
  border: 1px solid rgba(79,107,255,0.20);
  border-radius: 18px 18px 18px 9px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 12px 26px rgba(24,35,63,0.12);
  color: #24345f;
  font: 700 0.82rem/1.28 "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: coachTipPulse 2.2s ease-in-out infinite;
}

.coach-tip-pointer-raven {
  position: absolute;
  right: 18px;
  bottom: calc(100% - 8px);
  width: 42px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 5px 9px rgba(24,35,63,0.18));
  transform: rotate(-3deg);
}

.coach-tip-bubble::after {
  content: "";
  position: absolute;
  left: 26px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(79,107,255,0.18);
  border-bottom: 1px solid rgba(79,107,255,0.18);
  background: rgba(255,255,255,0.88);
  transform: rotate(45deg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.coach-tip-above .coach-tip-bubble::after {
  left: auto;
  right: 42px;
  top: auto;
  bottom: -7px;
}

.coach-tip-bubble strong,
.coach-tip-bubble span {
  display: block;
}

.coach-tip-bubble strong {
  margin-bottom: 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.78rem;
}

.coach-tip-bubble span {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.coach-tip-hiding {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.practice-focus-mode .coach-tip {
  display: none !important;
}

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

@keyframes coachTipPulse {
  0%, 100% {
    box-shadow: 0 12px 26px rgba(24,35,63,0.14);
  }
  50% {
    box-shadow: 0 12px 26px rgba(24,35,63,0.14), 0 0 0 5px rgba(79,107,255,0.12);
  }
}

@media (max-width: 800px) {

  .coach-tip-auth,
  .coach-tip-report,
  .coach-tip-topics,
  .coach-tip-navigation,
  .coach-tip-text-audio,
  .coach-tip-profile,
  .coach-tip-sound {
    left: var(--coach-tip-left, 8px);
    top: var(--coach-tip-top, calc(100% + 8px));
    right: auto;
    bottom: auto;
  }

  .coach-tip-auth .coach-tip-bubble,
  .coach-tip-report .coach-tip-bubble,
  .coach-tip-topics .coach-tip-bubble,
  .coach-tip-navigation .coach-tip-bubble,
  .coach-tip-text-audio .coach-tip-bubble,
  .coach-tip-profile .coach-tip-bubble,
  .coach-tip-sound .coach-tip-bubble {
    max-width: min(286px, calc(100vw - 48px));
  }

  .coach-tip-leaderboard {
    top: 42px;
    left: 8px;
    right: auto;
  }

  .coach-tip-bubble {
    max-width: min(310px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 8px 11px 8px 7px;
  }

  .coach-tip-mascot {
    width: 60px;
  }

  .coach-tip-pointer-raven {
    right: 14px;
    width: 36px;
  }

  .coach-tip-bus {
    width: 72px;
  }

  .coach-tip-cab {
    width: 86px;
  }

  .coach-tip-raven {
    width: 64px;
  }

  .coach-tip-phone,
  .coach-tip-mic {
    width: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coach-tip,
  .coach-tip-bubble {
    animation: none;
  }

  .coach-tip-hiding {
    transition: none;
  }
}

/* Public help page */
.app-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-help-link,
.user-help-link,
.help-back-link,
.help-contact-actions a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.app-help-link,
.user-help-link {
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow-xs);
}

.help-page {
  min-height: 100vh;
}

.help-shell {
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.help-hero,
.help-section,
.help-grid article {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.help-hero {
  margin-top: 18px;
  padding: 34px;
}

.help-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.help-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.help-hero p,
.help-section p,
.help-grid p {
  color: var(--muted);
  line-height: 1.6;
}

.help-section {
  margin-top: 16px;
  padding: 24px;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.help-grid article {
  padding: 22px;
}

.help-section h2,
.help-grid h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.help-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.help-section-heading h2,
.help-section-heading p {
  margin-top: 0;
}

.help-section-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,206,86,0.16);
  border: 1px solid rgba(180,126,22,0.14);
  box-shadow: var(--shadow-xs);
}

.help-badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.help-badge-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(130,148,190,0.16);
  border-radius: 8px;
  background: rgba(255,255,255,0.54);
}

.help-badge-card strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.help-badge-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.help-badge-sample,
.help-rank-sample {
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(79,107,255,0.08);
  color: #30405d;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.help-rank-sample--1 {
  min-width: 28px;
  width: 28px;
  padding: 0;
  background: linear-gradient(135deg, #ffd86b, #d99619);
  color: #fff;
}

.help-section li {
  margin: 8px 0;
  line-height: 1.55;
}

.help-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.help-contact-actions a {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  background: var(--surface-2);
}

@media (max-width: 720px) {
  .app-heading-row {
    align-items: flex-start;
    min-width: 0;
  }

  .app-heading-row h1 {
    flex: 1 1 auto;
    min-width: 0;
  }

  .app-help-link {
    margin-top: 4px;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .help-badge-grid {
    grid-template-columns: 1fr;
  }

  .help-hero,
  .help-section,
  .help-grid article {
    padding: 20px;
  }
}

/* ===== MOBILE AUTH WIDTH GUARD ===== */
@media (max-width: 800px) {
  body:not(.trainer-active),
  body:not(.trainer-active) .app-container,
  body:not(.trainer-active) .trainer-panel,
  body:not(.trainer-active) .start-actions,
  body:not(.trainer-active) #loginPanel.auth-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body:not(.trainer-active) .trainer-panel {
    padding-left: 18px !important;
    padding-right: 18px !important;
    overflow-x: hidden !important;
  }

  body:not(.trainer-active) .app-heading-row {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body:not(.trainer-active) .app-heading-row h1 {
    flex: 1 1 220px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }

  body:not(.trainer-active) .app-help-link {
    flex: 0 0 auto !important;
    max-width: 100% !important;
  }

  body:not(.trainer-active) .start-actions select,
  body:not(.trainer-active) .start-actions button,
  body:not(.trainer-active) #loginPanel input,
  body:not(.trainer-active) #loginPanel select,
  body:not(.trainer-active) #loginPanel button {
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 420px) {
  body:not(.trainer-active) .trainer-panel {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

.app-build-badge {
    position: fixed;
    right: 8px;
    bottom: 8px;
    z-index: 1200;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(20, 28, 44, 0.62);
    color: #fff;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0;
    pointer-events: none;
    user-select: none;
}

@media (max-width: 640px) {
    .app-build-badge {
        right: 6px;
        bottom: 6px;
        font-size: 9px;
        opacity: 0.78;
    }
}
