/* Student Showcase, fullscreen projector / smart board display */

.ss-root--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 12200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow: hidden;
}

.ss-root--fullscreen.ss-root--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ,  Theme tokens ,  */
.ss-root[data-ss-theme="dark"] {
  --ss-scene-bg:
    radial-gradient(ellipse 75% 50% at 50% 0%, rgba(99, 102, 241, 0.2) 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 10% 90%, rgba(16, 185, 129, 0.16) 0%, transparent 50%),
    radial-gradient(ellipse 45% 35% at 92% 78%, rgba(139, 92, 246, 0.14) 0%, transparent 45%),
    linear-gradient(165deg, #0f172a 0%, #0c1222 40%, #080d18 100%);
  --ss-text: #f8fafc;
  --ss-text-muted: #cbd5e1;
  --ss-text-subtle: #94a3b8;
  --ss-title-accent: #818cf8;
  --ss-title-badge-bg: rgba(99, 102, 241, 0.25);
  --ss-title-badge-border: rgba(129, 140, 248, 0.45);
  --ss-title-color: #a5b4fc;
  --ss-close-bg: rgba(255, 255, 255, 0.08);
  --ss-close-bg-hover: rgba(255, 255, 255, 0.14);
  --ss-close-color: #e2e8f0;
  --ss-character-shadow: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --ss-character-fallback: rgba(255, 255, 255, 0.15);
  --ss-active-award-bg: rgba(15, 23, 42, 0.88);
  --ss-active-award-border: rgba(255, 255, 255, 0.14);
  --ss-active-award-text: #e2e8f0;
  --ss-stats-bg: rgba(255, 255, 255, 0.1);
  --ss-stats-border: rgba(255, 255, 255, 0.18);
  --ss-stats-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  --ss-stat-label: #e2e8f0;
  --ss-stat-value: #ffffff;
  --ss-stat-bar-bg: rgba(0, 0, 0, 0.35);
  --ss-stat-bar-border: rgba(255, 255, 255, 0.14);
  --ss-stat-divider: rgba(255, 255, 255, 0.14);
  --ss-gold: #fbbf24;
  --ss-awards-heading: #f1f5f9;
  --ss-award-name: #e2e8f0;
  --ss-awards-more: #94a3b8;
  --ss-progress-dot: rgba(255, 255, 255, 0.22);
  --ss-progress-dot-active: #818cf8;
  --ss-spinner-track: rgba(255, 255, 255, 0.15);
  --ss-spinner-accent: #818cf8;
  --ss-ray-opacity: 0.8;
  --ss-sparkle-a: rgba(255, 255, 255, 0.6);
  --ss-sparkle-b: rgba(129, 140, 248, 0.85);
  --ss-brand-teach: #a5b4fc;
  --ss-brand-quest: #fca5a5;
}

.ss-root[data-ss-theme="light"] {
  --ss-scene-bg:
    radial-gradient(ellipse 75% 50% at 50% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 10% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 45% 35% at 92% 78%, rgba(139, 92, 246, 0.08) 0%, transparent 45%),
    linear-gradient(165deg, #f8fafc 0%, #f1f5f9 40%, #e2e8f0 100%);
  --ss-text: #0f172a;
  --ss-text-muted: #475569;
  --ss-text-subtle: #64748b;
  --ss-title-accent: #6366f1;
  --ss-title-badge-bg: rgba(99, 102, 241, 0.12);
  --ss-title-badge-border: rgba(99, 102, 241, 0.35);
  --ss-title-color: #6366f1;
  --ss-close-bg: rgba(15, 23, 42, 0.06);
  --ss-close-bg-hover: rgba(15, 23, 42, 0.1);
  --ss-close-color: var(--color-text);
  --ss-character-shadow: 0 20px 40px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(15, 23, 42, 0.08);
  --ss-character-fallback: rgba(15, 23, 42, 0.12);
  --ss-active-award-bg: rgba(255, 255, 255, 0.95);
  --ss-active-award-border: rgba(15, 23, 42, 0.1);
  --ss-active-award-text: #1e293b;
  --ss-stats-bg: #ffffff;
  --ss-stats-border: #e2e8f0;
  --ss-stats-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(99, 102, 241, 0.08);
  --ss-stat-label: #475569;
  --ss-stat-value: #0f172a;
  --ss-stat-bar-bg: #f1f5f9;
  --ss-stat-bar-border: #cbd5e1;
  --ss-stat-divider: #e2e8f0;
  --ss-gold: #d97706;
  --ss-awards-heading: #1e293b;
  --ss-award-name: #334155;
  --ss-awards-more: #64748b;
  --ss-progress-dot: rgba(15, 23, 42, 0.18);
  --ss-progress-dot-active: #6366f1;
  --ss-spinner-track: rgba(15, 23, 42, 0.1);
  --ss-spinner-accent: #6366f1;
  --ss-ray-opacity: 0.45;
  --ss-sparkle-a: rgba(99, 102, 241, 0.35);
  --ss-sparkle-b: rgba(16, 185, 129, 0.4);
  --ss-brand-teach: #7C73FF;
  --ss-brand-quest: #FF6B6B;
}

.ss-scene {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: url('../images/main/teams.webp') center center / cover no-repeat;
  color: var(--ss-text);
  /* Readable on photo background regardless of app theme */
  --ss-text: #f8fafc;
  --ss-text-muted: #e2e8f0;
  --ss-text-subtle: #cbd5e1;
  --ss-title-color: #c4b5fd;
  --ss-title-badge-bg: rgba(99, 102, 241, 0.5);
  --ss-title-badge-border: rgba(167, 139, 250, 0.6);
  --ss-awards-heading: #f1f5f9;
  --ss-award-name: #e2e8f0;
  --ss-awards-more: #cbd5e1;
  --ss-close-bg: rgba(255, 255, 255, 0.12);
  --ss-close-bg-hover: rgba(255, 255, 255, 0.2);
  --ss-close-color: #f8fafc;
  --ss-brand-teach: #d4ccff;
  --ss-brand-quest: #ffb4b4;
  --ss-progress-dot: rgba(255, 255, 255, 0.28);
  --ss-progress-dot-active: #a5b4fc;
}

.ss-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(8, 13, 24, 0.62) 0%,
    rgba(8, 13, 24, 0.38) 42%,
    rgba(8, 13, 24, 0.58) 100%
  );
}

.ss-brand {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.ss-brand--stage {
  display: none;
}

.ss-brand--compact {
  display: none;
}

.ss-brand--header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 2vw, 1.1rem);
  padding: 0.45rem clamp(0.85rem, 2.5vw, 1.35rem);
  text-align: center;
  grid-column: 2;
  min-width: 0;
  pointer-events: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
}

.ss-brand--header .ss-brand-logo {
  width: clamp(64px, 14vw, 120px);
  height: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.55));
}

.ss-brand--header .ss-brand-text {
  font-size: clamp(1.75rem, 5vw, 3.25rem);
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.ss-brand--compact .ss-brand-logo {
  width: clamp(28px, 6vw, 40px);
  height: auto;
}

.ss-brand--compact .ss-brand-text {
  font-size: clamp(0.78rem, 1.8vw, 1rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ss-brand-logo {
  width: clamp(72px, 12vw, 120px);
  height: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.ss-brand--stage .ss-brand-logo {
  width: clamp(72px, 12vw, 120px);
}

.ss-brand-text {
  display: flex;
  gap: 0.12em;
  align-items: baseline;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  max-width: 100%;
}

.ss-brand-teach {
  color: var(--ss-brand-teach);
}

.ss-brand-quest {
  color: var(--ss-brand-quest);
}

.ss-ambient {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.18;
}

.ss-rays {
  position: absolute;
  top: -15%;
  left: 50%;
  width: 130%;
  height: 65%;
  transform: translateX(-50%);
  background: conic-gradient(
    from 180deg at 50% 100%,
    transparent 0deg,
    rgba(99, 102, 241, 0.06) 20deg,
    transparent 40deg,
    rgba(16, 185, 129, 0.05) 60deg,
    transparent 80deg,
    rgba(99, 102, 241, 0.07) 100deg,
    transparent 120deg
  );
  animation: ss-rays-sway 16s ease-in-out infinite alternate;
  opacity: var(--ss-ray-opacity);
}

.ss-sparkles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 15% 25%, var(--ss-sparkle-a), transparent),
    radial-gradient(1.5px 1.5px at 82% 20%, var(--ss-sparkle-b), transparent),
    radial-gradient(2px 2px at 48% 72%, var(--ss-sparkle-a), transparent),
    radial-gradient(1.5px 1.5px at 88% 68%, var(--ss-sparkle-b), transparent);
  animation: ss-sparkle-drift 20s linear infinite;
}

@keyframes ss-rays-sway {
  from { transform: translateX(-50%) rotate(-2deg); }
  to { transform: translateX(-50%) rotate(2deg); }
}

@keyframes ss-sparkle-drift {
  from { transform: translateY(0); }
  to { transform: translateY(-12px); }
}

.ss-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
  align-items: center;
  column-gap: 0.75rem;
  padding:
    max(0.75rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    0.65rem
    max(1rem, env(safe-area-inset-left, 0px));
  flex-shrink: 0;
}

.ss-close {
  grid-column: 3;
  justify-self: end;
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  width: clamp(34px, 8vw, 44px);
  height: clamp(34px, 8vw, 44px);
  border: none;
  border-radius: 12px;
  background: var(--ss-close-bg);
  color: var(--ss-close-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.ss-close:hover {
  background: var(--ss-close-bg-hover);
}

.ss-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding:
    0
    max(0.75rem, env(safe-area-inset-right, 0px))
    max(0.5rem, env(safe-area-inset-bottom, 0px))
    max(0.75rem, env(safe-area-inset-left, 0px));
}

.ss-stage-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ss-stage-fit {
  flex-shrink: 0;
}

.ss-stage-scaler {
  transform-origin: top left;
  width: min(1100px, 100vw - 1.5rem);
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.ss-spotlight {
  width: 100%;
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.ss-spotlight--exit {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
}

.ss-spotlight--enter {
  animation: ss-spotlight-enter 0.52s ease forwards;
}

@keyframes ss-spotlight-enter {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ss-slide {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.5rem;
  align-items: center;
}

.ss-slide-character {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: 0;
}

.ss-character {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 5;
  height: auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--ss-character-shadow);
}

.ss-character--absent {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.ss-character-bg {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background-size: cover !important;
  background-position: center center !important;
}

.ss-character-sprite {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 6% 5%;
  box-sizing: border-box;
  pointer-events: none;
}

.ss-character-portrait {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.45));
}

.ss-character-fallback {
  font-size: 8rem;
  color: var(--ss-character-fallback);
}

.ss-character-pet {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(72%);
  z-index: 3;
}

.ss-character-pet img {
  max-width: 180px;
  max-height: 140px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.ss-active-award,
.ss-active-award-badge,
.ss-featured-collection-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
  background: var(--ss-active-award-bg);
  border: 1px solid var(--ss-active-award-border);
  max-width: 120px;
}

.ss-active-award-thumb,
.ss-featured-collection-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.ss-active-award-thumb img,
.ss-featured-collection-thumb img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.ss-active-award-name,
.ss-featured-collection-name {
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.2;
  color: var(--ss-active-award-text);
}

.ss-active-award-stack,
.ss-active-award-stack-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #6366f1;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.ss-collections {
  margin-top: 0.25rem;
}

.ss-collections-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.ss-collection-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 80px;
}

.ss-collection-badge img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.ss-collection-badge--pinned img {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.ss-collection-badge-name {
  font-size: 0.65rem;
  text-align: center;
  line-height: 1.15;
  color: var(--ss-award-name);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-slide-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  min-height: 0;
  padding: 1.1rem 1.25rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38);
}

.ss-slide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.ss-student-name {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ss-text);
  overflow-wrap: anywhere;
  word-break: break-word;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.ss-student-name .student-name-title {
  display: block;
  font-size: 0.72em;
  color: var(--ss-title-color);
  font-weight: 600;
  margin-top: 0.15rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.ss-level-badge {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--ss-title-badge-bg);
  border: 1px solid var(--ss-title-badge-border);
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.ss-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.95rem;
  color: var(--ss-text-muted);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.ss-team {
  color: var(--ss-text-muted);
}

/* Stats panel - always a light card; ink must stay dark (theme tokens go light in dark mode) */
.ss-stats-wrap .ss-stats-overlay,
.ss-stats-wrap .stats-overlay {
  background: rgba(255, 255, 255, 0.96) !important;
  border: 2px solid rgba(15, 23, 42, 0.1) !important;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  color: #0f172a !important;
}

.ss-stats-wrap .stat-bar-label,
html[data-season] .ss-stats-wrap .stat-bar-label {
  color: #475569 !important;
}

.ss-stats-wrap .stat-bar-label span:last-child,
html[data-season] .ss-stats-wrap .stat-bar-label span:last-child {
  color: #0f172a !important;
  font-weight: 700;
}

.ss-stats-wrap .stat-bar,
html[data-season] .ss-stats-wrap .stat-bar {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

.ss-stats-wrap .stat-info,
html[data-season] .ss-stats-wrap .stat-info {
  border-top-color: #e2e8f0 !important;
}

.ss-stats-wrap .stat-info-item,
html[data-season] .ss-stats-wrap .stat-info-item {
  color: #0f172a !important;
}

.ss-stats-wrap .stat-info-item .label,
html[data-season] .ss-stats-wrap .stat-info-item .label {
  color: #64748b !important;
}

.ss-stats-wrap .stat-info-item span:last-child,
.ss-stats-wrap [class*="overlay-gold"],
.ss-stats-wrap .stat-info-item span:not(.label),
html[data-season] .ss-stats-wrap .stat-info-item span:last-child,
html[data-season] .ss-stats-wrap .stat-info-item span:not(.label) {
  color: #d97706 !important;
  font-weight: 700;
}

.ss-stats-wrap .stats-overlay-header h2 {
  display: none;
}

.ss-stats-wrap .stats-overlay-header .level-badge {
  display: none;
}

.ss-stats-wrap .overlay-class-row {
  display: none;
}

.ss-awards {
  margin-top: 0.25rem;
}

.ss-awards-heading {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ss-awards-heading);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ss-awards-heading i {
  color: #fbbf24;
}

.ss-awards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.ss-award-medal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 72px;
}

.ss-award-medal img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.ss-award-medal--featured img {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
  border-radius: 8px;
}

.ss-award-medal-name {
  font-size: 0.65rem;
  text-align: center;
  line-height: 1.15;
  color: var(--ss-award-name);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-award-medal-count {
  position: absolute;
  top: -4px;
  right: 2px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.9);
  color: #fff;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
}

.ss-awards-more {
  align-self: center;
  font-size: 0.85rem;
  color: var(--ss-awards-more);
  padding: 0.25rem 0.5rem;
}

.ss-awards--loading {
  display: flex;
  align-items: center;
  min-height: 72px;
  margin: 0;
}

.ss-awards-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ss-spinner-track);
  border-top-color: var(--ss-spinner-accent);
  border-radius: 50%;
  animation: ss-spin 0.8s linear infinite;
}

@keyframes ss-spin {
  to { transform: rotate(360deg); }
}

.ss-progress {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding-top: 0.25rem;
  flex-shrink: 0;
}

.ss-progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ss-progress-dot);
  transition: background 0.25s ease, transform 0.25s ease;
}

.ss-progress-dot--active {
  background: var(--ss-progress-dot-active);
  transform: scale(1.25);
}

/* Stacked slide on narrow or short viewports (before scale-to-fit) */
@media (max-width: 820px), (max-height: 720px) {
  .ss-stage-scaler {
    width: min(520px, 100vw - 1.5rem);
  }

  .ss-slide {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 0.85rem;
  }

  .ss-character {
    max-width: 360px;
    margin-inline: auto;
  }
}

@media (max-width: 420px) {
  .ss-brand--header .ss-brand-text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-rays,
  .ss-sparkles,
  .ss-awards-spinner {
    animation: none;
  }

  .ss-spotlight--enter {
    animation: none;
  }
}
