/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #58CC02;
  --primary-dark: #46a302;
  --primary-light: #7ee038;
  --secondary: #1CB0F6;
  --secondary-dark: #1899d6;
  --warning: #FFC800;
  --danger: #FF4B4B;
  --danger-dark: #ea2b2b;
  --success: #58CC02;
  --bg: #f7f7f7;
  --surface: #ffffff;
  --text: #3c3c3c;
  --text-light: #777777;
  --text-dark: #1a1a1a;
  --border: #e5e5e5;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ===== LOADING SCREEN ===== */
#screen-loading {
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #58CC02 0%, #46a302 100%);
}

.loading-container {
  text-align: center;
  color: white;
}

.loading-logo {
  font-size: 72px;
  margin-bottom: 16px;
  animation: bounce 1s ease infinite;
}

.loading-title {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 8px;
}

.loading-subtitle {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 32px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ===== AUTH SCREEN ===== */
#screen-auth {
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, #58CC02 0%, #46a302 40%, var(--bg) 40%);
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  color: white;
  margin-bottom: 32px;
}

.auth-logo {
  font-size: 56px;
  margin-bottom: 8px;
}

.auth-header h1 {
  font-size: 32px;
  font-weight: 900;
}

.auth-header p {
  font-size: 16px;
  opacity: 0.9;
}

.auth-tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  border: 2px solid var(--border);
  border-bottom: none;
}

.auth-tab {
  flex: 1;
  padding: 14px;
  border: none;
  background: var(--surface);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  color: var(--primary);
  background: white;
  box-shadow: inset 0 -3px 0 var(--primary);
}

.auth-form {
  display: none;
  background: var(--surface);
  padding: 24px;
  border: 2px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.auth-form.active {
  display: block;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary);
  background: white;
}

.auth-error {
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 0 var(--primary-dark);
}

.btn-primary:active {
  box-shadow: 0 2px 0 var(--primary-dark);
  transform: translateY(2px);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
  box-shadow: 0 4px 0 var(--secondary-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 0 var(--danger-dark);
}

.btn-danger:active {
  box-shadow: 0 2px 0 var(--danger-dark);
  transform: translateY(2px);
}

.btn-full {
  width: 100%;
}

.btn-large {
  padding: 18px 32px;
  font-size: 18px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

.btn-back {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.btn-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-light);
  line-height: 1;
}

/* ===== HOME SCREEN ===== */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  font-size: 28px;
}

.header-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 20px;
}

.stat-icon {
  font-size: 16px;
}

.stat-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.home-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(32px + var(--safe-bottom));
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

/* ===== STATS CARD ===== */
.stats-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 2px solid var(--border);
}

.stats-row {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

.xp-bar-container {
  position: relative;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  transition: width 0.5s ease;
  width: 0%;
}

.xp-bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
}

/* ===== SESSIONS MAP ===== */
.sessions-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-bottom: 32px;
}

.session-node {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 360px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}

.session-node:active {
  transform: scale(0.97);
}

.session-node.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.session-node.locked:active {
  transform: none;
}

.session-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
  border: 4px solid;
  position: relative;
  transition: all 0.3s;
}

.session-circle.available {
  background: var(--primary);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 0 var(--primary-dark);
  animation: pulse-glow 2s ease-in-out infinite;
}

.session-circle.completed {
  background: var(--warning);
  border-color: #e6b400;
  box-shadow: 0 4px 0 #e6b400;
}

.session-circle.locked {
  background: var(--border);
  border-color: #ccc;
  box-shadow: 0 4px 0 #ccc;
  filter: grayscale(1);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 0 var(--primary-dark), 0 0 0 0 rgba(88, 204, 2, 0.3); }
  50% { box-shadow: 0 4px 0 var(--primary-dark), 0 0 0 8px rgba(88, 204, 2, 0); }
}

.session-info {
  flex: 1;
}

.session-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.session-desc {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 600;
}

.session-stars-display {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}

.session-stars-display .star {
  font-size: 16px;
}

.session-connector {
  width: 4px;
  height: 24px;
  background: var(--border);
  border-radius: 2px;
}

.session-connector.completed {
  background: var(--warning);
}

/* ===== SESSION INTRO ===== */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  height: var(--header-height);
}

.session-title {
  font-size: 16px;
  font-weight: 700;
}

.session-intro-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  max-width: 450px;
  margin: 0 auto;
  width: 100%;
}

.session-intro-icon {
  font-size: 80px;
  margin-bottom: 24px;
  animation: bounce 1.5s ease infinite;
}

.session-intro-content h2 {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.session-intro-content p {
  font-size: 16px;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 32px;
}

.session-intro-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
}

.intro-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ===== GAME SCREEN ===== */
.progress-bar-container {
  flex: 1;
  height: 16px;
  background: var(--border);
  border-radius: 8px;
  margin: 0 16px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  transition: width 0.4s ease;
  width: 0%;
}

.question-counter {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-light);
  min-width: 40px;
  text-align: right;
}

.game-content {
  flex: 1;
  padding: 20px 16px;
  padding-bottom: 200px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.text-passage {
  background: var(--surface);
  border: 2px solid var(--border);
  border-left: 5px solid var(--secondary);
  border-radius: var(--radius-xs);
  padding: 16px;
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}

.question-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  line-height: 1.4;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.4;
}

.option-btn:active {
  transform: scale(0.98);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  color: var(--text-light);
}

.option-btn.selected {
  border-color: var(--secondary);
  background: #e8f4fd;
}

.option-btn.selected .option-letter {
  background: var(--secondary);
  border-color: var(--secondary);
  color: white;
}

.option-btn.correct {
  border-color: var(--success);
  background: #e8f8e0;
  animation: correct-shake 0.4s ease;
}

.option-btn.correct .option-letter {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.option-btn.wrong {
  border-color: var(--danger);
  background: #fde8e8;
  animation: wrong-shake 0.4s ease;
}

.option-btn.wrong .option-letter {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.option-btn.disabled {
  pointer-events: none;
  opacity: 0.7;
}

@keyframes correct-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ===== FEEDBACK BAR ===== */
.feedback-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 200;
}

.feedback-bar.show {
  transform: translateY(0);
}

.feedback-bar.correct {
  background: #d4edda;
  border-top: 3px solid var(--success);
}

.feedback-bar.wrong {
  background: #f8d7da;
  border-top: 3px solid var(--danger);
}

.feedback-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.feedback-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.feedback-bar.correct .feedback-title {
  color: #155724;
}

.feedback-bar.wrong .feedback-title {
  color: #721c24;
}

.feedback-explanation {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}

.feedback-bar .btn {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
}

.feedback-bar.correct .btn {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 0 var(--primary-dark);
}

.feedback-bar.wrong .btn {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 0 var(--danger-dark);
}

/* ===== RESULT SCREEN ===== */
#screen-result {
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, var(--bg) 0%, #e8f8e0 100%);
  position: relative;
  overflow: hidden;
}

.result-container {
  text-align: center;
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  z-index: 1;
}

.result-stars {
  font-size: 48px;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.result-stars .star {
  display: inline-block;
  opacity: 0;
  transform: scale(0) rotate(-180deg);
  animation: star-pop 0.5s ease forwards;
}

.result-stars .star:nth-child(2) { animation-delay: 0.2s; }
.result-stars .star:nth-child(3) { animation-delay: 0.4s; }

@keyframes star-pop {
  0% { opacity: 0; transform: scale(0) rotate(-180deg); }
  60% { opacity: 1; transform: scale(1.3) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.result-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.result-subtitle {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 32px;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 24px;
}

.result-stat-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--primary);
}

.result-stat-value.result-xp {
  color: var(--warning);
}

.result-stat-label {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

.result-accuracy-bar {
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 40px;
}

.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 6px;
  transition: width 1s ease;
  width: 0%;
}

/* ===== CONFETTI ===== */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: flex-end;
  padding: 16px;
}

.modal.active {
  display: flex;
  animation: fade-in 0.2s ease;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 450px;
  max-height: 80dvh;
  overflow-y: auto;
  animation: slide-up 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 800;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ===== PROFILE ===== */
.profile-info {
  text-align: center;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 36px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.profile-info h3 {
  font-size: 22px;
  font-weight: 800;
}

.profile-info p {
  font-size: 14px;
  color: var(--text-light);
}

.profile-stats {
  display: flex;
  justify-content: space-around;
  padding: 20px 0;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.profile-stat {
  text-align: center;
}

.profile-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
}

.profile-stat-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .auth-container {
    max-width: 420px;
  }

  .game-content {
    padding: 32px 24px;
    padding-bottom: 220px;
  }

  .text-passage {
    font-size: 16px;
    padding: 20px;
  }

  .question-text {
    font-size: 18px;
  }

  .option-btn {
    font-size: 16px;
    padding: 18px;
  }

  .modal-content {
    border-radius: var(--radius);
    max-width: 480px;
  }

  .modal {
    align-items: center;
  }
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fade-in 0.3s ease;
}

/* ===== MASCOT ===== */
.mascot-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.mascot-container.mascot-correct {
  background: #e8f8e0;
  border-color: var(--success);
}

.mascot-container.mascot-streak {
  background: linear-gradient(135deg, #fff8e0, #ffe8d0);
  border-color: var(--warning);
}

.mascot-container.mascot-wrong {
  background: #fde8e8;
  border-color: var(--danger);
}

.mascot-container.mascot-encourage {
  background: #e8f0fd;
  border-color: var(--secondary);
}

.mascot-character {
  font-size: 48px;
  line-height: 1;
  flex-shrink: 0;
}

.mascot-bubble {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  padding-top: 8px;
}

/* Mascot animations */
.mascot-bounce {
  animation: mascot-bounce 0.6s ease;
}

.mascot-celebrate {
  animation: mascot-celebrate 0.6s ease;
}

.mascot-shake {
  animation: mascot-sad-shake 0.5s ease;
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-4px); }
}

@keyframes mascot-celebrate {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.2) rotate(-10deg); }
  50% { transform: scale(1.3) rotate(10deg); }
  75% { transform: scale(1.1) rotate(-5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes mascot-sad-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-5deg); }
  40% { transform: translateX(6px) rotate(5deg); }
  60% { transform: translateX(-4px) rotate(-3deg); }
  80% { transform: translateX(4px) rotate(3deg); }
}

/* ===== FEEDBACK MASCOT ===== */
.feedback-mascot {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
}

/* ===== RETRY BUTTON ===== */
.btn-retry {
  margin-top: 8px;
}

.feedback-bar.wrong .btn-retry {
  background: var(--secondary);
  color: white;
  box-shadow: 0 4px 0 var(--secondary-dark);
}

/* ===== STREAK INDICATOR ===== */
.streak-indicator {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: linear-gradient(135deg, #ff9600, #ffc800);
  color: white;
  padding: 8px 20px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 16px;
  z-index: 300;
  box-shadow: 0 4px 15px rgba(255, 150, 0, 0.4);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.streak-indicator.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== RANKING SCREEN ===== */
.ranking-content {
  flex: 1;
  padding: 16px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.ranking-tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}

.ranking-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: var(--surface);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.ranking-tab.active {
  color: white;
  background: var(--primary);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.ranking-item.ranking-top {
  border-color: var(--warning);
  background: #fffdf0;
}

.ranking-item.ranking-me {
  border-color: var(--primary);
  background: #f0fde8;
  box-shadow: 0 0 0 2px rgba(88, 204, 2, 0.2);
}

.ranking-position {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-light);
  min-width: 36px;
  text-align: center;
}

.ranking-item.ranking-top .ranking-position {
  font-size: 24px;
}

.ranking-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--secondary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.ranking-item:nth-child(1) .ranking-avatar { background: #FFD700; }
.ranking-item:nth-child(2) .ranking-avatar { background: #C0C0C0; }
.ranking-item:nth-child(3) .ranking-avatar { background: #CD7F32; }

.ranking-info {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-details {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

.ranking-value {
  font-size: 15px;
  font-weight: 900;
  color: var(--primary);
  white-space: nowrap;
}

.ranking-loading, .ranking-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
}

/* ===== MATCH GAME MODE ===== */
.match-category-badge {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  background: var(--bg);
  padding: 8px 16px;
  border-radius: 20px;
  margin-bottom: 16px;
  display: inline-block;
  width: 100%;
  letter-spacing: 1px;
}

.match-board {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  position: relative;
  min-height: 300px;
}

.match-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

.match-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
}

.match-item {
  padding: 12px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.3;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-item:active {
  transform: scale(0.96);
}

.match-item-left {
  border-left: 4px solid var(--secondary);
}

.match-item-right {
  border-right: 4px solid var(--warning);
}

.match-item.match-selected {
  border-color: var(--secondary);
  background: #e0f2fe;
  box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.25);
  transform: scale(1.03);
}

.match-item.match-correct {
  border-color: var(--success) !important;
  background: #e8f8e0 !important;
  color: var(--primary-dark);
  pointer-events: none;
  opacity: 0.85;
  animation: match-pop 0.3s ease;
}

.match-item.match-wrong {
  border-color: var(--danger) !important;
  background: #fde8e8 !important;
  animation: wrong-shake 0.4s ease;
}

@keyframes match-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.match-line-anim {
  animation: line-draw 0.3s ease;
}

@keyframes line-draw {
  from { opacity: 0; stroke-dasharray: 200; stroke-dashoffset: 200; }
  to { opacity: 1; stroke-dasharray: 200; stroke-dashoffset: 0; }
}

@media (min-width: 768px) {
  .match-item {
    font-size: 15px;
    padding: 14px 12px;
  }

  .match-board {
    gap: 16px;
  }
}
