/* ============================================
   STUDENT TOOLS — Dark Sleek Modern Theme
   ============================================

   Linked files:
   - index.html (landing page)
   - math.html, studying.html, writing.html (sub-sites)
   - app.js (application logic and interactivity)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #07070d;
  --bg-secondary: #0e0e18;
  --bg-card: #12121e;
  --bg-card-hover: #181828;
  --bg-input: #0c0c16;
  --border-subtle: rgba(255,255,255,0.06);
  --border-accent: rgba(0,212,255,0.2);
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --accent-cyan: #00d4ff;
  --accent-cyan-dim: rgba(0,212,255,0.15);
  --accent-purple: #7c3aed;
  --accent-purple-dim: rgba(124,58,237,0.15);
  --accent-green: #00e68a;
  --accent-red: #ff4466;
  --accent-orange: #ff8c00;
  --accent-yellow: #ffd700;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-glow: 0 0 30px rgba(0,212,255,0.08);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --font-display: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background grain texture */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* ---- LAYOUT ---- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-smooth);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}

.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 12px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border-color: var(--border-accent);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.sidebar-footer a:hover { color: var(--accent-cyan); }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 32px 40px;
  min-height: 100vh;
}

.main-header {
  margin-bottom: 32px;
}

.main-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.main-header p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 4px;
}

/* ---- TOOL PANELS ---- */
.tool-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  transition: all var(--transition-smooth);
  box-shadow: var(--shadow-card);
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-dim);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #00a8cc);
  color: #000;
  border: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,212,255,0.3);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ---- RESULTS ---- */
.result-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  min-height: 60px;
  position: relative;
  overflow-x: auto;
}

.result-box:empty::before {
  content: 'Results will appear here...';
  color: var(--text-muted);
  font-style: italic;
}

.result-box .result-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.result-box .result-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-box .result-step {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.result-box .result-step:last-child { border-bottom: none; }

.result-highlight {
  color: var(--accent-cyan);
  font-weight: 600;
}

.result-success { color: var(--accent-green); }
.result-error { color: var(--accent-red); }

/* ---- HOME GRID ---- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.home-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.home-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.home-card:hover::before { opacity: 1; }

.home-card .card-emoji {
  font-size: 28px;
  margin-bottom: 12px;
}

.home-card .card-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.home-card .card-courses {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

.home-card .card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- GRAPH CANVAS ---- */
.graph-container {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  margin-top: 16px;
  position: relative;
}

.graph-container canvas {
  width: 100%;
  border-radius: var(--radius-sm);
}

/* ---- UNIT CIRCLE ---- */
.unit-circle-container {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.unit-circle-container canvas {
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

/* ---- STATS TABLE ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.stat-card .stat-value {
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

/* ---- TOGGLE BUTTONS ---- */
.toggle-group {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.toggle-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-family: var(--font-mono);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.toggle-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* ---- AD PLACEHOLDER ---- */
.ad-placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin: 24px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- MOBILE HAMBURGER ---- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 20px;
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 24px 16px;
    padding-top: 24px;
  }
  .mobile-toggle {
    display: none;
  }
  .mobile-overlay.open {
    display: block;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .kittle-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .unit-circle-container {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .main-header h1 { font-size: 22px; }
  .card { padding: 20px; }
}

/* ---- LEGAL PAGES ---- */
.legal-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
}

.legal-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.legal-page .legal-date {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 32px;
  font-family: var(--font-mono);
}

.legal-page h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--accent-cyan);
}

.legal-page p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.7;
}

.legal-page a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.legal-page a:hover {
  text-decoration: underline;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 24px;
  transition: color var(--transition-fast);
}
.legal-back:hover { color: var(--accent-cyan); }

/* ---- COOKIE BANNER ---- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 999;
  font-size: 13px;
  color: var(--text-secondary);
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-banner a { color: var(--accent-cyan); text-decoration: none; }
.cookie-banner a:hover { text-decoration: underline; }

/* ---- TABS WITHIN TOOLS ---- */
.tool-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}

.tool-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
}

.tool-tab:hover { color: var(--text-primary); }
.tool-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

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

/* ---- SPECIAL ANIMATIONS ---- */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,212,255,0.2); }
  50% { box-shadow: 0 0 20px 4px rgba(0,212,255,0.1); }
}

.pulse { animation: pulse-glow 2s infinite; }

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

.animate-in {
  animation: slideUp 0.4s ease forwards;
}

/* Staggered animation for home cards */
.home-card:nth-child(1) { animation-delay: 0.05s; }
.home-card:nth-child(2) { animation-delay: 0.1s; }
.home-card:nth-child(3) { animation-delay: 0.15s; }
.home-card:nth-child(4) { animation-delay: 0.2s; }
.home-card:nth-child(5) { animation-delay: 0.25s; }
.home-card:nth-child(6) { animation-delay: 0.3s; }
.home-card:nth-child(7) { animation-delay: 0.35s; }
.home-card:nth-child(8) { animation-delay: 0.4s; }
.home-card:nth-child(9) { animation-delay: 0.45s; }
.home-card:nth-child(10) { animation-delay: 0.5s; }
.home-card:nth-child(11) { animation-delay: 0.55s; }
.home-card:nth-child(12) { animation-delay: 0.6s; }

/* ---- HOME FOOTER NOTICE ---- */
.home-footer-notice {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.home-footer-notice p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.home-footer-notice a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.home-footer-notice a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

/* ---- HOME KITTLE WALL LINK ---- */
.home-kittle-wall-link {
  margin-top: 12px;
  text-align: center;
}

.home-kittle-wall-link p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.home-kittle-wall-link a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.home-kittle-wall-link a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

/* ============================================
   STUDY TOOLS — Flashcards & Quizzes
   ============================================ */

/* ---- DECK / SET GRID ---- */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.deck-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.deck-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.deck-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.deck-card:hover::after { opacity: 1; }

.deck-card .deck-emoji { font-size: 24px; margin-bottom: 8px; }

.deck-card .deck-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.deck-card .deck-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.deck-card .deck-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.deck-card .deck-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.deck-card .deck-actions button:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.deck-card .deck-actions .btn-danger:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* ---- CREATE DECK CARD (+ button) ---- */
.deck-card-new {
  background: var(--bg-card);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-smooth);
  min-height: 140px;
}

.deck-card-new:hover {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.deck-card-new .plus-icon {
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 8px;
  transition: color var(--transition-fast);
}
.deck-card-new:hover .plus-icon { color: var(--accent-cyan); }

.deck-card-new span {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   KITTLE WALL — Photo Gallery
   ============================================ */

/* ---- KITTLE GRID ---- */
.kittle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.kittle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-smooth);
  position: relative;
  aspect-ratio: 1;
}

.kittle-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.kittle-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kittle-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  grid-column: 1 / -1;
}

/* ---- FLASHCARD FLIP ---- */
.flashcard-scene {
  perspective: 1000px;
  width: 100%;
  max-width: 560px;
  height: 320px;
  margin: 0 auto 24px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border-radius: var(--radius-lg);
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.flashcard-front {
  background: linear-gradient(135deg, #12121e 0%, #18182a 100%);
  border-top: 3px solid var(--accent-cyan);
}

.flashcard-back {
  background: linear-gradient(135deg, #12121e 0%, #1a1830 100%);
  transform: rotateY(180deg);
  border-top: 3px solid var(--accent-purple);
}

.flashcard-side-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.flashcard-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  word-wrap: break-word;
  width: 100%;
}

.flashcard-back .flashcard-text {
  color: var(--accent-green);
}

/* ---- FLASHCARD CONTROLS ---- */
.fc-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.fc-controls .btn {
  min-width: 110px;
}

.fc-progress {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.fc-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin: 8px auto 0;
  overflow: hidden;
}

.fc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ---- CARD EDITOR ---- */
.card-editor-list {
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.card-editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.card-editor-row:last-child { border-bottom: none; }

.card-editor-row .card-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  grid-column: 1 / -1;
  margin-bottom: -4px;
}

.card-delete-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-delete-btn:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(255,68,102,0.1);
}

/* ---- QUIZ STYLES ---- */
.quiz-question-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  transition: all var(--transition-smooth);
}

.quiz-question-block.correct {
  border-color: var(--accent-green);
  background: rgba(0,230,138,0.05);
}

.quiz-question-block.incorrect {
  border-color: var(--accent-red);
  background: rgba(255,68,102,0.05);
}

.quiz-q-number {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.quiz-q-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 14px;
  color: var(--text-secondary);
}

.quiz-option:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  background: var(--accent-cyan-dim);
}

.quiz-option.selected {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.quiz-option.reveal-correct {
  border-color: var(--accent-green) !important;
  color: var(--accent-green) !important;
  background: rgba(0,230,138,0.1) !important;
}

.quiz-option.reveal-wrong {
  border-color: var(--accent-red) !important;
  color: var(--accent-red) !important;
  background: rgba(255,68,102,0.1) !important;
}

.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.quiz-option.selected .quiz-option-letter {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

.quiz-option.reveal-correct .quiz-option-letter {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
}

.quiz-option.reveal-wrong .quiz-option-letter {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

/* True/False special */
.quiz-tf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quiz-tf-row .quiz-option {
  justify-content: center;
  font-weight: 600;
  font-family: var(--font-display);
}

/* ---- QUIZ SCORE ---- */
.quiz-score-box {
  text-align: center;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
}

.quiz-score-number {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.quiz-score-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.quiz-score-message {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-top: 16px;
  color: var(--text-primary);
}

/* ---- QUIZ EDITOR ---- */
.quiz-editor-question {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
}

.quiz-editor-question .qe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.quiz-editor-question .qe-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.qe-type-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.qe-type-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.qe-type-btn.active {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.quiz-editor-question .qe-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.qe-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qe-option-row input[type="text"] {
  flex: 1;
}

.qe-correct-radio {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  position: relative;
}

.qe-correct-radio:checked {
  border-color: var(--accent-green);
  background: var(--accent-green);
}

.qe-correct-radio:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #000;
  font-weight: 700;
}

.qe-correct-radio:hover {
  border-color: var(--accent-green);
}

/* ---- STUDY MODE SHUFFLE BADGE ---- */
.shuffle-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 15px;
  font-family: var(--font-display);
  margin-bottom: 20px;
  color: var(--text-secondary);
}

/* ---- MODAL OVERLAY ---- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ---- BACK BUTTON ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 20px;
  transition: color var(--transition-fast);
  background: none;
  border: none;
}
.back-link:hover { color: var(--accent-cyan); }

/* ---- SEPARATOR WITH LABEL ---- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.section-divider span {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============================================
   GRAMMAR CHECKER — Writing Tool Styles
   ============================================ */

/* ---- TEXTAREA ENHANCEMENTS ---- */
#gc-input {
  min-height: 220px;
  line-height: 1.8;
  font-family: var(--font-body);
  font-size: 15px;
  resize: vertical;
}

.gc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.gc-word-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- SCORE RING ---- */
.gc-score-row {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.gc-score-circle {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.gc-score-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gc-ring-bg {
  fill: none;
  stroke: var(--bg-input);
  stroke-width: 8;
}

.gc-ring-fill {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.gc-score-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.gc-score-info {
  flex: 1;
  min-width: 200px;
}

.gc-score-label {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.gc-score-detail {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- FILTER BUTTONS ---- */
.gc-filter-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.gc-filter-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.gc-filter-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

.gc-filter-btn.active {
  background: var(--accent-cyan-dim);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ---- ISSUE CARDS ---- */
.gc-issue {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.gc-issue::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
}

.gc-issue[data-type="grammar"]::before { background: var(--accent-red); }
.gc-issue[data-type="spelling"]::before { background: var(--accent-orange); }
.gc-issue[data-type="punctuation"]::before { background: var(--accent-yellow); }
.gc-issue[data-type="style"]::before { background: var(--accent-purple); }

.gc-issue:hover {
  border-color: var(--border-accent);
}

.gc-issue.gc-issue-fixed {
  opacity: 0.4;
  pointer-events: none;
}

.gc-issue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.gc-issue-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gc-issue[data-type="grammar"] .gc-issue-badge {
  background: rgba(255,68,102,0.12);
  color: var(--accent-red);
}
.gc-issue[data-type="spelling"] .gc-issue-badge {
  background: rgba(255,140,0,0.12);
  color: var(--accent-orange);
}
.gc-issue[data-type="punctuation"] .gc-issue-badge {
  background: rgba(255,215,0,0.12);
  color: var(--accent-yellow);
}
.gc-issue[data-type="style"] .gc-issue-badge {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.gc-issue-context {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.gc-issue-context .gc-highlight-bad {
  background: rgba(255,68,102,0.15);
  color: var(--accent-red);
  padding: 1px 4px;
  border-radius: 3px;
  text-decoration: line-through;
  text-decoration-color: rgba(255,68,102,0.4);
}

.gc-issue-context .gc-highlight-good {
  background: rgba(0,230,138,0.12);
  color: var(--accent-green);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}

.gc-issue-explain {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.gc-issue-actions {
  display: flex;
  gap: 6px;
}

.gc-issue-actions button {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.gc-issue-actions button.gc-fix-btn:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(0,230,138,0.08);
}

.gc-issue-actions button.gc-ignore-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ---- CORRECTED TEXT BOX ---- */
.gc-corrected-text {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ---- COPY TOAST ---- */
.gc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent-green);
  color: #000;
  padding: 10px 24px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  z-index: 600;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

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

/* ---- CHARACTER CUTTER ---- */
.lt-char-cutter {
  margin-bottom: 12px;
}

.lt-char-bar-wrap {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.lt-char-fill {
  height: 100%;
  width: 0;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: width 0.15s ease, background 0.3s ease;
}

.lt-char-fill.lt-char-warn {
  background: var(--accent-orange);
}

.lt-char-fill.lt-char-over {
  background: var(--accent-red);
}

.lt-char-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lt-char-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.lt-char-warning {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-orange);
  padding: 8px 12px;
  background: rgba(255, 140, 0, 0.08);
  border: 1px solid rgba(255, 140, 0, 0.25);
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ============================================
   LANDING PAGE
   ============================================ */

.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

.landing-header {
  text-align: center;
  margin-bottom: 48px;
}

.landing-logo-icon {
  width: 64px;
  height: 64px;
  font-size: 28px;
  margin: 0 auto 20px;
}

.landing-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.landing-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.landing-desc {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 960px;
  width: 100%;
}

.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
  cursor: pointer;
  display: block;
}

.landing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

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

.landing-card:hover::before {
  opacity: 1;
}

.landing-card-math::before {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
}
.landing-card-math:hover {
  border-color: var(--accent-cyan);
}

.landing-card-study::before {
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
}
.landing-card-study:hover {
  border-color: var(--accent-green);
}

.landing-card-writing::before {
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-orange));
}
.landing-card-writing:hover {
  border-color: var(--accent-purple);
}

.landing-card-music::before {
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow));
}
.landing-card-music:hover {
  border-color: var(--accent-orange);
}

.landing-card-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.landing-card-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.landing-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.landing-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.landing-card-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-display);
}

.landing-footer {
  margin-top: 48px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.landing-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.landing-footer a:hover {
  color: var(--accent-cyan);
}

.landing-footer p {
  margin-bottom: 8px;
}

.landing-copyright {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .landing-title {
    font-size: 32px;
  }
  .landing-cards {
    grid-template-columns: 1fr;
  }
  .landing-card {
    padding: 28px 20px;
  }
}

/* ============================================
   GAME STUDY — Quiz Blaster arcade styles
   ============================================ */
.gs-source-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}
.gs-tab-btn {
  flex: 1 1 140px;
  min-height: 42px;
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.gs-tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}
.gs-tab-btn.active {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}
.gs-tab-panel { display: none; }
.gs-tab-panel.active { display: block; animation: gsFade 0.25s ease; }

.gs-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}
.gs-hint code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
}

.gs-settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .gs-settings-row { grid-template-columns: 1fr; }
}

.gs-highscore-card {
  margin-top: 18px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(124,58,237,0.1));
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.gs-hs-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent-yellow);
  text-transform: uppercase;
}
.gs-hs-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-yellow);
}

/* -- HUD -- */
.gs-hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.gs-hud-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
  min-width: 0;
}
.gs-hud-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.gs-hud-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
@media (max-width: 560px) {
  .gs-hud { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .gs-hud-item { padding: 8px 4px; }
  .gs-hud-label { font-size: 9px; letter-spacing: 0.5px; }
  .gs-hud-value { font-size: 16px; }
}

/* -- Timer bar -- */
.gs-timer-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.gs-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  transition: width 0.1s linear, background 0.3s ease;
}

/* -- Stage -- */
.gs-stage {
  background: linear-gradient(160deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.gs-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(0,212,255,0.08), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(124,58,237,0.08), transparent 40%);
  pointer-events: none;
}

.gs-question-card {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 18px;
  box-shadow: 0 0 24px rgba(0,212,255,0.08) inset;
}
.gs-q-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}
@media (max-width: 560px) {
  .gs-q-text { font-size: 18px; }
  .gs-question-card { padding: 18px 14px; min-height: 80px; }
  .gs-stage { padding: 16px; }
}

.gs-pulse { animation: gsPulse 0.4s ease; }
.gs-shake { animation: gsShake 0.4s ease; }
@keyframes gsPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(0,230,138,0); }
  50% { transform: scale(1.02); box-shadow: 0 0 40px rgba(0,230,138,0.35); }
  100% { transform: scale(1); }
}
@keyframes gsShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes gsFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.gs-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  position: relative;
}
@media (max-width: 560px) {
  .gs-options-grid { grid-template-columns: 1fr; gap: 10px; }
}

.gs-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  min-height: 60px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.gs-option-btn:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,212,255,0.15);
}
.gs-option-btn:active:not(:disabled) {
  transform: translateY(0);
}
.gs-option-btn:disabled {
  cursor: default;
  opacity: 0.85;
}
.gs-option-letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.gs-option-text {
  flex: 1;
  word-break: break-word;
}
.gs-option-btn.gs-correct {
  border-color: var(--accent-green);
  background: rgba(0,230,138,0.12);
  color: var(--accent-green);
  animation: gsPulse 0.4s ease;
}
.gs-option-btn.gs-correct .gs-option-letter {
  background: var(--accent-green);
  color: #000;
}
.gs-option-btn.gs-wrong {
  border-color: var(--accent-red);
  background: rgba(255,68,102,0.12);
  color: var(--accent-red);
}
.gs-option-btn.gs-wrong .gs-option-letter {
  background: var(--accent-red);
  color: #fff;
}

.gs-feedback {
  text-align: center;
  margin-top: 14px;
  min-height: 24px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}
.gs-fb-correct { color: var(--accent-green); }
.gs-fb-wrong { color: var(--accent-red); }

/* -- Game Over -- */
.gs-gameover-box {
  max-width: 520px;
  margin: 40px auto;
  background: linear-gradient(160deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.gs-gameover-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 12px;
}
.gs-gameover-score {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 800;
  color: var(--accent-yellow);
  line-height: 1;
  margin: 12px 0;
  text-shadow: 0 0 30px rgba(255,215,0,0.3);
}
.gs-gameover-msg {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.gs-gameover-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.gs-stat {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.gs-stat span { color: var(--text-muted); }
.gs-stat b {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 15px;
}
@media (max-width: 560px) {
  .gs-gameover-box { padding: 24px 18px; }
  .gs-gameover-score { font-size: 48px; }
  .gs-gameover-stats { grid-template-columns: 1fr; }
}
