/* ============================================
   MATH COMPETITION - "MEMPHIS ARCADE" THEME
   Bold geometric shapes, game-show energy,
   chunky type, high contrast, pure fun.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Titan+One&family=DM+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;700;800&display=swap');

:root {
  --ink: #0D0D0D;
  --ink-soft: #2A2A3C;
  --cream: #FFF8F0;
  --cream-dark: #F5EDE0;
  --coral: #FF5252;
  --coral-dark: #E03E3E;
  --blue: #3D5AFE;
  --blue-light: #8C9EFF;
  --yellow: #FFD740;
  --yellow-pale: #FFF3B0;
  --mint: #00E5A0;
  --mint-pale: #B2FFE0;
  --pink: #FF4081;
  --peach: #FFAB91;
  --violet: #7C4DFF;
  --white: #FFFFFF;
  --gray: #8E8E9A;
  --gray-light: #C4C4D0;
  --shadow-hard: 4px 4px 0px var(--ink);
  --shadow-hard-sm: 3px 3px 0px var(--ink);
  --shadow-hard-lg: 6px 6px 0px var(--ink);
  --shadow-soft: 0 8px 30px rgba(13, 13, 13, 0.08);
  --success: #00E676;
  --danger: #FF1744;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --border: 3px solid var(--ink);
  --border-thick: 4px solid var(--ink);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  font-weight: 500;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="10" cy="10" r="8" fill="%23FF5252" stroke="%230D0D0D" stroke-width="2"/></svg>'), auto;
}

/* ========== GEOMETRIC BACKGROUND ========== */
.bg-geo {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--cream);
  background-image:
    radial-gradient(circle at 20% 80%, var(--yellow-pale) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(61, 90, 254, 0.06) 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, rgba(255, 64, 129, 0.04) 0%, transparent 50%);
}

/* Dot grid pattern with noise texture */
.bg-geo::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(var(--ink) 0.8px, transparent 0.8px),
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="noise"><feTurbulence baseFrequency="0.9" numOctaves="4"/></filter><rect width="300" height="300" filter="url(%23noise)" opacity="0.05"/></svg>');
  background-size: 28px 28px, 300px 300px;
  opacity: 0.06;
  mix-blend-mode: multiply;
}

/* Floating geometric shapes */
.geo-shape {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border: var(--border);
}

.geo-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--yellow);
  top: 8%;
  right: 8%;
  animation: geoFloat 12s ease-in-out infinite;
}

.geo-triangle {
  width: 0;
  height: 0;
  border-left: 35px solid transparent;
  border-right: 35px solid transparent;
  border-bottom: 60px solid var(--coral);
  border-top: none;
  background: none;
  top: 70%;
  left: 5%;
  animation: geoFloat 15s ease-in-out infinite reverse;
}

.geo-square {
  width: 55px;
  height: 55px;
  background: var(--mint);
  bottom: 15%;
  right: 6%;
  transform: rotate(15deg);
  animation: geoSpin 20s linear infinite;
}

.geo-cross {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  top: 35%;
  left: 8%;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--blue);
  opacity: 0.25;
  animation: geoFloat 10s ease-in-out infinite;
}

.geo-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: none;
  border: 5px solid var(--pink);
  top: 50%;
  right: 12%;
  opacity: 0.2;
  animation: geoFloat 18s ease-in-out infinite;
}

@keyframes geoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(8deg); }
}

@keyframes geoSpin {
  from { transform: rotate(15deg); }
  to { transform: rotate(375deg); }
}

/* ========== LAYOUT ========== */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* ========== HEADER ========== */
.header {
  text-align: center;
  padding: 50px 20px 30px;
}

.header h1 {
  font-family: 'Titan One', cursive;
  font-size: 3rem;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -1px;
  line-height: 1.1;
  text-shadow: 3px 3px 0 var(--yellow);
}

.header p {
  font-size: 1.1rem;
  color: var(--gray);
  font-weight: 600;
  margin-top: 8px;
}

.header-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: iconWobble 3s ease-in-out infinite;
}

@keyframes iconWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-8deg) scale(1.05); }
  75% { transform: rotate(8deg) scale(1.05); }
}

/* ========== CARDS ========== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  border: var(--border);
  box-shadow: var(--shadow-hard);
  margin-bottom: 20px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px var(--ink);
  background: linear-gradient(135deg, var(--white) 0%, rgba(255, 248, 240, 0.5) 100%);
}

.card h2 {
  font-family: 'Titan One', cursive;
  font-size: 1.3rem;
  margin-bottom: 16px;
  color: var(--ink);
}

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  color: var(--gray);
  font-weight: 700;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-block;
  padding: 14px 28px;
  border: var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.12s ease;
  text-decoration: none;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-hard-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px var(--ink);
  filter: saturate(1.2) brightness(1.05);
  animation: btnPulse 0.6s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { transform: translate(-2px, -2px) scale(1); }
  50% { transform: translate(-2px, -2px) scale(1.02); }
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0px var(--ink);
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
}

.btn-secondary {
  background: var(--mint);
  color: var(--ink);
}

.btn-success {
  background: var(--mint);
  color: var(--ink);
}

.btn-danger {
  background: var(--coral);
  color: var(--white);
}

.btn-warning {
  background: var(--yellow);
  color: var(--ink);
}

.btn-outline {
  background: var(--white);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--yellow);
}

.btn-lg {
  padding: 18px 44px;
  font-size: 1.15rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  box-shadow: 2px 2px 0px var(--ink);
}

.btn-block {
  display: block;
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-hard-sm) !important;
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  border: var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  transition: all 0.15s ease;
  outline: none;
  background: var(--white);
  box-shadow: inset 0 2px 0 rgba(0,0,0,0.04);
}

.form-control:focus {
  box-shadow: var(--shadow-hard-sm);
  transform: translate(-1px, -1px);
  border-color: var(--blue);
}

.form-control::placeholder {
  color: var(--gray-light);
  font-weight: 500;
}

/* ========== ROLE SELECTION (LANDING) ========== */
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
}

.role-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 50px 28px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-lg);
  position: relative;
  overflow: hidden;
}

.role-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
}

.role-card:first-child::before {
  background: var(--coral);
}

.role-card:last-child::before {
  background: var(--blue);
}

.role-card:hover {
  transform: translate(-4px, -4px) rotate(-1deg);
  box-shadow: 10px 10px 0px var(--ink);
  background: linear-gradient(135deg, var(--white) 0%, rgba(255, 215, 64, 0.08) 100%);
}

.role-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(61, 90, 254, 0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.role-card:hover::after {
  opacity: 1;
}

.role-card:active {
  transform: translate(0px, 0px);
  box-shadow: 4px 4px 0px var(--ink);
}

.role-card .icon {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
  transition: transform 0.2s ease;
}

.role-card:hover .icon {
  transform: scale(1.15) rotate(-6deg);
}

.role-card h2 {
  font-family: 'Titan One', cursive;
  font-size: 1.6rem;
  margin-bottom: 6px;
  color: var(--ink);
}

.role-card p {
  color: var(--gray);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ========== SCREENS ========== */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: screenPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes screenPop {
  from { opacity: 0; transform: scale(0.95) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 2px solid var(--ink);
}

.badge-sequence {
  background: var(--yellow);
  color: var(--ink);
}

.badge-logic {
  background: var(--mint);
  color: var(--ink);
}

/* ========== COMPETITION CODE ========== */
.code-display {
  background: var(--ink);
  color: var(--yellow);
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 12px;
  text-align: center;
  padding: 22px;
  border-radius: var(--radius);
  margin: 16px 0;
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-lg);
  position: relative;
}

.code-display::after {
  content: 'CODIGO';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--coral);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
  letter-spacing: 2px;
}

/* ========== GROUPS LIST ========== */
.groups-list {
  list-style: none;
}

.groups-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-weight: 600;
  border: 2px solid var(--ink);
  transition: all 0.12s ease;
}

.groups-list li:hover {
  background: var(--yellow-pale);
  transform: translateX(4px);
}

.groups-list .score {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--blue);
  background: var(--white);
  padding: 2px 12px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
}

/* ========== QUESTION DISPLAY ========== */
.question-box {
  background: var(--ink);
  color: var(--cream);
  padding: 36px;
  border-radius: var(--radius);
  text-align: center;
  margin: 20px 0;
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-lg);
  position: relative;
  overflow: hidden;
}

/* Decorative corner marks */
.question-box::before,
.question-box::after {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid var(--yellow);
  opacity: 0.3;
}

.question-box::before {
  top: 12px;
  left: 12px;
  border-right: none;
  border-bottom: none;
}

.question-box::after {
  bottom: 12px;
  right: 12px;
  border-left: none;
  border-top: none;
}

.question-box .question-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--yellow);
  margin-bottom: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.question-box .question-text {
  font-family: 'Titan One', cursive;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.5;
  position: relative;
  z-index: 1;
  color: var(--white);
}

.question-box .question-type {
  margin-top: 18px;
}

.question-box .question-type .badge {
  border-color: rgba(255,255,255,0.3);
}

.question-box .question-points {
  margin-top: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--yellow);
}

/* ========== ANSWER INPUT (STUDENT) ========== */
.answer-section {
  text-align: center;
  margin: 28px 0;
}

.answer-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  padding: 18px;
  width: 100%;
  max-width: 400px;
  border: var(--border-thick);
  border-radius: var(--radius);
  outline: none;
  transition: all 0.15s ease;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-hard);
}

.answer-input:focus {
  box-shadow: 6px 6px 0px var(--blue);
  border-color: var(--blue);
}

.answer-input::placeholder {
  color: var(--gray-light);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 1.2rem;
}

/* ========== FEEDBACK ========== */
.feedback {
  text-align: center;
  padding: 24px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 1.2rem;
  font-weight: 700;
  border: var(--border);
  box-shadow: var(--shadow-hard);
}

.feedback-correct {
  background: var(--mint-pale);
  color: #0A5C36;
  border-color: var(--ink);
}

.feedback-incorrect {
  background: #FFE0E0;
  color: #8B1A1A;
  border-color: var(--ink);
}

.feedback-waiting {
  background: var(--yellow-pale);
  color: #6B5900;
  border-color: var(--ink);
}

/* ========== WAITING SCREEN ========== */
.waiting {
  text-align: center;
  padding: 60px 20px;
}

.waiting .spinner {
  width: 60px;
  height: 60px;
  border: var(--border-thick);
  border-radius: 50%;
  margin: 0 auto 24px;
  position: relative;
  background: var(--yellow);
  animation: spinnerBounce 1.2s ease-in-out infinite;
}

.waiting .spinner::before {
  content: '?';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Titan One', cursive;
  font-size: 1.5rem;
  color: var(--ink);
  animation: spinnerSpin 1.2s ease-in-out infinite;
}

@keyframes spinnerBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes spinnerSpin {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}

.waiting h2 {
  font-family: 'Titan One', cursive;
  color: var(--ink-soft);
  font-size: 1.4rem;
}

.waiting p {
  margin-top: 8px;
  color: var(--gray);
  font-weight: 600;
}

/* ========== SCOREBOARD ========== */
.scoreboard-container {
  padding: 40px;
  min-height: 100vh;
  background: var(--ink);
  color: var(--cream);
  position: relative;
  overflow: hidden;
}

/* Scoreboard grid pattern */
.scoreboard-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Corner decorations */
.scoreboard-container::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border: 2px solid rgba(255, 215, 64, 0.1);
  border-radius: var(--radius);
  pointer-events: none;
}

.scoreboard-header {
  text-align: center;
  margin-bottom: 50px;
  position: relative;
  z-index: 1;
}

.scoreboard-header h1 {
  font-family: 'Titan One', cursive;
  font-size: 3.2rem;
  color: var(--yellow);
  text-shadow: 4px 4px 0 rgba(0,0,0,0.4);
  letter-spacing: -1px;
}

.scoreboard-header .question-info {
  font-family: 'JetBrains Mono', monospace;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1rem;
  margin-top: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.score-row {
  display: flex;
  align-items: center;
  padding: 18px 28px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.06);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: rowSlam 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
  z-index: 1;
}

@keyframes rowSlam {
  from {
    opacity: 0;
    transform: translateX(-60px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.score-row.rank-1 {
  background: rgba(255, 215, 64, 0.12);
  border: 3px solid var(--yellow);
  box-shadow: 0 0 40px rgba(255, 215, 64, 0.15), inset 0 0 30px rgba(255, 215, 64, 0.05);
}

.score-row.rank-2 {
  background: rgba(200, 200, 210, 0.08);
  border: 3px solid rgba(200, 200, 210, 0.3);
}

.score-row.rank-3 {
  background: rgba(255, 171, 145, 0.08);
  border: 3px solid rgba(255, 171, 145, 0.25);
}

.score-row .rank {
  font-family: 'Titan One', cursive;
  font-size: 2rem;
  width: 60px;
  text-align: center;
  line-height: 1;
}

.rank-1 .rank { color: var(--yellow); text-shadow: 2px 2px 0 rgba(0,0,0,0.3); }
.rank-2 .rank { color: #C8C8D0; }
.rank-3 .rank { color: var(--peach); }

.score-row .team-name {
  flex: 1;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-left: 16px;
  color: var(--cream);
}

.score-row .team-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  min-width: 100px;
  text-align: right;
  color: var(--yellow);
}

.score-bar-bg {
  flex: 1;
  height: 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin: 0 24px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

.score-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rank-1 .score-bar { background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.rank-2 .score-bar { background: #C8C8D0; }
.rank-3 .score-bar { background: var(--peach); }
.score-bar { background: var(--blue-light); }

/* ========== TEACHER: QUESTION LIST ========== */
.question-list {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

.question-list::-webkit-scrollbar {
  width: 8px;
}

.question-list::-webkit-scrollbar-track {
  background: var(--cream);
  border-radius: 4px;
}

.question-list::-webkit-scrollbar-thumb {
  background: var(--ink);
  border-radius: 4px;
}

.question-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  background: var(--white);
}

.question-item:hover {
  background: var(--yellow-pale);
  transform: translateX(4px);
  box-shadow: var(--shadow-hard-sm);
}

.question-item.used {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  background: var(--cream-dark);
}

.question-item .q-text {
  flex: 1;
  font-size: 0.88rem;
  margin-right: 10px;
  font-weight: 600;
}

.question-item .q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== TEACHER: ANSWERS PANEL ========== */
.answers-panel {
  margin-top: 15px;
}

.answer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 2px solid transparent;
  animation: answerSlide 0.3s ease-out;
}

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

.answer-row .group-name {
  font-weight: 700;
}

.answer-row .group-answer {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.1rem;
}

.answer-row .answer-correct {
  color: #0A5C36;
  background: var(--mint-pale);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
}

.answer-row .answer-incorrect {
  color: #8B1A1A;
  background: #FFE0E0;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
}

/* ========== STATUS BAR ========== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--white);
  border-radius: var(--radius);
  border: var(--border);
  box-shadow: var(--shadow-hard);
  margin-bottom: 24px;
}

.status-bar .status-item {
  text-align: center;
}

.status-bar .status-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue);
}

.status-bar .status-label {
  font-size: 0.65rem;
  color: var(--gray);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1px;
}

/* ========== ANIMATIONS ========== */
.score-update {
  animation: scoreSlam 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scoreSlam {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); color: var(--mint); }
  100% { transform: scale(1); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== DASHBOARD GRID ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ========== FILTER BUTTONS ========== */
.filter-btn {
  text-transform: uppercase !important;
  font-size: 0.7rem !important;
  letter-spacing: 1px !important;
  padding: 6px 14px !important;
}

.filter-btn.active {
  background: var(--ink) !important;
  color: var(--yellow) !important;
  border-color: var(--ink) !important;
}

/* ========== STUDENT SCORE CARD ========== */
.score-card-student {
  background: var(--yellow);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--ink);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-lg);
  position: relative;
}

.score-card-student::before {
  content: 'PUNTOS';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--coral);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
  letter-spacing: 2px;
}

.score-card-student .score-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-card-student .score-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
}

/* ========== TROPHY SECTION ========== */
.trophy-icon {
  font-size: 5rem;
  display: inline-block;
  animation: trophyDance 1s ease-in-out infinite;
}

@keyframes trophyDance {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-10deg); }
  75% { transform: translateY(-12px) rotate(10deg); }
}

/* ========== HINT BOX ========== */
.hint-box {
  background: var(--yellow-pale);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  border: 2px solid var(--ink);
  font-weight: 600;
  margin: 14px 0;
  box-shadow: var(--shadow-hard-sm);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .role-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

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

  .header h1 {
    font-size: 2.2rem;
  }

  .header-icon {
    font-size: 2.8rem;
  }

  .code-display {
    font-size: 2rem;
    letter-spacing: 8px;
  }

  .question-box .question-text {
    font-size: 1.2rem;
  }

  .scoreboard-header h1 {
    font-size: 2.2rem;
  }

  .score-row {
    padding: 14px 18px;
  }

  .score-row .team-name {
    font-size: 1.1rem;
  }

  .score-row .team-score {
    font-size: 1.4rem;
  }

  .score-bar-bg {
    display: none;
  }

  .status-bar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .role-card {
    padding: 35px 20px 30px;
  }

  .btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
  }

  .geo-shape {
    opacity: 0.5;
    transform: scale(0.6);
  }

  .answer-input {
    font-size: 1.4rem;
  }
}

@media (max-width: 400px) {
  .container, .container-wide {
    padding: 14px;
  }

  .card {
    padding: 20px;
  }

  .header h1 {
    font-size: 1.8rem;
  }
}

/* ========== ENHANCED MICRO-INTERACTIONS ========== */
.question-box {
  animation: questionReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes questionReveal {
  0% {
    opacity: 0;
    transform: scale(0.85) rotateX(20deg);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateX(0deg);
    filter: blur(0);
  }
}

.answer-input:focus {
  animation: inputFocus 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes inputFocus {
  0% { transform: translate(-1px, -1px) scale(1); }
  50% { transform: translate(-1px, -1px) scale(1.03); }
  100% { transform: translate(-1px, -1px) scale(1); }
}

/* Floating particles effect */
.bg-geo::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(255, 82, 82, 0.03) 2px, transparent 2px),
    radial-gradient(circle at 85% 75%, rgba(61, 90, 254, 0.03) 2px, transparent 2px),
    radial-gradient(circle at 45% 85%, rgba(0, 229, 160, 0.03) 2px, transparent 2px),
    radial-gradient(circle at 75% 15%, rgba(255, 215, 64, 0.03) 2px, transparent 2px);
  background-size: 200px 200px;
  animation: particlesFloat 30s linear infinite;
}

@keyframes particlesFloat {
  0% { background-position: 0 0, 100px 100px, 50px 150px, 150px 50px; }
  100% { background-position: 200px 200px, 300px 300px, 250px 350px, 350px 250px; }
}

/* Enhanced button states */
.btn-primary:hover {
  background: linear-gradient(135deg, var(--blue) 0%, var(--violet) 100%);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--mint) 0%, #00C987 100%);
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--coral) 0%, #FF1744 100%);
}

.btn-warning:hover {
  background: linear-gradient(135deg, var(--yellow) 0%, #FFC400 100%);
}

/* Staggered entrance animations */
.screen.active > * {
  animation: staggerIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.screen.active > *:nth-child(1) { animation-delay: 0.05s; }
.screen.active > *:nth-child(2) { animation-delay: 0.1s; }
.screen.active > *:nth-child(3) { animation-delay: 0.15s; }
.screen.active > *:nth-child(4) { animation-delay: 0.2s; }
.screen.active > *:nth-child(5) { animation-delay: 0.25s; }

@keyframes staggerIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Enhanced geometric shapes animation */
.geo-circle {
  animation: geoFloat 12s ease-in-out infinite, geoGlow 3s ease-in-out infinite;
}

@keyframes geoGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 215, 64, 0.3)); }
  50% { filter: drop-shadow(0 0 16px rgba(255, 215, 64, 0.6)); }
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
  border-radius: 6px;
  border: 2px solid var(--ink);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--coral) 0%, var(--pink) 100%);
  border-radius: 6px;
  border: 2px solid var(--ink);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--blue) 0%, var(--violet) 100%);
}

/* Interactive cursor effects */
.btn, .role-card, .question-item {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><circle cx="12" cy="12" r="10" fill="%233D5AFE" stroke="%230D0D0D" stroke-width="2.5"/><circle cx="12" cy="12" r="4" fill="%23FFFFFF"/></svg>'), pointer;
}

/* ========== RESPONSIVE IMPROVEMENTS ========== */

/* Tablet pequeña / móvil horizontal */
@media (max-width: 600px) {
  .header h1 {
    font-size: 2rem;
    text-shadow: 2px 2px 0 var(--yellow);
  }

  .score-card-student .score-value {
    font-size: 2.8rem;
  }

  .code-display {
    font-size: 1.6rem;
    letter-spacing: 6px;
    padding: 16px;
  }

  footer {
    font-size: 10px !important;
    padding: 6px 0 !important;
  }

  .question-box {
    padding: 24px 18px;
  }

  .question-box .question-text {
    font-size: 1.15rem;
  }

  .trophy-icon {
    font-size: 3.5rem;
  }

  /* Reducir intensidad de animaciones en móvil para mejor performance */
  .bg-geo::after {
    animation: none;
  }

  .geo-glow {
    animation: geoFloat 12s ease-in-out infinite;
  }

  .btn:hover {
    animation: none;
  }
}

/* Móvil muy pequeño */
@media (max-width: 400px) {
  footer {
    font-size: 9px !important;
    padding: 5px 0 !important;
  }

  .role-card .icon {
    font-size: 3rem;
  }

  .score-row .rank {
    font-size: 1.4rem;
    width: 45px;
  }
}

/* Modo reducción de movimiento (accesibilidad) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .geo-shape {
    animation: none !important;
  }

  .bg-geo::after {
    animation: none !important;
  }
}

/* Modo alto contraste */
@media (prefers-contrast: high) {
  :root {
    --shadow-hard: 6px 6px 0px var(--ink);
    --shadow-hard-sm: 4px 4px 0px var(--ink);
    --shadow-hard-lg: 8px 8px 0px var(--ink);
    --border: 4px solid var(--ink);
    --border-thick: 5px solid var(--ink);
  }
}

/* Orientación landscape en móviles */
@media (max-width: 900px) and (orientation: landscape) {
  .header {
    padding: 20px 20px 15px;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .header-icon {
    font-size: 2rem;
  }

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

  .role-card {
    padding: 20px 15px;
  }

  .role-card .icon {
    font-size: 2.5rem;
  }

  .role-card h2 {
    font-size: 1.2rem;
  }
}

/* ========== UTILITIES ========== */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   FRONTEND DESIGN SKILL — ELEVATED MOMENTS
   Fixing broken references, high-impact motion,
   and unforgettable key interaction points.
   ============================================ */

/* ─── BG-ANIMATED: Páginas internas ─── */
/* Símbolos matemáticos que flotan suavemente, misma
   paleta que index pero con identidad propia.       */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--cream);
  background-image:
    radial-gradient(circle at 15% 80%, rgba(255, 215, 64, 0.13) 0%, transparent 38%),
    radial-gradient(circle at 85% 18%, rgba(61, 90, 254, 0.06) 0%, transparent 35%),
    radial-gradient(circle at 52% 52%, rgba(255, 64, 129, 0.04) 0%, transparent 45%);
}

.bg-animated::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--ink) 0.8px, transparent 0.8px);
  background-size: 28px 28px;
  opacity: 0.05;
  mix-blend-mode: multiply;
}

.bg-animated .shape {
  position: absolute;
  font-family: 'Titan One', cursive;
  color: var(--ink);
  user-select: none;
  pointer-events: none;
  line-height: 1;
  opacity: 0;
}

.bg-animated .shape:nth-child(1) {
  left: 7%;
  top: 55%;
  animation: mathSymDrift 22s ease-in-out 0s infinite;
}
.bg-animated .shape:nth-child(1)::before {
  content: '÷';
  font-size: 5rem;
  display: block;
}

.bg-animated .shape:nth-child(2) {
  left: 78%;
  top: 22%;
  animation: mathSymDrift 20s ease-in-out 6s infinite;
}
.bg-animated .shape:nth-child(2)::before {
  content: 'Σ';
  font-size: 7rem;
  display: block;
}

.bg-animated .shape:nth-child(3) {
  left: 44%;
  top: 72%;
  animation: mathSymDrift 18s ease-in-out 12s infinite;
}
.bg-animated .shape:nth-child(3)::before {
  content: '×';
  font-size: 5.5rem;
  display: block;
}

.bg-animated .shape:nth-child(4) {
  left: 20%;
  top: 10%;
  animation: mathSymDrift 24s ease-in-out 3s infinite;
}
.bg-animated .shape:nth-child(4)::before {
  content: 'π';
  font-size: 6rem;
  display: block;
}

@keyframes mathSymDrift {
  0%   { opacity: 0; transform: translateY(30px) rotate(-8deg) scale(0.85); }
  12%  { opacity: 0.055; }
  88%  { opacity: 0.055; }
  100% { opacity: 0;  transform: translateY(-60px) rotate(12deg) scale(1.1); }
}

/* Reducir motion en móvil */
@media (max-width: 600px) {
  .bg-animated .shape { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-animated .shape { animation: none !important; }
}

/* ─── SCOREBOARD: CRT Scanlines + grid (override) ─── */
/* El scoreboard es el momento más cinematográfico:
   añadimos líneas de CRT retro-arcade sobre el fondo. */
.scoreboard-container::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 3px,
      rgba(0, 0, 0, 0.14) 3px,
      rgba(0, 0, 0, 0.14) 4px
    ),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 4px, 40px 40px, 40px 40px;
}

/* ─── SCOREBOARD: Rank-1 — Aura pulsante ─── */
/* El primer lugar merece un momento UNFORGETTABLE.   */
.score-row.rank-1 {
  animation:
    rowSlam 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    rankOneAura 3s ease-in-out 0.5s infinite;
}

@keyframes rankOneAura {
  0%, 100% {
    box-shadow:
      0 0 24px rgba(255, 215, 64, 0.18),
      inset 0 0 20px rgba(255, 215, 64, 0.05);
    border-color: var(--yellow);
  }
  50% {
    box-shadow:
      0 0 60px rgba(255, 215, 64, 0.42),
      inset 0 0 40px rgba(255, 215, 64, 0.12);
    border-color: #FFE57F;
  }
}

/* Barra neón para el líder */
.rank-1 .score-bar {
  background: linear-gradient(90deg, var(--yellow) 0%, #FFEE80 100%);
  box-shadow: 0 0 16px rgba(255, 215, 64, 0.9), 0 0 40px rgba(255, 215, 64, 0.4);
  animation: neonBarPulse 2s ease-in-out infinite;
}

@keyframes neonBarPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 215, 64, 0.7); }
  50%       { box-shadow: 0 0 30px rgba(255, 215, 64, 1), 0 0 60px rgba(255, 215, 64, 0.5); }
}

/* Score número con neón */
.score-row.rank-1 .team-score {
  animation: scoreNeon 2.5s ease-in-out infinite;
}

@keyframes scoreNeon {
  0%, 100% { text-shadow: 0 0 10px rgba(255, 215, 64, 0.6); }
  50%       { text-shadow: 0 0 28px rgba(255, 215, 64, 1), 0 0 50px rgba(255, 215, 64, 0.6); }
}

/* Hover sutil en filas no-líderes */
.score-row:not(.rank-1):hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(5px);
  transition: all 0.2s ease;
}

/* ─── QUESTION REVEAL: Spotlight flash ─── */
/* Override: más drama — como si un foco cayera
   sobre la pregunta en un game show.              */
@keyframes questionReveal {
  0% {
    opacity: 0;
    transform: scale(0.88) rotateX(18deg);
    filter: blur(12px) brightness(2.8);
    box-shadow: 0 0 90px rgba(255, 215, 64, 0.95), var(--shadow-hard-lg);
  }
  45% {
    filter: blur(0) brightness(1.12);
    box-shadow: 0 0 32px rgba(255, 215, 64, 0.25), var(--shadow-hard-lg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateX(0deg);
    filter: blur(0) brightness(1);
    box-shadow: var(--shadow-hard-lg);
  }
}

/* ─── FEEDBACK: Correcto/Incorrecto — animaciones dramáticas ─── */
/* El momento de verdad: correcto explota, incorrecto sacude.    */
.feedback-correct {
  animation: correctEntry 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes correctEntry {
  0%   { transform: scale(0.72) translateY(12px); opacity: 0; }
  55%  { transform: scale(1.06) translateY(-4px); opacity: 1; }
  78%  { transform: scale(0.98) translateY(0); }
  100% { transform: scale(1)    translateY(0); opacity: 1; }
}

.feedback-incorrect {
  animation: incorrectShake 0.55s ease-out forwards;
}

@keyframes incorrectShake {
  0%   { transform: translateX(0); opacity: 0; }
  8%   { opacity: 1; }
  20%  { transform: translateX(-13px); }
  35%  { transform: translateX(13px); }
  50%  { transform: translateX(-9px); }
  65%  { transform: translateX(9px); }
  80%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* ─── TROPHY: Glow glorioso ─── */
/* Override: añadir glow que pulsa junto al baile. */
.trophy-icon {
  animation: trophyDance 1s ease-in-out infinite, trophyGlow 2s ease-in-out infinite;
}

@keyframes trophyGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 64, 0.5)); }
  50%       { filter: drop-shadow(0 0 32px rgba(255, 215, 64, 0.95)); }
}

/* ─── CODE DISPLAY: Latido de neón ─── */
/* El código de competencia late como un corazón
   para capturar la atención de los estudiantes. */
.code-display {
  animation: codeHeartbeat 4s ease-in-out infinite;
}

@keyframes codeHeartbeat {
  0%, 88%, 100% { box-shadow: var(--shadow-hard-lg); }
  5%             { box-shadow: var(--shadow-hard-lg), 0 0 28px rgba(255, 215, 64, 0.55); }
  10%            { box-shadow: var(--shadow-hard-lg); }
  18%            { box-shadow: var(--shadow-hard-lg), 0 0 48px rgba(255, 215, 64, 0.8); }
  24%            { box-shadow: var(--shadow-hard-lg); }
}

/* ─── WAITING SPINNER: Aura de anticipación ─── */
.waiting .spinner {
  box-shadow: var(--shadow-hard), 0 0 28px rgba(255, 215, 64, 0.4);
}

/* ─── ROLE CARD: Stripe crece en hover ─── */
.role-card::before {
  transition: height 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.role-card:hover::before {
  height: 14px;
}

/* ─── SCORE UPDATE: Pulso en la tarjeta del estudiante ─── */
.score-card-student.score-update {
  animation: scoreCardPulse 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scoreCardPulse {
  0%   { transform: scale(1);    background: var(--yellow); }
  30%  { transform: scale(1.09); background: var(--mint);
         box-shadow: 8px 8px 0 var(--ink), 0 0 34px rgba(0, 229, 160, 0.55); }
  65%  { transform: scale(0.97); }
  100% { transform: scale(1);    background: var(--yellow); }
}
