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

/* The body stays locked to the window (css/main.css) like index.html: the
   nav and portal sidebar never move, only .portal-main / .auth-hero scroll. */
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg);
       display: flex; flex-direction: column; }

/* ── 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; min-height: 0; }
#view-portal.active { display: flex; }

/* Same shape as index.html's .lander-wrap: fixed sidebar, main scrolls on its own */
.portal-body {
  flex: 1; min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--bg);
}

/* Sidebar — same look as the Game Menu (css/nav.css
   .proj-launcher + .proj-grid--themed): a frosted-glass column
   over the page scene, pill category labels, 3-across tinted icon tiles. */
.portal-sidebar {
  --menu-glass: 82%;
  --menu-tint: color-mix(in srgb, var(--purple) 8%, var(--surface));
  width: var(--game-menu-w); flex-shrink: 0;
  border-right: 1px solid var(--toolbar-border);
  padding: 18px 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--purple) 30%, transparent) transparent;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--menu-tint) var(--menu-glass), transparent),
    color-mix(in srgb, var(--surface) var(--menu-glass), transparent) 160px);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}
/* Solid where glass would hurt (matches the home menu) */
html[data-theme="high-contrast"] .portal-sidebar,
html[data-reduce-motion] .portal-sidebar { --menu-glass: 100%; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .portal-sidebar { --menu-glass: 100%; }
}
.sidebar-section { margin-bottom: 20px; border-radius: 16px; scroll-margin-top: 12px; }
/* Dashboard "Create a Game" points here (js/teacher.js) */
.sidebar-section.is-pulsing { animation: sidebar-pulse 1.4s ease-out 1; }
@keyframes sidebar-pulse {
  0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--purple) 45%, transparent); background: color-mix(in srgb, var(--purple) 10%, transparent); }
  100%    { box-shadow: 0 0 0 4px transparent; background: transparent; }
}
html[data-reduce-motion] .sidebar-section.is-pulsing { animation-timing-function: step-end; }   /* no fade: on, then off */
.sidebar-section:last-child { margin-bottom: 0; }
.sidebar-label {
  display: inline-flex;
  padding: 4px 11px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--purple) 13%, var(--surface));
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: color-mix(in srgb, var(--purple) 75%, var(--btn-text));
}
/* Subject headings inside the Games section (teacher/panels.php 'topics') */
.sidebar-sublabel {
  margin: 14px 2px 8px;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
}
.sidebar-label + .sidebar-sublabel { margin-top: 0; }
.sidebar-tile-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.sidebar-btn {
  --tile: var(--sidebar-icon-color, var(--purple));
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 6px; width: 100%; min-width: 0;
  padding: 0; border: 0; background: none; outline: none;
  font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.25;
  color: var(--btn-text); text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-btn-icon {
  width: 100%; aspect-ratio: 1; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--tile) 14%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--tile) 32%, var(--surface));
  color: color-mix(in srgb, var(--tile) 78%, var(--btn-text));
  box-shadow: 0 1px 3px color-mix(in srgb, var(--tile) 18%, transparent);
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.sidebar-btn-icon svg { width: 46%; height: 46%; }
.sidebar-btn:hover .sidebar-btn-icon,
.sidebar-btn:focus-visible .sidebar-btn-icon {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--tile) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--tile) 55%, var(--surface));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--tile) 26%, transparent);
}
.sidebar-btn:focus-visible .sidebar-btn-icon { outline: 2px solid var(--purple); outline-offset: 2px; }
.sidebar-btn:active .sidebar-btn-icon { transform: scale(.94); }
/* The whole button is transparent — only the icon box is a tile (beats
   css/main.css's global button:hover background). */
.sidebar-btn:hover { background: none; }
/* Current panel: filled in the theme accent (not the panel's own fixed
   colour), so the fill, glow and label follow the active theme. */
.sidebar-btn.active { --tile: var(--purple); color: color-mix(in srgb, var(--tile) 80%, var(--btn-text)); }
.sidebar-btn.active .sidebar-btn-icon,
.sidebar-btn.active:hover .sidebar-btn-icon {
  background: var(--tile);
  border-color: var(--tile);
  color: #fff;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--tile) 32%, transparent);
}
@media (orientation: landscape) and (max-height: 700px) {
  .sidebar-btn-icon { aspect-ratio: 1.3; }
}
html[data-reduce-motion] .sidebar-btn-icon { transition: none; transform: none !important; }
@media (hover: none) {
  .sidebar-btn:hover:not(.active) .sidebar-btn-icon {
    transform: none;
    background: color-mix(in srgb, var(--tile) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--tile) 32%, var(--surface));
    box-shadow: 0 1px 3px color-mix(in srgb, var(--tile) 18%, transparent);
  }
}

.sidebar-btn.sidebar-coffee {
  flex-direction: row; align-items: center; justify-content: flex-start; gap: 9px;
  width: 100%; padding: 8px 12px; margin-bottom: 12px; border-radius: 12px;
  font-size: 13px; font-weight: 600; text-align: left; text-decoration: none;
  color: var(--purple); background: color-mix(in srgb, var(--purple) 12%, var(--surface));
}
.sidebar-btn.sidebar-coffee:hover { background: var(--purple); color: #fff; }
.sidebar-coffee img { flex-shrink: 0; width: 16px; height: 16px; }
.sidebar-divider { height: 1px; background: var(--toolbar-border); margin: 12px 0; }


/* Main content area */
.portal-main {
  flex: 1; padding: 32px 40px; min-width: 0; position: relative;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}

/* Mobile: stack the sidebar above the content, like index.html. The portal
   body becomes the one scroller so the menu scrolls away with the page. */
@media (max-width: 700px) {
  .portal-body {
    flex-direction: column;
    overflow-x: hidden; overflow-y: auto;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    background: var(--bg);
  }
  .portal-sidebar {
    width: auto; flex-shrink: 0; overflow: visible;
    padding: 14px 14px 10px;
    border-right: 0; border-bottom: 1px solid var(--toolbar-border);
  }
  .sidebar-section { margin-bottom: 14px; }
  .sidebar-tile-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .portal-main { flex: none; overflow: visible; padding: 24px 18px; }
}

/* Sign out — top right of every portal page (moved here from the site nav) */
.portal-signout {
  position: absolute; top: 26px; right: 40px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1.5px solid var(--btn-border); background: var(--surface); color: var(--btn-text);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.portal-signout:hover { border-color: var(--purple); color: var(--purple); }
.portal-signout:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
/* Keep each page's heading clear of the button */
.portal-panel > .panel-title:first-child { padding-right: 120px; }
.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; }
.room-tile.is-class { border-left: 4px solid #0F766E; cursor: default; }
.room-tile.is-class.is-selected { box-shadow: 0 0 0 2px #0F766E, 0 4px 16px rgba(15,118,110,.18); }
.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; }
.card-type-chip.is-class { background: #CCFBF1; color: #0F766E; }
.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; }
.class-roster-card { max-width: 640px; }
.class-roster-card h3 { margin-bottom: 2px; }
.class-roster-card .qr-sub { margin-bottom: 4px; }
.class-roster-card .roster-list { margin-top: 16px; }
.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; }

/* Settings panel (teacher/panel-account.php): Profile + Password side by
   side, Font and Danger zone full width. Same card language as the
   dashboard's .dash-section. */
.acc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.acc-card {
  max-width: none; margin: 0;
  padding: 22px 24px;
  border: 1.5px solid var(--btn-border); border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
}
.acc-card--wide { grid-column: 1 / -1; }
.acc-card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.acc-card-head h3 { margin: 2px 0 3px; font-size: 17px; font-weight: 800; }
.acc-card-sub { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.acc-card-icon {
  flex-shrink: 0;
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--acc) 14%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--acc) 32%, var(--surface));
  color: color-mix(in srgb, var(--acc) 80%, var(--btn-text));
}
.acc-card-icon svg { width: 20px; height: 20px; }
.acc-card .settings-row { flex-wrap: wrap; }
.acc-card .settings-row .field { min-width: 180px; }
.acc-card .settings-save { padding: 11px 22px; border-radius: 10px; font-size: 14px; font-weight: 700; }
.acc-card .danger-btn { padding: 11px 22px; border-radius: 10px; font-size: 14px; font-weight: 700; }
.acc-notice {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  background: color-mix(in srgb, #D97706 12%, var(--surface));
  border: 1.5px solid color-mix(in srgb, #D97706 35%, var(--surface));
  color: var(--btn-text);
}
.acc-notice-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.acc-font-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.acc-font-grid .avatar-style-opt { padding: 14px 6px; border-radius: 12px; }
@media (max-width: 900px) {
  .acc-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .acc-card { padding: 18px 16px; }
}

/* 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-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 { 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; }
.wn-list a { color: var(--purple-dark); font-weight: 600; }

/* Alert/invite cards tint from the theme's own surface and text colours so
   they stay readable on light and dark themes alike. */
.site-alert-card {
  background: color-mix(in srgb, #DC2626 9%, var(--surface));
  border: 1.5px solid color-mix(in srgb, #DC2626 30%, var(--surface));
  border-left: 4px solid #DC2626;
  border-radius: 13px;
  padding: 14px 18px;
  margin-bottom: 24px;
}
.sa-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sa-title { font-size: 13px; font-weight: 700; color: color-mix(in srgb, #DC2626 75%, var(--btn-text)); text-transform: uppercase; letter-spacing: .03em; }
.sa-close {
  background: none; border: none; font-size: 18px; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 0 4px; font-family: inherit;
}
.sa-close:hover { color: var(--btn-text); }
.sa-message { margin: 0; font-size: 13px; color: var(--btn-text); line-height: 1.6; }

.pending-invites-card {
  background: color-mix(in srgb, #D97706 9%, var(--surface));
  border: 1.5px solid color-mix(in srgb, #D97706 35%, var(--surface));
  border-left: 4px solid #D97706;
  border-radius: 13px;
  padding: 14px 18px;
  margin-bottom: 24px;
}
.pi-head { margin-bottom: 8px; }
.pi-title { font-size: 13px; font-weight: 700; color: color-mix(in srgb, #D97706 70%, var(--btn-text)); text-transform: uppercase; letter-spacing: .03em; }
.pi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid color-mix(in srgb, #D97706 35%, var(--surface));
}
.pi-row:first-of-type { border-top: none; }
.pi-text { font-size: 13px; color: var(--btn-text); }
.pi-actions { display: flex; gap: 6px; flex-shrink: 0; }

.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; }

/* ── Panel hero banner (Dashboard, Settings …) ──
   Puts a panel's title + intro on a card so nothing sits straight on the
   page scene; same language as css/pages.css .info-hero. Start a panel
   with <section class="panel-hero"> and Sign out moves into its corner.
   Grid: copy on the left spanning both rows; on the right, row 1 is kept
   free for the Sign out button (absolutely positioned, see below) and an
   optional action button (.dash-cta-btn) sits under it in row 2 — so the
   two can never overlap. .panel-hero--plain = no action button. */
.panel-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(36px, auto) auto;
  gap: 14px 24px;
  padding: 24px 28px;
  margin-bottom: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--purple) 14%, var(--surface)),
    color-mix(in srgb, var(--purple) 4%, var(--surface)) 70%);
  border: 1.5px solid color-mix(in srgb, var(--purple) 26%, var(--toolbar-border, var(--btn-border)));
  box-shadow: 0 8px 26px rgba(0,0,0,.12);
}
.panel-hero-copy { grid-column: 1; grid-row: 1 / 3; align-self: center; min-width: 0; }
.panel-hero .dash-cta-btn { grid-column: 2; grid-row: 2; align-self: end; justify-self: end; }
.panel-hero-title {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 32px); font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
  color: var(--btn-text);
}
.panel-hero-sub { margin: 0; font-size: 15px; line-height: 1.55; color: color-mix(in srgb, var(--text-muted) 50%, var(--btn-text)); }
.panel-hero--plain { grid-template-rows: auto; }
.panel-hero--plain .panel-hero-copy { grid-row: 1; padding-right: 130px; }   /* clear of Sign out */
/* Sign out sits in the hero's top-right corner on panels that start with one */
.portal-main:has(> .portal-panel.active > :is(.panel-hero, .gh-hero):first-child) .portal-signout { top: 50px; right: 58px; }
@media (max-width: 700px) {
  .portal-main:has(> .portal-panel.active > :is(.panel-hero, .gh-hero):first-child) .portal-signout { top: 40px; right: 34px; }
  /* Phones: copy on top (kept clear of Sign out), full-width button below */
  .panel-hero { padding: 20px 18px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
  .panel-hero-copy, .panel-hero--plain .panel-hero-copy { grid-row: 1; padding-right: 100px; }
  .panel-hero .dash-cta-btn { grid-column: 1; grid-row: 2; justify-self: stretch; justify-content: center; }
}

.dash-cta-btn {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  background: var(--purple); color: #fff; border: none; border-radius: 12px;
  padding: 13px 22px; font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--purple) 30%, transparent);
}
.dash-cta-btn:hover { background: var(--purple); color: #fff; filter: brightness(1.08); }

/* Section card (My Classes / My Content) */
.dash-section {
  padding: 20px 22px 22px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1.5px solid var(--btn-border);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
}
@media (max-width: 700px) { .dash-section { padding: 16px 14px; } }
/* Rows/cards rendered inside a section card (packs, history, groups) sit a
   step off the card colour so they still read as separate items. */
.dash-section .my-pack-row { background: var(--surface-2); }
.dash-section .pack-empty { padding: 32px 16px; }
.dash-section > .lobby-err { margin: 6px 0 0; min-height: 0; }
.dash-section > .lobby-err:empty { display: none; }
.dash-section .create-form { max-width: 560px; }
.dash-section .my-packs-header { gap: 12px; flex-wrap: wrap; }
.my-packs-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Learning Walls' create form is already a card — line it up with the sections */
#panel-walls .create-wall-form { max-width: none; margin-top: 0; border-radius: 18px; }
.create-wall-err { grid-column: 1 / -1; margin: 0; min-height: 0; }
.create-wall-err:empty { display: none; }
/* Game History */
.hist-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.hist-filters:empty { display: none; }
.hist-compare-bar {
  position: sticky; bottom: 0; z-index: 2;
  align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 12px;
  margin-top: 12px; padding: 12px 14px;
  background: var(--surface); border: 1.5px solid var(--btn-border); border-radius: 14px;
  box-shadow: 0 -4px 18px rgba(0,0,0,.08);
}
.hist-compare-count { font-size: 13px; color: var(--text-muted); margin-right: auto; }
.btn-sm.hist-compare-btn,
.btn-sm.hist-compare-btn:hover { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn-sm.hist-compare-btn:disabled { opacity: .55; }
.class-roster-card { border-radius: 18px; box-shadow: 0 4px 18px rgba(0,0,0,.06); }
/* Admin pages: stat tiles inside a section card sit a step off the card */
.dash-section .stat-card,
.dash-section .game-solo-card { background: var(--surface-2); }
.dash-section .stats-summary-grid,
.dash-section .solo-games-section { margin-bottom: 0; }
.dash-section .solo-games-section + .solo-games-section { margin-top: 16px; }
.admin-form-card { max-width: 620px; }
/* main.css only styles .field <input>s: give the Mailbox form's textarea and selects the same look. */
#panel-mailbox .field textarea,
#panel-mailbox .field select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--btn-border);
  font-size: 14px; font-family: inherit; color: var(--btn-text); background: var(--surface-2);
  outline: none; transition: border-color .15s; box-sizing: border-box;
}
#panel-mailbox .field textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
#panel-mailbox .field textarea:focus,
#panel-mailbox .field select:focus { border-color: var(--purple); }
#panel-game-availability .settings-card,
#panel-site-events .dash-section { border-radius: 18px; }
.dash-section .dash-classes-grid,
.dash-section .dash-feature-grid { margin-bottom: 0; }
/* Tiles inside a card: a step off the card colour so they still read as tiles */
.dash-section .room-tile,
.dash-section .dash-game-card { background: var(--surface-2); }
.dash-section .room-tile:hover,
.dash-section .dash-game-card:hover { background: var(--surface); }
.dash-section .empty-state { padding: 28px 16px; cursor: pointer; border: 1.5px dashed var(--btn-border); border-radius: 13px; }
.dash-section .empty-state:hover { border-color: var(--purple); color: var(--purple); }

.dash-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 14px;
}
.dash-section-title { font-size: 17px; font-weight: 800; color: var(--btn-text); margin: 0; }
.dash-section-link {
  font-size: 13px; font-weight: 600; color: var(--purple);
  background: none; border: none; cursor: pointer; padding: 0; font-family: inherit;
}
.dash-section-link:hover { text-decoration: underline; }

.dash-classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.room-tile.dash-mini-tile { cursor: pointer; }

/* Badges are always solid — never see-through over the page scene.
   Locked ones are muted by greying the icon and text, not the card. */
.ach-badge {
  border-radius: 16px;
  border: 1.5px solid var(--btn-border);
  padding: 18px 12px 14px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.ach-earned {
  border-color: color-mix(in srgb, var(--purple) 55%, var(--surface));
  background: color-mix(in srgb, var(--purple) 12%, var(--surface));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--purple) 18%, transparent);
}
.ach-locked { border-style: dashed; }
.ach-locked .ach-icon { filter: grayscale(1); opacity: .4; }
.ach-locked .ach-name { color: var(--text-muted); }
.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  {
  display: inline-block; margin-top: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700;
  color: color-mix(in srgb, var(--purple) 80%, var(--btn-text));
  background: var(--surface);
}
.ach-loading { text-align: center; padding: 40px; color: var(--text-muted); font-size: 13px; margin: 0; }

/* Stat chips inside a .panel-hero (Achievements) */
.panel-hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.panel-hero-stats:empty { display: none; }
.panel-hero-stat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--btn-border);
  font-size: 13px; color: var(--text-muted);
}
.panel-hero-stat strong { color: var(--btn-text); font-weight: 800; }

/* 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; }
.empty-state .empty-icon svg { width: 40px; height: 40px; display: inline-block; vertical-align: middle; }

/* ── Board view ─────────────────────────────────────────── */
#view-board {
  display: none; flex-direction: column; height: 100vh; height: 100svh; height: 100dvh; 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-lobby-start {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  background: var(--purple); border: 1px solid var(--purple);
  font-size: 11px; font-weight: 700; color: #fff;
  cursor: pointer; transition: background .12s;
  white-space: nowrap;
}
.rt-lobby-start:hover { background: var(--purple-dark); }

.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); }

/* ── Class roster (inline panel in the teacher Classes panel) ────── */
.roster-list { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.roster-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px; border-bottom: 1px solid var(--btn-border);
  font-size: 13px;
}
.roster-row:last-child { border-bottom: none; }
.roster-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--btn-border);
}
.roster-row.is-present .roster-dot { background: #1D9E75; }
.roster-name { flex: 1; font-weight: 600; color: var(--btn-text); }
.roster-seen { font-size: 11px; color: var(--text-muted); }
.roster-row.is-present .roster-seen { color: #1D9E75; font-weight: 600; }
.roster-kick {
  font-size: 11px; font-weight: 600; color: #A32D2D;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 3px 7px; cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.roster-kick:hover { background: #FCEBEB; border-color: #E24B4A; }

/* ── 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; }
}

/* iPhone/iPad home-bar gap at the end of each scrolling area (the body no
   longer pads for it, so panels reach the bottom edge; css/main.css) */
.portal-main::after, .portal-sidebar::after, .auth-hero::after {
  content: "";
  display: block;
  height: env(safe-area-inset-bottom, 0px);
}
