:root {
  --panel: rgba(18, 8, 32, .94);
  --panel2: rgba(255, 255, 255, .07);
  --line: rgba(190, 90, 255, .35);
  --text: #eee9ff;
  --muted: #cbbdf7;
  --good: #67e8a5;
  --bad: #ff6b9a
}

* {
  box-sizing: border-box
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  text-align: center;
  min-height: 100vh;
  background: radial-gradient(circle at center, #0a0014, #000);
  color: var(--text)
}

body:before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(160, 70, 255, .15), transparent 40%), radial-gradient(circle at 70% 80%, rgba(120, 0, 255, .12), transparent 45%);
  pointer-events: none;
  z-index: -1
}

h1,
h2,
h3 {
  margin: .3em 0
}

p {
  color: var(--muted)
}

button {
  padding: 12px 16px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(10, 0, 20, .9);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(160, 70, 255, .2), inset 0 0 10px rgba(80, 0, 120, .3);
  transition: .2s
}

button:hover {
  transform: scale(1.03);
  box-shadow: 0 0 14px rgba(190, 90, 255, .6), 0 0 30px rgba(120, 0, 255, .3)
}

button.secondary {
  background: rgba(255, 255, 255, .07)
}

button.danger {
  border-color: rgba(255, 70, 120, .7)
}

button.small {
  padding: 8px 10px;
  font-size: 14px
}

input,
textarea,
select {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35);
  color: var(--text);
  font-size: 15px
}

textarea {
  min-height: 82px;
  resize: vertical
}

label {
  display: block;
  margin: 12px 0 6px;
  color: #efe8ff;
  font-weight: bold;
  text-align: left
}

small {
  color: var(--muted)
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 26px 16px
}

.screen.active {
  display: block
}

.centerScreen {
  display: none;
  min-height: 100vh;
  padding: 26px 16px;
  align-items: center;
  justify-content: center
}

.centerScreen.active {
  display: flex
}

.cardPanel {
  width: min(1060px, 94vw);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 0 35px rgba(140, 40, 255, .18)
}

.topActions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px
}

.deckCard,
.miniCard {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel2);
  text-align: left
}

.deckMeta {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 14px
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  color: #e9dcff;
  font-size: 12px;
  margin-right: 5px
}

.formRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

@media(max-width:760px) {
  .formRow {
    grid-template-columns: 1fr
  }
}

.editorLayout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  align-items: start
}

@media(max-width:900px) {
  .editorLayout {
    grid-template-columns: 1fr
  }
}

.hidden {
  display: none !important
}

.notice {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--muted);
  text-align: left
}

.success {
  color: var(--good)
}

.error {
  color: var(--bad)
}

#hud {
  display: none;
  justify-content: space-around;
  gap: 8px;
  padding: 10px;
  font-size: 18px;
  flex-wrap: wrap
}

#timer {
  display: none;
  font-size: 22px
}

.quote {
  font-size: 24px;
  margin: 24px auto;
  font-style: italic;
  max-width: 850px;
  white-space: pre-wrap
}

.mediaBox {
  max-width: 780px;
  margin: 10px auto 20px
}

#gameScreen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px 10px 18px
}

#gameScreen #gameScaleContainer {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform-origin: top center;
  transition: transform .15s ease
}

#gameScreen #hud {
  display: flex;
  width: min(100%, 920px);
  max-width: 100%;
  padding: 12px 14px;
  font-size: clamp(14px, 2.2vw, 18px)
}

#gameScreen #timer {
  display: block;
  font-size: clamp(18px, 2.3vw, 22px);
  width: min(100%, 920px);
  text-align: center
}

#gameScreen #comboShowcase {
  display: block;
  width: min(720px, 94vw);
  margin: 0 auto 8px;
  max-width: 100%
}

#gameScreen .cardPanel {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 20px;
  border-radius: 18px
}

#gameScreen .quote {
  font-size: clamp(20px, 2.6vw, 28px);
  margin: 20px auto;
  max-width: 100%
}

#gameScreen .options {
  max-width: 100%;
  width: min(760px, 100%)
}

#gameScreen .options button {
  padding: 14px 16px;
  font-size: clamp(15px, 2.2vw, 18px)
}

#gameScreen #typedResponseBox {
  max-width: 100%;
  width: min(760px, 100%)
}

#gameScreen #typedAnswerInput {
  font-size: clamp(16px, 2.2vw, 18px)
}

#gameScreen .topActions {
  justify-content: center
}

@media(max-width:760px) {
  #gameScreen.active {
    padding: 10px 8px 14px
  }

  #gameScreen #hud {
    flex-direction: column;
    align-items: center
  }
}

.mediaBox iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
  border-radius: 14px
}

.mediaBox audio {
  width: min(100%, 560px)
}

.options {
  display: grid;
  gap: 10px;
  max-width: 650px;
  margin: auto
}

#typedResponseBox {
  display: none;
  max-width: 650px;
  margin: 0 auto
}

#feedback {
  min-height: 42px;
  margin-top: 15px;
  font-weight: bold
}

#comboShowcase {
  display: none;
  position: relative;
  width: min(720px, 94vw);
  margin: 10px auto 18px;
  padding: 14px 18px 18px;
  isolation: isolate;
  transform: skew(-8deg)
}

#comboShowcase:before,
#comboShowcase:after {
  content: "";
  position: absolute;
  inset: -16px -28px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  filter: blur(10px);
  transition: .25s
}

#comboShowcase:before {
  background: radial-gradient(circle at 20% 90%, var(--flame1, transparent) 0 9%, transparent 22%), radial-gradient(circle at 38% 92%, var(--flame2, transparent) 0 11%, transparent 25%), radial-gradient(circle at 58% 90%, var(--flame1, transparent) 0 10%, transparent 24%), radial-gradient(circle at 78% 94%, var(--flame2, transparent) 0 12%, transparent 26%);
  animation: flameRoar .55s infinite alternate ease-in-out
}

#comboShowcase:after {
  inset: -8px -14px;
  border-radius: 22px;
  border: 2px solid var(--comboColor, #fff);
  box-shadow: 0 0 28px var(--comboGlow, rgba(255, 255, 255, .45))
}

#comboShowcase.flames:before,
#comboShowcase.flames:after {
  opacity: 1
}

.comboHeader {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 16px;
  line-height: .9;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #000, 0 0 18px var(--comboGlow, rgba(255, 255, 255, .4))
}

#comboRank {
  font-size: clamp(54px, 11vw, 112px);
  font-weight: 1000;
  letter-spacing: -6px;
  color: var(--comboColor, #fff);
  -webkit-text-stroke: 3px #050008;
  filter: drop-shadow(0 0 18px var(--comboGlow, rgba(255, 255, 255, .45)))
}

#comboNumber {
  font-size: clamp(40px, 8vw, 86px);
  font-weight: 1000;
  color: var(--numberColor, #fff);
  -webkit-text-stroke: 2px #050008;
  min-width: 96px;
  text-align: left
}

.comboLabel {
  font-size: clamp(18px, 3vw, 34px);
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 8px
}

#comboTitle {
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--comboColor, #fff);
  text-shadow: 2px 2px 0 #000, 0 0 12px var(--comboGlow, rgba(255, 255, 255, .35));
  margin: 2px 0 8px;
  transform: skew(8deg)
}

.comboMeterShell {
  position: relative;
  height: 26px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .5);
  background: rgba(0, 0, 0, .65);
  overflow: hidden;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .9), 0 0 18px var(--comboGlow, rgba(255, 255, 255, .3))
}

#comboBar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .85), var(--comboColor, #fff));
  border-radius: 999px;
  box-shadow: 0 0 24px var(--comboGlow, rgba(255, 255, 255, .4));
  transition: width .2s
}

.comboMeterShell:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: translateX(-100%);
  animation: comboSweep 1.2s infinite linear
}

#comboShowcase.comboPop #comboRank,
#comboShowcase.comboPop #comboNumber {
  animation: comboPop .22s ease
}

#comboShowcase.comboShake {
  animation: comboShake .18s ease-in-out infinite
}

@keyframes comboPop {
  45% {
    transform: rotate(-8deg) scale(1.24)
  }
}

@keyframes comboSweep {
  to {
    transform: translateX(100%)
  }
}

@keyframes comboShake {
  25% {
    transform: skew(-8deg) translate(2px, -1px)
  }

  50% {
    transform: skew(-8deg) translate(-2px, 1px)
  }

  75% {
    transform: skew(-8deg) translate(1px, 2px)
  }
}

@keyframes flameRoar {
  from {
    transform: translateY(5px) scaleY(.9);
    opacity: .72
  }

  to {
    transform: translateY(-5px) scaleY(1.18);
    opacity: 1
  }
}

#particles {
  position: fixed;
  inset: 0;
  pointer-events: none
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: floatUp .9s ease-out forwards
}

@keyframes floatUp {
  to {
    transform: translateY(-120px);
    opacity: 0
  }
}

.leaderboardTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px
}

.leaderboardTable th,
.leaderboardTable td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  text-align: left
}

.leaderboardTable th {
  color: #fff;
  background: rgba(255, 255, 255, .08)
}

.leaderboardTable td {
  color: var(--muted)
}

.podiumRow:first-child td {
  color: #ffd84a;
  font-weight: bold
}

.liveCode {
  font-size: clamp(48px, 10vw, 110px);
  font-weight: 1000;
  letter-spacing: 10px;
  color: #fff;
  text-shadow: 0 0 22px rgba(180, 90, 255, .9), 4px 4px 0 #000
}

.hostQuestion {
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 900;
  line-height: 1.12;
  margin: 24px auto;
  max-width: 1100px;
  white-space: pre-wrap
}

.hostOptionsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px auto;
  max-width: 980px
}

.hostOptionTile,
.playerAnswerTile {
  border-radius: 18px;
  padding: 20px;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, .22);
  background: linear-gradient(135deg, rgba(110, 0, 255, .35), rgba(255, 255, 255, .06));
  font-weight: 900
}

.playerAnswerTile {
  cursor: pointer;
  font-size: 20px
}

.playerAnswerTile:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none
}

.liveStatusPill {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  margin: 4px
}

@media(max-width:720px) {
  .hostOptionsGrid {
    grid-template-columns: 1fr
  }
}

/* Manage Decks + subject search additions */
.filterPanel {
  margin: 18px auto 22px;
  max-width: 920px;
  text-align: left;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  background: rgba(255, 255, 255, .055)
}

.subjectChips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px
}

.subjectChip {
  border-color: rgba(255, 255, 255, .18)
}

.subjectChip.active {
  background: linear-gradient(135deg, rgba(168, 77, 255, .8), rgba(255, 255, 255, .12));
  box-shadow: 0 0 18px rgba(168, 77, 255, .45);
  color: #fff
}

.subjectSection {
  margin: 20px auto;
  text-align: left
}

.subjectSection>h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  margin: 22px 0 12px
}

.subjectSection>h2:after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(190, 90, 255, .5), transparent)
}

.inlineCheck {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  text-align: left
}

.inlineCheck input {
  width: auto
}

.managedCard {
  margin-top: 10px
}

.cardListHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap
}

.optionGrid {
  display: grid;
  gap: 8px
}

.accountBar button {
  margin-left: 8px
}

.deckCard h3,
.miniCard h3 {
  margin-top: 0
}

/* Always-on music + performance / live quiz additions */
.qrWrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 12px auto;
  text-align: left
}

.qrCode {
  width: 220px;
  height: 220px;
  background: #fff;
  border: 10px solid #fff;
  border-radius: 16px;
  box-shadow: 0 0 24px rgba(255, 255, 255, .25)
}

#liveJoinUrl {
  word-break: break-all;
  color: #fff
}

.correctAnswer {
  border-color: rgba(103, 232, 165, .95) !important;
  background: linear-gradient(135deg, rgba(45, 220, 130, .75), rgba(255, 255, 255, .12)) !important;
  box-shadow: 0 0 28px rgba(103, 232, 165, .75) !important;
  color: #fff
}

.chosenWrong {
  border-color: rgba(255, 107, 154, .95) !important;
  background: linear-gradient(135deg, rgba(255, 45, 95, .55), rgba(255, 255, 255, .08)) !important
}

.chosenCorrect {
  outline: 4px solid rgba(255, 255, 255, .7)
}

.liveJoinPanel {
  text-align: center
}

.performance-low * {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important
}

.performance-low body:before {
  display: none
}

.performance-low button:hover {
  transform: none;
  box-shadow: 0 0 8px rgba(160, 70, 255, .2), inset 0 0 10px rgba(80, 0, 120, .3)
}

.performance-low #particles {
  display: none
}

.performance-low #comboShowcase {
  transform: none
}

.performance-low #comboShowcase:before,
.performance-low #comboShowcase:after {
  display: none
}

.performance-low .comboMeterShell:after {
  display: none
}

.performance-low .cardPanel {
  box-shadow: none
}

.performance-low .deckCard,
.performance-low .miniCard {
  box-shadow: none
}

.performance-low .mediaBox iframe {
  max-height: 55vh
}

body.performance-low:before {
  display: none
}


/* Gamification profile / cosmetics */
.profileHero {
  margin: 14px auto;
  text-align: left
}

.profileHeader {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: flex-start;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(120, 0, 255, .18), rgba(255, 255, 255, .06))
}

.profileAvatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  background: rgba(0, 0, 0, .35);
  border: 3px solid rgba(255, 255, 255, .25);
  box-shadow: 0 0 24px rgba(180, 90, 255, .35);
  overflow: hidden;
  flex: 0 0 auto
}

.profileAvatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.profileInfo {
  flex: 1
}

.profileTitle {
  font-weight: 800;
  display: inline-block;
}

.xpBar {
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, .8);
  margin: 8px 0
}

.xpBar>div {
  height: 100%;
  background: linear-gradient(90deg, #7c3cff, #ffd84a);
  box-shadow: 0 0 16px rgba(255, 216, 74, .65)
}

.profileSection {
  text-align: left;
  margin-top: 18px
}

.cosmeticGrid,
.achievementGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px
}

.cosmeticCard,
.achievementCard {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .055)
}

.activeCosmetic {
  border-color: rgba(103, 232, 165, .85);
  box-shadow: 0 0 20px rgba(103, 232, 165, .28)
}

.unlockedAchievement {
  border-color: rgba(255, 216, 74, .8);
  background: linear-gradient(135deg, rgba(255, 216, 74, .16), rgba(255, 255, 255, .055))
}

.xpGainBox {
  margin: 14px auto;
  padding: 14px;
  border: 1px solid rgba(255, 216, 74, .65);
  border-radius: 16px;
  background: rgba(255, 216, 74, .09);
  box-shadow: 0 0 22px rgba(255, 216, 74, .25)
}

.frame-gold .profileAvatar {
  border-color: #ffd84a;
  box-shadow: 0 0 24px rgba(255, 216, 74, .85), 0 0 55px rgba(255, 216, 74, .25)
}

.frame-purplepulse .profileAvatar {
  border-color: #b45cff;
  animation: profilePulse 1.4s infinite alternate;
  box-shadow: 0 0 30px rgba(180, 90, 255, .8)
}

@keyframes profilePulse {
  from {
    transform: scale(1);
    filter: brightness(1)
  }

  to {
    transform: scale(1.04);
    filter: brightness(1.2)
  }
}

.theme-golden-scholar {
  --line: rgba(255, 216, 74, .45);
  --muted: #ffeaa0
}

.theme-void-library {
  --line: rgba(180, 90, 255, .55);
  --text: #f6edff
}

.title-animated {
  display: inline-block;
  position: relative;
  color: var(--titleColor, currentColor);
  text-shadow: 0 0 14px rgba(124, 58, 237, .35);
  font-weight: 900;
}

.title-liquid-drip {
  display: inline-block;
  position: relative;
  color: var(--titleColor, currentColor);
  text-shadow: 0 0 18px rgba(0, 0, 0, .18);
  font-weight: 900;
}

.title-liquid-drip::before,
.title-liquid-drip::after {
  content: '';
  position: absolute;
  bottom: -0.25em;
  width: 0.36em;
  height: 0.36em;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0.6em currentColor, 0.9em 0.35em currentColor;
  opacity: 0.85;
  animation: titleDrip 2.8s ease-in-out infinite;
}

.title-liquid-drip::before {
  left: 18%;
  transform: scaleX(0.9);
  animation-delay: 0s;
}

.title-liquid-drip::after {
  left: 60%;
  width: 0.28em;
  height: 0.28em;
  transform: scaleX(1.1);
  animation-delay: 0.9s;
}

@keyframes titleDrip {

  0%,
  20% {
    transform: translateY(0) scaleY(0.9);
    opacity: 0.7;
  }

  50% {
    transform: translateY(0.55em) scaleY(1.1);
    opacity: 1;
  }

  100% {
    transform: translateY(0) scaleY(0.9);
    opacity: 0.75;
  }
}

/* Superadmin tools */
#superAdminScreen .miniCard {
  margin-bottom: 14px;
}

#superAdminScreen textarea {
  min-height: 72px;
}

#adminCosmeticList .miniCard,
#adminAchievementList .miniCard,
#adminStaffList .miniCard {
  margin-top: 10px;
}

.cosmeticPreview {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, .03);
  margin-top: 16px;
}

.cosmeticPreview h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1rem;
}

.cosmeticPreviewInner {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #f4f4f4;
  font-size: 0.95rem;
}

.cosmeticPreviewInner img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 12px;
  object-fit: contain;
}

.previewTitle,
.previewTheme,
.previewCardBack,
.previewCombo {
  width: 100%;
  max-width: 300px;
  padding: 18px 20px;
  border-radius: 16px;
  color: white;
  font-weight: 700;
  letter-spacing: .02em;
}

.previewTitle {
  font-size: 1.3rem;
}

.previewTitleText {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: .03em;
  line-height: 1.1;
  padding: 0.2rem 0.4rem;
  position: relative;
}

.previewFrame {
  width: 180px;
  height: 180px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  position: relative;
}

.previewFrameAvatar {
  width: 110px;
  height: 110px;
  background: rgba(0, 0, 0, .2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 2rem;
  font-weight: 700;
}

.previewTheme {
  padding: 26px 20px;
}

.previewCardBack {
  height: 140px;
  display: grid;
  place-items: center;
}

.previewCombo {
  height: 80px;
  display: grid;
  place-items: center;
}

.previewNote {
  margin-top: 10px;
  font-size: 0.87rem;
  opacity: .85;
}

@keyframes previewPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

@keyframes previewSpin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#superAdminButton {
  border-color: rgba(255, 216, 74, .65);
  box-shadow: 0 0 16px rgba(255, 216, 74, .22), inset 0 0 10px rgba(255, 216, 74, .08);
}

/* ================= DYNAMIC PROFILE FRAME DESIGNER ================= */

.profileHeader.dynamicFrame {
  --frame1: #8b5cf6;
  --frame2: #22d3ee;
  --frameGlow: #a855f7;
  --frameThickness: 4px;
  --frameSpeed: 2s;
}

.profileHeader.dynamicFrame .profileAvatar {
  position: relative;
  border: var(--frameThickness) solid var(--frame1);
  box-shadow:
    0 0 16px var(--frameGlow),
    0 0 34px color-mix(in srgb, var(--frameGlow), transparent 45%);
  overflow: visible;
  z-index: 1;
}

.profileHeader.dynamicFrame .profileAvatar img,
.profileHeader.dynamicFrame .profileAvatar {
  border-radius: 50%;
}

/* Pulse effect */
.profileHeader.dynamicFrame.frameEffect-pulse .profileAvatar {
  animation: dynamicFramePulse var(--frameSpeed) infinite ease-in-out;
}

/* Spinning gradient ring */
.profileHeader.dynamicFrame.frameEffect-spin .profileAvatar::before,
.profileHeader.dynamicFrame.frameEffect-rainbow .profileAvatar::before,
.profileHeader.dynamicFrame.frameEffect-sparkle .profileAvatar::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}

/* Spin */
.profileHeader.dynamicFrame.frameEffect-spin .profileAvatar::before {
  background: conic-gradient(from 0deg,
      var(--frame1),
      var(--frame2),
      var(--frame1));
  animation: dynamicFrameSpin var(--frameSpeed) linear infinite;
}

/* Rainbow */
.profileHeader.dynamicFrame.frameEffect-rainbow .profileAvatar::before {
  background: conic-gradient(red,
      orange,
      yellow,
      lime,
      cyan,
      blue,
      violet,
      red);
  animation: dynamicFrameSpin var(--frameSpeed) linear infinite;
}

/* Sparkle */
.profileHeader.dynamicFrame.frameEffect-sparkle .profileAvatar::before {
  background:
    radial-gradient(circle at 20% 20%, white 0 4px, transparent 5px),
    radial-gradient(circle at 80% 30%, var(--frame2) 0 5px, transparent 6px),
    radial-gradient(circle at 40% 85%, white 0 4px, transparent 5px),
    radial-gradient(circle at 70% 75%, var(--frame1) 0 5px, transparent 6px);
  filter: drop-shadow(0 0 8px var(--frameGlow));
  animation: dynamicFrameSparkle var(--frameSpeed) infinite ease-in-out;
}

/* Flame glow */
.profileHeader.dynamicFrame.frameEffect-flame .profileAvatar {
  box-shadow:
    0 0 18px var(--frameGlow),
    0 0 38px var(--frame1),
    0 0 70px var(--frame2);
  animation: dynamicFrameFlame var(--frameSpeed) infinite alternate ease-in-out;
}

/* Electric glow */
.profileHeader.dynamicFrame.frameEffect-electric .profileAvatar {
  box-shadow:
    0 0 12px white,
    0 0 28px var(--frame1),
    0 0 52px var(--frame2);
  animation: dynamicFrameElectric calc(var(--frameSpeed) / 2) infinite steps(2, end);
}

@keyframes dynamicFramePulse {

  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }

  50% {
    transform: scale(1.05);
    filter: brightness(1.25);
  }
}

@keyframes dynamicFrameSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dynamicFrameSparkle {

  0%,
  100% {
    opacity: .45;
    transform: scale(.95) rotate(0deg);
  }

  50% {
    opacity: 1;
    transform: scale(1.08) rotate(20deg);
  }
}

@keyframes dynamicFrameFlame {
  from {
    filter: brightness(1);
    transform: scale(1);
  }

  to {
    filter: brightness(1.35);
    transform: scale(1.04);
  }
}

@keyframes dynamicFrameElectric {

  0%,
  100% {
    filter: brightness(1);
    transform: translate(0, 0);
  }

  50% {
    filter: brightness(1.6);
    transform: translate(1px, -1px);
  }
}

/* Respect low performance mode */
body.performance-low .profileHeader.dynamicFrame .profileAvatar,
body.performance-low .profileHeader.dynamicFrame .profileAvatar::before {
  animation: none !important;
}

/* ================= FRAME EFFECT PATCH: reliable dynamic avatar frames =================
   These overrides keep generated frame effects visible above the profile card background,
   while keeping the avatar image/text above the animated ring. */
.profileHeader.dynamicFrame {
  position: relative;
  overflow: visible;
}

.profileHeader.dynamicFrame .profileAvatar {
  position: relative;
  overflow: visible;
  isolation: isolate;
}

.profileHeader.dynamicFrame .profileAvatar::before {
  z-index: 0 !important;
}

.profileHeader.dynamicFrame .profileAvatar img,
.profileHeader.dynamicFrame .profileAvatar .avatarInner {
  position: relative;
  z-index: 2;
}

.profileHeader.dynamicFrame .profileAvatar img {
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
}

.cosmeticFramePreview {
  max-width: 160px;
  min-height: 130px;
  margin: 0 auto 10px;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 12px;
}

.cosmeticFramePreview .profileAvatar {
  width: 74px;
  height: 74px;
  font-size: 38px;
}

body.performance-low .profileHeader.dynamicFrame .profileAvatar::before,
body.performance-low .cosmeticFramePreview .profileAvatar::before {
  animation: none !important;
}

/* ================= COSMETIC PLAYER IDENTITIES ================= */
.cosmeticLeaderboard td { vertical-align: middle; }
.rankCell { font-weight: 900; color: #fff; text-align: center; }
.playerIdentity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}
.playerIdentity.compactIdentity { min-width: 190px; gap: 9px; }
.identityAvatarWrap.profileHeader {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
  width: auto;
  min-width: 0;
  box-shadow: none;
  overflow: visible;
}
.identityAvatar.profileAvatar {
  width: 58px;
  height: 58px;
  font-size: 28px;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,.22), transparent 35%),
    linear-gradient(135deg, rgba(139,92,246,.45), rgba(34,211,238,.22)),
    rgba(0,0,0,.42);
}
.compactIdentity .identityAvatar.profileAvatar { width: 46px; height: 46px; font-size: 22px; }
.identityAvatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatarInitial { font-weight: 1000; color: #fff; text-shadow: 0 0 12px rgba(180,90,255,.8); }
.identityText { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.1; }
.identityName { color: #fff; font-size: 15px; }
.identityTitle { font-size: 12px; }
.identityLevel { font-size: 11px; color: var(--muted); }
.leaderboardTable .playerIdentity p { margin: 0; }
.livePlayerFinalBoard { display: grid; gap: 10px; margin: 14px auto; max-width: 760px; }
.finalBoardRow {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
}
.finalBoardRow:nth-child(1) { border-color: rgba(255,216,74,.8); box-shadow: 0 0 20px rgba(255,216,74,.18); }
.finalBoardRow:nth-child(2) { border-color: rgba(210,220,255,.65); }
.finalBoardRow:nth-child(3) { border-color: rgba(255,160,90,.65); }
@media(max-width:760px){
  .playerIdentity { min-width: 0; }
  .identityAvatar.profileAvatar { width: 44px; height: 44px; font-size: 21px; }
  .identityLevel { display:none; }
  .finalBoardRow { grid-template-columns: 28px 1fr; }
  .finalBoardRow > span:not(.rankCell), .finalBoardRow > strong { grid-column: 2; justify-self: start; }
}


/* Superadmin Excel deck import */
.excelImportGuide {
  margin: 12px 0;
  line-height: 1.5;
}
#adminExcelImportMessage.success,
#adminExcelImportMessage.error,
#adminExcelImportMessage.notice {
  margin-top: 10px;
  font-weight: 800;
}
