/* ==========================================================================
   MEDICAL HOUSE DIRECTORY - DESIGN SYSTEM & STYLESHEET
   Aesthetics: Cinematic Dark, Atmospheric Radial Lights, Frosted Glass (Ultra-clean)
   ========================================================================== */

:root {
  /* House Colors */
  --color-archimedes: #1A4D8C;
  --color-archimedes-glow: rgba(26, 77, 140, 0.45);
  --color-archimedes-light: #3b82f6;

  --color-hippocrates: #47266B;
  --color-hippocrates-glow: rgba(71, 38, 107, 0.5);
  --color-hippocrates-light: #9333ea;

  --color-galen: #7B1C20;
  --color-galen-glow: rgba(123, 28, 32, 0.5);
  --color-galen-light: #ef4444;

  --color-osler: #C99225;
  --color-osler-glow: rgba(201, 146, 37, 0.45);
  --color-osler-light: #f59e0b;

  /* Neutral Surface & Glass Tokens */
  --bg-deep: #07090e;
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-card-bg: rgba(13, 20, 36, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(255, 255, 255, 0.28);
  --glass-blur: blur(20px);
  --glass-blur-heavy: blur(28px);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Typography Fonts */
  --font-serif: 'Cinzel', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-thai: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Dimensions */
  --nav-height: 72px;
  --max-content-width: 1360px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans), var(--font-thai);
  overflow-x: clip;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: clip;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   BACKGROUND UNIVERSE & ATMOSPHERIC LIGHTING
   ========================================================================== */
.bg-universe {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.03) translate3d(0, 0, 0);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bg-layer.active {
  opacity: 0.68;
  transform: scale(1) translate3d(0, 0, 0);
}

.bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(7, 9, 14, 0.22) 0%, rgba(7, 9, 14, 0.65) 65%, rgba(7, 9, 14, 0.9) 100%),
              linear-gradient(180deg, rgba(7, 9, 14, 0.45) 0%, rgba(7, 9, 14, 0.15) 50%, rgba(7, 9, 14, 0.78) 100%);
  z-index: 1;
}

.ambient-glow {
  position: absolute;
  width: 85vw;
  height: 85vh;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  background: radial-gradient(circle at center, var(--color-archimedes-glow) 0%, rgba(26, 77, 140, 0.15) 35%, transparent 70%);
  opacity: 0.75;
  transition: background 0.8s ease, opacity 0.8s ease;
  z-index: 2;
  pointer-events: none;
  will-change: background, opacity;
}

/* ==========================================================================
   TOP NAVIGATION
   ========================================================================== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2.5rem;
  z-index: 100;
  background: rgba(7, 9, 14, 0.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.faculty-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #38bdf8;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
  line-height: 1.2;
  margin-bottom: 2px;
}

.system-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.6rem 1.15rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  gap: 0.55rem;
  padding: 0.55rem 1.05rem;
}

.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

/* Dark mode (default): show Sun icon, hide Moon icon */
body.dark-mode .theme-icon-moon,
body:not(.light-mode) .theme-icon-moon {
  display: none !important;
}

body.dark-mode .theme-icon-sun,
body:not(.light-mode) .theme-icon-sun {
  display: inline-flex !important;
  color: #f59e0b;
}

/* Light mode: show Moon icon, hide Sun icon */
body.light-mode .theme-icon-sun {
  display: none !important;
}

body.light-mode .theme-icon-moon {
  display: inline-flex !important;
  color: #6366f1;
}

.theme-toggle-btn:hover .theme-icon {
  transform: rotate(30deg) scale(1.15);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   RIGHT FLOATING HUD NAVIGATION
   ========================================================================== */
.floating-hud {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  z-index: 90;
}

.hud-track {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(13, 20, 36, 0.55);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 0.55rem;
  border-radius: 9999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.hud-dot {
  position: relative;
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.hud-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-dot:hover .hud-circle {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.3);
}

.hud-dot.active .hud-circle {
  width: 10px;
  height: 10px;
  background: #ffffff;
  box-shadow: 0 0 14px 3px var(--active-hud-glow, rgba(255, 255, 255, 0.7));
  transform: scale(1.2);
}

.hud-tooltip {
  position: absolute;
  right: 36px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: all 0.2s ease;
}

.hud-dot:hover .hud-tooltip {
  opacity: 1;
  transform: translateX(0);
}

.hud-btn-scroll-top {
  background: rgba(13, 20, 36, 0.55);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.hud-btn-scroll-top:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* ==========================================================================
   SCROLL TRACK & CINEMATIC SCENES (5000px Track)
   ========================================================================== */
.scroll-track-container {
  position: relative;
  width: 100%;
  height: 5000px; /* Long track for continuous smooth physics scroll */
  z-index: 10;
}

.sticky-stage {
  position: sticky;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-height) + 1.25rem) 3.5rem 1.5rem 3.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 16px, 0);
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              visibility 0.4s;
  will-change: opacity, transform;
  contain: layout paint;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  z-index: 1;
}

.scene.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translate3d(0, 0, 0) !important;
  z-index: 20 !important;
}

/* ==========================================================================
   STAGGERED SCROLL-REVEAL CHOREOGRAPHY (AWWWARDS / CINEMATIC LANDING)
   ========================================================================== */

/* --- Scene 1: Intro Cascade --- */
.scene-intro.active .intro-prestige-badge {
  animation: revealDown 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.scene-intro.active .intro-title {
  animation: revealUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

.scene-intro.active .nexus-svg-web {
  animation: fadeIn 0.8s ease 0.25s both;
}

.scene-intro.active .house-flags-grid .house-flag-card:nth-child(1) {
  animation: revealCardUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
}

.scene-intro.active .house-flags-grid .house-flag-card:nth-child(2) {
  animation: revealCardUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}

.scene-intro.active .house-flags-grid .house-flag-card:nth-child(3) {
  animation: revealCardUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both;
}

.scene-intro.active .house-flags-grid .house-flag-card:nth-child(4) {
  animation: revealCardUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.40s both;
}

.scene-intro.active .scroll-cue {
  animation: fadeIn 0.8s ease 0.55s both, floatCue 2.2s ease-in-out infinite 1.35s;
}

/* --- Scenes 2 - 5: House Storytelling Showcase --- */
.scene-house.active .house-bezel-outer {
  animation: revealMonolith 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

.scene-house.active .eyebrow-badge {
  animation: revealDown 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

.scene-house.active .house-title-group {
  animation: revealUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.scene-house.active .house-manifesto-box {
  animation: revealUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}

.scene-house.active .bento-row .bento-cell:nth-child(1) {
  animation: revealBento 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.30s both;
}

.scene-house.active .bento-row .bento-cell:nth-child(2) {
  animation: revealBento 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.36s both;
}

.scene-house.active .bento-telemetry-strip {
  animation: revealBento 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
}

.scene-house.active .roster-actions-container {
  animation: revealUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.48s both;
}

/* Right Column: 3D Card Stage Entrance */
.scene-house.active .shrine-bezel-outer {
  animation: reveal3DStage 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
}

.scene-house.active .shrine-floating-emblem {
  animation: popInEmblem 0.75s cubic-bezier(0.34, 1.4, 0.64, 1) 0.38s both;
}

/* ==========================================================================
   SCROLL REVEAL KEYFRAMES
   ========================================================================== */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes revealDown {
  0% {
    opacity: 0;
    transform: translate3d(0, -18px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes revealUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes revealCardUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 36px, 0) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes revealMonolith {
  0% {
    opacity: 0;
    transform: translate3d(-30px, 0, 0) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes revealBento {
  0% {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes reveal3DStage {
  0% {
    opacity: 0;
    transform: translate3d(36px, 0, 0) rotateY(-8deg) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateY(0deg) scale(1);
  }
}

@keyframes popInEmblem {
  0% {
    opacity: 0;
    transform: scale(0.5) translate3d(14px, 14px, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate3d(0, 0, 0);
  }
}

/* ==========================================================================
   SCENE 1: SYSTEM OVERVIEW / INTRO
   ========================================================================== */
.scene-intro {
  padding: calc(var(--nav-height) + 1.25rem) 2.5rem 1.5rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-intro-inner {
  max-width: 1060px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  position: relative;
  z-index: 15;
  width: 100%;
  margin: auto 0;
}

/* ==========================================================================
   HERO TITLE SHOWCASE & ARCHITECTURAL TYPOGRAPHY (SCENE 1)
   ========================================================================== */
.hero-title-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.hero-ambient-glow {
  position: absolute;
  width: 800px;
  height: 280px;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  background: radial-gradient(ellipse at center, rgba(255, 122, 0, 0.12) 0%, rgba(0, 184, 122, 0.12) 40%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.intro-prestige-badge {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.badge-line {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.badge-text {
  font-family: var(--font-serif);
  font-size: 0.76rem;
  letter-spacing: 0.35em;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.intro-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.96;
  text-align: center;
}

.title-main {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 4.8vw, 4.2rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  margin-right: -0.2em;
  color: #ffffff;
  background: linear-gradient(180deg, #ffffff 25%, #e2e8f0 65%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.9));
}

.title-sub {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.8vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  margin-right: -0.16em;
  color: #e2e8f0;
  margin-top: 0.25rem;
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.8));
}

.brand-vu {
  background: linear-gradient(135deg, #ffb366 0%, #ff7a00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 25px rgba(255, 122, 0, 0.55));
}

.brand-med {
  background: linear-gradient(135deg, #6ee7b7 0%, #00b87a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 25px rgba(0, 184, 122, 0.55));
}

/* ==========================================================================
   4-HOUSE PRESTIGE SHOWCASE & CONSTELLATION NEXUS (SCENE 1)
   ========================================================================== */
.house-nexus-stage {
  position: relative;
  width: 100%;
  max-width: 1040px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
}

.nexus-constellation-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  transform: translateZ(0);
  will-change: transform;
}

.nexus-svg-web {
  position: absolute;
  top: -30px;
  left: 0;
  width: 100%;
  height: 160px;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
  opacity: 0.35;
  transition: opacity 0.45s ease;
}

.nexus-svg-web.active {
  opacity: 1;
}

.nexus-link-line {
  fill: none;
  stroke: rgba(203, 213, 225, 0.15);
  stroke-width: 1.25;
  stroke-dasharray: 4 6;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.nexus-link-line.link-archimedes.energized {
  stroke: url(#beam-archimedes);
  stroke-width: 2.2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 12px #3b82f6);
}

.nexus-link-line.link-hippocrates.energized {
  stroke: url(#beam-hippocrates);
  stroke-width: 2.2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 12px #a855f7);
}

.nexus-link-line.link-galen.energized {
  stroke: url(#beam-galen);
  stroke-width: 2.2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 12px #ef4444);
}

.nexus-link-line.link-osler.energized {
  stroke: url(#beam-osler);
  stroke-width: 2.2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 12px #f59e0b);
}

.house-flags-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.35rem;
  width: 100%;
  max-width: 1040px;
  position: relative;
  z-index: 10;
}

.house-flag-card {
  cursor: pointer;
  outline: none;
  position: relative;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.house-flag-card:hover {
  transform: translateY(-8px);
}

.flag-bezel-outer {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  padding: 6px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
}

.flag-bezel-inner {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(10, 15, 29, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 0.95rem 0.85rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  height: 100%;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.flag-house-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.flag-house-num {
  font-family: var(--font-serif);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: #94a3b8;
  font-weight: 800;
}

.flag-sigil-badge {
  font-family: var(--font-sans);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.flag-visual-stage {
  width: 100%;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.65rem;
  border-radius: 12px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.35) 100%);
  overflow: hidden;
}

.flag-banner-img {
  max-height: 110px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s ease;
}

.house-flag-card:hover .flag-banner-img {
  transform: scale(1.06) translateY(-2px);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.85));
}

.flag-light-sweep {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.75s ease;
  pointer-events: none;
}

.house-flag-card:hover .flag-light-sweep {
  left: 140%;
}

.flag-meta-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.2rem;
}

.flag-house-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
  transition: color 0.3s ease;
}

.flag-house-motto {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.flag-hover-indicator {
  margin-top: 0.85rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #94a3b8;
  transition: all 0.3s ease;
}

.flag-hover-indicator svg {
  transition: transform 0.3s ease;
}

.house-flag-card:hover .flag-hover-indicator svg {
  transform: translateX(3px);
}

/* --- Signature House Hover Color Systems --- */
.flag-archimedes:hover .flag-bezel-outer {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 16px 36px rgba(26, 77, 140, 0.45), 0 0 25px rgba(59, 130, 246, 0.25);
}
.flag-archimedes:hover .flag-house-name,
.flag-archimedes:hover .flag-hover-indicator {
  color: #60a5fa;
}

.flag-hippocrates:hover .flag-bezel-outer {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 16px 36px rgba(71, 38, 107, 0.48), 0 0 25px rgba(168, 85, 247, 0.25);
}
.flag-hippocrates:hover .flag-house-name,
.flag-hippocrates:hover .flag-hover-indicator {
  color: #c084fc;
}

.flag-galen:hover .flag-bezel-outer {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 16px 36px rgba(123, 28, 32, 0.48), 0 0 25px rgba(239, 68, 68, 0.25);
}
.flag-galen:hover .flag-house-name,
.flag-galen:hover .flag-hover-indicator {
  color: #f87171;
}

.flag-osler:hover .flag-bezel-outer {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 16px 36px rgba(201, 146, 37, 0.45), 0 0 25px rgba(245, 158, 11, 0.25);
}
.flag-osler:hover .flag-house-name,
.flag-osler:hover .flag-hover-indicator {
  color: #fbbf24;
}

.house-flag-card:hover {
  transform: translateY(-8px);
}

.house-flag-card:hover .flag-banner-img {
  transform: scale(1.08);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
}

.house-flag-card:hover .flag-light-sweep {
  left: 140%;
}

.house-flag-card:hover .flag-hover-indicator svg {
  transform: translateY(2px);
}

.scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.75;
  animation: floatCue 2.2s ease-in-out infinite;
}

.scroll-text {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-weight: 700;
}

.mouse-icon {
  width: 20px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  position: relative;
}

.mouse-wheel {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 6px;
  background: #ffffff;
  border-radius: 2px;
  transform: translateX(-50%);
  animation: wheelScroll 1.8s infinite;
}

@keyframes wheelScroll {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 12px); }
}

@keyframes floatCue {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ==========================================================================
   CINEMATIC HERO SPLIT LAYOUT (SCENES 2 - 5) - SOVEREIGN MONOLITH ARCHITECTURE
   ========================================================================== */
.hero-split-layout {
  max-width: var(--max-content-width);
  width: 100%;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 3.25rem;
  align-items: center;
  pointer-events: auto;
}

/* Outer Shell: Precision Machined Tray (Doppelrand Architectural Monolith) */
.house-bezel-outer {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px;
  border-radius: 32px;
  box-shadow: 0 35px 100px -20px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.house-bezel-outer:hover {
  transform: translateY(-2px);
  box-shadow: 0 45px 110px -15px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.monolith-archimedes:hover { border-color: rgba(59, 130, 246, 0.35); }
.monolith-hippocrates:hover { border-color: rgba(168, 85, 247, 0.35); }
.monolith-galen:hover { border-color: rgba(239, 68, 68, 0.35); }
.monolith-osler:hover { border-color: rgba(245, 158, 11, 0.35); }

/* Inner Core: Refracted Midnight Crystal Chamber */
.house-glass-panel {
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.88) 0%, rgba(8, 12, 22, 0.96) 100%);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: calc(32px - 10px);
  padding: 2.25rem 2.4rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 16px 40px rgba(0, 0, 0, 0.5);
}

.panel-inner-glow {
  position: absolute;
  top: -80px;
  right: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.3;
}

.scene-archimedes .panel-inner-glow { background: var(--color-archimedes-light); }
.scene-hippocrates .panel-inner-glow { background: var(--color-hippocrates-light); }
.scene-galen .panel-inner-glow { background: var(--color-galen-light); }
.scene-osler .panel-inner-glow { background: var(--color-osler-light); }

/* Top Identity & Status Capsule */
.house-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.95rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.9rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.badge-arc-pill { border-color: rgba(59, 130, 246, 0.3); background: rgba(59, 130, 246, 0.08); }
.badge-hip-pill { border-color: rgba(168, 85, 247, 0.3); background: rgba(168, 85, 247, 0.08); }
.badge-gal-pill { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); }
.badge-osl-pill { border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.08); }

.badge-house-tag {
  font-family: monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #f1f5f9;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pulse-beacon {
  animation: beaconPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes beaconPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.35); }
}

.badge-arc-pill .badge-dot { background: #3b82f6; box-shadow: 0 0 8px #3b82f6; }
.badge-hip-pill .badge-dot { background: #a855f7; box-shadow: 0 0 8px #a855f7; }
.badge-gal-pill .badge-dot { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.badge-osl-pill .badge-dot { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }

/* Monumental Typography Block */
.house-title-group {
  margin-bottom: 1.15rem;
}

.house-name-en {
  font-family: var(--font-serif);
  font-size: 2.85rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.05;
  margin-bottom: 0.35rem;
}

.title-archimedes {
  background: linear-gradient(135deg, #ffffff 30%, #93c5fd 70%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(59, 130, 246, 0.35));
}

.title-hippocrates {
  background: linear-gradient(135deg, #ffffff 30%, #d8b4fe 70%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(168, 85, 247, 0.35));
}

.title-galen {
  background: linear-gradient(135deg, #ffffff 30%, #fca5a5 70%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(239, 68, 68, 0.35));
}

.title-osler {
  background: linear-gradient(135deg, #ffffff 30%, #fde047 70%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(245, 158, 11, 0.35));
}

.house-title-sub-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.house-name-th {
  font-family: var(--font-thai);
  font-size: 1.08rem;
  color: #f1f5f9;
  font-weight: 600;
}

.title-separator {
  color: #475569;
  font-size: 0.75rem;
}

.house-crest-title {
  font-family: var(--font-serif);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
}

.house-color-pill {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
}

.color-arc { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.25); }
.color-hip { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.25); }
.color-gal { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }
.color-osl { background: rgba(245, 158, 11, 0.15); color: #fde047; border: 1px solid rgba(245, 158, 11, 0.25); }

/* House Philosophical Doctrine & Manifesto Chamber */
.house-manifesto-box {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 16px;
  padding: 1rem 1.25rem 1rem 1.4rem;
  margin-bottom: 1.2rem;
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: stretch;
  gap: 0.95rem;
}

.manifesto-accent-line {
  width: 3px;
  border-radius: 4px;
  flex-shrink: 0;
}

.line-arc { background: linear-gradient(180deg, #3b82f6, #60a5fa); box-shadow: 0 0 10px rgba(59, 130, 246, 0.6); }
.line-hip { background: linear-gradient(180deg, #a855f7, #c084fc); box-shadow: 0 0 10px rgba(168, 85, 247, 0.6); }
.line-gal { background: linear-gradient(180deg, #ef4444, #f87171); box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); }
.line-osl { background: linear-gradient(180deg, #f59e0b, #fbbf24); box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }

.manifesto-text-wrap {
  flex: 1;
}

.house-description {
  font-family: var(--font-thai), var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.68;
  color: #cbd5e1;
  margin: 0;
  font-weight: 400;
}

/* Asymmetric Academic Matrix Bento */
.house-spec-bento {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.2rem;
}

.bento-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.bento-cell {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-cell:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.bento-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.icon-arc { color: #60a5fa; background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.25); }
.icon-hip { color: #c084fc; background: rgba(168, 85, 247, 0.12); border-color: rgba(168, 85, 247, 0.25); }
.icon-gal { color: #f87171; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.25); }
.icon-osl { color: #fbbf24; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.25); }

.bento-cell-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bento-label {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.bento-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.35;
}

/* Telemetry Strip */
.bento-telemetry-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.15rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
}

.telemetry-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.telemetry-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: beaconPulse 2s infinite;
}

.dot-arc { background: #3b82f6; box-shadow: 0 0 10px #3b82f6; }
.dot-hip { background: #a855f7; box-shadow: 0 0 10px #a855f7; }
.dot-gal { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.dot-osl { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }

.telemetry-label {
  font-family: monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #94a3b8;
}

.telemetry-val {
  font-family: monospace;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #38bdf8;
}

/* Compact Telemetry Strip in House Header */
.telemetry-compact-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.85rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
}

/* ==========================================================================
   CENTER 3D FLIPPABLE MASTER CARD (FACULTY ADVISORS <-> HOUSE CREST)
   ========================================================================== */
.hero-center-stage {
  max-width: 1040px;
  width: 90vw;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 2000px;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.flip-card-3d {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 28px;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s ease;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* 3D Flip State */
.flip-card-3d.is-flipped {
  transform: rotateY(180deg);
}

/* 3D Hover Lift */
.flip-card-3d:not(.is-flipped):hover {
  transform: translateY(-8px) scale(1.02);
}

.flip-card-3d.is-flipped:hover {
  transform: rotateY(180deg) translateY(-8px) scale(1.02);
}

/* House Glowing Atmospheric Shadows */
.stage-archimedes {
  box-shadow: 0 30px 90px -15px rgba(0, 0, 0, 0.9), 0 0 50px rgba(59, 130, 246, 0.3);
}
.stage-hippocrates {
  box-shadow: 0 30px 90px -15px rgba(0, 0, 0, 0.9), 0 0 50px rgba(168, 85, 247, 0.3);
}
.stage-galen {
  box-shadow: 0 30px 90px -15px rgba(0, 0, 0, 0.9), 0 0 50px rgba(239, 68, 68, 0.3);
}
.stage-osler {
  box-shadow: 0 30px 90px -15px rgba(0, 0, 0, 0.9), 0 0 50px rgba(245, 158, 11, 0.3);
}

.stage-archimedes:hover {
  box-shadow: 0 45px 110px -15px rgba(0, 0, 0, 0.95), 0 0 70px rgba(59, 130, 246, 0.45);
}
.stage-hippocrates:hover {
  box-shadow: 0 45px 110px -15px rgba(0, 0, 0, 0.95), 0 0 70px rgba(168, 85, 247, 0.45);
}
.stage-galen:hover {
  box-shadow: 0 45px 110px -15px rgba(0, 0, 0, 0.95), 0 0 70px rgba(239, 68, 68, 0.45);
}
.stage-osler:hover {
  box-shadow: 0 45px 110px -15px rgba(0, 0, 0, 0.95), 0 0 70px rgba(245, 158, 11, 0.45);
}

/* Card Faces */
.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* FRONT FACE */
.card-face-front {
  background: #090d16;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.stage-archimedes .card-face-front { border-color: rgba(59, 130, 246, 0.35); }
.stage-hippocrates .card-face-front { border-color: rgba(168, 85, 247, 0.35); }
.stage-galen .card-face-front { border-color: rgba(239, 68, 68, 0.35); }
.stage-osler .card-face-front { border-color: rgba(245, 158, 11, 0.35); }

.card-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-glare {
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-25deg);
  pointer-events: none;
  transition: left 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.flip-card-3d:hover .card-glare {
  left: 200%;
}

/* Zoom Button in Front Top-Right */
.card-zoom-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f8fafc;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.42rem 0.85rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.card-zoom-btn:hover {
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

/* Flip Cues */
.card-flip-cue {
  position: absolute;
  bottom: 16px;
  right: 18px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f8fafc;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.42rem 0.95rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 4px 15px rgba(0,0,0,0.4); }
  100% { box-shadow: 0 4px 22px rgba(255,255,255,0.25); }
}

/* BACK FACE: HERALDIC CREST & HOUSE IDENTITY */
.card-face-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, rgba(13, 20, 36, 0.97) 0%, rgba(6, 10, 18, 0.99) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  padding: 2.2rem 3rem;
  display: flex;
  align-items: center;
  position: relative;
}

.stage-archimedes .card-face-back { border-color: rgba(59, 130, 246, 0.45); }
.stage-hippocrates .card-face-back { border-color: rgba(168, 85, 247, 0.45); }
.stage-galen .card-face-back { border-color: rgba(239, 68, 68, 0.45); }
.stage-osler .card-face-back { border-color: rgba(245, 158, 11, 0.45); }

.back-sigil-ambient {
  position: absolute;
  top: 50%;
  left: 20%;
  width: 400px;
  height: 400px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.35;
}

.glow-archimedes { background: #3b82f6; }
.glow-hippocrates { background: #a855f7; }
.glow-galen { background: #ef4444; }
.glow-osler { background: #f59e0b; }

.back-card-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}

/* Left: Emblem Chamber */
.back-emblem-chamber {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.emblem-aura-ring {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  animation: rotateSlow 24s linear infinite;
  pointer-events: none;
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.back-emblem-img {
  max-width: 230px;
  max-height: 230px;
  object-fit: contain;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
  animation: floatEmblem 4s ease-in-out infinite alternate;
}

@keyframes floatEmblem {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.03); }
}

/* Right: Lore & Heraldry Chamber */
.back-lore-chamber {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  gap: 0.65rem;
}

.back-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.1rem;
}

.back-title-en {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.05;
  margin: 0;
}

.back-title-sub {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.back-lore-quote {
  font-family: var(--font-thai);
  font-size: 1.02rem;
  line-height: 1.65;
  color: #e2e8f0;
  font-style: italic;
  font-weight: 400;
  max-width: 580px;
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  padding-left: 1rem;
  margin: 0.4rem 0 0.8rem 0;
}

.back-actions-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.back-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 1.35rem;
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  box-shadow: 0 8px 24px -5px rgba(0, 0, 0, 0.5);
}

.back-action-btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
  color: #ffffff;
}

.back-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.back-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Action Area */
.roster-actions-container {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.roster-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.roster-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.roster-pill-track {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.roster-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 0.32rem 0.72rem;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.roster-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Button-in-Button Primary Interactive CTA */
.house-primary-cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem 0.75rem 1.4rem;
  border-radius: 14px;
  border: 1px solid transparent;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.house-primary-cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.house-primary-cta:active {
  transform: translateY(0) scale(0.99);
}

.cta-icon-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.house-primary-cta:hover .cta-icon-bubble {
  transform: translate(2px, -2px);
  background: rgba(255, 255, 255, 0.3);
}

.cta-archimedes {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  border-color: rgba(96, 165, 250, 0.3);
}

.cta-hippocrates {
  background: linear-gradient(135deg, #6b21a8, #7e22ce);
  box-shadow: 0 6px 20px rgba(126, 34, 206, 0.35);
  border-color: rgba(192, 132, 252, 0.3);
}

.cta-galen {
  background: linear-gradient(135deg, #991b1b, #b91c1c);
  box-shadow: 0 6px 20px rgba(185, 28, 28, 0.35);
  border-color: rgba(248, 113, 113, 0.3);
}

.cta-osler {
  background: linear-gradient(135deg, #b45309, #d97706);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35);
  border-color: rgba(251, 191, 36, 0.3);
}

.osler-cta-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.full-archive-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  padding: 0.65rem 1.25rem;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.full-archive-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   RIGHT COLUMN: 3D HOLOGRAPHIC ARTIFACT SHRINE (DOPPELRAND STAGE)
   ========================================================================== */
.house-visual-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.shrine-bezel-outer {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 8px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.1s ease-out, border-color 0.3s ease, box-shadow 0.3s ease;
}

.shrine-bezel-outer:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 35px 90px -10px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Inner Glass Stage */
.shrine-glass-stage {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(8, 12, 24, 0.98) 100%);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(28px - 8px);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Center Artwork Chamber */
.shrine-artwork-chamber {
  width: 100%;
  height: 380px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  perspective: 1200px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.6) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
}

/* 3D Flippable Stage */
.shrine-flip-stage {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
  outline: none;
}

.shrine-card-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.shrine-flip-stage.is-flipped .shrine-card-3d {
  transform: rotateY(180deg);
}

.shrine-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
}

/* FRONT FACE */
.shrine-face-front {
  z-index: 2;
  transform: rotateY(0deg);
}

.shrine-card-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  filter: brightness(0.94) contrast(1.06);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
  position: relative;
  z-index: 1;
}

.shrine-flip-stage:hover .shrine-card-art {
  transform: scale(1.04);
  filter: brightness(1.02) contrast(1.08);
}

.shrine-floating-emblem {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.95));
  z-index: 3;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.shrine-flip-stage:hover .shrine-floating-emblem {
  transform: scale(1.12) translateY(-4px);
}

.shrine-light-sweep {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-20deg);
  transition: left 0.85s ease;
  pointer-events: none;
  z-index: 2;
}

.shrine-flip-stage:hover .shrine-light-sweep {
  left: 140%;
}

.emblem-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(50px);
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
}

.glow-archimedes { background: radial-gradient(circle, #2563eb 0%, transparent 70%); }
.glow-hippocrates { background: radial-gradient(circle, #9333ea 0%, transparent 70%); }
.glow-galen { background: radial-gradient(circle, #dc2626 0%, transparent 70%); }
.glow-osler { background: radial-gradient(circle, #d97706 0%, transparent 70%); }

/* BACK FACE: Grand Emblem Showcase */
.shrine-face-back {
  transform: rotateY(180deg);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.4rem 1.25rem 1.15rem 1.25rem;
  text-align: center;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96) 0%, rgba(6, 9, 18, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.7);
}

.back-archimedes { border-color: rgba(59, 130, 246, 0.35); }
.back-hippocrates { border-color: rgba(168, 85, 247, 0.35); }
.back-galen { border-color: rgba(239, 68, 68, 0.35); }
.back-osler { border-color: rgba(245, 158, 11, 0.35); }

.back-sigil-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(45px);
  opacity: 0.4;
  pointer-events: none;
}

.back-content-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
}

.back-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.back-kicker {
  font-family: monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #94a3b8;
}

.back-title {
  font-family: var(--font-cinzel), serif;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  margin: 0;
}

.back-emblem-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0.35rem 0;
}

.back-grand-emblem {
  width: 145px;
  height: 145px;
  object-fit: contain;
  filter: drop-shadow(0 12px 25px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.15));
  animation: grandEmblemFloat 4s ease-in-out infinite alternate;
}

@keyframes grandEmblemFloat {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-6px) scale(1.05); }
}

.back-description {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #cbd5e1;
  font-weight: 400;
  margin: 0 0 0.35rem 0;
  max-width: 310px;
}

/* Interactive Flip Hint Badges */
.flip-hint-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #f8fafc;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: all 0.25s ease;
}

.shrine-flip-stage:hover .flip-hint-badge {
  background: rgba(0, 0, 0, 0.88);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(-50%) scale(1.05);
}

.back-hint {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  margin-top: 0.2rem;
}

.shrine-flip-stage:hover .back-hint {
  transform: scale(1.05);
}

/* ==========================================================================
   FROSTED GLASS DIRECTORY MODAL
   ========================================================================== */
.directory-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.directory-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.directory-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 14, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.directory-modal-container {
  position: relative;
  width: 100%;
  max-width: 1100px;
  max-height: 88vh;
  background: rgba(13, 20, 36, 0.88);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.directory-modal-overlay.open .directory-modal-container {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.75rem 2.25rem 1.25rem 2.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.modal-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: rotate(90deg);
}

/* Modal Toolbar */
.modal-toolbar {
  padding: 1.25rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
}

.house-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.house-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.house-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.house-tab-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.house-tab-btn.tab-archimedes.active { background: var(--color-archimedes); border-color: #60a5fa; }
.house-tab-btn.tab-hippocrates.active { background: var(--color-hippocrates); border-color: #c084fc; }
.house-tab-btn.tab-galen.active { background: var(--color-galen); border-color: #f87171; }
.house-tab-btn.tab-osler.active { background: var(--color-osler); border-color: #fbbf24; }

.toolbar-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cohort-filter-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cohort-pill {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cohort-pill:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.cohort-pill.active {
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
}

.search-box-wrapper {
  position: relative;
  flex: 1;
  max-width: 380px;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  color: #ffffff;
  padding: 0.6rem 2.25rem 0.6rem 2.5rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.clear-search-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.result-status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Modal Body Scroll & Grid */
.modal-body-scroll {
  padding: 1.75rem 2.25rem;
  overflow-y: auto;
  max-height: 52vh;
}

.modal-body-scroll::-webkit-scrollbar {
  width: 6px;
}

.modal-body-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.modal-body-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Student Directory Card */
.student-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.student-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.student-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.student-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.avatar-archimedes { background: var(--color-archimedes); box-shadow: 0 0 10px var(--color-archimedes-glow); }
.avatar-hippocrates { background: var(--color-hippocrates); box-shadow: 0 0 10px var(--color-hippocrates-glow); }
.avatar-galen { background: var(--color-galen); box-shadow: 0 0 10px var(--color-galen-glow); }
.avatar-osler { background: var(--color-osler); box-shadow: 0 0 10px var(--color-osler-glow); }

.student-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.student-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.student-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.student-badges-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.badge-role {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.badge-role.lead {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-class {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state svg {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state h3 {
  color: #ffffff;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.88rem;
  max-width: 360px;
  margin-bottom: 1.5rem;
}

.reset-filter-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-split-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    max-height: 85vh;
    overflow-y: auto;
    padding-right: 0.5rem;
  }

  .house-visual-panel {
    order: -1;
  }

  .shrine-bezel-outer {
    max-width: 360px;
  }

  .shrine-artwork-chamber {
    height: 280px;
  }

  .shrine-floating-emblem {
    width: 75px;
    height: 75px;
  }

  .back-grand-emblem {
    width: 110px;
    height: 110px;
  }

  .scene {
    padding: var(--nav-height) 2rem 2rem 2rem;
  }

  .floating-hud {
    right: 1rem;
  }

  .house-flags-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 540px;
    gap: 1rem;
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  .top-nav {
    padding: 0 1.25rem;
  }

  .faculty-title {
    display: none;
  }

  .floating-hud {
    display: none;
  }

  .house-bezel-outer {
    border-radius: 24px;
    padding: 6px;
  }

  .house-glass-panel {
    padding: 1.5rem 1.25rem;
    border-radius: calc(24px - 6px);
  }

  .house-name-en {
    font-size: 2.2rem;
  }

  .bento-row {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .shrine-bezel-outer {
    max-width: 320px;
  }

  .shrine-artwork-chamber {
    height: 260px;
  }

  .shrine-floating-emblem {
    width: 65px;
    height: 65px;
  }

  .back-grand-emblem {
    width: 95px;
    height: 95px;
  }

  .back-description {
    font-size: 0.72rem;
    line-height: 1.4;
  }

  .hero-title-showcase {
    margin-bottom: 2rem;
  }

  .intro-prestige-badge {
    gap: 0.75rem;
  }

  .badge-line {
    width: 24px;
  }

  .badge-text {
    font-size: 0.7rem;
    letter-spacing: 0.25em;
  }

  .title-main {
    font-size: 2.85rem;
    letter-spacing: 0.18em;
    margin-right: -0.18em;
  }

  .title-sub {
    font-size: 1.65rem;
    letter-spacing: 0.18em;
    margin-right: -0.18em;
    margin-top: 0.25rem;
  }

  .students-grid {
    grid-template-columns: 1fr;
  }

  .house-flags-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .flag-visual-stage {
    height: 110px;
  }

  .flag-banner-img {
    max-height: 95px;
  }

  .flag-house-name {
    font-size: 0.9rem;
  }
}

/* ==========================================================================
   LIGHT MODE DESIGN SYSTEM (LUXURY ARCHITECTURAL MARBLE & ICE WHITE)
   Aesthetic: High-end medical faculty prestige, luminous frosted porcelain,
              crisp typography, jewel-toned house accents, and high-contrast readouts.
   ========================================================================== */

:root[data-color-mode="light"],
body.light-mode {
  --bg-deep: #f4f6f9;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-card-bg: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-hover: rgba(15, 23, 42, 0.18);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --active-hud-glow: rgba(15, 23, 42, 0.4);
}

body.light-mode {
  background-color: var(--bg-deep);
  color: var(--text-primary);
}

/* Global Theme Transition */
body,
.bg-layer,
.bg-overlay,
.top-nav,
.nav-btn,
.floating-hud,
.hud-track,
.house-bezel-outer,
.house-glass-panel,
.shrine-bezel-outer,
.shrine-glass-stage,
.bento-cell,
.house-manifesto-box,
.bento-telemetry-strip,
.directory-modal-container,
.student-card {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}

/* --- Light Mode Background & Atmospheric Lighting --- */
body.light-mode .bg-layer {
  opacity: 0;
}

body.light-mode .bg-layer.active {
  opacity: 0.58;
  filter: saturate(1.15) brightness(1.02);
}

body.light-mode .bg-overlay {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.35) 0%, rgba(244, 246, 249, 0.62) 65%, rgba(244, 246, 249, 0.88) 100%),
              linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(248, 250, 252, 0.18) 50%, rgba(244, 246, 249, 0.82) 100%);
}

body.light-mode .ambient-glow {
  opacity: 0.6;
  filter: blur(80px);
}

/* --- Light Mode Top Navigation --- */
body.light-mode .top-nav {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

body.light-mode .brand-logo {
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.15));
}

body.light-mode .faculty-title {
  color: #0284c7;
  text-shadow: 0 1px 2px rgba(2, 132, 199, 0.12);
  font-weight: 800;
}

body.light-mode .system-title {
  color: #0f172a;
}

body.light-mode .nav-btn {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.1);
  color: #1e293b;
}

body.light-mode .nav-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: rgba(15, 23, 42, 0.2);
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

/* --- Light Mode Floating HUD --- */
body.light-mode .hud-track {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

body.light-mode .hud-circle {
  background: rgba(15, 23, 42, 0.25);
}

body.light-mode .hud-dot:hover .hud-circle {
  background: rgba(15, 23, 42, 0.7);
}

body.light-mode .hud-dot.active .hud-circle {
  background: #0f172a;
  box-shadow: 0 0 10px 2px var(--active-hud-glow, rgba(15, 23, 42, 0.4));
}

body.light-mode .hud-tooltip {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

body.light-mode .hud-btn-scroll-top {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 23, 42, 0.1);
  color: #475569;
}

body.light-mode .hud-btn-scroll-top:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.25);
}

/* --- Light Mode Scene 1: Intro / Hero Section --- */
body.light-mode .hero-ambient-glow {
  background: radial-gradient(ellipse at center, rgba(255, 122, 0, 0.15) 0%, rgba(0, 184, 122, 0.15) 40%, transparent 70%);
}

body.light-mode .badge-line {
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.25), transparent);
}

body.light-mode .badge-text {
  color: #475569;
  text-shadow: none;
}

body.light-mode .title-main {
  color: #0f172a;
  background: linear-gradient(180deg, #0f172a 20%, #1e293b 65%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(15, 23, 42, 0.1));
}

body.light-mode .title-sub {
  color: #1e293b;
  filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.08));
}

body.light-mode .brand-vu {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(234, 88, 12, 0.35));
}

body.light-mode .brand-med {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(5, 150, 105, 0.35));
}

body.light-mode .nexus-link-line {
  stroke: rgba(100, 116, 139, 0.25);
}

/* 4-House Cards in Scene 1 */
body.light-mode .flag-bezel-outer {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

body.light-mode .flag-bezel-inner {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
  border-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .flag-house-header {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .flag-house-num {
  color: #64748b;
}

body.light-mode .flag-sigil-badge {
  background: rgba(15, 23, 42, 0.05);
  color: #475569;
}

body.light-mode .flag-visual-stage {
  background: radial-gradient(circle at center, rgba(241, 245, 249, 0.95) 0%, rgba(226, 232, 240, 0.7) 100%);
}

body.light-mode .flag-banner-img {
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.22));
}

body.light-mode .flag-house-name {
  color: #0f172a;
}

body.light-mode .flag-house-motto {
  color: #64748b;
}

body.light-mode .flag-hover-indicator {
  border-top-color: rgba(15, 23, 42, 0.06);
  color: #64748b;
}

body.light-mode .flag-light-sweep {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
}

body.light-mode .scroll-cue .mouse-icon {
  border-color: rgba(15, 23, 42, 0.35);
}

body.light-mode .scroll-cue .mouse-wheel {
  background: #0f172a;
}

body.light-mode .scroll-text {
  color: #64748b;
}

/* Flag Card Hover in Light Mode */
body.light-mode .flag-archimedes:hover .flag-bezel-outer {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.18), 0 0 20px rgba(37, 99, 235, 0.12);
}
body.light-mode .flag-archimedes:hover .flag-house-name,
body.light-mode .flag-archimedes:hover .flag-hover-indicator {
  color: #1d4ed8;
}

body.light-mode .flag-hippocrates:hover .flag-bezel-outer {
  border-color: rgba(147, 51, 234, 0.5);
  box-shadow: 0 16px 36px rgba(147, 51, 234, 0.18), 0 0 20px rgba(147, 51, 234, 0.12);
}
body.light-mode .flag-hippocrates:hover .flag-house-name,
body.light-mode .flag-hippocrates:hover .flag-hover-indicator {
  color: #7e22ce;
}

body.light-mode .flag-galen:hover .flag-bezel-outer {
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 16px 36px rgba(220, 38, 38, 0.18), 0 0 20px rgba(220, 38, 38, 0.12);
}
body.light-mode .flag-galen:hover .flag-house-name,
body.light-mode .flag-galen:hover .flag-hover-indicator {
  color: #b91c1c;
}

body.light-mode .flag-osler:hover .flag-bezel-outer {
  border-color: rgba(217, 119, 6, 0.5);
  box-shadow: 0 16px 36px rgba(217, 119, 6, 0.18), 0 0 20px rgba(217, 119, 6, 0.12);
}
body.light-mode .flag-osler:hover .flag-house-name,
body.light-mode .flag-osler:hover .flag-hover-indicator {
  color: #b45309;
}

/* --- Light Mode Scenes 2 - 5: Sovereign Monolith & Bento --- */
body.light-mode .house-bezel-outer {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 25px 70px -15px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body.light-mode .house-bezel-outer:hover {
  box-shadow: 0 35px 85px -10px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1);
}

body.light-mode .house-glass-panel {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.93) 100%);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 1), 0 16px 40px rgba(15, 23, 42, 0.04);
}

body.light-mode .eyebrow-badge {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

body.light-mode .badge-house-tag {
  color: #1e293b;
}

/* Light Mode EN House Titles (Rich Jewel-Toned Metallurgy Gradients) */
body.light-mode .title-archimedes {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(37, 99, 235, 0.2));
}

body.light-mode .title-hippocrates {
  background: linear-gradient(135deg, #581c87 0%, #7e22ce 50%, #9333ea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(126, 34, 206, 0.2));
}

body.light-mode .title-galen {
  background: linear-gradient(135deg, #881337 0%, #dc2626 50%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(220, 38, 38, 0.2));
}

body.light-mode .title-osler {
  background: linear-gradient(135deg, #78350f 0%, #d97706 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(217, 119, 6, 0.2));
}

body.light-mode .house-name-th {
  color: #0f172a;
}

body.light-mode .title-separator {
  color: #94a3b8;
}

body.light-mode .house-crest-title {
  color: #64748b;
}

/* Light Mode Doctrine & Bento */
body.light-mode .house-manifesto-box {
  background: rgba(241, 245, 249, 0.85);
  border-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .house-description {
  color: #334155;
  font-weight: 500;
}

body.light-mode .bento-cell {
  background: rgba(241, 245, 249, 0.85);
  border-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .bento-cell:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

body.light-mode .bento-label {
  color: #64748b;
}

body.light-mode .bento-val {
  color: #0f172a;
}

body.light-mode .bento-telemetry-strip {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(15, 23, 42, 0.07);
}

body.light-mode .telemetry-label {
  color: #64748b;
}

body.light-mode .telemetry-val {
  color: #0284c7;
}

body.light-mode .roster-actions-container {
  border-top-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .roster-kicker {
  color: #64748b;
}

body.light-mode .roster-chip {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.1);
  color: #334155;
}

body.light-mode .roster-chip:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: rgba(15, 23, 42, 0.2);
  color: #0f172a;
}

body.light-mode .full-archive-btn {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.12);
  color: #1e293b;
}

body.light-mode .full-archive-btn:hover {
  background: rgba(15, 23, 42, 0.09);
  border-color: rgba(15, 23, 42, 0.2);
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* --- Light Mode 3D Flippable Card Stage --- */
body.light-mode .shrine-bezel-outer {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 25px 70px -15px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body.light-mode .shrine-bezel-outer:hover {
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 35px 85px -10px rgba(15, 23, 42, 0.12), inset 0 1px 0 #ffffff;
}

body.light-mode .shrine-glass-stage {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.92) 100%);
  border-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .shrine-artwork-chamber {
  background: radial-gradient(circle at center, rgba(241, 245, 249, 0.95) 0%, rgba(226, 232, 240, 0.7) 100%);
  border-color: rgba(15, 23, 42, 0.06);
}

/* Light Mode Back Face: Grand Emblem Showcase Stage */
body.light-mode .shrine-face-back {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 246, 250, 0.95) 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 1px 0 #ffffff, 0 10px 30px rgba(15, 23, 42, 0.06);
}

body.light-mode .back-archimedes { border-color: rgba(37, 99, 235, 0.3); }
body.light-mode .back-hippocrates { border-color: rgba(147, 51, 234, 0.3); }
body.light-mode .back-galen { border-color: rgba(220, 38, 38, 0.3); }
body.light-mode .back-osler { border-color: rgba(217, 119, 6, 0.3); }

body.light-mode .back-sigil-glow {
  opacity: 0.35;
  filter: blur(40px);
}

body.light-mode .back-sigil-glow.glow-archimedes { background: radial-gradient(circle, rgba(59, 130, 246, 0.22) 0%, transparent 70%); }
body.light-mode .back-sigil-glow.glow-hippocrates { background: radial-gradient(circle, rgba(168, 85, 247, 0.22) 0%, transparent 70%); }
body.light-mode .back-sigil-glow.glow-galen { background: radial-gradient(circle, rgba(239, 68, 68, 0.22) 0%, transparent 70%); }
body.light-mode .back-sigil-glow.glow-osler { background: radial-gradient(circle, rgba(245, 158, 11, 0.22) 0%, transparent 70%); }

body.light-mode .back-kicker {
  color: #64748b;
  font-weight: 700;
}

body.light-mode .back-title {
  color: #0f172a;
  text-shadow: none;
  font-weight: 900;
}

body.light-mode .back-archimedes .back-title { color: #1e3a8a; }
body.light-mode .back-hippocrates .back-title { color: #581c87; }
body.light-mode .back-galen .back-title { color: #881337; }
body.light-mode .back-osler .back-title { color: #78350f; }

body.light-mode .back-grand-emblem {
  filter: drop-shadow(0 10px 20px rgba(15, 23, 42, 0.18)) drop-shadow(0 0 15px rgba(255, 255, 255, 0.9));
}

body.light-mode .back-description {
  color: #334155;
  font-weight: 500;
}

body.light-mode .flip-hint-badge {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #1e293b;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

body.light-mode .shrine-flip-stage:hover .flip-hint-badge {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.25);
  color: #0f172a;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

/* --- Light Mode Student Directory Modal --- */
body.light-mode .directory-modal-backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.light-mode .directory-modal-container {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.15), inset 0 1px 0 #ffffff;
}

body.light-mode .modal-header {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .modal-title {
  color: #0f172a;
}

body.light-mode .modal-kicker {
  color: #64748b;
}

body.light-mode .modal-close-btn {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.1);
  color: #475569;
}

body.light-mode .modal-close-btn:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}

body.light-mode .modal-toolbar {
  background: rgba(248, 250, 252, 0.85);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .house-tab-btn {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
  color: #475569;
}

body.light-mode .house-tab-btn:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.08);
}

body.light-mode .house-tab-btn.active {
  color: #ffffff;
}

body.light-mode .cohort-pill {
  background: transparent;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

body.light-mode .cohort-pill:hover {
  border-color: rgba(15, 23, 42, 0.25);
  color: #0f172a;
}

body.light-mode .cohort-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

body.light-mode .search-input {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.15);
  color: #0f172a;
}

body.light-mode .search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

body.light-mode .search-input::placeholder {
  color: #94a3b8;
}

body.light-mode .result-status-bar {
  color: #64748b;
}

body.light-mode .modal-body-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.04);
}

body.light-mode .modal-body-scroll::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
}

body.light-mode .student-card {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

body.light-mode .student-card:hover {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body.light-mode .student-name {
  color: #0f172a;
}

body.light-mode .student-id {
  color: #64748b;
}

body.light-mode .student-badges-row {
  border-top-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .badge-role {
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
}

body.light-mode .badge-role.lead {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

body.light-mode .badge-class {
  color: #64748b;
}

body.light-mode .empty-state h3 {
  color: #0f172a;
}

body.light-mode .empty-state p {
  color: #64748b;
}

body.light-mode .reset-filter-btn {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* --- Light Mode Center 3D Flip Card --- */
body.light-mode .card-face-front {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
}

body.light-mode .stage-archimedes {
  box-shadow: 0 30px 75px -15px rgba(15, 23, 42, 0.25), 0 0 40px rgba(37, 99, 235, 0.15);
}
body.light-mode .stage-hippocrates {
  box-shadow: 0 30px 75px -15px rgba(15, 23, 42, 0.25), 0 0 40px rgba(147, 51, 234, 0.15);
}
body.light-mode .stage-galen {
  box-shadow: 0 30px 75px -15px rgba(15, 23, 42, 0.25), 0 0 40px rgba(220, 38, 38, 0.15);
}
body.light-mode .stage-osler {
  box-shadow: 0 30px 75px -15px rgba(15, 23, 42, 0.25), 0 0 40px rgba(217, 119, 6, 0.15);
}

body.light-mode .stage-archimedes:hover {
  box-shadow: 0 45px 95px -15px rgba(15, 23, 42, 0.35), 0 0 55px rgba(37, 99, 235, 0.25);
}
body.light-mode .stage-hippocrates:hover {
  box-shadow: 0 45px 95px -15px rgba(15, 23, 42, 0.35), 0 0 55px rgba(147, 51, 234, 0.25);
}
body.light-mode .stage-galen:hover {
  box-shadow: 0 45px 95px -15px rgba(15, 23, 42, 0.35), 0 0 55px rgba(220, 38, 38, 0.25);
}
body.light-mode .stage-osler:hover {
  box-shadow: 0 45px 95px -15px rgba(15, 23, 42, 0.35), 0 0 55px rgba(217, 119, 6, 0.25);
}

body.light-mode .card-zoom-btn,
body.light-mode .card-flip-cue {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
}

body.light-mode .card-zoom-btn:hover {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.28);
}

body.light-mode .card-face-back {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.97) 0%, rgba(241, 245, 249, 0.98) 100%);
  border-color: rgba(15, 23, 42, 0.14);
}

body.light-mode .back-sigil-ambient {
  opacity: 0.16;
}

body.light-mode .emblem-aura-ring {
  border-color: rgba(15, 23, 42, 0.12);
}

body.light-mode .back-lore-quote {
  color: #334155;
  border-left-color: rgba(15, 23, 42, 0.22);
}

body.light-mode .back-secondary-btn {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.12);
  color: #1e293b;
}

body.light-mode .back-secondary-btn:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}

/* ==========================================================================
   FACULTY ADVISOR HIGH-RES LIGHTBOX MODAL
   ========================================================================== */
.advisor-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.advisor-lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.advisor-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 13, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
}

.advisor-lightbox-container {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  width: 92vw;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.advisor-lightbox-overlay.open .advisor-lightbox-container {
  transform: scale(1) translateY(0);
}

.advisor-lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  z-index: 2;
}

.advisor-lightbox-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.1) rotate(90deg);
}

.advisor-lightbox-body {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #090d16;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.advisor-lightbox-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.advisor-lightbox-caption {
  margin-top: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.5rem;
}

.advisor-lightbox-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: #38bdf8;
}

.advisor-lightbox-desc {
  font-family: var(--font-thai);
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.5;
}

body.light-mode .advisor-lightbox-container {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 40px 100px -20px rgba(15, 23, 42, 0.25), inset 0 1px 0 #ffffff;
}

body.light-mode .advisor-lightbox-close {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.15);
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

body.light-mode .advisor-lightbox-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

body.light-mode .advisor-lightbox-title {
  color: #0284c7;
}

body.light-mode .advisor-lightbox-desc {
  color: #475569;
}


