/* Live classroom service, notifications (header) + polls */

/* ========== Header notification bell ========== */
.notification-center-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-notification {
  position: relative;
  gap: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.btn-notification i {
  font-size: 1.25rem;
  line-height: 1;
}

.nc-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: var(--color-on-primary);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-header-bg);
  line-height: 1;
}

.nc-badge.hidden {
  display: none;
}

/* Preview dropdown, sits below any notification toast */
.nc-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.06);
  z-index: 1002;
  overflow: hidden;
}

.notification-center-wrap.has-active-toast .nc-dropdown:not(.hidden) {
  top: calc(100% + 72px);
}

.nc-dropdown.hidden {
  display: none;
}

/* Notification preview toast, anchored below bell, does not cover the button */
.notification-toast-container {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(340px, calc(100vw - 24px));
  pointer-events: none;
}

.notification-toast {
  pointer-events: auto;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.notification-toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.nc-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-background-alt);
}

.nc-dropdown-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.nc-dropdown-unread {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}

.nc-dropdown-list,
.nc-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 420px;
  overflow-y: auto;
}

.nc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
  transition: background 0.15s ease;
  cursor: pointer;
}

.nc-item:hover {
  background: var(--color-background-alt);
}

.nc-item-unread {
  background: var(--color-brand-hover-bg);
}

.nc-item-unread:hover {
  background: var(--color-selection-bg);
}

.nc-item-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.nc-item-body {
  flex: 1;
  min-width: 0;
}

.nc-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.nc-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
}

.nc-item-time {
  font-size: 0.75rem;
  color: var(--color-text-light);
  white-space: nowrap;
}

.nc-item-detail {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--color-text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nc-item-compact .nc-item-detail {
  -webkit-line-clamp: 2;
}

.nc-unread-dot {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

.nc-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.nc-dropdown-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  background: var(--color-background-alt);
}

.nc-see-all-btn {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: var(--color-selection-bg);
  color: var(--color-tool-accent);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.nc-see-all-btn:hover {
  background: var(--color-selection-bg);
}

/* ========== Full notifications modal ========== */
.nc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.nc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.nc-modal {
  position: relative;
  width: min(640px, 100%);
  max-height: min(85vh, 720px);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.nc-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
}

.nc-modal-close {
  background: var(--color-background-secondary);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nc-modal-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.nc-modal-toolbar {
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.nc-modal-summary {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.nc-modal-list {
  flex: 1;
  max-height: none;
}

.nc-modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-background-alt);
  text-align: center;
}

.nc-modal-footer .nc-load-more {
  min-width: 160px;
}

.nc-modal-footer .hidden {
  display: none;
}

/* ========== Student notifications (visual cards) ========== */
.notification-center-wrap.nc-student .nc-dropdown,
.nc-dropdown.nc-student-dropdown {
  width: min(420px, calc(100vw - 24px));
}

.notification-center-wrap.nc-student .nc-dropdown-list {
  max-height: min(480px, 58vh);
}

.nc-item-student.nc-item-unread {
  border-left: 3px solid var(--color-primary);
  padding-left: 13px;
}

.nc-item-student.nc-item-actionable:hover {
  background: var(--color-brand-hover-bg);
}

.nc-item-student .nc-item-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.nc-item-top--student {
  align-items: flex-start;
  margin-bottom: 2px;
}

.nc-item-top--student .nc-item-title {
  font-size: 0.95rem;
  line-height: 1.35;
  padding-right: 4px;
}

.nc-item-student .nc-item-detail {
  margin-top: 2px;
  -webkit-line-clamp: 2;
}

.nc-item-student .nc-visual-chips {
  margin: 4px 0 2px;
}

.nc-item-student.nc-item-actionable .nc-item-detail {
  margin-bottom: 2px;
}

.nc-item-icon--restore {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.nc-item-icon--combat {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
}

.nc-item-icon--reward {
  background: linear-gradient(135deg, #f59e0b 0%, #eab308 100%);
}

.nc-item-icon--curse {
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
}

.nc-item-icon--quest {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
}

.nc-item-icon--inspiration {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.nc-item-icon--spell {
  background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
}

.nc-item-icon--encounter {
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}

.nc-item-icon--character {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.nc-cat-badge--combat {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.nc-cat-badge--reward {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.nc-cat-badge--curse {
  color: #6d28d9;
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.nc-cat-badge--quest {
  color: #0369a1;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.nc-cat-badge--inspiration {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.nc-cat-badge--spell {
  color: #be185d;
  background: #fdf2f8;
  border-color: #fbcfe8;
}

.nc-cat-badge--encounter {
  color: #c2410c;
  background: #fff7ed;
  border-color: #fed7aa;
}

.nc-cat-badge--character {
  color: #4338ca;
  background: #eef2ff;
  border-color: #c7d2fe;
}

.nc-visual-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 4px;
}

.nc-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
}

.nc-stat-chip i {
  font-size: 0.7rem;
  opacity: 0.9;
}

.nc-stat-chip--hp {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.nc-stat-chip--mp {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.nc-stat-chip--xp {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.nc-stat-chip--gp {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.nc-stat-chip--positive {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.nc-stat-chip--negative {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.nc-stat-chip--curse {
  color: #6d28d9;
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.nc-stat-chip--quest {
  color: #0369a1;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.nc-stat-chip--target {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.nc-stat-chip--inspiration {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.nc-stat-chip--award {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.nc-stat-chip--reward {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.nc-stat-chip--damage {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.nc-stat-chip--campaign {
  color: #0369a1;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.nc-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-tool-accent);
  background: var(--color-selection-bg);
  border: 1px solid var(--color-accent-chip-border);
}

.nc-action-pill--combat {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.nc-action-pill--quest {
  color: #0369a1;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.nc-empty-student {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 2.5rem 1.5rem;
}

.nc-empty-student i {
  font-size: 2rem;
  color: var(--color-text-light);
  opacity: 0.55;
}

.nc-empty-student p {
  margin: 0;
  max-width: 260px;
  line-height: 1.45;
}

.nc-modal-overlay.nc-student-overlay .nc-modal.nc-modal-student {
  width: min(680px, 100%);
}

.nc-modal-list.nc-student-list .nc-item-student {
  padding: 14px 18px;
}

.nc-modal-list.nc-student-list .nc-item-student .nc-item-detail {
  -webkit-line-clamp: 3;
}

.notification-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.notification-toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.9rem;
}

.notification-toast-text {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.notification-toast--combat {
  background: linear-gradient(135deg, #7f1d1d 0%, #9a3412 100%);
}

.notification-toast--reward {
  background: linear-gradient(135deg, #78350f 0%, #854d0e 100%);
}

.notification-toast--curse {
  background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
}

.notification-toast--quest {
  background: linear-gradient(135deg, #0c4a6e 0%, #155e75 100%);
}

.notification-toast--inspiration {
  background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
}

.notification-toast--spell {
  background: linear-gradient(135deg, #831843 0%, #6b21a8 100%);
}

.notification-toast--encounter {
  background: linear-gradient(135deg, #7c2d12 0%, #9a3412 100%);
}

.notification-toast--character {
  background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
}

.notification-toast--restore {
  background: linear-gradient(135deg, #78350f 0%, #b45309 100%);
}

/* ========== Live polls ========== */
.live-poll-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: live-poll-overlay-in 0.25s ease;
}

.live-poll-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
}

.live-poll-panel {
  position: relative;
  width: min(980px, 100%);
  max-height: 92dvh;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    var(--color-modal-shell-start) 0%,
    var(--color-surface) 42%,
    var(--color-modal-shell-end) 100%
  );
  color: var(--color-text);
  box-shadow:
    0 28px 64px rgba(124, 115, 255, 0.22),
    0 12px 32px rgba(0, 0, 0, 0.14);
  border: 2px solid var(--color-modal-shell-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: live-poll-panel-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.live-poll-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-header);
}

.live-poll-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem 0.75rem;
}

.live-poll-header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.live-poll-header-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: var(--color-on-primary);
  font-size: 1.15rem;
  box-shadow: 0 6px 16px rgba(124, 115, 255, 0.35);
  animation: live-poll-wiggle 3s ease-in-out infinite;
}

.live-poll-header-sub {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.live-poll-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0 1.35rem 0;
}

.live-poll-tab {
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.live-poll-tab:hover {
  color: var(--color-tool-accent);
  background: var(--color-brand-hover-bg);
}

.live-poll-tab--active {
  color: var(--color-tool-accent);
  background: rgba(124, 115, 255, 0.08);
  border-bottom-color: var(--color-primary);
}

.live-poll-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
}

.live-poll-close {
  background: var(--color-surface);
  border: 2px solid var(--color-modal-shell-border);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.live-poll-close:hover {
  background: var(--color-primary);
  color: var(--color-on-primary);
  transform: scale(1.04);
}

.live-poll-body {
  padding: 1.1rem 1.35rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.live-poll-body--columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 0 1.75rem;
  align-items: start;
}

.live-poll-body--setup-only {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
  margin: 0;
}

.live-poll-panel--setup-only {
  width: min(920px, 100%);
}

.live-poll-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.live-poll-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.live-poll-col--setup {
  padding-right: 0.25rem;
}

.live-poll-col--live {
  padding-left: 1.35rem;
  border-left: 2px dashed rgba(124, 115, 255, 0.22);
  min-height: 0;
}

#live-poll-live-col.hidden {
  display: none !important;
}

.live-poll-col--history {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 320px;
  max-height: min(62vh, 520px);
}

.live-poll-history-heading {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.live-poll-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.25rem;
}

.live-poll-history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.live-poll-history-item:hover {
  border-color: var(--color-primary-light);
  box-shadow: 0 4px 14px rgba(124, 115, 255, 0.16);
  transform: translateY(-1px);
}

.live-poll-history-item--selected {
  border-color: var(--color-primary);
  background: var(--color-selection-hover);
  box-shadow: 0 0 0 3px var(--color-selection-muted);
}

.live-poll-history-item-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(124, 115, 255, 0.12);
  color: var(--color-primary);
  font-size: 0.95rem;
}

.live-poll-history-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.live-poll-history-item-q {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.live-poll-history-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.live-poll-history-votes {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.live-poll-history-item-date {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.live-poll-history-status {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-poll-history-status--active {
  background: var(--color-tool-status-success-bg);
  color: var(--color-tool-status-success);
}

.live-poll-history-status--ended {
  background: rgba(107, 114, 128, 0.15);
  color: var(--color-text-secondary);
}

.live-poll-history-status--draft {
  background: var(--color-warning-banner-bg);
  color: var(--color-warning-banner-text);
}

.live-poll-history-empty,
.live-poll-history-hint,
.live-poll-history-loading,
.live-poll-history-error {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  padding: 1rem;
  text-align: center;
  border-radius: 12px;
  background: rgba(124, 115, 255, 0.06);
  border: 1px dashed rgba(124, 115, 255, 0.25);
}

.live-poll-history-error {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.25);
}

#live-poll-view-history.hidden {
  display: none;
}

#live-poll-view-live.hidden {
  display: none;
}

@media (max-width: 768px) {
  .live-poll-body--columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .live-poll-col--live {
    padding-left: 0;
    border-left: none;
    padding-top: 1rem;
    border-top: 2px dashed rgba(124, 115, 255, 0.22);
    min-height: 0;
  }

  .live-poll-setup-grid {
    grid-template-columns: 1fr;
  }

  .live-poll-setup-sidebar {
    order: 2;
  }
}

.live-poll-setup {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.live-poll-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.live-poll-setup-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.live-poll-setup-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(124, 115, 255, 0.05);
  border: 1px solid rgba(124, 115, 255, 0.16);
}

.live-poll-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.live-poll-field--question input[type='text'] {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.75rem 0.9rem;
}

.live-poll-field--options textarea {
  min-height: 9.5rem;
  resize: vertical;
  line-height: 1.45;
}

.live-poll-field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}

.live-poll-field-label i {
  color: var(--color-primary);
  font-size: 0.9rem;
}

.live-poll-field-hint {
  font-size: 0.78rem;
  color: var(--color-text-light);
  line-height: 1.35;
}

.live-poll-body input[type='text'],
.live-poll-body textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 2px solid var(--color-input-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.live-poll-body input[type='text']:focus,
.live-poll-body textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 115, 255, 0.18);
}

.live-poll-checkbox {
  flex-direction: row !important;
  align-items: stretch;
  gap: 0 !important;
  cursor: pointer;
}

.live-poll-settings {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
}

.live-poll-settings-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}

.live-poll-setting-card {
  margin: 0;
}

.live-poll-setting-card-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.live-poll-setting-icon {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(124, 115, 255, 0.1);
  color: var(--color-primary);
  font-size: 0.78rem;
}

.live-poll-setting-text {
  flex: 1;
  line-height: 1.3;
}

.live-poll-setting-card-body i {
  color: var(--color-primary);
  width: 1rem;
  text-align: center;
}

.live-poll-setting-card:has(input:checked) .live-poll-setting-card-body {
  border-color: var(--color-primary);
  background: rgba(124, 115, 255, 0.1);
  box-shadow: 0 0 0 2px rgba(124, 115, 255, 0.12);
}

.live-poll-setting-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.live-poll-setup--disabled {
  opacity: 0.72;
  pointer-events: none;
}

.live-poll-timer-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.live-poll-timer-seconds-wrap {
  padding-left: 0.35rem;
}

.live-poll-timer-seconds-wrap.hidden {
  display: none;
}

.live-poll-timer-seconds-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.live-poll-timer-input {
  width: 72px;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 2px solid var(--color-input-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  font-family: inherit;
  font-weight: 700;
}

.live-poll-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.live-poll-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(124, 115, 255, 0.35);
}

.live-poll-start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(124, 115, 255, 0.42);
}

.live-poll-live-active {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.live-poll-live-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.live-poll-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.live-poll-live-badge--waiting {
  background: rgba(107, 114, 128, 0.12);
  color: var(--color-text-secondary);
}

.live-poll-live-badge--live {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  animation: live-poll-badge-pulse 1.8s ease-in-out infinite;
}

.live-poll-live-badge--live::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: live-poll-dot-pulse 1.8s ease-in-out infinite;
}

.live-poll-live-badge--ended {
  background: rgba(124, 115, 255, 0.12);
  color: var(--color-primary);
}

@keyframes live-poll-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  50% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); }
}

@keyframes live-poll-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.live-poll-timer-ring {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0;
}

.live-poll-timer-ring-track {
  position: relative;
  width: 5.5rem;
  height: 5.5rem;
  --timer-pct: 100;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary) calc(var(--timer-pct, 100) * 1%),
    rgba(124, 115, 255, 0.15) 0
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(124, 115, 255, 0.2);
}

.live-poll-timer-ring-track::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--color-surface);
}

.live-poll-timer-ring-text {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-primary);
  text-align: center;
  line-height: 1.25;
  padding: 0 0.35rem;
}

.live-poll-timer-ring--urgent .live-poll-timer-ring-track {
  background: conic-gradient(
    #ef4444 calc(var(--timer-pct, 100) * 1%),
    rgba(239, 68, 68, 0.15) 0
  );
  animation: live-poll-timer-shake 0.5s ease-in-out infinite;
}

.live-poll-timer-ring--urgent .live-poll-timer-ring-text {
  color: #dc2626;
}

@keyframes live-poll-timer-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

.live-poll-timer-display--hidden {
  display: none;
}

.live-poll-run-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.live-poll-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  background: var(--color-surface);
  color: #dc2626;
  border: 2px solid rgba(220, 38, 38, 0.45);
}

.live-poll-end-btn:hover:not(:disabled) {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.live-poll-participation {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.live-poll-participation-card {
  padding: 1rem;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid rgba(124, 115, 255, 0.18);
  box-shadow: 0 4px 14px rgba(124, 115, 255, 0.08);
}

.live-poll-participation-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.live-poll-progress-ring {
  flex-shrink: 0;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary) calc(var(--progress, 0) * 1%),
    rgba(124, 115, 255, 0.12) 0
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.live-poll-progress-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--color-surface);
}

.live-poll-progress-value {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.live-poll-progress-sep {
  opacity: 0.45;
  font-weight: 600;
}

.live-poll-participation-intro {
  min-width: 0;
}

.live-poll-participation-heading {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 800;
}

.live-poll-participation-summary {
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.live-poll-participation-pct {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
}

.live-poll-participation-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.live-poll-participation-col {
  padding: 0.65rem;
  border-radius: 10px;
  background: rgba(124, 115, 255, 0.04);
  border: 1px solid rgba(124, 115, 255, 0.12);
}

.live-poll-participation-col--voted h5 {
  color: #059669;
}

.live-poll-participation-col--waiting h5 {
  color: #d97706;
}

.live-poll-participation-col h5 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.live-poll-participation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.85rem;
}

.live-poll-participation-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(124, 115, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
}

.live-poll-participation-name {
  font-weight: 700;
  color: var(--color-text);
}

.live-poll-participation-choice {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.live-poll-participation-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-style: italic;
}

.live-poll-results {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.live-poll-results-card {
  padding: 1rem;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid rgba(124, 115, 255, 0.18);
  box-shadow: 0 4px 14px rgba(124, 115, 255, 0.08);
}

.live-poll-results-head h3 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.35;
}

.live-poll-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.live-poll-stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(124, 115, 255, 0.1);
  color: var(--color-primary);
}

.live-poll-stat-pill--active {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.live-poll-stat-pill--ended {
  background: rgba(107, 114, 128, 0.12);
  color: var(--color-text-secondary);
}

.live-poll-stat-pill--draft {
  background: var(--color-warning-banner-bg);
  color: var(--color-warning-banner-text);
}

.live-poll-stat-pill--muted {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.live-poll-results-charts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.live-poll-meta {
  margin: 0 0 0.75rem;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.live-poll-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.live-poll-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2fr auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.88rem;
}

.live-poll-bar-label {
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-poll-bar-track {
  height: 12px;
  background: rgba(124, 115, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.live-poll-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
  min-width: 0;
}

.live-poll-bar-count {
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  min-width: 1.5rem;
  text-align: right;
}

.live-poll-student-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: live-poll-overlay-in 0.25s ease;
}

@keyframes live-poll-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.live-poll-student-panel {
  width: min(480px, 100%);
  background: linear-gradient(
    180deg,
    var(--color-surface) 0%,
    var(--color-modal-shell-start) 100%
  );
  color: var(--color-text);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: 0 24px 60px rgba(124, 115, 255, 0.25), 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(124, 115, 255, 0.35);
  animation: live-poll-panel-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes live-poll-panel-pop {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.live-poll-student-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.live-poll-student-header-icon {
  font-size: 1.5rem;
  line-height: 1;
  animation: live-poll-wiggle 2.5s ease-in-out infinite;
}

@keyframes live-poll-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.live-poll-student-panel h2 {
  margin: 0;
  flex: 1;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-tool-accent);
}

.live-poll-student-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(124, 115, 255, 0.12);
  color: var(--color-tool-accent);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.live-poll-student-close:hover {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.live-poll-student-q {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--color-text);
  padding: 0.75rem 0.85rem;
  background: rgba(124, 115, 255, 0.08);
  border-radius: 10px;
  border-left: 4px solid var(--color-primary);
}

.live-poll-student-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.live-poll-student-panel .live-poll-answer-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--option-color, var(--color-primary));
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.live-poll-student-panel .live-poll-answer-btn:hover {
  transform: translateY(-2px) scale(1.01);
  background: var(--option-color, var(--color-primary));
  color: var(--color-on-primary);
  box-shadow: 0 6px 16px rgba(124, 115, 255, 0.35);
}

.live-poll-student-panel .live-poll-answer-btn:hover .live-poll-answer-letter {
  background: rgba(255, 255, 255, 0.25);
  color: var(--color-on-primary);
}

.live-poll-answer-letter {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--option-color, var(--color-primary));
  color: var(--color-on-primary);
  font-size: 0.85rem;
  font-weight: 800;
}

.live-poll-answer-text {
  flex: 1;
  line-height: 1.35;
}

.live-poll-submitted-celebrate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.25rem 0.75rem;
  text-align: center;
  animation: live-poll-panel-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.live-poll-submitted-icon {
  width: 3.25rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.live-poll-submitted-msg {
  text-align: center;
  color: var(--color-tool-accent);
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0;
  padding: 0;
}

.live-poll-submitted-thanks {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.live-poll-student-results {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 2px dashed rgba(124, 115, 255, 0.35);
}

.live-poll-student-results.hidden {
  display: none;
}

.live-poll-student-results-heading {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-tool-accent);
}

.live-poll-student-ended {
  margin: 0.75rem 0 0;
  text-align: center;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.live-poll-student-ended.hidden {
  display: none;
}

/* Pie chart, teacher + student */
.live-poll-pie-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  justify-content: center;
}

.live-poll-pie-wrap--teacher {
  margin-top: 0.25rem;
}

.live-poll-pie-ring {
  flex-shrink: 0;
  padding: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C73FF, #FF6B6B, #10b981, #f59e0b);
  animation: live-poll-ring-spin 8s linear infinite;
}

@keyframes live-poll-ring-spin {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}

.live-poll-pie-chart {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.live-poll-pie-chart--pop {
  animation: live-poll-pie-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes live-poll-pie-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.live-poll-pie-wrap--student .live-poll-pie-chart {
  width: 132px;
  height: 132px;
}

.live-poll-pie-hole {
  width: 58%;
  height: 58%;
  border-radius: 50%;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.live-poll-pie-total {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-tool-accent);
  line-height: 1.1;
}

.live-poll-pie-total-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.live-poll-pie-empty-label {
  font-size: 0.65rem;
  text-align: center;
  color: var(--color-text-light);
  padding: 0 0.35rem;
  line-height: 1.3;
}

.live-poll-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 160px;
}

.live-poll-pie-legend-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
  color: var(--color-text);
}

.live-poll-pie-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--slice-color, var(--color-primary));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.live-poll-pie-legend-label {
  font-weight: 600;
  color: var(--color-text);
}

.live-poll-pie-legend-stats {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.live-poll-pie-legend-stats strong {
  color: var(--color-tool-accent);
}

.live-poll-pie-pct {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* Header rejoin button, student dashboard */
.live-poll-rejoin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: var(--color-on-primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124, 115, 255, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.live-poll-rejoin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 115, 255, 0.55);
}

.live-poll-rejoin-btn.hidden {
  display: none;
}

.live-poll-rejoin-btn--pulse {
  animation: live-poll-rejoin-pulse 1.6s ease-in-out infinite;
}

@keyframes live-poll-rejoin-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(124, 115, 255, 0.45); }
  50% { box-shadow: 0 4px 22px rgba(255, 107, 107, 0.65), 0 0 0 4px rgba(124, 115, 255, 0.2); }
}

.live-poll-rejoin-btn i {
  font-size: 1rem;
}

@media (max-width: 640px) {
  .live-poll-rejoin-label {
    display: none;
  }

  .live-poll-rejoin-btn {
    padding: 0.5rem 0.65rem;
  }
}

/* Teacher notification filters + reverse, large panel for busy classrooms */
.notification-center-wrap.nc-teacher .nc-dropdown,
.nc-dropdown.nc-teacher-dropdown {
  width: min(520px, calc(100vw - 24px));
}

.notification-center-wrap.nc-teacher .nc-dropdown-list {
  max-height: min(560px, 60vh);
}

.notification-center-wrap.nc-teacher .nc-item-compact {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  cursor: default;
}

.notification-center-wrap.nc-teacher .nc-item-compact .nc-item-detail {
  -webkit-line-clamp: 3;
}

.nc-modal-overlay.nc-teacher-overlay {
  padding: 10px;
  align-items: stretch;
  justify-content: center;
}

.nc-modal.nc-modal-teacher {
  width: min(1180px, 98vw);
  height: min(94vh, 960px);
  max-height: 94dvh;
}

.nc-modal-teacher .nc-modal-header {
  padding: 18px 24px;
  flex-shrink: 0;
}

.nc-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.nc-modal-subtitle {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.nc-modal-teacher .nc-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  flex-shrink: 0;
}

.nc-modal-unread-pill {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-tool-accent);
  background: var(--color-selection-bg);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.nc-modal-list.nc-teacher-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--color-background-alt);
}

.nc-item-teacher {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(140px, auto);
  align-items: start;
  gap: 16px;
  padding: 16px 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  cursor: default;
}

.nc-item-teacher:hover {
  background: var(--color-background-alt);
}

.nc-item-teacher.nc-item-unread {
  background: var(--color-brand-hover-bg);
  border-left: 3px solid var(--color-primary);
  padding-left: 21px;
}

.nc-item-teacher.nc-item-unread:hover {
  background: var(--color-selection-bg);
}

.nc-item-icon-lg {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.nc-item-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.nc-item-teacher .nc-item-title {
  font-size: 1rem;
}

.nc-item-student {
  margin: 2px 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
}

.nc-item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nc-item-detail-line {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--color-text-light);
}

.nc-item-teacher .nc-item-detail {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
}

.nc-item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding-top: 4px;
  min-width: 140px;
}

.nc-item-actions-compact {
  min-width: auto;
  padding-top: 0;
  align-self: center;
}

.nc-item-actions-compact .nc-reverse-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nc-item-actions .nc-reverse-btn {
  margin-top: 0;
  width: 100%;
  min-height: 40px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--color-danger);
  background: var(--color-surface);
  color: var(--color-danger);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nc-item-actions .nc-mark-read-btn,
.nc-item-actions .nc-mark-unread-btn {
  white-space: nowrap;
}

.nc-item-actions .nc-mark-read-btn {
  color: var(--color-success, #16a34a);
  border-color: color-mix(in srgb, var(--color-success, #16a34a) 35%, transparent);
}

.nc-item-actions .nc-mark-unread-btn {
  color: var(--color-primary);
}

.nc-item-actions-compact .nc-mark-read-btn,
.nc-item-actions-compact .nc-mark-unread-btn {
  min-width: 2rem;
  padding-inline: 0.45rem;
}
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--color-danger-dark);
}

.nc-item-actions .nc-reverse-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.nc-action-placeholder {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-warning-banner-text);
  text-align: center;
  padding: 10px 8px;
}

.nc-modal-wide {
  max-width: 640px;
}

.nc-modal-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-background-alt);
  flex-shrink: 0;
}

.nc-modal-teacher .nc-modal-filters {
  padding: 14px 24px;
}

.nc-modal-teacher .nc-modal-footer {
  flex-shrink: 0;
  padding: 14px 24px 18px;
}

.nc-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nc-filter-chip {
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nc-filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-tool-accent);
}

.nc-filter-chip.active {
  background: var(--color-selection-bg);
  border-color: var(--color-primary);
  color: var(--color-tool-accent);
}

.nc-item-teacher.nc-item-read {
  background: var(--color-surface);
  border-left: 3px solid var(--color-border);
  padding-left: 21px;
}

.nc-item-teacher.nc-item-read:hover {
  background: var(--color-background-alt);
}

.nc-read-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent-chip-text);
  background: var(--color-accent-chip-bg);
  border: 1px solid var(--color-accent-chip-border);
  padding: 2px 7px;
  border-radius: 4px;
}

.nc-filter-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.nc-hide-read-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nc-filter-student {
  margin-left: 0;
}

.nc-student-select {
  padding: 8px 12px;
  border: 1px solid var(--color-input-border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--color-input-bg);
  color: var(--color-input-text);
  min-width: 180px;
}

.nc-cat-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-accent-chip-text);
  background: var(--color-accent-chip-bg);
  border: 1px solid var(--color-accent-chip-border);
  padding: 2px 6px;
  border-radius: 4px;
}

.nc-reverse-btn {
  margin-top: 8px;
  font-size: 0.8rem;
}

.nc-item-reversed {
  opacity: 0.78;
}

.nc-reversed-label {
  margin: 8px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-warning-banner-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 720px) {
  .nc-modal.nc-modal-teacher {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .nc-modal-overlay.nc-teacher-overlay {
    padding: 0;
  }

  .nc-item-teacher {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .nc-item-actions {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .nc-item-actions .nc-reverse-btn {
    width: 100%;
  }
}

/* ========== Notifications - mobile ========== */
@media (max-width: 768px) {
  /* Bottom sheet so the preview panel stays within the viewport */
  .nc-dropdown {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: min(85dvh, 640px);
    border-radius: 16px 16px 0 0;
    z-index: 12001;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
  }

  .notification-center-wrap.has-active-toast .nc-dropdown:not(.hidden) {
    top: auto;
  }

  .notification-center-wrap.nc-student .nc-dropdown,
  .nc-dropdown.nc-student-dropdown,
  .notification-center-wrap.nc-teacher .nc-dropdown,
  .nc-dropdown.nc-teacher-dropdown {
    width: 100%;
  }

  .nc-dropdown-list,
  .notification-center-wrap.nc-student .nc-dropdown-list,
  .notification-center-wrap.nc-teacher .nc-dropdown-list {
    max-height: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nc-dropdown-header {
    padding: 14px 16px;
    flex-shrink: 0;
  }

  .nc-dropdown-footer {
    flex-shrink: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .notification-toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 12px;
    right: 12px;
    width: auto;
    align-items: stretch;
    z-index: 12000;
  }

  .notification-toast {
    width: 100%;
  }

  .nc-item-top--student {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .nc-item-top--student .nc-item-time {
    white-space: normal;
  }

  .nc-item-student .nc-item-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Student full-history modal */
  .nc-modal-overlay.nc-student-overlay {
    padding: 0;
    align-items: stretch;
  }

  .nc-modal-overlay.nc-student-overlay .nc-modal.nc-modal-student {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .nc-modal-overlay.nc-student-overlay .nc-modal-header,
  .nc-modal-overlay.nc-student-overlay .nc-modal-toolbar,
  .nc-modal-overlay.nc-student-overlay .nc-modal-footer {
    flex-shrink: 0;
  }

  .nc-modal-overlay.nc-student-overlay .nc-modal-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nc-modal-list.nc-student-list .nc-item-student {
    padding: 12px 14px;
  }

  /* Teacher activity panel filters + toolbar */
  .nc-modal-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px;
  }

  .nc-modal-teacher .nc-modal-filters {
    padding: 12px 16px;
  }

  .nc-filter-actions {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .nc-student-select {
    min-width: 0;
    width: 100%;
  }

  .nc-modal-teacher .nc-modal-header {
    padding: 14px 16px;
  }

  .nc-modal-teacher .nc-modal-toolbar {
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nc-modal-teacher .nc-modal-footer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .nc-item-teacher {
    padding: 12px 16px;
    gap: 12px;
  }

  .notification-center-wrap.nc-teacher .nc-item-compact {
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .notification-center-wrap.nc-teacher .nc-item-actions-compact {
    grid-column: 1 / -1;
    align-self: stretch;
  }
}

/* Pinned paused combat in teacher notifications */
.nc-item-pinned.nc-item-paused-combat {
  background: var(--color-warning-banner-bg);
  border-bottom: 2px solid var(--color-warning-banner-border);
  cursor: pointer;
}

.nc-item-pinned.nc-item-paused-combat:hover {
  background: var(--color-warning-banner-bg);
  filter: brightness(1.08);
}

.nc-item-detail-sub {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* Teacher paused combat manager */
.pct-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pct-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.pct-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  overflow: auto;
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

.pct-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.pct-header h2 {
  margin: 0;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pct-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.pct-body {
  padding: 16px 20px 20px;
}

.pct-summary p {
  margin: 0 0 8px;
  color: var(--color-text);
}

.pct-expires,
.pct-hint,
.pct-empty,
.pct-loading {
  color: var(--color-text-secondary);
  font-size: 0.92rem;
}

.pct-section {
  margin-top: 16px;
}

.pct-section h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--color-text);
}

.pct-target-list,
.pct-defense-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pct-target-row,
.pct-defense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.pct-target-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.pct-target-status--defended {
  background: #dcfce7;
  color: #166534;
}

.pct-target-status--pending {
  background: #fef3c7;
  color: #92400e;
}

.pct-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
