/* ════════════════════════════════════════════════════════════
   TEACHER PORTAL LAYOUT
   Three views:  #view-auth  |  #view-portal  |  #view-board
   ════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); min-height: 100vh;
       display: flex; flex-direction: column;
       height: auto; overflow: visible; }

/* ── Shared nav ─────────────────────────────────────────── */
.t-nav {
  display: flex; align-items: center; height: 58px;
  padding: 0 32px; background: var(--surface);
  border-bottom: 1px solid var(--toolbar-border);
  position: sticky; top: 0; z-index: 200; flex-shrink: 0;
}
.t-nav .nav-logo { margin-right: auto; }
.t-nav .nav-logo img { height: 32px; display: block; }
.t-nav .nav-links { display: flex; align-items: center; gap: 6px; }
.t-nav .nav-link {
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  padding: 6px 12px; border-radius: 7px; background: none; border: none;
  cursor: pointer; font-family: inherit; transition: background .12s, color .12s;
}
.t-nav .nav-link:hover { background: var(--btn-hover); color: var(--btn-text); }
.t-nav .nav-link.active { color: var(--purple); font-weight: 600; }
.t-nav .nav-user {
  font-size: 13px; font-weight: 600; color: var(--btn-text);
  padding: 6px 12px; border-radius: 7px;
}
.t-nav .nav-sep { width: 1px; height: 22px; background: var(--toolbar-border); margin: 0 4px; }

/* ── Auth view ──────────────────────────────────────────── */
#view-auth {
  flex: 1; display: flex; flex-direction: column; background: var(--bg); min-height: 0;
}

/* A returning teacher's token must be verified by the API before the portal
   is revealed. Keep both views behind an intentional loading screen during
   that short check so the login form never flashes first. */
html.teacher-auth-pending #view-auth,
html.teacher-auth-pending #view-portal { display:none !important; }
html.teacher-auth-pending body.teacher-page::before {
  content:'Loading dashboard…';
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding-top:58px;
  color:var(--text-muted);
  background:var(--bg);
  font-size:14px;
  font-weight:600;
  letter-spacing:.01em;
}


.auth-hero {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.auth-card {
  background: var(--surface); border-radius: 18px; padding: 40px 44px; width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.10); max-width: 92vw;
  margin-top: auto; margin-bottom: auto;
}
.auth-card .card-brand {
  text-align: center; font-size: 26px; font-weight: 800;
  color: var(--purple); letter-spacing: -.5px; margin-bottom: 4px;
}
.auth-card .card-sub { text-align: center; font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.auth-card h2 { font-size: 19px; font-weight: 700; color: var(--btn-text); margin-bottom: 20px; }
.auth-note {
  background: var(--bg-muted,#f4f3ee); border: 1px solid #e4e2d9; border-radius: 10px;
  padding: 10px 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted);
  text-align: center; margin-bottom: 22px;
}
.auth-note strong { color: var(--btn-text); }

/* ── Portal view ────────────────────────────────────────── */
#view-portal { display: none; flex-direction: column; flex: 1; }
#view-portal.active { display: flex; }

.portal-body {
  display: flex;
  min-height: calc(100vh - 60px);
  background: linear-gradient(to right, var(--surface) 220px, var(--bg) 220px);
}

/* Sidebar */
.portal-sidebar {
  width: 220px; flex-shrink: 0;
  border-right: 1px solid var(--toolbar-border);
  padding: 24px 0;
}
.sidebar-section { padding: 0 12px; margin-bottom: 6px; }
.sidebar-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 0 8px; margin-bottom: 4px;
}
.sidebar-tile-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
}
.sidebar-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 100%; min-width: 0;
  padding: 9px 4px; border-radius: 10px;
  border: 1px solid var(--btn-border); background: var(--surface-2);
  font-size: 10.5px; font-weight: 600; line-height: 1.25; color: var(--btn-text);
  cursor: pointer; font-family: inherit; text-align: center; transition: background .12s, border-color .12s;
}
.sidebar-btn:hover { background: var(--btn-hover); }
.sidebar-btn.active { background: var(--purple-light); border-color: var(--purple); color: var(--purple); }
.sidebar-btn-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-btn-icon svg { width: 18px; height: 18px; opacity: .6; }
.sidebar-btn.active .sidebar-btn-icon svg { opacity: 1; }
.sidebar-btn-accent .sidebar-btn-icon {
  color: var(--sidebar-icon-color);
  background: var(--sidebar-icon-bg);
}
.sidebar-btn-accent .sidebar-btn-icon svg { opacity: 1; }

.sidebar-coffee {
  flex-direction: row; align-items: center; justify-content: flex-start; gap: 9px;
  width: 100%; padding: 8px 10px; border: none; text-align: left;
  font-size: 13px; font-weight: 500;
  color: var(--purple) !important; background: var(--purple-light); margin-bottom: 10px;
}
.sidebar-coffee:hover { background: var(--purple) !important; color: #fff !important; }
.sidebar-coffee img { flex-shrink: 0; width: 16px; height: 16px; }
.sidebar-divider { height: 1px; background: var(--toolbar-border); margin: 12px 12px; }

.sidebar-search { padding: 0 12px 10px; }
.sidebar-search-input {
  width: 100%; box-sizing: border-box; padding: 7px 10px;
  border: 1.5px solid var(--btn-border); border-radius: 8px;
  background: var(--surface-2); color: var(--btn-text);
  font-size: 12.5px; font-family: inherit;
}
.sidebar-search-input:focus { outline: none; border-color: var(--purple); }
.sidebar-section.sidebar-search-empty { display: none; }

/* Main content area */
.portal-main { flex: 1; padding: 32px 40px; min-width: 0; }
.portal-panel { display: none; }
.portal-panel.active { display: block; }

.panel-title {
  font-size: 20px; font-weight: 700; color: var(--btn-text); margin-bottom: 6px;
}
.panel-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

/* Room grid */
.rooms-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.room-tile {
  background: var(--surface); border-radius: 13px; border: 1.5px solid var(--btn-border);
  padding: 14px 16px 16px 16px; cursor: pointer; transition: border-color .12s, box-shadow .12s;
  display: flex; flex-direction: column; gap: 4px;
}
.room-tile:hover { border-color: var(--purple); box-shadow: 0 4px 16px rgba(83,74,183,.12); }
.room-tile.is-wall { border-left: 4px solid #378ADD; }
.room-tile.is-presentation { border-left: 4px solid var(--purple); }
.room-tile.is-room { border-left: 4px solid #1D9E75; }
.card-type-chip {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 20px; margin-bottom: 8px;
}
.card-type-chip.is-wall { background: #E8F1FB; color: #2569A8; }
.card-type-chip.is-presentation { background: var(--purple-light); color: var(--purple); }
.card-type-chip.is-room { background: #E5F5EE; color: #157A57; }
.room-tile .rt-name { font-size: 14px; font-weight: 700; color: var(--btn-text); }
.room-tile .rt-code { font-size: 20px; font-weight: 800; color: var(--purple); letter-spacing: .12em; margin-top: 6px; }
.room-tile .rt-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.room-tile .rt-locked { font-size: 11px; color: #BA7517; font-weight: 600; }
.room-tile .rt-rename {
  position: static; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--btn-border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.room-tile .rt-rename:hover { background: #EEF4FF; border-color: #7F77DD; color: #7F77DD; }
.room-tile .rt-view {
  position: static; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--btn-border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.room-tile .rt-view:hover { background: #E8F5FE; border-color: #378ADD; color: #378ADD; }
.room-tile .rt-present {
  position: static; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--btn-border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.room-tile .rt-present:hover { background: #E6F6F2; border-color: #1D9E75; color: #1D9E75; }
.room-tile .rt-del {
  position: static; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--btn-border);
  color: #A32D2D; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.room-tile .rt-del:hover { background: #FCEBEB; border-color: #E24B4A; }

/* Create room form */
.create-form {
  display: flex; gap: 10px; align-items: flex-end; max-width: 480px;
}
.create-form .field { flex: 1; margin: 0; }
.create-form button {
  padding: 10px 20px; background: var(--purple); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.create-form button:hover { background: var(--purple-dark); }

.wall-type-select {
  width: 100%; height: 41px; padding: 0 32px 0 12px; box-sizing: border-box;
  border-radius: 8px; border: 1.5px solid var(--btn-border); background: var(--surface-2);
  font-size: 14px; font-weight: 600; font-family: inherit; color: var(--btn-text);
  cursor: pointer; outline: none; transition: border-color .15s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23888780' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.wall-type-select:focus { border-color: var(--purple); }

/* Settings form */
.settings-card {
  background: var(--surface); border-radius: 13px; border: 1px solid var(--btn-border);
  padding: 28px 32px; max-width: 520px; margin-bottom: 24px;
}
.settings-card h3 { font-size: 15px; font-weight: 700; color: var(--btn-text); margin-bottom: 18px; }
.settings-row { display: flex; gap: 14px; }
.create-wall-form {
  display:grid; grid-template-columns:minmax(0, 1fr) minmax(180px, .75fr);
  align-items:end; gap:16px; max-width:680px; box-sizing:border-box;
  padding:22px; margin-top:24px; border:1.5px solid var(--btn-border); border-radius:16px;
  background:var(--surface); box-shadow:0 6px 20px rgba(36,32,76,.07);
}
.create-wall-form-heading {
  grid-column:1 / -1; display:flex; align-items:center; gap:12px;
  padding-bottom:16px; border-bottom:1px solid var(--toolbar-border);
}
.create-wall-form-heading h3 { margin:0; color:var(--btn-text); font-size:17px; line-height:1.25; }
.create-wall-form-heading p { margin:4px 0 0; color:var(--text-muted); font-size:12px; line-height:1.45; }
.create-wall-form-icon {
  width:42px; height:42px; flex:0 0 42px; display:grid; place-items:center;
  border-radius:12px; color:var(--purple); font-size:19px;
  background:color-mix(in srgb, var(--purple) 12%, var(--surface));
}
.create-wall-form .wall-retention-create-card { grid-column:1 / -1; }
.create-wall-form #createWallBtn { grid-column:2; justify-self:end; min-width:136px; }
.wall-retention-create-card {
  padding:15px; border:1.5px solid var(--btn-border); border-radius:13px;
  background:var(--surface-2); transition:border-color .15s, background .15s, box-shadow .15s;
}
.wall-retention-create-card:has(input:checked) {
  border-color:var(--purple); background:color-mix(in srgb, var(--purple) 7%, var(--surface));
  box-shadow:0 0 0 3px color-mix(in srgb, var(--purple) 11%, transparent);
}
.wall-retention-check {
  display:flex !important; align-items:center; gap:12px; margin:0 !important;
  text-transform:none !important; letter-spacing:normal !important; cursor:pointer;
}
.wall-retention-card-icon {
  width:42px; height:42px; border-radius:11px; flex:0 0 42px;
  display:grid; place-items:center; background:color-mix(in srgb, var(--purple) 12%, var(--surface)); color:var(--purple); font-size:20px;
}
.wall-retention-card-copy { min-width:0; flex:1; }
.wall-retention-card-copy strong { display:block; color:var(--btn-text); font-size:14px; line-height:1.3; }
.wall-retention-card-copy small { display:block; margin-top:3px; color:var(--text-muted); font-size:12px; line-height:1.4; font-weight:400; }
.wall-retention-check input {
  width:20px; height:20px; flex:0 0 20px; margin:0; accent-color:var(--purple); cursor:pointer;
}
.wall-retention-days {
  align-items:center; justify-content:flex-end; gap:10px; padding:13px 0 0 54px; margin-top:13px;
  border-top:1px solid var(--toolbar-border);
}
.wall-retention-days label { margin:0 !important; text-transform:none !important; letter-spacing:normal !important; }
#new-wall-retention-days { width:145px; padding:8px 10px; font:inherit; color:var(--btn-text); background:var(--surface); border:1.5px solid var(--btn-border); border-radius:8px; }
@media (max-width:640px) {
  .create-wall-form { grid-template-columns:1fr; padding:17px; }
  .create-wall-form-heading { grid-column:1; }
  .create-wall-form .wall-retention-create-card,
  .create-wall-form #createWallBtn { grid-column:1; }
  .create-wall-form #createWallBtn { justify-self:stretch; }
  .wall-retention-days { padding-left:0; justify-content:space-between; }
}
.settings-row .field { flex: 1; }
.settings-save {
  padding: 9px 22px; background: var(--purple); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; margin-top: 4px;
}
.settings-save:hover { background: var(--purple-dark); }
.settings-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.settings-msg.ok    { color: #0F6E56; }
.settings-msg.error { color: #A32D2D; }

/* Anonymous visitor analytics */
.visitor-summary-grid { margin-bottom:18px; }
.visitor-report-grid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(260px,.65fr); gap:16px; }
.visitor-report-card {
  min-width:0; padding:20px; border:1px solid var(--btn-border); border-radius:14px;
  background:var(--surface); box-shadow:0 4px 14px rgba(35,31,25,.05);
}
.visitor-trend-card { grid-row:span 2; }
.visitor-country-card { grid-column:2; }
.visitor-card-heading { display:flex; align-items:center; gap:10px; margin-bottom:16px; }
.visitor-card-heading>i {
  width:36px; height:36px; display:grid; place-items:center; flex:0 0 36px;
  border-radius:10px; color:var(--purple); background:color-mix(in srgb,var(--purple) 11%,var(--surface));
}
.visitor-card-heading h3 { margin:0; color:var(--btn-text); font-size:15px; }
.visitor-card-heading p { margin:2px 0 0; color:var(--text-muted); font-size:11px; }
.visitor-subheading { margin-top:22px; margin-bottom:12px; padding-top:18px; border-top:1px solid var(--toolbar-border); }
.visitor-legend { display:flex; justify-content:flex-end; gap:14px; margin:-34px 0 18px; color:var(--text-muted); font-size:11px; }
.visitor-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; }
.visitor-dot.web,.visitor-trend-track .web { background:#378ADD; }
.visitor-dot.app,.visitor-trend-track .app { background:#7F77DD; }
.visitor-trend { display:flex; flex-direction:column; gap:8px; max-height:480px; overflow:auto; padding-right:4px; }
.visitor-trend-row { display:grid; grid-template-columns:54px minmax(60px,1fr) 38px; align-items:center; gap:9px; font-size:11px; }
.visitor-trend-row time { color:var(--text-muted); }
.visitor-trend-row>strong { text-align:right; color:var(--btn-text); }
.visitor-trend-track { display:flex; height:10px; overflow:hidden; border-radius:999px; background:var(--surface-2); }
.visitor-trend-track i { display:block; height:100%; min-width:0; }
.visitor-breakdown { display:flex; flex-direction:column; gap:13px; }
.visitor-breakdown-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 12px; }
.visitor-breakdown-label strong { display:block; color:var(--btn-text); font-size:13px; }
.visitor-breakdown-label span { color:var(--text-muted); font-size:10px; }
.visitor-breakdown-value { align-self:center; color:var(--purple); font-size:12px; font-weight:700; }
.visitor-breakdown-track { grid-column:1/-1; height:6px; overflow:hidden; border-radius:999px; background:var(--surface-2); }
.visitor-breakdown-track i { display:block; height:100%; border-radius:inherit; background:var(--purple); }
.visitor-empty { padding:28px 12px; text-align:center; color:var(--text-muted); font-size:12px; }
@media(max-width:820px){
  .visitor-report-grid { grid-template-columns:1fr; }
  .visitor-trend-card,.visitor-country-card { grid-column:auto; grid-row:auto; }
}

/* Game availability scheduler */
#panel-game-availability .settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#panel-game-availability .settings-grid > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}
#panel-game-availability input:not([type="checkbox"]),
#panel-game-availability select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1.5px solid var(--btn-border);
  border-radius: 9px;
  outline: none;
  background: var(--surface);
  color: var(--btn-text);
  font: inherit;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#panel-game-availability input:not([type="checkbox"]):hover,
#panel-game-availability select:hover { border-color: color-mix(in srgb, var(--purple) 48%, var(--btn-border)); }
#panel-game-availability input:not([type="checkbox"]):focus,
#panel-game-availability select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 16%, transparent);
}
#panel-game-availability input::placeholder { color: var(--text-muted); opacity: .72; }
#panel-game-availability select option { background: var(--surface); color: var(--btn-text); }
#panel-game-availability .gas-mode { width: 170px; flex: 0 0 170px; }
#gas-days label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1.5px solid var(--btn-border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--btn-text);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
#panel-game-availability input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--purple);
  cursor: pointer;
}
#panel-game-availability label:has(#gas-advertise) {
  color: var(--btn-text);
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 680px) {
  #panel-game-availability .settings-grid { grid-template-columns: 1fr; }
  #panel-game-availability .setting-toggle-row { gap: 10px; }
  #panel-game-availability .gas-mode { width: 145px; flex-basis: 145px; }
}

/* Setting row with toggle switch */
.setting-toggle-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
}
.setting-toggle-info { flex: 1; }
.setting-toggle-title { font-size: 14px; font-weight: 600; color: var(--btn-text); }
.setting-toggle-desc  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* Global Challenges admin card */
.gc-progress { height: 6px; border-radius: 4px; background: var(--purple-light); overflow: hidden; margin-top: 4px; }
.gc-progress-fill { height: 100%; background: var(--purple); border-radius: 4px; transition: width .3s ease; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--btn-border);
  border-radius: 24px;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle-switch input:checked + .toggle-slider { background: var(--purple); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.avatar-style-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 6px; border: 2px solid var(--toolbar-border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; font-family: inherit; color: var(--btn-text);
  transition: border-color .12s, background .12s;
}
.avatar-style-opt:hover { border-color: var(--purple); }
.avatar-style-opt.selected { border-color: var(--purple); background: var(--purple-light); }

/* Achievements */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
/* ── Dashboard ── */
.whats-new-card {
  background: var(--purple-light);
  border: 1.5px solid var(--purple-light);
  border-left: 4px solid var(--purple);
  border-radius: 13px;
  padding: 14px 18px;
  margin-bottom: 24px;
}
.wn-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wn-title { font-size: 13px; font-weight: 700; color: var(--purple); text-transform: uppercase; letter-spacing: .03em; }
.wn-close {
  background: none; border: none; font-size: 18px; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 0 4px; font-family: inherit;
}
.wn-close:hover { color: var(--btn-text); }
.wn-list { margin: 0; padding-left: 18px; }
.wn-list li { font-size: 13px; color: var(--btn-text); line-height: 1.6; }

.dash-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.dash-game-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 13px;
  border: 1.5px solid var(--btn-border);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  white-space: normal;
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.dash-game-card:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 14px rgba(83,74,183,.10);
}
.dgc-icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: var(--dgc-bg);
  color: var(--dgc-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dgc-body { flex: 1; min-width: 0; }
.dgc-name { font-size: 14px; font-weight: 700; color: var(--btn-text); margin-bottom: 2px; overflow-wrap: break-word; }
.dgc-desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.dgc-badge {
  font-size: 10px; font-weight: 600;
  background: var(--purple-light); color: var(--purple);
  padding: 1px 6px; border-radius: 99px;
  vertical-align: middle; margin-left: 4px;
}
.dgc-arrow { color: var(--text-muted); flex-shrink: 0; opacity: .45; }
.dash-game-card:hover .dgc-arrow { opacity: .9; }

.dash-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.dash-feature-card { padding: 18px 20px; border-width: 2px; }
.dash-feature-card .dgc-icon { width: 52px; height: 52px; border-radius: 13px; }
.dash-feature-card .dgc-name { font-size: 15px; }

.ach-badge {
  border-radius: 14px;
  border: 2px solid var(--btn-border);
  padding: 18px 12px 14px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.ach-earned {
  border-color: var(--purple);
  background: var(--purple-light);
}
.ach-locked {
  background: var(--surface-2);
  opacity: .45;
  filter: grayscale(1);
}
.ach-icon  { font-size: 36px; line-height: 1; margin-bottom: 8px; }
.ach-name  { font-size: 13px; font-weight: 700; color: var(--btn-text); margin-bottom: 4px; }
.ach-desc  { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.ach-date  { font-size: 10px; color: var(--purple); margin-top: 6px; font-weight: 600; }

/* Verification notice */
.unverified-notice {
  background: #fffbeb; border: 1.5px solid #f0c040; border-radius: 10px;
  padding: 12px 16px; font-size: 13px; color: #7a5c00; line-height: 1.5; margin-bottom: 16px;
}
[data-theme] .unverified-notice { background: color-mix(in srgb, var(--surface) 80%, #ffcc00 20%); color: var(--btn-text); border-color: #c0a000; }
.verify-request-btn {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer; border: 1.5px solid #a37a00;
  background: #fff8dc; color: #7a5c00;
}
.verify-request-btn:hover { background: #fef3c7; }
.verify-request-btn:disabled { opacity: .6; cursor: not-allowed; }
.unverified-inline-note { font-size: 12px; color: #a07000; margin: 4px 0 0; }

/* Admin tabs */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 2px; border-bottom: 2px solid var(--toolbar-border); }
.admin-tab {
  padding: 8px 18px; border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.admin-tab:hover { color: var(--btn-text); }
.admin-tab.active { color: var(--purple); border-bottom-color: var(--purple); }

/* Admin teacher table */
#admin-teacher-list {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--toolbar-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
#admin-table-wrap { overflow-x: auto; }

.admin-search-input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; margin-bottom: 14px;
  border: 1.5px solid var(--btn-border); border-radius: 8px;
  background: var(--surface-2); color: var(--btn-text);
  font-size: 13px; font-family: inherit;
}
.admin-search-input:focus { outline: none; border-color: var(--purple); }

.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.admin-table th {
  text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  border-bottom: 2px solid var(--toolbar-border);
}
.admin-table td { padding: 10px 10px; border-bottom: 1px solid var(--toolbar-border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-badge {
  display: inline-block; border-radius: 6px; padding: 2px 9px;
  font-size: 11px; font-weight: 700; line-height: 1.6;
}
.admin-badge.verified { background: #d4f0e0; color: #0a6e3e; }
.admin-badge.pending  { background: #fff3cd; color: #7a5c00; }
.admin-badge.rejected { background: #fee2e2; color: #991b1b; cursor: help; }
.admin-badge.admin    { background: var(--purple-light); color: var(--purple-dark); }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-btn {
  padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer; border: 1.5px solid var(--btn-border);
  background: var(--surface-2); color: var(--btn-text);
}
.admin-btn:hover { background: var(--btn-hover); }
.admin-btn:disabled { opacity: .5; cursor: not-allowed; }
.admin-btn.success { background: #22c55e; color: #fff; border-color: #16a34a; }
.admin-btn.success:hover { background: #16a34a; }
.admin-btn.danger  { background: #ef4444; color: #fff; border-color: #dc2626; }
.admin-btn.danger:hover  { background: #dc2626; }

.admin-pager {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.admin-pager-info {
  flex: 1; text-align: center; font-size: 12px; color: var(--text-muted);
}

.admin-pack-preview-cell {
  padding: 0 !important;
  background: var(--surface-2);
  border-bottom: 2px solid var(--purple) !important;
}

/* Read-only pack preview (legacy, kept for fallback) */
.admin-pack-qlist {
  margin: 0; padding: 14px 14px 14px 36px; list-style: decimal;
  display: flex; flex-direction: column; gap: 12px;
}
.admin-pack-q { font-size: 13px; }
.admin-pack-qtext { font-weight: 600; color: var(--btn-text); margin-bottom: 6px; }
.admin-pack-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-pack-opt {
  padding: 3px 10px; border-radius: 6px; font-size: 12px;
  border: 1.5px solid var(--btn-border); background: var(--surface); color: var(--text-muted);
}
.admin-pack-opt.correct {
  border-color: #22c55e; background: #dcfce7; color: #15803d; font-weight: 700;
}

/* Editable admin Q&A */
.admin-pack-qlist-edit { padding: 12px 12px 0; list-style: decimal; display: flex; flex-direction: column; gap: 14px; }
.admin-pack-q-edit { font-size: 13px; }
.admin-q-text {
  width: 100%; font-size: 13px; font-family: inherit; font-weight: 600;
  padding: 6px 8px; border: 1.5px solid var(--btn-border); border-radius: 7px;
  background: var(--surface); color: var(--btn-text); resize: vertical; box-sizing: border-box;
  margin-bottom: 8px;
}
.admin-pack-opts-edit { display: flex; flex-direction: column; gap: 5px; }
.admin-opt-row { display: flex; align-items: center; gap: 6px; }
.admin-opt-correct-lbl { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.admin-opt-correct-lbl input { accent-color: #22c55e; width: 15px; height: 15px; cursor: pointer; }
.option-color-dot-sm { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.admin-opt-label-txt { font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; width: 14px; }
.admin-opt-input {
  flex: 1; font-size: 12px; font-family: inherit; padding: 5px 8px;
  border: 1.5px solid var(--btn-border); border-radius: 6px;
  background: var(--surface); color: var(--btn-text);
}
.admin-q-edit-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px; border-top: 1px solid var(--toolbar-border); margin-top: 12px;
}
.admin-q-save-msg { font-size: 12px; font-weight: 600; }

/* Reject form */
.admin-reject-form { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.admin-reject-label { font-size: 12px; font-weight: 600; color: var(--btn-text); }
.admin-reject-textarea {
  width: 100%; font-size: 13px; font-family: inherit; padding: 7px 10px;
  border: 1.5px solid var(--btn-border); border-radius: 7px;
  background: var(--surface); color: var(--btn-text); resize: vertical; box-sizing: border-box;
}

/* Teacher-side rejected badge */
.badge-rejected {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: #fee2e2; color: #991b1b; cursor: help;
}

/* Admin pack controls */
.admin-pack-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid var(--toolbar-border); margin-bottom: 4px;
}
.admin-pack-controls .admin-search-input {
  flex: 1; min-width: 160px; max-width: 260px;
}
.admin-filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.admin-filter-tab {
  padding: 4px 11px; border-radius: 6px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer; border: 1.5px solid var(--btn-border);
  background: var(--surface-2); color: var(--btn-text); white-space: nowrap;
}
.admin-filter-tab:hover { background: var(--btn-hover); }
.admin-filter-tab.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.admin-filter-tab.flagged { border-color: #f97316; color: #c2410c; }
.admin-filter-tab.flagged.active { background: #f97316; color: #fff; border-color: #f97316; }
.admin-sort-select {
  font-size: 12px; font-family: inherit; padding: 5px 8px;
  border: 1.5px solid var(--btn-border); border-radius: 6px;
  background: var(--surface-2); color: var(--btn-text); cursor: pointer;
}
.admin-badge.flagged   { background: #fff7ed; color: #c2410c; }
.admin-badge.volunteer { background: #e0f2fe; color: #0369a1; }

/* Admin reports section */
.admin-reports-section {
  border-top: 1px solid var(--toolbar-border); margin-top: 4px; padding-top: 4px;
}
.admin-reports-title {
  padding: 10px 12px 6px; font-size: 12px; font-weight: 700;
  color: #c2410c; text-transform: uppercase; letter-spacing: .04em;
}
.admin-report-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 6px 12px; border-top: 1px solid var(--toolbar-border); font-size: 12px;
}
.admin-report-who { font-weight: 600; color: var(--btn-text); }
.admin-report-date { color: var(--text-muted); grid-column: 2; grid-row: 1; text-align: right; }
.admin-report-comment { grid-column: 1 / -1; color: var(--text-muted); font-style: italic; }

/* Community card report button */
.community-card-wrap { display: flex; flex-direction: column; }
.pack-report-btn {
  align-self: flex-end; margin-top: 2px; padding: 2px 8px;
  font-size: 11px; font-weight: 600; font-family: inherit; cursor: pointer;
  background: none; border: none; color: var(--text-muted); opacity: .6;
}
.pack-report-btn:hover { opacity: 1; color: #c2410c; }

/* Danger zone */
.danger-zone {
  border: 2px solid #e0a0a0 !important;
  background: #fff8f8;
}
[data-theme] .danger-zone { background: color-mix(in srgb, var(--surface) 90%, #ff3333 10%); border-color: #b85050 !important; }
.danger-btn {
  padding: 9px 22px; background: #C0392B; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.danger-btn:hover { background: #962d22; }

/* Delete account modal */
.del-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.del-modal-box {
  background: var(--surface); border-radius: 16px; padding: 32px 28px;
  max-width: 420px; width: 90%; box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.del-modal-icon { font-size: 40px; text-align: center; margin-bottom: 12px; }
.del-modal-title { font-size: 20px; font-weight: 700; color: var(--btn-text); text-align: center; margin-bottom: 10px; }
.del-modal-body { font-size: 14px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.del-modal-list {
  font-size: 13px; color: var(--text-muted); padding-left: 20px;
  line-height: 1.9; margin: 0 0 4px;
}
.del-modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.del-cancel-btn {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; background: var(--surface-2);
  border: 1.5px solid var(--btn-border); color: var(--btn-text);
}
.del-cancel-btn:hover { background: var(--btn-hover); }
.del-next-btn {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; background: var(--purple); color: #fff; border: none;
}
.del-next-btn:hover { background: var(--purple-dark); }
.del-confirm-btn {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; background: #C0392B; color: #fff; border: none;
}
.del-confirm-btn:hover { background: #962d22; }
.del-confirm-btn:disabled { opacity: .5; cursor: not-allowed; }
.del-modal-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 8px;
  border: 1.5px solid var(--btn-border); background: var(--surface-2); color: var(--btn-text);
  font-size: 14px; font-family: inherit; margin-top: 10px;
}
.del-modal-input:focus { outline: none; border-color: var(--purple); }
.del-modal-error { font-size: 12px; color: #C0392B; margin-top: 6px; min-height: 16px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px;
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ── Board view ─────────────────────────────────────────── */
#view-board {
  display: none; flex-direction: column; height: 100vh; height: 100svh; overflow: hidden;
}
#view-board.active { display: flex; }

#board-toolbar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--toolbar-border); flex-shrink: 0; z-index: 100;
}
.sep { width: 1px; height: 22px; background: var(--toolbar-border); margin: 0 3px; flex-shrink: 0; }

#lock-banner {
  display: none; background: #FAEEDA; border-bottom: 1px solid #EF9F27;
  padding: 6px 16px; font-size: 13px; font-weight: 600; color: #633806;
  text-align: center; flex-shrink: 0;
}
#lock-banner.show { display: block; }

#world-wrap { flex: 1; overflow: hidden; position: relative; cursor: default; }
#world { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 4000px; height: 4000px; }
#grid-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#edge-svg { position: absolute; top: 0; left: 0; width: 4000px; height: 4000px; pointer-events: none; overflow: visible; }
.edge-del { pointer-events: all; cursor: pointer; }

/* Popples */
.popple { position: absolute; min-width: 130px; min-height: 74px; border-radius: 13px; border: 2.5px solid; padding: 12px 14px; cursor: grab; user-select: none; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: box-shadow .15s; }
.popple:active { cursor: grabbing; }
.popple.dragging { box-shadow: var(--shadow-drag); z-index: 1000 !important; }
.popple.selected { outline: 3px solid rgba(83,74,183,.55); outline-offset: 2px; }
.popple-owner { font-size: 10px; font-weight: 700; opacity: .55; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.popple textarea { background: transparent; border: none; outline: none; font-family: inherit; font-size: 13.5px; font-weight: 500; resize: none; width: 100%; line-height: 1.45; cursor: text; overflow: hidden; min-height: 36px; }
.popple textarea::placeholder { opacity: .5; }
.dot { position: absolute; width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--surface); border: 2.5px solid; cursor: crosshair; opacity: 0; transition: opacity .15s; z-index: 10; }
.popple:hover .dot, .popple.selected .dot { opacity: 1; }
.dot[data-dir="t"] { top: calc(var(--dot)/-2); left: 50%; transform: translateX(-50%); }
.dot[data-dir="b"] { bottom: calc(var(--dot)/-2); left: 50%; transform: translateX(-50%); }
.dot[data-dir="l"] { left: calc(var(--dot)/-2); top: 50%; transform: translateY(-50%); }
.dot[data-dir="r"] { right: calc(var(--dot)/-2); top: 50%; transform: translateY(-50%); }
.popple-del { position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; border-radius: 50%; background: #E24B4A; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; display: none; align-items: center; justify-content: center; cursor: pointer; border: 2px solid var(--surface); z-index: 20; }
.popple.selected .popple-del { display: flex; }
.popple-resize { position: absolute; bottom: 3px; right: 4px; width: 14px; height: 14px; cursor: se-resize; opacity: 0; transition: opacity .15s; }
.popple:hover .popple-resize, .popple.selected .popple-resize { opacity: .4; }

/* Toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px); background: #2c2c2a; color: #fff; padding: 8px 18px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9999; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Help */
#help-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 5000; opacity: 0; pointer-events: none; transition: opacity .2s; }
#help-overlay.show { opacity: 1; pointer-events: all; }
#help-box { background: var(--surface); border-radius: 14px; padding: 28px 32px; max-width: 420px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 88vh; overflow-y: auto; }
#help-box h2 { font-size: 18px; margin-bottom: 16px; color: var(--purple); }
#help-box table { width: 100%; border-collapse: collapse; font-size: 13px; }
#help-box td { padding: 6px 0; vertical-align: top; }
#help-box td:first-child { color: var(--purple); font-weight: 600; padding-right: 14px; white-space: nowrap; }
#help-box tr + tr td { border-top: 1px solid #f0eee8; }
/* ── Room card action buttons ────────────────────────────────── */
.rt-actions {
  display: flex; gap: 6px; align-items: center;
  border-bottom: 1px solid var(--btn-border);
  padding-bottom: 10px; margin-bottom: 8px;
}
.rt-actions .rt-del { margin-left: auto; }

.rt-qr {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--btn-border);
  font-size: 11px; font-weight: 600; color: var(--purple);
  cursor: pointer; transition: background .12s, border-color .12s;
}
.rt-qr:hover { background: var(--purple-light); border-color: var(--purple); }

.rt-present-toggle.toggle-switch {
  width: 30px; height: 18px; margin-left: 2px;
}
.rt-present-toggle .toggle-slider::before { width: 12px; height: 12px; left: 3px; top: 3px; }
.rt-present-toggle input:checked + .toggle-slider::before { transform: translateX(12px); }

/* ── QR modal ────────────────────────────────────────────────── */
#qr-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
}
#qr-modal {
  background: var(--surface); border-radius: 18px; padding: 36px 40px;
  text-align: center; width: 340px; max-width: 92vw;
  box-shadow: 0 24px 60px rgba(0,0,0,.2); position: relative;
}
#qr-close {
  position: absolute; top: 14px; right: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--btn-border); background: var(--surface);
  font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--btn-text);
}
#qr-close:hover { background: #FCEBEB; border-color: #E24B4A; color: #A32D2D; }
#qr-modal h2 {
  font-size: 17px; font-weight: 700; color: var(--btn-text);
  margin-bottom: 4px; padding-right: 20px;
}
.qr-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
#qr-canvas {
  display: flex; justify-content: center; margin-bottom: 16px;
}
#qr-canvas img, #qr-canvas canvas {
  border-radius: 8px; border: 4px solid var(--surface);
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
}
.qr-code-text {
  font-size: 28px; font-weight: 800; letter-spacing: .18em;
  color: var(--purple); margin-bottom: 6px;
}
.qr-url {
  font-size: 11px; color: var(--text-muted); word-break: break-all;
  margin-bottom: 18px; line-height: 1.5;
}
.qr-copy-btn {
  width: 100%; padding: 10px; background: var(--purple); color: #fff;
  border: none; border-radius: 9px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background .12s;
}
.qr-copy-btn:hover { background: var(--purple-dark); }

/* ── Student roster sidebar (teacher board view only) ────────── */
#board-body { flex: 1; display: flex; overflow: hidden; }

#students-panel {
  display: flex; flex-direction: row;
  background: var(--surface); border-left: 1px solid var(--toolbar-border);
  flex-shrink: 0; width: 36px;
  transition: width .22s ease; overflow: hidden;
}
#students-panel.open { width: 220px; }

#sp-toggle {
  flex-shrink: 0; width: 36px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; padding: 14px 0 0; gap: 10px;
  border: none; border-right: 1px solid var(--toolbar-border);
  background: none; cursor: pointer; font-family: inherit;
  transition: background .12s; color: var(--text-muted);
}
#sp-toggle:hover { background: var(--btn-hover); color: var(--btn-text); }
#students-panel.open #sp-toggle { background: var(--purple-light); color: var(--purple); }

/* Chevron: points right (▶) when closed → rotate to left (◀) when open */
#sp-chevron { transition: transform .22s; transform: rotate(180deg); }
#students-panel.open #sp-chevron { transform: rotate(0deg); }

#sp-badge {
  background: var(--purple); color: #fff;
  border-radius: 10px; padding: 2px 5px;
  font-size: 10px; font-weight: 700; min-width: 16px; text-align: center;
  line-height: 1.5;
}
.sp-toggle-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  writing-mode: vertical-rl; transform: rotate(180deg); margin-top: 2px;
}

#sp-drawer {
  flex: 1; display: flex; flex-direction: column; overflow-y: auto; min-width: 0;
}
.sp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px; border-bottom: 1px solid var(--toolbar-border);
  font-size: 12px; font-weight: 700; color: var(--btn-text);
  position: sticky; top: 0; background: var(--surface); flex-shrink: 0;
}
#sp-count {
  background: var(--purple-light); color: var(--purple);
  border-radius: 10px; padding: 1px 7px;
  font-size: 11px; font-weight: 700;
}
#sp-names { list-style: none; padding: 6px 0; margin: 0; }
#sp-names li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; font-size: 12px; color: var(--btn-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border-radius: 6px; margin: 0 4px;
  transition: background .12s;
}
#sp-names li:hover { background: var(--btn-hover); }
#sp-names li.active {
  background: rgba(83,74,183,.12); color: var(--purple);
  font-weight: 700;
}
#sp-names li.active::before { background: var(--purple) !important; }
#sp-names li::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #5DCAA5; flex-shrink: 0;
}
#sp-names li[data-offline]::before { background: #bbb; }
#sp-names li[data-offline]:not(.active) { color: var(--text-muted); }
#sp-names .sp-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); padding: 8px 14px 2px; cursor: default; pointer-events: none;
}
#sp-names .sp-section-label::before { display: none; }
#sp-names .sp-section-label:hover { background: transparent; }
.sp-empty {
  font-size: 12px; color: var(--text-muted);
  padding: 16px 14px; text-align: center; margin: 0;
}

/* ── Student kick / block (shared by mindbubble + Learning Wall host pages) ── */
.sp-kick-btn {
  margin-left: auto; flex-shrink: 0;
  width: 18px; height: 18px; border: none; border-radius: 50%;
  background: transparent; color: var(--text-muted);
  font-size: 11px; line-height: 18px; text-align: center; padding: 0;
  cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
#sp-names li:hover .sp-kick-btn { opacity: 1; }
.sp-kick-btn:hover { background: #E24B4A; color: #fff; }
#sp-blocked-section { border-top: 1px solid var(--toolbar-border); }
#sp-blocked-list { list-style: none; padding: 6px 0; margin: 0; }
#sp-blocked-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-unblock-btn {
  margin-left: auto; flex-shrink: 0;
  border: 1px solid var(--toolbar-border); border-radius: 6px; background: var(--surface);
  color: var(--btn-text); font-size: 11px; font-weight: 600; padding: 2px 8px;
  cursor: pointer; transition: background .12s;
}
.sp-unblock-btn:hover { background: var(--btn-hover); }

/* ── Usage stats panel ───────────────────────────────────── */
.stats-range-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.stats-range-btn {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--btn-border);
  background: var(--surface); color: var(--btn-text); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s, color .12s;
}
.stats-range-btn:hover { background: var(--btn-hover); }
.stats-range-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.stats-range-custom {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted);
}
.stats-range-custom input[type="date"] {
  border: 1.5px solid var(--btn-border); border-radius: 8px; padding: 4px 8px;
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--btn-text);
}
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--btn-border);
  border-radius: 13px;
  padding: 20px;
  text-align: center;
}
.stat-num {
  font-size: 36px;
  font-weight: 700;
  color: var(--purple);
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}
.stats-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) {
  .stats-detail-grid { grid-template-columns: 1fr; }
}

.stats-mode-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 20px;
}
.stats-mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--btn-border);
  background: var(--surface); color: var(--btn-text); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s, color .12s;
}
.stats-mode-btn:hover { background: var(--btn-hover); }
.stats-mode-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }

.solo-games-section {
  margin-bottom: 24px;
}
.solo-games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.game-solo-card {
  background: var(--surface);
  border: 1px solid var(--btn-border);
  border-radius: 13px;
  padding: 18px 20px;
}
.game-solo-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--btn-text);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--toolbar-border);
}
.gs-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--dgc-bg);
  color: var(--dgc-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.game-solo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--toolbar-border);
  font-size: 13px;
}
.game-solo-row:last-child { border-bottom: none; }
.game-solo-label { color: var(--text-muted); }
.game-solo-num   { font-weight: 700; color: var(--purple); }
.game-solo-subheader {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin: 10px 0 2px;
}
.game-solo-subheader:first-of-type { margin-top: 0; }
@media (max-width: 900px) {
  .solo-games-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .solo-games-grid { grid-template-columns: 1fr; }
}
