/* ============================================
   Mr Hope's Classroom - Class Whiteboard App
   Matching the main classroom design system
   v2 - dark mode colour scheme fix
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700&family=Google+Sans:wght@400;500&family=Roboto:wght@400;500&display=swap');

/* ===== Design System Variables – matches updated mrhope.app aesthetic ===== */
:root {
  /* Typography */
  --font-display: 'Lexend', 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Lexend', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Neutrals — warm grey palette matching ATT deck theme */
  --white: #ffffff;
  --grey-50: #faf8f4;
  --grey-100: #f0ede7;
  --grey-200: #e8e4dc;
  --grey-300: #d5d0c7;
  --grey-600: #7a7268;
  --grey-900: #2c2a26;

  /* Primary – Red (Interactive Sessions accent) */
  --green: #c0392b;
  --green-hover: #a93226;
  --green-light: rgba(192, 57, 43, 0.10);
  --green-lighter: rgba(192, 57, 43, 0.05);
  --green-gradient: linear-gradient(135deg, rgba(192,57,43,.18) 0%, rgba(192,57,43,.08) 100%);

  /* Blue */
  --blue: #2c6fad;
  --blue-hover: #1e5a94;
  --blue-light: rgba(44, 111, 173, 0.10);
  --blue-gradient: linear-gradient(135deg, rgba(44,111,173,.18) 0%, rgba(44,111,173,.08) 100%);

  /* Orange / Gold */
  --orange: #b07d2a;
  --orange-hover: #966a1f;
  --orange-light: rgba(176, 125, 42, 0.10);
  --orange-gradient: linear-gradient(135deg, rgba(176,125,42,.18) 0%, rgba(176,125,42,.08) 100%);

  --purple: #7c5cbf;
  --purple-light: rgba(124, 92, 191, 0.10);
  --purple-gradient: linear-gradient(135deg, rgba(124,92,191,.18) 0%, rgba(101,67,167,.08) 100%);

  --teal: #1a7a6e;
  --teal-light: rgba(26, 122, 110, 0.10);
  --teal-gradient: linear-gradient(135deg, rgba(26,122,110,.18) 0%, rgba(26,122,110,.08) 100%);

  --yellow: #b08020;
  --yellow-light: rgba(176, 128, 32, 0.10);
  --yellow-gradient: linear-gradient(135deg, rgba(176,128,32,.18) 0%, rgba(176,128,32,.08) 100%);

  --red: #c0392b;
  --red-light: rgba(192, 57, 43, 0.10);

  /* Shadows — softer for light background */
  --shadow-sm: 0 2px 8px rgba(60, 50, 40, 0.07);
  --shadow-md: 0 8px 32px rgba(60, 50, 40, 0.11);
  --shadow-lg: 0 16px 48px rgba(60, 50, 40, 0.14);
  --shadow-modal: 0 20px 60px rgba(60, 50, 40, 0.18);

  /* Radii */
  --radius: 20px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-modal: 22px;
  --radius-full: 100px;

  /* Transitions */
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Aliases */
  --primary: var(--green);
  --primary-hover: var(--green-hover);
  --primary-light: var(--green-light);
  --text-primary: #2c2a26;
  --text-secondary: #7a7268;
  --text-muted: #9a948c;
  --bg-white: #f0ede7;
  --bg-light: #faf8f4;
  --border-color: #d5d0c7;

  /* Status colours */
  --success-green: #1a7a4a;
  --error-red: var(--red);
  --primary-blue: var(--blue);
}

/* ===== Dark Theme Overrides ===== */
[data-theme="dark"] {
  --white: #ffffff;
  --grey-50: #0f0f0f;
  --grey-100: #1a1a1a;
  --grey-200: #2a2a2a;
  --grey-300: #333333;
  --grey-600: #888888;
  --grey-900: #f0ede8;

  --green: #ef4444;
  --green-hover: #dc2626;
  --green-light: rgba(239, 68, 68, 0.15);
  --green-lighter: rgba(239, 68, 68, 0.08);
  --green-gradient: linear-gradient(135deg, rgba(239,68,68,.38) 0%, rgba(239,68,68,.18) 100%);

  --blue: #6b9fd4;
  --blue-hover: #5a8ec3;
  --blue-light: rgba(107, 159, 212, 0.12);
  --blue-gradient: linear-gradient(135deg, rgba(107,159,212,.38) 0%, rgba(107,159,212,.18) 100%);

  --orange: #d4a020;
  --orange-hover: #b8860b;
  --orange-light: rgba(212, 160, 32, 0.12);
  --orange-gradient: linear-gradient(135deg, rgba(212,160,32,.38) 0%, rgba(212,160,32,.18) 100%);

  --purple: #a78bfa;
  --purple-light: rgba(167, 139, 250, 0.12);
  --purple-gradient: linear-gradient(135deg, rgba(167,139,250,.38) 0%, rgba(139,92,246,.18) 100%);

  --teal: #2dd4bf;
  --teal-light: rgba(13, 148, 136, 0.12);
  --teal-gradient: linear-gradient(135deg, rgba(13,148,136,.38) 0%, rgba(13,148,136,.18) 100%);

  --yellow: #fbbf24;
  --yellow-light: rgba(251, 191, 36, 0.12);
  --yellow-gradient: linear-gradient(135deg, rgba(251,191,36,.38) 0%, rgba(251,191,36,.18) 100%);

  --red: #ef4444;
  --red-light: rgba(239, 68, 68, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.6);

  --text-primary: #f0ede8;
  --text-secondary: #888888;
  --text-muted: #555555;
  --bg-white: #1a1a1a;
  --bg-light: #0f0f0f;
  --border-color: #2a2a2a;

  --success-green: #10b981;
}

[data-theme="dark"] .flex-btn-primary {
  background: rgba(239,68,68,.15);
  color: #f87171;
  border-color: rgba(239,68,68,.4);
}
[data-theme="dark"] .flex-btn-primary:hover {
  background: rgba(239,68,68,.25);
  border-color: rgba(239,68,68,.6);
  box-shadow: 0 4px 16px rgba(239,68,68,.15);
}
[data-theme="dark"] .activity-card:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
[data-theme="dark"] .activity-label {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.07);
}

/* ===== Theme Toggle Pill ===== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: .62rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .15s;
  background: none;
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}
.theme-toggle-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.theme-toggle-btn .icon-sun  { display: block; }
.theme-toggle-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: block; }

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-top: 0;
}

/* ===== Header Bar (ATT deck design language) ===== */
.header-bar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  gap: 12px;
}

.header-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.header-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--primary);
  white-space: nowrap;
}

.header-dot {
  color: var(--text-muted);
  font-size: .7rem;
}

.header-title {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Nav button — matches hub hdr-btn */
.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .15s;
  background: none;
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.bar-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.bar-btn.primary {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.bar-btn.primary:hover {
  background: rgba(192,57,43,.18);
}

/* Keep .back-to-dashboard-btn as alias */
.back-to-dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: .65rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .15s;
  background: none;
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.back-to-dashboard-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  transform: none;
}
.back-to-dashboard-btn svg { width: 13px; height: 13px; }

.header-back-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  margin-right: 16px;
  transition: color 0.2s;
}

.header-back-link:hover {
  color: var(--blue-hover);
}

/* ===== Dashboard View (matches main index) ===== */
.dashboard-view {
  padding: 28px 32px 40px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  align-self: flex-start;
}

.dashboard-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.dashboard-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ===== Buttons - Matching main app ===== */
.flex-btn-outline {
  padding: 10px 24px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--primary);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
  cursor: pointer;
}

.flex-btn-outline:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.flex-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  background: rgba(192,57,43,.10);
  color: #a93226;
  border: 1.5px solid rgba(192,57,43,.3);
  border-radius: var(--radius-full);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.flex-btn-primary:hover {
  background: rgba(192,57,43,.18);
  border-color: rgba(192,57,43,.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(192,57,43,.12);
}

.flex-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.flex-link:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

/* ===== Main Content ===== */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ===== Sections ===== */
.app-section {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 24px;
}

.app-section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.app-section-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.flex-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* ===== Activity Cards Grid (matches main index apps-grid) ===== */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

@media (max-width: 1200px) {
  .activity-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .activity-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.activity-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 0;
}

.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(60,50,40,.12);
}

/* Per-card colour hover borders using :has() */
.activity-card:has(.activity-icon.wordcloud):hover  { border-color: rgba(107,159,212,.5);  box-shadow: 0 16px 48px rgba(107,159,212,.1); }
.activity-card:has(.activity-icon.cardmatch):hover   { border-color: rgba(212,160,32,.5);   box-shadow: 0 16px 48px rgba(212,160,32,.1); }
.activity-card:has(.activity-icon.multiplechoice):hover,
.activity-card:has(.activity-icon.quizround):hover   { border-color: rgba(107,159,212,.5);  box-shadow: 0 16px 48px rgba(107,159,212,.1); }
.activity-card:has(.activity-icon.anagram):hover,
.activity-card:has(.activity-icon.wordsearch):hover,
.activity-card:has(.activity-icon.crossword):hover   { border-color: rgba(167,139,250,.5);  box-shadow: 0 16px 48px rgba(139,92,246,.1); }
.activity-card:has(.activity-icon.exam):hover,
.activity-card:has(.activity-icon.worldexplorer):hover { border-color: rgba(13,148,136,.5); box-shadow: 0 16px 48px rgba(13,148,136,.1); }
.activity-card:has(.activity-icon.quizgo):hover      { border-color: rgba(239,68,68,.5);    box-shadow: 0 16px 48px rgba(239,68,68,.1); }

.activity-icon {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 10px 0;
  border-radius: 12px;
  transition: transform 0.25s ease;
}

.activity-card:hover .activity-icon { transform: scale(1.02); }

.activity-icon svg {
  width: 100%;
  height: 100%;
  max-width: 120px;
}

.activity-card-content { padding: 12px 14px 16px; }

.activity-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  padding: 4px 9px;
  border-radius: 6px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Coloured labels per activity type */
.activity-card:has(.activity-icon.wordcloud) .activity-label  { color: #6b9fd4; background: rgba(107,159,212,.1);  border-color: rgba(107,159,212,.2); }
.activity-card:has(.activity-icon.cardmatch) .activity-label    { color: #d4a020; background: rgba(212,160,32,.1);   border-color: rgba(212,160,32,.2); }
.activity-card:has(.activity-icon.multiplechoice) .activity-label,
.activity-card:has(.activity-icon.quizround) .activity-label    { color: #6b9fd4; background: rgba(107,159,212,.1);  border-color: rgba(107,159,212,.2); }
.activity-card:has(.activity-icon.anagram) .activity-label,
.activity-card:has(.activity-icon.wordsearch) .activity-label,
.activity-card:has(.activity-icon.crossword) .activity-label    { color: #c4b5fd; background: rgba(139,92,246,.1);   border-color: rgba(139,92,246,.2); }
.activity-card:has(.activity-icon.exam) .activity-label,
.activity-card:has(.activity-icon.worldexplorer) .activity-label { color: #2dd4bf; background: rgba(13,148,136,.1);  border-color: rgba(13,148,136,.2); }
.activity-card:has(.activity-icon.quizgo) .activity-label        { color: #f87171; background: rgba(239,68,68,.1);   border-color: rgba(239,68,68,.2); }

.activity-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text-primary);
  margin: 0 0 5px;
}

.activity-description {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

/* Activity icon backgrounds — translucent coloured gradients */
.activity-icon.wordcloud    { background: var(--blue-gradient); }
.activity-icon.multiplechoice { background: var(--blue-gradient); }
.activity-icon.anagram      { background: var(--purple-gradient); }
.activity-icon.wordsearch   { background: var(--purple-gradient); }
.activity-icon.crossword    { background: var(--purple-gradient); }
.activity-icon.exam         { background: var(--teal-gradient); }
.activity-icon.quizround    { background: var(--blue-gradient); }
.activity-icon.cardmatch    { background: var(--orange-gradient); }
.activity-icon.quizgo       { background: var(--green-gradient); }
.activity-icon.worldexplorer { background: var(--teal-gradient); }

/* ===== Form Elements ===== */
.app-input-group {
  margin-bottom: 20px;
}

.app-input-group label,
.app-input-group .app-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.app-input,
.app-textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-light);
  transition: all 0.2s;
}

.app-input:focus,
.app-textarea:focus {
  outline: none;
  border-color: rgba(107,159,212,.6);
  box-shadow: 0 0 0 3px rgba(107,159,212,.12);
}

.app-textarea {
  min-height: 100px;
  resize: vertical;
}

.app-file-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-light);
}

.app-input-group small {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== Actions ===== */
.app-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ===== Modal - Matching main app style ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius-modal);
  padding: 48px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  border: 1.5px solid var(--border-color);
  animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.mc-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ===== Room Code Display ===== */
.room-code-display {
  text-align: center;
  padding: 24px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
}

.room-code-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
}

/* ===== Activities List ===== */
.activities-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
}

.activity-item:hover {
  box-shadow: var(--shadow-sm);
}

/* ===== Word Cloud ===== */
.wordcloud-container {
  padding: 32px;
  background: var(--grey-50);
  border-radius: var(--radius-md);
  min-height: 300px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  align-content: center;
}

.wordcloud-word {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  font-weight: 500;
  transition: transform 0.2s;
  cursor: default;
}

.wordcloud-word:hover {
  transform: scale(1.05);
}

.wordcloud-word-wrapper {
  display: inline-flex;
  position: relative;
}

.wordcloud-word-wrapper:hover .wordcloud-delete-btn {
  opacity: 1;
}

.wordcloud-delete-btn {
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.wordcloud-delete-btn:hover {
  opacity: 1 !important;
}

/* ===== Multiple Choice ===== */
.mc-question-item {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.mc-question-item h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.mc-options-list {
  list-style: none;
  margin: 12px 0;
}

.mc-options-list li {
  padding: 10px 14px;
  margin: 6px 0;
  background: var(--grey-50);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
}

.mc-options-list li.correct {
  background: var(--green-light);
  color: var(--green);
  font-weight: 500;
}

/* ===== Anagram ===== */
.anagram-item {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.anagram-item h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.anagram-scrambled {
  font-size: 22px;
  font-weight: 600;
  color: var(--purple);
  letter-spacing: 4px;
  margin: 12px 0;
  font-family: 'Courier New', monospace;
}

.anagram-hint {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== Exam Questions ===== */
.exam-question-item {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.exam-question-item h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* ===== Student Activity Styles ===== */
.student-option-btn {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  margin-bottom: 10px;
}

.student-option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.student-option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.student-option-btn.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.student-option-btn.incorrect {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}

/* ===== Fullscreen Modals ===== */
.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0f0f0f;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.fullscreen-content {
  background: #1c1c1c;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 95vw;
  max-height: 95vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fullscreen-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1c1c1c;
}

.fullscreen-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: #0f0f0f;
}

/* Shared app chrome theming for Class Whiteboard */
:root {
  --chrome-primary: #dc2626;
  --chrome-bg: #1c1c1c;
  --chrome-border: #2a2a2a;
  --chrome-text-secondary: #888888;
  --chrome-text-muted: #555555;
  --chrome-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-bar {
    padding: 8px 12px;
  }

  .header-title {
    max-width: 140px;
  }

  .back-to-dashboard-btn,
  .bar-btn {
    padding: 5px 10px;
    font-size: .6rem;
  }
}

/* ── Compact header: icons only at narrow widths ── */
@media (max-width: 540px) {
  .header-bar {
    padding: 6px 10px;
  }

  .header-title-wrap {
    flex-shrink: 1;
    min-width: 0;
  }

  .header-label {
    font-size: .58rem;
  }

  .header-dot,
  .header-title {
    display: none;
  }

  .header-actions {
    gap: 4px;
  }

  /* Hide text labels — buttons become icon-only pills */
  .bar-btn .btn-label,
  .theme-label {
    display: none;
  }

  .bar-btn,
  .theme-toggle-btn {
    padding: 6px 8px;
    min-width: 30px;
    justify-content: center;
  }
}

@media (max-width: 768px) {

  .flex-btn-outline,
  .flex-btn-primary {
    padding: 8px 16px;
    font-size: 13px;
  }

  .dashboard-view {
    padding: 20px 16px 32px;
  }

  .dashboard-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .app-main {
    padding: 24px 16px;
  }

  .app-section {
    padding: 24px;
    border-radius: var(--radius-md);
  }
  
  .app-section-title {
    font-size: 18px;
  }
  
  .app-section-description {
    font-size: 13px;
  }

  .activity-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .activity-icon {
    height: 100px;
    margin: 8px 8px 0;
  }

  .activity-card-content {
    padding: 12px 14px 16px;
  }

  .activity-name {
    font-size: 14px;
  }

  .activity-description {
    font-size: 12px;
  }

  .mc-options-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 32px 24px;
    border-radius: var(--radius-2xl);
  }
  
  .modal-header h2 {
    font-size: 18px;
  }
  
  .app-input-group label,
  .app-input-group .app-label {
    font-size: 12px;
  }
  
  .app-input, .app-textarea {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  /* Room code display */
  .room-code-badge {
    font-size: 16px;
    padding: 8px 16px;
    letter-spacing: 3px;
  }
  
  /* Student activity styles */
  .student-option-btn {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  /* Fullscreen modals */
  .fullscreen-content {
    border-radius: var(--radius-md);
  }
  
  .fullscreen-header {
    padding: 16px;
  }
  
  .fullscreen-body {
    padding: 20px;
  }
}

@media (max-width: 500px) {
  .activity-grid {
    grid-template-columns: 1fr;
  }
  
  .app-section {
    padding: 20px;
  }
  
  .modal-content {
    padding: 24px 20px;
  }
  
  .app-actions {
    flex-direction: column;
  }
  
  .app-actions button {
    width: 100%;
  }
  
  /* Word cloud */
  .wordcloud-container {
    padding: 20px;
    min-height: 200px;
  }
  
  /* MC question styles for student */
  .mc-question-item {
    padding: 16px;
  }
  
  .mc-question-item h4 {
    font-size: 15px;
  }
  
  /* Anagram styles */
  .anagram-scrambled {
    font-size: 18px;
    letter-spacing: 3px;
  }
}

/* ===== Dark Fullscreen Activity Modals ===== */
.fs-dark {
  --white: #1c1c1c;
  --grey-50: #0f0f0f;
  --grey-100: #1c1c1c;
  --grey-200: #2a2a2a;
  --grey-300: #333333;
  --grey-600: #888888;
  --grey-900: #f0ede8;
  --text-primary: #f0ede8;
  --text-secondary: #888888;
  --bg-white: #1c1c1c;
  --bg-light: #0f0f0f;
  --border-color: #2a2a2a;
  --green-light: rgba(220, 38, 38, 0.15);
  --green-lighter: rgba(220, 38, 38, 0.08);
  --primary-light: rgba(220, 38, 38, 0.15);
  --red-light: rgba(239, 68, 68, 0.12);
  --blue-light: rgba(59, 130, 246, 0.12);
  --purple-light: rgba(168, 85, 247, 0.12);
  --teal-light: rgba(13, 148, 136, 0.12);
  --yellow-light: rgba(249, 168, 37, 0.12);
  color: #f1f5f9;
}

.fs-dark .modal-content {
  background: #0f0f0f !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.fs-dark .modal-header {
  background: #1c1c1c !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.fs-dark .modal-close {
  color: rgba(255, 255, 255, 0.5);
}

.fs-dark .modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.fs-dark .room-code-badge {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.fs-dark .app-section-title {
  color: #f1f5f9;
}

/* Override JS-generated inline background: white */
.fs-dark [style*="background: white"],
.fs-dark [style*="background:white"] {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

/* Override inline background: var(--bg-light) for option rows */
.fs-dark [style*="background: var(--bg-light)"] {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Progress bars background override */
.fs-dark [style*="background: rgba(0,0,0,0.1)"] {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* Fullscreen body area */
.fs-dark .fs-dark-body {
  background: #0f0f0f !important;
}

/* Word cloud container on dark */
.fs-dark .wordcloud-container {
  background: #0f0f0f;
}

/* Freeze button dark override */
.fs-dark #wordcloud-freeze-btn {
  background: transparent !important;
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

.fs-dark #wordcloud-freeze-btn:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

/* Quiz Round timer on dark */
.fs-dark #quizround-timer-display {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.fs-dark .flex-btn-primary {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.fs-dark .flex-btn-outline {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
}

.fs-dark .flex-btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* Empty state text */
.fs-dark p[style*="color: var(--text-secondary)"] {
  color: rgba(255, 255, 255, 0.4) !important;
}

/* Exam response cards */
.fs-dark .exam-response-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Word cloud words — keep vibrant on dark */
.fs-dark .wordcloud-word {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* ── Wordsearch / Crossword Grid Dark Theme ── */
.fs-dark table {
  background: #1c1c1c !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.fs-dark td {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.fs-dark td[style*="background: white"] {
  background: #1c1c1c !important;
}

.fs-dark td[style*="background: #333"] {
  background: #0a0f1e !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
}

/* Letter colours on dark grid */
.fs-dark td span[style*="color: #000"],
.fs-dark td[style*="color: #000"] {
  color: rgba(255, 255, 255, 0.9) !important;
}

.fs-dark td span[style*="color: #999"],
.fs-dark td[style*="color: #999"] {
  color: rgba(255, 255, 255, 0.2) !important;
}

.fs-dark td span[style*="color: #9c27b0"] {
  color: #c084fc !important;
}

/* Number labels inside grid cells */
.fs-dark td span[style*="color: #333"] {
  color: rgba(255, 255, 255, 0.4) !important;
}

/* Fallback for td textContent colors (no span) */
.fs-dark td[style*="font-size: 32px"],
.fs-dark td[style*="font-size: 24px"] {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Toggle buttons (Board / Answers) — inactive */
.fs-dark button[style*="background: white"] {
  background: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* ── Word Cloud Frozen View ── */
.fs-dark [style*="background: #fff3cd"] {
  background: rgba(249, 168, 37, 0.12) !important;
  border-color: rgba(249, 168, 37, 0.3) !important;
}

.fs-dark [style*="color: #856404"] {
  color: #fbbf24 !important;
}

.fs-dark thead tr {
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

/* Word cloud count badge in frozen/normal view */
.fs-dark .wc-student-popup {
  background: #1c1c1c;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

/* ── Scrollbar for dark modals ── */
.fs-dark .fs-dark-body::-webkit-scrollbar {
  width: 6px;
}

.fs-dark .fs-dark-body::-webkit-scrollbar-track {
  background: #0f0f0f;
}

.fs-dark .fs-dark-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.fs-dark .fs-dark-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── World Explorer Leaderboard (dark theme) ── */
.we-lb-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: transform 0.2s, background 0.2s;
  animation: we-row-enter 0.3s ease both;
}

.we-lb-row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.we-lb-row.we-top-1 {
  border-color: rgba(250, 204, 21, 0.3);
  background: rgba(250, 204, 21, 0.08);
}

.we-lb-row.we-top-2 {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.06);
}

.we-lb-row.we-top-3 {
  border-color: rgba(217, 119, 6, 0.25);
  background: rgba(217, 119, 6, 0.06);
}

.we-lb-rank {
  width: 40px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.we-lb-rank-medal {
  font-size: 24px;
}

.we-lb-name {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.we-lb-stats {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
}

.we-lb-stat {
  text-align: center;
}

.we-lb-stat-val {
  font-size: 18px;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}

.we-lb-stat-lbl {
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

.we-lb-progress {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.we-lb-progress-fill {
  height: 100%;
  background: #dc2626;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.we-lb-status {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 6px;
  flex-shrink: 0;
  text-align: center;
  min-width: 80px;
}

.we-lb-status.complete {
  color: var(--success-green);
  background: rgba(16, 185, 129, 0.12);
}

/* Success green stays green for correct answers */

.we-lb-status.playing {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

@keyframes we-row-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Question Analysis Cards */
.we-qa-card {
  padding: 20px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.we-qa-card.struggle {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
}

.we-qa-card.easy {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.04);
}

.we-qa-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.we-qa-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.we-tab-btn.active {
  background: rgba(220, 38, 38, 0.15) !important;
  color: #dc2626 !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
}

/* Responsive dark modals */
@media (max-width: 768px) {
  .fs-dark .modal-content {
    border-radius: 12px !important;
  }

  .we-lb-stats {
    gap: 12px;
  }

  .we-lb-stat-val {
    font-size: 14px;
  }

  .we-lb-progress {
    width: 60px;
  }
}

/* ===== Fullscreen Presenter Mode ===== */
.presenter-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: #0f0f0f !important;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: presenterFadeIn 0.4s ease;
}

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

.presenter-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-y: auto;
}

.presenter-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  flex-shrink: 0;
}

.presenter-signin-note {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: 14px;
}

.presenter-signin-note strong {
  color: var(--primary);
  font-weight: 600;
}

.presenter-topbar-actions {
  display: flex;
  gap: 12px;
}

.presenter-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.presenter-exit-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.presenter-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 32px;
  min-height: 0;
}

.presenter-room-label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 16px;
}

.presenter-room-code {
  font-family: var(--font-display);
  font-size: clamp(80px, 14vw, 180px);
  font-weight: 700;
  letter-spacing: clamp(8px, 2vw, 24px);
  color: var(--primary);
  text-shadow: 0 0 60px rgba(220, 38, 38, 0.3);
  line-height: 1;
  margin-bottom: 20px;
  user-select: all;
  animation: presenterCodePulse 3s ease-in-out infinite;
}

@keyframes presenterCodePulse {
  0%, 100% { text-shadow: 0 0 60px rgba(220, 38, 38, 0.3); }
  50% { text-shadow: 0 0 80px rgba(220, 38, 38, 0.5), 0 0 120px rgba(220, 38, 38, 0.15); }
}

.presenter-join-hint {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
}

.presenter-join-hint strong {
  color: rgba(255, 255, 255, 0.75);
}

.presenter-regenerate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.presenter-regenerate-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.presenter-bottom {
  width: 100%;
  padding: 24px 32px 32px;
  flex-shrink: 0;
  text-align: center;
}

.presenter-activity-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 20px;
}

.presenter-activity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.presenter-activity-btn {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s, border-color .18s, box-shadow .18s;
  text-align: left;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-display);
  padding: 0;
}

.presenter-activity-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.presenter-activity-btn[data-type="wordcloud"]:hover    { border-color: rgba(107, 159, 212, 0.5); }
.presenter-activity-btn[data-type="cardmatch"]:hover    { border-color: rgba(212, 140, 32, 0.5);  }
.presenter-activity-btn[data-type="worldexplorer"]:hover { border-color: rgba(13, 148, 136, 0.5);  }

.presenter-activity-icon {
  height: 120px;
  border-radius: 14px;
  margin: 10px 10px 0;
  width: calc(100% - 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform .25s ease;
  flex-shrink: 0;
}

.presenter-activity-btn:hover .presenter-activity-icon { transform: scale(1.02); }

.presenter-activity-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.presenter-activity-tag {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.presenter-activity-name {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: rgba(255, 255, 255, 0.9);
  white-space: normal;
}

.presenter-activity-desc {
  font-size: .72rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
  white-space: normal;
  max-width: none;
  text-align: left;
  flex: 1;
}

.presenter-activity-launch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1.5px solid;
  margin-top: 6px;
  align-self: flex-start;
  pointer-events: none;
}

/* Per-card tag + launch colours */
.presenter-activity-btn[data-type="wordcloud"] .presenter-activity-tag,
.presenter-activity-btn[data-type="wordcloud"] .presenter-activity-launch { color: rgba(107,159,212,.9); border-color: rgba(107,159,212,.3); background: rgba(107,159,212,.1); }
.presenter-activity-btn[data-type="cardmatch"] .presenter-activity-tag,
.presenter-activity-btn[data-type="cardmatch"] .presenter-activity-launch { color: rgba(212,160,32,.9);  border-color: rgba(212,160,32,.3);  background: rgba(212,160,32,.1); }
.presenter-activity-btn[data-type="worldexplorer"] .presenter-activity-tag,
.presenter-activity-btn[data-type="worldexplorer"] .presenter-activity-launch { color: rgba(45,212,191,.9); border-color: rgba(13,148,136,.3); background: rgba(13,148,136,.1); }

/* Active activity banner */
.presenter-active-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 32px;
  background: rgba(220, 38, 38, 0.12);
  border-top: 1px solid rgba(220, 38, 38, 0.25);
  animation: presenterBannerSlideUp 0.3s ease;
}

@keyframes presenterBannerSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.presenter-active-dot {
  width: 10px;
  height: 10px;
  background: #dc2626;
  border-radius: 50%;
  animation: presenterDotPulse 1.5s ease-in-out infinite;
}

@keyframes presenterDotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.presenter-active-banner span {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: #dc2626;
}

.presenter-active-view-btn,
.presenter-active-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.presenter-active-view-btn {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #dc2626;
}

.presenter-active-view-btn:hover {
  background: rgba(220, 38, 38, 0.25);
}

.presenter-active-end-btn {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.presenter-active-end-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Presenter responsive */
@media (max-width: 768px) {
  .presenter-topbar {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    align-items: stretch;
  }

  .presenter-signin-note {
    font-size: 15px;
    padding: 10px 16px;
    justify-content: center;
  }

  .presenter-topbar-actions {
    justify-content: center;
  }

  .presenter-room-code {
    font-size: clamp(56px, 12vw, 120px);
    letter-spacing: clamp(4px, 1.5vw, 16px);
  }

  .presenter-bottom {
    padding: 16px 16px 24px;
  }

  .presenter-activity-grid {
    gap: 10px;
  }

  .presenter-activity-icon {
    height: 80px;
  }

  .presenter-activity-name {
    font-size: .82rem;
  }

  .presenter-activity-desc {
    font-size: .65rem;
  }

  .presenter-activity-launch {
    font-size: .6rem;
    padding: 4px 10px;
  }

  .presenter-active-banner {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }
}

/* ===== Card Match (all modes native) ===== */

/* Mode picker */
.cm-mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 8px; }
.cm-mode-card {
  background: var(--grey-50); border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md); padding: 22px 16px; cursor: pointer;
  text-align: center; transition: all 0.2s;
}
.cm-mode-card:hover { border-color: var(--orange); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(230,126,34,0.15); }
.cm-mode-icon { font-size: 28px; font-weight: 900; color: var(--orange); font-family: var(--font-display); margin-bottom: 8px; }
.cm-mode-title { font-size: 15px; font-weight: 700; color: #f1f5f9; font-family: var(--font-display); margin-bottom: 6px; }
.cm-mode-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.cm-mode-tag { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 20px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.cm-tag-study { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cm-tag-easy { background: rgba(16,185,129,0.15); color: #34d399; }
.cm-tag-hard { background: rgba(239,68,68,0.15); color: #f87171; }
.cm-tag-sort { background: rgba(230,126,34,0.15); color: #fb923c; }

/* Flashcard */
.cm-flash-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cm-flash-counter { font-size: 15px; color: var(--text-secondary); font-weight: 500; }
.cm-flashcard { width: 380px; height: 500px; perspective: 1200px; cursor: pointer; }
.cm-fc-inner {
  width: 100%; height: 100%; position: relative; transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.cm-fc-inner.cm-flipped { transform: rotateY(180deg); }
.cm-fc-face { position: absolute; inset: 0; border-radius: var(--radius-lg); backface-visibility: hidden; overflow: hidden; }
.cm-fc-front { background: #1c1c1c; display: flex; flex-direction: column; }
.cm-fc-img { flex: 1; overflow: hidden; }
.cm-fc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-fc-img-ph { width: 100%; height: 100%; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; font-size: 52px; color: rgba(255,255,255,0.12); }
.cm-fc-label { padding: 16px 20px; border-top: 1px solid var(--border-color); }
.cm-fc-sub { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.09em; }
.cm-fc-title { font-size: 22px; font-weight: 700; color: #f1f5f9; font-family: var(--font-display); line-height: 1.2; margin-top: 4px; }
.cm-fc-hint { font-size: 12px; color: rgba(255,255,255,0.2); margin-top: 6px; }
.cm-fc-back { background: var(--grey-50); transform: rotateY(180deg); padding: 24px; display: flex; flex-direction: column; overflow-y: auto; }
.cm-fc-back-title { font-size: 14px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.cm-fc-prop { margin-bottom: 12px; }
.cm-fc-prop-lbl { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.cm-fc-prop-val { font-size: 15px; color: rgba(255,255,255,0.85); font-weight: 500; line-height: 1.45; }
.cm-flash-controls { display: flex; align-items: center; gap: 14px; }
.cm-flash-nav {
  width: 48px; height: 48px; border-radius: 50%; background: #1c1c1c;
  border: 1.5px solid var(--border-color); font-size: 20px; color: #f1f5f9;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.15s; padding: 0;
}
.cm-flash-nav:hover { border-color: var(--orange); color: var(--orange); }
.cm-flash-nav:disabled { opacity: 0.2; pointer-events: none; }
.cm-flash-pips { display: flex; gap: 6px; align-items: center; }
.cm-flash-pip { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.12); transition: background 0.2s; }
.cm-flash-pip.active { background: var(--orange); }
.cm-flash-pip.seen { background: rgba(255,255,255,0.35); }

/* Face-Up Match */
.cm-fu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.cm-fu-col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.1em; }
.cm-fu-col-dot { width: 10px; height: 10px; border-radius: 50%; }
.cm-fu-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.cm-gc { cursor: pointer; transition: transform 0.15s; }
.cm-gc:hover:not(.cm-matched) { transform: translateY(-3px); }
.cm-gc.cm-matched { opacity: 0.2; pointer-events: none; transition: opacity 0.4s; }
.cm-gc.cm-selected .cm-gc-inner { box-shadow: 0 0 0 3px var(--orange), 0 4px 20px rgba(230,126,34,0.25) !important; }
.cm-gc.cm-wrong .cm-gc-inner { box-shadow: 0 0 0 3px var(--red), 0 4px 20px rgba(239,68,68,0.2) !important; }
.cm-gc.cm-correct .cm-gc-inner { box-shadow: 0 0 0 3px var(--success-green), 0 4px 20px rgba(16,185,129,0.2) !important; }
.cm-gc-inner {
  width: 180px; height: 260px; position: relative; border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow 0.2s;
}
.cm-gc-img-face { background: #1c1c1c; display: flex; flex-direction: column; height: 100%; }
.cm-gc-img-area { flex: 1; overflow: hidden; }
.cm-gc-img-area img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-gc-img-ph { width: 100%; height: 100%; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; font-size: 32px; color: rgba(255,255,255,0.12); }
.cm-gc-lbl { padding: 10px 12px; border-top: 1px solid var(--border-color); }
.cm-gc-sub { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.cm-gc-title { font-size: 14px; font-weight: 600; color: #f1f5f9; font-family: var(--font-display); line-height: 1.2; margin-top: 2px; }
.cm-gc-info-face { background: var(--grey-50); padding: 14px; display: flex; flex-direction: column; gap: 6px; height: 100%; overflow: hidden; }
.cm-gc-info-title { font-size: 11px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 4px; }
.cm-gc-prop-lbl { font-size: 9px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.cm-gc-prop-val { font-size: 12px; color: rgba(255,255,255,0.85); font-weight: 500; line-height: 1.4; }
.cm-fu-hint { margin-top: 18px; background: #1c1c1c; border-radius: var(--radius-sm); padding: 12px 18px; text-align: center; font-size: 14px; color: var(--text-secondary); border: 1px solid var(--border-color); }

/* Face-Down Pairs */
.cm-pairs-board { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.cm-pairs-hint { font-size: 14px; color: var(--text-secondary); background: #1c1c1c; border-radius: var(--radius-sm); padding: 10px 16px; border: 1px solid var(--border-color); }
.cm-pairs-grid { display: grid; gap: 12px; }
.cm-pc { cursor: pointer; transition: transform 0.15s; }
.cm-pc:hover:not(.cm-pc-matched) { transform: translateY(-2px); }
.cm-pc.cm-pc-matched { opacity: 0.2; pointer-events: none; }
.cm-pc-inner {
  position: relative; transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4,0,0.2,1);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.cm-pc-inner.cm-pc-flipped { transform: rotateY(180deg); }
.cm-pc-face { position: absolute; inset: 0; border-radius: var(--radius-md); backface-visibility: hidden; overflow: hidden; }
.cm-pc-cover { background: var(--grey-50); border: 1.5px solid rgba(255,255,255,0.08); }
.cm-pc-cover-inner {
  width: 100%; height: 100%;
  background-image: repeating-linear-gradient(45deg, rgba(230,126,34,0.06) 0px, rgba(230,126,34,0.06) 2px, transparent 2px, transparent 12px);
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: rgba(255,255,255,0.12);
}
.cm-pc-img-front { background: #1c1c1c; display: flex; flex-direction: column; transform: rotateY(180deg); }
.cm-pc-img-area { flex: 1; overflow: hidden; }
.cm-pc-img-area img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-pc-img-ph { width: 100%; height: 100%; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; font-size: 28px; color: rgba(255,255,255,0.12); }
.cm-pc-img-lbl { padding: 7px 10px; border-top: 1px solid var(--border-color); }
.cm-pc-img-sub { font-size: 9px; color: var(--text-secondary); text-transform: uppercase; }
.cm-pc-img-title { font-size: 13px; font-weight: 600; color: #f1f5f9; font-family: var(--font-display); line-height: 1.2; }
.cm-pc-info-front { background: var(--grey-50); transform: rotateY(180deg); padding: 10px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cm-pc-info-title { font-size: 10px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 3px; }
.cm-pc-info-lbl { font-size: 8px; color: var(--text-secondary); text-transform: uppercase; }
.cm-pc-info-val { font-size: 11px; color: rgba(255,255,255,0.85); font-weight: 500; line-height: 1.35; }
.cm-pc.cm-pc-selected .cm-pc-inner { box-shadow: 0 0 0 3px var(--orange), 0 4px 16px rgba(230,126,34,0.25); }
.cm-pc.cm-pc-wrong .cm-pc-inner { box-shadow: 0 0 0 3px var(--red); }
.cm-pc.cm-pc-correct .cm-pc-inner { box-shadow: 0 0 0 3px var(--success-green); }

/* Sort Match */
.cm-sort-cols { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; min-height: 160px; }
.cm-sort-zone {
  flex: 1; min-width: 260px; max-width: 480px;
  background: var(--grey-50); border: 2px dashed rgba(255,255,255,0.12);
  border-radius: var(--radius-md); padding: 16px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.cm-sort-zone.cm-zone-hover { border-color: var(--orange); background: rgba(230,126,34,0.08); box-shadow: 0 0 0 4px rgba(230,126,34,0.12); }
.cm-sort-zone-hdr { text-align: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.cm-sort-zone-title { font-size: 17px; font-weight: 700; color: #f1f5f9; font-family: var(--font-display); }
.cm-sort-zone-count { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.cm-sort-zone-cards { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; justify-content: center; align-items: flex-start; }
.cm-sort-placed { background: rgba(230,126,34,0.12); border: 1px solid rgba(230,126,34,0.25); border-radius: var(--radius-sm); padding: 8px 12px; text-align: center; }
.cm-sort-placed-title { font-size: 13px; font-weight: 600; color: var(--orange); font-family: var(--font-display); }
.cm-sort-placed-sub { font-size: 11px; color: var(--text-secondary); }
.cm-sort-divider { text-align: center; padding: 18px 0; font-size: 14px; color: var(--text-secondary); position: relative; }
.cm-sort-divider::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--border-color); }
.cm-sort-divider span { position: relative; background: var(--bg-light); padding: 0 16px; font-weight: 500; }
.cm-sort-pool { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 10px 0; touch-action: none; }
.cm-sc { width: 170px; cursor: grab; touch-action: none; transition: transform 0.15s, opacity 0.2s; user-select: none; }
.cm-sc:hover { transform: translateY(-3px); }
.cm-sc.cm-sc-dragging { opacity: 0.25; }
.cm-sc-inner {
  background: #1c1c1c; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  overflow: hidden; border: 2px solid rgba(255,255,255,0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cm-sc-img { width: 100%; height: 110px; overflow: hidden; }
.cm-sc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-sc-img-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.04); font-size: 26px; color: rgba(255,255,255,0.12); }
.cm-sc-body { padding: 10px 12px; }
.cm-sc-sub { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.cm-sc-title { font-size: 14px; font-weight: 600; color: #f1f5f9; font-family: var(--font-display); line-height: 1.2; margin-top: 2px; }
.cm-sc-props { padding: 0 12px 10px; }
.cm-sc-prop-lbl { font-size: 9px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.cm-sc-prop-val { font-size: 11px; color: rgba(255,255,255,0.8); font-weight: 500; line-height: 1.35; }
.cm-sc-ghost { opacity: 0.9; transform: rotate(2deg) scale(1.06); box-shadow: 0 12px 40px rgba(0,0,0,0.5) !important; pointer-events: none; z-index: 9999; position: fixed; }
.cm-sc.cm-sc-correct .cm-sc-inner { border-color: var(--success-green); box-shadow: 0 0 0 3px rgba(16,185,129,0.3); }
.cm-sc.cm-sc-wrong .cm-sc-inner { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,0.25); animation: cmShake 0.4s; }
@keyframes cmShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Win screen */
.cm-win-box { text-align: center; padding: 40px 20px; background: var(--grey-50); border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.cm-win-box h3 { font-size: 26px; font-weight: 700; color: #f1f5f9; font-family: var(--font-display); margin-bottom: 8px; }
.cm-win-box p { color: var(--text-secondary); font-size: 15px; margin-top: 4px; }
.cm-win-acc { color: var(--orange) !important; font-weight: 700 !important; font-size: 18px !important; }
.cm-win-btns { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .cm-fu-cols { grid-template-columns: 1fr; }
  .cm-flashcard { width: 320px; height: 420px; }
  .cm-gc-inner { width: 150px; height: 220px; }
  .cm-sort-cols { gap: 10px; }
  .cm-sort-zone { min-width: 100%; }
  .cm-sc { width: 140px; }
  .cm-sc-img { height: 85px; }
  .cm-mode-grid { grid-template-columns: 1fr; }
}

/* ===== Focus States ===== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}