/* ============================================================
   Edukacyjna Przygoda — Visual Design for Children 7-10
   Research-based: Duolingo-inspired palette, bouncy interactions,
   Nunito+Fredoka fonts, generous sizing, center-focused layout.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&family=Quicksand:wght@500;600;700&display=swap');

/* --- Design tokens --- */
:root {
  /* Primary palette */
  --green: #58CC02;
  --green-dark: #43A301;
  --green-light: #7ED937;
  --blue: #4A90E2;
  --blue-dark: #2E6BC4;
  --blue-light: #7AB3F0;

  /* Accent */
  --orange: #FF9600;
  --orange-dark: #E08600;
  --red: #FF5A5F;
  --red-dark: #D9484C;
  --purple: #9B59F6;
  --yellow: #FFC800;
  --teal: #1CB0C6;
  --pink: #FF6B9D;
  --cyan: #00D4AA;

  /* Lesson card colors */
  --lesson-1: linear-gradient(135deg, #FF6B6B 0%, #EE5A5A 100%);
  --lesson-2: linear-gradient(135deg, #4ECDC4 0%, #44B3AB 100%);
  --lesson-3: linear-gradient(135deg, #A78BFA 0%, #8B5CF6 100%);
  --lesson-4: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  --lesson-5: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  --lesson-6: linear-gradient(135deg, #F472B6 0%, #EC4899 100%);
  --lesson-7: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
  --lesson-8: linear-gradient(135deg, #FB923C 0%, #F97316 100%);

  /* Surfaces */
  --bg: #F0F5FF;
  --bg-warm: #FFF8E7;
  --card: #ffffff;
  --card-hover: #F8FAFF;

  /* Text */
  --ink: #2D3436;
  --muted: #636E72;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --shadow-btn: 0 4px 0;

  /* Typography - Lato by Polish designer, Quicksand for headings */
  --font-display: 'Quicksand', 'Lato', -apple-system, sans-serif;
  --font-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Easing */
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(88,204,2,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 0%, rgba(74,144,226,0.08) 0%, transparent 60%);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #58CC02 0%, #43A301 50%, #2E8B00 100%);
  box-shadow: var(--shadow-md), 0 4px 0 #2E7A00;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
  transition: transform 0.3s var(--bounce);
}

.brand-mark:hover {
  transform: rotate(-8deg) scale(1.1);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
  letter-spacing: 0.3px;
}

.brand-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.nav a {
  color: white;
  text-decoration: none;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  padding: 8px 14px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: 14px;
  transition: background 0.2s, transform 0.15s var(--bounce);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.nav a:hover {
  background: rgba(255,255,255,0.4);
  transform: translateY(-2px);
}

.nav a:active {
  transform: translateY(1px);
}

/* --- Headings --- */
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  margin: 0 0 20px 0;
  color: var(--ink);
}

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin: 24px 0 12px 0;
  color: var(--ink);
}

/* --- Cards --- */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(0,0,0,0.04);
  margin: 12px 0;
  transition: box-shadow 0.2s, transform 0.2s var(--bounce);
}

.cards {
  display: grid;
  gap: 12px;
}

/* --- Buttons (3D, bouncy) --- */
button, .button {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: white;
  background: var(--green);
  border: none;
  border-radius: var(--r-md);
  padding: 14px 28px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  position: relative;
  box-shadow: var(--shadow-btn) var(--green-dark);
  transition: transform 0.12s var(--bounce), box-shadow 0.12s;
  letter-spacing: 0.3px;
}

button:hover, .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--green-dark);
}

button:active, .button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--green-dark);
  transition-duration: 0.06s;
}

.button-secondary {
  background: var(--blue);
  box-shadow: var(--shadow-btn) var(--blue-dark);
}

.button-secondary:hover {
  box-shadow: 0 6px 0 var(--blue-dark);
}

.button-secondary:active {
  box-shadow: 0 1px 0 var(--blue-dark);
}

.button-muted {
  background: #B2BEC3;
  box-shadow: var(--shadow-btn) #8D9CA5;
}

.button-muted:hover {
  box-shadow: 0 6px 0 #8D9CA5;
}

.button-muted:active {
  box-shadow: 0 1px 0 #8D9CA5;
}

.button-sm {
  padding: 8px 14px;
  font-size: 14px;
  min-height: 40px;
  border-radius: var(--r-sm);
  box-shadow: 0 3px 0 var(--green-dark);
}

.button-danger {
  background: var(--red);
  box-shadow: var(--shadow-btn) var(--red-dark);
}

.button-danger:hover {
  box-shadow: 0 6px 0 var(--red-dark);
}

.button-danger:active {
  box-shadow: 0 1px 0 var(--red-dark);
}

/* --- Forms --- */
.form {
  display: grid;
  gap: 14px;
  max-width: 400px;
}

.form label {
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.form input, .form select, .form textarea {
  padding: 14px 16px;
  border: 2px solid #DFE6E9;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 17px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.form input:focus, .form select:focus, .form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(74,144,226,0.15);
  outline: none;
}

select {
  padding: 12px 14px;
  border: 2px solid #DFE6E9;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 16px;
  background: white;
}

/* --- Auth pages (login / register) --- */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.auth-page .brand-mark-large {
  width: 100px;
  height: 100px;
  margin-bottom: 12px;
  animation: mascot-bounce 2s ease-in-out infinite;
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-page h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.auth-page .auth-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 24px;
}

.auth-page .form {
  width: 100%;
  max-width: 360px;
}

.auth-page .auth-footer {
  margin-top: 20px;
  font-size: 15px;
}

.auth-page .auth-footer a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

/* --- Lesson progress banner --- */
.lesson-progress-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, var(--blue-light) 0%, var(--blue) 100%);
  color: white;
  padding: 12px 20px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.lesson-progress-banner strong {
  font-family: var(--font-display);
  font-size: 16px;
}

.lesson-progress-banner .progress-indicator {
  background: rgba(255,255,255,0.25);
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
}

/* --- Study: exercise card --- */
.exercise-card {
  text-align: center;
  padding: 32px;
}

.exercise-card .prompt {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.exercise-card .word {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: var(--ink);
  margin: 12px 0 20px;
  line-height: 1.2;
}

.exercise-card .form {
  max-width: 100%;
  margin: 0 auto;
}

.exercise-card .form input[type="text"] {
  text-align: center;
  font-size: 20px;
  padding: 16px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.exercise-card button[type="submit"] {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  font-size: 19px;
  padding: 16px;
}

/* --- Multiple choice options --- */
.options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: white;
  padding: 16px 18px;
  border-radius: var(--r-md);
  border: 3px solid #DFE6E9;
  cursor: pointer;
  font-weight: 700;
  font-size: 17px;
  min-height: 56px;
  transition: border-color 0.15s, transform 0.15s var(--bounce), background 0.15s;
}

.option:hover {
  border-color: var(--blue);
  background: #F0F5FF;
  transform: scale(1.02);
}

.option:active {
  transform: scale(0.98);
}

.option:has(input:checked) {
  border-color: var(--blue);
  background: #E8F0FE;
}

.option input[type="radio"] {
  accent-color: var(--blue);
  width: 20px;
  height: 20px;
}

/* --- Cloze --- */
.cloze-sentence {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.5;
  font-weight: 600;
}

.hint {
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
  margin-bottom: 8px;
}

/* --- Exercise type badge --- */
.exercise-type-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 16px;
  border-radius: var(--r-full);
  background: #EEF4FF;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

/* --- Result page --- */
.result-card {
  text-align: center;
  padding: 32px;
}

.result-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
}

.result-icon.ok {
  animation: celebrate 0.6s var(--bounce);
}

.result-icon.bad {
  animation: gentle-shake 0.5s var(--smooth);
}

@keyframes celebrate {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.3); }
  75%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes gentle-shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}

.result-status {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
}

.result-status.ok {
  color: var(--green);
}

.result-status.bad {
  color: var(--red);
}

.result-details {
  display: grid;
  gap: 6px;
  text-align: left;
  max-width: 380px;
  margin: 16px auto 0;
  font-size: 16px;
}

.result-details dt {
  color: var(--muted);
  font-size: 14px;
}

.result-details dd {
  margin: 0 0 8px 0;
  font-weight: 700;
  font-size: 18px;
}

.result-meta {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

/* --- Dashboard stats --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(0,0,0,0.04);
  transition: transform 0.2s var(--bounce);
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 4px;
  display: block;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}

.stat-green { color: var(--green); }
.stat-blue { color: var(--blue); }
.stat-orange { color: var(--orange); }
.stat-purple { color: var(--purple); }

/* Legacy summary-stats (admin, session_summary) */
.summary-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
  min-width: 80px;
}

.stat-correct { color: var(--green); }
.stat-wrong { color: var(--red); }

/* --- Streak --- */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--orange), #FF5A5F);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(255,150,0,0.3);
}

.streak-flame {
  display: inline-block;
  animation: flame-flicker 1.5s ease-in-out infinite;
  transform-origin: bottom center;
}

@keyframes flame-flicker {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  25% { transform: scaleY(1.08) scaleX(0.95); }
  75% { transform: scaleY(1.04) scaleX(0.98); }
}

/* --- Progress bars --- */
.progress-bar {
  background: #E8EDF2;
  border-radius: var(--r-full);
  height: 14px;
  overflow: hidden;
  width: 100%;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--green);
  transition: width 0.5s var(--smooth);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.fill-good { background: var(--green); }
.fill-ok { background: var(--orange); }
.fill-weak { background: var(--red); }

/* --- Lesson cards --- */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.lesson-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(0,0,0,0.04);
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow 0.2s, transform 0.2s var(--bounce);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lesson-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.lesson-card:active {
  transform: translateY(0px);
}

.lesson-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.lesson-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* --- Lesson progress card --- */
.lesson-progress-card {
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}

.lesson-progress-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.lesson-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* --- Last session --- */
.last-session-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 16px;
}

/* --- Session summary --- */
.ai-summary {
  font-size: 17px;
  line-height: 1.7;
  padding: 8px 0;
}

.ai-badge {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.wrong-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.wrong-word {
  background: #FFF0F0;
  color: var(--red);
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: 14px;
  border: 2px solid rgba(255,90,95,0.15);
}

/* --- Tables --- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th {
  text-align: left;
  padding: 12px 14px;
  background: #F0F5FF;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid #E8EDF2;
}

.table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #F0F2F5;
  font-size: 15px;
}

.table tbody tr:hover {
  background: #F8FAFF;
}

/* --- Error --- */
.error {
  color: var(--red);
  font-weight: 700;
  background: #FFF0F0;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 2px solid rgba(255,90,95,0.15);
}

/* --- Confetti (injected via JS) --- */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall 2.5s linear forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* --- Page enter animation --- */
.content {
  animation: page-in 0.35s var(--smooth);
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.content h1 { margin-top: 0; }

/* --- Responsive --- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 12px; }

  .header {
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r-lg);
  }

  .brand-mark { width: 40px; height: 40px; }
  .brand-title { font-size: 18px; }

  .nav {
    justify-content: center;
    gap: 4px;
  }

  .nav a {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 36px;
  }

  h1 { font-size: 22px; }
  h2 { font-size: 18px; }

  .exercise-card .word { font-size: 28px; }
  .exercise-card { padding: 20px; }

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

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-card { padding: 14px 10px; }
  .stat-value { font-size: 28px; }
  .stat-icon { font-size: 24px; }

  .summary-stats { gap: 12px; }

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

  .table { font-size: 14px; }
  .table th, .table td { padding: 8px 10px; }

  button, .button {
    padding: 14px 20px;
    font-size: 16px;
    min-height: 52px;
    width: 100%;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form { max-width: 100%; }

  .form input, .form select {
    padding: 14px;
    font-size: 16px;
  }

  .result-icon { font-size: 48px; }
  .result-status { font-size: 24px; }

  /* Practice cards on mobile - still look nice */
  .practice-choice {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .practice-card {
    min-height: 140px;
    padding: 20px 16px;
  }

  .practice-icon {
    font-size: 44px;
    margin-bottom: 8px;
  }

  .practice-title {
    font-size: 18px;
  }

  .practice-desc {
    font-size: 13px;
  }
}

/* --- Accessibility --- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, .option:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Speaker / TTS button --- */
.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: 0 3px 0 var(--blue-dark);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.speak-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--blue-dark);
}
.speak-btn:active, .speak-btn-active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--blue-dark);
}
.speak-btn-active {
  background: var(--blue-dark);
}

/* --- Practice choice cards (dashboard) --- */
.practice-choice {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.practice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: var(--card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), 0 6px 0 rgba(0,0,0,0.1);
  text-decoration: none;
  color: white;
  transition: transform 0.25s var(--bounce), box-shadow 0.2s ease;
  text-align: center;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}

.practice-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}

.practice-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg), 0 12px 0 rgba(0,0,0,0.08);
}

.practice-card:active {
  transform: translateY(-2px) scale(0.98);
  box-shadow: var(--shadow-md), 0 4px 0 rgba(0,0,0,0.1);
}

/* Main action cards */
.practice-card-all {
  background: linear-gradient(135deg, #58CC02 0%, #43A301 100%);
  box-shadow: var(--shadow-lg), 0 6px 0 #2e7a00;
}
.practice-card-all:hover { box-shadow: var(--shadow-lg), 0 12px 0 #2e7a00; }
.practice-card-all:active { box-shadow: var(--shadow-md), 0 4px 0 #2e7a00; }

.practice-card-difficult {
  background: linear-gradient(135deg, #FF9600 0%, #E08600 100%);
  box-shadow: var(--shadow-lg), 0 6px 0 #c06800;
}
.practice-card-difficult:hover { box-shadow: var(--shadow-lg), 0 12px 0 #c06800; }
.practice-card-difficult:active { box-shadow: var(--shadow-md), 0 4px 0 #c06800; }

/* Lesson cards with vibrant colors */
.practice-card-lesson {
  color: white;
}

.practice-card-lesson:nth-child(3) { background: var(--lesson-1); box-shadow: var(--shadow-lg), 0 6px 0 #cc4444; }
.practice-card-lesson:nth-child(4) { background: var(--lesson-2); box-shadow: var(--shadow-lg), 0 6px 0 #339994; }
.practice-card-lesson:nth-child(5) { background: var(--lesson-3); box-shadow: var(--shadow-lg), 0 6px 0 #7c4ee0; }
.practice-card-lesson:nth-child(6) { background: var(--lesson-4); box-shadow: var(--shadow-lg), 0 6px 0 #d48806; }
.practice-card-lesson:nth-child(7) { background: var(--lesson-5); box-shadow: var(--shadow-lg), 0 6px 0 #059669; }
.practice-card-lesson:nth-child(8) { background: var(--lesson-6); box-shadow: var(--shadow-lg), 0 6px 0 #d53f8c; }
.practice-card-lesson:nth-child(9) { background: var(--lesson-7); box-shadow: var(--shadow-lg), 0 6px 0 #2563eb; }
.practice-card-lesson:nth-child(10) { background: var(--lesson-8); box-shadow: var(--shadow-lg), 0 6px 0 #c2410c; }
.practice-card-lesson:nth-child(n+11) { background: var(--lesson-1); box-shadow: var(--shadow-lg), 0 6px 0 #cc4444; }

.practice-card-lesson .practice-desc,
.practice-card-all .practice-desc,
.practice-card-difficult .practice-desc {
  color: rgba(255,255,255,0.9);
}

.practice-icon {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
  transition: transform 0.3s var(--bounce);
}

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

.practice-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.practice-desc {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
}

.practice-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
  max-width: 200px;
}

.progress-bar-mini {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.3);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill-mini {
  height: 100%;
  border-radius: 5px;
  background: white;
  transition: width 0.4s var(--smooth);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
}

.practice-pct {
  font-size: 14px;
  font-weight: 700;
  color: white;
  min-width: 40px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* --- Stats details (collapsible) --- */
.stats-details {
  margin-bottom: 20px;
}

.stats-details summary {
  cursor: pointer;
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  list-style: none;
}

.stats-details summary::-webkit-details-marker {
  display: none;
}

.stats-details[open] summary {
  border-radius: var(--r-md) var(--r-md) 0 0;
  margin-bottom: 0;
}

.stats-details[open] .stats-grid {
  background: var(--card);
  padding: 16px;
  border-radius: 0 0 var(--r-md) var(--r-md);
  box-shadow: var(--shadow-sm);
}

.last-session-card {
  padding: 16px 20px;
}

/* --- Reward system --- */
/* Motivational message */
.motivational-card {
  text-align: center;
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
  border: 2px solid var(--green);
}

.motivational-msg {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--green-dark);
  white-space: pre-line;
}

/* New achievements notification */
.new-achievements-card {
  background: linear-gradient(135deg, #FFF8E7 0%, #FFECB3 100%);
  border: 2px solid var(--yellow);
}

.new-achievements {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.new-achievement {
  text-align: center;
  animation: pulse 1s ease infinite;
}

.new-achievement-emoji {
  font-size: 48px;
  display: block;
}

.new-achievement-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.reward-announcement {
  text-align: center;
  background: linear-gradient(135deg, #FFF8E7 0%, #FFECB3 100%);
  border: 2px solid var(--yellow);
}

.reward-icon {
  font-size: 48px;
  animation: bounce 0.6s ease infinite alternate;
}

.reward-button {
  background: linear-gradient(135deg, var(--orange) 0%, #FF6B00 100%);
  font-size: 18px;
  padding: 16px 32px;
}

/* Sticker choice page */
.reward-choose-page {
  text-align: center;
}

.reward-subtitle {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 8px;
}

.reward-instruction {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 20px 0;
}

.sticker-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 400px;
  margin: 0 auto;
}

.sticker-form {
  margin: 0;
}

.sticker-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 24px 16px;
  background: var(--card);
  border: 3px solid transparent;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md), 0 4px 0 #e0e0e0;
  cursor: pointer;
  transition: all 0.2s var(--bounce);
}

.sticker-choice:hover {
  transform: translateY(-4px) scale(1.05);
  border-color: var(--yellow);
  box-shadow: var(--shadow-lg), 0 6px 0 #d0d0d0;
}

.sticker-choice:active {
  transform: translateY(0) scale(0.98);
}

.sticker-emoji {
  font-size: 56px;
  margin-bottom: 8px;
}

.sticker-img {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  object-fit: contain;
}

.sticker-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* Claimed page */
.reward-claimed-page {
  text-align: center;
}

.claimed-sticker-display {
  margin: 20px 0;
}

.claimed-emoji {
  font-size: 100px;
  display: inline-block;
  animation: pulse 1s ease infinite;
}

.claimed-img {
  width: 100px;
  height: 100px;
  display: inline-block;
  animation: pulse 1s ease infinite;
  object-fit: contain;
}

.claimed-name {
  font-size: 18px;
  color: var(--muted);
}

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

/* Rewards collection page */
.sticker-count-badge {
  text-align: center;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: white;
  padding: 12px 24px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 20px;
  display: inline-block;
}

.sticker-collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}

.sticker-item {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.sticker-item:hover {
  transform: scale(1.05);
}

.sticker-item-emoji {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.sticker-item-img {
  width: 40px;
  height: 40px;
  display: block;
  margin: 0 auto 8px;
  object-fit: contain;
}

.sticker-item-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.sticker-item-meta {
  font-size: 11px;
  color: var(--muted);
}

.sticker-item-date {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

/* Achievement collection */
.achievement-collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.achievement-item {
  background: linear-gradient(135deg, #FFF8E7 0%, #FFECB3 100%);
  border: 2px solid var(--yellow);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.2s ease;
}

.achievement-item:hover {
  transform: scale(1.05);
}

.achievement-emoji {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.achievement-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink);
}

.achievement-desc {
  font-size: 11px;
  color: var(--muted);
}

.empty-rewards {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

/* Icon selector for admin */
.icon-select-row {
  margin-bottom: 12px;
}

.icon-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.icon-option {
  cursor: pointer;
}

.icon-option input {
  display: none;
}

.icon-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  background: var(--card);
  transition: all 0.15s ease;
}

.icon-option input:checked + span {
  border-color: var(--green);
  background: #E8F5E9;
}

.icon-option:hover span {
  background: var(--card-hover);
}

/* --- Footer --- */
.footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
  padding: 16px 0;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}
.footer span {
  white-space: nowrap;
}

/* ==============================================
   NEW DASHBOARD DESIGN - Clean lesson tiles
   ============================================== */

.dashboard-header {
  text-align: center;
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.dashboard-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
}

/* Lesson grid */
.lesson-grid-new {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* Individual tile */
.lesson-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 12px;
  border-radius: 20px;
  text-decoration: none;
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lesson-tile:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.lesson-tile:active {
  transform: translateY(-2px);
}

.tile-icon {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.tile-content {
  width: 100%;
}

.tile-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
}

.tile-desc {
  font-size: 12px;
  opacity: 0.85;
}

.tile-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.tile-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  overflow: hidden;
}

.tile-progress-fill {
  height: 100%;
  background: white;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.tile-pct {
  font-size: 11px;
  font-weight: 700;
  min-width: 30px;
}

/* Main tile - green */
.lesson-tile-main {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

/* Repeat difficult - orange */
.lesson-tile-repeat {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Color variants for lessons */
.lesson-tile-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.lesson-tile-teal {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}
.lesson-tile-purple {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}
.lesson-tile-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.lesson-tile-green {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}
.lesson-tile-pink {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}
.lesson-tile-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.lesson-tile-orange {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Quick stats bar */
.quick-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}

.quick-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.qs-icon {
  font-size: 24px;
}

.qs-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.qs-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dashboard actions */
.dashboard-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.btn-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.btn-link:hover {
  background: rgba(0,0,0,0.05);
  color: var(--ink);
}

/* Mobile responsive */
@media (max-width: 640px) {
  .lesson-grid-new {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .lesson-tile {
    padding: 16px 10px;
  }

  .tile-icon {
    font-size: 36px;
    margin-bottom: 8px;
  }

  .tile-title {
    font-size: 14px;
  }

  .quick-stats {
    gap: 16px;
    padding: 16px 12px;
  }

  .qs-value {
    font-size: 16px;
  }
}

/* ==============================================
   THEME SETTINGS PAGE
   ============================================== */

.settings-desc {
  color: var(--muted);
  margin-bottom: 20px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.theme-form {
  margin: 0;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px 16px;
  background: var(--card);
  border: 3px solid #e0e0e0;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.2s var(--bounce);
  position: relative;
  min-height: 120px;
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.theme-card-active {
  border-color: var(--green);
  background: linear-gradient(135deg, rgba(88,204,2,0.1) 0%, rgba(88,204,2,0.05) 100%);
}

.theme-emoji {
  font-size: 48px;
  margin-bottom: 8px;
}

.theme-image {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
}

.theme-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.theme-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

/* Theme card preview colors */
.theme-card-default {
  border-bottom: 4px solid #58CC02;
}

.theme-card-spring {
  border-bottom: 4px solid #48bb78;
}

.theme-card-summer {
  border-bottom: 4px solid #ecc94b;
}

.theme-card-autumn {
  border-bottom: 4px solid #dd6b20;
}

.theme-card-winter {
  border-bottom: 4px solid #4299e1;
}

/* Natura */
.theme-card-ocean {
  border-bottom: 4px solid #0891b2;
}

.theme-card-forest {
  border-bottom: 4px solid #059669;
}

.theme-card-meadow {
  border-bottom: 4px solid #65a30d;
}

.theme-card-jungle {
  border-bottom: 4px solid #16a34a;
}

.theme-card-sky {
  border-bottom: 4px solid #0ea5e9;
}

.theme-card-sunset {
  border-bottom: 4px solid #f97316;
}

.theme-card-aurora {
  border-bottom: 4px solid #a855f7;
}

.theme-card-volcano {
  border-bottom: 4px solid #ef4444;
}

.theme-card-arctic {
  border-bottom: 4px solid #67e8f9;
}

.theme-card-tropical {
  border-bottom: 4px solid #f59e0b;
}

/* Słodycze i owoce */
.theme-card-candy {
  border-bottom: 4px solid #ec4899;
}

.theme-card-bubblegum {
  border-bottom: 4px solid #f472b6;
}

.theme-card-cotton_candy {
  border-bottom: 4px solid #e879f9;
}

.theme-card-strawberry {
  border-bottom: 4px solid #f43f5e;
}

.theme-card-blueberry {
  border-bottom: 4px solid #6366f1;
}

.theme-card-watermelon {
  border-bottom: 4px solid #22c55e;
}

.theme-card-lemon {
  border-bottom: 4px solid #facc15;
}

.theme-card-peach {
  border-bottom: 4px solid #fb923c;
}

.theme-card-grape {
  border-bottom: 4px solid #8b5cf6;
}

.theme-card-cherry {
  border-bottom: 4px solid #e11d48;
}

/* Magiczne */
.theme-card-galaxy {
  border-bottom: 4px solid #7c3aed;
}

.theme-card-rainbow {
  border-bottom: 4px solid #f97316;
}

.theme-card-fairy {
  border-bottom: 4px solid #d946ef;
}

.theme-card-unicorn {
  border-bottom: 4px solid #f472b6;
}

.theme-card-dragon {
  border-bottom: 4px solid #dc2626;
}

@media (max-width: 640px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .theme-card {
    padding: 20px 12px;
    min-height: 100px;
  }

  .theme-emoji {
    font-size: 36px;
  }

  .theme-name {
    font-size: 14px;
  }
}

/* ==============================================
   USER BADGE (Header avatar + nickname)
   ============================================== */

.user-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  text-decoration: none;
  transition: background 0.2s, transform 0.15s var(--bounce), box-shadow 0.2s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.user-badge:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.user-badge-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
}

.user-badge-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
}

/* ==============================================
   MAIN WITH SIDEBAR LAYOUT
   ============================================== */

.main-with-sidebar {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.main-with-sidebar .content {
  flex: 1;
  min-width: 0;
}

/* ==============================================
   ONLINE USERS SIDEBAR
   ============================================== */

.online-sidebar {
  width: 180px;
  flex-shrink: 0;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.online-sidebar-wide {
  width: 270px;
}

.online-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

.online-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

.online-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}

.online-user:hover {
  background: #f5f5f5;
}

.online-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.online-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
  border-radius: 50%;
  font-size: 16px;
  flex-shrink: 0;
}

.online-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User status indicator */
.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-online {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.status-offline {
  background: #d1d5db;
}

.user-offline {
  opacity: 0.7;
}

.user-offline .online-name {
  color: #9ca3af;
}

/* ==============================================
   SIDEBAR CHAT WIDGET
   ============================================== */

.sidebar-chat {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #f0f0f0;
}

.sidebar-chat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 10px;
}

.sidebar-chat-messages {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding-right: 4px;
}

.sidebar-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.sidebar-chat-messages::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 2px;
}

.sidebar-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.sidebar-msg {
  background: #f5f5f5;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.sidebar-msg-admin {
  background: linear-gradient(135deg, #fff8e7 0%, #fff3cd 100%);
  border-left: 2px solid #ffc107;
}

.sidebar-msg-author {
  font-weight: 700;
  color: var(--green-dark);
  margin-right: 4px;
}

.sidebar-msg-admin .sidebar-msg-author {
  color: #d69e2e;
}

.sidebar-msg-text {
  color: var(--ink);
  word-break: break-word;
}

.sidebar-chat-empty {
  text-align: center;
  color: #999;
  font-size: 12px;
  padding: 20px 0;
}

.sidebar-chat-form {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  max-width: none;
}

.sidebar-chat-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  font-size: 12px;
  transition: border-color 0.2s;
}

.sidebar-chat-input:focus {
  border-color: var(--green);
  outline: none;
}

.sidebar-chat-send {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex-shrink: 0;
}

.sidebar-chat-send:hover {
  transform: scale(1.1);
  box-shadow: none;
}

/* Spell check error highlighting */
.spell-error {
  text-decoration: underline wavy #ff6b6b;
  text-decoration-skip-ink: none;
  cursor: help;
}

/* Mobile responsive - adjust sidebar on small screens */
@media (max-width: 900px) {
  .main-with-sidebar {
    flex-direction: column;
  }

  .online-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    margin-bottom: 20px;
    order: -1;
  }

  .online-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .online-user {
    padding: 4px 8px;
    background: #f5f5f5;
  }

  .online-name {
    max-width: 60px;
  }

  .sidebar-chat {
    margin-top: 12px;
    padding-top: 12px;
  }

  .sidebar-chat-messages {
    max-height: 150px;
  }
}

@media (max-width: 640px) {
  .user-badge {
    width: 34px;
    height: 34px;
  }

  .user-badge-avatar,
  .user-badge-emoji {
    width: 30px;
    height: 30px;
  }

  .user-badge-emoji {
    font-size: 16px;
  }

  .online-sidebar {
    padding: 12px;
  }

  .online-header {
    font-size: 13px;
  }

  .online-avatar,
  .online-emoji {
    width: 24px;
    height: 24px;
  }

  .online-emoji {
    font-size: 14px;
  }

  .online-name {
    font-size: 12px;
  }
}
