:root {
  --primary: #ff6b4a;
  --primary-dark: #f05634;
  --secondary: #ffc13c;
  --success: #17b8a6;
  --danger: #ef4444;
  --info: #4f9df7;
  --bg: #fffaf6;
  --bg-soft: #f6f1ec;
  --card: #ffffff;
  --text: #1f2a3a;
  --ink-soft: #55617a;
  --muted: #7c8698;
  --line: #eee5dd;
  --coral-soft: #ffe7df;
  --teal-soft: #d9f6f1;
  --gold-soft: #fff3d6;
  --radius: 20px;
  --radius-lg: 28px;
  --font-head: "Baloo 2", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
}

h1, h2, h3, h4 { font-family: var(--font-head); }

/* AUTH STYLES */
.auth-container {
  max-width: 440px;
  margin: 0 auto;
  padding: 40px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.auth-header h1 {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
}

.auth-header p {
  color: #55617a;
  font-size: 0.95rem;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}

.auth-tab {
  flex: 1;
  padding: 14px;
  background: #eee5dd;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  color: #55617a;
}

.auth-tab:first-child { border-radius: 12px 0 0 0; }
.auth-tab:last-child { border-radius: 0 12px 0 0; }

.auth-tab.active {
  background: white;
  color: var(--primary);
}

.auth-form {
  display: none;
  background: white;
  padding: 30px 24px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.auth-form.active { display: block; }

.auth-form h2 {
  font-size: 1.3rem;
  color: var(--primary);
  margin-bottom: 20px;
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f2a3a;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #eee5dd;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
}

.btn {
  padding: 12px 24px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #f05634; transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #0f9d8d; }
.btn-danger { background: var(--danger); color: white; }
.btn-secondary { background: #eee5dd; color: #1f2a3a; }
.btn-secondary:hover { background: #eee5dd; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
  color: #55617a;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.feedback {
  padding: 10px 16px;
  border-radius: 10px;
  margin-top: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  display: none;
}

.feedback.correct { background: #d9f6f1; color: #0f9d8d; display: block; }
.feedback.wrong { background: #FEE2E2; color: #991B1B; display: block; }

/* DASHBOARD COMMON */
header {
  background: #fffaf6;
  color: var(--text);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 0 var(--line);
  flex-wrap: wrap;
  gap: 10px;
}

header h1 { font-size: 1.3rem; font-weight: 800; }

.header-logo { height: 58px; width: auto; display: block; margin-left: 22px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.dashboard-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px;
}

.section-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}

.section-card h2 {
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-card h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 12px;
}

/* STUDENT CARDS */
.student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.student-card {
  background: #f6f1ec;
  border: 2px solid #eee5dd;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.student-card h4 {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 6px;
}

.student-code {
  background: var(--primary);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 2px;
  display: inline-block;
  margin: 6px 0;
}

/* CHAPTER CARDS */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.chapter-card {
  background: linear-gradient(135deg, #ffe7df, #d9f6f1);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  border: 2px solid transparent;
}

.chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(124,58,237,0.2);
  border-color: var(--primary);
}

.chapter-card .ch-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
}

.chapter-card .ch-emoji {
  font-size: 2.8rem;
  margin-bottom: 2px;
}

.chapter-card .ch-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 6px;
}

.weekly-plan-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #ffe7df, #d9f6f1);
  border: 2px solid var(--primary);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.weekly-plan-banner:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(124,58,237,0.25); }
.wp-icon { font-size: 2.2rem; }
.wp-info { flex: 1; }
.wp-info strong { color: var(--primary); font-size: 1.05rem; display: block; }
.wp-info span { color: #55617a; font-size: 0.85rem; }
.wp-arrow { font-size: 1.4rem; color: var(--primary); font-weight: 800; }

.block-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f6f1ec;
  border: 2px solid #eee5dd;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.block-card:hover { border-color: var(--primary); background: #ffe7df; }
.block-icon { font-size: 2rem; flex-shrink: 0; }
.block-info { flex: 1; }
.block-info strong { color: var(--primary); font-size: 0.95rem; }
.block-info span { color: #55617a; font-size: 0.8rem; }
.block-arrow { font-size: 1.3rem; color: var(--primary); font-weight: 800; }

.content-preview { background: #f6f1ec; border: 2px solid #eee5dd; border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.content-preview h4 { color: var(--primary); font-size: 0.95rem; margin-bottom: 8px; }
.exercise-mini { background: white; border: 1px solid #eee5dd; border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; }

.chapter-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 12px;
  text-align: center;
}
.chapter-box-emoji { font-size: 3.5rem; line-height: 1; }
.chapter-box-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.chapter-box-subtitle { font-size: 0.95rem; color: #55617a; }

.chapter-card .ch-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.chapter-card .ch-subtitle {
  font-size: 0.8rem;
  color: #55617a;
  margin-top: 4px;
}

/* SCORE BAR */
#score-bar {
  background: white;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 10px 16px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  flex-wrap: wrap;
}

.score-item { display: flex; align-items: center; gap: 6px; font-size: 0.95rem; }
.score-badge {
  background: var(--primary);
  color: white;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 1rem;
  min-width: 36px;
  text-align: center;
}
.star-badge { background: var(--secondary); }

/* NAV */
nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px 8px;
}

.nav-btn {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 30px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-btn:hover, .nav-btn.active {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(124,58,237,0.3);
}

/* SECTIONS */
.section {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 12px 40px;
  animation: fadeIn 0.3s ease;
}

.section.active { display: block; }

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

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  color: #55617a;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* CARDS GRID */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.vocab-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.25s;
  border: 2px solid transparent;
  user-select: none;
}

.vocab-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(124,58,237,0.2);
  border-color: var(--primary);
}

.vocab-card .emoji { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.vocab-card .word { font-size: 0.9rem; font-weight: 700; color: var(--primary); }
.vocab-card .translation { font-size: 0.78rem; color: #7c8698; margin-top: 4px; display: none; }

/* GRAMMAR BOX */
.grammar-box {
  background: linear-gradient(135deg, #ffe7df, #d9f6f1);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border-left: 5px solid var(--primary);
}

.grammar-box h3 { font-size: 1rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; }

.grammar-example {
  background: white;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.grammar-example .adj { color: var(--secondary); font-weight: 700; }
.grammar-example .comp { color: var(--primary); font-weight: 700; }

/* EXERCISE CARD */
.exercise-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}

.exercise-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-number {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* MEMORY GAME */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 500px) { .memory-grid { grid-template-columns: repeat(3, 1fr); } }

.memory-card {
  aspect-ratio: 1;
  background: var(--primary);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  transition: all 0.3s;
  text-align: center;
  padding: 6px;
  user-select: none;
  min-height: 90px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.memory-card.revealed { background: white; color: var(--text); border: 2px solid var(--primary); }
.memory-card.matched-mem { background: #d9f6f1; color: #0f9d8d; border: 2px solid var(--success); cursor: default; animation: memPop 0.5s ease; }
@keyframes memPop {
  0% { transform: scale(1); box-shadow: 0 3px 8px rgba(0,0,0,0.15); }
  50% { transform: scale(1.25); box-shadow: 0 0 24px rgba(16,185,129,0.9); }
  100% { transform: scale(1); box-shadow: 0 3px 8px rgba(0,0,0,0.15); }
}
.memory-card .card-back { font-size: 2.6rem; }
.memory-card .mem-emoji { font-size: 2.6rem; }
.memory-card .mem-word { font-size: 1.05rem; font-weight: 800; line-height: 1.2; }

.win-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}
.win-box {
  background: white;
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: winPop 0.5s ease;
  max-width: 90vw;
}
.win-emoji { font-size: 4.5rem; animation: winBounce 1s infinite; }
.win-box h2 { font-size: 2rem; color: var(--primary); font-weight: 800; margin: 12px 0 8px; }
.win-box p { font-size: 1.1rem; color: #1f2a3a; margin-bottom: 20px; }
@keyframes winPop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes winBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* MATCHING */
.match-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.match-col { display: flex; flex-direction: column; gap: 8px; }

.match-item {
  background: white;
  border: 2px solid #eee5dd;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
}

.match-item:hover { border-color: var(--primary); background: #ffe7df; }
.match-item.selected { border-color: var(--primary); background: var(--primary); color: white; }
.match-item.matched { border-color: var(--success); background: #d9f6f1; color: #0f9d8d; cursor: default; }
.match-item.wrong-match { border-color: var(--danger); background: #FEE2E2; animation: shake 0.4s; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* FILL BLANKS */
.fill-sentence {
  font-size: 1.05rem;
  line-height: 2.2;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.fill-input {
  border: 2px solid #eee5dd;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 1rem;
  font-weight: 600;
  min-width: 110px;
  outline: none;
  transition: border-color 0.2s;
}

.fill-input:focus { border-color: var(--primary); }
.fill-input.correct-input { border-color: var(--success); background: #d9f6f1; }
.fill-input.wrong-input { border-color: var(--danger); background: #FEE2E2; }

/* WORD SEARCH */
.wordsearch-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ws-grid {
  display: inline-block;
  background: white;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.ws-row { display: flex; }

.ws-cell {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  text-transform: uppercase;
  user-select: none;
}

@media (max-width: 480px) { .ws-cell { width: 24px; height: 24px; font-size: 0.72rem; } }

.ws-cell:hover { background: #ffe7df; }
.ws-cell.selected-ws { background: #d9f6f1; color: var(--info); }
.ws-cell.found-ws { background: #d9f6f1; color: var(--success); font-weight: 800; }

.ws-words { flex: 1; min-width: 140px; }
.ws-words h4 { font-weight: 800; color: var(--primary); margin-bottom: 10px; }

.ws-word-item {
  padding: 5px 0;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid #f6f1ec;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-word-item.found-word { text-decoration: line-through; color: var(--success); }
.ws-word-item .ws-dot { width: 10px; height: 10px; border-radius: 50%; background: #eee5dd; flex-shrink: 0; }
.ws-word-item.found-word .ws-dot { background: var(--success); }

/* SPELLING */
.spelling-display {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
  margin: 10px 0 6px;
  letter-spacing: 6px;
  min-height: 52px;
}

.spelling-hint { text-align: center; font-size: 0.85rem; color: #7c8698; margin-bottom: 14px; }

.letter-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }

.letter-btn {
  width: 42px;
  height: 42px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.letter-btn:hover:not(:disabled) { background: #f05634; transform: scale(1.1); }
.letter-btn:disabled { background: #eee5dd; cursor: default; transform: none; }

/* SENTENCE BUILDER */
.word-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  min-height: 48px;
  padding: 10px;
  background: #f6f1ec;
  border-radius: 12px;
  border: 2px dashed #eee5dd;
}

.word-chip {
  background: var(--primary);
  color: white;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.word-chip:hover { background: #f05634; transform: scale(1.05); }
.word-chip.used { background: #7c8698; cursor: default; transform: none; }

.sentence-drop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  background: #ffe7df;
  border-radius: 12px;
  border: 2px solid var(--primary);
  margin-bottom: 10px;
}

.dropped-chip {
  background: #f05634;
  color: white;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

/* QUIZ */
.sentence-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 500px) { .sentence-options { grid-template-columns: 1fr; } }

.option-btn {
  background: white;
  border: 2px solid #eee5dd;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.option-btn:hover { border-color: var(--primary); background: #ffe7df; }
.option-btn.correct-opt { border-color: var(--success); background: #d9f6f1; color: #0f9d8d; }
.option-btn.wrong-opt { border-color: var(--danger); background: #FEE2E2; color: #991B1B; }

/* PROGRESS */
.progress-section {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.progress-bar-outer {
  background: #eee5dd;
  border-radius: 10px;
  height: 16px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-inner {
  background: linear-gradient(90deg, var(--primary), var(--info));
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* SCHEDULE */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 700px) { .schedule-grid { grid-template-columns: 1fr; } }

.schedule-day {
  background: #f6f1ec;
  border: 2px solid #eee5dd;
  border-radius: 12px;
  padding: 12px;
}

.schedule-day h4 {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
  text-align: center;
}

.schedule-day-header {
  background: var(--primary);
  color: white;
  padding: 10px;
  border-radius: 8px 8px 0 0;
  text-align: center;
  font-weight: 800;
  font-size: 0.9rem;
  margin: -12px -12px 8px -12px;
}

.schedule-day-body { padding: 4px 0; }

.week-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.week-nav button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}

.week-nav button:hover { background: #f05634; }

.week-nav .week-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}

.exercise-count-badge {
  background: var(--secondary);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  margin-left: 4px;
}

.schedule-exercise {
  background: white;
  border: 1px solid #eee5dd;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.schedule-exercise .remove-btn {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-exercise-btn {
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
}

/* TOAST */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1f2a3a;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 999;
  transition: transform 0.3s ease;
  white-space: nowrap;
}

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

/* CONFETTI */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall 1.8s ease-in forwards;
}

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

/* HOME SECTION */
.home-hero { text-align: center; padding: 6px 0 20px; }
.home-hero .big-emoji { font-size: 5rem; margin-bottom: 10px; }
.home-hero h2 { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.home-hero p { color: #55617a; font-size: 1rem; margin: 8px 0 20px; }

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.home-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  transition: all 0.25s;
  border: 2px solid transparent;
  position: relative;
}

.home-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(124,58,237,0.2);
  border-color: var(--primary);
}

.home-card .icon { font-size: 2.5rem; margin-bottom: 8px; }
.home-card h3 { font-size: 0.95rem; font-weight: 800; color: var(--primary); }
.home-card p { font-size: 0.78rem; color: #7c8698; margin-top: 4px; }

/* WEEKLY PLAN (rows of days) */
.plan-day { margin-bottom: 22px; }
.plan-day-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #ffe7df;
}
.plan-day-exercises {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.plan-empty { color: #7c8698; font-size: 0.85rem; font-style: italic; padding: 4px 2px; }

.plan-block { border: 2px solid #eee5dd; border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #f6f1ec; }
.plan-block.block-done { border-color: var(--success); background: #d9f6f1; }
.plan-block.block-pending { border-color: #fff3d6; }
.plan-block-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.plan-block-num {
  background: var(--primary); color: white; border-radius: 50%;
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; flex-shrink: 0;
}
.plan-block-name { font-weight: 800; color: var(--primary); font-size: 0.95rem; }
.plan-block-chapter { font-size: 0.72rem; color: #55617a; background: #eee5dd; border-radius: 20px; padding: 2px 8px; }
.plan-block .plan-day-exercises { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.block-dyn { padding: 14px 12px; }
.block-dyn .icon { font-size: 2rem; }
.block-dyn h3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

/* Routine / guided mode */
.ex-num {
  position: absolute;
  top: 8px;
  left: 10px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}
.home-card.ex-done { border-color: var(--success); background: #d9f6f1; }
.home-card.ex-pending { border-color: #fff3d6; }
.ex-status {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
}
.status-done { background: #d9f6f1; color: #0f9d8d; }
.status-pending { background: #fff3d6; color: #b98a00; }
.plan-day-header { position: relative; flex-wrap: wrap; }
.day-start-btn { margin-left: 2px; }
#routine-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1f2a3a;
  color: white;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  z-index: 900;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.2);
  flex-wrap: wrap;
}
.routine-info { font-weight: 800; font-size: 1rem; }
.routine-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 30px;
  max-width: 440px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal h3 { font-size: 1.2rem; color: var(--primary); margin-bottom: 16px; }

/* RESPONSIVE */
@media (max-width: 600px) {
  .match-container { grid-template-columns: 1fr; }
  header h1 { font-size: 1.1rem; }
}
