/* Custom CSS Design: Wizard Academy Theme with Modern Dark and Parchment Elements */

:root {
  --color-dark-bg: #0d0f14;
  --color-gold: #c9a054;
  --color-gold-glow: #ffd700;
  --color-parchment: #f4edd8;
  --color-parchment-dark: #e8ddbe;
  --color-dark-text: #2f2a1c;
  --color-gryffindor: #740001;
  --color-ravenclaw: #0e1a40;
  --color-hufflepuff: #ecb939;
  --color-slytherin: #1a472a;
  
  --font-magic: Georgia, 'Times New Roman', serif;
  --font-hebrew: Arial, 'Noto Sans Hebrew', sans-serif;
  
  --shadow-magic: 0 8px 32px rgba(199, 160, 84, 0.15);
  --shadow-neon: 0 0 15px rgba(201, 160, 84, 0.4);
}

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

body {
  background-color: var(--color-dark-bg);
  font-family: var(--font-hebrew);
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  direction: rtl;
}

/* Background Magic Effects */
.stars {
  background: linear-gradient(rgba(9, 11, 16, 0.75), rgba(9, 11, 16, 0.9)), url('images/optimized/academy-background.webp') no-repeat center center;
  background-size: cover;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -3;
}

.twinkling {
  background: radial-gradient(circle at 50% 30%, rgba(201, 160, 84, 0.08), transparent 55%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -2;
  animation: move-twink-back 200s linear infinite;
}

@keyframes move-twink-back {
  from { background-position: 0 0; }
  to { background-position: -10000px 5000px; }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Sound Controller in header */
.sound-control {
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid var(--color-gold);
  border-radius: 30px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-magic);
  font-family: var(--font-hebrew);
  color: #fff;
  font-size: 0.9rem;
}

.sound-control:hover {
  background: rgba(199, 160, 84, 0.2);
  box-shadow: var(--shadow-neon);
}

.profile-chips {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 16px;
  min-width: 150px;
  z-index: 20;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(14, 17, 25, 0.98);
  border: 1px solid rgba(199, 160, 84, 0.55);
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
}

.user-status-bar.profile-menu-open .profile-chips {
  display: flex;
}

.profile-switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(199, 160, 84, 0.45);
  color: #f0dfb7;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--font-hebrew);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.switch-icon {
  font-size: 1rem;
  line-height: 1;
}

.profile-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(199, 160, 84, 0.3);
  color: #d5c7a8;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-hebrew);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.profile-chip:hover {
  background: rgba(199, 160, 84, 0.15);
  border-color: var(--color-gold);
}

.profile-chip.active {
  background: rgba(199, 160, 84, 0.25);
  border-color: var(--color-gold);
  color: #fff;
  box-shadow: 0 0 8px rgba(199, 160, 84, 0.4);
}

.chip-avatar {
  font-size: 1.1rem;
}

.sound-icon {
  font-size: 1.1rem;
}

.sound-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gold);
}

/* Containers */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 2px dashed rgba(199, 160, 84, 0.3);
  margin-bottom: 30px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.academy-crest {
  font-size: 2.8rem;
  text-shadow: 0 0 10px var(--color-gold);
  animation: float 4s ease-in-out infinite;
  will-change: transform;
}

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

.app-header h1 {
  font-family: var(--font-magic);
  font-size: 2rem;
  color: var(--color-gold);
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
}

.user-status-bar {
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid var(--color-gold);
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-magic);
  position: relative;
}

.user-avatar {
  font-size: 1.8rem;
}

.user-avatar-image {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-gold);
}

.network-banner {
  position: sticky;
  top: 0;
  z-index: 2000;
  background: #7b2d26;
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-weight: 700;
}

.welcome-banner {
  display: flex;
  align-items: center;
  gap: 18px;
}

.welcome-hero-image {
  width: 112px;
  height: 112px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid var(--color-gold);
  flex: 0 0 auto;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: max-content;
}

.user-name {
  font-weight: 700;
  color: #fff;
}

.user-xp {
  font-size: 0.85rem;
  color: var(--color-gold);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.app-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #d5c7a8;
  font-size: .85rem;
  padding: 28px 12px 8px;
}

.app-footer a { color: #f6c453; }

/* Cards (Wizard Academy Parchment style) */
.card {
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  overflow: hidden;
}

.card.parchment {
  background: var(--color-parchment);
  color: var(--color-dark-text);
  border: 6px double #8b7355;
  background-image: radial-gradient(circle, transparent 20%, var(--color-parchment-dark) 100%);
  box-shadow: 5px 5px 25px rgba(0, 0, 0, 0.4), inset 0 0 40px rgba(139, 115, 85, 0.3);
}

/* Screens */
.screen {
  display: none;
  animation: fadeIn 0.5s ease forwards;
}

.screen.active {
  display: block;
}

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

/* Profile Selection Screen */
.welcome-box {
  margin-bottom: 40px;
}

.welcome-box h2 {
  font-family: var(--font-magic);
  color: var(--color-gold);
  font-size: 2.2rem;
  margin-bottom: 12px;
  text-shadow: 0 0 10px rgba(199, 160, 84, 0.3);
}

.welcome-box p {
  font-size: 1.2rem;
  color: #d1d5db;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.profile-card {
  background: rgba(20, 24, 35, 0.85);
  border: 2px solid rgba(199, 160, 84, 0.3);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.profile-card:hover {
  transform: translateY(-10px);
  border-color: var(--color-gold);
  box-shadow: 0 15px 30px rgba(199, 160, 84, 0.25);
}

.house-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
}

/* Wizard Academy House Themes */
.profile-card.gryffindor {
  border-left: 6px solid var(--color-gryffindor);
}
.profile-card.gryffindor .house-badge {
  background: var(--color-gryffindor);
  box-shadow: 0 0 8px var(--color-gryffindor);
}

.profile-card.ravenclaw {
  border-left: 6px solid var(--color-ravenclaw);
}
.profile-card.ravenclaw .house-badge {
  background: var(--color-ravenclaw);
  box-shadow: 0 0 8px var(--color-ravenclaw);
}

.profile-card.hufflepuff {
  border-left: 6px solid var(--color-hufflepuff);
  color: #fff;
}
.profile-card.hufflepuff .house-badge {
  background: #b08200;
  box-shadow: 0 0 8px var(--color-hufflepuff);
}

.profile-avatar {
  font-size: 4rem;
  margin: 20px 0;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.2));
}

.profile-card h3 {
  font-family: var(--font-magic);
  font-size: 1.8rem;
  color: var(--color-gold);
  margin-bottom: 8px;
}

.profile-meta {
  font-size: 0.95rem;
  color: #b0b8c4;
  margin-bottom: 15px;
}

.profile-stats-brief {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: #e5e7eb;
  line-height: 1.4;
}

/* Dashboard Screen Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
}

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

  .dashboard-main {
    order: 1;
  }

  .dashboard-sidebar {
    order: 2;
    width: 100%;
  }
}

/* Sidebar Dashboard Stats */
.dashboard-sidebar {
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: start;
}

.dashboard-sidebar h3 {
  font-family: var(--font-magic);
  color: var(--color-dark-text);
  border-bottom: 2px solid rgba(139, 115, 85, 0.4);
  padding-bottom: 10px;
  font-size: 1.4rem;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-label {
  font-size: 0.95rem;
  font-weight: 700;
}

.progress-bar-bg {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  height: 16px;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(139, 115, 85, 0.4);
}

.progress-bar-fill {
  background: linear-gradient(90deg, #b08d49, var(--color-gold));
  height: 100%;
  width: 0%;
  border-radius: 10px;
  transition: width 0.6s ease;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.progress-bar-gold {
  background: linear-gradient(90deg, #d4af37, #ffd700);
}

.xp-text {
  font-size: 0.85rem;
  text-align: left;
  font-weight: 700;
  color: #6b5c3b;
}

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

.stat-box {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: inset 0 0 10px rgba(139, 115, 85, 0.15);
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  display: block;
  color: var(--color-gryffindor);
}

.stat-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4b3d21;
}

.weekly-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weekly-stats h4 {
  font-size: 0.95rem;
  color: var(--color-dark-text);
  font-weight: 700;
}

/* CSS Chart Bars */
.chart-bars {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 100px;
  padding: 10px 5px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  border-bottom: 2px solid rgba(139, 115, 85, 0.4);
}

.chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 12%;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  background: linear-gradient(to top, #7e191b, #a52a2a);
  width: 100%;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  min-height: 2px;
  transition: height 0.8s ease;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.chart-bar.today {
  background: linear-gradient(to top, #b08d49, var(--color-gold));
  box-shadow: 0 0 8px rgba(199, 160, 84, 0.6);
}

.chart-label {
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 5px;
  color: #6b5a3e;
}

.failed-questions-box {
  background: rgba(236, 185, 57, 0.15);
  border: 1px dashed #b08200;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.failed-questions-box h4 {
  font-size: 0.95rem;
  color: #7c5c00;
  font-weight: 700;
}

.failed-questions-box p {
  font-size: 0.85rem;
  color: #4b3d21;
}

.challenge-panel {
  background: linear-gradient(135deg, rgba(116, 0, 1, 0.12), rgba(236, 185, 57, 0.18));
  border: 1px solid rgba(176, 130, 0, 0.45);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.challenge-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5c2d1b;
}

.challenge-panel-header h4 {
  margin: 0;
  font-size: 1rem;
}

.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.challenge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.25);
  border-radius: 10px;
  padding: 9px;
}

.challenge-row.done {
  border-color: #b08200;
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.16);
}

.challenge-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.challenge-copy strong {
  color: #4b2b19;
  font-size: 0.9rem;
}

.challenge-copy span {
  color: #6b5c3b;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Dashboard Main Content */
.welcome-banner {
  background: rgba(20, 24, 35, 0.85);
  border: 2px solid var(--color-gold);
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-magic);
}

.welcome-banner h2 {
  font-family: var(--font-magic);
  color: var(--color-gold);
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.welcome-banner p {
  color: #d1d5db;
  line-height: 1.5;
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  pointer-events: none;
}

.subject-card {
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid rgba(199, 160, 84, 0.2);
  border-radius: 16px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.subject-card:hover {
  border-color: var(--color-gold);
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(199, 160, 84, 0.15);
}

.subject-card.smart-teacher {
  grid-column: span 2;
}

.subject-icon {
  font-size: 2.5rem;
  align-self: flex-start;
}

.subject-card h3 {
  font-family: var(--font-magic);
  font-size: 1.3rem;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.subject-card p {
  font-size: 0.9rem;
  color: #b0b8c4;
  flex-grow: 1;
  line-height: 1.4;
}

.subject-difficulty {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-gold);
  font-weight: 600;
}

.stars-stars {
  letter-spacing: 2px;
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.5));
}

/* Quiz Screen */
.quiz-container {
  padding: 30px;
  margin-bottom: 30px;
}

.quiz-container.quiz-zoomed-out {
  zoom: 0.88;
}

.quiz-zoom-toggle {
  width: 44px;
  min-width: 44px;
  padding-inline: 8px;
  font-weight: 900;
}

.quiz-zoom-toggle[aria-pressed="true"] {
  border-color: #b8860b;
  background: rgba(255, 215, 0, 0.2);
}

.cloud-sync-panel {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(23, 76, 115, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.38);
}

.cloud-sync-panel h5 {
  margin: 0 0 6px;
  color: #174c73;
}

.cloud-sync-status {
  margin: 0 0 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.cloud-sync-status[data-state="connected"] { color: #176b35; }
.cloud-sync-status[data-state="error"] { color: #8b1e1e; }
.cloud-sync-status[data-state="syncing"] { color: #174c73; }

.cloud-sync-code {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(47, 42, 28, 0.45);
  border-radius: 8px;
  background: #fffdf5;
  color: #2f2a1c;
  direction: ltr;
  text-align: left;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.3);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.subject-badge {
  background: var(--color-gryffindor);
  color: white;
  padding: 6px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.difficulty-level {
  font-size: 0.9rem;
  font-weight: 700;
  color: #7b5c3b;
}

.official-badge {
  display: inline-block;
  background: rgba(184, 134, 11, 0.1);
  border: 1px solid rgba(184, 134, 11, 0.35);
  color: #8b6508;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
  align-self: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quiz-progress-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--color-dark-text);
}

.quiz-score-live {
  padding: 6px 12px;
  border: 1px solid rgba(184, 134, 11, 0.4);
  border-radius: 18px;
  background: rgba(255, 247, 214, 0.78);
  color: #740001;
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.small-margin {
  margin-bottom: 25px;
}

/* Judaism Concept Block */
.judaism-concept-block {
  background: rgba(199, 160, 84, 0.1);
  border: 2px solid rgba(139, 115, 85, 0.5);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: inset 0 0 15px rgba(139, 115, 85, 0.1);
}

.concept-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.concept-badge {
  background: #a0522d;
  color: white;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.concept-title h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #5c2d1b;
}

.concept-explanation {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--color-dark-text);
  margin-bottom: 15px;
}

.concept-analogy {
  background: rgba(255, 255, 255, 0.6);
  border-right: 4px solid var(--color-gold);
  padding: 12px;
  border-radius: 4px;
}

.concept-analogy h4 {
  font-family: var(--font-magic);
  color: #5c2d1b;
  margin-bottom: 5px;
}

.concept-analogy p {
  font-size: 0.95rem;
  line-height: 1.4;
  font-style: italic;
  color: #3e3321;
}

/* Question Box */
.question-box {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  text-align: center;
  box-shadow: inset 0 0 10px rgba(139, 115, 85, 0.05);
}

.question-box h3 {
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--color-dark-text);
  font-weight: 800;
}

.question-context {
  max-height: min(34vh, 300px);
  overflow-y: auto;
  white-space: pre-line;
  background: #fffdf4;
  border: 1px solid #d9c99f;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
  line-height: 1.65;
  color: #302b21;
  text-align: start;
  box-shadow: inset 0 2px 8px rgba(90, 65, 25, .08);
}

/* Answers Grid */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

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

  .smart-teacher {
    grid-column: 1 / -1 !important;
  }

  .app-container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .sound-text {
    display: none;
  }
}

.answer-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(139, 115, 85, 0.6);
  color: var(--color-dark-text);
  padding: 18px 20px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: right;
  outline: none;
  font-family: var(--font-hebrew);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.answer-btn:hover {
  background: var(--color-gold);
  border-color: #8b7355;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(139, 115, 85, 0.2);
}

.answer-btn:active {
  transform: translateY(0);
}

.short-answer-area {
  background: rgba(255, 255, 255, 0.58);
  border: 2px solid rgba(139, 115, 85, 0.45);
  border-radius: 12px;
  padding: 16px;
}

.short-answer-area label {
  display: block;
  color: var(--color-dark-text);
  font-weight: 800;
  margin-bottom: 10px;
}

.short-answer-row {
  display: flex;
  gap: 10px;
}

.short-answer-row input {
  flex: 1 1 auto;
  min-width: 0;
  border: 2px solid rgba(139, 115, 85, 0.65);
  border-radius: 9px;
  padding: 12px 14px;
  font: 700 1rem var(--font-hebrew);
  color: var(--color-dark-text);
  background: #fff;
}

.short-answer-row input:focus {
  outline: 3px solid rgba(199, 160, 84, 0.35);
  border-color: #8b7355;
}

.short-answer-area p {
  color: #665d4d;
  font-size: 0.85rem;
  margin: 8px 0 0;
}

@media (max-width: 480px) {
  .short-answer-row {
    flex-direction: column;
  }
}

/* Buttons Styling */
.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  font-family: var(--font-hebrew);
  text-decoration: none;
  display: inline-block;
  scroll-margin-top: 100px;
  scroll-margin-bottom: 100px;
  position: relative;
  z-index: 5;
}

.btn-primary {
  background: linear-gradient(135deg, #b08d49, #8b6c2f);
  color: white;
  border: 1px solid var(--color-gold);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-gold), #b08d49);
  box-shadow: var(--shadow-neon);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-accent {
  background: linear-gradient(135deg, #740001, #4b0002);
  color: white;
  border: 1px solid #740001;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #a52a2a, #740001);
  box-shadow: 0 0 10px rgba(116, 0, 1, 0.5);
}

.btn-warning {
  background: linear-gradient(135deg, #ecb939, #b08200);
  color: #1f1a0e;
  border: 1px solid #b08200;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #ffd700, #ecb939);
  box-shadow: 0 0 8px rgba(236, 185, 57, 0.5);
}

.btn-danger {
  background: #7f1d1d;
  color: white;
  border: 1px solid #b91c1c;
}

.btn-danger:hover {
  background: #991b1b;
}

.data-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 15px;
  border-top: 1px solid rgba(139, 115, 85, 0.35);
}

.data-tools .btn-secondary {
  background: #5c4d3c;
  border-color: #3e3321;
  color: #fff;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #ffd700;
  outline-offset: 3px;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 15px 30px;
  font-size: 1.15rem;
}

/* Feedback Overlay & Card */
.feedback-overlay {
  --feedback-system-bottom: max(72px, env(safe-area-inset-bottom));
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 20, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  will-change: backdrop-filter;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) var(--feedback-system-bottom) max(14px, env(safe-area-inset-left));
  overflow: hidden;
}

.feedback-card {
  max-width: 500px;
  width: 100%;
  max-height: calc(100dvh - 100px);
  padding: 0;
  text-align: center;
  position: relative;
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feedback-scroll-area {
  padding: 20px 35px 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0;
}

.feedback-action-bar {
  flex: 0 0 auto;
  padding: 16px 35px 12px;
  background: linear-gradient(180deg, rgba(249, 244, 224, 1), rgba(249, 244, 224, 0.95) 78%, rgba(249, 244, 224, 0));
  box-shadow: 0 8px 18px rgba(62, 51, 33, 0.08);
  order: -1;
}

.feedback-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: popScale 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-card h2 {
  font-family: var(--font-magic);
  color: var(--color-gryffindor);
  margin-bottom: 15px;
  font-size: 1.8rem;
}

.feedback-message {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--color-dark-text);
  margin-bottom: 20px;
  white-space: pre-line;
}

.difficulty-change-indicator {
  background: rgba(199, 160, 84, 0.2);
  border: 1px solid var(--color-gold);
  padding: 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #7b5c3b;
  margin-bottom: 15px;
}

.xp-earned-banner {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-gryffindor);
  margin-bottom: 18px;
}

.xp-earned-banner small {
  display: block;
  margin-top: 5px;
  color: #5c4d3c;
  font-size: 0.85rem;
}

@media (max-height: 760px) {
  .feedback-card {
    max-height: calc(100dvh - 88px);
  }

  .feedback-scroll-area {
    padding: 12px 22px 6px;
  }

  .feedback-icon {
    font-size: 2.75rem;
    margin-bottom: 8px;
  }

  .feedback-card h2 {
    font-size: 1.45rem;
    margin-bottom: 10px;
  }

  .feedback-message {
    font-size: 1rem;
    line-height: 1.42;
    margin-bottom: 14px;
  }

  .difficulty-change-indicator {
    margin-bottom: 10px;
  }

  .xp-earned-banner {
    font-size: 1.05rem;
    margin-bottom: 12px;
  }

  .feedback-action-bar {
    padding: 12px 22px 8px;
  }
}

.animated-pop {
  animation: popScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popScale {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Results Screen */
.results-card {
  max-width: 650px;
  margin: 40px auto;
  padding: 40px;
}

.results-crest {
  font-size: 5rem;
  text-shadow: 0 0 12px var(--color-gold);
  margin-bottom: 20px;
}

.results-card h2 {
  font-family: var(--font-magic);
  color: var(--color-gryffindor);
  font-size: 2.2rem;
  margin-bottom: 10px;
}

.results-stats {
  display: flex;
  justify-content: space-around;
  margin: 30px 0;
  background: rgba(0,0,0,0.05);
  border-radius: 12px;
  padding: 20px 10px;
  border: 1px solid rgba(139, 115, 85, 0.3);
}

.results-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.results-stat-item span:last-child {
  font-size: 0.85rem;
  font-weight: 700;
  color: #6b5c3b;
}

.results-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-gryffindor);
}

.feedback-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-dark-text);
  margin-bottom: 30px;
  line-height: 1.5;
}

.actions-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.break-reminder {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 15, 20, 0.78);
  padding: 20px;
}

.break-reminder-card {
  max-width: 420px;
  padding: 24px;
  text-align: center;
}

.break-reminder-card h3 {
  color: var(--color-gryffindor);
  font-family: var(--font-magic);
  margin-bottom: 10px;
}

.break-reminder-card p {
  color: var(--color-dark-text);
  line-height: 1.5;
  margin-bottom: 18px;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .tab-text { display: none; }
  .dash-tab { font-size: 1.4rem; padding: 6px 0; }
  .app-container { padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .app-header { flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 0 12px; }
  .logo-container { gap: 8px; }
  .app-header h1 { font-size: 1.15rem; }
  .academy-crest { font-size: 1.55rem; }
  .header-left { flex-direction: row; width: 100%; gap: 8px; align-items: center; justify-content: center; }
  .sound-control { width: 42px; height: 42px; padding: 0; justify-content: center; flex: 0 0 auto; }
  .user-status-bar { padding: 6px 8px; gap: 8px; flex: 1 1 auto; min-width: 0; justify-content: space-between; }
  .profile-switch-toggle { display: inline-flex; flex: 0 0 auto; }
  .profile-chips {
    left: 8px;
    right: 8px;
    min-width: 0;
  }
  .profile-chip { padding: 8px 10px; font-size: 0.86rem; justify-content: center; }
  .user-info { align-items: flex-end; }
  .user-name { font-size: 0.9rem; line-height: 1.1; }
  .user-xp { font-size: 0.8rem; line-height: 1.1; white-space: nowrap; }
  .sound-text { display: none; }
  .welcome-banner { align-items: center; gap: 10px; padding: 12px; margin-bottom: 14px; border-width: 1px; border-radius: 12px; }
  .welcome-banner h2 { font-size: 1.15rem; margin-bottom: 0; }
  .welcome-banner p { display: none; }
  .welcome-hero-image { width: 56px; height: 56px; border-radius: 12px; }
  .subjects-grid { grid-template-columns: 1fr; gap: 12px; }
  .subject-card { padding: 14px; gap: 8px; border-radius: 12px; }
  .subject-card.smart-teacher { grid-column: auto !important; }
  .subject-card-image-wrapper { height: 112px; border-radius: 8px; margin-bottom: 2px; }
  .subject-card h3 { font-size: 1.08rem; padding-bottom: 6px; }
  .subject-card p { font-size: 0.84rem; line-height: 1.3; }
  .subject-difficulty { font-size: 0.78rem; gap: 8px; }
  .results-stats {
    flex-direction: column;
    gap: 20px;
  }
}

/* Interactive Math Step-by-Step Solver Style */
.math-steps-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.steps-assigned-box, .steps-options-box {
  background: rgba(255, 255, 255, 0.4);
  border: 2px dashed rgba(139, 115, 85, 0.4);
  border-radius: 12px;
  padding: 18px;
}

.steps-assigned-box h4, .steps-options-box h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #5c2d1b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.empty-steps-text {
  font-size: 0.95rem;
  color: #7b6d51;
  text-align: center;
  line-height: 60px;
  font-style: italic;
}

.shuffled-steps-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(199, 160, 84, 0.6);
  color: var(--color-dark-text);
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  text-align: right;
  width: 100%;
  font-family: var(--font-hebrew);
}

.step-card:hover {
  background: var(--color-gold);
  color: white;
  border-color: #8b7355;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(199, 160, 84, 0.25);
}

.step-card.correct-done {
  background: #e2f0d9;
  border-color: #a8d08d;
  color: #385723;
  cursor: default;
}

.step-card.correct-done:hover {
  transform: none;
  box-shadow: none;
  background: #e2f0d9;
  color: #385723;
}

.step-badge {
  background: rgba(139, 115, 85, 0.2);
  color: #5c2d1b;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.step-card.correct-done .step-badge {
  background: #a8d08d;
  color: white;
}

/* ==========================================
   DETAILED STATISTICS SCREEN & SMART TEACHER
   ========================================== */

.stats-screen-container {
  padding: 30px;
  margin-bottom: 30px;
  background-image: radial-gradient(circle, transparent 20%, var(--color-parchment-dark) 100%);
}

.stats-screen-header {
  border-bottom: 2px dashed rgba(139, 115, 85, 0.4);
  padding-bottom: 20px;
  margin-bottom: 25px;
  text-align: center;
  position: relative;
}

.stats-screen-header h2 {
  font-family: var(--font-magic);
  color: var(--color-gryffindor);
  font-size: 1.8rem;
  margin-top: 15px;
  margin-bottom: 8px;
}

.stats-screen-header p {
  font-size: 1.05rem;
  color: #5c4d3c;
  font-style: italic;
}

.stats-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.2);
  padding-bottom: 10px;
}

.stats-tab {
  background: rgba(139, 115, 85, 0.15);
  border: 1px solid rgba(139, 115, 85, 0.4);
  color: var(--color-dark-text);
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-hebrew);
  font-size: 1rem;
}

.stats-tab:hover {
  background: rgba(139, 115, 85, 0.3);
}

.stats-tab.active {
  background: var(--color-gryffindor);
  color: white;
  border-color: var(--color-gryffindor);
  box-shadow: 0 4px 8px rgba(116, 0, 1, 0.2);
}

.stats-tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.stats-tab-content.active {
  display: block;
}

/* Overview Layout */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 30px;
}

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

.overview-card {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(139, 115, 85, 0.05);
}

.overview-card h4 {
  font-size: 1.1rem;
  color: #5c2d1b;
  margin-bottom: 15px;
  width: 100%;
  border-bottom: 1px solid rgba(139, 115, 85, 0.2);
  padding-bottom: 8px;
  text-align: center;
}

.accuracy-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-parchment) 60%, transparent 61%),
              conic-gradient(var(--color-gold) 0%, rgba(139, 115, 85, 0.1) 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-gryffindor);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1), inset 0 0 10px rgba(0,0,0,0.05);
}

.subject-bars-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.subject-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.subject-progress-row span:first-child {
  width: 70px;
  font-weight: 700;
  color: var(--color-dark-text);
}

.subject-progress-row span:last-child {
  width: 45px;
  font-weight: 800;
  text-align: left;
  color: var(--color-gryffindor);
}

.progress-bar-bg.small {
  height: 12px;
  flex-grow: 1;
}

/* Quick Totals */
.quick-totals-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .quick-totals-row {
    grid-template-columns: 1fr 1fr;
  }
}

.total-box {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.total-box span:first-child {
  font-size: 1.6rem;
  font-weight: 800;
  display: block;
  color: var(--color-gryffindor);
}

.total-box span:last-child {
  font-size: 0.85rem;
  font-weight: 700;
  color: #5c4d3c;
}

/* Subjects detail lists */
.subjects-stats-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.subject-detail-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.02);
}

.subject-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(139, 115, 85, 0.2);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.subject-detail-header h3 {
  font-family: var(--font-magic);
  color: var(--color-dark-text);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-accuracy-badge {
  background: var(--color-gold);
  color: white;
  padding: 4px 12px;
  border-radius: 15px;
  font-weight: 800;
  font-size: 0.9rem;
}

.subject-detail-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .subject-detail-grid {
    grid-template-columns: 1fr;
  }
}

.topics-accuracy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topic-accuracy-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  border-right: 3px solid var(--color-gold);
}

.topic-accuracy-row.warning {
  border-right-color: #d9534f;
  background: rgba(217, 83, 79, 0.05);
}

.topic-accuracy-row.success {
  border-right-color: #5cb85c;
  background: rgba(92, 184, 92, 0.05);
}

.subject-recommendation-box {
  background: rgba(199, 160, 84, 0.08);
  border: 1px dashed rgba(139, 115, 85, 0.4);
  border-radius: 8px;
  padding: 15px;
  font-size: 0.95rem;
  color: #4b3c2a;
  line-height: 1.4;
}

.subject-recommendation-box h5 {
  font-weight: 700;
  margin-bottom: 5px;
  color: #7c5c00;
}

/* Recommendations list */
.recommendations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  padding: 0;
}

.recommendations-list li {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.25);
  border-right: 5px solid var(--color-gold);
  border-radius: 8px;
  padding: 15px;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--color-dark-text);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.recommendations-list li::before {
  content: '🧙‍♂️';
  font-size: 1.2rem;
}

.recommendations-list li.high-priority {
  border-right-color: var(--color-gryffindor);
  background: rgba(116, 0, 1, 0.03);
}

.recommendations-list li.high-priority::before {
  content: '🚨';
}

/* Smart Teacher Styles */
.smart-teacher-status {
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

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

/* Image styling classes */
.profile-badge-wrapper {
  width: 100px;
  height: 100px;
  margin: 15px auto;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--color-gold);
  box-shadow: 0 0 15px rgba(211, 166, 37, 0.4);
  background-color: rgba(20, 24, 35, 0.8);
}

.profile-house-badge {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.subject-card-image-wrapper {
  width: 100%;
  height: 140px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(199, 160, 84, 0.3);
  margin-bottom: 5px;
  background-color: rgba(20, 24, 35, 0.8);
}

.subject-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.subject-card:hover .subject-card-img {
  transform: scale(1.1);
}

.question-image-container {
  margin: 15px auto;
  max-width: 100%;
  display: flex;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  border: 1px solid var(--color-gold);
  background-color: rgba(20, 24, 35, 0.8);
}

.question-image {
  max-height: 250px;
  max-width: 100%;
  object-fit: contain;
}

/* ==========================================================================
   GAMIFIED ADDON STYLES: WIZARD ACADEMY REMASTERED
   ========================================================================== */

/* HUD Stats in Header */
.user-hud-stats {
  display: flex;
  gap: 12px;
  margin: 4px 0;
  flex-wrap: wrap;
}

.hud-stat {
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid rgba(199, 160, 84, 0.3);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.energy-timer {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: normal;
  margin-left: 2px;
}

/* Dashboard Navigation Tabs */
.dashboard-tabs-container {
  display: flex;
  justify-content: space-around;
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid var(--color-gold);
  border-radius: 12px;
  padding: 6px;
  margin: 15px 0 25px;
  gap: 8px;
  box-shadow: var(--shadow-magic);
}

.dash-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #d5c7a8;
  padding: 10px 5px;
  font-family: var(--font-hebrew);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-align: center;
  white-space: nowrap;
}

.dash-tab:hover {
  background: rgba(199, 160, 84, 0.15);
  color: #fff;
}

.dash-tab.active {
  background: var(--color-gold);
  color: var(--color-dark-bg);
  box-shadow: 0 0 10px rgba(199, 160, 84, 0.5);
  text-shadow: none;
}

/* Tab Panels */
.tab-panel {
  display: none;
  pointer-events: none;
}

.tab-panel.active {
  display: block;
}

.subject-card,
.level-node,
.btn,
.avatar-card,
.battlepass-row,
.leaderboard-row,
.daily-day-card,
.chest-emoji {
  pointer-events: auto !important;
}

/* Worlds and Adventure Map */
.worlds-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.world-select-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(199, 160, 84, 0.3);
  color: #fff;
  border-radius: 30px;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-hebrew);
  font-size: 0.9rem;
  font-weight: bold;
  transition: all 0.2s ease;
}

.world-select-btn.active {
  background: linear-gradient(135deg, #ffd700, #c9a054);
  color: #0d0f14;
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.world-select-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.adventure-map {
  background: rgba(10, 10, 15, 0.6);
  border: 2px solid var(--color-gold);
  border-radius: 16px;
  padding: 30px 20px;
  min-height: 400px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.8);
}

.map-pathway {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  position: relative;
  z-index: 2;
  margin: 20px 0;
}

.level-node-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.level-node {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(20, 24, 35, 0.9);
  border: 4px solid #8b7355;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 850;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 3;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.level-node::before {
  content: '';
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border-radius: 50%;
  border: 2px dashed transparent;
  transition: all 0.3s;
}

.level-node.unlocked {
  border-color: #ffd700;
  background: radial-gradient(circle, #2a1e38 0%, #100a1c 100%);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.level-node.unlocked::before {
  border-color: #ffd700;
  animation: rotateDashed 12s linear infinite;
  will-change: transform;
}

.level-node.completed {
  border-color: #2ec4b6;
  background: radial-gradient(circle, #102e2b 0%, #051412 100%);
}

.level-node.locked {
  border-color: #555;
  background: #222;
  color: #777;
  cursor: not-allowed;
  box-shadow: none;
}

.level-node.boss {
  width: 90px;
  height: 90px;
  border-radius: 18px;
  border-color: #e63946;
  background: radial-gradient(circle, #5b1016 0%, #200407 100%);
  box-shadow: 0 0 25px rgba(230, 57, 70, 0.6);
}

.level-node.boss.unlocked::before {
  border-color: #e63946;
}

.level-node:hover:not(.locked) {
  transform: scale(1.15);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
}

.level-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #fff;
  margin-top: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  background: rgba(0,0,0,0.6);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}

.level-stars {
  display: flex;
  gap: 2px;
  position: absolute;
  top: -15px;
  justify-content: center;
  width: 100%;
  z-index: 4;
}

.level-stars span {
  font-size: 1.1rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  filter: drop-shadow(0 0 3px rgba(255,215,0,0.8));
}

.path-connector-line {
  position: absolute;
  width: 6px;
  background: rgba(139, 115, 85, 0.4);
  z-index: 1;
  transform-origin: top center;
}

.path-connector-line.active {
  background: linear-gradient(to bottom, #2ec4b6, #ffd700);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

@keyframes rotateDashed {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Magic Shop Styles */
.shop-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.shop-coins-banner {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid #ffd700;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.shop-card {
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid var(--color-gold);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  transition: all 0.3s;
}

.shop-card:hover {
  transform: translateY(-5px);
  border-color: #ffd700;
  box-shadow: 0 8px 25px rgba(199,160,84,0.3);
}

.shop-item-icon {
  font-size: 3rem;
  margin: 10px 0;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.1));
}

.shop-card h4 {
  font-size: 1.1rem;
  color: var(--color-gold);
  font-family: var(--font-magic);
}

.shop-card p {
  font-size: 0.85rem;
  color: #ccc;
  min-height: 40px;
}

.shop-card .item-cost {
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffd700;
}

.btn-buy {
  background: linear-gradient(135deg, #ffd700, #c9a054);
  color: #0d0f14;
  border: none;
  font-weight: bold;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.btn-buy:hover {
  box-shadow: 0 0 12px rgba(255,215,0,0.6);
  transform: scale(1.03);
}

.btn-buy:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
}

/* Avatar showcase in Shop */
.avatar-showcase {
  border-top: 2px dashed rgba(199, 160, 84, 0.3);
  padding-top: 20px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.avatar-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(199, 160, 84, 0.2);
  border-radius: 12px;
  padding: 15px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.avatar-card:hover {
  background: rgba(199, 160, 84, 0.1);
  border-color: var(--color-gold);
}

.avatar-card.equipped {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 10px rgba(255,215,0,0.3);
}

.avatar-card-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 8px;
}

.avatar-card-name {
  font-size: 0.8rem;
  font-weight: bold;
  display: block;
  color: #fff;
}

.avatar-card-status {
  font-size: 0.7rem;
  color: #ffd700;
  margin-top: 4px;
  display: block;
}

/* Battle Pass Screen */
.battlepass-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bp-header-info {
  background: linear-gradient(135deg, #3a0ca3, #0f0a28);
  border: 1px solid #7209b7;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.bp-header-info h3 {
  font-family: var(--font-magic);
  color: #ffd700;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.bp-bar-wrapper {
  margin: 15px 0 5px;
}

.battlepass-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.battlepass-row {
  display: flex;
  align-items: center;
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid rgba(199, 160, 84, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  justify-content: space-between;
  gap: 15px;
}

.battlepass-row.unlocked {
  border-color: #7209b7;
  box-shadow: inset 0 0 10px rgba(114, 9, 183, 0.1);
}

.bp-level-badge {
  background: #7209b7;
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: bold;
  font-size: 0.95rem;
  min-width: 75px;
  text-align: center;
}

.bp-level-xp {
  font-size: 0.8rem;
  color: #aaa;
  display: block;
}

.bp-reward-detail {
  flex: 1;
  font-size: 0.95rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-claim {
  background: #7209b7;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-claim:hover:not(:disabled) {
  background: #f72585;
  box-shadow: 0 0 8px rgba(247, 37, 133, 0.6);
}

.btn-claim:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
}

/* Leaderboard Tab */
.leaderboard-container {
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid var(--color-gold);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 15px;
  justify-content: space-between;
}

.leaderboard-row.me {
  background: rgba(199, 160, 84, 0.15);
  border-color: var(--color-gold);
}

.lead-rank-name {
  display: flex;
  align-items: center;
  gap: 15px;
}

.lead-rank {
  font-weight: 850;
  font-size: 1.1rem;
  width: 25px;
  color: #aaa;
}

.leaderboard-row:nth-child(1) .lead-rank { color: #ffd700; font-size: 1.3rem; }
.leaderboard-row:nth-child(2) .lead-rank { color: #c0c0c0; font-size: 1.2rem; }
.leaderboard-row:nth-child(3) .lead-rank { color: #cd7f32; font-size: 1.15rem; }

.lead-avatar-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-avatar {
  font-size: 1.5rem;
}

.lead-name {
  font-weight: bold;
}

.lead-xp-value {
  font-weight: 700;
  color: var(--color-gold);
}

/* Quiz Additions: Timer, Combo, Boss Arena */
.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
}

.timer-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: none; /* Only visible when level active */
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4ad66d, #ffd700, #ff4d4d);
  background-size: 300% 100%;
  transition: width 0.1s linear;
}

.combo-badge {
  background: linear-gradient(135deg, #ff4d4d, #f77f00);
  color: #fff;
  border-radius: 20px;
  padding: 4px 10px;
  font-weight: bold;
  font-size: 0.8rem;
  box-shadow: 0 0 10px rgba(255, 77, 77, 0.6);
  animation: comboFlame 0.8s ease infinite alternate;
  will-change: transform, filter;
  display: none;
}

@keyframes comboFlame {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.15); filter: brightness(1.2); }
}

/* Boss Arena on Quiz Screen */
.boss-arena {
  background: linear-gradient(180deg, #2b0c10, #120406);
  border: 2px solid #ff4d4d;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 15px;
  box-shadow: 0 0 15px rgba(255, 77, 77, 0.3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.boss-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.boss-avatar-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.boss-graphic {
  font-size: 2.2rem;
  animation: shakeBoss 3s infinite;
  will-change: transform;
}

@keyframes shakeBoss {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
  20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.boss-title {
  color: #ff4d4d;
  font-weight: bold;
  font-family: var(--font-magic);
  font-size: 1rem;
}

.boss-hp-bar-bg {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,77,77,0.3);
}

.boss-hp-bar-fill {
  background: #ff4d4d;
  height: 100%;
  width: 100%;
  transition: width 0.4s ease;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

.player-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 77, 77, 0.2);
  padding-top: 6px;
}

.player-hearts {
  font-size: 1.1rem;
  color: #ff4d4d;
  display: flex;
  gap: 3px;
}

/* Quiz Power-ups buttons */
.quiz-powerups-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.btn-powerup {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--color-gold);
  border-radius: 30px;
  padding: 6px 12px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hebrew);
  font-size: 0.8rem;
  font-weight: bold;
  transition: all 0.2s;
}

.btn-powerup:hover:not(:disabled) {
  background: rgba(199, 160, 84, 0.2);
  transform: scale(1.05);
}

.btn-powerup:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #555;
}

.btn-powerup-count {
  background: var(--color-gold);
  color: #000;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 10px;
}

/* Confetti and particles canvas */
#canvasConfetti {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 9999;
  pointer-events: none;
  display: none;
}

/* Mystery Box Modal */
.mystery-box-modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mystery-box-content {
  background: radial-gradient(circle, #25123e 0%, #0c0517 100%);
  border: 3px solid #ff4da6;
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  padding: 30px;
  text-align: center;
  color: #fff;
  box-shadow: 0 0 30px rgba(255, 77, 166, 0.5);
  animation: fadeIn 0.3s ease;
}

.chest-wrapper {
  margin: 30px 0;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chest-emoji {
  font-size: 5rem;
  cursor: pointer;
  display: inline-block;
  user-select: none;
  filter: drop-shadow(0 0 10px rgba(255,215,0,0.5));
}

.chest-emoji.shake {
  animation: chestShake 0.6s infinite;
}

.chest-emoji.open {
  animation: chestOpen 0.5s forwards;
}

@keyframes chestShake {
  0%, 100% { transform: rotate(0); }
  10%, 30%, 50%, 70%, 90% { transform: rotate(-5deg); }
  20%, 40%, 60%, 80% { transform: rotate(5deg); }
}

@keyframes chestOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1.2); }
}

.reward-reveal-title {
  color: #ff4da6;
  font-size: 1.4rem;
  font-family: var(--font-magic);
  margin-top: 15px;
}

/* Daily Reward modal */
.daily-reward-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.daily-day-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(199, 160, 84, 0.2);
  border-radius: 8px;
  padding: 10px 5px;
  text-align: center;
  font-size: 0.75rem;
}

.daily-day-card.active {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.daily-day-card.claimed {
  opacity: 0.5;
  background: rgba(0,0,0,0.2);
  border-color: #555;
}

.daily-day-icon {
  font-size: 1.3rem;
  display: block;
  margin: 5px 0;
}

.daily-day-num {
  font-weight: bold;
}
