:root {
  --bg-dark: #0f172a;
  --bg-gradient: radial-gradient(circle at 50% -20%, #1e1b4b 0%, #0f172a 70%);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #f8fafc;
  --muted: #94a3b8;
  --radius: 20px;
  --font: 'Outfit', sans-serif;
  --qzr-safe-top: env(safe-area-inset-top, 0px);
  --qzr-safe-right: env(safe-area-inset-right, 0px);
  --qzr-safe-bottom: env(safe-area-inset-bottom, 0px);
  --qzr-safe-left: env(safe-area-inset-left, 0px);
}

/* Base resets specifically for realtime panels */
#quizRealTimeContainer * {
  box-sizing: border-box;
}

/* In the simulator, this was body. Providing a modifier class for the app container */
body.realtime-active {
  font-family: var(--font) !important;
  background: var(--bg-gradient) !important;
  background-color: var(--bg-dark) !important;
  color: var(--text) !important;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body.theme-1.realtime-active {
  background: var(--ux-page-surface, #f5f8fc) !important;
  background-color: var(--ux-page-surface, #f5f8fc) !important;
  color: var(--ux-text-primary, #12263f) !important;
}

body.theme-1 #quizRealTimeContainer {
  --bg-dark: var(--ux-page-surface, #f5f8fc);
  --bg-gradient: linear-gradient(180deg, var(--ux-page-surface, #f5f8fc) 0%, color-mix(in srgb, var(--ux-card-surface, #fff) 82%, #eef4fa) 100%);
  --glass-bg: color-mix(in srgb, var(--ux-card-surface, #fff) 92%, transparent);
  --glass-border: color-mix(in srgb, var(--ux-card-border, #dfe7f1) 82%, transparent);
  --glass-shadow: var(--ux-shadow-sm, 0 8px 20px rgba(15, 23, 42, 0.06));
  --primary: var(--ux-accent-primary, #ff7a45);
  --primary-hover: color-mix(in srgb, var(--ux-accent-primary, #ff7a45) 82%, #111827);
  --text: var(--ux-text-primary, #12263f);
  --muted: var(--ux-text-muted, #5b6f87);
  background: var(--bg-gradient);
  color: var(--text);
}

body.theme-1 #quizRealTimeContainer > * {
  color: var(--text);
}

body.theme-1 #quizRealTimeContainer .glass-panel {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
}

body.theme-1 #quizRealTimeContainer h1 {
  background: linear-gradient(135deg, var(--ux-accent-primary, #ff7a45), var(--ux-accent-secondary, #173a64));
  -webkit-background-clip: text;
  background-clip: text;
}

body.theme-1 #quizRealTimeContainer input,
body.theme-1 #quizRealTimeContainer select,
body.theme-1 #quizRealTimeContainer textarea {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 86%, #eef4fa);
  border-color: var(--glass-border);
  color: var(--text);
}

body.theme-1 #quizRealTimeContainer input:focus,
body.theme-1 #quizRealTimeContainer select:focus,
body.theme-1 #quizRealTimeContainer textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--ux-focus-ring, 0 0 0 4px rgba(255, 122, 69, 0.18));
}

body.theme-1 #quizRealTimeContainer .btn-secondary {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 86%, #eef4fa);
  color: var(--text);
  border-color: var(--glass-border);
}

body.theme-1 #quizRealTimeContainer .badge:not(.connected):not(.host) {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 78%, #eef4fa);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

body.theme-1 #quizRealTimeContainer .text-white,
body.theme-1 #quizRealTimeContainer .text-light {
  color: var(--text) !important;
}

body.theme-1 #quizRealTimeContainer .text-muted {
  color: var(--muted) !important;
}

body.theme-1 #quizRealTimeContainer .bg-dark-subtle {
  background-color: color-mix(in srgb, var(--ux-accent-primary, #ff7a45) 12%, var(--ux-card-surface, #fff)) !important;
}

/* Explicit exception to restore FontAwesome visibility against the !important font override */
body.realtime-active i[class*="fa-"],
body.realtime-active [class*="fa-solid"],
body.realtime-active [class*="fas"],
body.realtime-active [class*="fab"],
body.realtime-active [class*="far"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome" !important;
}

/* Goal badge selection for showcase */
.goals-badges-track .goal-badge {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}

.goals-badges-track .goal-badge.goal-badge--selected {
  outline: 2px solid var(--bs-warning, #ffc107);
  outline-offset: 2px;
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(255,193,7,.25);
}

#quizRealTimeContainer h1,
#quizRealTimeContainer h2,
#quizRealTimeContainer h3 {
  font-weight: 900;
  letter-spacing: 0;
}

#quizRealTimeContainer h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Layout Components */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  flex-grow: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 24px;
}

#quizRealTimeContainer.app-container {
  min-height: calc(100dvh - var(--qzr-safe-top) - var(--qzr-safe-bottom));
  padding-top: max(24px, var(--qzr-safe-top));
  padding-right: max(24px, var(--qzr-safe-right));
  padding-bottom: max(24px, var(--qzr-safe-bottom));
  padding-left: max(24px, var(--qzr-safe-left));
}

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

  #quizRealTimeContainer.app-container {
    padding-top: max(16px, var(--qzr-safe-top));
    padding-right: max(16px, var(--qzr-safe-right));
    padding-bottom: max(16px, var(--qzr-safe-bottom));
    padding-left: max(16px, var(--qzr-safe-left));
  }
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* View Management */
.view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view.active {
  display: block;
}

#viewWaiting.active {
  display: flex;
  flex-direction: column;
  min-height: 65vh;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#quizRealTimeContainer label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#quizRealTimeContainer input,
#quizRealTimeContainer select,
#quizRealTimeContainer textarea {
  font-family: var(--font);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: white;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  transition: all 0.2s ease;
}

#quizRealTimeContainer input:focus,
#quizRealTimeContainer select:focus,
#quizRealTimeContainer textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

#quizRealTimeContainer textarea {
  min-height: 100px;
  resize: vertical;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Buttons */
#quizRealTimeContainer .btn {
  font-family: var(--font);
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

#quizRealTimeContainer .btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

#quizRealTimeContainer .btn:hover::after {
  opacity: 1;
}

#quizRealTimeContainer .btn:active {
  transform: scale(0.98);
}

#quizRealTimeContainer .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#quizRealTimeContainer .btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#quizRealTimeContainer .btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#quizRealTimeContainer .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid var(--glass-border);
}

#quizRealTimeContainer .btn-block {
  width: 100%;
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.badge.connected {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

/* Header */
.realtime-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

/* Players Grid */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.player-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s;
  color: var(--text);
}

.player-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.player-info {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-weight: 700;
  font-size: 1rem;
}

.player-status {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Playground */
.playground-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.realtime-goal-hud-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  flex: 0 0 100%;
}

.realtime-goal-hud-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 12px;
}

/* Circular Countdown Timer */
.timer-circle-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.timer-circle-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.35));
  transition: filter 0.4s ease;
}

.timer-circle-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 5;
}

.timer-circle-progress {
  fill: none;
  stroke: url(#timerGradient);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s ease;
}

.timer-circle-wrap .timer-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  text-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
  font-variant-numeric: tabular-nums;
  transition: color 0.4s, text-shadow 0.4s;
  line-height: 1;
}

/* Urgent state (last 3 seconds) */
.timer-circle-wrap.urgent .timer-circle-svg {
  filter: drop-shadow(0 0 14px rgba(239, 68, 68, 0.6));
}

.timer-circle-wrap.urgent .timer-circle-progress {
  stroke: var(--danger);
}

.timer-circle-wrap.urgent .timer-text {
  color: var(--danger);
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
  animation: timerPulseText 0.8s infinite alternate;
}

@keyframes timerPulseText {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.12);
  }
}

.question-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  margin-bottom: 32px;
  border: 1px solid var(--glass-border);
}

.question-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1.3;
  color: var(--text);
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.answers-grid--typed {
  grid-template-columns: 1fr;
}

.answer-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.answer-key {
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--muted);
}

.answer-btn:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.answer-btn.selected {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
}

.answer-btn.selected .answer-key {
  background: var(--primary);
  color: white;
}

@keyframes correctPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 25px 10px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes wrongShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-8px);
  }

  40%,
  80% {
    transform: translateX(8px);
  }
}

.answer-btn.correct {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: var(--success) !important;
  animation: correctPulse 1.5s ease-out infinite;
  z-index: 10;
}

.answer-btn.correct .answer-key {
  background: var(--success);
  color: white;
}

.answer-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  animation: wrongShake 0.4s ease-in-out;
  opacity: 0.8 !important;
}

.answer-btn.wrong .answer-key {
  background: #ef4444;
  color: white;
}

.answer-btn.disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

#quizRealTimeContainer .realtime-text-blank {
  display: inline-block;
  width: clamp(52px, 18vw, 132px);
  min-height: 1.25em;
  margin: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 2px solid currentColor;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  vertical-align: baseline;
}

#quizRealTimeContainer .realtime-text-blank:focus {
  outline: none;
  background: transparent;
  border-color: currentColor;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.18);
}

.realtime-order-board,
.realtime-match-board {
  display: grid;
  gap: 14px;
  width: 100%;
}

.realtime-order-board--anagram {
  justify-items: center;
}

.realtime-sortable-list {
  display: grid;
  gap: 10px;
}

.realtime-sortable-list.is-sorting .realtime-sortable-item {
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.realtime-sortable-list--anagram {
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  gap: 10px;
  padding: 4px 2px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.realtime-sortable-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.realtime-sortable-item:hover,
.realtime-sortable-item.is-selected {
  background: rgba(59, 130, 246, 0.16);
  border-color: var(--primary);
}

.realtime-sortable-item.is-dragging {
  opacity: .55;
  transform: scale(.98);
}

.realtime-sortable-item.is-pointer-dragging {
  opacity: .96;
  cursor: grabbing;
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.32);
}

.realtime-sortable-item.is-sort-hover-before {
  transform: translateY(-4px);
}

.realtime-sortable-item.is-sort-hover-after {
  transform: translateY(4px);
}

.realtime-sortable-list--anagram .realtime-sortable-item.is-sort-hover-before {
  transform: translateX(-5px);
}

.realtime-sortable-list--anagram .realtime-sortable-item.is-sort-hover-after {
  transform: translateX(5px);
}

.realtime-sortable-placeholder {
  width: 100%;
  min-height: 58px;
  border: 2px dashed rgba(124, 108, 255, 0.85);
  border-radius: 16px;
  background: rgba(124, 108, 255, 0.12);
  box-shadow: inset 0 0 0 4px rgba(124, 108, 255, 0.06), 0 10px 24px rgba(124, 108, 255, 0.14);
  animation: realtimeSortablePlaceholderPulse 1s ease-in-out infinite alternate;
}

.realtime-sortable-placeholder--letter {
  flex: 0 0 48px;
  width: 48px !important;
  min-height: 52px;
  border-radius: 15px;
}

@keyframes realtimeSortablePlaceholderPulse {
  from {
    background: rgba(124, 108, 255, 0.09);
    border-color: rgba(124, 108, 255, 0.7);
  }

  to {
    background: rgba(124, 108, 255, 0.17);
    border-color: rgba(255, 255, 255, 0.9);
  }
}

.realtime-sortable-item--letter {
  flex: 0 0 48px;
  width: 48px;
  min-height: 52px;
  justify-content: center;
  gap: 0;
  padding: 0;
  color: #101828;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(124, 108, 255, 0.28);
  border-radius: 15px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.realtime-sortable-item--letter .answer-key {
  display: none;
}

.realtime-sortable-item--letter span:last-child {
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.realtime-sortable-item--letter:hover,
.realtime-sortable-item--letter.is-selected {
  background: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.realtime-match-board--interactive {
  position: relative;
  gap: 18px;
  width: min(100%, 560px);
  margin: 0 auto;
}

.realtime-match-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(28px, 10vw, 76px);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
}

.realtime-match-stage {
  position: relative;
}

.realtime-match-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.realtime-match-columns {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(28px, 10vw, 76px);
  align-items: stretch;
}

.realtime-match-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.realtime-match-card {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 86px;
  padding: 12px;
  color: #101828;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.13);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.realtime-match-card--left {
  gap: 12px;
  touch-action: pan-y;
}

.realtime-match-card--right {
  justify-content: center;
  min-height: 86px;
  text-align: center;
  background: rgba(255, 255, 255, 0.86);
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.45);
}

.realtime-match-card--right[data-match-count]:not([data-match-count="0"]):not([data-match-count="1"])::after {
  content: attr(data-match-count);
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  background: var(--match-color, var(--primary));
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.realtime-match-card:hover:not(.disabled),
.realtime-match-card.is-selected,
.realtime-match-card.is-drop-target {
  transform: translateY(-2px);
  border-color: var(--match-color, var(--primary));
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.realtime-match-card.is-matched {
  border-color: var(--match-color, var(--primary));
}

.realtime-match-card.is-dragging {
  opacity: .7;
  transform: scale(.98);
}

.realtime-match-card.disabled,
.realtime-match-card:disabled {
  cursor: not-allowed;
  opacity: .72;
  transform: none;
}

.realtime-match-thumb {
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--match-color, var(--primary));
  background: rgba(124, 108, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

.realtime-match-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.realtime-match-thumb i {
  font-size: 1.25rem;
}

.realtime-match-card__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.realtime-match-dot {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 12px;
  height: 12px;
  background: var(--match-color, var(--primary));
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
  transform: translateY(-50%);
}

.realtime-match-dot--left {
  right: -7px;
}

.realtime-match-dot--right {
  left: -7px;
}

.realtime-match-submit {
  justify-content: center;
  min-height: 54px;
  margin-top: 8px;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, #6d5dfc 0%, #7c3aed 100%);
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(109, 93, 252, 0.38);
}

.realtime-match-submit .answer-key {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.realtime-match-submit:hover:not(.disabled) {
  background: linear-gradient(135deg, #7c6cff 0%, #8b5cf6 100%);
  border-color: rgba(255, 255, 255, 0.22);
}

.realtime-match-help {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.realtime-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

.realtime-match-row span {
  color: var(--text);
  font-weight: 900;
  text-transform: none;
}

#quizRealTimeContainer .realtime-match-row select {
  min-width: 0;
}

.realtime-solution-box {
  display: grid;
  gap: 6px;
  padding: 16px;
  color: var(--text);
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 16px;
}

.realtime-solution-box strong {
  color: #34d399;
}

/* Side Panel / Logs */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.status-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 16px;
}

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

.status-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.status-value {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.console-log {
  background: #020617;
  border-radius: 16px;
  padding: 16px;
  flex-grow: 1;
  height: 400px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: #a5b4fc;
  border: 1px solid var(--glass-border);
}

.log-entry {
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.log-time {
  color: #64748b;
  margin-right: 8px;
  font-size: 0.7rem;
}

.log-event {
  color: #38bdf8;
  font-weight: 700;
}

.log-data {
  color: #94a3b8;
  margin-top: 4px;
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Advanced Settings Toggle */
.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 16px;
  transition: color 0.2s;
}

.advanced-toggle:hover {
  color: white;
}

.advanced-settings {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  animation: fadeIn 0.3s;
}

.advanced-settings.open {
  display: block;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  place-items: center;
  padding-top: max(24px, var(--qzr-safe-top));
  padding-right: max(24px, var(--qzr-safe-right));
  padding-bottom: max(24px, var(--qzr-safe-bottom));
  padding-left: max(24px, var(--qzr-safe-left));
}

.modal-overlay.open {
  display: grid;
  animation: fadeIn 0.3s;
}

body.realtime-active .modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.final-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 8px;
}

.final-stat {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  text-align: center;
}

.final-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.final-stat-value {
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

.solo-performance-card {
  margin: 16px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(87, 45, 13, 0.95), rgba(163, 88, 44, 0.9));
  overflow: hidden;
}

.solo-performance-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-weight: 800;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.solo-performance-main {
  margin: 14px 16px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
  padding: 14px 12px;
}

.solo-performance-score-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.solo-performance-score-value {
  margin-top: 4px;
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 900;
  color: #ffa57c;
}

.solo-performance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px 16px 16px;
}

.solo-performance-kpi {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  text-align: center;
}

.solo-performance-kpi-label {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.9);
}

.solo-performance-kpi-value {
  margin-top: 4px;
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.1;
  color: #ff6b1a;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--muted);
  min-width: 40px;
  text-align: center;
}

.ranking-item:nth-child(1) .rank-number {
  color: #fbbf24;
}

/* Gold */
.ranking-item:nth-child(2) .rank-number {
  color: #94a3b8;
}

/* Silver */
.ranking-item:nth-child(3) .rank-number {
  color: #b45309;
}

/* Bronze */

.rank-score {
  font-weight: 900;
  font-size: 1.2rem;
  margin-left: auto;
  color: var(--primary);
}

.host-controls {
  display: none;
  margin-top: 24px;
  padding: 24px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 16px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.host-controls.active {
  display: block;
  animation: fadeIn 0.4s;
}

.realtime-session-info-btn,
.realtime-session-sound-btn {
  position: fixed !important;
  left: max(16px, var(--qzr-safe-left));
  z-index: 1012;
  width: 44px;
  height: 44px;
  border-radius: 50% !important;
  padding: 0 !important;
  opacity: 0.84;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.realtime-session-info-btn {
  bottom: calc(88px + var(--qzr-safe-bottom));
}

.realtime-session-sound-btn {
  bottom: calc(142px + var(--qzr-safe-bottom));
  display: none;
}

.realtime-session-sound-btn.is-muted {
  opacity: 0.58;
}

.realtime-session-info-btn i,
.realtime-session-sound-btn i {
  font-size: 0.95rem;
}

.session-info-modal-content {
  width: min(680px, 94vw);
}

.session-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}

.session-info-item {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-info-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.session-info-value {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  word-break: break-word;
}

body.theme-1 #quizRealTimeContainer .realtime-goal-hud-card,
body.theme-1 #quizRealTimeContainer .question-box,
body.theme-1 #quizRealTimeContainer .player-card,
body.theme-1 #quizRealTimeContainer .status-matrix,
body.theme-1 #quizRealTimeContainer .realtime-match-row,
body.theme-1 #quizRealTimeContainer .ranking-item,
body.theme-1 #quizRealTimeContainer .final-stat,
body.theme-1 #quizRealTimeContainer .session-info-item,
body.theme-1 #quizRealTimeContainer .host-controls {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 90%, #eef4fa);
  border-color: var(--glass-border);
  color: var(--text);
}

body.theme-1 #quizRealTimeContainer .player-card:hover,
body.theme-1 #quizRealTimeContainer .answer-btn:hover:not(.disabled),
body.theme-1 #quizRealTimeContainer .realtime-sortable-item:hover,
body.theme-1 #quizRealTimeContainer .realtime-sortable-item.is-selected {
  background: color-mix(in srgb, var(--primary) 12%, var(--ux-card-surface, #fff));
  border-color: color-mix(in srgb, var(--primary) 45%, var(--glass-border));
}

body.theme-1 #quizRealTimeContainer .answer-btn,
body.theme-1 #quizRealTimeContainer .realtime-sortable-item {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 92%, #eef4fa);
  border-color: var(--glass-border);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

body.theme-1 #quizRealTimeContainer .answer-key {
  background: color-mix(in srgb, var(--primary) 13%, var(--ux-card-surface, #fff));
  color: var(--primary);
}

body.theme-1 #quizRealTimeContainer .timer-circle-track {
  stroke: color-mix(in srgb, var(--ux-card-border, #dfe7f1) 72%, transparent);
}

body.theme-1 #quizRealTimeContainer .timer-circle-wrap .timer-text {
  text-shadow: 0 0 12px color-mix(in srgb, var(--primary) 22%, transparent);
}

body.theme-1 #quizRealTimeContainer .answer-btn.selected {
  background: color-mix(in srgb, var(--primary) 16%, var(--ux-card-surface, #fff));
  border-color: var(--primary);
}

body.theme-1 #quizRealTimeContainer .answer-btn.correct {
  background: color-mix(in srgb, var(--success) 18%, var(--ux-card-surface, #fff)) !important;
  color: #064e3b;
}

body.theme-1 #quizRealTimeContainer .answer-btn.wrong {
  background: color-mix(in srgb, var(--danger) 14%, var(--ux-card-surface, #fff)) !important;
  color: #7f1d1d;
}

body.theme-1 #quizRealTimeContainer .realtime-text-blank:focus {
  box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 30%, transparent);
}

body.theme-1 #quizRealTimeContainer .realtime-sortable-item--letter,
body.theme-1 #quizRealTimeContainer .realtime-match-card {
  background: var(--ux-card-surface, #fff);
  border-color: color-mix(in srgb, var(--ux-card-border, #dfe7f1) 86%, #fff);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

body.theme-1 #quizRealTimeContainer .realtime-match-card--right {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 88%, #eef4fa);
  border-color: color-mix(in srgb, var(--ux-card-border, #dfe7f1) 70%, var(--muted));
}

body.theme-1 #quizRealTimeContainer .realtime-match-thumb {
  background: color-mix(in srgb, var(--match-color, var(--primary)) 14%, var(--ux-card-surface, #fff));
}

body.theme-1 #quizRealTimeContainer .realtime-match-dot {
  border-color: var(--ux-card-surface, #fff);
}

body.theme-1 #quizRealTimeContainer .realtime-solution-box {
  background: color-mix(in srgb, var(--success) 14%, var(--ux-card-surface, #fff));
  border-color: color-mix(in srgb, var(--success) 35%, var(--glass-border));
  color: var(--text);
}

body.theme-1 #quizRealTimeContainer .console-log {
  background: color-mix(in srgb, var(--ux-card-surface, #fff) 88%, #e6eef7);
  color: var(--text);
  border-color: var(--glass-border);
}

body.theme-1 #quizRealTimeContainer .log-entry {
  border-bottom-color: var(--glass-border);
}

body.theme-1 #quizRealTimeContainer .log-event,
body.theme-1 #quizRealTimeContainer .log-data {
  color: var(--muted);
}

body.theme-1 #quizRealTimeContainer .advanced-toggle:hover {
  color: var(--primary);
}

body.theme-1.realtime-active .modal-overlay {
  background: rgba(245, 248, 252, 0.72);
}

body.theme-1.realtime-active .modal-content {
  background: var(--ux-card-surface, #fff);
  border-color: var(--ux-card-border, #dfe7f1);
  color: var(--ux-text-primary, #12263f);
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.14);
}

body.theme-1 #quizRealTimeContainer .solo-performance-card {
  border-color: color-mix(in srgb, #f59e0b 28%, var(--glass-border));
  background: linear-gradient(140deg, #fff7ed, #ffedd5);
  color: #7c2d12;
}

body.theme-1 #quizRealTimeContainer .solo-performance-main,
body.theme-1 #quizRealTimeContainer .solo-performance-kpi {
  background: rgba(255, 255, 255, 0.58);
}

body.theme-1 #quizRealTimeContainer .solo-performance-score-label,
body.theme-1 #quizRealTimeContainer .solo-performance-kpi-label {
  color: #9a3412;
}

body.theme-1 #quizRealTimeContainer .realtime-question-image-container,
body.theme-1 #quizRealTimeContainer .realtime-quiz-image-container {
  background-color: color-mix(in srgb, var(--ux-card-surface, #fff) 88%, #eef4fa);
  border-color: var(--glass-border);
}

@media (max-width: 640px) {
  .realtime-session-info-btn,
  .realtime-session-sound-btn {
    bottom: calc(86px + var(--qzr-safe-bottom));
    left: max(12px, var(--qzr-safe-left));
  }

  .realtime-session-sound-btn {
    bottom: calc(138px + var(--qzr-safe-bottom));
  }

  .players-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 16px;
  }

  .player-card {
    min-height: 64px;
    padding: 12px;
  }

  .playground-header {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .timer-circle-wrap {
    width: 64px;
    height: 64px;
  }

  .timer-circle-wrap .timer-text {
    font-size: 1.25rem;
  }

  .realtime-goal-hud-card {
    padding: 9px 10px;
  }

  .question-box {
    padding: 18px;
    margin-bottom: 18px;
  }

  .question-title {
    font-size: 1.35rem;
  }

  .answers-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .realtime-sortable-list--anagram {
    justify-content: flex-start;
    gap: 8px;
  }

  .realtime-sortable-item--letter {
    flex-basis: 42px;
    width: 42px;
    min-height: 46px;
    border-radius: 13px;
  }

  .realtime-sortable-placeholder--letter {
    flex-basis: 42px;
    width: 42px !important;
    min-height: 46px;
    border-radius: 13px;
  }

  .realtime-sortable-item--letter span:last-child {
    font-size: 1.12rem;
  }

  .realtime-match-board--interactive {
    gap: 14px;
  }

  .realtime-match-head,
  .realtime-match-columns {
    column-gap: clamp(24px, 8vw, 38px);
  }

  .realtime-match-column {
    gap: 12px;
  }

  .realtime-match-card {
    min-height: 74px;
    padding: 10px 8px;
    border-radius: 11px;
    font-size: 0.86rem;
  }

  .realtime-match-card--left {
    gap: 8px;
  }

  .realtime-match-card--right {
    min-height: 74px;
  }

  .realtime-match-thumb {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .realtime-match-dot {
    width: 11px;
    height: 11px;
  }

  .realtime-match-submit {
    min-height: 52px;
    margin-top: 4px;
  }

  .realtime-match-row {
    grid-template-columns: 1fr;
  }

  .answer-btn {
    min-height: 52px;
    padding: 14px;
    font-size: 1rem;
  }

  .status-matrix {
    grid-template-columns: 1fr;
  }

  .console-log {
    height: 220px;
  }

  .feedback-toast {
    width: calc(100vw - 2rem - var(--qzr-safe-left) - var(--qzr-safe-right));
    max-width: 420px;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 1rem;
    letter-spacing: 0;
  }

  .session-info-grid {
    grid-template-columns: 1fr;
  }
}

/* Brutal Elimination Toast */
.elimination-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: rgba(220, 38, 38, 0.95);
  color: white;
  padding: 40px 60px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 0 100px rgba(220, 38, 38, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid #f87171;
  backdrop-filter: blur(10px);
}

.elimination-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.elimination-toast i {
  font-size: 5rem;
  margin-bottom: 20px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: pulseSkull 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseSkull {

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

  50% {
    opacity: .7;
    transform: scale(1.1);
  }
}

.elimination-toast .elimination-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.elimination-toast .elimination-name {
  font-size: 1.5rem;
  font-weight: 500;
}

.competition-winner-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.98), rgba(180, 83, 9, 0.96));
  color: #fff8eb;
  padding: 40px 60px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 0 100px rgba(251, 191, 36, 0.55), inset 0 0 22px rgba(120, 53, 15, 0.45);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid rgba(255, 251, 235, 0.78);
  backdrop-filter: blur(10px);
}

.competition-winner-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.competition-winner-toast i {
  font-size: 5rem;
  margin-bottom: 20px;
  color: #fff7cc;
  text-shadow: 0 4px 20px rgba(120, 53, 15, 0.45);
  animation: pulseWinnerTrophy 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseWinnerTrophy {

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

  50% {
    opacity: 0.88;
    transform: scale(1.08) rotate(-2deg);
  }
}

.competition-winner-toast .winner-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.competition-winner-toast .winner-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.competition-winner-toast .winner-subtitle {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.96;
}

.competition-winner-fireworks {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10000;
}

/* Feedback Toast */
.feedback-toast {
  position: fixed;
  top: calc(20px + var(--qzr-safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-50px);
  padding: 16px 32px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  letter-spacing: 1px;
}

.feedback-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.feedback-toast.success {
  background: linear-gradient(135deg, #10b981, #047857);
  border: 2px solid #34d399;
}

.feedback-toast.error {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border: 2px solid #f87171;
}

.solo-contextual-message {
  position: fixed;
  top: 22%;
  left: 50%;
  z-index: 10010;
  pointer-events: none;
  border-radius: 16px;
  padding: 12px 20px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-align: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  max-width: min(88vw, 720px);
  border: none;
  background: rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}

.solo-contextual-message--flying {
  opacity: 0;
  transform: translate(-140vw, -50%);
  transition:
    transform 750ms cubic-bezier(0.08, 0.82, 0.2, 1),
    opacity 220ms ease-out;
}

.solo-contextual-message--flying.is-entering {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.solo-contextual-message--flying.is-leaving {
  opacity: 0;
  transform: translate(120vw, -50%);
  transition:
    transform 350ms ease-in,
    opacity 350ms ease-in;
}

.solo-contextual-message--flying.tone-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(59, 130, 246, 0.09));
  color: #d1fae5;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.5), 0 0 18px rgba(59, 130, 246, 0.35);
}

.solo-contextual-message--flying.tone-error {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.13), rgba(236, 72, 153, 0.09));
  color: #fef3c7;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.55), 0 0 18px rgba(236, 72, 153, 0.35);
}

.solo-contextual-message--attempts {
  top: 26%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.13), rgba(20, 184, 166, 0.09));
  color: #dbeafe;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.55), 0 0 16px rgba(20, 184, 166, 0.4);
}

.solo-contextual-message--attempts.is-visible {
  animation: soloContextPuffIn 220ms ease-out forwards;
}

.solo-contextual-message--attempts.is-leaving {
  animation: soloContextPuffOut 320ms ease-in forwards;
}

@keyframes soloContextPuffIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes soloContextPuffOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

/* ===================================================================
   Goal-achieved celebration  ·  Centered banner + localised fireworks
   =================================================================== */
.solo-goal-celebrate {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10020;
  pointer-events: none;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
}

.solo-goal-celebrate__banner {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  padding: 14px 26px;
  border-radius: 18px;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(236, 72, 153, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(255, 215, 0, 0.45),
    0 0 48px rgba(236, 72, 153, 0.35);
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.7), 0 0 18px rgba(236, 72, 153, 0.55);
  transition: transform 380ms cubic-bezier(0.18, 1.4, 0.4, 1), opacity 220ms ease-out;
}

.solo-goal-celebrate__title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  opacity: 0.95;
}

.solo-goal-celebrate__label {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.solo-goal-celebrate.is-on .solo-goal-celebrate__banner {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.solo-goal-celebrate.is-off .solo-goal-celebrate__banner {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.12);
  transition: transform 350ms ease-in, opacity 320ms ease-in;
}

.solo-goal-celebrate__fireworks {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

.solo-goal-celebrate__spark {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: -5px 0 0 -5px;
  opacity: 0;
  background: radial-gradient(circle, #fff 0%, #ffd700 45%, rgba(255, 215, 0, 0) 70%);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.9), 0 0 22px rgba(236, 72, 153, 0.55);
  transform: translate(0, 0) scale(0.4);
}

.solo-goal-celebrate__spark.spark--0 { background: radial-gradient(circle, #fff 0%, #ffd700 45%, rgba(255, 215, 0, 0) 70%); }
.solo-goal-celebrate__spark.spark--1 { background: radial-gradient(circle, #fff 0%, #f472b6 45%, rgba(244, 114, 182, 0) 70%); }
.solo-goal-celebrate__spark.spark--2 { background: radial-gradient(circle, #fff 0%, #38bdf8 45%, rgba(56, 189, 248, 0) 70%); }
.solo-goal-celebrate__spark.spark--3 { background: radial-gradient(circle, #fff 0%, #34d399 45%, rgba(52, 211, 153, 0) 70%); }
.solo-goal-celebrate__spark.spark--4 { background: radial-gradient(circle, #fff 0%, #f97316 45%, rgba(249, 115, 22, 0) 70%); }
.solo-goal-celebrate__spark.spark--5 { background: radial-gradient(circle, #fff 0%, #a78bfa 45%, rgba(167, 139, 250, 0) 70%); }

.solo-goal-celebrate.is-on .solo-goal-celebrate__spark {
  animation: soloGoalSpark 1100ms cubic-bezier(0.15, 0.7, 0.2, 1) forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes soloGoalSpark {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(0) scale(0.3);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--distance)) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .solo-goal-celebrate__banner,
  .solo-goal-celebrate.is-on .solo-goal-celebrate__spark {
    transition: opacity 200ms linear;
    animation: none;
  }
  .solo-goal-celebrate.is-on .solo-goal-celebrate__banner {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ===================================================================
   Join-Session inline alert  ·  Frosted-glass translucent panel
   =================================================================== */

/* Outer panel — frosted glass base (fallback + default) */
.join-alert-panel {
  margin: 0.5rem 0.75rem 0.25rem;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  animation: joinAlertSlideIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tint the panel when it carries error items */
.join-alert-panel:has(.join-alert-item--error) {
  border-color: rgba(231, 76, 60, 0.30);
  box-shadow: 0 4px 24px rgba(231, 76, 60, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

/* Tint the panel when it carries success items */
.join-alert-panel:has(.join-alert-item--success) {
  border-color: rgba(39, 174, 96, 0.30);
  box-shadow: 0 4px 24px rgba(39, 174, 96, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

@keyframes joinAlertSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* List reset */
.join-alert-list {
  list-style: none;
  margin: 0;
  padding: 0.55rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Each message row */
.join-alert-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
}

/* Error row */
.join-alert-item--error {
  color: #7f1d1d;
  background: rgba(231, 76, 60, 0.12);
  border-left: 3px solid rgba(231, 76, 60, 0.55);
}

/* Success row */
.join-alert-item--success {
  color: #064e3b;
  background: rgba(39, 174, 96, 0.12);
  border-left: 3px solid rgba(39, 174, 96, 0.55);
}

/* Icon */
.join-alert-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
}

.join-alert-icon--error {
  color: #e74c3c;
}

.join-alert-icon--success {
  color: #27ae60;
}

/* Showcase Goals Badges - Modern Horizontal Scrollable */
.goals-showcase-section {
  width: 100%;
}

.goals-section-header {
  /* display: flex; */
  align-items: center;
}

.goals-section-title {
  color: #374151;
  letter-spacing: 0.02em;
}

.goals-swiper-container {
  position: relative;
}

.goals-swiper-container::-webkit-scrollbar {
  display: none;
}

.goals-badges-track {
  padding: 2px;
}

.goal-badge {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.goal-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Empty state badges */
.goals-placeholder-badge {
  border: 1px dashed #d1d5db;
}

/* Goal badge internal elements */
.goal-badge-icon {
  margin-right: 4px;
}

.goal-badge-value {
  margin-left: 4px;
}

/* Goals section title default styles (override inline) */
.goals-section-title {
  font-size: 4rem;
  font-weight: 100;
  color: #3e5984;
  letter-spacing: 0.02em;
  text-align: center;
  /* width: 100%; */
}

/* Goals swiper container styles (override inline) */
.goals-swiper-container {
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 16px 8px;
}

.goals-showcase-potential {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.goals-potential-metric {
  min-width: 0;
  padding: 25px 10px;
  border: 1px solid rgba(62, 89, 132, 0.18);
  border-radius: 8px;
  /* background: #f8fafc; */
}

.goals-potential-label,
.goals-potential-detail {
  display: block;
  color: #64748b;
  font-family: Roboto, Verdana, sans-serif;
  font-size: 9px;
  line-height: 1.25;
  white-space: normal;
}

.goals-potential-label {
  font-weight: 600;
}

.goals-potential-value {
  display: block;
  margin: 3px 0 2px;
  color: #223c80;
  font-family: "Alfa Slab One", Roboto, Verdana, sans-serif;
  font-size:2.2rem;
  font-weight: 100;
  line-height: 1.15;
}

@media (max-width: 420px) {
  /* Add responsive styles here if needed */
  .goals-showcase-potential {
    /* grid-template-columns: 1fr; */
  }
}

/* Placeholder badge for loading state */
.goals-placeholder-badge {
  font-size: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed #d1d5db;
}
