:root {
  --sp-bg: #f5f4fb;
  --sp-surface: #ffffff;
  --sp-border: #e5e3f0;
  --sp-ink: #141526;
  --sp-muted: #64637a;
  --sp-primary: #6D28D9;
  --sp-primary-fg: #ffffff;
  --sp-primary-hover: color-mix(in srgb, #6D28D9 86%, #000000);
  --sp-primary-soft: color-mix(in srgb, #6D28D9 14%, transparent);
  --sp-accent: #F59E0B;
}

body.skoolpress-fullpage-body {
  margin: 0 !important;
  padding: 0 !important;
  background: var(--sp-bg) !important;
  color: var(--sp-ink);
  overflow-x: hidden;
}

.skoolpress-fullpage-wrap {
  width: 100%;
  min-height: 100vh;
}

.skoolpress-shell,
.skoolpress-shell * {
  box-sizing: border-box;
}

.skoolpress-shell {
  background: var(--sp-bg);
  color: var(--sp-ink);
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  width: 100%;
  direction: rtl;
  line-height: 1.5;
  text-align: start;
}

.skoolpress-shell.sp-is-embedded {
  width: 100vw;
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
  min-height: 85vh;
}

.sp-container {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 20px;
}

/* Top Navbar */
.sp-topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sp-border);
  box-shadow: 0 1px 3px rgba(27, 27, 24, 0.03);
}

body.admin-bar .sp-topnav {
  top: 32px;
}

@media (max-width: 782px) {
  body.admin-bar .sp-topnav {
    top: 46px;
  }
}

.sp-topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
  padding-block: 8px;
}

.sp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  color: var(--sp-ink);
  text-decoration: none;
  cursor: pointer;
}

.sp-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.sp-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sp-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.sp-tabs::-webkit-scrollbar {
  display: none;
}

.sp-tab {
  background: transparent;
  border: none;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sp-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.sp-tab:hover {
  color: var(--sp-ink);
  background: var(--sp-bg);
}

.sp-tab.is-active {
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
}

/* Sub-toolbar */
.sp-subbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--sp-border);
  padding-block: 10px;
}

.sp-subbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sp-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  max-width: 440px;
}

.sp-search-icon {
  position: absolute;
  inset-inline-start: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sp-muted);
  pointer-events: none;
  display: inline-flex;
}

.sp-search-input {
  padding-inline-start: 34px !important;
  background: var(--sp-bg) !important;
}

.sp-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.sp-input,
.sp-textarea,
.sp-select {
  width: 100%;
  background: var(--sp-surface);
  color: var(--sp-ink);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.sp-input:hover,
.sp-textarea:hover,
.sp-select:hover {
  border-color: #d5d3cc;
}

.sp-input:focus,
.sp-textarea:focus,
.sp-select:focus {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px var(--sp-primary-soft);
}

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

.sp-lang-select {
  width: auto;
  background: var(--sp-surface);
  color: var(--sp-ink);
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sp-icon-btn {
  position: relative;
  background: var(--sp-surface);
  color: var(--sp-ink);
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  text-decoration: none;
}

.sp-icon-btn:hover {
  border-color: #b8b6ae;
}

.sp-badge-count {
  background: var(--sp-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 5px;
}

/* Main Layout */
.sp-main {
  padding-block: 24px 56px;
}

.sp-grid-community {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .sp-grid-community {
    grid-template-columns: 1fr;
  }
}

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

@media (max-width: 900px) {
  .sp-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .sp-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Community Hero Banner */
.sp-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 72%, #1e0536) 0%, var(--sp-primary) 55%, color-mix(in srgb, var(--sp-primary) 76%, #7c3aed) 100%);
  color: #ffffff;
  padding: 24px 26px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 14px 34px -14px rgba(59, 7, 100, 0.42);
}

.sp-hero-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sp-hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.sp-hero-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #ffffff;
  color: var(--sp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 8px 20px -6px rgba(20, 21, 38, 0.28);
}

.sp-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sp-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sp-btn-amber {
  background: var(--sp-accent);
  color: #141526;
  border: none;
  padding: 9px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  text-decoration: none;
}

.sp-btn-amber:hover {
  filter: brightness(0.94);
}

.sp-btn-glass {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 9px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.sp-btn-glass:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Cards & Buttons */
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px -2px rgba(20, 21, 38, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sp-card:hover {
  border-color: #cfcbe4;
  box-shadow: 0 10px 26px -14px rgba(20, 21, 38, 0.14);
}

.sp-post-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--sp-border);
  margin-bottom: 12px;
  display: block;
}

.sp-pin-btn.is-pinned {
  background: var(--sp-accent);
  border-color: var(--sp-accent);
  color: #ffffff;
}

.sp-notif-popover {
  position: absolute;
  inset-inline-end: 0;
  top: 100%;
  margin-top: 8px;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  box-shadow: 0 18px 40px -10px rgba(20, 21, 38, 0.18);
  z-index: 60;
  overflow: hidden;
}

.sp-sidebar-cover {
  height: 112px;
  margin: -18px -20px 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 78%, #1e0536), var(--sp-primary));
  position: relative;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.sp-sidebar-wave {
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  width: 100%;
  height: 28px;
  display: block;
}

.sp-sidebar-badge {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
  border: 4px solid #ffffff;
  box-shadow: 0 6px 14px -4px rgba(20, 21, 38, 0.2);
  margin: -27px auto 10px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  overflow: hidden;
}

.sp-sidebar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 640px) {
  .sp-container { padding-inline: 12px; }
  .sp-hero { padding: 18px 16px; }
  .sp-card { padding: 14px 14px; }
  .sp-sidebar-cover { margin: -14px -14px 0; }
}

.sp-role-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--sp-primary-soft);
  color: var(--sp-primary);
  font-size: 11px;
  font-weight: 700;
}

.sp-media-grid { display: grid; gap: 6px; margin-bottom: 12px; border-radius: 12px; overflow: hidden; grid-template-columns: 1fr 1fr; }
.sp-media-grid.sp-media-1 { grid-template-columns: 1fr; }
.sp-media-grid img { width: 100%; height: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.sp-media-grid.sp-media-1 img { aspect-ratio: 16 / 9; }
.sp-post-video { width: 100%; max-height: 480px; border-radius: 12px; margin-bottom: 12px; background: #000; display: block; }
.sp-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-bottom: 12px; border-radius: 12px; overflow: hidden; background: #000; }
.sp-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sp-file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 0 0 10px; margin-inline-end: 8px; border: 1px solid var(--sp-border); border-radius: 10px; background: var(--sp-bg); color: inherit; font-size: 13px; font-weight: 600; text-decoration: none; }
.sp-media-panel { display: grid; gap: 8px; background: var(--sp-bg); padding: 10px; border-radius: 10px; border: 1px solid var(--sp-border); }
.sp-media-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-upload-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sp-media-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-media-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--sp-border); border-radius: 10px; background: var(--sp-surface); font-size: 12px; max-width: 100%; }
.sp-media-item img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.sp-media-item button { border: 0; background: transparent; cursor: pointer; color: #dc2626; font-size: 14px; }
.sp-hero-admin { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(109, 40, 217, 0.25); border-top-color: var(--sp-primary); border-radius: 50%; animation: sp-spin 0.8s linear infinite; flex: none; vertical-align: middle; }
@keyframes sp-spin { to { transform: rotate(360deg); } }
.sp-progress { display: block; width: 110px; height: 5px; border-radius: 4px; background: var(--sp-border); overflow: hidden; }
.sp-progress-bar { display: block; height: 100%; width: 0; background: var(--sp-primary); transition: width 0.15s linear; }
.sp-media-item.is-pending { padding: 6px 10px; }
.sp-media-item.is-pending img { filter: saturate(0.7) brightness(0.92); }
.sp-pending-info { display: grid; gap: 3px; }
.sp-pending-text { font-size: 11px; color: var(--sp-muted); }
.sp-upload-overlay { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(20, 10, 50, 0.5); color: #fff; font-weight: 700; font-size: 14px; }
.sp-upload-overlay .sp-spinner { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; width: 20px; height: 20px; }
.sp-edit-chip { position: absolute; top: 10px; z-index: 4; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: rgba(20, 10, 50, 0.62); color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.35); }
.sp-chip-end { inset-inline-end: 10px; }
.sp-chip-start { inset-inline-start: 10px; }
.sp-about-cover { position: relative; height: 130px; border-radius: 12px; margin-bottom: 16px; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 78%, #1e0536), var(--sp-primary)); background-size: cover; background-position: center; }
.sp-about-logo-wrap { position: relative; flex: none; }
.sp-about-logo { width: 56px; height: 56px; border-radius: 12px; background: var(--sp-primary-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--sp-primary); font-weight: 800; }
.sp-about-logo img { width: 100%; height: 100%; object-fit: cover; }
.sp-logo-edit { position: absolute; inset-inline-end: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--sp-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: pointer; border: 2px solid #fff; z-index: 3; }
.sp-edit-banner { background: var(--sp-primary-soft); color: var(--sp-primary); font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }

.sp-menu-wrap {
  position: relative;
}

.sp-menu-popover {
  position: absolute;
  inset-inline-end: 0;
  top: 100%;
  margin-top: 6px;
  width: 185px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  box-shadow: 0 14px 30px -8px rgba(20, 21, 38, 0.18);
  padding: 6px;
  z-index: 20;
  display: grid;
  gap: 2px;
}

.sp-menu-item {
  width: 100%;
  text-align: start;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sp-ink);
  cursor: pointer;
  font-family: inherit;
}

.sp-menu-item:hover {
  background: var(--sp-bg);
}

.sp-btn-primary {
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
  border: none;
  padding: 9px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  box-shadow: 0 4px 12px -4px rgba(109, 40, 217, 0.4);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.sp-btn-primary:hover {
  background: var(--sp-primary-hover);
  box-shadow: 0 6px 16px -4px rgba(109, 40, 217, 0.5);
}

.sp-btn-primary:active {
  transform: scale(0.99);
}

.sp-btn-primary.is-active {
  box-shadow: 0 0 0 2px var(--sp-surface), 0 0 0 4px var(--sp-accent);
}

.sp-btn-primary-sm {
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12px;
}

.sp-btn-primary-soft {
  background: var(--sp-primary-soft);
  color: var(--sp-primary);
  border: 1px solid rgba(109, 40, 217, 0.25);
  padding: 8px 14px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sp-btn-primary-soft:hover {
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
}

.sp-editor-box {
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  background: var(--sp-bg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.sp-editor-box:focus-within {
  background: var(--sp-surface);
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px var(--sp-primary-soft);
}

.sp-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-bottom: 1px solid var(--sp-border);
  background: rgba(255, 255, 255, 0.85);
}

.sp-editor-box .sp-textarea {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.sp-post-body {
  margin: 0 0 12px;
  font-size: 14px;
  color: #323149;
  line-height: 1.65;
}

.sp-post-body p {
  margin: 0 0 8px;
  white-space: pre-line;
}

.sp-post-body p:last-child,
.sp-post-body ul:last-child {
  margin-bottom: 0;
}

.sp-post-body ul {
  margin: 0 0 8px;
  padding-inline-start: 20px;
}

.sp-post-body li {
  margin-bottom: 3px;
}

.sp-btn-secondary {
  background: var(--sp-bg);
  color: var(--sp-ink);
  border: 1px solid var(--sp-border);
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.sp-btn-secondary:hover {
  background: #eceaf7;
}

.sp-btn-secondary.is-liked {
  background: var(--sp-primary-soft);
  border-color: var(--sp-primary);
  color: var(--sp-primary);
}

/* Avatars & Level Badges */
.sp-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.sp-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--sp-border);
  background: #eceaf7;
}

.sp-avatar-sm {
  width: 28px;
  height: 28px;
}

.sp-lvl-badge {
  position: absolute;
  bottom: -3px;
  inset-inline-end: -3px;
  background: var(--sp-primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Filter Bar */
.sp-cat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.sp-cat-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
  padding-bottom: 2px;
}

.sp-cat-pills::-webkit-scrollbar {
  display: none;
}

.sp-cat-pill {
  background: var(--sp-surface);
  color: var(--sp-muted);
  border: 1px solid var(--sp-border);
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.sp-cat-pill.is-active {
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
  border-color: var(--sp-primary);
}

/* Polls */
.sp-poll-box {
  background: var(--sp-bg);
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}

.sp-poll-opt {
  position: relative;
  width: 100%;
  text-align: start;
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}

.sp-poll-opt.is-voted {
  border-color: var(--sp-accent);
}

.sp-poll-fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  background: var(--sp-primary-soft);
  pointer-events: none;
}

.sp-poll-label,
.sp-poll-pct {
  position: relative;
  z-index: 1;
}

/* Classroom Player */
.sp-course-cover {
  height: 140px;
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 60%, #7c3aed 100%);
  color: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  border-radius: 10px 10px 0 0;
}

.sp-progress-track {
  width: 100%;
  height: 7px;
  background: #ecebe5;
  border-radius: 999px;
  overflow: hidden;
}

.sp-progress-fill {
  height: 100%;
  background: #16a34a;
  transition: width 0.25s ease;
}

.sp-player-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .sp-player-layout {
    grid-template-columns: 1fr;
  }
}

.sp-lesson-btn {
  width: 100%;
  text-align: start;
  background: transparent;
  border: 1px solid transparent;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--sp-ink);
}

.sp-lesson-btn:hover {
  background: #f5f4fb;
}

.sp-lesson-btn.is-active {
  background: var(--sp-primary-soft);
  border-color: var(--sp-primary);
  font-weight: 700;
}

/* Calendar Grid */
.sp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.sp-cal-day {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.sp-cal-day.is-selected {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
}

.sp-cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--sp-accent);
}

/* Modals & Drawers */
.sp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 27, 24, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sp-modal {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 24px 60px -14px rgba(27, 27, 24, 0.22);
}

.sp-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 27, 24, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}

.sp-drawer {
  background: var(--sp-surface);
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid var(--sp-border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
}

.sp-toast {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  z-index: 1100;
  background: var(--sp-ink);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 28px -6px rgba(20, 21, 38, 0.28);
}

.skoolpress-auth-gate {
  max-width: 480px;
  margin: 60px auto;
  background: #ffffff;
  border: 1px solid #e5e3f0;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(20, 21, 38, 0.08);
}

/* Split-Card Auth UI */
.sp-auth-gate-screen {
  min-height: 100vh;
  background: var(--sp-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.sp-auth-card {
  background: var(--sp-surface);
  border: 1px solid rgba(230, 229, 224, 0.9);
  border-radius: 18px;
  max-width: 880px;
  width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: 5fr 7fr;
  box-shadow: 0 24px 64px -14px rgba(27, 27, 24, 0.24), 0 0 0 1px rgba(0, 0, 0, 0.03);
  position: relative;
}

@media (max-width: 768px) {
  .sp-auth-card {
    grid-template-columns: 1fr;
  }
}

.sp-auth-aside {
  background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 55%, #3b0764 100%);
  color: #ffffff;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.sp-auth-aside-glow {
  position: absolute;
  bottom: -60px;
  inset-inline-start: -60px;
  width: 210px;
  height: 210px;
  border-radius: 999px;
  background: var(--sp-primary);
  opacity: 0.25;
  filter: blur(44px);
  pointer-events: none;
}

.sp-auth-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.94);
}

.sp-auth-form-pane {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.sp-auth-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--sp-border);
  background: var(--sp-bg);
  color: var(--sp-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sp-auth-close:hover {
  background: #ffffff;
  color: var(--sp-ink);
}

.sp-auth-tabs {
  display: flex;
  gap: 6px;
  background: #f5f4ef;
  border: 1px solid var(--sp-border);
  box-shadow: inset 0 1px 2px rgba(27, 27, 24, 0.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.sp-auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--sp-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.sp-auth-tab.is-active {
  background: var(--sp-surface);
  color: var(--sp-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sp-auth-field {
  margin-bottom: 14px;
}

.sp-auth-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--sp-ink);
  margin-bottom: 6px;
}

.sp-pass-wrap {
  position: relative;
}

.sp-pass-toggle {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--sp-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
}

.sp-auth-alert {
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}

.sp-auth-alert.is-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.sp-auth-alert.is-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

/* ===== Mobile layout + bottom navigation ===== */
.sp-bottomnav,
.sp-fab { display: none; }

@media (max-width: 768px) {
  .sp-container { padding-inline: 12px; }
  .sp-tabs { display: none; }
  .sp-topnav-inner { min-height: 52px; flex-wrap: nowrap; gap: 10px; padding-block: 6px; }
  .sp-brand { min-width: 0; font-size: 15px; }
  .sp-brand > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
  .sp-topnav .sp-btn-amber span { display: none; }
  .sp-topnav .sp-btn-amber { padding: 8px 10px !important; }

  .sp-subbar { padding-block: 8px; }
  .sp-subbar-inner { gap: 8px; }
  .sp-search-wrap { flex: 1 1 100%; min-width: 0; max-width: none; order: 2; }
  .sp-subbar-actions { flex: 1 1 100%; order: 1; justify-content: flex-end; gap: 6px; }
  .sp-subbar .sp-icon-btn { padding: 8px 10px; }
  .sp-subbar .sp-icon-btn > span:not(.sp-badge-count):not(.sp-ico) { display: none; }
  .sp-subbar .sp-icon-btn > span.sp-ico { display: inline-block; }
  .sp-badge-count { position: absolute; top: -6px; inset-inline-end: -6px; }

  .sp-main { padding-block: 14px calc(104px + env(safe-area-inset-bottom)); }

  .sp-hero { padding: 16px; flex-direction: column; align-items: stretch; gap: 14px; border-radius: 16px; margin-bottom: 16px; }
  .sp-hero-actions { width: 100%; }
  .sp-hero-admin { width: 100%; }

  .sp-card { padding: 14px; border-radius: 14px; }

  .sp-input, .sp-textarea, .sp-select, .sp-lang-select { font-size: 16px; }
  .sp-btn-secondary, .sp-icon-btn, .sp-btn-primary:not(.sp-btn-primary-sm), .sp-btn-amber { min-height: 40px; }
  .sp-editor-toolbar { padding: 6px 8px; }
  .sp-cat-bar { flex-direction: column; align-items: stretch; }
  .sp-cat-pills { flex-wrap: nowrap; }
  .sp-cat-pill { flex-shrink: 0; }
  .sp-cat-bar .sp-select { width: 100% !important; }

  .sp-post-cover, .sp-media-grid, .sp-embed, .sp-post-video { border-radius: 10px; }
  .sp-menu-popover { width: min(220px, 70vw); }

  .sp-notif-popover { position: fixed; top: 64px; inset-inline: 12px; width: auto; max-width: none; margin-top: 0; z-index: 90; }

  .sp-backdrop:has(> .sp-modal) { align-items: flex-end; padding: 0; }
  .sp-backdrop > .sp-modal { max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .sp-drawer { max-width: 100%; }

  .sp-cal-grid { gap: 4px; }
  .sp-toast { bottom: calc(88px + env(safe-area-inset-bottom)); inset-inline: 12px; text-align: center; }

  .sp-bottomnav {
    display: flex;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 55;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--sp-border);
    box-shadow: 0 -8px 26px -12px rgba(20, 21, 38, 0.22);
  }
  .sp-bn-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 2px;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--sp-muted);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, transform 0.12s ease;
  }
  .sp-bn-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 28px;
    border-radius: 14px;
    transition: background-color 0.2s ease, transform 0.2s ease;
  }
  .sp-bn-ico .sp-ico { width: 20px; height: 20px; }
  .sp-bn-item:active { transform: scale(0.92); }
  .sp-bn-item.is-active { color: var(--sp-primary); font-weight: 800; }
  .sp-bn-item.is-active .sp-bn-ico { background: var(--sp-primary-soft); transform: translateY(-1px); }
  .sp-bn-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .sp-fab {
    display: flex;
    position: fixed;
    inset-inline-end: 16px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 56;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: var(--sp-primary);
    color: var(--sp-primary-fg);
    box-shadow: 0 12px 24px -6px color-mix(in srgb, var(--sp-primary) 70%, #000);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
  }
  .sp-fab:active { transform: scale(0.9); }
  .sp-fab .sp-ico { width: 24px; height: 24px; }

  .skoolpress-shell.sp-kb-open .sp-bottomnav,
  .skoolpress-shell.sp-kb-open .sp-fab { display: none; }
}

@media (max-width: 380px) {
  .sp-bn-ico { width: 42px; }
  .sp-bn-item { font-size: 10px; }
}

/* ===== Image lightbox ===== */
.sp-media-grid a { cursor: zoom-in; display: block; }
.sp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 14, 0.94);
  touch-action: pan-y pinch-zoom;
  animation: sp-lb-in 0.18s ease;
}
@keyframes sp-lb-in { from { opacity: 0; } to { opacity: 1; } }
.sp-lb-img {
  position: relative;
  z-index: 1;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.sp-lb-spinner { position: absolute; width: 28px; height: 28px; border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }
.sp-lb-close {
  position: absolute;
  z-index: 3;
  top: calc(14px + env(safe-area-inset-top));
  inset-inline-end: 14px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: #ffffff;
  color: #141526;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.sp-lb-close:active { transform: scale(0.9); }
.sp-lb-close .sp-ico { width: 22px; height: 22px; stroke-width: 2.6; }
.sp-lb-counter {
  position: absolute;
  z-index: 3;
  top: calc(24px + env(safe-area-inset-top));
  inset-inline-start: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.sp-lb-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.sp-lb-nav:active { background: rgba(255, 255, 255, 0.35); }
.sp-lb-left { left: 10px; }
.sp-lb-right { right: 10px; }

/* ===== Pending-review posts ===== */
.sp-pending-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: -4px 0 12px; padding: 8px 12px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; font-weight: 700; }
.sp-pending-actions { display: inline-flex; gap: 6px; }
.sp-is-pending [data-like-post], .sp-is-pending [data-vote-post] { pointer-events: none; opacity: 0.45; }

/* ===== Hero readability + mobile header ===== */
.sp-hero h1, .sp-hero p { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.sp-topnav-mobile { display: none; }

@media (max-width: 768px) {
  .sp-topnav {
    background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 78%, #1e0536), var(--sp-primary));
    border-bottom: 0;
    box-shadow: 0 8px 20px -12px rgba(20, 21, 38, 0.55);
  }
  .sp-topnav .sp-brand { flex: 1; color: #ffffff; }
  .sp-topnav .sp-brand > span:last-child { max-width: 44vw; }
  .sp-topnav .sp-brand-mark { background: #ffffff; color: var(--sp-primary); width: 36px; height: 36px; }
  .sp-topnav-mobile { display: flex; align-items: center; gap: 6px; }
  .sp-m-btn {
    position: relative;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease, background-color 0.15s ease;
  }
  .sp-m-btn:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.28); }
  .sp-m-btn .sp-ico { width: 19px; height: 19px; }
  .sp-m-btn .sp-badge-count { position: absolute; top: -5px; inset-inline-end: -5px; }
  .sp-topnav .sp-btn-amber { width: 40px; min-height: 40px; padding: 0 !important; border-radius: 12px; justify-content: center; }

  .sp-subbar #sp-toggle-notifs,
  .sp-subbar #sp-open-messages,
  .sp-subbar .sp-icon-btn[data-nav="leaderboards"] { display: none; }
  .sp-subbar-inner { flex-wrap: wrap; }
  .sp-search-wrap { flex: 1 1 170px; order: 1; min-width: 0; }
  .sp-subbar-actions { flex: 0 1 auto; order: 2; min-width: 0; max-width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .sp-subbar-actions .sp-btn-primary, .sp-subbar-actions .sp-btn-secondary { white-space: nowrap; }
}

/* ===== No sideways scrolling (login / auth + whole shell) ===== */
.skoolpress-shell,
.sp-auth-gate-screen { overflow-x: clip; max-width: 100%; }
.sp-auth-card { isolation: isolate; min-width: 0; }
.sp-auth-aside { contain: paint; isolation: isolate; min-width: 0; }
.sp-auth-form-pane { min-width: 0; }
.sp-auth-form-pane form, .sp-auth-field, .sp-auth-field .sp-input { max-width: 100%; min-width: 0; }

@media (max-width: 768px) {
  .sp-auth-card { grid-template-columns: minmax(0, 1fr); border-radius: 16px; }
  .sp-auth-aside-glow { display: none; }
  .sp-auth-aside { padding: 20px 18px; gap: 14px; }
  .sp-auth-form-pane { padding: 22px 18px; }
  .sp-auth-gate-screen { padding: 12px; justify-content: flex-start; min-height: 100dvh; }
}

/* ===== Clear close button on the sign-in window ===== */
.sp-auth-close {
  top: 14px;
  inset-inline-end: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #141526;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(20, 21, 38, 0.35);
  z-index: 5;
  padding: 0;
  transition: transform 0.12s ease, background-color 0.15s ease;
}
.sp-auth-close .sp-ico { width: 20px; height: 20px; stroke-width: 2.6; }
.sp-auth-close:hover { background: #dc2626; color: #ffffff; transform: scale(1.06); }
.sp-auth-close:active { transform: scale(0.94); }
.sp-auth-form-pane:has(> .sp-auth-close) { padding-top: 64px; }

@media (max-width: 768px) {
  .sp-auth-form-pane { position: static; }
  .sp-auth-form-pane:has(> .sp-auth-close) { padding-top: 22px; }
  .sp-auth-close { background: #ffffff; color: #141526; border-color: rgba(255, 255, 255, 0.9); top: 12px; }
  .sp-auth-close:hover { background: #fee2e2; color: #b91c1c; }
}

/* ===== Animated badges: new / featured / admin / VIP ===== */
.sp-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  margin-inline-end: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
}
.sp-badge .sp-ico { width: 12px; height: 12px; }

.sp-badge-new { background: linear-gradient(135deg, #10b981, #059669); color: #ffffff; animation: sp-pulse-green 1.8s ease-in-out infinite; }
.sp-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: #ffffff; animation: sp-blink 1.1s ease-in-out infinite; }

.sp-badge-featured { background: linear-gradient(110deg, #f59e0b 20%, #fde68a 45%, #f59e0b 70%); background-size: 220% 100%; color: #4a2c00; animation: sp-shimmer 2.6s linear infinite; }
.sp-badge-featured .sp-ico { fill: currentColor; animation: sp-twinkle 1.6s ease-in-out infinite; }

.sp-badge-admin { background: linear-gradient(135deg, #5b21b6, #7c3aed); color: #ffffff; animation: sp-glow-purple 2.4s ease-in-out infinite; }

.sp-badge-vip { background: linear-gradient(135deg, #141526, #3b2a08); color: #fcd34d; border: 1px solid #fcd34d; }
.sp-badge-vip .sp-ico { animation: sp-twinkle 2s ease-in-out infinite; }
.sp-badge-vip::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%); transform: translateX(-130%); animation: sp-sheen 3s ease-in-out infinite; pointer-events: none; }

.sp-card.is-featured { border-color: #f59e0b; box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35), 0 12px 28px -16px rgba(245, 158, 11, 0.55); }

@keyframes sp-pulse-green { 0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); } 50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } }
@keyframes sp-blink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
@keyframes sp-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -120% 0; } }
@keyframes sp-twinkle { 0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; } 50% { transform: scale(1.25) rotate(12deg); opacity: 0.8; } }
@keyframes sp-glow-purple { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5); } 50% { box-shadow: 0 0 10px 2px rgba(124, 58, 237, 0.35); } }
@keyframes sp-sheen { 0% { transform: translateX(-130%); } 55%, 100% { transform: translateX(130%); } }

@media (prefers-reduced-motion: reduce) {
  .sp-badge, .sp-badge *, .sp-badge::after { animation: none !important; }
}

/* ===== Lesson page on phones: video first, lesson list below ===== */
@media (max-width: 860px) {
  .sp-lesson-player { order: -1; }
}

/* ===== Direct messages window ===== */
.sp-drawer.sp-dm { max-width: 640px; }
.sp-dm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 78%, #1e0536), var(--sp-primary));
  color: #ffffff;
}
.sp-dm-title { font-size: 16px; font-weight: 800; }
.sp-dm-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sp-dm-close .sp-ico { width: 18px; height: 18px; stroke-width: 2.6; }
.sp-dm-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sp-dm-list { overflow-y: auto; background: var(--sp-bg); border-inline-end: 1px solid var(--sp-border); }
.sp-dm-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--sp-border);
  background: transparent;
  cursor: pointer;
  text-align: start;
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.sp-dm-item:hover { background: rgba(0, 0, 0, 0.03); }
.sp-dm-item.is-active { background: var(--sp-surface); }
.sp-dm-item.is-active::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--sp-primary); }
.sp-dm-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sp-dm-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dm-last { font-size: 12px; color: var(--sp-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dm-last.is-unread { color: var(--sp-ink); font-weight: 700; }
.sp-dm-item .sp-badge-count { position: static; flex: none; }
.sp-dm-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--sp-bg); }
.sp-dm-chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--sp-surface); border-bottom: 1px solid var(--sp-border); }
.sp-dm-back {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--sp-border);
  background: var(--sp-bg);
  color: var(--sp-ink);
  font-size: 18px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.sp-dm-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.sp-msg { max-width: 80%; padding: 8px 13px 6px; border-radius: 16px; font-size: 14px; line-height: 1.55; word-break: break-word; }
.sp-msg-time { font-size: 10px; opacity: 0.7; margin-top: 2px; text-align: end; }
.sp-msg.is-mine { align-self: flex-end; background: var(--sp-primary); color: var(--sp-primary-fg); border-end-end-radius: 4px; }
.sp-msg.is-theirs { align-self: flex-start; background: var(--sp-surface); color: var(--sp-ink); border: 1px solid var(--sp-border); border-end-start-radius: 4px; }
.sp-dm-compose { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--sp-surface); border-top: 1px solid var(--sp-border); }
.sp-dm-compose .sp-input { border-radius: 999px; padding: 11px 16px; }
.sp-dm-send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--sp-primary);
  color: var(--sp-primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--sp-primary) 80%, #000);
  -webkit-tap-highlight-color: transparent;
}
.sp-dm-send:disabled { opacity: 0.55; }
.sp-dm-send .sp-ico { width: 18px; height: 18px; }
.sp-dm-empty { margin: auto; padding: 24px; text-align: center; color: var(--sp-muted); font-size: 13px; }

@media (max-width: 768px) {
  .sp-drawer.sp-dm { max-width: none; height: 100%; border: 0; }
  .sp-dm-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .sp-dm-body { grid-template-columns: minmax(0, 1fr); }
  .sp-dm-list { border-inline-end: 0; }
  .sp-dm-item { padding: 14px 16px; }
  .sp-dm:not(.is-chat) .sp-dm-item.is-active { background: transparent; }
  .sp-dm:not(.is-chat) .sp-dm-item.is-active::before { display: none; }
  .sp-dm-chat { display: none; }
  .sp-dm.is-chat .sp-dm-list { display: none; }
  .sp-dm.is-chat .sp-dm-chat { display: flex; }
  .sp-dm-back { display: flex; }
  .sp-dm-compose { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sp-msg { max-width: 86%; }
}

/* ===== Overlays stay below the WordPress toolbar when it is visible ===== */
body.admin-bar .sp-drawer-backdrop,
body.admin-bar .sp-backdrop,
body.admin-bar .sp-lightbox { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .sp-drawer-backdrop,
  body.admin-bar .sp-backdrop,
  body.admin-bar .sp-lightbox { top: 46px; }
}
