/* ============================================================
   SCREENS.CSS — Per-screen layout styles
   ============================================================ */

/* ---- HOME ---- */
.logo-icon {
  font-size: 3.75rem;
  display: block;
  animation: bounce 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(57,255,20,.5));
}

img.logo-icon {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
  margin: 0 auto;
}

.game-title {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(3rem, 12vw, 5.625rem);
  line-height: .9;
  background: linear-gradient(135deg, var(--neon-green) 0%, var(--electric-blue) 50%, var(--hot-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(57,255,20,.4));
  letter-spacing: 0.25rem;
  margin-bottom: 0.375rem;
}

.game-subtitle {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.375rem;
  color: var(--electric-blue);
  text-transform: uppercase;
  margin-bottom: 2.5rem;
}

.game-credit {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--hot-pink);
  margin-bottom: 1.875rem;
  letter-spacing: 0.125rem;
}


/* NEW: CATEGORY BUBBLES GRID */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 31.25rem;
  margin: 0 auto 1.875rem;
}

@media (min-width: 480px) {
  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.cat-bubble {
  aspect-ratio: 1 / 1;
  background: rgba(30, 30, 46, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px; /* Modern squircle-like rounding */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  padding: 0.625rem;
}

.cat-bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--cat-color), transparent 70%);
  opacity: 0.15;
  transition: opacity 0.4s;
}

.cat-bubble:hover {
  transform: translateY(-8px) scale(1.05);
  border-color: var(--cat-color);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.1);
}

.cat-bubble:hover::before {
  opacity: 0.35;
}

.cat-bubble:active {
  transform: scale(0.95);
}

.cat-bubble-icon {
  font-size: clamp(2rem, 8vw, 2.625rem);
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  transition: transform 0.3s;
  z-index: 1;
}
.cat-bubble:hover .cat-bubble-icon {
  transform: scale(1.2) rotate(5deg);
}

.cat-bubble-label {
  font-family: 'Bebas Neue', cursive;
  font-size: 1rem;
  letter-spacing: 0.09375rem;
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  text-align: center;
  line-height: 1.2;
  z-index: 1;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
  width: 100%;
}

.popup-mode-grid {
  max-width: 28.125rem;
  margin: 0 auto;
}

.mode-card {
  background: var(--card);
  border: 2px solid rgba(255,255,255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.125rem 0.75rem;
  cursor: pointer;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}

.mode-card:hover {
  transform: translateY(-5px) scale(1.03);
  border-color: var(--electric-blue);
  box-shadow: 0 0 25px rgba(0,212,255,.2);
}

.mode-emoji {
  font-size: 2.25rem;
  display: block;
  margin-bottom: 0.625rem;
}

.mode-name {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.125rem;
  color: white;
  margin-bottom: 0.25rem;
  letter-spacing: 0.0625rem;
}

.mode-desc {
  font-size: 0.6875rem;
  color: rgba(255,255,255,.6);
  line-height: 1.2;
}

.diff-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.75rem;
  letter-spacing: 0.1875rem;
  color: var(--yellow);
  margin-bottom: 1.25rem;
}


.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
  max-width: 43.75rem;
  width: 100%;
  margin: 0;
}

.diff-grid.single-card {
  display: flex;
  justify-content: center;
  max-width: 21.875rem;
}

.diff-card {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  position: relative;
  overflow: hidden;
  width: 100%;
}
.diff-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s;
  border-radius: inherit;
}
.diff-card:hover { transform: translateY(-6px) scale(1.03); }

.diff-card.is-construction {
  opacity: 0.6;
  border-style: dashed !important;
  filter: grayscale(0.8);
  border-color: rgba(255,255,255,0.1) !important;
}
.diff-card.is-construction:hover {
  filter: grayscale(0.4);
  opacity: 0.9;
}

.diff-card[data-level="0"] { border-color: rgba(0,212,255,.35); }
.diff-card[data-level="0"]::before { background: radial-gradient(circle at 50% 0%, rgba(0,212,255,.18), transparent 70%); }
.diff-card[data-level="0"]:hover { border-color: var(--electric-blue); box-shadow: 0 0 30px rgba(0,212,255,.4); }
.diff-card[data-level="0"] .diff-name { color: var(--electric-blue); }

.diff-card[data-level="1"] { border-color: rgba(57,255,20,.35); }
.diff-card[data-level="1"]::before { background: radial-gradient(circle at 50% 0%, rgba(57,255,20,.18), transparent 70%); }
.diff-card[data-level="1"]:hover { border-color: var(--neon-green); box-shadow: 0 0 30px rgba(57,255,20,.4); }
.diff-card[data-level="1"] .diff-name { color: var(--neon-green); }

.diff-card[data-level="2"] { border-color: rgba(255,214,0,.35); }
.diff-card[data-level="2"]::before { background: radial-gradient(circle at 50% 0%, rgba(255,214,0,.18), transparent 70%); }
.diff-card[data-level="2"]:hover { border-color: var(--yellow); box-shadow: 0 0 30px rgba(255,214,0,.4); }
.diff-card[data-level="2"] .diff-name { color: var(--yellow); }

.diff-card[data-level="3"] { border-color: rgba(255,45,120,.35); }
.diff-card[data-level="3"]::before { background: radial-gradient(circle at 50% 0%, rgba(255,45,120,.18), transparent 70%); }
.diff-card[data-level="3"]:hover { border-color: var(--hot-pink); box-shadow: 0 0 30px rgba(255,45,120,.4); }
.diff-card[data-level="3"] .diff-name { color: var(--hot-pink); }

.diff-card[data-level="4"] { border-color: rgba(139,92,246,.35); }
.diff-card[data-level="4"]::before { background: radial-gradient(circle at 50% 0%, rgba(139,92,246,.18), transparent 70%); }
.diff-card[data-level="4"]:hover { border-color: var(--purple); box-shadow: 0 0 30px rgba(139,92,246,.4); }
.diff-card[data-level="4"] .diff-name { color: var(--purple); }

.diff-card[data-level="5"] { border-color: rgba(0,212,255,.35); }
.diff-card[data-level="5"]::before { background: radial-gradient(circle at 50% 0%, rgba(0,212,255,.18), transparent 70%); }
.diff-card[data-level="5"]:hover { border-color: var(--electric-blue); box-shadow: 0 0 30px rgba(0,212,255,.4); }
.diff-card[data-level="5"] .diff-name { color: var(--electric-blue); }

.diff-card[data-level="6"] { border-color: rgba(255, 45, 120, 0.35); }
.diff-card[data-level="6"]::before { background: radial-gradient(circle at 50% 0%, rgba(255, 45, 120, 0.18), transparent 70%); }
.diff-card[data-level="6"]:hover { border-color: var(--hot-pink); box-shadow: 0 0 30px rgba(255, 45, 120, 0.4); }
.diff-card[data-level="6"] .diff-name { color: var(--hot-pink); }

.diff-card[data-level="7"] { border-color: rgba(255, 140, 0, 0.35); }
.diff-card[data-level="7"]::before { background: radial-gradient(circle at 50% 0%, rgba(255, 140, 0, 0.18), transparent 70%); }
.diff-card[data-level="7"]:hover { border-color: #FF8C00; box-shadow: 0 0 30px rgba(255, 140, 0, 0.4); }
.diff-card[data-level="7"] .diff-name { color: #FF8C00; }

.diff-card:hover::before { opacity: 1; }

.diff-emoji { font-size: 2.75rem; margin-bottom: 0.5rem; display: block; }
.diff-name  { font-family: 'Bebas Neue', cursive; font-size: 1.625rem; letter-spacing: 0.125rem; margin-bottom: 0.375rem; }
.diff-desc { font-size: 0.75rem; font-weight: 600; opacity: .7; line-height: 1.4; }
.diff-hs   { font-size: 0.6875rem; font-weight: 700; margin-top: 0.625rem; color: var(--yellow); opacity: .8; }
.home-footer { font-size: 0.75rem; font-weight: 700; color: rgba(255,255,255,.25); letter-spacing: 0.1875rem; margin-bottom: 2.5rem; }

/* ---- NEW: BUBBLE OVERLAY (MODAL) ---- */
.bubble-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bubble-overlay.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.bubble-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 10, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.bubble-modal {
  position: relative;
  background: var(--dark2);
  width: 92%;
  max-width: min(30rem, 90vw);
  max-height: 85vh;
  border-radius: 32px; /* XL Rounded */
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(40px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  z-index: 2010;
}

.bubble-overlay.active .bubble-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.bubble-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.05);
  color: white;
  font-size: 1.625rem;
  line-height: 1;
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2020;
  transition: all 0.2s;
}
.bubble-close:hover { 
  background: var(--hot-pink); 
  transform: rotate(90deg);
  color: white;
}

.bubble-view {
  display: flex;
  flex-direction: column;
  padding: 2rem 1.25rem 1.5rem;
  width: 100%;
  height: 100%;
  max-height: 85vh;
}

.bubble-view-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 2rem;
  letter-spacing: 0.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
  text-shadow: 0 5px 15px rgba(0,0,0,0.5);
  margin-top: 0.625rem;
}

.bubble-scroll-container {
  overflow-y: auto;
  padding-right: 0.375rem;
  flex: 1;
  margin: 0 -0.625rem;
  padding: 0.625rem 1rem;
}

.bubble-scroll-container::-webkit-scrollbar {
  width: 6px;
}
.bubble-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}
.bubble-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
}

.bubble-header-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1.5rem;
  padding-top: 0.625rem;
}

.bubble-back-btn {
  position: absolute;
  left: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255,255,255,0.15);
  color: white;
  border-radius: var(--radius-pill);
  padding: 0.375rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.bubble-back-btn:hover {
  background: var(--electric-blue);
  border-color: var(--electric-blue);
  transform: translateX(-3px);
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}


/* ---- Trigonometry SVG Triangle ---- */
.trig-flex-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.9375rem;
  flex-wrap: wrap;
}
.trig-table-wrap {
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 0.5rem;
}
.trig-info-table {
  border-collapse: collapse;
  font-family: 'Nunito', sans-serif;
  font-size: 0.875rem;
}
.trig-info-table td {
  padding: 0.25rem 0.625rem;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.trig-info-table tr:last-child td {
  border-bottom: none;
}
.trig-table-label {
  font-weight: 800;
  color: var(--electric-blue);
  text-align: left;
}
.trig-table-val {
  font-weight: 700;
  color: white;
  text-align: right;
}
.trig-table-unknown {
  color: var(--yellow);
  font-weight: 900;
  animation: trig-pulse 1.5s ease-in-out infinite;
}

.trig-triangle-svg {
  width: 100%;
  max-width: 13.75rem;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 8px rgba(0,212,255,.2));
}
.trig-label {
  fill: rgba(255,255,255,.85);
  font-family: 'Nunito', sans-serif;
}
.trig-unknown {
  fill: var(--yellow) !important;
  font-size: 1.125rem !important;
  animation: trig-pulse 1.5s ease-in-out infinite;
}
@keyframes trig-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
.trig-line {
  font-family: 'Nunito', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: rgba(255,255,255,.8);
  line-height: 1.5;
  text-align: center;
}

/* ---- Diff-card selected state ---- */
.diff-card.selected {
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 0 40px rgba(139,92,246,.5);
  border-color: var(--purple) !important;
}
.diff-card.selected::after {
  content: '✓';
  position: absolute;
  top: 0.5rem;
  right: 0.625rem;
  background: var(--purple);
  color: white;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop-in .3s cubic-bezier(.34,1.56,.64,1);
}

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

/* ---- RANKING SECTION ---- */
.ranking-section {
  width: 100%;
  max-width: 43.75rem;
  margin: 1.25rem auto 0;
  background: rgba(30,30,46,.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(139,92,246,.25);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
}

.ranking-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.75rem;
  letter-spacing: 0.1875rem;
  background: linear-gradient(135deg, var(--yellow) 0%, var(--orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.125rem;
}

.ranking-tabs {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}
.ranking-tabs::-webkit-scrollbar { display: none; }

.ranking-tab {
  flex: 1;
  min-width: 6.25rem;
  padding: 0.625rem 0.875rem;
  background: rgba(255,255,255,.04);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.5);
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all .3s ease;
  white-space: nowrap;
}
.ranking-tab:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8);
  border-color: rgba(255,255,255,.15);
}
.ranking-tab.active {
  background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(0,212,255,.15));
  border-color: var(--purple);
  color: white;
  box-shadow: 0 0 15px rgba(139,92,246,.25);
}

.ranking-table-wrap {
  min-height: 7.5rem;
}

.ranking-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}
.ranking-table thead th {
  font-family: 'Bebas Neue', cursive;
  font-size: 0.875rem;
  letter-spacing: 0.125rem;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ranking-table thead th:last-child { text-align: right; }

.ranking-table tbody tr {
  background: rgba(255,255,255,.03);
  transition: all .2s;
}
.ranking-table tbody tr:hover {
  background: rgba(255,255,255,.07);
}
.ranking-table tbody tr.ranking-top {
  background: rgba(139,92,246,.08);
}

.ranking-table td {
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,.7);
}
.ranking-table td:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  text-align: center;
  width: 2.5rem;
}
.ranking-table td:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  text-align: right;
  color: var(--neon-green);
  font-family: 'Bebas Neue', cursive;
  font-size: 1rem;
  letter-spacing: 0.0625rem;
}

.ranking-pos { font-size: 1rem; }
.ranking-player { color: white !important; }
.ranking-level { font-size: 0.75rem !important; opacity: .7; }

.ranking-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.875rem 1.25rem;
  color: rgba(255,255,255,.3);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  gap: 0.5rem;
}
.ranking-empty-icon {
  font-size: 2.5rem;
  filter: grayscale(.5);
}

/* ---- GAME ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.timer-wrap {
  background: var(--card);
  border-radius: var(--radius-pill);
  height: 0.75rem;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1.5px solid rgba(255,255,255,.08);
}
.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-green), var(--electric-blue));
  border-radius: var(--radius-pill);
  transition: width 1s linear, background .3s;
}
.timer-bar.warn   { background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.timer-bar.danger { background: linear-gradient(90deg, var(--hot-pink), var(--orange)); animation: pulse-bar .5s infinite; }

.marathon-track {
  background: var(--card);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.125rem;
  margin-bottom: 0.875rem;
  overflow: hidden;
}
.track-label { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1875rem; text-transform: uppercase; color: var(--electric-blue); margin-bottom: 0.625rem; }
.track-inner { display: flex; align-items: center; height: 2.75rem; width: 100%; position: relative; }
.track-dots  { display: flex; gap: 0; width: 100%; justify-content: space-between; align-items: center; position: relative; transition: none; }
.track-dot {
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 700; flex-shrink: 0;
  transition: all .3s;
}
.track-dot.done     { background: var(--neon-green);    border-color: var(--neon-green); color: var(--dark); }
.track-dot.current  { background: var(--electric-blue); border-color: var(--electric-blue); color: var(--dark); box-shadow: 0 0 12px var(--electric-blue); animation: current-pulse 1s ease-in-out infinite; }
.track-dot.locked   { background: rgba(255,255,255,.05); }
.track-dot.challenge{ background: var(--purple); border-color: var(--purple); color: white; }
.track-dot.boss     { background: var(--hot-pink); border-color: var(--hot-pink); color: white; box-shadow: 0 0 10px var(--hot-pink); }
.runner {
  position: absolute;
  font-size: 1.625rem;
  top: 50%; transform: translateY(-50%) scaleX(-1);
  transition: left .5s cubic-bezier(.34,1.56,.64,1);
  z-index: 2;
  filter: drop-shadow(0 0 8px rgba(57,255,20,.6));
  animation: runner-bounce .4s ease-in-out infinite alternate;
}

.eq-card {
  background: var(--card);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.375rem;
  text-align: center;
  margin-bottom: 1.125rem;
  position: relative;
  overflow: hidden;
  transition: border-color .3s, box-shadow .3s;
}
.eq-card.correct { border-color: var(--neon-green); box-shadow: 0 0 30px rgba(57,255,20,.4); }
.eq-card.wrong   { border-color: var(--hot-pink);   box-shadow: 0 0 30px rgba(255,45,120,.4); animation: shake .4s; }

.equation { font-family: 'Bebas Neue', cursive; font-size: clamp(1.875rem, 8vw, 3.25rem); letter-spacing: 0.1875rem; margin-bottom: 0.5rem; line-height: 1.3; white-space: pre-line; }
.eq-hint  { font-size: 0.8125rem; font-weight: 600; color: rgba(255,255,255,.4); }
.multiplier { display: none; margin-top: 0.625rem; background: linear-gradient(135deg, var(--orange), var(--yellow)); color: var(--dark); border-radius: var(--radius-pill); padding: 0.25rem 0.875rem; font-size: 0.8125rem; font-weight: 900; }
.multiplier.show { display: inline-block; }

/* ---- Multi-line equation layouts ---- */
/* Sistema de ecuaciones — llave { a la izquierda */
.sys-wrap {
  display: inline-flex;
  align-items: stretch;
  gap: 0.5rem;
}
.sys-brace {
  font-size: clamp(2.5rem, 10vw, 4.375rem);
  line-height: 1;
  color: var(--electric-blue);
  font-weight: 100;
  align-self: center;
  opacity: .9;
}
.sys-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  text-align: left;
}
.sys-line {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(1.25rem, 5vw, 2.25rem);
  letter-spacing: 0.125rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* Derivada — función en grande, pregunta en color acento */
.deriv-func {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(1.5rem, 6vw, 2.75rem);
  letter-spacing: 0.1875rem;
  line-height: 1.2;
}
.deriv-question {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(1.25rem, 5vw, 2.125rem);
  letter-spacing: 0.1875rem;
  color: var(--yellow);
  margin-top: 0.25rem;
  opacity: .9;
}

.answers-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.75rem; margin-bottom: 0.875rem; }
.answer-btn {
  background: var(--card);
  border: 2px solid rgba(255,255,255,.12);
  border-radius: var(--radius-md);
  padding: 1.125rem 0.875rem;
  font-family: 'Bebas Neue', cursive;
  font-size: 1.625rem; letter-spacing: 0.125rem;
  color: white; cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  line-height: 1.3;
}
.answer-btn:hover { border-color: var(--electric-blue); transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 25px rgba(0,212,255,.3); }
.answer-btn:active { transform: scale(.97); }
.answer-btn.correct-ans { background: rgba(57,255,20,.2); border-color: var(--neon-green); color: var(--neon-green); }
.answer-btn.wrong-ans   { background: rgba(255,45,120,.2); border-color: var(--hot-pink);   color: var(--hot-pink); }
.answer-btn:disabled { pointer-events: none; }

/* KaTeX math expressions inside answer buttons */
.answer-btn .katex {
  font-size: 1.4rem;
  letter-spacing: normal;
}
.answer-btn .katex .frac-line {
  border-top-width: 2px;
}

.input-wrap { display: flex; gap: 0.75rem; margin-bottom: 0.875rem; }
.eq-input {
  flex: 1;
  background: var(--card);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  font-family: 'Bebas Neue', cursive;
  font-size: 1.875rem; letter-spacing: 0.1875rem;
  color: white; text-align: center; outline: none;
  transition: border-color .3s, box-shadow .3s;
}
.eq-input:focus { border-color: var(--electric-blue); box-shadow: 0 0 20px rgba(0,212,255,.3); }
.eq-input.correct-ans { border-color: var(--neon-green); color: var(--neon-green); }
.eq-input.wrong-ans   { border-color: var(--hot-pink);   color: var(--hot-pink); }

.progress-text { text-align: center; font-family: 'Bebas Neue', cursive; font-size: 1.25rem; letter-spacing: 0.125rem; color: var(--electric-blue); margin-top: auto; padding-top: 0.5rem; }

/* ---- CHALLENGE INTERSTITIAL ---- */
.challenge-card {
  background: var(--card);
  border: 2px solid var(--purple);
  border-radius: 28px;
  padding: 2.5rem 1.875rem;
  max-width: min(31.25rem, 85vw); width: 100%;
  box-shadow: 0 0 60px rgba(139,92,246,.3);
  animation: card-appear .5s cubic-bezier(.34,1.56,.64,1);
}
.challenge-big-icon  { font-size: 4.5rem; margin-bottom: 0.875rem; display: block; animation: bounce 1s ease-in-out infinite; }
.challenge-big-title { font-family: 'Bebas Neue', cursive; font-size: 2.625rem; letter-spacing: 0.25rem; color: var(--purple); margin-bottom: 0.5rem; }
.challenge-big-desc  { font-size: 1.0625rem; font-weight: 700; margin-bottom: 1.25rem; line-height: 1.5; }
.challenge-reward    { background: rgba(255,214,0,.1); border: 2px solid rgba(255,214,0,.35); border-radius: var(--radius-sm); padding: 0.75rem; margin-bottom: 1.375rem; font-weight: 700; color: var(--yellow); font-size: 0.875rem; }

/* ---- RESULT ---- */
.result-card {
  background: var(--card);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: 28px;
  padding: 2.5rem 1.75rem;
  max-width: min(31.25rem, 85vw); width: 100%;
  animation: card-appear .5s cubic-bezier(.34,1.56,.64,1);
}
.result-emoji    { font-size: 4.75rem; margin-bottom: 0.875rem; display: block; }
.result-title    { font-family: 'Bebas Neue', cursive; font-size: 3.125rem; letter-spacing: 0.25rem; margin-bottom: 0.375rem; }
.result-subtitle { font-size: 0.9375rem; font-weight: 600; opacity: .7; margin-bottom: 1rem; }
.stars-wrap      { font-size: 1.75rem; margin-bottom: 0.5rem; }
.new-hs-badge    { background: linear-gradient(135deg,var(--yellow),var(--orange)); color: var(--dark); border-radius: var(--radius-pill); padding: 0.375rem 1.25rem; font-weight: 900; font-size: 0.875rem; letter-spacing: 0.125rem; display: inline-block; margin-bottom: 1rem; }

.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
.result-stat  { background: rgba(255,255,255,.05); border-radius: var(--radius-md); padding: 0.875rem 0.625rem; }
.result-stat-val   { font-family: 'Bebas Neue', cursive; font-size: 1.875rem; letter-spacing: 0.125rem; }
.result-stat-label { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.125rem; text-transform: uppercase; opacity: .6; margin-top: 0.25rem; }

/* ---- Ranking name entry on result ---- */
.ranking-name-wrap {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: rgba(139,92,246,.08);
  border: 1.5px solid rgba(139,92,246,.2);
  border-radius: var(--radius-md);
}
.ranking-name-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.0625rem;
  color: var(--purple);
  margin-bottom: 0.625rem;
  text-transform: uppercase;
}
.ranking-name-row {
  display: flex;
  gap: 0.5rem;
}
.ranking-name-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9375rem;
  font-weight: 600;
  outline: none;
  transition: border-color .3s;
}
.ranking-name-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 12px rgba(139,92,246,.2);
}
.ranking-name-input::placeholder {
  color: rgba(255,255,255,.3);
}
.ranking-save-btn {
  padding: 0.625rem 1.125rem;
  background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(0,212,255,.15));
  border: 1.5px solid var(--purple);
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 700;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all .3s;
  white-space: nowrap;
}
.ranking-save-btn:hover {
  background: linear-gradient(135deg, rgba(139,92,246,.4), rgba(0,212,255,.25));
  box-shadow: 0 0 15px rgba(139,92,246,.3);
}
.ranking-save-btn:disabled {
  opacity: .6;
  cursor: default;
}
.ranking-saved-msg {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--neon-green);
  margin-top: 0.5rem;
  animation: fade-up .3s ease-out;
}

/* ---- PVP SIMULTANEOUS MODE ---- */
.pvp-screen-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.pvp-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,.3);
  border-bottom: 1.5px solid rgba(255,255,255,.08);
  padding: 0.75rem 1.125rem;
  gap: 0.75rem;
}

.pvp-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex: 1;
}

.player-score {
  background: rgba(255,255,255,.05);
  border-radius: var(--radius-md);
  padding: 0.625rem 1rem;
  text-align: center;
}

.player-score.player1-score { border-left: 3px solid var(--neon-green); }
.player-score.player2-score { border-left: 3px solid var(--electric-blue); }

.player-name {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.0625rem;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 0.25rem;
}

.player-points {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.75rem;
  letter-spacing: 0.125rem;
  color: white;
}

.vs-text {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.125rem;
  color: var(--hot-pink);
  font-weight: 700;
}

/* PvP Split Screen */
.pvp-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}

.pvp-player-section {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-right: 1.5px solid rgba(255,255,255,.08);
  overflow-y: auto;
}

.pvp-player-section:last-child {
  border-right: none;
}

.pvp-player-section.player1-section { background: rgba(57,255,20,.05); }
.pvp-player-section.player2-section { background: rgba(0,212,255,.05); }

.player-header {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.0625rem;
  margin-bottom: 0.75rem;
  color: rgba(255,255,255,.8);
}

.eq-card {
  margin-bottom: 0.75rem;
  padding: 1rem 0.875rem;
}

.eq-card .equation { font-size: clamp(1.25rem, 5vw, 2rem); margin-bottom: 0.375rem; }
.eq-card .eq-hint { font-size: 0.75rem; }

.pvp-player-section .answers-grid {
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  grid-template-columns: repeat(2, 1fr);
}

.pvp-player-section .answer-btn {
  padding: 0.625rem 0.5rem;
  font-size: 0.8125rem;
}

.marathon-track-pvp {
  background: rgba(0,0,0,.2);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin-top: auto;
  overflow: hidden;
}

.marathon-track-pvp .track-label { font-size: 0.625rem; margin-bottom: 0.375rem; }
.marathon-track-pvp .track-inner { height: 2rem; }
.marathon-track-pvp .track-dot { width: 1.25rem; height: 1.25rem; font-size: 0.5625rem; }

@media (max-width: 480px) {
  .diff-grid     { grid-template-columns: 1fr; max-width: 18.75rem; }
  .answers-grid  { grid-template-columns: 1fr; }
  .result-stats  { grid-template-columns: repeat(2,1fr); }
  .pvp-split-container { grid-template-columns: 1fr; }
  .pvp-player-section { border-right: none; border-bottom: 1.5px solid rgba(255,255,255,.08); }
  .pvp-player-section:last-child { border-bottom: none; }
  .team-split-container { grid-template-columns: 1fr; }
  .team-player-section { border-right: none; border-bottom: 1.5px solid rgba(255,255,255,.08); }
  .team-player-section:last-child { border-bottom: none; }
  .teams-container { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

/* ---- TEAMS INPUT SCREEN ---- */
.container-form {
  background: var(--bg-secondary);
  border: 1.5px solid rgba(57,255,20,.15);
  border-radius: var(--radius-lg);
  padding: 1.875rem;
  max-width: min(56.25rem, 90vw);
  margin: 0 auto;
}

.container-form h1 {
  font-family: 'Bebas Neue', cursive;
  font-size: 2.625rem;
  color: var(--neon-green);
  margin-bottom: 0.5rem;
  letter-spacing: 0.125rem;
}

.container-form .subtitle {
  color: rgba(255,255,255,.7);
  margin-bottom: 1.875rem;
  font-size: 0.875rem;
}

.teams-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.875rem;
  margin-bottom: 1.875rem;
}

.team-form {
  background: rgba(0,0,0,.2);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.team-form h2 {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: white;
}

.team-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: white;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.team-input::placeholder {
  color: rgba(255,255,255,.4);
}

.team-input:focus {
  outline: none;
  border-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(57,255,20,.2);
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.player-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.player-input {
  flex: 1;
  padding: 0.625rem 0.75rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.875rem;
}

.player-input::placeholder {
  color: rgba(255,255,255,.4);
}

.player-input:focus {
  outline: none;
  border-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(57,255,20,.2);
}

.remove-player-btn {
  background: rgba(255,0,0,.2);
  border: 1px solid rgba(255,0,0,.3);
  color: #ff4444;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: bold;
  transition: all .2s;
}

.remove-player-btn:hover {
  background: rgba(255,0,0,.3);
  border-color: rgba(255,0,0,.5);
}

.add-player-btn {
  width: 100%;
  padding: 0.625rem;
  background: rgba(57,255,20,.15);
  border: 1px solid rgba(57,255,20,.3);
  border-radius: var(--radius-sm);
  color: var(--neon-green);
  cursor: pointer;
  font-weight: 600;
  transition: all .2s;
  font-size: 0.8125rem;
}

.add-player-btn:hover {
  background: rgba(57,255,20,.25);
  border-color: var(--neon-green);
}

.difficulty-selector {
  margin-bottom: 1.5625rem;
  text-align: center;
}

.difficulty-selector label {
  display: block;
  color: var(--yellow);
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.btn-group {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
}

.difficulty-btn {
  padding: 0.625rem 1.25rem;
  background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(255,255,255,.15);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all .2s;
  font-size: 0.8125rem;
}

.difficulty-btn:hover {
  border-color: var(--electric-blue);
}

.difficulty-btn.selected {
  background: rgba(57,255,20,.3);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.start-btn {
  width: 100%;
  padding: 0.9375rem 1.875rem;
  background: linear-gradient(135deg, rgba(57,255,20,.3), rgba(0,212,255,.3));
  border: 2px solid var(--neon-green);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  letter-spacing: 0.0625rem;
}

.start-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(57,255,20,.3);
  background: linear-gradient(135deg, rgba(57,255,20,.4), rgba(0,212,255,.4));
}

/* ---- TEAM GAME SCREEN ---- */
.team-game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0.625rem;
  gap: 0.625rem;
}

.team-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,.3);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  gap: 1rem;
}

.team-scores {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
}

.team-score {
  text-align: center;
  min-width: 5rem;
}

.team-score .team-name {
  font-size: 0.75rem;
  color: rgba(255,255,255,.7);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.team-score .team-points {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.125rem;
  color: rgba(255,255,255,.6);
  letter-spacing: 0.0625rem;
  margin-top: 0.125rem;
}

.hp-bar-wrap {
  width: 6.25rem;
  height: 0.625rem;
  background: rgba(255,255,255,.1);
  border-radius: 5px;
  overflow: hidden;
  margin: 0.25rem auto 0.125rem;
}

.hp-bar {
  height: 100%;
  width: 100%;
  background-color: #22c55e;
  border-radius: 5px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.hp-label {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.25rem;
  color: white;
  letter-spacing: 0.0625rem;
}

.vs-text {
  color: var(--yellow);
  font-weight: 700;
  font-size: 1rem;
}

.round-info {
  color: var(--electric-blue);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.0625rem;
}

.player-names-bar {
  display: flex;
  justify-content: space-around;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-weight: 600;
  color: white;
  font-size: 0.8125rem;
  gap: 0.625rem;
}

.current-player {
  flex: 1;
  text-align: center;
  padding: 0.25rem 0.5rem;
}

.team-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  flex: 1;
  overflow: visible;
  min-height: 31.25rem;
  height: auto;
}

.team-player-section {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,.2);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  gap: 0.5rem;
  min-height: 21.875rem;
  overflow: visible;
}

.team-player-section .player-header {
  font-weight: 600;
  font-size: 0.8125rem;
  color: white;
  text-align: center;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

.team-player-section .eq-card {
  background: rgba(255,255,255,.03);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  padding: 0.625rem;
  text-align: center;
  flex-shrink: 0;
  min-height: 5rem;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.team-player-section .eq-type-badge {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--electric-blue);
  letter-spacing: 0.0625rem;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.25rem;
}

.team-player-section .equation {
  font-family: 'Courier New', monospace;
  font-size: 1.125rem;
  color: #ffffff;
  margin: 0.5rem 0;
  word-break: break-word;
  white-space: pre-line;
  min-height: 1.5rem;
  line-height: 1.4;
  display: block;
  visibility: visible;
}

.team-player-section .eq-hint {
  font-size: 0.6875rem;
  color: rgba(255,255,255,.6);
  margin-top: 0.25rem;
}

.team-player-section .answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
  flex-shrink: 0;
}

.team-player-section .answer-btn {
  background: rgba(57,255,20,.1);
  border: 1.5px solid rgba(57,255,20,.3);
  color: white;
  padding: 0.5rem 0.375rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all .2s;
  min-height: auto;
  display: block;
}

.team-player-section .answer-btn:hover {
  background: rgba(57,255,20,.2);
  border-color: var(--neon-green);
  transform: scale(1.05);
}

.team-player-section .answer-btn span {
  display: block;
}

.team-player-section .input-wrap {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.team-player-section .eq-input {
  flex: 1;
  padding: 0.5rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.8125rem;
  text-align: center;
}

.team-player-section .eq-input::placeholder {
  color: rgba(255,255,255,.4);
}

.team-player-section .eq-input:focus {
  outline: none;
  border-color: var(--neon-green);
}

.team-player-section .submit-btn {
  padding: 0.5rem 0.75rem;
  background: rgba(57,255,20,.2);
  border: 1.5px solid rgba(57,255,20,.4);
  color: var(--neon-green);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.team-player-section .submit-btn:hover {
  background: rgba(57,255,20,.3);
  border-color: var(--neon-green);
}

.team-player-section .eq-card.correct {
  background: rgba(0,255,100,.15);
  border-color: rgba(0,255,100,.4);
}

.team-player-section .eq-card.wrong {
  background: rgba(255,50,50,.15);
  border-color: rgba(255,50,50,.4);
}

/* ---- TOURNAMENT GAME SCREEN ---- */
.tournament-section {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,.25);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 1rem;
  gap: 0.75rem;
  min-height: 18.75rem;
  overflow: visible;
}

.tournament-section-1 {
  border-left: 4px solid var(--neon-green);
}

.tournament-section-2 {
  border-left: 4px solid var(--electric-blue);
}

.tournament-section .player-header {
  font-weight: 700;
  font-size: 0.875rem;
  color: white;
  text-align: center;
  margin-bottom: 0.375rem;
  flex-shrink: 0;
  letter-spacing: 0.0625rem;
}

.tournament-section .eq-card {
  background: rgba(255,255,255,.05);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  flex-shrink: 0;
  min-height: 6rem;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tournament-section .eq-type-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--yellow);
  letter-spacing: 0.0625rem;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.375rem;
}

.tournament-section .equation {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  color: #ffffff;
  margin: 0.5rem 0;
  word-break: break-word;
  white-space: pre-line;
  min-height: 1.75rem;
  line-height: 1.4;
  display: block;
  visibility: visible;
  letter-spacing: 0.125rem;
}

.tournament-section .equation .katex {
  font-size: 1.5rem;
}

.tournament-section .eq-hint {
  font-size: 0.75rem;
  color: rgba(255,255,255,.6);
  margin-top: 0.375rem;
}

.tournament-section .answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  flex-shrink: 0;
  margin-bottom: 0;
}

.tournament-section .answer-btn {
  background: var(--card);
  border: 2px solid rgba(255,255,255,.15);
  color: white;
  padding: 0.875rem 0.625rem;
  border-radius: var(--radius-md);
  font-family: 'Bebas Neue', cursive;
  font-size: 1.25rem;
  letter-spacing: 0.09375rem;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}

.tournament-section .answer-btn:hover {
  border-color: var(--electric-blue);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0,212,255,.25);
}

.tournament-section .answer-btn:active {
  transform: scale(.97);
}

.tournament-section .answer-btn.correct-ans {
  background: rgba(57,255,20,.2);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.tournament-section .answer-btn.wrong-ans {
  background: rgba(255,45,120,.2);
  border-color: var(--hot-pink);
  color: var(--hot-pink);
}

.tournament-section .answer-btn:disabled {
  pointer-events: none;
}

/* KaTeX math expressions inside tournament answer buttons */
.tournament-section .answer-btn .katex {
  font-size: 1.125rem;
  letter-spacing: normal;
}

.tournament-section .answer-btn .katex .frac-line {
  border-top-width: 2px;
}

.tournament-section .eq-card.correct {
  background: rgba(0,255,100,.15);
  border-color: var(--neon-green);
  box-shadow: 0 0 20px rgba(57,255,20,.3);
}

.tournament-section .eq-card.wrong {
  background: rgba(255,50,50,.15);
  border-color: var(--hot-pink);
  box-shadow: 0 0 20px rgba(255,45,120,.3);
  animation: shake .4s;
}

/* ---- TEAM RESULT SCREEN ---- */
.team-result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.25rem;
  gap: 1.875rem;
  max-width: min(62.5rem, 90vw);
  margin: 0 auto;
}

.result-banner {
  background: linear-gradient(135deg, rgba(57,255,20,.2), rgba(0,212,255,.2));
  border: 2px solid var(--neon-green);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  width: 100%;
}

.result-banner.team1-winner {
  border-color: rgba(255,100,100, .6);
  background: linear-gradient(135deg, rgba(255,100,100,.15), rgba(255,100,100,.05));
}

.result-banner.team2-winner {
  border-color: rgba(100,150,255, .6);
  background: linear-gradient(135deg, rgba(100,150,255,.15), rgba(100,150,255,.05));
}

.result-banner.tie-winner {
  border-color: var(--yellow);
  background: linear-gradient(135deg, rgba(255,200,0,.15), rgba(255,200,0,.05));
}

.winner-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 2rem;
  color: var(--neon-green);
  letter-spacing: 0.125rem;
  margin-bottom: 0.75rem;
}

.winner-name {
  font-family: 'Bebas Neue', cursive;
  font-size: 3rem;
  background: linear-gradient(135deg, white, rgba(255,255,255,.7));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.0625rem;
}

.teams-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.875rem;
  width: 100%;
}

.team-stat {
  background: rgba(0,0,0,.3);
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 1.5625rem;
  text-align: center;
}

.team-stat h2 {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.5rem;
  color: white;
  margin-bottom: 0.75rem;
  letter-spacing: 0.0625rem;
}

.team-score-display {
  font-family: 'Bebas Neue', cursive;
  font-size: 2.625rem;
  color: var(--neon-green);
  margin-bottom: 1.25rem;
  letter-spacing: 0.125rem;
}

.team-players-stats {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  text-align: left;
}

.player-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,.03);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.05);
}

.player-name {
  font-weight: 600;
  color: white;
}

.player-score {
  color: var(--electric-blue);
  font-weight: 700;
}

.result-actions {
  display: flex;
  gap: 0.9375rem;
  width: 100%;
  max-width: 37.5rem;
}

.result-btn {
  flex: 1;
  padding: 0.9375rem 1.875rem;
  background: rgba(57,255,20,.15);
  border: 2px solid rgba(57,255,20,.3);
  color: var(--neon-green);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  letter-spacing: 0.0625rem;
  text-transform: uppercase;
}

.result-btn:hover {
  transform: translateY(-3px);
  border-color: var(--neon-green);
  background: rgba(57,255,20,.25);
  box-shadow: 0 0 20px rgba(57,255,20,.2);
}

.result-btn.home-btn {
  background: rgba(0,212,255,.15);
  border-color: rgba(0,212,255,.3);
  color: var(--electric-blue);
}

.result-btn.home-btn:hover {
  border-color: var(--electric-blue);
  background: rgba(0,212,255,.25);
  box-shadow: 0 0 20px rgba(0,212,255,.2);
}

/* ============================================================
   PROJECTION / LARGE SCREENS (35" - 55" TVs, 1080p & 4K)
   ============================================================ */

@media (min-width: 1024px) {
  /* General Scaling */
  .screen-inner { 
    max-width: 62.5rem; 
    padding: 2.5rem; 
  }
  
  /* Home / Modes */
  .game-title { font-size: 7.5rem; }
  .game-subtitle { font-size: 1.25rem; letter-spacing: 0.625rem; }
  
  .mode-grid { 
    max-width: 56.25rem; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 1.5rem; 
  }
  .mode-emoji { font-size: 3.75rem; }
  .mode-name { font-size: 1.375rem; }
  .mode-desc { font-size: 0.875rem; }
  
  /* Difficulties */
  .diff-grid { 
    max-width: 56.25rem; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 1.5rem; 
  }
  .diff-emoji { font-size: 3.5rem; }
  .diff-name { font-size: 2rem; }
  .diff-desc { font-size: 0.875rem; }
  
  /* Rankings */
  .ranking-section { max-width: 56.25rem; padding: 2.5rem; }
  .ranking-title { font-size: 2.25rem; }
  .ranking-table td { font-size: 1rem; padding: 0.875rem 1.125rem; }
  
  /* Game Elements */
  .eq-card { padding: 2.5rem; border-width: 3px; }
  .equation { font-size: 5rem; }
  .eq-hint { font-size: 1.125rem; }
  
  .answers-grid { gap: 1.25rem; }
  .answer-btn { padding: 1.875rem; font-size: 2.5rem; border-width: 3px; }
  .eq-input { font-size: 3rem; padding: 1.25rem; }
  
  .top-bar { margin-bottom: 1.5rem; }
  .timer-wrap { height: 1.125rem; }
  
  /* Team & PvP Layouts */
  .team-split-container { gap: 1.25rem; }
  .team-player-section { padding: 1.5rem; }
  .team-player-section .equation { font-size: 2.25rem; line-height: 1.5; }
  .team-player-section .answer-btn { font-size: 1.375rem; padding: 1rem; }
  .team-player-section .eq-input { font-size: 1.625rem; padding: 1rem; }
  .team-player-section .eq-type-badge { font-size: 0.875rem; }
  
  .pvp-split-container { gap: 0.5rem; }
  .pvp-player-section { padding: 1.875rem; }
  .pvp-player-section .eq-card .equation { font-size: 3rem; }
  .pvp-player-section .answer-btn { font-size: 1.5rem; padding: 1rem; }
  
  /* Tournament Layouts */
  .tournament-section { padding: 1.5rem; gap: 1rem; }
  .tournament-section .equation { font-size: 2.5rem; line-height: 1.5; }
  .tournament-section .equation .katex { font-size: 2rem; }
  .tournament-section .answer-btn { font-size: 1.75rem; padding: 1.125rem; min-height: 4rem; }
  .tournament-section .answer-btn .katex { font-size: 1.5rem; }
  .tournament-section .eq-card { padding: 1.5rem; min-height: 8rem; }
  .tournament-section .eq-type-badge { font-size: 0.875rem; }
  .tournament-section .player-header { font-size: 1.125rem; }
  
  /* Team Form Setup */
  .container-form { max-width: 68.75rem; padding: 3.125rem; }
  .teams-container { gap: 3.125rem; }
  .team-form h2 { font-size: 1.75rem; }
  .team-input, .player-input { font-size: 1.125rem; padding: 0.875rem; }
  .difficulty-btn { font-size: 1rem; padding: 0.875rem 1.75rem; }
  .start-btn { font-size: 1.25rem; padding: 1.25rem 2.5rem; }
  
  /* Team Game Specific */
  .team-top-bar { padding: 1rem 1.5rem; }
  .team-score .team-name { font-size: 1rem; }
  .team-score .team-points { font-size: 1.625rem; }
  .hp-bar-wrap { width: 9.375rem; height: 0.875rem; }
  .hp-label { font-size: 1.75rem; }
  .player-names-bar { font-size: 1.125rem; padding: 1rem; }
  .round-info { font-size: 1rem; }
  
  /* Team Results */
  .team-result-container { max-width: 75rem; padding: 3.75rem 2.5rem; }
  .winner-title { font-size: 2.625rem; }
  .winner-name { font-size: 4rem; }
  .team-stat h2 { font-size: 2rem; }
  .team-score-display { font-size: 3.5rem; }
  .player-name, .player-score { font-size: 1.25rem; padding: 0.25rem; }
  .result-btn { font-size: 1.125rem; padding: 1.25rem 2.5rem; }
}

@media (min-width: 1600px) {
  /* For 4K projection or large boardroom displays */
  .screen-inner { max-width: 81.25rem; }
  .mode-grid { max-width: 68.75rem; gap: 2rem; }
  .diff-grid { max-width: 75rem; gap: 2rem; }
}
