/* ========== CLASSROOM INTERFACE ========== */

.classroom-container {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--color-page-bg);
  overflow: hidden;
}

/* ========== LEFT COLUMN: MENU ========== */
.classroom-menu {
  background: var(--color-surface);
  border-right: 2px solid var(--color-border);
  overflow-y: auto;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.classroom-menu.expanded {
  width: 280px;
}

.classroom-menu.collapsed {
  width: 52px;
  min-width: 52px;
  border-right: 2px solid var(--color-border);
  overflow-x: hidden;
  overflow-y: auto;
}

.classroom-menu.collapsed .menu-header {
  width: 100%;
  height: 52px;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.classroom-menu.collapsed .menu-header h3 {
  display: none;
}

.classroom-menu.collapsed .menu-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}

.classroom-menu.collapsed .menu-toggle-btn:hover {
  transform: scale(1.05);
}

.classroom-menu.collapsed .menu-content {
  display: flex;
  flex-direction: column;
  padding: 6px 0 10px;
  gap: 0;
}

.classroom-menu.collapsed .menu-section-title {
  display: none;
}

.classroom-menu.collapsed .menu-section + .menu-section {
  border-top: 1px solid #ececf3;
  margin-top: 6px;
  padding-top: 6px;
}

.classroom-menu.collapsed .menu-item {
  padding: 11px 0;
  justify-content: center;
  gap: 0;
}

.classroom-menu.collapsed .menu-item .menu-item-label {
  display: none;
}

.classroom-menu.collapsed .menu-item i {
  width: auto;
  font-size: 17px;
}

.classroom-menu.collapsed .menu-unread-badge {
  position: absolute;
  top: 5px;
  right: 7px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  border-width: 1px;
}

.classroom-menu.collapsed .menu-item:hover {
  padding-left: 0;
  background: var(--color-brand-hover-bg);
  color: var(--color-primary);
}

.classroom-menu.collapsed .menu-item:active {
  background: #ebe9ff;
}

.menu-help-tooltip {
  position: fixed;
  z-index: calc(var(--z-tooltip, 1070) + 2);
  width: min(300px, calc(100vw - 24px));
  padding: 12px 14px;
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 100%);
  color: #f8fafc;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-8px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.menu-help-tooltip::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 6px 6px 0;
  border-style: solid;
  border-color: transparent #312e81 transparent transparent;
}

.menu-help-tooltip--left::before {
  left: auto;
  right: -6px;
  border-width: 6px 0 6px 6px;
  border-color: transparent transparent transparent #312e81;
}

.menu-help-tooltip--visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.menu-help-tooltip__title {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
  color: #fde68a;
  margin-bottom: 6px;
}

.menu-help-tooltip__body {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.92);
}

.menu-help-tooltip__body[hidden] {
  display: none;
}

.menu-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--color-border);
  background: linear-gradient(135deg, #7C73FF 0%, #667eea 100%);
  color: white;
  flex-shrink: 0;
}

.menu-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.menu-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 16px;
}

.menu-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.menu-content {
  flex: 1;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-section[hidden],
.classroom-menu .menu-item[hidden] {
  display: none !important;
}

.menu-section {
  padding: 0;
}

.menu-section-title {
  padding: 6px 20px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-item {
  background: none;
  border: none;
  padding: 8px 20px;
  text-align: left;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  position: relative;
}

.menu-item i {
  width: 18px;
  color: #7C73FF;
  flex-shrink: 0;
}

.menu-item-label {
  flex: 1;
  min-width: 0;
}

.menu-unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  border: 2px solid var(--color-surface);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.menu-unread-badge.hidden {
  display: none;
}

.menu-item:hover {
  background: var(--color-page-bg);
  color: #7C73FF;
  padding-left: 24px;
}

.menu-item:active {
  background: #efefef;
}

/* ========== MIDDLE COLUMN: STUDENT LIST ========== */
.classroom-student-list {
  width: 280px;
  background: var(--color-surface);
  border-right: 2px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: visible;
}

.student-list-header {
  padding: 20px;
  border-bottom: 2px solid var(--color-border);
  flex-shrink: 0;
  position: relative;
}

.student-list-header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.classroom-mobile-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.classroom-mobile-menu-btn:hover {
  background: var(--color-selection-hover);
  border-color: var(--color-primary);
}

.classroom-mobile-menu-btn i {
  font-size: 1rem;
}

.classroom-menu-backdrop {
  display: none;
}

body.classroom-mobile-menu-open {
  overflow: hidden;
}

.student-list-header h3 {
  flex: 1;
  min-width: 0;
}

.student-list-controls {
  display: flex;
  gap: 10px;
}

.student-search {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Open Sans', sans-serif;
  transition: border-color 0.2s ease;
}

.student-search:focus {
  outline: none;
  border-color: #7C73FF;
}

.filter-sort-toggle {
  padding: 8px 12px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  color: #7C73FF;
  font-size: 14px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.filter-sort-toggle:hover {
  border-color: var(--color-primary);
  background: var(--color-selection-hover);
}

.student-view-toggle-group {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.student-view-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-toolbar-btn-icon);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.student-view-toggle + .student-view-toggle {
  border-left: none;
}

.student-view-toggle:hover:not(.active) {
  background: var(--color-toolbar-btn-hover-bg);
  color: var(--color-toolbar-btn-icon);
}

.student-view-toggle.active {
  background: var(--color-toolbar-btn-active-bg);
  color: var(--color-toolbar-btn-active-icon);
}

/* Card roster view */
.classroom-container--student-cards .classroom-student-list {
  flex: 1;
  width: auto;
  min-width: 0;
  max-width: none;
}

.classroom-container--student-cards .classroom-student-display {
  display: none;
}

/* Roster tabs (Students / Teams) in list panel */
.roster-tab-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.roster-tab {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-toolbar-btn-icon);
  font-family: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.roster-tab:hover:not(.active) {
  background: var(--color-toolbar-btn-hover-bg);
  color: var(--color-toolbar-btn-icon);
}

.roster-tab.active {
  background: var(--color-toolbar-btn-active-bg);
  color: var(--color-toolbar-btn-active-icon);
}

/* Team roster list mode - showcase panel visible beside team list */
.classroom-container--team-view:not(.classroom-container--student-cards) .classroom-student-display {
  display: flex;
  min-width: 0;
  min-height: 0;
}

#student-list-content.student-list-content--teams {
  padding: 8px 0;
}

.team-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.2s ease;
}

.team-list-item:hover {
  background: var(--color-selection-hover);
}

.team-list-item.active {
  background: var(--color-selection-bg);
  box-shadow: inset 3px 0 0 var(--team-accent, var(--color-primary));
}

.team-list-item-emblem {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
}

.team-list-item-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

.team-list-item-emblem-fallback {
  font-size: 1.35rem;
  color: var(--team-accent, var(--color-primary));
  opacity: 0.85;
}

.team-list-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-list-item-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
}

.team-list-item-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.team-list-item-avatars {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.team-list-item-mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C73FF 0%, #667eea 100%);
  background-size: cover;
  background-position: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.team-list-item-mini-more {
  font-size: 11px;
  color: var(--color-text-secondary);
  padding-left: 2px;
}

.character-container:has(.team-showcase-display) {
  align-items: stretch;
  justify-content: stretch;
}

/* Team showcase - full-bleed background + hero cards */
.team-showcase-display {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: auto;
  box-sizing: border-box;
}

.team-showcase-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: url('../images/main/teams.webp') center center / 100% 100% no-repeat;
  z-index: 0;
  pointer-events: none;
}

.team-showcase-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  min-height: 100%;
  padding: 16px 20px 120px;
  box-sizing: border-box;
}

.team-showcase-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  min-height: 0;
}

.team-showcase-banner-emblem,
.team-showcase-banner-text {
  position: relative;
  z-index: 1;
}

.team-showcase-banner-emblem {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.team-showcase-banner-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.22));
}

.team-showcase-banner-text {
  min-width: 0;
}

.team-showcase-banner-name {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.team-showcase-banner-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.team-showcase-members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  align-items: stretch;
}

/* Compact team member tiles */
.team-hero-card {
  position: relative;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  border-radius: 16px;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), filter 0.2s ease;
  width: 100%;
  height: auto;
}

.team-hero-card:hover {
  transform: translateY(-6px) scale(1.02);
  z-index: 2;
}

.team-hero-card:active {
  transform: translateY(-2px) scale(0.99);
}

.team-hero-card-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  height: auto;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(165deg, var(--color-surface) 0%, color-mix(in srgb, var(--hero-accent, #7C73FF) 8%, var(--color-surface)) 100%);
  border: 2px solid color-mix(in srgb, var(--hero-accent, #7C73FF) 45%, var(--color-border));
  box-shadow:
    0 6px 18px color-mix(in srgb, var(--hero-accent, #7C73FF) 16%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.team-hero-card:hover .team-hero-card-frame {
  border-color: var(--hero-accent, #7C73FF);
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--hero-accent, #7C73FF) 24%, transparent),
    0 0 0 1px color-mix(in srgb, var(--hero-accent, #7C73FF) 35%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.team-hero-card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    transparent 30%,
    rgba(255, 255, 255, 0.14) 48%,
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 5;
}

.team-hero-card:hover .team-hero-card-shine {
  opacity: 1;
}

.team-hero-card-body {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.team-hero-card-art-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-hero-card-art {
  position: relative;
  width: 100%;
  height: 208px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #1a1a22 0%, #12121a 100%);
}

.team-hero-card-level {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1a1200;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.team-hero-card-debuff {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(88, 28, 135, 0.85);
  color: #e9d5ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.team-hero-card-bg {
  position: absolute;
  inset: 0;
  background-color: #1a1a22;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.team-hero-card-art-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 38%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.42) 100%),
    linear-gradient(270deg, rgba(0, 0, 0, 0.35) 0%, transparent 45%),
    radial-gradient(ellipse 90% 80% at 50% 100%, color-mix(in srgb, var(--hero-accent, #7C73FF) 22%, transparent) 0%, transparent 70%);
  pointer-events: none;
}

.team-hero-card-sprite-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.team-hero-card-sprite {
  max-height: 184px;
  max-width: 94%;
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
  transform: translateY(4px);
  transition: transform 0.22s ease;
}

.team-hero-card:hover .team-hero-card-sprite {
  transform: translateY(0) scale(1.03);
}

.team-hero-card-initials {
  font-size: 3.25rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.35);
  padding-bottom: 24px;
}

.team-hero-card-stat-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
}

.team-hero-card-side-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(0, 0, 0, 0.55);
}

.team-hero-card-side-stat i {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.team-hero-card-side-stat--hp i { color: #ef4444; }
.team-hero-card-side-stat--mp i { color: #3b82f6; }
.team-hero-card-side-stat--xp i { color: #10b981; }
.team-hero-card-side-stat--gp i { color: #f59e0b; }

.team-hero-card-side-stat-value {
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-hero-card-footer {
  padding: 10px 12px 12px;
  background: var(--color-surface);
  border-top: 1px solid color-mix(in srgb, var(--hero-accent, #7C73FF) 22%, var(--color-border));
  text-align: center;
}

.team-hero-card-name {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.team-hero-card-class-row {
  display: flex;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.team-hero-card-class {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hero-accent, #7C73FF) 16%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--hero-accent, #7C73FF) 35%, transparent);
  color: var(--color-text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-hero-card--absent {
  opacity: 0.52;
  filter: grayscale(0.35);
}

.team-hero-card--absent:hover {
  transform: none;
}

.team-hero-card--debuffed .team-hero-card-sprite-wrap {
  filter: saturate(0.88) hue-rotate(-6deg);
}

.team-hero-card--debuffed .team-hero-card-stat-overlay {
  top: 48px;
}

.team-avg-stats-empty {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: center;
  font-style: italic;
}

.team-stats-overlay .team-avg-level-info {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.team-stats-overlay .team-avg-level-info .stat-info-item span:last-child {
  font-weight: 700;
  color: #d97706;
}

.team-showcase-emblem {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
}

.team-showcase-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

.team-showcase-emblem-fallback {
  font-size: 1.5rem;
  color: var(--color-primary);
  opacity: 0.85;
}

.team-showcase-title-block h2 {
  color: var(--color-text);
}

.team-showcase-member-count {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.team-display-placeholder i {
  font-size: 64px;
}

/* Team list mode - sidebar + cards, shared scene background (no gray panel) */
.classroom-student-display:has(.team-showcase-display) {
  background: transparent;
}

.student-display-main:has(.team-showcase-display) {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  background: transparent;
}

.student-display-main:has(.team-showcase-display)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../images/main/teams.webp') center center / cover no-repeat;
  z-index: 0;
  pointer-events: none;
}

.student-display-main:has(.team-showcase-display) > .student-overlay-stack {
  position: relative;
  top: auto;
  left: auto;
  order: -1;
  flex: 0 0 300px;
  max-width: 300px;
  min-width: 0;
  padding: 20px 12px 20px 20px;
  box-sizing: border-box;
  overflow-x: visible;
  overflow-y: auto;
  max-height: 100%;
  z-index: 2;
  align-self: stretch;
}

.student-display-main:has(.team-showcase-display) > .character-container {
  flex: 1;
  min-width: 0;
  width: auto;
  height: auto;
  overflow: auto;
  z-index: 1;
}

.student-display-main:has(.team-showcase-display) .team-showcase-bg {
  display: none;
}

.student-display-main:has(.team-showcase-display) .team-showcase-banner {
  display: none;
}

.student-display-main:has(.team-showcase-display) .team-showcase-content {
  padding: 12px 16px 24px;
  min-height: 0;
}

.student-display-main:has(.team-showcase-display) .team-stats-overlay,
.student-display-main:has(.team-showcase-display) .action-overlay-container {
  min-width: 0;
  width: 100%;
}

.student-display-main:has(.team-showcase-display) .action-overlay-buttons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.student-display-main:has(.team-showcase-display) .action-btn-small {
  width: 100%;
  height: 48px;
  min-width: 0;
}

#student-list-content.student-list-content--cards {
  padding: 16px 20px 24px;
}

.classroom-container--student-cards .student-roster-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: 28px 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.student-roster-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr));
  gap: 20px 12px;
  align-content: start;
  width: 100%;
  box-sizing: border-box;
}

.student-roster-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  text-align: center;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.student-roster-card:hover {
  background: var(--color-selection-hover);
}

.student-roster-card.active {
  background: var(--color-selection-bg);
  box-shadow: inset 0 0 0 2px var(--color-primary);
  color: var(--color-text);
}

.student-roster-card-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.student-roster-card-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C73FF 0%, #667eea 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 14px rgba(124, 115, 255, 0.22);
}

.student-roster-card-avatar--debuffed {
  filter: saturate(0.92) hue-rotate(-4deg);
}

.student-roster-card-initials {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 0;
}

.student-roster-card-debuff-sigil {
  width: 18px;
  height: 18px;
  right: 4px;
  bottom: 4px;
  font-size: 9px;
}

.student-roster-card-level {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 2px solid #7C73FF;
  color: #7C73FF;
  font-size: 13px;
  font-weight: 700;
  line-height: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 2;
}

.student-roster-card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  margin: 0;
}

.student-roster-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
  margin: 0;
}

.student-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.student-name-wrap .student-name {
  min-width: 0;
}

.student-name-wrap--card {
  justify-content: center;
  max-width: 100%;
}

.student-online-indicator {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #22c55e;
  box-shadow:
    0 0 0 2px var(--color-surface),
    0 0 8px rgba(34, 197, 94, 0.65);
}

.student-roster-card.active .student-roster-card-name,
.student-roster-card.active .student-roster-card-meta {
  color: var(--color-text);
}

.student-roster-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  max-width: 100%;
  line-height: 1.2;
}

.student-roster-card-meta .student-class {
  font-size: 10px;
}

.student-roster-card-team {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-roster-card-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  margin-top: 2px;
}

.student-roster-card-stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  width: 100%;
}

.student-roster-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.student-roster-card-stat i {
  font-size: 10px;
}

.student-roster-card-stat--hp i {
  color: #ef4444;
}

.student-roster-card-stat--mp i {
  color: #3b82f6;
}

.student-roster-card-stat--xp i {
  color: #10b981;
}

.student-roster-card-stat--gp i {
  color: #f59e0b;
}

/* Team roster card view (mirrors student card grid) */
.team-roster-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr));
  gap: 20px 12px;
  align-content: start;
  width: 100%;
  box-sizing: border-box;
}

.classroom-container--student-cards .team-roster-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: 28px 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.team-roster-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  text-align: center;
}

.team-roster-card:hover {
  background: var(--color-selection-hover);
}

.team-roster-card.active {
  background: var(--color-selection-bg);
  box-shadow: inset 0 0 0 2px var(--team-accent, var(--color-primary));
  color: var(--color-text);
}

.team-roster-card-emblem-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.team-roster-card-emblem {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  filter: drop-shadow(0 4px 14px rgba(124, 115, 255, 0.22));
}

.team-roster-card-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.team-roster-card-emblem-fallback {
  font-size: 2.5rem;
  color: var(--team-accent, var(--color-primary));
  opacity: 0.9;
}

.team-roster-card-level {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 2px solid var(--team-accent, #7C73FF);
  color: var(--team-accent, #7C73FF);
  font-size: 13px;
  font-weight: 700;
  line-height: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 2;
}

.team-roster-card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  margin: 0;
}

.team-roster-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
  margin: 0;
}

.team-roster-card-meta {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1.2;
}

.team-roster-card.active .team-roster-card-name,
.team-roster-card.active .team-roster-card-meta {
  color: var(--color-text);
}

.team-roster-card-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: 2px;
}

.team-roster-card-stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  width: 100%;
}

.team-roster-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.team-roster-card-stat i {
  font-size: 10px;
}

.team-roster-card-stat--hp i {
  color: #ef4444;
}

.team-roster-card-stat--mp i {
  color: #3b82f6;
}

.team-roster-card-avatars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
}

.team-roster-card-mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C73FF 0%, #667eea 100%);
  background-size: cover;
  background-position: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.team-roster-card-mini-more {
  font-size: 10px;
  color: var(--color-text-secondary);
  padding-left: 2px;
}

.student-action-context-menu {
  position: fixed;
  z-index: 12000;
  min-width: 196px;
  padding: 6px 0;
  background: var(--color-surface);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.student-action-context-menu-header {
  padding: 8px 14px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #7C73FF;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.student-action-context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}

.student-action-context-menu-item i {
  width: 18px;
  color: #7C73FF;
  text-align: center;
}

.student-action-context-menu-item:hover {
  background: var(--color-brand-hover-bg);
  color: var(--color-primary);
}

/* Filter & Sort Panel */
.filter-sort-panel {
  position: fixed;
  top: auto;
  left: auto;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 320px;
  max-width: 400px;
}

.filter-sort-panel.hidden {
  display: none;
}

.filter-sort-content {
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.filter-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.filter-section:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
}

.filter-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: #7C73FF;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text);
  user-select: none;
}

.filter-option input {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.filter-option:hover span {
  color: #7C73FF;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#clear-filters-btn {
  flex: 1;
}

.student-list-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
}

.student-list-item {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  margin: 0 8px;
  border-radius: 6px;
}

.student-list-item:hover {
  background: var(--color-selection-hover);
  border-left-color: var(--color-primary);
}

.student-list-item.active {
  background: var(--color-selection-bg);
  border-left-color: var(--color-primary);
  font-weight: 600;
  color: var(--color-text);
}

.student-list-item.active .student-name,
.student-list-item.active .student-text,
.student-list-item.active .student-list-row-1,
.student-list-item.active .student-list-row-2,
.student-list-item.active .student-list-row-3 {
  color: var(--color-text);
}

.student-list-item--absent {
  opacity: 0.55;
}

.student-list-item--absent .student-avatar-thumb,
.student-list-item--absent .student-roster-card-avatar {
  filter: grayscale(0.65);
}

.student-list-item--absent.active {
  opacity: 0.72;
}

.student-roster-card--absent {
  opacity: 0.55;
}

.student-roster-card--absent .student-roster-card-avatar {
  filter: grayscale(0.65);
}

.student-roster-card--absent.active {
  opacity: 0.72;
}

.character-display--absent .character-background {
  filter: grayscale(1);
  opacity: 0.75;
}

.character-display--absent .character-sprite,
.character-display--absent .character-pet {
  filter: grayscale(1);
}

.character-display--absent .student-active-award-badge,
.character-display--absent .student-featured-collection-badge {
  filter: grayscale(1);
  opacity: 0.85;
}

/* Active curse, corrupted screen effect on selected cursed student */
.student-display-main--cursed {
  box-shadow:
    inset 0 0 120px rgba(8, 2, 16, 0.92),
    inset 0 0 220px rgba(34, 197, 94, 0.08),
    0 0 48px rgba(220, 38, 38, 0.22);
}

.student-display-main--cursed::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 24;
  border-radius: 0;
  box-sizing: border-box;
  border: none;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, 0.18) 2px,
      rgba(0, 0, 0, 0.18) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 48px,
      rgba(74, 222, 128, 0.04) 48px,
      rgba(74, 222, 128, 0.04) 49px
    ),
    radial-gradient(ellipse 130% 90% at 50% 110%, rgba(34, 197, 94, 0.16) 0%, transparent 58%),
    radial-gradient(ellipse 70% 55% at 8% 18%, rgba(168, 85, 247, 0.14) 0%, transparent 52%),
    radial-gradient(ellipse 65% 50% at 92% 24%, rgba(239, 68, 68, 0.12) 0%, transparent 48%),
    linear-gradient(180deg, rgba(15, 5, 25, 0.42) 0%, transparent 28%, transparent 72%, rgba(15, 5, 25, 0.38) 100%);
  mix-blend-mode: multiply;
  animation:
    student-curse-corruption-flicker 0.12s steps(2) infinite,
    student-curse-corruption-drift 4.5s ease-in-out infinite;
}

.student-display-main--cursed::after {
  content: '';
  position: absolute;
  inset: 8px;
  pointer-events: none;
  z-index: 23;
  border-radius: 0;
  border: 2px solid rgba(74, 222, 128, 0.28);
  box-shadow:
    -5px 0 0 rgba(239, 68, 68, 0.35),
    5px 0 0 rgba(168, 85, 247, 0.28),
    inset 0 0 32px rgba(15, 5, 25, 0.55);
  animation: student-curse-glitch-border 3.2s steps(1) infinite;
}

.character-display--cursed .character-background::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  border-radius: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 6px,
      rgba(74, 222, 128, 0.035) 6px,
      rgba(74, 222, 128, 0.035) 7px
    );
  box-shadow:
    inset 0 0 0 2px rgba(34, 197, 94, 0.22),
    inset 0 0 90px rgba(15, 5, 25, 0.55);
  animation: student-curse-sprite-glitch 5.5s ease-in-out infinite;
}

.character-display--cursed .character-sprite img,
.character-display--cursed .character-sprite > .fa-user-circle {
  animation: student-curse-character-distort 4.2s ease-in-out infinite;
}

.character-display--cursed .character-sprite img {
  filter:
    drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45))
    contrast(1.18)
    saturate(0.62)
    hue-rotate(-18deg);
}

.character-display--cursed .character-sprite > .fa-user-circle {
  filter: contrast(1.1) saturate(0.55) hue-rotate(-18deg);
}

.student-curse-status-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(92%, 520px);
  pointer-events: none;
  animation: student-curse-banner-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.student-curse-status-banner__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 2px solid rgba(74, 222, 128, 0.45);
  background:
    linear-gradient(135deg, rgba(15, 5, 25, 0.94) 0%, rgba(30, 10, 40, 0.9) 55%, rgba(12, 4, 20, 0.95) 100%);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, 0.25) inset,
    -3px 0 0 rgba(239, 68, 68, 0.5),
    3px 0 0 rgba(74, 222, 128, 0.35),
    0 12px 36px rgba(0, 0, 0, 0.45);
  text-align: center;
  animation: student-curse-banner-glitch 4s steps(1) infinite;
}

.student-curse-status-banner__sigil {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: #bbf7d0;
  background: radial-gradient(circle at 35% 30%, #4ade80 0%, #166534 55%, #052e16 100%);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.45);
}

.student-curse-status-banner__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.student-curse-status-banner__label {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #86efac;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.45);
}

.student-curse-status-banner__message {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f5f3ff;
  line-height: 1.25;
}

.student-curse-status-banner__names {
  font-size: 0.8rem;
  font-weight: 600;
  color: #c4b5fd;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Active debuff - softer screen effect (not the cursed corruption) */
.student-display-main--debuffed {
  box-shadow:
    inset 0 0 80px rgba(120, 53, 15, 0.28),
    inset 0 0 140px rgba(251, 191, 36, 0.06),
    0 0 32px rgba(245, 158, 11, 0.14);
}

.student-display-main--debuffed::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 24;
  background:
    radial-gradient(ellipse 90% 70% at 50% 100%, rgba(245, 158, 11, 0.1) 0%, transparent 55%),
    linear-gradient(180deg, rgba(69, 26, 3, 0.18) 0%, transparent 35%, transparent 75%, rgba(69, 26, 3, 0.14) 100%);
  animation: student-debuff-pulse 3.5s ease-in-out infinite;
}

.character-display--debuffed .character-sprite img,
.character-display--debuffed .character-sprite > .fa-user-circle {
  filter:
    drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4))
    saturate(0.88)
    brightness(0.94);
}

.student-debuff-status-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(92%, 520px);
  pointer-events: none;
  animation: student-curse-banner-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.student-debuff-status-banner__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 2px solid rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(69, 26, 3, 0.92) 0%, rgba(120, 53, 15, 0.88) 100%);
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.2) inset,
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.student-debuff-status-banner__sigil {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  font-size: 1rem;
}

.student-debuff-status-banner__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  min-width: 0;
}

.student-debuff-status-banner__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fcd34d;
}

.student-debuff-status-banner__message {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fef3c7;
  line-height: 1.25;
}

.student-debuff-status-banner__names {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fde68a;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes student-debuff-pulse {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

@keyframes student-curse-corruption-flicker {
  0%,
  100% {
    opacity: 0.92;
  }
  50% {
    opacity: 1;
  }
}

@keyframes student-curse-corruption-drift {
  0%,
  100% {
    transform: translateX(0);
    filter: hue-rotate(0deg);
  }
  50% {
    transform: translateX(-2px);
    filter: hue-rotate(8deg);
  }
}

@keyframes student-curse-glitch-border {
  0%,
  88%,
  100% {
    transform: translate(0, 0);
    opacity: 0.75;
  }
  90% {
    transform: translate(-4px, 1px);
    opacity: 1;
    border-color: rgba(239, 68, 68, 0.55);
  }
  92% {
    transform: translate(3px, -1px);
    opacity: 0.9;
    border-color: rgba(168, 85, 247, 0.45);
  }
  94% {
    transform: translate(0, 0);
    opacity: 0.8;
  }
}

@keyframes student-curse-sprite-glitch {
  0%,
  100% {
    opacity: 0.65;
  }
  48% {
    opacity: 0.85;
  }
  50% {
    opacity: 0.45;
    transform: translateX(2px);
  }
  52% {
    opacity: 0.8;
    transform: translateX(-1px);
  }
}

@keyframes student-curse-character-distort {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  49% {
    transform: translateX(0) scale(1);
  }
  50% {
    transform: translateX(-3px) scale(1.01);
  }
  51% {
    transform: translateX(2px) scale(0.995);
  }
  52% {
    transform: translateX(0) scale(1);
  }
}

@keyframes student-curse-banner-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes student-curse-banner-glitch {
  0%,
  93%,
  100% {
    transform: translate(0, 0);
  }
  94% {
    transform: translate(-2px, 0);
  }
  96% {
    transform: translate(2px, 0);
  }
}

/* Teacher preference: hide curse corruption effect (Buffs, debuffs & curses panel) */

.classroom-container--curse-glow-off .student-display-main--cursed {
  box-shadow: none;
}

.classroom-container--curse-glow-off .student-display-main--cursed::before,
.classroom-container--curse-glow-off .student-display-main--cursed::after {
  display: none;
}

.classroom-container--curse-glow-off .character-display--cursed .character-background::after {
  display: none;
}

.classroom-container--curse-glow-off .character-display--cursed .character-sprite img,
.classroom-container--curse-glow-off .character-display--cursed .character-sprite > .fa-user-circle {
  animation: none;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.classroom-container--curse-glow-off .student-curse-status-banner {
  display: none;
}

.classroom-container--curse-glow-off .student-debuff-status-banner {
  display: none;
}

.classroom-container--curse-glow-off .student-display-main--debuffed {
  box-shadow: none;
}

.classroom-container--curse-glow-off .student-display-main--debuffed::before {
  display: none;
}

.classroom-container--curse-glow-off .character-display--debuffed .character-sprite img,
.classroom-container--curse-glow-off .character-display--debuffed .character-sprite > .fa-user-circle {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.classroom-container--curse-glow-off .student-avatar-debuff-aura,
.classroom-container--curse-glow-off .student-roster-card-debuff-aura {
  display: none;
}

.student-avatar-thumb {
  width: 45px;
  height: 45px;
  min-width: 45px;
  min-height: 45px;
  background: linear-gradient(135deg, #7C73FF 0%, #667eea 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
  align-self: center;
  position: relative;
}

.student-avatar-thumb--debuffed {
  filter: saturate(0.92) hue-rotate(-4deg);
}

.student-avatar-thumb--placeholder {
  background: #ffffff;
  border: 2px dashed rgba(91, 33, 182, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(124, 115, 255, 0.14),
    0 1px 3px rgba(91, 33, 182, 0.12);
  color: #6d28d9;
}

.student-avatar-thumb--placeholder .fa-user,
.student-avatar-thumb--placeholder .fa-user-circle {
  position: relative;
  z-index: 0;
  font-size: 17px;
  color: #6d28d9;
  opacity: 1;
}

.student-list-item.active .student-avatar-thumb--placeholder,
.student-list-item:hover .student-avatar-thumb--placeholder {
  background: #ffffff;
  border-color: rgba(76, 29, 149, 0.58);
  box-shadow:
    inset 0 0 0 1px rgba(124, 115, 255, 0.22),
    0 2px 6px rgba(91, 33, 182, 0.16);
}

.student-list-item.active .student-avatar-thumb--placeholder .fa-user,
.student-list-item.active .student-avatar-thumb--placeholder .fa-user-circle,
.student-list-item:hover .student-avatar-thumb--placeholder .fa-user,
.student-list-item:hover .student-avatar-thumb--placeholder .fa-user-circle {
  color: #5b21b6;
}

html[data-theme="dark"] .student-avatar-thumb--placeholder,
:root:not([data-theme="light"]) .student-avatar-thumb--placeholder {
  background: rgba(30, 27, 75, 0.92);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(167, 139, 250, 0.18),
    0 1px 4px rgba(0, 0, 0, 0.35);
  color: #c4b5fd;
}

html[data-theme="dark"] .student-avatar-thumb--placeholder .fa-user,
html[data-theme="dark"] .student-avatar-thumb--placeholder .fa-user-circle,
:root:not([data-theme="light"]) .student-avatar-thumb--placeholder .fa-user,
:root:not([data-theme="light"]) .student-avatar-thumb--placeholder .fa-user-circle {
  color: #ddd6fe;
}

html[data-theme="dark"] .student-list-item.active .student-avatar-thumb--placeholder,
html[data-theme="dark"] .student-list-item:hover .student-avatar-thumb--placeholder,
:root:not([data-theme="light"]) .student-list-item.active .student-avatar-thumb--placeholder,
:root:not([data-theme="light"]) .student-list-item:hover .student-avatar-thumb--placeholder {
  background: rgba(49, 46, 129, 0.95);
  border-color: rgba(196, 181, 253, 0.62);
}

.student-avatar-debuff-aura {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 90% 70% at 18% 88%, rgba(239, 68, 68, 0.34), transparent 58%),
    radial-gradient(ellipse 75% 55% at 92% 12%, rgba(185, 28, 28, 0.22), transparent 52%),
    radial-gradient(circle at 50% 100%, rgba(127, 29, 29, 0.18), transparent 62%);
  mix-blend-mode: multiply;
  animation: student-debuff-aura-drift 3.6s ease-in-out infinite alternate;
}

.student-avatar-debuff-sigil {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  line-height: 1;
  color: #fecaca;
  background: linear-gradient(145deg, #991b1b, #7f1d1d);
  box-shadow: 0 1px 3px rgba(69, 10, 10, 0.35);
  z-index: 2;
  pointer-events: none;
  animation: student-debuff-sigil-pulse 2.8s ease-in-out infinite;
}

@keyframes student-debuff-aura-drift {
  from {
    opacity: 0.55;
    transform: scale(1) rotate(0deg);
  }
  to {
    opacity: 0.9;
    transform: scale(1.06) rotate(8deg);
  }
}

@keyframes student-debuff-sigil-pulse {
  0%,
  100% {
    opacity: 0.82;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.student-avatar-thumb > .fa-user-circle,
.student-avatar-thumb > .fa-user {
  position: relative;
  z-index: 0;
}

.student-list-row-1 {
  display: flex;
  line-height: 1.3;
  gap: 8px;
  align-items: center;
}

.student-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-team {
  font-size: 9px;
  color: var(--color-text-light);
  font-weight: 500;
  white-space: nowrap;
}

.student-list-row-2 {
  display: flex;
  gap: 4px;
  align-items: center;
  line-height: 1.3;
}

.student-text {
  font-size: 10px;
  color: var(--color-text);
  font-weight: 500;
}

/* Text-only class labels in roster/sidebar, do not affect wizard creation pills */
.student-list-content .student-class,
.student-roster-card-meta .student-class {
  font-size: 10px;
  font-weight: 600;
  background: none;
  padding: 0;
  border: none;
  display: inline;
}

/* Catalog-driven class colors (custom classes + overrides) */
.student-class[style*="--class-color"],
.student-list-content .student-class[style*="--class-color"],
.student-roster-card-meta .student-class[style*="--class-color"] {
  color: var(--class-color) !important;
}

.mb-class-badge[style*="--class-color"] {
  color: color-mix(in srgb, var(--class-color) 80%, #000) !important;
  background: color-mix(in srgb, var(--class-color) 14%, transparent) !important;
  border-color: color-mix(in srgb, var(--class-color) 35%, transparent) !important;
}

html[data-theme="dark"] .mb-class-badge[style*="--class-color"],
:root:not([data-theme="light"]) .mb-class-badge[style*="--class-color"] {
  color: var(--class-color) !important;
}

.combat-student-avatar[style*="--class-color"] {
  border-color: color-mix(in srgb, var(--class-color) 45%, transparent) !important;
}

.combat-student-avatar--fallback[style*="--class-color"] {
  background: linear-gradient(
    135deg,
    var(--class-color),
    color-mix(in srgb, var(--class-color) 55%, #111)
  ) !important;
}

.class-defender {
  color: #ef4444 !important;
}

.class-wizard {
  color: #3b82f6 !important;
}

.class-healer {
  color: #10b981 !important;
}

.class-medic {
  color: #10b981 !important;
}

.class-tinkerer {
  color: #f59e0b !important;
}

.class-warrior {
  color: #ef4444 !important;
}

.class-mage {
  color: #3b82f6 !important;
}

.class-rogue {
  color: #10b981 !important;
}

.class-paladin {
  color: #f59e0b !important;
}

.class-cleric {
  color: #ec4899 !important;
}

.class-ranger {
  color: #06b6d4 !important;
}

.class-druid {
  color: #8b5cf6 !important;
}

.class-bard {
  color: #f59e0b !important;
}

.class-unassigned {
  color: #999 !important;
}

.student-list-row-3 {
  display: flex;
  gap: 6px;
  font-size: 9px;
  line-height: 1.3;
}

.student-stat {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 500;
}

.hp-stat {
  color: #ef4444;
}

.mp-stat {
  color: #3b82f6;
}

.xp-stat {
  color: #10b981;
}

.gp-stat {
  color: #f59e0b;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 14px;
}

.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 14px;
}

/* ========== RIGHT COLUMN: STUDENT DISPLAY ========== */
.classroom-student-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  overflow: hidden;
}

/* Top section: Stats Panel */
.student-display-top {
  display: none;
}

/* Main section: Character Display */
.student-display-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-background-alt) 100%);
  overflow: hidden;
  position: relative;
}

.character-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.character-placeholder {
  text-align: center;
  color: var(--color-text-light);
}

.character-placeholder i {
  font-size: 80px;
  margin-bottom: 20px;
  display: block;
}

.character-placeholder p {
  font-size: 14px;
  margin: 0;
}

.character-display--incomplete,
.character-display--incomplete .character-background--blank {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-background--blank {
  background: var(--color-background-alt, #f3f4f6);
  border: 1px dashed rgba(124, 115, 255, 0.25);
  box-sizing: border-box;
}

.student-setup-incomplete-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 420px;
  padding: 28px 32px;
  text-align: center;
  color: var(--color-text-secondary);
}

.student-setup-incomplete-icon {
  font-size: 2.5rem;
  color: var(--color-primary-light, #9ca3ff);
  margin-bottom: 16px;
}

.student-setup-incomplete-message {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
}

.student-setup-incomplete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.student-setup-warning-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(94%, 640px);
  pointer-events: none;
}

.student-setup-warning-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.98) 0%, rgba(254, 243, 199, 0.96) 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
}

.student-setup-warning-banner__icon {
  color: #d97706;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.student-setup-warning-banner__message {
  margin: 0;
  flex: 1 1 200px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  color: #92400e;
  text-align: center;
}

.student-setup-warning-banner__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 13px;
}

.character-display {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.character-background {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center bottom !important;
  background-repeat: no-repeat;
  background-attachment: local;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  border-radius: 0;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.character-sprite {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  margin-bottom: 30px;
}

.character-sprite img {
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.character-pet {
  position: absolute;
  bottom: 40px;
  right: 40px;
  z-index: 11;
}

.character-pet img {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* Bottom section: Action Menu */
.student-display-bottom {
  display: none;
}

/* ========== SCROLLBARS ========== */
/* Firefox / standard (avoid ::-webkit-* :hover, which some engines reject as invalid) */
.classroom-menu,
.student-list-content,
.student-display-main {
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.classroom-menu:hover,
.student-list-content:hover,
.student-display-main:hover {
  scrollbar-color: #7c73ff transparent;
}

/* Chromium / Safari */
.classroom-menu::-webkit-scrollbar,
.student-list-content::-webkit-scrollbar,
.student-display-main::-webkit-scrollbar {
  width: 8px;
}

.classroom-menu::-webkit-scrollbar-track,
.student-list-content::-webkit-scrollbar-track,
.student-display-main::-webkit-scrollbar-track {
  background: transparent;
}

.classroom-menu::-webkit-scrollbar-thumb,
.student-list-content::-webkit-scrollbar-thumb,
.student-display-main::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

.classroom-menu:hover::-webkit-scrollbar-thumb,
.student-list-content:hover::-webkit-scrollbar-thumb,
.student-display-main:hover::-webkit-scrollbar-thumb {
  background: #7c73ff;
}

/* ========== STUDENT OVERLAY PANELS (list view) ========== */

.student-overlay-stack {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  overflow: visible;
  pointer-events: none;
}

.student-overlay-stack .stats-overlay,
.student-overlay-stack .action-overlay-container,
.student-overlay-stack .action-overlay {
  pointer-events: auto;
}

/* Stats/actions sit above the full-screen curse corruption layer on .student-display-main */
.student-display-main--cursed > .student-overlay-stack {
  z-index: 35;
  isolation: isolate;
}

/* Stats Overlay (Top Left) */
.stats-overlay {
  position: relative;
  top: auto;
  left: auto;
  background: var(--color-surface);
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 280px;
  z-index: 100;
  font-family: 'Open Sans', sans-serif;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(124, 115, 255, 0.08);
  pointer-events: auto;
}

.stats-overlay.hidden {
  display: none;
}

.stats-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.stats-overlay-header h2 {
  font-size: 16px;
  margin: 0;
  color: var(--color-text);
  font-weight: 700;
  font-family: 'Open Sans', sans-serif;
}

.level-badge {
  background: linear-gradient(135deg, #7C73FF 0%, #667eea 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button.level-badge:hover,
button.level-badge:focus-visible {
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px rgba(124, 115, 255, 0.28);
  outline: none;
  transform: translateY(-1px);
}

button.level-badge:active {
  transform: translateY(0);
}

.stats-overlay .overlay-class-row {
  text-align: center;
  margin-bottom: 10px;
}

#overlay-class {
  font-weight: 700 !important;
  font-size: 14px !important;
  background: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

#overlay-class.class-defender {
  color: #ef4444 !important;
}

#overlay-class.class-wizard {
  color: #3b82f6 !important;
}

#overlay-class.class-healer {
  color: #10b981 !important;
}

#overlay-class.class-medic {
  color: #10b981 !important;
}

#overlay-class.class-tinkerer {
  color: #f59e0b !important;
}

#overlay-class[style*="--class-color"],
.team-hero-card-class[style*="--class-color"],
.stats-overlay .overlay-class-row span[style*="--class-color"] {
  color: var(--class-color) !important;
}

.stat-bar-container {
  margin-bottom: 10px;
}

.stat-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-bar-label span:last-child {
  color: var(--color-text);
}

.stat-bar {
  background: color-mix(in srgb, var(--color-text) 7%, var(--color-surface));
  border: 1px solid var(--color-border);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.14);
  height: 20px;
  border-radius: 6px;
  overflow: hidden;
}

.stat-bar-container:has(.xp-bar-fill) .stat-bar {
  background: color-mix(in srgb, var(--color-xp) 16%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-xp) 32%, var(--color-border));
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.12);
}

.stat-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  font-weight: 700;
}

.hp-bar-fill {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.mp-bar-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
}

.xp-bar-fill {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.stat-info {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.stat-info-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text);
  margin-bottom: 4px;
}

.stat-info-item .label {
  color: var(--color-text-secondary);
  font-weight: 600;
}

#overlay-gold {
  color: #f59e0b;
  font-weight: 600;
}

/* Action Overlay (Below Stats) */
.action-overlay-container {
  min-width: 280px;
  overflow: visible;
}

.action-overlay {
  position: static;
  background: var(--color-surface);
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(124, 115, 255, 0.08);
  pointer-events: auto;
  box-sizing: border-box;
  overflow: visible;
}

.action-overlay.hidden {
  display: none;
}

.action-overlay-header {
  font-size: 11px;
  font-weight: 700;
  color: #7C73FF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-align: center;
}

.action-overlay-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  overflow: visible;
  position: relative;
}

.action-btn-small {
  width: 55px;
  height: 55px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e5e7eb;
  background: var(--color-background-alt);
  color: var(--color-text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
  z-index: 1;
}

.action-btn-small:hover {
  background: var(--color-brand-hover-bg);
  border-color: #7C73FF;
  color: #7C73FF;
  z-index: 1000;
}

.action-btn-small:active {
  transform: scale(0.95);
}

/* Tooltip - anchor to grid edges so long labels are not clipped on the left/right */
.action-btn-small::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
  max-width: min(240px, calc(100vw - 48px));
  width: max-content;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1001;
  border: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.action-overlay-buttons .action-btn-small:nth-child(4n + 1)::after,
.action-overlay-buttons .action-btn-small:nth-child(4n + 2)::after {
  left: 0;
  right: auto;
  transform: none;
}

.action-overlay-buttons .action-btn-small:nth-child(4n)::after {
  left: auto;
  right: 0;
  transform: none;
}

.action-btn-small:hover::after {
  opacity: 1;
}

.action-btn-small:disabled,
.action-btn-small[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-btn-small:disabled:hover,
.action-btn-small[aria-disabled="true"]:hover {
  background: var(--color-background-alt);
  border-color: #e5e7eb;
  color: var(--color-text-secondary);
  z-index: 1000;
}

.action-btn-small:disabled:hover::after,
.action-btn-small[aria-disabled="true"]:hover::after {
  opacity: 1;
}

.action-btn-small.action-damage {
  border-left: 3px solid #ef4444;
}

.action-btn-small.action-reward {
  border-left: 3px solid #10b981;
}

.action-btn-small.action-potions {
  border-left: 3px solid #f59e0b;
}

.action-btn-small.action-award {
  border-left: 3px solid #fbbf24;
}

.action-btn-small.action-cast-spell {
  border-left: 3px solid #8b5cf6;
}

.action-btn-small.action-cast-spell[aria-disabled="true"]::after,
.action-btn-small.action-cast-spell:disabled::after {
  white-space: normal;
  max-width: 240px;
  text-align: center;
  line-height: 1.35;
  bottom: auto;
  top: calc(100% + 8px);
}

.student-action-context-menu-item.is-disabled,
.student-action-context-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-btn-small.action-effects {
  border-left: 3px solid #06b6d4;
}

.action-btn-small.action-analytics {
  border-left: 3px solid #6366f1;
}

.action-btn-small.action-view-dashboard {
  border-left: 3px solid #ec4899;
}

.action-btn-small.action-edit-stats {
  border-left: 3px solid #f59e0b;
}

.action-btn-small.action-toggle-presence {
  border-left: 3px solid #94a3b8;
}

.action-btn-small.action-toggle-login {
  border-left: 3px solid #ef4444;
}

.action-btn-small.action-toggle-login i {
  color: #ef4444;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1400px) {
  .action-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .classroom-container {
    height: 100%;
  }

  .classroom-menu.expanded {
    width: 220px;
  }

  .classroom-student-list {
    width: 220px;
  }

  .classroom-container--team-view:not(.classroom-container--student-cards) .classroom-student-list {
    width: 200px;
  }

  .student-display-main:has(.team-showcase-display) > .student-overlay-stack {
    flex: 0 0 280px;
    max-width: 280px;
    padding: 16px 10px 16px 16px;
  }

  .team-showcase-members {
    max-width: none;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .action-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .character-sprite img {
    max-width: 200px;
    max-height: 200px;
  }
}

@media (max-width: 900px) {
  .student-display-main:has(.team-showcase-display) {
    flex-direction: column;
    overflow-y: auto;
  }

  .student-display-main:has(.team-showcase-display) > .student-overlay-stack {
    flex: 0 0 auto;
    max-width: none;
    width: 100%;
    padding: 12px 12px 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    overflow: visible;
  }

  .student-display-main:has(.team-showcase-display) .stats-overlay,
  .student-display-main:has(.team-showcase-display) .action-overlay-container {
    flex: 1 1 240px;
    min-width: min(100%, 220px);
  }

  .student-display-main:has(.team-showcase-display) > .character-container {
    flex: 1 1 auto;
    min-height: 280px;
  }
}

@media (max-width: 768px) {
  #app.classroom-view {
    height: calc(100dvh - var(--header-height, 96px));
    min-height: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .classroom-layout--mobile.classroom-container {
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  .classroom-layout--mobile .classroom-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 92vw) !important;
    min-width: 0;
    max-width: 92vw;
    height: 100dvh !important;
    z-index: calc(var(--z-modal, 1100) + 2);
    transform: translateX(-110%);
    transition: transform 0.24s ease;
    border-right: 2px solid var(--color-border);
    border-bottom: none;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.28);
    display: flex !important;
  }

  .classroom-layout--mobile .classroom-menu.classroom-menu--mobile-open {
    transform: translateX(0);
  }

  .classroom-layout--mobile .classroom-menu.collapsed,
  .classroom-layout--mobile .classroom-menu.expanded {
    width: min(320px, 92vw) !important;
  }

  .classroom-layout--mobile .classroom-menu.collapsed .menu-header h3,
  .classroom-layout--mobile .classroom-menu .menu-header h3 {
    display: block;
  }

  .classroom-layout--mobile .classroom-menu.collapsed .menu-section-title,
  .classroom-layout--mobile .classroom-menu .menu-section-title {
    display: flex;
  }

  .classroom-layout--mobile .classroom-menu.collapsed .menu-item,
  .classroom-layout--mobile .classroom-menu .menu-item {
    justify-content: flex-start;
    padding: 12px 16px;
    gap: 12px;
  }

  .classroom-layout--mobile .classroom-menu.collapsed .menu-item .menu-item-label,
  .classroom-layout--mobile .classroom-menu .menu-item .menu-item-label {
    display: inline;
  }

  .classroom-layout--mobile .classroom-menu.collapsed .menu-item i,
  .classroom-layout--mobile .classroom-menu .menu-item i {
    width: auto;
    font-size: 1rem;
  }

  .classroom-layout--mobile .classroom-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal, 1100) + 1);
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .classroom-layout--mobile .classroom-menu-backdrop.classroom-menu-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
  }

  .classroom-layout--mobile .classroom-mobile-menu-btn {
    display: inline-flex;
    flex-shrink: 0;
  }

  .classroom-layout--mobile .student-list-header-top {
    justify-content: space-between;
  }

  .classroom-layout--mobile .roster-tab-group {
    margin-left: auto;
  }

  .classroom-layout--mobile .classroom-student-list {
    width: 100% !important;
    max-width: 100%;
    flex: 1;
    min-height: 0;
    max-height: none;
    height: auto;
    border: none;
    border-bottom: none;
    overflow: hidden;
    box-sizing: border-box;
  }

  .classroom-layout--mobile .classroom-student-display {
    display: none !important;
  }

  .classroom-layout--mobile.classroom-container--team-view:not(.classroom-container--student-cards) .classroom-student-display {
    display: none !important;
  }

  .classroom-layout--mobile #student-list-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .classroom-layout--mobile #student-list-content.student-list-content--cards {
    padding: 12px 10px 20px;
  }

  .classroom-layout--mobile.classroom-container--student-cards .student-roster-card-grid,
  .classroom-layout--mobile .student-roster-card-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 8px;
  }

  .classroom-layout--mobile .team-roster-card-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 8px;
  }

  .classroom-layout--mobile .student-roster-card {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 6px 4px 8px;
  }

  .classroom-layout--mobile .student-roster-card-avatar-wrap {
    width: 72px;
    height: 72px;
  }

  .classroom-layout--mobile .student-roster-card-initials {
    font-size: 1.45rem;
  }

  .classroom-layout--mobile .student-roster-card-name {
    font-size: 11px;
  }

  .classroom-layout--mobile .student-roster-card-meta .student-class,
  .classroom-layout--mobile .student-roster-card-team {
    font-size: 9px;
  }

  .classroom-layout--mobile .student-roster-card-stats-row {
    gap: 3px 5px;
  }

  .classroom-layout--mobile .student-roster-card-stat {
    font-size: 10px;
    gap: 2px;
  }

  .classroom-layout--mobile .student-roster-card-stat i {
    font-size: 9px;
  }

  .classroom-layout--mobile .student-list-header {
    padding: 14px 12px;
  }

  .classroom-layout--mobile .classroom-container--team-view:not(.classroom-container--student-cards) .classroom-student-list {
    display: flex;
    flex-direction: column;
    max-height: none;
  }

  .classroom-student-list,
  .classroom-student-display {
    width: 100% !important;
    height: auto;
    border: none;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 1;
  }

  .classroom-container--team-view:not(.classroom-container--student-cards) .classroom-student-list {
    display: flex;
    flex-direction: column;
    max-height: 36vh;
    min-height: 0;
    overflow: hidden;
  }

  .classroom-container--team-view:not(.classroom-container--student-cards) .student-list-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .classroom-student-display {
    border-bottom: none;
    flex: 1;
    min-height: 0;
  }

  .student-display-main:has(.team-showcase-display) > .student-overlay-stack {
    padding: 10px 10px 0;
    flex-direction: column;
  }

  .team-showcase-members {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .action-buttons {
    grid-template-columns: repeat(1, 1fr);
  }

  .character-sprite img {
    max-width: 150px;
    max-height: 150px;
  }

  .character-pet img {
    max-width: 80px;
    max-height: 80px;
  }
}

@media (max-width: 768px) and (min-width: 560px) {
  .classroom-layout--mobile.classroom-container--student-cards .student-roster-card-grid,
  .classroom-layout--mobile .student-roster-card-grid,
  .classroom-layout--mobile .team-roster-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .classroom-container--student-cards .student-roster-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .student-display-main:has(.team-showcase-display) .stats-overlay,
  .student-display-main:has(.team-showcase-display) .action-overlay-container {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .team-showcase-members {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    max-width: none;
  }
}

/* ========== ACTIVE AWARD (student view, top-right) ========== */
.student-active-award-badge,
.student-featured-collection-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: min(320px, calc(100% - 40px));
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  text-align: center;
  pointer-events: auto;
  overflow: visible;
}

.character-background:has(.student-active-award-badge),
.character-background:has(.student-featured-collection-badge) {
  overflow: visible;
}

.character-display:has(.student-active-award-badge),
.character-display:has(.student-featured-collection-badge) {
  overflow: visible;
}

.student-active-award-medal,
.student-featured-collection-medal {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-active-award-stack-count {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 2;
  min-width: 1.65em;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.student-active-award-thumb {
  position: relative;
  width: 144px;
  height: 144px;
  min-width: 144px;
  min-height: 144px;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.character-display .student-active-award-thumb img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.student-featured-collection-thumb {
  position: relative;
  width: 144px;
  height: 144px;
  min-width: 144px;
  min-height: 144px;
  border-radius: 0;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.student-featured-collection-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.student-active-award-name,
.student-featured-collection-name {
  display: block;
  width: 100%;
  max-width: min(320px, calc(100% - 40px));
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  color: #1e1b4b;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 245, 255, 0.94) 100%);
  border: 2px solid rgba(124, 115, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
}

.student-active-award-name {
  max-height: none;
}

.student-active-award-badge.rarity-legendary .student-active-award-name {
  border-color: rgba(234, 179, 8, 0.7);
  background: linear-gradient(145deg, rgba(255, 251, 235, 0.97) 0%, rgba(254, 243, 199, 0.95) 100%);
  color: #78350f;
}

.student-active-award-badge.rarity-unique .student-active-award-name {
  border-color: rgba(168, 85, 247, 0.65);
  background: linear-gradient(145deg, rgba(250, 245, 255, 0.98) 0%, rgba(237, 233, 254, 0.95) 100%);
  color: #4c1d95;
}

.student-active-award-badge.rarity-epic .student-active-award-name {
  border-color: rgba(168, 85, 247, 0.55);
  color: #5b21b6;
}

.student-active-award-badge.rarity-rare .student-active-award-name {
  border-color: rgba(59, 130, 246, 0.55);
  color: #1e3a8a;
}

.student-active-award-badge.rarity-uncommon .student-active-award-name {
  border-color: rgba(34, 197, 94, 0.55);
  color: #14532d;
}

.student-featured-collection-name {
  color: var(--color-text);
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(236, 253, 245, 0.94) 100%);
}

.featured-badge-name--len-sm {
  font-size: 18px;
  padding: 8px 12px;
}

.featured-badge-name--len-md {
  font-size: 15px;
  padding: 8px 10px;
  line-height: 1.3;
}

.featured-badge-name--len-lg {
  font-size: 13px;
  padding: 7px 10px;
  line-height: 1.28;
}

.featured-badge-name--len-xl {
  font-size: 11px;
  padding: 6px 8px;
  line-height: 1.22;
}

html[data-theme="dark"] .student-active-award-name,
html[data-theme="dark"] .student-featured-collection-name {
  color: var(--color-text);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.97) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(124, 115, 255, 0.42);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

html[data-theme="dark"] .student-active-award-badge.rarity-legendary .student-active-award-name {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(145deg, rgba(41, 37, 36, 0.97) 0%, rgba(28, 25, 23, 0.95) 100%);
  color: #fde68a;
}

html[data-theme="dark"] .student-active-award-badge.rarity-unique .student-active-award-name {
  border-color: rgba(45, 212, 191, 0.5);
  background: linear-gradient(145deg, rgba(19, 36, 40, 0.97) 0%, rgba(15, 23, 42, 0.95) 100%);
  color: #99f6e4;
}

html[data-theme="dark"] .student-active-award-badge.rarity-epic .student-active-award-name {
  border-color: rgba(168, 85, 247, 0.55);
  background: linear-gradient(145deg, rgba(36, 24, 54, 0.97) 0%, rgba(15, 23, 42, 0.95) 100%);
  color: #d8b4fe;
}

html[data-theme="dark"] .student-active-award-badge.rarity-rare .student-active-award-name {
  border-color: rgba(59, 130, 246, 0.55);
  background: linear-gradient(145deg, rgba(23, 37, 84, 0.55) 0%, rgba(15, 23, 42, 0.95) 100%);
  color: #93c5fd;
}

html[data-theme="dark"] .student-active-award-badge.rarity-uncommon .student-active-award-name {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(145deg, rgba(20, 46, 33, 0.72) 0%, rgba(15, 23, 42, 0.95) 100%);
  color: #86efac;
}

html[data-theme="dark"] .student-featured-collection-name {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(145deg, rgba(20, 46, 33, 0.72) 0%, rgba(15, 23, 42, 0.95) 100%);
  color: #6ee7b7;
}

/* ========== EDIT STATS MODAL ========== */
.edit-stats-panel {
  width: min(860px, 96vw);
  max-width: none;
  overflow: hidden;
}

.edit-stats-header h2 i {
  color: var(--color-primary-light, var(--color-primary));
}

.edit-stats-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 22px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--color-modal-shell-border);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-primary) 12%, var(--color-surface)) 0%,
    var(--color-surface) 55%
  );
}

.edit-stats-hero-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  font-size: 1.35rem;
  color: var(--color-primary-text);
  background: color-mix(in srgb, var(--color-primary) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.edit-stats-hero-copy {
  min-width: 0;
}

.edit-stats-hero-kicker {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.edit-stats-hero-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-stats-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 22px 22px;
}

.edit-stats-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.edit-stats-cards--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.edit-stats-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  min-width: 0;
}

.edit-stats-card:hover {
  transform: translateY(-1px);
}

.edit-stats-card:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
}

.edit-stats-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.15rem;
}

.edit-stats-card-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.edit-stats-card-input {
  width: 100%;
  max-width: 100%;
  padding: 8px 6px;
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.edit-stats-card-input:focus {
  outline: none;
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
}

.edit-stats-card-input::-webkit-outer-spin-button,
.edit-stats-card-input::-webkit-inner-spin-button {
  margin: 0;
}

.edit-stats-card--level {
  border-color: rgba(124, 115, 255, 0.35);
  background: linear-gradient(165deg, rgba(124, 115, 255, 0.14) 0%, var(--color-surface) 72%);
}

.edit-stats-card--level .edit-stats-card-icon {
  color: var(--color-primary-text);
  background: rgba(124, 115, 255, 0.18);
}

.edit-stats-card--level .edit-stats-card-input {
  color: var(--color-primary-text);
}

.edit-stats-card--hp {
  border-color: rgba(239, 68, 68, 0.32);
  background: linear-gradient(165deg, rgba(239, 68, 68, 0.12) 0%, var(--color-surface) 72%);
}

.edit-stats-card--hp .edit-stats-card-icon {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.14);
}

.edit-stats-card--hp .edit-stats-card-input {
  color: #ef4444;
}

.edit-stats-card--mp {
  border-color: rgba(59, 130, 246, 0.32);
  background: linear-gradient(165deg, rgba(59, 130, 246, 0.12) 0%, var(--color-surface) 72%);
}

.edit-stats-card--mp .edit-stats-card-icon {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.14);
}

.edit-stats-card--mp .edit-stats-card-input {
  color: #3b82f6;
}

.edit-stats-card--xp {
  border-color: rgba(16, 185, 129, 0.32);
  background: linear-gradient(165deg, rgba(16, 185, 129, 0.12) 0%, var(--color-surface) 72%);
}

.edit-stats-card--xp .edit-stats-card-icon {
  color: #10b981;
  background: rgba(16, 185, 129, 0.14);
}

.edit-stats-card--xp .edit-stats-card-input {
  color: #10b981;
}

.edit-stats-card--gp {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(165deg, rgba(245, 158, 11, 0.14) 0%, var(--color-surface) 72%);
}

.edit-stats-card--gp .edit-stats-card-icon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
}

.edit-stats-card--gp .edit-stats-card-input {
  color: #f59e0b;
}

.edit-stats-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--color-modal-shell-border);
}

/* spellbook.css defines .btn-secondary for dark panels; restore readable buttons here */
.give-award-panel .btn.btn-secondary,
.edit-stats-panel .btn.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.give-award-panel .btn.btn-secondary:hover:not(:disabled),
.edit-stats-panel .btn.btn-secondary:hover:not(:disabled) {
  background: var(--color-brand-hover-bg);
  color: var(--color-text);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.edit-stats-save--busy {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 760px) {
  .edit-stats-cards,
  .edit-stats-cards--four {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .edit-stats-hero {
    margin: 0 16px;
    padding: 14px;
  }

  .edit-stats-form {
    padding: 16px;
  }

  .edit-stats-cards,
  .edit-stats-cards--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .edit-stats-cards,
  .edit-stats-cards--four {
    grid-template-columns: 1fr;
  }
}

/* ========== GIVE AWARD PICKER ========== */
.give-award-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.give-award-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
}

.give-award-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  max-height: min(88dvh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  border-radius: 20px;
  border: 2px solid var(--color-modal-shell-border);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
}

.give-award-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-header);
}

.give-award-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-primary);
}

.give-award-close {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 2px solid var(--color-modal-shell-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.give-award-close:hover {
  background: var(--color-brand-hover-bg);
  border-color: var(--color-primary);
  color: var(--color-primary-light);
}

.give-award-close:active {
  transform: scale(0.96);
}

.give-award-close:focus-visible {
  outline: 3px solid rgba(124, 115, 255, 0.55);
  outline-offset: 2px;
}

.give-award-sub {
  margin: 0;
  padding: 12px 22px 10px;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  opacity: 1;
  text-align: center;
  line-height: 1.45;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.give-award-recipients {
  padding: 4px 22px 12px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: transparent;
}

.give-award-recipients-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-primary-light);
  margin-bottom: 8px;
}

.give-award-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.give-award-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 2px solid var(--color-modal-shell-border);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}

.give-award-chip-remove {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.give-award-chip-remove:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* Multi-add student picker (damage / reward / award targeting) */
.student-recipient-add-picker {
  position: relative;
  width: 100%;
}

.student-recipient-add-picker-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.student-recipient-add-picker-control {
  position: relative;
}

.student-recipient-add-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--color-input-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.student-recipient-add-picker-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.student-recipient-add-picker-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-secondary);
}

.student-recipient-add-picker--open .student-recipient-add-picker-trigger {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(124, 115, 255, 0.2);
}

.student-recipient-add-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  border-radius: 10px;
  border: 2px solid var(--color-input-border);
  background: var(--color-surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

/* Portaled while open, escapes modal overflow clipping */
.student-recipient-add-picker-menu--floating {
  position: fixed;
  z-index: 15000;
  top: 0;
  left: 0;
  right: auto;
  min-width: 280px;
  max-width: calc(100vw - 16px);
}

.student-recipient-add-picker-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.student-recipient-add-picker-list--rich {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px;
}

.student-recipient-add-picker-list--rich-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex-direction: unset;
  flex-wrap: unset;
}

@media (max-width: 900px) {
  .student-recipient-add-picker-list--rich-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .student-recipient-add-picker-list--rich-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.student-recipient-add-picker-item--rich {
  width: 100%;
  max-width: none;
}

.student-recipient-add-picker-list--rich-grid .student-recipient-add-picker-item--rich {
  min-width: 0;
}

.student-recipient-add-picker-option--rich {
  display: flex;
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
  border: 1.5px solid var(--color-input-border);
  background: var(--color-surface);
}

.student-recipient-add-picker-list--rich-grid .student-recipient-add-picker-option--rich {
  height: 100%;
  min-height: 108px;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
}

.student-recipient-add-picker--combat .student-recipient-add-picker-option--rich {
  border-color: rgba(220, 38, 38, 0.2);
}

.student-recipient-add-picker--combat .student-recipient-add-picker-option--rich:hover,
.student-recipient-add-picker--combat .student-recipient-add-picker-option--rich:focus-visible {
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(254, 226, 226, 0.35);
  color: inherit;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.student-recipient-add-picker--reward .student-recipient-add-picker-option--rich {
  border-color: rgba(16, 185, 129, 0.22);
}

.student-recipient-add-picker--reward .student-recipient-add-picker-option--rich:hover,
.student-recipient-add-picker--reward .student-recipient-add-picker-option--rich:focus-visible {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(209, 250, 229, 0.35);
  color: inherit;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.student-recipient-add-picker--award .student-recipient-add-picker-option--rich {
  border-color: rgba(245, 158, 11, 0.28);
}

.student-recipient-add-picker--award .student-recipient-add-picker-option--rich:hover,
.student-recipient-add-picker--award .student-recipient-add-picker-option--rich:focus-visible {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(254, 243, 199, 0.4);
  color: inherit;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

/* Shared recipient toolbar (damage / reward / award) */
.recipient-add-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.recipient-add-toolbar-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.recipient-add-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.recipient-add-toolbar-picker {
  flex: 1 1 220px;
  min-width: 0;
}

.recipient-add-toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.recipient-add-toolbar-row .student-recipient-add-picker-trigger,
.recipient-add-toolbar-actions > button {
  min-height: 40px;
  box-sizing: border-box;
}

.recipient-add-toolbar-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 639px) {
  .recipient-add-toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .recipient-add-toolbar-actions {
    width: 100%;
  }

  .recipient-add-toolbar-actions > button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
}

.recipient-add-toolbar-picker .student-recipient-add-picker-mount,
.recipient-add-toolbar-picker .give-reward-add-picker-mount,
.recipient-add-toolbar-picker .give-award-add-picker-mount,
.recipient-add-toolbar-picker .combat-add-picker-mount {
  width: 100%;
  max-width: none;
  min-width: 0;
  flex: unset;
}

.student-recipient-add-picker-item {
  flex: 0 0 auto;
  max-width: 100%;
  margin: 0;
}

.student-recipient-add-picker-pill {
  display: inline-block;
  width: auto;
  max-width: none;
  border: 1.5px solid var(--color-input-border);
  border-radius: 999px;
  background: var(--color-surface);
  text-align: center;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.student-recipient-add-picker-pill:hover,
.student-recipient-add-picker-pill:focus-visible {
  background: var(--color-page-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(124, 115, 255, 0.15);
}

.student-recipient-add-picker--combat .student-recipient-add-picker-pill {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--color-combat-chip-text, var(--color-text));
}

.student-recipient-add-picker--combat .student-recipient-add-picker-pill:hover,
.student-recipient-add-picker--combat .student-recipient-add-picker-pill:focus-visible {
  border-color: rgba(220, 38, 38, 0.65);
  color: #b91c1c;
  background: rgba(254, 226, 226, 0.5);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.student-recipient-add-picker--reward .student-recipient-add-picker-pill {
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--color-reward-chip-text, var(--color-text));
}

.student-recipient-add-picker--reward .student-recipient-add-picker-pill:hover,
.student-recipient-add-picker--reward .student-recipient-add-picker-pill:focus-visible {
  border-color: rgba(16, 185, 129, 0.65);
  color: #047857;
  background: rgba(209, 250, 229, 0.45);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.student-recipient-add-picker--award .student-recipient-add-picker-pill {
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--color-text);
}

.student-recipient-add-picker--award .student-recipient-add-picker-pill:hover,
.student-recipient-add-picker--award .student-recipient-add-picker-pill:focus-visible {
  border-color: rgba(245, 158, 11, 0.75);
  color: #b45309;
  background: rgba(254, 243, 199, 0.5);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.student-recipient-add-picker-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.student-recipient-add-picker--disabled {
  opacity: 0.55;
  pointer-events: none;
}

.student-recipient-add-picker--combat .student-recipient-add-picker-trigger {
  border-color: rgba(220, 38, 38, 0.3);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.88rem;
}

.student-recipient-add-picker--combat.student-recipient-add-picker--open .student-recipient-add-picker-trigger {
  border-color: rgba(220, 38, 38, 0.55);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.student-recipient-add-picker--reward .student-recipient-add-picker-trigger {
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.student-recipient-add-picker--reward.student-recipient-add-picker--open .student-recipient-add-picker-trigger {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.give-award-add-picker-mount {
  width: 100%;
}

.give-award-team-btn,
.give-award-everyone-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--color-modal-shell-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.give-award-team-btn:hover:not(:disabled) {
  background: #3b82f6;
  border-color: #2563eb;
  color: #fff;
}

.give-award-team-btn:disabled,
.give-reward-team-btn:disabled,
.combat-team-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.give-award-everyone-btn:hover,
.give-award-everyone-btn--active {
  background: #6366f1;
  border-color: var(--color-tool-accent);
  color: #fff;
}

.give-award-chip--everyone {
  background: var(--color-selection-muted);
  border-color: var(--color-modal-shell-border);
  color: var(--color-primary-light);
}

.give-award-loading,
.give-award-empty {
  padding: 32px 22px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 1rem;
}

.give-award-loading--hidden,
.give-award-grid--hidden,
.give-award-empty--hidden,
.give-award-footer--hidden {
  display: none !important;
}

.give-award-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 16px 22px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.give-award-tile {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-width: 0;
  border: 2px solid var(--color-modal-shell-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.give-award-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: 0 10px 28px var(--color-brand-hover-bg);
}

.give-award-tile--disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.give-award-tile--busy {
  pointer-events: none;
  opacity: 0.7;
}

.give-award-tile--selected {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-selection-muted), 0 10px 28px var(--color-brand-hover-bg);
  background: var(--color-selection-bg);
}

/*
 * Award picker: image must not participate in flex intrinsic sizing (huge bitmaps
 * otherwise force row/column size). Absolute fill + fixed wrapper bounds the paint box.
 */
.give-award-tile-thumb {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  max-width: 56px;
  max-height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
}

.give-award-overlay .give-award-tile-thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.give-award-tile-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.give-award-tile-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.2;
}

.give-award-tile-rarity {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.give-award-tile-reason {
  font-size: 0.72rem;
  color: var(--color-text-light);
  line-height: 1.3;
}

.give-award-tile-prior {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  line-height: 1.3;
}

.give-award-tile-prior--none {
  color: var(--color-text-light);
  font-style: italic;
}

.give-award-tooltip-prior {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

.give-award-tile-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.give-award-footer {
  flex-shrink: 0;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-header);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.give-award-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  text-align: center;
}

.give-award-confirm {
  min-width: 240px;
  font-weight: 800;
  color: var(--color-on-primary);
}

.give-award-confirm:disabled {
  background: var(--color-border);
  color: var(--color-text-secondary);
  opacity: 1;
  cursor: not-allowed;
}

.give-award-confirm--busy {
  opacity: 0.75;
  pointer-events: none;
}

/* ── Use potion picker (reuses give-award overlay; quantity badge) ───────── */
.use-potion-tile-qty {
  font-size: 0.78rem;
  font-weight: 700;
  color: #059669;
  letter-spacing: 0.02em;
}

.use-potion-tile-qty--pending {
  color: #b45309;
}

.use-potion-tile--pending {
  opacity: 0.72;
  cursor: not-allowed;
}

/* ── Potion used confirmation (after successful use) ─────────────────────── */
.potion-used-overlay {
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.potion-used-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
}

.potion-used-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(90dvh, 880px);
  overflow-y: auto;
  padding: 24px 26px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 45%, #f8fafc 100%);
  border: 2px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.potion-used-kicker {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #059669;
}

.potion-used-image-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--color-surface);
  border: 2px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
}

.potion-used-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.potion-used-name {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #14532d;
  line-height: 1.2;
}

.potion-used-for {
  margin: 0 0 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #166534;
}

.potion-used-effect-h {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #047857;
  text-align: left;
}

.potion-used-desc {
  margin: 0 0 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--color-text);
  text-align: left;
}

.potion-used-spell-h {
  margin: 16px 0 10px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-tool-accent);
  text-align: left;
}

.potion-used-spell-inner {
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--color-tool-inset-strong);
  border: 1px solid rgba(99, 102, 241, 0.22);
  margin-bottom: 18px;
}

.potion-used-spell-inner .spell-cast-result-icon {
  margin-bottom: 8px;
}

.potion-used-spell-inner .spell-cast-result-title {
  margin-top: 0;
}

.potion-used-spell-fail {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(254, 226, 226, 0.85);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #991b1b;
  font-size: 0.9rem;
  text-align: left;
  line-height: 1.45;
}

.potion-used-spell-fail i {
  margin-right: 8px;
}

.potion-used-dismiss {
  min-width: 200px;
  font-weight: 800;
}

.give-award-tooltip {
  position: fixed;
  z-index: 13050;
  max-width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 12px;
  background: #1e1b4b;
  color: #f8fafc;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.give-award-tooltip--visible {
  opacity: 1;
  visibility: visible;
}

.give-award-tooltip-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: #fff;
}

.give-award-tooltip-desc {
  opacity: 0.92;
  margin-bottom: 8px;
}

.give-award-tooltip-rewards {
  font-weight: 700;
  color: #a5b4fc;
  font-size: 0.85rem;
}

/* ========== TEACHER: STUDENT EFFECTS (same shell as give-award) ========== */
.student-effects-overlay .give-award-panel {
  max-width: 640px;
}

.student-effects-sub strong {
  color: var(--color-primary);
  font-weight: 800;
}

.student-effects-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.student-effects-section {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(124, 115, 255, 0.12);
}

.student-effects-section--curses {
  border-bottom: none;
  padding-bottom: 0;
}

.student-effects-glow-toggle {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid rgba(124, 115, 255, 0.12);
}

.student-effects-glow-toggle .btn-secondary.student-effects-glow-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(124, 115, 255, 0.18);
}

.student-effects-glow-toggle .btn-secondary.student-effects-glow-btn:hover {
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 115, 255, 0.28);
}

.student-effects-glow-toggle .btn-secondary.student-effects-glow-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.student-effects-glow-toggle .student-effects-section-hint {
  margin-top: 8px;
  margin-bottom: 0;
}

.student-effects-section-hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.student-effects-empty {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 2px dashed var(--color-modal-shell-border);
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  text-align: center;
}

.student-effects-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.22);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.student-effects-row:last-child {
  margin-bottom: 0;
}

.student-effects-row--spell {
  border-left: 4px solid #10b981;
}

.student-effects-row--flag-debuff {
  border-left: 4px solid #ef4444;
  background: rgba(254, 226, 226, 0.35);
}

.student-effects-row-detail--expires {
  color: #7c2d12;
}

.student-effects-row-detail--primary {
  font-weight: 700;
  color: #b91c1c;
}

.student-effects-section--debuffs .give-award-recipients-label {
  color: #b91c1c;
}

.student-effects-row--curse {
  border-left: 4px solid #a855f7;
}

.student-effects-row:hover {
  border-color: rgba(124, 115, 255, 0.4);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1);
}

.student-effects-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.student-effects-row-title {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--color-primary);
}

.student-effects-row-detail {
  font-size: 0.84rem;
  color: var(--color-text-secondary);
  line-height: 1.35;
}

.student-effects-row-meta {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--color-tool-accent-icon);
  font-weight: 600;
}

.student-effects-remove {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.student-effects-remove:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.5);
}

.student-effects-remove:disabled,
.student-effects-remove--busy {
  opacity: 0.65;
  cursor: wait;
}

.student-effects-remove--curse {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.1);
  color: #6b21a8;
}

.student-effects-remove--curse:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.6);
}

.student-effects-error {
  margin: 0 22px 22px;
}

/* ========== AWARD CELEBRATION ========== */
.award-celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.award-celebration-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(124, 115, 255, 0.35) 0%, rgba(15, 23, 42, 0.92) 55%);
  animation: award-celebrate-bg 0.8s ease-out;
}

@keyframes award-celebrate-bg {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.award-celebration-content {
  position: relative;
  z-index: 1;
  max-width: 440px;
  width: 100%;
}

.award-celebration-burst {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 320px;
  height: 320px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 0deg, #fbbf24, #f472b6, #a78bfa, #38bdf8, #fbbf24);
  opacity: 0.35;
  filter: blur(40px);
  animation: award-burst-spin 4s linear infinite;
  pointer-events: none;
}

@keyframes award-burst-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.award-celebration-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.award-particle {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fbbf24;
  opacity: 0;
  animation: award-pop 1.1s ease-out forwards;
  animation-delay: calc(var(--d) * 0.04s);
}

.award-particle:nth-child(odd) {
  background: #a78bfa;
}

@keyframes award-pop {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    opacity: 0;
    transform: translate(
        calc(-50% + (var(--d) - 9) * 18px),
        calc(-50% + (var(--d) % 5) * -32px - 80px)
      )
      scale(0.5);
  }
}

.award-celebration-card {
  position: relative;
  background: linear-gradient(165deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 45%, var(--color-brand-hover-bg) 100%);
  border-radius: 24px;
  padding: 32px 28px 28px;
  text-align: center;
  border: 3px solid rgba(124, 115, 255, 0.4);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  animation: award-card-in 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes award-card-in {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(24px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.award-celebration-kicker {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7c3aed;
}

.award-celebration-title {
  margin: 0 0 16px;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--color-text);
  line-height: 1.15;
}

.award-celebration-image-wrap {
  position: relative;
  margin: 0 auto 16px;
  width: 160px;
  height: 160px;
  min-width: 160px;
  min-height: 160px;
  max-width: 160px;
  max-height: 160px;
  border-radius: 20px;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
  animation: award-img-bounce 0.7s ease 0.15s both;
}

@keyframes award-img-bounce {
  0% {
    transform: scale(0.3) rotate(-8deg);
  }
  60% {
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.award-celebration-overlay .award-celebration-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.award-celebration-student {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-primary-light);
}

.award-celebration-active-note {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.award-celebration-bonus {
  margin: 0 0 18px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #059669;
}

.award-celebration-dismiss {
  min-width: 200px;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 12px;
}

/* Center the button (global .btn is display:flex + mobile width:100% breaks text-align:center) */
.award-celebration-card .btn.award-celebration-dismiss {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}

/* ========== RANDOMIZER ========== */
.randomizer-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

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

.randomizer-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: min(90dvh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.randomizer-panel--draft {
  max-width: 560px;
}

.randomizer-panel--spin {
  max-width: 380px;
  padding: 32px 28px 28px;
}

.randomizer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.randomizer-close:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.55);
  color: var(--color-primary);
}

.randomizer-title {
  margin: 0 48px 8px 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.randomizer-title i {
  color: var(--color-tool-accent-icon);
}

.randomizer-subtitle {
  margin: 0 0 16px;
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.randomizer-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px;
  background: var(--color-tool-inset);
  border: 1px solid rgba(124, 115, 255, 0.25);
  border-radius: 12px;
}

.randomizer-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.randomizer-mode-btn:hover {
  color: var(--color-tool-accent);
  background: rgba(124, 115, 255, 0.08);
}

.randomizer-mode-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.18);
}

.randomizer-pool-grid--single {
  grid-template-columns: 1fr;
}

.randomizer-pool-btn--team {
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
}

.randomizer-pool-btn-meta {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-tool-accent-icon);
  opacity: 0.9;
}

.randomizer-draft-pool-static {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.25);
  border-radius: 10px;
}

.randomizer-team-wrap {
  position: relative;
  margin: 0 auto 12px;
  width: 220px;
  height: 220px;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid rgba(196, 181, 253, 0.5);
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.25) 0%, rgba(30, 27, 75, 0.55) 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.randomizer-panel--spin .randomizer-team-wrap {
  animation: randomizer-slot-shake 0.045s linear infinite;
}

.randomizer-panel--winner .randomizer-team-wrap {
  animation: randomizer-winner-pop 0.275s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  border-color: #fde047;
  box-shadow:
    0 0 0 3px rgba(250, 204, 21, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.5);
}

.randomizer-team-emblem-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 18px;
  filter: contrast(1.05) saturate(1.05) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.randomizer-panel--spin:not(.randomizer-panel--winner) .randomizer-team-emblem-img {
  filter: contrast(1.08) saturate(1.1) blur(0.5px) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.randomizer-team-emblem-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 5.5rem;
  color: #c4b5fd;
  line-height: 1;
}

.randomizer-draft-list-item--team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.randomizer-draft-emblem {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--color-tool-inset-strong);
  border: 1px solid rgba(124, 115, 255, 0.25);
  padding: 2px;
}

.randomizer-draft-emblem-fallback {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(124, 115, 255, 0.12);
  color: var(--color-tool-accent-icon);
  font-size: 0.85rem;
}

.randomizer-spin-meta {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-tool-accent-icon);
}

.randomizer-pool-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.randomizer-pool-btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-tool-accent);
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.randomizer-pool-btn:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.55);
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.randomizer-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(124, 115, 255, 0.2);
  flex-shrink: 0;
}

.randomizer-draft-status-btn,
.randomizer-draft-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-tool-accent);
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.randomizer-draft-status-btn:hover,
.randomizer-draft-reset-btn:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.55);
  color: var(--color-primary);
}

.randomizer-draft-reset-btn {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(255, 251, 235, 0.9);
}

.randomizer-draft-reset-btn:hover {
  background: rgba(254, 243, 199, 0.95);
  border-color: rgba(245, 158, 11, 0.65);
  color: #92400e;
}

.randomizer-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-tool-accent-icon);
  cursor: pointer;
}

.randomizer-back-link:hover {
  color: var(--color-tool-accent);
  text-decoration: underline;
}

.randomizer-draft-pool-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}

.randomizer-draft-pool-select {
  width: 100%;
  margin: 0 0 16px;
  padding: 10px 36px 10px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-primary);
  background-color: var(--color-input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234338ca' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 2px solid var(--color-input-border);
  border-radius: 10px;
  appearance: none;
  cursor: pointer;
}

.randomizer-draft-pool-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.randomizer-draft-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.randomizer-draft-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  background: var(--color-modal-shell-header);
  border: 1px solid rgba(124, 115, 255, 0.25);
  border-radius: 12px;
}

.randomizer-draft-column-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-tool-accent);
  line-height: 1.3;
}

.randomizer-draft-column-title--remaining {
  color: #047857;
}

.randomizer-draft-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 220px;
}

.randomizer-draft-list-item {
  padding: 8px 10px;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid rgba(124, 115, 255, 0.15);
  border-radius: 8px;
}

.randomizer-draft-list-item:last-child {
  margin-bottom: 0;
}

.randomizer-draft-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  font-style: italic;
}

@media (max-width: 520px) {
  .randomizer-draft-columns {
    grid-template-columns: 1fr;
  }

  .randomizer-draft-list {
    max-height: 140px;
  }
}

.randomizer-spin-frame {
  position: relative;
  text-align: center;
}

.randomizer-spin-glow {
  position: absolute;
  left: 50%;
  top: 110px;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(167, 139, 250, 0.45) 0%, transparent 70%);
  pointer-events: none;
  animation: randomizer-pulse 0.275s ease-in-out infinite alternate;
}

@keyframes randomizer-pulse {
  from {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
}

.randomizer-portrait-wrap {
  position: relative;
  margin: 0 auto 16px;
  width: 220px;
  height: 220px;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid rgba(196, 181, 253, 0.5);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.randomizer-panel--spin .randomizer-portrait-wrap {
  animation: randomizer-slot-shake 0.045s linear infinite;
}

.randomizer-panel--winner .randomizer-portrait-wrap {
  animation: randomizer-winner-pop 0.275s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  border-color: #fde047;
  box-shadow:
    0 0 0 3px rgba(250, 204, 21, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.5);
}

@keyframes randomizer-slot-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

@keyframes randomizer-winner-pop {
  0% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}

.randomizer-portrait-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: contrast(1.05) saturate(1.05);
}

.randomizer-panel--spin:not(.randomizer-panel--winner) .randomizer-portrait-img {
  filter: contrast(1.08) saturate(1.1) blur(0.5px);
}

.randomizer-portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 120px;
  color: var(--color-tool-accent-icon);
  background: linear-gradient(180deg, #312e81, #1e1b4b);
}

.randomizer-spin-name {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  min-height: 1.35em;
}

.randomizer-spin-status {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-tool-accent-icon);
}

.randomizer-panel--winner .randomizer-spin-status {
  color: #ca8a04;
}

/* ========== MESSAGE BOARD (Quest Bulletin) ========== */
.mb-root {
  position: relative;
  z-index: 13500;
}

.mb-overlay-inner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.mb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
}

.mb-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: min(92dvh, 880px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(
    165deg,
    var(--color-modal-shell-start) 0%,
    var(--color-selection-muted) 45%,
    var(--color-modal-shell-end) 100%
  );
  border: 2px solid var(--color-modal-shell-border);
  border-radius: 22px;
  box-shadow: var(--shadow-xl);
}

.mb-header {
  position: relative;
  flex-shrink: 0;
  padding: 20px 56px 16px 22px;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 55%, #a855f7 100%);
  color: #fff;
  overflow: hidden;
}

.mb-header-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
}

.mb-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  animation: mb-float 4s ease-in-out infinite alternate;
}

.mb-bubble--1 {
  width: 80px;
  height: 80px;
  top: -20px;
  right: 80px;
}

.mb-bubble--2 {
  width: 48px;
  height: 48px;
  bottom: 8px;
  right: 140px;
  animation-delay: 0.6s;
}

.mb-bubble--3 {
  width: 32px;
  height: 32px;
  top: 20px;
  right: 24px;
  animation-delay: 1.1s;
}

@keyframes mb-float {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-6px) scale(1.05);
  }
}

.mb-header-main {
  position: relative;
  z-index: 1;
}

.mb-title {
  margin: 0 0 4px;
  font-size: 1.45rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.mb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.mb-close:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.04);
}

.mb-feed-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  background:
    radial-gradient(circle at 10% 20%, rgba(167, 139, 250, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 40%);
}

.mb-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mb-loading,
.mb-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.mb-empty i {
  font-size: 2.5rem;
  color: #a78bfa;
  margin-bottom: 12px;
  display: block;
}

.mb-empty--error i {
  color: #ef4444;
}

.mb-msg {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px 12px;
  align-items: start;
  animation: mb-msg-in 0.28s ease-out;
}

.mb-msg--pinned {
  position: relative;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(251, 191, 36, 0.28), transparent 42%),
    linear-gradient(135deg, rgba(255, 251, 235, 0.96) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow:
    0 14px 34px rgba(180, 83, 9, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.74);
}

.mb-msg--pinned::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 5px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
}

.mb-msg--removing {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes mb-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mb-msg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(124, 115, 255, 0.35);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.2);
  background: linear-gradient(135deg, var(--color-selection-muted), var(--color-selection-bg));
}

.mb-msg-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.mb-msg--teacher .mb-msg-avatar {
  border-color: rgba(245, 158, 11, 0.45);
}

.mb-msg--student .mb-msg-avatar {
  border-color: rgba(124, 115, 255, 0.4);
}

.mb-msg--pinned .mb-msg-avatar {
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow:
    0 0 0 4px rgba(245, 158, 11, 0.14),
    0 8px 20px rgba(180, 83, 9, 0.22);
}

.mb-msg-avatar--tip {
  cursor: pointer;
  outline: none;
}

.mb-msg-avatar--tip:hover,
.mb-msg-avatar--tip:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 115, 255, 0.28);
}

.mb-student-tip {
  position: fixed;
  z-index: 13650;
  display: flex;
  align-items: stretch;
  gap: 0;
  width: min(320px, calc(100vw - 24px));
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(124, 115, 255, 0.35);
  background: var(--color-surface, #fff);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.mb-student-tip--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mb-student-tip__preview {
  flex: 0 0 42%;
  min-width: 120px;
  max-width: 140px;
}

.mb-student-tip__bg {
  width: 100%;
  height: 100%;
  min-height: 168px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.mb-student-tip__portrait {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.mb-student-tip__portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 168px;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.55);
}

.mb-student-tip__stats {
  flex: 1;
  min-width: 0;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mb-student-tip__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mb-student-tip__name {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--color-text);
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-student-tip__level {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124, 115, 255, 0.14);
  color: var(--color-primary);
}

.mb-student-tip__team {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.mb-student-tip__class {
  font-size: 0.74rem;
  font-weight: 700;
  align-self: flex-start;
}

.mb-student-tip__stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mb-student-tip__stat-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.mb-student-tip__bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.mb-student-tip__bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.mb-student-tip__bar-fill--hp {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.mb-student-tip__bar-fill--mp {
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
}

.mb-student-tip__bar-fill--xp {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.mb-student-tip__gold {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.74rem;
}

.mb-student-tip__gold-label {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.mb-student-tip__gold-value {
  font-weight: 800;
  color: #d97706;
}

.mb-msg-body {
  min-width: 0;
}

.mb-msg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 6px;
}

.mb-msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.92rem;
}

.mb-team-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--mb-team-color, #7c73ff);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.mb-via {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.mb-team-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-tool-accent-icon);
  background: rgba(99, 102, 241, 0.12);
  padding: 1px 8px;
  border-radius: 999px;
}

.mb-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 6px;
}

.mb-role-badge--teacher {
  background: rgba(245, 158, 11, 0.2);
  color: #b45309;
}

.mb-class-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: capitalize;
  border: 1px solid transparent;
  line-height: 1.35;
}

.mb-class-badge.class-defender,
.mb-class-badge.class-warrior {
  color: #991b1b !important;
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.35);
}

.mb-class-badge.class-wizard,
.mb-class-badge.class-mage {
  color: #1d4ed8 !important;
  background: rgba(59, 130, 246, 0.14) !important;
  border-color: rgba(59, 130, 246, 0.35);
}

.mb-class-badge.class-healer,
.mb-class-badge.class-medic,
.mb-class-badge.class-rogue {
  color: #047857 !important;
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: rgba(16, 185, 129, 0.35);
}

.mb-class-badge.class-tinkerer,
.mb-class-badge.class-paladin,
.mb-class-badge.class-bard {
  color: #b45309 !important;
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(245, 158, 11, 0.38);
}

.mb-msg-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-light);
  white-space: nowrap;
}

.mb-msg-bubble {
  padding: 12px 14px;
  border-radius: 4px 16px 16px 16px;
  background: var(--color-surface);
  border: 1px solid rgba(124, 115, 255, 0.2);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
}

.mb-msg--teacher .mb-msg-bubble {
  background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
  border-color: rgba(245, 158, 11, 0.35);
  border-radius: 16px 4px 16px 16px;
}

.mb-msg--mine .mb-msg-bubble {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.15);
}

.mb-msg--pinned .mb-msg-bubble {
  background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow:
    0 8px 22px rgba(245, 158, 11, 0.2),
    inset 4px 0 0 rgba(245, 158, 11, 0.9);
}

.mb-msg-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-text);
  word-break: break-word;
}

.mb-message-actions {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mb-delete,
.mb-pin {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-light);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mb-msg:hover .mb-delete,
.mb-msg:hover .mb-pin,
.mb-delete:focus-visible,
.mb-pin:focus-visible,
.mb-msg--pinned .mb-pin {
  opacity: 1;
}

.mb-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.mb-pin:hover,
.mb-msg--pinned .mb-pin {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.mb-pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(245, 158, 11, 0.18);
  color: var(--color-warning-banner-text, #92400e);
}

.mb-pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #78350f;
  border: 1px solid rgba(180, 83, 9, 0.22);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.28);
}

.mb-msg--pending .mb-msg-bubble {
  opacity: 0.92;
  border-style: dashed;
}

.mb-moderate-actions {
  display: flex;
  gap: 6px;
}

.mb-approve,
.mb-deny {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mb-approve {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success, #059669);
}

.mb-deny {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.mb-composer {
  flex-shrink: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(124, 115, 255, 0.22);
  background: var(--color-tool-inset);
}

.mb-composer-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-tool-accent-icon);
}

.mb-composer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.mb-input {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  resize: vertical;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mb-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.mb-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.mb-send:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

.mb-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .mb-overlay-inner {
    padding: 0;
    align-items: stretch;
  }

  .mb-panel {
    max-height: 100dvh;
    max-height: 100svh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mb-send span {
    display: none;
  }

  .mb-delete,
  .mb-pin {
    opacity: 1;
  }
}

/* Timer & Stopwatch, light shell (matches give-award picker) */
.tsw-root {
  position: relative;
  z-index: 12000;
}

/* [hidden] must override display rules below (otherwise mini bar stays visible and minimize breaks) */
.tsw-root .tsw-overlay[hidden],
.tsw-root .tsw-mini[hidden],
.tsw-root .tsw-minimize[hidden] {
  display: none !important;
}

.tsw-root .tsw-overlay:not([hidden]) {
  display: flex;
}

.tsw-root .tsw-mini:not([hidden]) {
  display: flex;
}

.tsw-root .tsw-minimize:not([hidden]) {
  display: flex;
}

.tsw-overlay {
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

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

.tsw-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  max-height: min(90dvh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.tsw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(124, 115, 255, 0.2);
  background: var(--color-modal-shell-header);
  flex-shrink: 0;
}

.tsw-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.tsw-title i {
  color: var(--color-tool-accent-icon);
}

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

.tsw-minimize,
.tsw-close {
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.tsw-minimize:hover,
.tsw-close:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.55);
  color: var(--color-primary);
}

.tsw-minimize:active,
.tsw-close:active {
  transform: scale(0.96);
}

.tsw-minimize:focus-visible,
.tsw-close:focus-visible {
  outline: 3px solid rgba(124, 115, 255, 0.55);
  outline-offset: 2px;
}

.tsw-body {
  padding: 20px 22px 22px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.tsw-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tsw-tab {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid rgba(124, 115, 255, 0.3);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tsw-tab:hover {
  background: rgba(124, 115, 255, 0.08);
  border-color: rgba(124, 115, 255, 0.45);
  color: var(--color-primary);
}

.tsw-tab--active {
  background: rgba(124, 115, 255, 0.18);
  border-color: rgba(124, 115, 255, 0.55);
  color: var(--color-primary);
}

.tsw-panels {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tsw-panel-page {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tsw-panel-page--active {
  display: flex;
}

.tsw-display {
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.06em;
  color: var(--color-tool-accent);
  line-height: 1.2;
}

.tsw-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--color-tool-accent);
  opacity: 0.9;
}

.tsw-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tsw-preset {
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid rgba(124, 115, 255, 0.35);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tsw-preset:hover:not(:disabled) {
  background: rgba(124, 115, 255, 0.1);
  border-color: rgba(124, 115, 255, 0.55);
}

.tsw-preset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tsw-custom {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tsw-label {
  font-size: 0.82rem;
  color: var(--color-tool-accent);
  font-weight: 600;
}

.tsw-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tsw-input {
  width: 72px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid rgba(124, 115, 255, 0.35);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
}

.tsw-input:disabled {
  opacity: 0.5;
}

.tsw-colon {
  color: var(--color-tool-accent);
  font-weight: 700;
}

.tsw-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-tool-accent);
  cursor: pointer;
}

.tsw-check input {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
}

.tsw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tsw-btn {
  flex: 1;
  min-width: 88px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(124, 115, 255, 0.35);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tsw-btn:hover:not(:disabled) {
  background: rgba(124, 115, 255, 0.08);
  border-color: rgba(124, 115, 255, 0.5);
}

.tsw-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tsw-btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: rgba(79, 70, 229, 0.85);
  color: #fff;
}

.tsw-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #818cf8, #6366f1);
}

.tsw-lap-head {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-tool-accent);
  padding: 0 4px;
}

.tsw-lap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--color-tool-inset-strong);
  border: 2px solid rgba(124, 115, 255, 0.2);
}

.tsw-lap-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--color-primary);
  border-bottom: 1px solid rgba(124, 115, 255, 0.15);
}

.tsw-lap-row:last-child {
  border-bottom: none;
}

.tsw-mini {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 12001;
  align-items: stretch;
  max-width: calc(100vw - 40px);
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.tsw-mini-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: rgba(124, 115, 255, 0.12);
  color: var(--color-tool-accent);
  font-size: 1.1rem;
}

.tsw-mini-body {
  padding: 10px 12px 10px 10px;
  min-width: 120px;
}

.tsw-mini-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-tool-accent);
  margin-bottom: 2px;
}

.tsw-mini-time {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
}

.tsw-mini-actions {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  min-height: 96px;
  border-left: 1px solid rgba(124, 115, 255, 0.25);
}

.tsw-mini-btn {
  width: 40px;
  flex: 1;
  border: none;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tsw-mini-btn:hover {
  background: rgba(124, 115, 255, 0.12);
  color: var(--color-primary);
}

.tsw-mini-btn + .tsw-mini-btn {
  border-top: 1px solid rgba(124, 115, 255, 0.2);
}

.tsw-mini-btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}

/* ========== Noise Tracker (clean timer-like style) ========== */
.nt-root {
  position: relative;
  z-index: 12000;
}

.nt-root.nt-root--combat-pending {
  z-index: 5000;
  pointer-events: none;
}

.nt-root .nt-overlay[hidden],
.nt-root .nt-runtime[hidden],
.nt-root .nt-mini[hidden] {
  display: none !important;
}

.nt-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

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

.nt-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  max-height: min(90dvh, 860px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--color-modal-shell-border);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
}

.nt-panel::before {
  display: none;
}

.nt-runtime {
  position: fixed;
  inset: 0;
  z-index: 12002;
  overflow: hidden;
}

.nt-runtime-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nt-runtime-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 58%, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.52) 78%),
    linear-gradient(180deg, rgba(10, 10, 25, 0.12) 0%, rgba(10, 10, 25, 0.4) 100%);
}

.nt-runtime-topbar {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.nt-runtime-top-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
}

.nt-runtime-top-btn:hover {
  background: rgba(79, 70, 229, 0.55);
}

.nt-runtime-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(760px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.nt-runtime-timer {
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
  letter-spacing: 0.04em;
}

.nt-runtime-timer[hidden] {
  display: none !important;
}

.nt-runtime-meter-wrap {
  width: 100%;
}

.nt-runtime-meter-wrap .nt-volume-meter-track {
  height: 28px;
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.95);
}

.nt-runtime-meter-wrap .nt-volume-meter-fill {
  background: linear-gradient(90deg, #7c3aed 0%, #a855f7 100%);
}

.nt-runtime-meter-wrap .nt-volume-meter-threshold {
  background: #ef4444;
  width: 3px;
}

.nt-runtime-meter-wrap .nt-volume-meter-max {
  color: #fff;
}

.nt-runtime-meter-wrap .nt-volume-meter-scale {
  color: rgba(255, 255, 255, 0.75);
}

.nt-runtime-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 140px 18px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(124, 115, 255, 0.2);
  color: #1f2937;
}

.nt-runtime-stakes {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  font-size: 1.08rem;
  font-weight: 700;
  color: #1f2937;
  text-align: center;
}

.nt-runtime-stakes .nt-stake {
  font-size: 1.12rem;
  font-weight: 800;
}

.nt-runtime-stakes-sep {
  color: #9ca3af;
  opacity: 1;
  font-weight: 500;
}

html[data-theme='dark'] .nt-runtime-footer {
  background: rgba(15, 23, 42, 0.94);
  border-top-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

html[data-theme='dark'] .nt-runtime-stakes {
  color: #f1f5f9;
}

html[data-theme='dark'] .nt-runtime-stakes-sep {
  color: #94a3b8;
}

html[data-theme='dark'] .nt-runtime-stakes .nt-stake--xp {
  color: #a5b4fc;
}

html[data-theme='dark'] .nt-runtime-stakes .nt-stake--gp {
  color: #fbbf24;
}

html[data-theme='dark'] .nt-runtime-stakes .nt-stake--hp {
  color: #f87171;
}

.nt-stake--xp {
  color: #6366f1;
}

.nt-stake--gp {
  color: #d97706;
}

.nt-stake--hp {
  color: #dc2626;
}

.nt-runtime-finish {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  flex-shrink: 0;
  min-width: 120px;
  padding: 12px 24px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nt-runtime-finish:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.nt-header,
.nt-body {
  position: relative;
  z-index: 1;
}

.nt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(124, 115, 255, 0.2);
  background: var(--color-modal-shell-header);
  flex-shrink: 0;
}

.nt-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nt-title i {
  color: var(--color-tool-accent-icon);
}

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

.nt-minimize,
.nt-close {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nt-minimize:hover,
.nt-close:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.55);
}

.nt-body {
  padding: 20px 22px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.nt-hero {
  background: var(--color-tool-inset);
  border: 1px solid rgba(124, 115, 255, 0.22);
  border-radius: 14px;
  padding: 12px 14px;
}

.nt-hero h3 {
  margin: 0 0 4px;
  color: var(--color-primary);
  font-size: 1.1rem;
}

.nt-hero p {
  margin: 0;
  color: var(--color-tool-hero-subtext);
  font-size: 0.92rem;
}

.nt-surface {
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.22);
  border-radius: 14px;
  padding: 14px;
}

.nt-live-card {
  padding: 12px;
}

.nt-live-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.nt-live-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nt-live-stat span {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.nt-live-stat strong {
  color: var(--color-text);
  font-size: 1.2rem;
}

.nt-meter {
  position: relative;
  margin-top: 10px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(124, 115, 255, 0.28);
  background: var(--color-surface);
  overflow: hidden;
}

.nt-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e 0%, #facc15 55%, #ef4444 100%);
  transition: width 80ms linear;
}

.nt-meter-threshold {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(124, 115, 255, 0.35);
}

.nt-live-foot {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.nt-status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.nt-status-idle {
  background: rgba(107, 114, 128, 0.12);
  color: var(--color-text-secondary);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.nt-status-running {
  background: var(--color-tool-status-success-bg);
  color: var(--color-tool-status-success);
}

.nt-status-paused {
  background: rgba(250, 204, 21, 0.22);
  color: #854d0e;
}

.nt-live-hint {
  color: var(--color-tool-accent);
  opacity: 0.85;
  font-size: 0.8rem;
}

.nt-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nt-control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nt-field--full {
  width: 100%;
}

.nt-field > span {
  font-size: 0.82rem;
  color: var(--color-text);
  font-weight: 600;
}

.nt-select,
.nt-field input[type='number'] {
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 10px;
}

.nt-input-compact {
  width: 88px;
  text-align: center;
  font-weight: 700;
}

.nt-device-row,
.nt-range-row,
.nt-duration-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nt-range-row input[type='range'] {
  flex: 1;
  accent-color: var(--color-primary);
  height: 6px;
  cursor: pointer;
}

.nt-root input[type='range'] {
  accent-color: var(--color-primary);
}

.nt-duration-row {
  justify-content: flex-start;
}

.nt-duration-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.nt-duration-block small {
  color: var(--color-tool-accent);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.nt-duration-sep {
  color: var(--color-tool-accent);
  font-weight: 800;
  margin-top: -12px;
}

.nt-section-title {
  margin: 4px 4px 0;
  color: var(--color-primary);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nt-effects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nt-effect-card {
  border-radius: 14px;
  border: 2px solid rgba(124, 115, 255, 0.22);
  background: var(--color-surface);
  padding: 10px;
}

.nt-effect-card h4 {
  margin: 0 0 8px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nt-effect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nt-effect-stat {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.nt-effect-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
}

.nt-effect-stat-input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 10px;
  font-weight: 600;
  text-align: center;
}

.nt-effect-stat-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 115, 255, 0.2);
}

.nt-spell-field {
  margin-top: 8px;
}

.nt-actions {
  display: flex;
  gap: 8px;
}

.nt-btn {
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--color-primary);
  background: var(--color-surface);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nt-btn:hover:not(:disabled) {
  background: rgba(124, 115, 255, 0.08);
}

.nt-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nt-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary-dark);
  color: var(--color-on-primary);
}

.nt-btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.nt-btn-light {
  background: var(--color-surface);
  border-color: rgba(124, 115, 255, 0.35);
  color: var(--color-primary);
}

.nt-btn-light:hover:not(:disabled) {
  background: rgba(124, 115, 255, 0.08);
  border-color: rgba(124, 115, 255, 0.5);
}

.nt-btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: rgba(220, 38, 38, 0.7);
  color: #fff;
}

.nt-mini {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 12001;
  display: flex;
  align-items: stretch;
  max-width: calc(100vw - 40px);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.nt-mini-dragon {
  width: 60px;
  object-fit: cover;
}

.nt-mini-body {
  padding: 8px 10px;
  min-width: 120px;
}

.nt-mini-label {
  color: var(--color-tool-accent);
  text-transform: uppercase;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.nt-mini-time {
  color: var(--color-primary);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
}

.nt-mini-level {
  color: var(--color-tool-accent);
  font-size: 0.72rem;
}

.nt-mini-actions {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(124, 115, 255, 0.25);
}

.nt-mini-btn {
  width: 36px;
  flex: 1;
  border: none;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
}

.nt-mini-btn + .nt-mini-btn {
  border-top: 1px solid rgba(124, 115, 255, 0.22);
}

.nt-mini-btn:hover {
  background: rgba(124, 115, 255, 0.12);
}

.nt-mini-btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.nt-fail-overlay,
.nt-outcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 12250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.nt-fail-backdrop,
.nt-outcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.nt-fail-card,
.nt-outcome-card {
  position: relative;
  z-index: 1;
  width: min(560px, 96vw);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(251, 191, 36, 0.55);
  background: linear-gradient(180deg, #2f1308, #160904);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
  padding: 20px 18px 16px;
}

.nt-outcome-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
}

.nt-fail-card h3,
.nt-outcome-card h3 {
  margin: 0 0 6px;
  color: #fef3c7;
}

.nt-fail-card p,
.nt-outcome-card p,
.nt-outcome-kicker {
  color: #fdba74;
  margin: 0;
}

.nt-fail-actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nt-fail-actions .nt-btn {
  flex: 1;
}

.nt-outcome-kicker {
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.72rem;
}

.nt-outcome-pills {
  margin: 10px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nt-outcome-pill {
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  padding: 4px 10px;
  font-size: 0.8rem;
}

@media (max-width: 860px) {
  .nt-control-row,
  .nt-effects {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .nt-live-top {
    grid-template-columns: 1fr;
  }
}

/* Noise tracker, setup wizard */
.nt-setup-wizard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nt-setup-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nt-setup-step-pill {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid rgba(124, 115, 255, 0.3);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nt-setup-step-pill:hover {
  background: rgba(124, 115, 255, 0.08);
  border-color: rgba(124, 115, 255, 0.45);
  color: var(--color-primary);
}

.nt-setup-step-pill--active {
  border-color: rgba(124, 115, 255, 0.55);
  background: rgba(124, 115, 255, 0.18);
  color: var(--color-primary);
}

.nt-setup-step-pill--done {
  border-color: rgba(124, 115, 255, 0.4);
  color: var(--color-text);
}

.nt-setup-step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 115, 255, 0.15);
  color: var(--color-text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nt-setup-step-pill--active .nt-setup-step-num {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.nt-setup-step-pill--done .nt-setup-step-num {
  background: rgba(124, 115, 255, 0.28);
  color: var(--color-primary);
}

.nt-step-intro h3 {
  margin: 0 0 4px;
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 700;
}

.nt-step-intro p {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.nt-calibrate-card {
  padding: 12px;
}

.nt-meter--large {
  height: 22px;
  margin-bottom: 10px;
}

.nt-calibrate-stats {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.nt-preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nt-preset-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.nt-preset-btn {
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 10px;
  padding: 8px 14px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nt-preset-btn:hover {
  background: rgba(124, 115, 255, 0.1);
  border-color: rgba(124, 115, 255, 0.55);
}

.nt-duration-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.nt-duration-preset {
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nt-duration-preset--active,
.nt-duration-preset:hover {
  border-color: rgba(124, 115, 255, 0.55);
  background: rgba(124, 115, 255, 0.18);
}

.nt-outcome-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.nt-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid rgba(124, 115, 255, 0.22);
  border-radius: 12px;
  background: var(--color-surface);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
}

.nt-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.nt-setup-nav {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
}

.nt-setup-nav-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.nt-btn-reset {
  color: var(--color-text-secondary);
  border-color: rgba(124, 115, 255, 0.28);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.nt-btn-reset:hover:not(:disabled) {
  color: var(--color-primary);
  border-color: rgba(124, 115, 255, 0.45);
  background: rgba(124, 115, 255, 0.06);
}

.nt-setup-nav .nt-btn-primary {
  margin-left: 0;
}

.nt-finish-card h3 {
  color: #e0e7ff;
}

.nt-finish-card p {
  color: #c7d2fe;
}

.nt-fail-actions .nt-btn {
  flex: none;
  width: 100%;
}

/* Runtime live-adjust drawer */
.nt-runtime-drawer {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 3;
  width: min(420px, calc(100vw - 28px));
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(15, 15, 28, 0.92);
  backdrop-filter: blur(10px);
  padding: 12px 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.nt-runtime-drawer[hidden] {
  display: none !important;
}

.nt-runtime-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.nt-runtime-drawer-head h4 {
  margin: 0;
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nt-runtime-drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.nt-runtime-drawer .nt-field > span {
  color: #cbd5e1;
}

.nt-runtime-drawer .nt-preset-btn {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

.nt-runtime-drawer .nt-preset-btn:hover {
  background: rgba(99, 102, 241, 0.35);
}

.nt-runtime-drawer .nt-rt-threshold-val,
.nt-runtime-drawer .nt-rt-sensitivity-val {
  color: #f8fafc;
  min-width: 28px;
  text-align: center;
}

.nt-runtime-full-setup {
  width: 100%;
  margin-top: 8px;
  border-color: rgba(255, 255, 255, 0.35) !important;
  color: #e2e8f0 !important;
}

/* Simplified Classcraft-style setup */
.nt-panel--simple {
  max-width: 560px;
}

.nt-header--simple {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 16px 0;
  border-bottom: none;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.nt-close--plain {
  position: static;
}

.nt-body--simple {
  padding: 8px 32px 28px;
  text-align: center;
}

.nt-page-title {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
}

.nt-page-sub {
  margin: 0 0 28px;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.nt-stakes-block {
  margin-bottom: 24px;
}

.nt-stakes-heading {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.nt-stakes-hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.nt-stakes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 360px;
  margin: 0 auto;
}

.nt-stakes-row--3 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 420px;
}

.nt-stake-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.nt-stake-field > span {
  font-size: 0.88rem;
  font-weight: 700;
}

.nt-stake-field--xp > span {
  color: #6366f1;
}

.nt-stake-field--gp > span {
  color: #d97706;
}

.nt-stake-field--hp > span {
  color: #dc2626;
}

.nt-stake-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid rgba(124, 115, 255, 0.25);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
}

.nt-stake-field--xp .nt-stake-input {
  color: #6366f1;
}

.nt-stake-field--gp .nt-stake-input {
  color: #d97706;
}

.nt-stake-input:focus {
  outline: none;
  border-color: rgba(124, 115, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.nt-add-timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 2px dashed rgba(124, 115, 255, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.nt-add-timer-btn:hover {
  border-color: rgba(124, 115, 255, 0.55);
  color: var(--color-primary);
}

.nt-timer-fields {
  margin-top: 4px;
}

.nt-timer-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.nt-timer-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.nt-timer-input {
  width: 100px;
  padding: 12px 14px;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid rgba(124, 115, 255, 0.25);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
}

.nt-timer-input:focus {
  outline: none;
  border-color: rgba(124, 115, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.nt-timer-field > span {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.nt-remove-timer-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border: none;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.nt-remove-timer-btn:hover {
  background: rgba(239, 68, 68, 0.22);
}

.nt-setup-nav--simple {
  margin-top: 32px;
  justify-content: flex-end;
  border-top: none;
  padding-top: 0;
}

.nt-setup-nav--split {
  justify-content: space-between;
}

.nt-btn-next {
  min-width: 120px;
  padding: 12px 28px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nt-calibrate-foot {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.nt-sensitivity {
  width: 100%;
  max-width: 520px;
  margin: 24px auto 0;
  text-align: left;
}

.nt-sensitivity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.nt-sensitivity-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
}

.nt-sensitivity-value {
  font-size: 0.85rem;
  font-weight: 800;
  color: #7c3aed;
  min-width: 36px;
  text-align: right;
}

.nt-sensitivity-slider {
  display: block;
  width: 100%;
  margin: 0;
  accent-color: #7c3aed;
  cursor: pointer;
}

.nt-sensitivity-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.nt-sensitivity-hint {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Unified volume meter with live threshold slider */
.nt-volume-meter {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.nt-volume-meter-track {
  position: relative;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(124, 115, 255, 0.28);
  background: var(--color-surface);
  overflow: visible;
}

.nt-volume-meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed 0%, #a855f7 100%);
  transition: width 80ms linear;
  pointer-events: none;
}

.nt-volume-meter-threshold {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 3px;
  transform: translateX(-50%);
  background: #ec4899;
  box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.35);
  pointer-events: none;
  z-index: 2;
}

.nt-volume-meter-max {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ec4899;
  white-space: nowrap;
}

.nt-volume-meter-slider {
  position: absolute;
  inset: -8px 0;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 3;
}

.nt-volume-meter-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-weight: 600;
}

@media (max-width: 680px) {
  .nt-body--simple {
    padding: 8px 18px 22px;
  }

  .nt-stakes-row--3 {
    grid-template-columns: 1fr;
    max-width: 200px;
  }

  .nt-runtime-footer {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 18px;
    text-align: center;
  }

  .nt-runtime-stakes {
    justify-content: center;
    font-size: 1rem;
  }

  .nt-runtime-stakes-sep {
    display: none;
  }

  .nt-runtime-finish {
    position: static;
    transform: none;
    width: 100%;
    margin-top: 12px;
  }
}

/* ========== 3D Dice Roller (light shell, matches timer / randomizer) ========== */
.dice-roller-root {
  position: relative;
  z-index: 12000;
}

.dice-roller-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px 28px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.dice-roller-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
}

.dice-roller-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(calc(100dvh - 48px), 980px);
  min-height: 0;
  margin-top: auto;
  margin-bottom: auto;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.dice-roller-panel--wide {
  max-width: min(96vw, 1080px);
  width: min(96vw, 1080px);
  height: min(calc(100dvh - 40px), 900px);
  max-height: min(calc(100dvh - 40px), 900px);
}

.dice-roller-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(124, 115, 255, 0.2);
  background: var(--color-modal-shell-header);
  flex-shrink: 0;
}

.dice-roller-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.dice-roller-title i {
  color: var(--color-tool-accent-icon);
}

.dice-roller-close {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.dice-roller-close:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.55);
  color: var(--color-primary);
}

.dice-roller-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.dice-roller-toolbar {
  position: relative;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 10px 20px 4px;
  z-index: 4;
}

.dice-roller-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: 100%;
  padding: 12px 22px;
  border: 2px solid rgba(124, 115, 255, 0.45);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.dice-roller-pick-btn:hover,
.dice-roller-pick-btn--open {
  background: rgba(124, 115, 255, 0.1);
  border-color: rgba(124, 115, 255, 0.65);
}

.dice-roller-pick-btn-label {
  white-space: nowrap;
}

.dice-roller-pick-summary {
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-tool-accent-icon);
  max-width: min(70vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dice-roller-pick-chevron {
  font-size: 0.75rem;
  color: var(--color-tool-accent-icon);
  transition: transform 0.2s ease;
}

.dice-roller-pick-btn--open .dice-roller-pick-chevron {
  transform: rotate(180deg);
}

.dice-roller-pick-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 520px);
  max-height: min(42vh, 360px);
  overflow-y: auto;
  padding: 14px 16px 16px;
  background: var(--color-surface);
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(49, 46, 129, 0.22);
  -webkit-overflow-scrolling: touch;
}

.dice-roller-pick-menu--hidden {
  display: none;
}

.dice-roller-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 18px 10px;
}

.dice-roller-footer {
  flex-shrink: 0;
  padding: 12px 18px 18px;
  border-top: 1px solid rgba(124, 115, 255, 0.2);
  background: var(--color-tool-inset-strong);
  backdrop-filter: blur(8px);
}

.dice-roller-hint {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.dice-roller-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

@media (max-width: 480px) {
  .dice-roller-grid {
    grid-template-columns: 1fr;
  }
}

.dice-roller-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid rgba(124, 115, 255, 0.22);
  border-radius: 12px;
}

.dice-roller-die-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-primary);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
}

.dice-roller-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dice-roller-step {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(124, 115, 255, 0.35);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-tool-accent);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dice-roller-step:hover {
  background: rgba(124, 115, 255, 0.12);
  border-color: rgba(124, 115, 255, 0.5);
  color: var(--color-primary);
}

.dice-roller-count {
  min-width: 28px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--color-tool-accent);
  font-family: 'Cinzel', serif;
}

.dice-roller-viewport-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-end);
}

.dice-roller-panel--wide .dice-roller-viewport {
  width: 100%;
  flex: 1;
  min-height: min(58vh, 620px);
  height: 100%;
  position: relative;
  background: var(--color-modal-shell-end);
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.dice-roller-viewport {
  width: 100%;
  height: min(36vh, 280px);
  min-height: 200px;
  position: relative;
  background: var(--color-modal-shell-end);
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

/* WebGLRenderer sets canvas pixel size; do not override with 100%×100% !important */
.dice-roller-viewport canvas {
  display: block;
  flex-shrink: 0;
}

.dice-roller-swipe-hint {
  margin: 0;
  padding: 8px 12px 10px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-align: center;
  background: var(--color-tool-inset);
  border-top: 1px solid var(--color-border);
}

.dice-roller-result {
  flex-shrink: 0;
  min-height: 3rem;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--color-tool-inset-strong);
  border: 2px solid rgba(124, 115, 255, 0.28);
  font-family: 'Cinzel', serif;
  font-size: clamp(1.1rem, 2.5vw, 1.65rem);
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  line-height: 1.4;
  word-break: break-word;
  letter-spacing: 0.02em;
}

.dice-roller-panel--wide .dice-roller-result:not(:empty) {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
}

.dice-roller-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin: 0;
}

.dice-roller-btn {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.dice-roller-btn--ghost {
  background: var(--color-surface);
  border-color: rgba(124, 115, 255, 0.35);
  color: var(--color-tool-accent);
}

.dice-roller-btn--ghost:hover {
  background: rgba(124, 115, 255, 0.08);
  border-color: rgba(124, 115, 255, 0.5);
  color: var(--color-primary);
}

.dice-roller-btn--primary {
  background: linear-gradient(135deg, #7c73ff 0%, #667eea 100%);
  border-color: rgba(102, 126, 234, 0.5);
  color: #fff;
}

.dice-roller-btn--primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .dice-roller-overlay {
    padding: 12px 8px 16px;
  }

  .dice-roller-panel--wide {
    width: 100%;
    max-width: 100%;
    height: min(calc(100dvh - 24px), 100%);
    max-height: min(calc(100dvh - 24px), 100%);
    border-radius: 16px;
  }

  .dice-roller-panel--wide .dice-roller-viewport {
    min-height: min(50vh, 480px);
  }

  .dice-roller-pick-menu {
    width: calc(100vw - 40px);
    max-width: none;
  }

  .dice-roller-pick-summary {
    max-width: 55vw;
  }
}

/* ======================================================================== */
/* GIVE REWARD FLOW                                                          */
/* ======================================================================== */

/* ── Picker overlay ─────────────────────────────────────────────────────── */
.give-reward-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.give-reward-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 30, 0.72);
  backdrop-filter: blur(4px);
}

.give-reward-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: min(calc(100dvh - 32px), 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-reward-shell-start) 0%, var(--color-reward-shell-end) 100%);
  border: 2px solid var(--color-reward-border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  color: var(--color-text);
}

.give-reward-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  flex-shrink: 0;
}

.give-reward-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.02em;
}

.give-reward-close {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s, border-color 0.15s;
}

.give-reward-close:hover {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ── Recipients section ─────────────────────────────────────────────────── */
.give-reward-recipients-section {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--color-reward-border);
  flex-shrink: 0;
  background: transparent;
}

.give-reward-recipients-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-reward-accent);
  display: block;
  margin-bottom: 8px;
}

.give-reward-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  margin-bottom: 10px;
}

.give-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--color-reward-chip-bg);
  border: 1.5px solid var(--color-reward-chip-border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-reward-chip-text);
}

.give-reward-chip--everyone {
  background: linear-gradient(90deg, #10b981, #059669);
  border-color: #047857;
  color: #fff;
}

.give-reward-chip-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.give-reward-chip-remove {
  border: none;
  background: none;
  color: #15803d;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.give-reward-chip-remove:hover { opacity: 1; }

.give-reward-add-picker-mount {
  width: 100%;
}

.give-reward-team-btn,
.give-reward-everyone-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--color-reward-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-reward-accent);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.give-reward-team-btn:hover:not(:disabled) {
  background: #3b82f6;
  border-color: #2563eb;
  color: #fff;
}

.give-reward-everyone-btn:hover,
.give-reward-everyone-btn--active {
  background: #10b981;
  border-color: #059669;
  color: #fff;
}

/* ── Loading / empty ────────────────────────────────────────────────────── */
.give-reward-loading {
  padding: 24px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.give-reward-loading--hidden { display: none; }

.give-reward-empty {
  padding: 20px 18px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.give-reward-empty--hidden { display: none; }

/* ── Reward grid ────────────────────────────────────────────────────────── */
.give-reward-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.give-reward-grid--hidden { display: none; }

/* ── Reward tile ────────────────────────────────────────────────────────── */
.give-reward-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 2px solid rgba(16, 185, 129, 0.2);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.1s;
  position: relative;
}

.give-reward-tile:hover {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.give-reward-tile--selected {
  border-color: var(--color-reward-selection-border);
  background: var(--color-reward-selection-bg);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.give-reward-tile-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  position: relative;
}

.give-reward-tile-spell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  background: #7c3aed;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.55rem;
}

.give-reward-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.give-reward-tile-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.give-reward-tile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.give-reward-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.give-reward-stat--hp { background: #fee2e2; color: #dc2626; }
.give-reward-stat--mp { background: #dbeafe; color: #2563eb; }
.give-reward-stat--xp { background: #dcfce7; color: #16a34a; }
.give-reward-stat--gp { background: #fef9c3; color: #ca8a04; }

.give-reward-tile-bonus {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.give-reward-tile-check {
  flex-shrink: 0;
  font-size: 1.4rem;
  color: #10b981;
  opacity: 0;
  transition: opacity 0.15s;
}

.give-reward-tile--selected .give-reward-tile-check { opacity: 1; }

.give-reward-tile--custom {
  border-style: dashed;
}

.give-reward-custom-wrap {
  flex-shrink: 0;
  padding: 0 14px 12px;
}

.give-reward-custom-wrap--hidden {
  display: none;
}

.give-reward-custom-form {
  padding: 14px;
  border-radius: 12px;
  background: var(--color-reward-custom-form-bg);
  border: 1px solid var(--color-reward-border);
}

.give-reward-custom-form-hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.give-reward-custom-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.give-reward-custom-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

.give-reward-custom-field--wide {
  grid-column: 1 / -1;
}

.give-reward-custom-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  font: inherit;
  background: var(--color-surface);
}

.give-reward-custom-field input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.give-reward-footer {
  flex-shrink: 0;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--color-reward-border);
  background: var(--color-modal-shell-header);
  backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.give-reward-footer--hidden { display: none; }

.give-reward-hint {
  margin: 0;
  font-size: 0.84rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.give-reward-confirm {
  flex-shrink: 0;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: var(--color-on-primary);
  font-weight: 700;
  padding: 10px 22px;
  font-size: 0.95rem;
}

.give-reward-confirm:disabled {
  background: var(--color-border);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
  opacity: 1;
  cursor: not-allowed;
}

.give-reward-confirm--busy { opacity: 0.7; cursor: wait; }

/* ======================================================================== */
/* REWARD CELEBRATION OVERLAY                                               */
/* ======================================================================== */

.reward-celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: rewardCelFadeIn 0.25s ease;
}

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

.reward-celebration-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 50, 20, 0.8);
  backdrop-filter: blur(6px);
}

.reward-celebration-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reward-celebration-card {
  position: relative;
  z-index: 2;
  width: min(92vw, 440px);
  background: linear-gradient(180deg, #f0fff4 0%, #dcfce7 60%, #bbf7d0 100%);
  border: 3px solid #10b981;
  border-radius: 24px;
  box-shadow: 0 32px 100px rgba(16, 185, 129, 0.4), 0 0 0 8px rgba(16, 185, 129, 0.12);
  padding: 36px 32px 28px;
  text-align: center;
  animation: rewardCelPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
}

@keyframes rewardCelPop {
  from { transform: scale(0.72) translateY(30px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.reward-celebration-burst {
  position: absolute;
  inset: -60px;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.22) 0%, transparent 70%);
  animation: rewardBurstPulse 1.8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes rewardBurstPulse {
  from { transform: scale(0.85); opacity: 0.6; }
  to   { transform: scale(1.15); opacity: 1; }
}

/* Particles */
.reward-celebration-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.reward-particle {
  --d: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: hsl(calc(var(--d) * 18deg), 80%, 58%);
  animation: rewardParticleOut 1.6s calc(var(--d) * 0.04s) ease-out forwards;
}

@keyframes rewardParticleOut {
  0%   { transform: translate(-50%,-50%) rotate(calc(var(--d) * 18deg)) translateX(0); opacity: 1; }
  100% { transform: translate(-50%,-50%) rotate(calc(var(--d) * 18deg)) translateX(160px); opacity: 0; }
}

.reward-celebration-kicker {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #059669;
}

.reward-celebration-title {
  margin: 0 0 18px;
  font-size: 1.85rem;
  font-weight: 900;
  color: #064e3b;
  line-height: 1.15;
}

.reward-celebration-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.reward-celebration-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  color: #fff;
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
  animation: rewardIconBounce 0.6s 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes rewardIconBounce {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.reward-celebration-student {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #065f46;
}

.reward-celebration-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.reward-cel-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.reward-cel-stat--hp { background: #fee2e2; color: #dc2626; }
.reward-cel-stat--mp { background: #dbeafe; color: #2563eb; }
.reward-cel-stat--xp { background: #dcfce7; color: #16a34a; }
.reward-cel-stat--gp { background: #fef9c3; color: #b45309; }

.reward-cel-spell-note {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: #7c3aed;
  font-weight: 600;
}

.reward-celebration-dismiss {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: #fff;
  font-weight: 700;
  padding: 12px 32px;
  font-size: 1rem;
  width: 100%;
  margin-top: 4px;
}

.reward-celebration-dismiss:hover {
  filter: brightness(1.07);
}

/* ======================================================================== */
/* LEVEL UP MODAL                                                            */
/* ======================================================================== */

.level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: levelUpFadeIn 0.2s ease;
}

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

.level-up-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 30, 0.88);
  backdrop-filter: blur(8px);
}

.level-up-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spinning rays behind the card */
.level-up-rays {
  position: absolute;
  width: 600px;
  height: 600px;
  pointer-events: none;
  animation: levelUpRaysSpin 8s linear infinite;
}

@keyframes levelUpRaysSpin {
  to { transform: rotate(360deg); }
}

.level-up-ray {
  --r: 0deg;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 280px;
  transform-origin: top center;
  transform: translateX(-50%) rotate(var(--r));
  background: linear-gradient(to bottom, rgba(250, 204, 21, 0.5), transparent);
  border-radius: 2px;
}

/* Particles */
.level-up-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.level-up-particle {
  --d: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: hsl(calc(var(--d) * 15deg + 40deg), 90%, 62%);
  animation: levelUpParticle 2.2s calc(var(--d) * 0.06s) ease-out infinite;
}

@keyframes levelUpParticle {
  0%   { transform: translate(-50%,-50%) rotate(calc(var(--d)*15deg)) translateX(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 0.8; }
  100% { transform: translate(-50%,-50%) rotate(calc(var(--d)*15deg)) translateX(220px) rotate(360deg); opacity: 0; }
}

.level-up-card {
  position: relative;
  z-index: 2;
  width: min(92vw, 460px);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 40%, #1e1b4b 100%);
  border: 3px solid #facc15;
  border-radius: 24px;
  padding: 32px 28px 28px;
  text-align: center;
  box-shadow:
    0 0 0 6px rgba(250, 204, 21, 0.2),
    0 32px 100px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255,255,255,0.08);
  outline: none;
  animation: levelUpCardPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes levelUpCardPop {
  from { transform: scale(0.6) translateY(40px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.level-up-flash-ring {
  position: absolute;
  inset: -8px;
  border-radius: 28px;
  border: 3px solid rgba(250, 204, 21, 0.6);
  animation: levelUpFlash 1.4s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes levelUpFlash {
  from { opacity: 0.3; box-shadow: 0 0 20px rgba(250, 204, 21, 0.3); }
  to   { opacity: 1;   box-shadow: 0 0 50px rgba(250, 204, 21, 0.7); }
}

.level-up-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
  color: #1c1917;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 20px;
  box-shadow: 0 4px 18px rgba(250, 204, 21, 0.5);
  animation: levelUpBadgePop 0.6s 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes levelUpBadgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.level-up-badge-arrow {
  font-size: 1rem;
  animation: levelUpArrowPulse 0.7s ease-in-out infinite alternate;
}

@keyframes levelUpArrowPulse {
  from { transform: translateY(0); }
  to   { transform: translateY(-3px); }
}

/* Old level → arrow → new level */
.level-up-number-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}

.level-up-old-level {
  font-size: 2.8rem;
  font-weight: 900;
  color: rgba(255,255,255,0.35);
  font-family: 'Cinzel', serif;
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.3);
}

.level-up-arrow-icon {
  font-size: 1.8rem;
  color: #facc15;
  animation: levelUpArrowSlide 0.9s ease-in-out infinite alternate;
}

@keyframes levelUpArrowSlide {
  from { transform: translateX(-3px); opacity: 0.7; }
  to   { transform: translateX(3px); opacity: 1; }
}

.level-up-new-level {
  font-size: 4.5rem;
  font-weight: 900;
  color: #facc15;
  font-family: 'Cinzel', serif;
  text-shadow: 0 0 40px rgba(250, 204, 21, 0.9), 0 4px 16px rgba(0,0,0,0.5);
  line-height: 1;
  animation: levelUpNewLevelPulse 1.2s ease-in-out infinite alternate;
}

@keyframes levelUpNewLevelPulse {
  from { text-shadow: 0 0 30px rgba(250, 204, 21, 0.7), 0 4px 16px rgba(0,0,0,0.5); }
  to   { text-shadow: 0 0 60px rgba(250, 204, 21, 1), 0 4px 30px rgba(0,0,0,0.6); }
}

.level-up-name {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.level-up-class {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  text-transform: capitalize;
}

.level-up-subtitle {
  margin: 0 0 20px;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.75);
  font-style: italic;
}

.level-up-multi {
  margin: -8px 0 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 8px;
  padding: 4px 12px;
  display: inline-block;
}

.level-up-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.level-up-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 10px 18px;
  min-width: 110px;
}

.level-up-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.level-up-stat-hp { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.level-up-stat-mp { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }

.level-up-stat-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.level-up-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.level-up-stat-value {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  font-family: 'Cinzel', serif;
  line-height: 1;
}

.level-up-dismiss {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
  border-color: #d97706;
  color: #1c1917;
  letter-spacing: 0.03em;
  transition: filter 0.15s, transform 0.1s;
}

.level-up-dismiss:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ── Level-up: new spells ───────────────────────────────────────────────── */
.level-up-new-spells {
  margin: 0 0 20px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
}

.level-up-new-spells-label {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c4b5fd;
  display: flex;
  align-items: center;
  gap: 6px;
}

.level-up-spell-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-up-spell-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 10px;
  padding: 7px 10px;
}

.level-up-spell-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.level-up-spell-icon--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 58, 237, 0.3);
  color: #c4b5fd;
  font-size: 1rem;
  border-radius: 8px;
}

.level-up-spell-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.level-up-spell-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-up-spell-cost {
  font-size: 0.75rem;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ============================================================
   GROUP LEVEL-UP OVERLAY  (.level-up-group-overlay)
   Shown when 2+ students level up from the same reward grant.
   ============================================================ */

.level-up-group-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.lug-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(3px);
}

/* -- Scene shell -- */
.lug-scene {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* -- Background rays -- */
.lug-rays {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: lugRaysSpin 18s linear infinite;
}
@keyframes lugRaysSpin { to { transform: rotate(360deg); } }

.lug-ray {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 55vmax;
  margin-left: -1.5px;
  transform-origin: top center;
  transform: rotate(var(--r)) translateY(-50%);
  background: linear-gradient(to bottom, rgba(251,191,36,0.18) 0%, transparent 100%);
  border-radius: 2px;
}

/* -- Particles -- */
.lug-parts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lug-part {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: lugPartBurst 1.8s ease-out calc(var(--d) * 0.07s) both;
}

.lug-part:nth-child(6n+1) { background: #fbbf24; }
.lug-part:nth-child(6n+2) { background: #f472b6; }
.lug-part:nth-child(6n+3) { background: #34d399; }
.lug-part:nth-child(6n+4) { background: #60a5fa; }
.lug-part:nth-child(6n+5) { background: #a78bfa; }
.lug-part:nth-child(6n+6) { background: #fb923c; }

@keyframes lugPartBurst {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  60%  { opacity: 1; }
  100% {
    transform: translate(
      calc(-50% + cos(calc(var(--d) * 12deg)) * 200px),
      calc(-50% + sin(calc(var(--d) * 12deg)) * 200px)
    ) scale(0.4);
    opacity: 0;
  }
}

/* -- Panel -- */
.lug-panel {
  position: relative;
  pointer-events: all;
  background: linear-gradient(160deg, #1c1038 0%, #0f172a 100%);
  border: 2px solid rgba(251,191,36,0.45);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(251,191,36,0.25), 0 24px 48px rgba(0,0,0,0.7);
  width: min(600px, 94vw);
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
  animation: lugPanelPop 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes lugPanelPop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* -- Header -- */
.lug-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(251,191,36,0.18);
  background: linear-gradient(135deg, rgba(251,191,36,0.12) 0%, rgba(168,85,247,0.12) 100%);
}

.lug-title-wrap {
  text-align: center;
}

.lug-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.35em;
  color: #fbbf24;
  text-transform: uppercase;
  animation: lugPulse 1.2s ease-in-out infinite alternate;
}
@keyframes lugPulse {
  from { text-shadow: 0 0 6px rgba(251,191,36,0.4); }
  to   { text-shadow: 0 0 20px rgba(251,191,36,0.9), 0 0 40px rgba(251,191,36,0.4); }
}

.lug-title {
  margin: 4px 0 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #f3f4f6;
  line-height: 1.2;
}

.lug-bolt {
  font-size: 1.5rem;
  color: #fbbf24;
  animation: lugBoltFlash 1.4s ease-in-out infinite alternate;
}
.lug-bolt--l { animation-delay: 0s;    }
.lug-bolt--r { animation-delay: 0.7s;  }
@keyframes lugBoltFlash {
  from { opacity: 0.3; transform: scale(0.85); }
  to   { opacity: 1;   transform: scale(1.15); }
}

/* -- Scrollable cards area -- */
.lug-cards-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(251,191,36,0.3) transparent;
}
.lug-cards-scroll:hover {
  scrollbar-color: rgba(251, 191, 36, 0.55) transparent;
}
.lug-cards-scroll::-webkit-scrollbar {
  width: 5px;
}
.lug-cards-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.lug-cards-scroll::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.3);
  border-radius: 3px;
}
.lug-cards-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.55);
}

/* -- Individual student card -- */
.lug-student-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(251,191,36,0.14);
  border-radius: 12px;
  padding: 10px 14px;
  transition: background 0.2s;
  animation: lugCardSlide 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
.lug-student-card:hover {
  background: rgba(255,255,255,0.07);
}

@keyframes lugCardSlide {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

.lug-student-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #e0e7ff;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(124,58,237,0.4);
}

.lug-student-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lug-student-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lug-student-class {
  font-size: 0.72rem;
  color: #a78bfa;
  text-transform: capitalize;
}

/* -- Level numbers -- */
.lug-level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lug-old-level {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-light);
  min-width: 22px;
  text-align: center;
  text-decoration: line-through;
  text-decoration-color: rgba(156,163,175,0.5);
}

.lug-level-arrow {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.lug-new-level {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fbbf24;
  min-width: 26px;
  text-align: center;
  text-shadow: 0 0 12px rgba(251,191,36,0.6);
}

.lug-multi-tag {
  font-size: 0.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1c1038;
  border-radius: 6px;
  padding: 2px 5px;
  letter-spacing: 0.02em;
}

/* -- Spell badge -- */
.lug-spell-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(124,58,237,0.25);
  color: #c4b5fd;
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px;
  padding: 2px 8px;
  flex-shrink: 0;
}

/* -- Footer button -- */
.lug-dismiss {
  margin: 16px 20px 20px;
  padding: 13px 28px;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1c1038;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(251,191,36,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.lug-dismiss:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(251,191,36,0.55);
}
.lug-dismiss:active {
  transform: translateY(0);
}

/* ==========================================================================
   COMBAT FLOW (light theme, red/damage; rewards stay green elsewhere)
   ========================================================================== */
.combat-overlay {
  position: fixed;
  inset: 0;
  z-index: 5100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.combat-overlay--above-raid {
  z-index: 13200;
}

.combat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 30, 0.72);
  backdrop-filter: blur(4px);
}

.combat-panel {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 32px));
  max-height: min(calc(100dvh - 32px), 920px);
  overflow: auto;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--color-combat-shell-start) 0%, var(--color-combat-shell-end) 100%);
  border: 2px solid rgba(220, 38, 38, 0.35);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(220, 38, 38, 0.08);
  color: var(--color-text);
}

.combat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  flex-shrink: 0;
  border-bottom: none;
}

.combat-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.02em;
}

.combat-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.15s, border-color 0.15s;
}

.combat-close:hover {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.6);
}

.combat-phases {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 18px 0;
  background: var(--color-combat-phases-bg);
  border-bottom: 1px solid rgba(220, 38, 38, 0.12);
}

.combat-phase-pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1.5px solid rgba(220, 38, 38, 0.22);
}

.combat-phase-pill--active {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: #991b1b;
}

.combat-phase-pill--done {
  color: var(--color-combat-accent-strong);
  background: var(--color-combat-selection-bg);
  border-color: var(--color-combat-selection-border);
}

.combat-phase-pill--skipped {
  color: var(--color-text-light);
  background: var(--color-background-alt);
  border-color: #e5e7eb;
  text-decoration: line-through;
  opacity: 0.75;
}

.combat-wizard-progress {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-combat-accent);
  margin-bottom: 8px;
}

.combat-wizard-body {
  min-height: 120px;
}

.combat-section--wizard {
  margin-top: 4px;
}

.combat-review-log {
  margin-top: 14px;
}

.combat-review-log .combat-log-card {
  position: static;
}

.combat-body {
  padding: 14px 18px 18px;
  background: var(--color-combat-body-bg);
}

.combat-scene-head {
  margin-bottom: 10px;
}

.combat-scene-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--color-combat-heading);
  font-weight: 800;
}

.combat-scene-head p {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.84rem;
}

.combat-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.combat-hud-item {
  border-radius: 12px;
  border: 1.5px solid rgba(220, 38, 38, 0.2);
  background: var(--color-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.06);
}

.combat-hud-label {
  color: #b91c1c;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.combat-hud-item strong {
  color: var(--color-combat-heading);
  font-size: 0.86rem;
}

.combat-grid-shell {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 14px;
}

.combat-grid-main {
  min-width: 0;
}

.combat-grid-side {
  min-width: 0;
}

.combat-log-card {
  border-radius: 14px;
  border: 1.5px solid rgba(220, 38, 38, 0.22);
  background: var(--color-surface);
  padding: 12px 14px;
  box-shadow: 0 2px 12px rgba(220, 38, 38, 0.08);
  position: sticky;
  top: 0;
}

.combat-log-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #b91c1c;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.combat-log-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--color-text);
  font-size: 0.8rem;
  line-height: 1.45;
  max-height: min(48vh, 380px);
  overflow-y: auto;
}

.combat-log-line {
  padding-right: 4px;
}

.combat-section {
  background: var(--color-surface);
  border: 1.5px solid rgba(220, 38, 38, 0.18);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.05);
}

.combat-section h3,
.combat-section h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--color-combat-heading);
  font-weight: 800;
}

.combat-recipient-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.combat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.combat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--color-combat-chip-border);
  background: var(--color-combat-chip-bg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-combat-chip-text);
}

.combat-chip--rich {
  border-radius: 12px;
  padding: 6px 10px 6px 6px;
  align-items: center;
}

.combat-chip--rich .combat-student-identity {
  gap: 8px;
}

.combat-chip--rich .combat-student-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.combat-chip--rich .combat-student-stats {
  font-size: 0.68rem;
}

.combat-chip--everyone {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
  border-color: #991b1b;
  color: #fff;
}

.combat-chip-remove {
  border: 0;
  background: transparent;
  color: var(--color-combat-chip-text);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.75;
  line-height: 1;
  padding: 0;
}

.combat-chip-remove:hover {
  opacity: 1;
}

.combat-add-picker-mount {
  width: 100%;
}

.combat-team-btn,
.combat-everyone-btn {
  border-radius: 10px;
  border: 2px solid rgba(220, 38, 38, 0.4);
  background: var(--color-surface);
  color: var(--color-combat-chip-text);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.combat-team-btn {
  border-color: rgba(37, 99, 235, 0.45);
  color: #2563eb;
}

.combat-team-btn:hover:not(:disabled) {
  background: #3b82f6;
  border-color: #2563eb;
  color: #fff;
}

.combat-everyone-btn i,
.combat-team-btn i {
  color: inherit;
}

.combat-everyone-btn:hover,
.combat-everyone-btn--active {
  background: #ef4444;
  border-color: #b91c1c;
  color: var(--color-on-danger);
}

.combat-damage-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.combat-damage-tile {
  border-radius: 14px;
  border: 1.5px solid rgba(220, 38, 38, 0.2);
  background: var(--color-surface);
  text-align: left;
  color: var(--color-text);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.05);
}

.combat-damage-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(220, 38, 38, 0.45);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.12);
}

.combat-damage-tile--selected {
  border-color: var(--color-combat-selection-border);
  background: var(--color-combat-selection-bg);
  box-shadow: 0 0 0 3px var(--color-combat-selection-ring);
}

.combat-damage-tile-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.combat-damage-name {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--color-text);
}

.combat-damage-check {
  opacity: 0;
  color: var(--color-combat-accent);
  font-size: 1.1rem;
}

.combat-damage-tile--selected .combat-damage-check {
  opacity: 1;
  color: var(--color-combat-accent-strong);
}

.combat-damage-desc {
  margin: 8px 0;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  min-height: 30px;
}

.combat-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.combat-tag {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 700;
}

.combat-tag--hp { background: #fee2e2; color: #dc2626; }
.combat-tag--mp { background: #dbeafe; color: #2563eb; }
.combat-tag--xp { background: #ede9fe; color: #6d28d9; }
.combat-tag--gp { background: #fef9c3; color: #ca8a04; }

.combat-damage-tile--custom {
  border-style: dashed;
}

.combat-custom-form {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--color-combat-custom-form-bg);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.combat-custom-form-hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.combat-custom-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.combat-custom-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

.combat-custom-field--wide {
  grid-column: 1 / -1;
}

.combat-custom-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 8px;
  font: inherit;
  background: var(--color-surface);
}

.combat-custom-field input:focus {
  outline: none;
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.combat-hint {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
  font-size: 0.84rem;
}

.combat-hint--small {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: -4px;
}

.combat-curse-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.combat-curse-toolbar .combat-curse-randomize {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.combat-curse-per-student-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.combat-curse-student-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--color-combat-row-bg);
  border: 1.5px solid rgba(220, 38, 38, 0.14);
  border-radius: 12px;
}

.combat-curse-student-row--defender {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.28);
}

.combat-curse-student-row--wizard {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.28);
}

.combat-curse-student-row--healer {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
}

.combat-curse-student-row--tinkerer {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.32);
}

.combat-curse-student-row--unassigned {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.28);
}

.combat-curse-student-head {
  display: flex;
  align-items: center;
}

.combat-curse-student-label {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--color-text);
}

.combat-defense-none-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid rgba(220, 38, 38, 0.22);
  background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
  text-align: left;
}

.combat-defense-none-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
  color: #9a3412;
}

.combat-defense-none-sub {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: #57534e;
}

.combat-defense-ineligible-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(40vh, 280px);
  overflow-y: auto;
}

.combat-defense-ineligible-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--color-combat-row-bg);
  border: 1px solid rgba(180, 83, 9, 0.2);
}

.combat-defense-ineligible-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--color-text);
}

.combat-defense-ineligible-why {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.combat-defense-ineligible-empty {
  margin: 0;
}

.combat-defense-list {
  display: grid;
  gap: 10px;
}

.combat-defense-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  border: 1.5px solid rgba(220, 38, 38, 0.14);
  border-radius: 12px;
  padding: 14px;
  background: var(--color-combat-row-bg);
}

.combat-defense-row--automatic-only {
  align-items: flex-start;
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.28);
}

.combat-defense-info--full {
  flex: 1;
  min-width: 0;
}

.combat-defense-auto-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #166534;
}

.combat-defense-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  flex: 1;
  min-width: 0;
}

.combat-defense-info strong {
  color: var(--color-text);
}

.combat-defense-pick-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.combat-defense-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(100%, 260px);
  flex-shrink: 0;
}

.combat-defense-defender-picker {
  width: 100%;
}

/* Rich student identity (combat targeting / defense / review) */
.combat-student-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.combat-student-identity--compact {
  gap: 8px;
}

.combat-student-identity-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.combat-student-avatar {
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(15, 23, 42, 0.08);
}

.combat-student-avatar--img.class-defender { border-color: rgba(239, 68, 68, 0.45); }
.combat-student-avatar--img.class-wizard { border-color: rgba(59, 130, 246, 0.45); }
.combat-student-avatar--img.class-healer { border-color: rgba(16, 185, 129, 0.45); }
.combat-student-avatar--img.class-tinkerer { border-color: rgba(245, 158, 11, 0.5); }

.combat-student-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  border: 2px solid transparent;
}

.combat-student-avatar--fallback.class-defender { background: linear-gradient(135deg, #ef4444, #dc2626); }
.combat-student-avatar--fallback.class-wizard { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.combat-student-avatar--fallback.class-healer { background: linear-gradient(135deg, #10b981, #059669); }
.combat-student-avatar--fallback.class-tinkerer { background: linear-gradient(135deg, #f59e0b, #d97706); }
.combat-student-avatar--fallback.class-unassigned { background: linear-gradient(135deg, #94a3b8, #64748b); }

.combat-student-name {
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combat-student-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.combat-student-stat--hp i { color: #ef4444; }
.combat-student-stat--mp i { color: #3b82f6; }

.combat-student-identity--grid {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  width: 100%;
}

.combat-student-identity--grid .combat-student-identity-text {
  align-items: center;
  width: 100%;
}

.combat-student-identity--grid .combat-student-name {
  font-size: 0.78rem;
  white-space: normal;
  line-height: 1.25;
}

.combat-student-identity--grid .combat-student-stats {
  justify-content: center;
  gap: 6px;
  font-size: 0.66rem;
}

/* Rich spell picker */
.combat-spell-identity {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  text-align: left;
}

.combat-spell-identity--compact {
  align-items: center;
}

.combat-spell-identity--compact .combat-spell-option-desc {
  display: none;
}

.combat-spell-icon {
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
}

.combat-spell-icon--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  font-size: 0.95rem;
}

.combat-spell-identity-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.combat-spell-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--color-text);
  line-height: 1.2;
}

.combat-spell-mp {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
}

.combat-spell-mp i {
  margin-right: 2px;
}

.combat-spell-option-desc {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.combat-spell-option-desc--empty {
  font-style: italic;
  opacity: 0.75;
}

.combat-rich-select-list--spell .combat-rich-select-option--spell {
  padding: 10px 12px;
}

.combat-defense-spell-picker {
  width: 100%;
}

.combat-rich-select-trigger--button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(220, 38, 38, 0.28);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.combat-rich-select-trigger--button:hover,
.combat-rich-select--open .combat-rich-select-trigger--button {
  border-color: rgba(220, 38, 38, 0.45);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.combat-rich-select-button-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.combat-curse-same-all-mount {
  display: inline-flex;
}

.combat-curse-same-all-mount .combat-rich-select {
  display: inline-flex;
}

.combat-curse-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
}

.combat-curse-option-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.15);
  color: #7c3aed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.combat-curse-option-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.combat-curse-option-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--color-text);
}

.combat-curse-option-desc {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.combat-rich-select-list--curse .combat-rich-select-option--curse {
  padding: 10px 12px;
}

/* Rich single-select (defender picker) */
.combat-rich-select {
  position: relative;
  width: 100%;
}

.combat-rich-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(220, 38, 38, 0.25);
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
}

.combat-rich-select-trigger:hover,
.combat-rich-select--open .combat-rich-select-trigger {
  border-color: rgba(220, 38, 38, 0.45);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.combat-rich-select-trigger-inner {
  flex: 1;
  min-width: 0;
}

.combat-rich-select-chevron {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.combat-rich-select-placeholder {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.combat-rich-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  border-radius: 10px;
  border: 1.5px solid rgba(220, 38, 38, 0.22);
  background: var(--color-surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.combat-rich-select-menu--floating {
  position: fixed;
  z-index: 15200;
  top: 0;
  left: 0;
  right: auto;
  min-width: 260px;
}

.combat-rich-select-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.combat-rich-select-option {
  width: 100%;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.combat-rich-select-option:hover,
.combat-rich-select-option:focus-visible {
  background: rgba(254, 226, 226, 0.35);
  border-color: rgba(220, 38, 38, 0.2);
  outline: none;
}

.combat-rich-select-option.is-selected {
  background: rgba(254, 226, 226, 0.5);
  border-color: rgba(220, 38, 38, 0.35);
}

.combat-rich-select-option--empty {
  padding: 10px 12px;
}

.combat-passive-effects {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.25);
  text-align: left;
}

.combat-passive-effects-head {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #166534;
  margin-bottom: 6px;
}

.combat-passive-effects-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.combat-passive-effect-item {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #14532d;
}

.combat-passive-effect-name {
  font-weight: 700;
}

.combat-passive-effect-meta {
  font-weight: 600;
  color: #15803d;
}

.combat-passive-effects-foot {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.combat-defense-select,
.combat-defense-spell-select,
.combat-curse-select,
.combat-curse-select-per-student,
.combat-restore-hp {
  border-radius: 10px;
  border: 1.5px solid rgba(220, 38, 38, 0.28);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 10px;
  font-size: 0.88rem;
}

.combat-curse-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.combat-curse-row label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--color-text);
}

.combat-review p {
  margin: 5px 0;
  color: var(--color-text);
  font-size: 0.88rem;
}

.combat-review--rich {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.combat-review-section {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(220, 38, 38, 0.14);
  background: var(--color-surface);
}

.combat-review-section-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b91c1c;
  display: flex;
  align-items: center;
  gap: 8px;
}

.combat-review-count {
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: none;
  letter-spacing: normal;
}

.combat-review-damage-card {
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-text);
}

.combat-review-student-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.combat-review-student-card {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(220, 38, 38, 0.12);
  background: var(--color-combat-row-bg);
}

.combat-review-student-card.combat-curse-student-row--defender { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.22); }
.combat-review-student-card.combat-curse-student-row--wizard { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.22); }
.combat-review-student-card.combat-curse-student-row--healer { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.22); }
.combat-review-student-card.combat-curse-student-row--tinkerer { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.26); }

.combat-review-student-card--curse {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.combat-review-curse-pick {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 40px;
}

.combat-review-curse-pick i {
  color: #7c3aed;
}

.combat-review-everyone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(185, 28, 28, 0.12));
  border: 1px solid rgba(220, 38, 38, 0.25);
  font-weight: 800;
  color: #b91c1c;
}

.combat-review-pair-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.combat-review-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--color-combat-row-bg);
  border: 1px solid rgba(220, 38, 38, 0.12);
}

.combat-review-pair-mid {
  color: #b91c1c;
  font-size: 1rem;
  text-align: center;
}

.combat-review-spell {
  grid-column: 1 / -1;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px dashed rgba(220, 38, 38, 0.15);
}

.combat-review-empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.combat-result-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(220, 38, 38, 0.25);
  background: var(--color-combat-selection-bg);
}

.combat-result-banner i {
  color: var(--color-combat-accent);
  font-size: 1.25rem;
}

.combat-result-banner strong {
  color: var(--color-text);
  font-size: 0.95rem;
}

.combat-result-banner p {
  margin: 4px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
}

.combat-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.combat-result-card {
  border-radius: 12px;
  border: 1.5px solid rgba(220, 38, 38, 0.16);
  background: var(--color-surface);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.combat-result-card strong {
  color: var(--color-text);
  font-size: 0.86rem;
}

.combat-result-card--exhausted {
  border-color: var(--color-combat-selection-border);
  background: var(--color-combat-selection-bg);
}

.combat-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.combat-footer--between {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.combat-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.combat-footer--end {
  justify-content: flex-end;
}

.combat-empty,
.combat-loading {
  color: var(--color-text-secondary);
  padding: 16px 0;
  text-align: center;
  font-size: 0.95rem;
}

/* Primary / secondary actions inside damage modal, red, not reward green */
.combat-panel .btn.btn-primary {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: #991b1b;
  color: #fff;
}

.combat-panel .btn.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  border-color: #7f1d1d;
}

.combat-panel .btn.btn-secondary {
  background: var(--color-surface);
  border: 1.5px solid rgba(220, 38, 38, 0.35);
  color: var(--color-combat-secondary-text);
}

.combat-panel .btn.btn-secondary:hover:not(:disabled) {
  background: var(--color-combat-secondary-hover-bg);
  border-color: rgba(220, 38, 38, 0.55);
  color: var(--color-text);
}

@media (max-width: 920px) {
  .combat-grid-shell {
    grid-template-columns: 1fr;
  }
  .combat-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .combat-log-card {
    position: static;
    max-height: none;
  }
  .combat-log-list {
    max-height: 240px;
  }
}

/* ==========================================================================
   COMBAT, dramatic damage results popup (after resolve, separate overlay)
   ========================================================================== */
.combat-dramatic-results-overlay {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: combatDramaticFadeIn 0.35s ease;
}

.combat-dramatic-results-card .reward-celebration-stats {
  margin: 14px 0 4px;
}

.combat-dramatic-results-overlay--above-raid {
  z-index: 13200;
}

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

.combat-dramatic-results-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(80, 0, 0, 0.55) 0%, rgba(15, 5, 5, 0.92) 65%);
  backdrop-filter: blur(8px);
}

.combat-dramatic-results-stage {
  position: relative;
  z-index: 1;
  width: min(96vw, 720px);
  max-height: min(92dvh, 880px);
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combat-dramatic-results-burst {
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.35) 0%, transparent 65%);
  animation: combatDramaticBurst 2s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes combatDramaticBurst {
  from { transform: scale(0.88); opacity: 0.65; }
  to { transform: scale(1.08); opacity: 1; }
}

.combat-dramatic-results-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.combat-dramatic-particle {
  --d: 0;
  position: absolute;
  top: 42%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: hsl(calc(var(--d) * 20deg), 85%, 58%);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
  animation: combatDramaticParticleOut 1.4s calc(var(--d) * 0.035s) ease-out forwards;
}

@keyframes combatDramaticParticleOut {
  0% {
    transform: translate(-50%, -50%) rotate(calc(var(--d) * 20deg)) translateX(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(calc(var(--d) * 20deg)) translateX(200px);
    opacity: 0;
  }
}

.combat-dramatic-results-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-height: min(88dvh, 820px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--color-combat-shell-start) 0%, var(--color-combat-shell-end) 100%);
  border: 3px solid var(--color-combat-selection-border);
  border-radius: 24px;
  box-shadow:
    0 0 0 6px var(--color-combat-selection-ring),
    var(--shadow-lg);
  padding: 28px 26px 22px;
  text-align: center;
  animation: combatDramaticCardPop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: var(--color-text);
}

@keyframes combatDramaticCardPop {
  from {
    transform: scale(0.82) translateY(40px);
    opacity: 0;
    filter: blur(4px);
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
    filter: blur(0);
  }
}

.combat-dramatic-results-icon-wrap {
  margin-bottom: 8px;
}

.combat-dramatic-results-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(145deg, #f97316 0%, #dc2626 50%, #991b1b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: #fff;
  box-shadow: 0 12px 40px rgba(220, 38, 38, 0.55);
  animation: combatDramaticIconPulse 1.2s ease-in-out infinite alternate;
}

@keyframes combatDramaticIconPulse {
  from { transform: scale(1); box-shadow: 0 12px 40px rgba(220, 38, 38, 0.45); }
  to { transform: scale(1.05); box-shadow: 0 16px 50px rgba(220, 38, 38, 0.65); }
}

.combat-dramatic-results-kicker {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-combat-accent);
}

.combat-dramatic-results-title {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 900;
  color: var(--color-text);
  line-height: 1.12;
}

.combat-dramatic-results-desc {
  margin: 0 0 18px;
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.combat-dramatic-results-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.combat-dramatic-metric {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 2px solid rgba(220, 38, 38, 0.2);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.1);
}

.combat-dramatic-metric--danger {
  border-color: var(--color-combat-selection-border);
  background: var(--color-combat-selection-bg);
}

.combat-dramatic-metric-val {
  display: block;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--color-combat-accent-strong);
  line-height: 1.1;
}

.combat-dramatic-metric-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}

.combat-dramatic-defense-block {
  text-align: left;
  background: var(--color-combat-row-bg);
  border: 1.5px solid rgba(220, 38, 38, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.combat-dramatic-defense-head {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-combat-accent);
}

.combat-dramatic-defense-list {
  margin: 0;
  padding-left: 18px;
  color: var(--color-text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
}

.combat-dramatic-roster-head {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-combat-accent);
  text-align: center;
}

.combat-dramatic-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  text-align: left;
}

.combat-dramatic-roster-card {
  --stagger: 0;
  background: var(--color-combat-row-bg);
  border: 1.5px solid rgba(220, 38, 38, 0.15);
  border-radius: 12px;
  padding: 10px 10px 8px;
  display: grid;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--color-text-secondary);
  animation: combatDramaticRosterIn 0.5s ease backwards;
  animation-delay: calc(var(--stagger) * 0.05s);
}

@keyframes combatDramaticRosterIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.combat-dramatic-roster-card strong {
  color: var(--color-text);
  font-size: 0.84rem;
}

.combat-dramatic-roster-card--exhausted {
  border-color: var(--color-combat-selection-border);
  background: var(--color-combat-selection-bg);
}

.combat-dramatic-roster-stat {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
}

.combat-dramatic-roster-stat i {
  width: 14px;
  margin-right: 4px;
  color: var(--color-combat-accent);
  opacity: 0.85;
}

.combat-dramatic-exhaust-tag {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-combat-accent-strong);
  margin-top: 2px;
}

.combat-dramatic-next-hint {
  margin: 0 0 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #7c3aed;
  animation: combatDramaticHintPulse 1.5s ease-in-out infinite;
}

@keyframes combatDramaticHintPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

.combat-dramatic-results-overlay .combat-dramatic-results-dismiss {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 1.02rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border: 2px solid #991b1b;
  color: #fff;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(185, 28, 28, 0.45);
}

.combat-dramatic-results-overlay .combat-dramatic-results-dismiss:hover {
  filter: brightness(1.08);
}

/* ==========================================================================
   COMBAT, curse aftermath popup (after damage results, if cursed)
   ========================================================================== */
.combat-curse-aftermath-overlay {
  position: fixed;
  inset: 0;
  z-index: 5300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: combatCurseFadeIn 0.45s ease;
}

.combat-curse-aftermath-overlay--above-raid {
  z-index: 13200;
}

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

.combat-curse-aftermath-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 30%, rgba(88, 28, 135, 0.5) 0%, rgba(15, 5, 25, 0.94) 55%);
  backdrop-filter: blur(10px);
}

.combat-curse-aftermath-stage {
  position: relative;
  z-index: 1;
  width: min(92vw, 460px);
  max-height: min(92dvh, 720px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.combat-curse-aftermath-veil {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  overflow: hidden;
}

.combat-curse-mote {
  --m: 0;
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(196, 181, 253, 0.7);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.9);
  left: calc(8% + var(--m) * 6%);
  top: calc(12% + var(--m) * 4%);
  animation: combatCurseFloat 4s calc(var(--m) * 0.15s) ease-in-out infinite alternate;
}

@keyframes combatCurseFloat {
  from { transform: translateY(0) scale(1); opacity: 0.5; }
  to { transform: translateY(-24px) scale(1.2); opacity: 1; }
}

.combat-curse-aftermath-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  max-height: min(90dvh, 680px);
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 40%, #1e1b4b 100%);
  border: 3px solid #7c3aed;
  border-radius: 22px;
  padding: 32px 26px 24px;
  text-align: center;
  box-shadow:
    0 0 0 5px rgba(124, 58, 237, 0.2),
    0 36px 100px rgba(0, 0, 0, 0.65);
  animation: combatCurseCardRise 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes combatCurseCardRise {
  from {
    transform: translateY(50px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.combat-curse-aftermath-sigil {
  width: 76px;
  height: 76px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a78bfa 0%, #5b21b6 55%, #3b0764 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ede9fe;
  box-shadow: 0 0 40px rgba(167, 139, 250, 0.55);
  animation: combatCurseSigilGlow 2s ease-in-out infinite alternate;
}

@keyframes combatCurseSigilGlow {
  from { box-shadow: 0 0 28px rgba(167, 139, 250, 0.4); }
  to { box-shadow: 0 0 48px rgba(167, 139, 250, 0.75); }
}

.combat-curse-aftermath-kicker {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #c4b5fd;
}

.combat-curse-aftermath-title {
  margin: 0 0 12px;
  font-size: 1.65rem;
  font-weight: 900;
  color: #f5f3ff;
  line-height: 1.15;
  text-shadow: 0 2px 24px rgba(139, 92, 246, 0.6);
}

.combat-curse-aftermath-sub {
  margin: 0 0 18px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #c4b5fd;
}

.combat-curse-aftermath-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0 4px 0 0;
  text-align: left;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.combat-curse-aftermath-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 12px;
}

.combat-curse-aftermath-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.combat-curse-aftermath-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
}

.combat-curse-aftermath-curse {
  font-size: 0.82rem;
  font-weight: 800;
  color: #e9d5ff;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(91, 33, 182, 0.55);
  border: 1px solid rgba(196, 181, 253, 0.4);
}

.combat-curse-aftermath-hp {
  font-size: 0.82rem;
  color: #ddd6fe;
}

.combat-curse-aftermath-hp strong {
  color: #fde68a;
}

.combat-curse-aftermath-overlay .combat-curse-aftermath-dismiss {
  flex-shrink: 0;
  width: 100%;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 12px;
  border: 2px solid #a78bfa;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(91, 33, 182, 0.5);
}

.combat-curse-aftermath-overlay .combat-curse-aftermath-dismiss:hover {
  filter: brightness(1.1);
}

/* ========== ACTIVITY / AUDIT LOG ========== */
.audit-log-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', system-ui, sans-serif;
}

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

.audit-log-panel {
  position: relative;
  z-index: 1;
  width: min(1080px, 96vw);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.audit-log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-modal-shell-header);
}

.audit-log-header-text h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.audit-log-header-text h2 i {
  color: var(--color-primary-light);
}

.audit-log-header-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.audit-log-close {
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}

.audit-log-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.audit-log-filters {
  padding: 14px 22px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-background-alt);
}

.audit-log-filters-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

@media (max-width: 900px) {
  .audit-log-filters-grid {
    grid-template-columns: 1fr 1fr;
  }
  .audit-log-field--search {
    grid-column: 1 / -1;
  }
}

.audit-log-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.audit-log-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}

.audit-log-field input,
.audit-log-field select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.85rem;
  border: 1px solid var(--color-input-border);
  border-radius: 8px;
  background: var(--color-input-bg);
  color: var(--color-input-text);
}

.audit-log-field input:focus,
.audit-log-field select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.audit-log-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.audit-log-input-wrap i {
  position: absolute;
  left: 10px;
  color: var(--color-text-light);
  font-size: 0.85rem;
  pointer-events: none;
}

.audit-log-input-wrap .audit-log-search {
  padding-left: 32px;
}

.audit-log-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.audit-log-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 22px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.82rem;
}

.audit-log-stat {
  font-weight: 600;
  color: var(--color-text);
}

.audit-log-stat--muted {
  font-weight: 500;
  color: var(--color-text-light);
}

.audit-log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-background-alt);
}

.audit-log-filter-note {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.audit-log-body {
  flex: 1;
  overflow: auto;
  padding: 16px 22px 20px;
}

.audit-log-entries {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-log-section-title {
  margin: 16px 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.audit-log-section-title:first-child {
  margin-top: 0;
}

.audit-log-entry {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-left: 4px solid var(--color-text-light);
  transition: box-shadow 0.15s ease;
  color: var(--color-text);
}

.audit-log-entry:hover {
  box-shadow: var(--shadow-sm);
}

.audit-log-entry--combat {
  border-left-color: #f59e0b;
  background: var(--color-audit-combat-bg);
}

.audit-log-entry--reward {
  border-left-color: #22c55e;
  background: var(--color-audit-reward-bg);
}

.audit-log-entry--magic {
  border-left-color: #8b5cf6;
  background: var(--color-audit-magic-bg);
}

.audit-log-entry--system {
  border-left-color: #38bdf8;
}

.audit-log-entry-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--color-background-alt);
  color: var(--color-text-secondary);
  font-size: 1rem;
}

.audit-log-entry--combat .audit-log-entry-icon {
  background: #fef3c7;
  color: #b45309;
}

.audit-log-entry--reward .audit-log-entry-icon {
  background: #dcfce7;
  color: #15803d;
}

.audit-log-entry--magic .audit-log-entry-icon {
  background: #ede9fe;
  color: #6d28d9;
}

.audit-log-entry-main {
  flex: 1;
  min-width: 0;
}

.audit-log-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.audit-log-entry-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.audit-log-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.audit-log-entry-meta i {
  margin-right: 4px;
  opacity: 0.85;
}

.audit-log-entry-detail {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  word-break: break-word;
}

.audit-log-entry-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* spells.css .btn-secondary targets dark panels; restore contrast in the audit log */
.audit-log-panel .audit-log-undo-btn.btn.btn-secondary {
  background: #ffffff;
  color: var(--color-text);
  border: 1.5px solid #64748b;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transform: none;
}

.audit-log-panel .audit-log-undo-btn.btn.btn-secondary i {
  color: var(--color-text-secondary);
}

.audit-log-panel .audit-log-undo-btn.btn.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  color: var(--color-text);
  border-color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.audit-log-panel .audit-log-undo-btn.btn.btn-secondary:hover:not(:disabled) i {
  color: var(--color-text);
}

.audit-log-panel .audit-log-undo-btn.btn.btn-secondary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.audit-log-panel .audit-log-undo-btn.btn.btn-secondary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

[data-theme='dark'] .audit-log-panel .audit-log-undo-btn.btn.btn-secondary {
  background: var(--color-surface-active);
  color: var(--color-text);
  border-color: var(--color-border-dark);
  box-shadow: none;
}

[data-theme='dark'] .audit-log-panel .audit-log-undo-btn.btn.btn-secondary i {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .audit-log-panel .audit-log-undo-btn.btn.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-primary-light);
}

.audit-log-reversed-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  opacity: 0.85;
}

.audit-log-empty--section {
  margin: 8px 0 0;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.audit-log-loading,
.audit-log-empty,
.audit-log-error {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.audit-log-error {
  color: #b91c1c;
}

.audit-log-table-wrap {
  overflow-x: auto;
}

.audit-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.audit-log-table th,
.audit-log-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.audit-log-table th {
  font-weight: 700;
  color: var(--color-text);
  background: #f8fafc;
  position: sticky;
  top: 0;
}

.audit-log-table code {
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-text);
}

.audit-log-detail {
  word-break: break-word;
  color: var(--color-text-secondary);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

.audit-log-meta {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.audit-log-actions {
  padding: 0 20px 16px;
}

.audit-log-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-log-section-caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  padding: 12px 0 8px;
}

.audit-log-table + .audit-log-table {
  margin-top: 16px;
}

.audit-log-tier {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 4px;
}

.audit-log-tier--live {
  background: #dcfce7;
  color: #166534;
}

.audit-log-tier--archive {
  background: #fef3c7;
  color: #92400e;
}

.audit-log-tier--deep {
  background: #e2e8f0;
  color: var(--color-text-secondary);
}

/* Paused combat, student defense modal */
.pcd-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

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

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

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

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

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

.pcd-hint,
.pcd-expires,
.pcd-empty,
.pcd-loading {
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  margin: 0 0 12px;
}

.pcd-expires {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.pcd-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pcd-row {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pcd-row-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pcd-row-info span {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

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

.pcd-spell-select {
  flex: 1 1 180px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}
