@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&family=Inter:wght@400;500;700;800&display=swap");

:root {
  --font-title: "Space Grotesk", -apple-system, sans-serif;
  --font-body: "Inter", sans-serif;

  /* Color Palette - Cyber Glassmorphic Dark Theme */
  --bg-slate-900: #0b0f19;
  --bg-slate-800: #131b2e;
  --bg-slate-700: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-white: #ffffff;

  --border-glow: rgba(255, 255, 255, 0.08);
  --border-focus: #c084fc;

  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.15);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);

  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.15);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-full: 9999px;

  --accent: #8b5cf6; /* Default theme purple */
  --accent-light: rgba(139, 92, 246, 0.15);
  --accent-gradient: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --hebrew-font: "Noto Sans Hebrew", "Arial Hebrew", "David", Arial, sans-serif;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background: var(--bg-slate-900);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  padding-bottom: 80px;
  position: relative;
  overflow-x: hidden;
}

/* Background animated glow spots */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background: radial-gradient(circle, var(--accent), transparent);
  top: -100px;
  left: -100px;
  animation: pulse-slow-1 25s infinite alternate;
}
body::after {
  background: radial-gradient(circle, #06b6d4, transparent);
  bottom: -100px;
  right: -100px;
  animation: pulse-slow-2 30s infinite alternate;
}

@keyframes pulse-slow-1 {
  0% {
    transform: scale(1) translate(0, 0);
  }
  100% {
    transform: scale(1.2) translate(80px, 50px);
  }
}
@keyframes pulse-slow-2 {
  0% {
    transform: scale(1) translate(0, 0);
  }
  100% {
    transform: scale(1.15) translate(-60px, -40px);
  }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-slate-900);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-slate-700);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Headers */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-title);
  color: var(--text-white);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.wrap {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

/* Hero Section */
.hero {
  padding: 50px 0 30px;
  position: relative;
  text-align: center;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-title);
  font-size: 0.95rem;
  margin-bottom: 20px;
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}
.back:hover {
  transform: translateX(-4px);
  color: var(--text-white);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--text-white);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 16px;
  margin-bottom: 20px;
  font-family: var(--font-title);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  background: linear-gradient(120deg, #ffffff 30%, #cbd5e1 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lead {
  max-width: 800px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.7;
}

/* Stats / XP Container */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 35px;
}

.stat {
  background: var(--bg-slate-800);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 24px;
  backdrop-filter: blur(16px);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  text-align: center;
}
.stat:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    var(--shadow-lg),
    0 0 15px rgba(255, 255, 255, 0.03);
}
.stat b {
  display: block;
  font-size: 2.2rem;
  color: var(--text-white);
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.2;
}
.stat span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  display: inline-block;
}

/* Sticky Navbar Tabs */
.tabs {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glow);
  margin-bottom: 35px;
}

.tabbar {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 0;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-full);
  background: var(--bg-slate-800);
  color: var(--text-muted);
  padding: 10px 22px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-title);
}
.tab:hover {
  border-color: var(--text-white);
  color: var(--text-white);
}
.tab[aria-selected="true"] {
  background: var(--text-white);
  color: var(--bg-slate-900);
  border-color: var(--text-white);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.25);
  font-weight: 700;
}

/* Section headings */
.section-head {
  margin-bottom: 30px;
}
.section-head h2 {
  font-size: 2rem;
  margin-bottom: 8px;
}
.section-head p.muted {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Activity Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 28px;
}

/* Premium Card Design */
.activity {
  background: var(--bg-slate-800);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  backdrop-filter: blur(16px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.activity::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--accent-gradient, var(--accent));
  opacity: 0.8;
  transition: opacity 0.3s ease;
}
.activity:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    var(--shadow-lg),
    0 0 25px rgba(139, 92, 246, 0.1);
}
.activity.done {
  border-color: var(--success);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.08);
}
.activity.done::before {
  background: var(--success);
}

.activity h3 {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-white);
}

.meta {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-slate-700);
  color: var(--text-muted);
}
.pill.accent {
  background: var(--accent-light);
  color: var(--text-white);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Forms / Interactive Fields */
.activity-interactive-area {
  background: var(--bg-slate-900);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

textarea,
input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--bg-slate-800);
  color: var(--text-white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
textarea:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.2);
}
/* Native dropdown popup options: force dark bg + light text so the
   open menu is readable (otherwise options render light-on-white). */
select option,
select optgroup {
  background: var(--bg-slate-800);
  color: var(--text-white);
}

/* Instant correct/incorrect feedback on graded dropdowns and fill-in fields */
select.sel-correct,
input.sel-correct {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
select.sel-incorrect,
input.sel-incorrect {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}
.sel-mark {
  font-weight: 800;
  margin-left: 8px;
  font-size: 1.05rem;
  line-height: 1;
}
.sel-mark.ok {
  color: var(--success);
}
.sel-mark.no {
  color: var(--danger);
}

/* Buttons */
.actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  flex-wrap: wrap;
}

.btn {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  background: var(--accent-gradient, var(--accent));
  color: var(--text-white);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  filter: brightness(1.1);
  box-shadow:
    var(--shadow-md),
    0 0 15px rgba(139, 92, 246, 0.2);
}
.btn:active {
  transform: scale(0.97);
}
.btn.secondary {
  background: var(--bg-slate-700);
  color: var(--text-white);
  border-color: var(--border-glow);
}
.btn.secondary:hover {
  background: var(--bg-slate-800);
  border-color: var(--text-muted);
}

/* Drag and Drop styles */
.drop-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 64px;
  background: var(--bg-slate-800);
  border: 2px dashed var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 10px;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.drop-container.dragover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-white);
}

.drag-item {
  background: var(--bg-slate-700);
  border: 1px solid var(--border-glow);
  border-radius: 6px;
  padding: 8px 16px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  /* Let the touch fallback handle drags instead of scrolling the page. */
  touch-action: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.2s;
}
.drag-item:hover {
  background: var(--bg-slate-800);
}
.drag-item:active {
  cursor: grabbing;
}
.drag-item.dragging {
  opacity: 0.5;
  transform: scale(0.94);
}
/* Floating clone that follows the finger during a touch drag. */
.drag-item.drag-ghost {
  opacity: 0.9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transform: scale(1.04);
}

/* HTML5 Canvas and Game HUDs */
.game-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border: 2px solid var(--border-glow);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow-lg);
}
.game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.game-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-title);
  color: #ffffff;
  font-size: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  font-weight: 700;
  z-index: 5;
}
.game-score-card {
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #ffffff;
  z-index: 10;
  text-align: center;
  padding: 20px;
}
.game-overlay h4 {
  font-size: 2.2rem;
  font-family: var(--font-title);
  margin-bottom: 4px;
}

/* Side-by-Side Reading Layout (Splits Screen) */
.reading-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 15px;
}
@media (min-width: 900px) {
  .reading-layout {
    grid-template-columns: 1.2fr 1fr;
  }
}

.passage-panel {
  background: var(--bg-slate-800);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 24px;
  max-height: 480px;
  overflow-y: auto;
  font-size: 1.05rem;
  line-height: 1.8;
  color: #e2e8f0;
}
.questions-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Word bank */
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-slate-900);
  border: 1px dashed var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}

/* Feedback elements */
.feedback-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.feedback-msg.show {
  opacity: 1;
}
.feedback-msg.correct {
  color: var(--success);
}
.feedback-msg.incorrect {
  color: var(--danger);
}

/* Subject Gradient Overrides */
body[data-subject="english"] {
  --accent: #a855f7;
  --accent-light: rgba(168, 85, 247, 0.15);
  --accent-gradient: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --border-focus: #ec4899;
}
body[data-subject="math"] {
  --accent: #06b6d4;
  --accent-light: rgba(6, 182, 212, 0.15);
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --border-focus: #3b82f6;
}
body[data-subject="science"] {
  --accent: #10b981;
  --accent-light: rgba(16, 185, 129, 0.15);
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #84cc16 100%);
  --border-focus: #84cc16;
}
body[data-subject="civics"] {
  --accent: #2563eb;
  --accent-light: rgba(37, 99, 235, 0.15);
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #f59e0b 100%);
  --border-focus: #f59e0b;
}
body[data-subject="hebrew"] {
  --accent: #f97316;
  --accent-light: rgba(249, 115, 22, 0.15);
  --accent-gradient: linear-gradient(135deg, #f97316 0%, #b45309 100%);
  --border-focus: #b45309;
}
body[data-subject="panther"] {
  --accent: #6366f1;
  --accent-light: rgba(99, 102, 241, 0.15);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --border-focus: #4f46e5;
}
body[data-subject="genz"] {
  --accent: #ec4899;
  --accent-light: rgba(236, 72, 153, 0.15);
  --accent-gradient: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  --border-focus: #8b5cf6;
}

/* Additional Resources / Learn More */
.resources {
  margin-top: 50px;
  padding-top: 10px;
}
.resources .section-head {
  margin-bottom: 22px;
}
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.res-card {
  background: var(--bg-slate-800);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 22px;
  border-top: 3px solid var(--accent);
}
.res-card h3 {
  font-size: 1.05rem;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.res-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 14px;
  line-height: 1.5;
}
.res-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.res-card a {
  display: block;
  color: var(--text-white);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-slate-900);
  border: 1px solid var(--border-glow);
  transition:
    border-color 0.2s ease,
    transform 0.15s ease;
}
.res-card a:hover,
.res-card a:focus-visible {
  border-color: var(--accent);
  transform: translateX(3px);
}
.res-card a::before {
  content: "↗";
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}
.res-card a .res-desc {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  margin: 2px 0 0 22px;
}

/* Footer */
.footer {
  padding: 40px 0 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--border-glow);
  margin-top: 60px;
  font-weight: 500;
}
