/* ==========================================================================
   Deutsch Warm-up App - Middle School Gamified Stylesheet
   Playful, Vibrant 3D Push Buttons, Gaming Color Themes & Glassmorphism
   ========================================================================== */

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

:root {
  /* Vibrant Gamified Palette */
  --bg-gradient: linear-gradient(135deg, #090d16 0%, #111827 30%, #1e1b4b 70%, #311042 100%);
  --card-bg-front: linear-gradient(145deg, #ffffff 0%, #f8fafc 70%, #f1f5f9 100%);
  --card-bg-back: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 50%, #e0e7ff 100%);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.5);

  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;

  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-light);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Floating Ambient Orbs */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  left: -10%;
  width: 55vw;
  height: 55vw;
  max-width: 600px;
  max-height: 600px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 12s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  bottom: -15%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  max-width: 650px;
  max-height: 650px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.22) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 16s ease-in-out infinite alternate-reverse;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(35px, 25px) scale(1.08);
  }

  100% {
    transform: translate(-20px, 45px) scale(0.95);
  }
}

/* Main Container Layout */
.app-container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  z-index: 1;
  position: relative;
}

/* Header Navbar */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 10px 22px rgba(255, 65, 108, 0.45);
  transform: rotate(-5deg);
  transition: transform 0.35s cubic-bezier(0.34, 1.7, 0.64, 1);
  cursor: pointer;
  user-select: none;
}

.brand:hover .brand-icon {
  transform: rotate(0deg) scale(1.12);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
  color: #a5b4fc;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 30px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.btn-icon-label:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

/* Control Panel Section */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--glass-shadow);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.control-label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 135px;
}

/* Playful Gamified Grade Selection Pills */
.grade-pills {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.grade-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  color: #cbd5e1;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.grade-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Individual Grade Color Themes */
.grade-btn.grade-5.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.55);
}

.grade-btn.grade-6.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.55);
}

.grade-btn.grade-7.active {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.55);
}

.grade-btn.grade-8.active {
  background: linear-gradient(135deg, #ec4899 0%, #e11d48 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.55);
}

/* Unit Selection Grid & Pills */
.units-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.unit-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.unit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm-text {
  background: transparent;
  border: none;
  color: #a5b4fc;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-sm-text:hover {
  color: #fff;
}

.units-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 135px;
  overflow-y: auto;
  padding-right: 4px;
}

.units-grid::-webkit-scrollbar {
  width: 5px;
}

.units-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}

.unit-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.unit-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.unit-chip input[type="checkbox"] {
  accent-color: var(--accent-pink);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.unit-chip.active {
  background: rgba(99, 102, 241, 0.28);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

/* Question Count Badge */
.badge-count {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  letter-spacing: 0.02em;
}

/* Warm-up Timer Digital Bar */
.timer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 20px;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid var(--glass-border);
  border-radius: 30px;
  margin: 0 auto 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
}

.timer-clock {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.35rem;
  color: #fbbf24;
  min-width: 60px;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
  letter-spacing: 0.05em;
}

.timer-btn {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ==========================================================================
   3D GAMIFIED FLASHCARD STAGE
   ========================================================================== */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  margin: 10px 0 24px;
  width: 100%;
}

.card-scene {
  width: 100%;
  max-width: 660px;
  height: clamp(350px, 46vh, 420px);
  position: relative;
  cursor: pointer;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.34, 1.4, 0.64, 1);
  border-radius: var(--radius-xl);
}

.card-scene.is-flipped .card-inner {
  transform: rotateY(180deg);
}

/* Card Sides Common */
.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: clamp(22px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 35px 70px -15px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

/* Front Face */
.card-front {
  background: var(--card-bg-front);
  color: var(--text-main);
}

/* Back Face */
.card-back {
  background: var(--card-bg-back);
  color: var(--text-main);
  transform: rotateY(180deg);
}

/* Card Header Bar */
.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(99, 102, 241, 0.14);
  color: var(--primary-hover);
  border-radius: 20px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.84rem;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.card-flip-hint {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Card Body Content */
.card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0;
  gap: 14px;
  flex: 1;
  width: 100%;
}

.question-text {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 4.4vw, 2.3rem);
  font-weight: 900;
  color: #0f172a;
  line-height: 1.35;
  letter-spacing: -0.02em;
  word-break: break-word;
}

/* Playful Sticky-Note Hint Box */
.hint-container {
  display: none;
  background: #fffbeb;
  border: 2px dashed #f59e0b;
  color: #92400e;
  padding: 10px 20px;
  border-radius: 16px;
  font-size: clamp(0.85rem, 2.5vw, 0.98rem);
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
}

.hint-container.visible {
  display: block;
}

.answer-box {
  background: #ffffff;
  border: 2.5px solid #818cf8;
  padding: 16px 22px;
  border-radius: var(--radius-md);
  width: 100%;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.18);
}

.answer-title {
  font-size: 0.78rem;
  font-weight: 900;
  color: #4338ca;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.answer-text {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 3.6vw, 1.5rem);
  font-weight: 800;
  color: #1e1b4b;
  word-break: break-word;
}

/* Card Footer Bar */
.card-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.btn-sound {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  border: 2px solid #818cf8;
  color: #4338ca;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.7, 0.64, 1);
  box-shadow: 0 6px 16px rgba(67, 56, 202, 0.25);
  flex-shrink: 0;
}

.btn-sound:hover {
  background: #4338ca;
  color: #fff;
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 8px 24px rgba(67, 56, 202, 0.4);
}

.btn-toggle-hint {
  padding: 9px 18px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  color: #334155;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle-hint:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

/* ==========================================================================
   3D TACTILE PUSHABLE BUTTONS (DUOLINGO & KAHOOT GAMIFIED STYLE)
   ========================================================================== */

.stage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  width: 100%;
  max-width: 660px;
}

/* Equal Dimension 3D Pushable Buttons */
.btn-main-action,
.btn-secondary-action {
  flex: 1 1 0px;
  width: 50%;
  min-width: 0;
  padding: 16px 20px;
  border-radius: 40px;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateY(0);
}

/* Primary Action Button: Emerald Green 3D Push Button */
.btn-main-action {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-bottom: 5px solid #047857;
  /* 3D tactile bottom bevel */
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.45);
}

.btn-main-action:hover {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(16, 185, 129, 0.6);
}

.btn-main-action:active {
  transform: translateY(3px);
  /* 3D Push down physics */
  border-bottom-width: 2px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

/* Specific Style for "🎉 Bildim!" Button: Star Gold 3D Push Button */
#btnCelebrate {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  border: none;
  border-bottom: 5px solid #b45309;
  color: #78350f;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.45);
}

#btnCelebrate:hover {
  background: linear-gradient(180deg, #fcd34d 0%, #fbbf24 100%);
  color: #451a03;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(245, 158, 11, 0.6);
}

#btnCelebrate:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   MODAL WINDOWS (GLASSMORPHISM)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #1e293b;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: clamp(20px, 4vw, 32px);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  color: #f8fafc;
  box-shadow: 0 35px 75px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  font-weight: 900;
  color: #fff;
}

.btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.6rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
}

.text-input {
  width: 100%;
  padding: 12px 16px;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.sheet-instructions {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #94a3b8;
}

.sheet-instructions ol {
  padding-left: 18px;
  margin-top: 8px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

@media (max-width: 1024px) {
  .app-container {
    padding: 16px 16px;
  }
}

@media (max-width: 840px) {
  .app-header {
    padding: 14px 18px;
    margin-bottom: 16px;
  }

  .control-panel {
    padding: 16px 18px;
    margin-bottom: 16px;
    gap: 14px;
  }

  .card-scene {
    height: 360px;
  }

  .stage-controls {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 12px 12px;
  }

  .app-header {
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
  }

  .brand {
    gap: 10px;
  }

  .brand-icon {
    width: 44px;
    height: 44px;
    font-size: 24px;
    border-radius: 14px;
  }

  .btn-icon-label {
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  .control-panel {
    padding: 14px 14px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
  }

  .control-label {
    min-width: 100%;
    margin-bottom: 2px;
    font-size: 0.9rem;
  }

  .grade-pills {
    width: 100%;
    gap: 8px;
  }

  .grade-btn {
    padding: 9px 14px;
    font-size: 0.88rem;
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .unit-top-bar {
    align-items: flex-start;
  }

  .units-grid {
    max-height: 125px;
    gap: 6px;
  }

  .unit-chip {
    padding: 7px 12px;
    font-size: 0.82rem;
    border-radius: 10px;
  }

  .timer-bar {
    padding: 6px 14px;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
    justify-content: space-around;
  }

  .timer-clock {
    font-size: 1.15rem;
    min-width: 50px;
  }

  .timer-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .card-scene {
    height: 330px;
  }

  .card-face {
    padding: 18px 16px;
  }

  .question-text {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }

  .answer-text {
    font-size: clamp(1rem, 4vw, 1.25rem);
  }

  .answer-box {
    padding: 12px 14px;
  }

  .btn-sound {
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
  }

  .btn-toggle-hint {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  .stage-controls {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .btn-main-action,
  .btn-secondary-action {
    width: 100%;
    flex: 1 1 100%;
    padding: 15px 20px;
    justify-content: center;
  }

  .modal-card {
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }

  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-footer>div {
    flex-direction: column;
    width: 100%;
  }

  .modal-footer button {
    width: 100%;
    justify-content: center;
  }
}

/* Version Badge */
.version-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* App Footer Signature */
.app-footer {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-text {
  font-size: 0.88rem;
  color: #cbd5e1;
  font-weight: 500;
}

.footer-text strong {
  color: #ffffff;
  font-weight: 700;
}

.footer-badge {
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-lang-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* ==========================================================================
   A4 PRINT & HTML2PDF EXPORT STYLES
   Exact 8 Cards per A4 Page (2 Cols x 4 Rows Duplex Front & Back Grid)
   ========================================================================== */

.print-area {
  display: none;
  background: #ffffff;
  color: #0f172a;
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

/* A4 Page Container */
.print-page {
  width: 190mm;
  height: 265mm;
  max-height: 265mm;
  margin: 0 auto;
  page-break-after: always;
  break-after: page;
  page-break-inside: avoid;
  break-inside: avoid;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4mm;
  box-sizing: border-box;
  background: #ffffff;
  color: #0f172a;
  overflow: hidden;
}

.print-page:last-child,
.print-page:last-of-type {
  page-break-after: avoid !important;
  break-after: avoid !important;
  page-break-after: auto !important;
  break-after: auto !important;
}

.print-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #6366f1;
  padding-bottom: 4px;
  margin-bottom: 4mm;
  width: 100%;
  height: 10mm;
  box-sizing: border-box;
}

.print-page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 13pt;
  font-weight: 800;
  color: #1e1b4b;
}

.print-page-meta {
  font-size: 8.5pt;
  color: #475569;
  font-weight: 700;
}

/* 2 Column x 4 Row Grid of Cards */
.print-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 56mm);
  gap: 5mm 6mm;
  width: 100%;
  flex: 1;
}

.print-card {
  width: 100%;
  height: 56mm;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.print-card-placeholder {
  visibility: hidden;
  border: none;
  background: transparent;
}

/* Printable Question Card (Front Page) */
.print-card-question {
  background-color: #ffffff;
  border: 2px solid #94a3b8;
}

/* Printable Answer Card (Back Page) */
.print-card-answer {
  background-color: #f0f7ff;
  border: 2px solid #60a5fa;
}

.print-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.print-badge {
  font-size: 8pt;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.print-badge-q {
  background-color: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.print-badge-a {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.print-unit-tag {
  font-size: 7.5pt;
  color: #475569;
  font-weight: 700;
}

.print-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4px 0;
}

.print-question-text {
  font-family: 'Outfit', sans-serif;
  font-size: 12.5pt;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.print-answer-text {
  font-family: 'Outfit', sans-serif;
  font-size: 11.5pt;
  font-weight: 800;
  color: #1e3a8a;
}

.print-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7pt;
  color: #64748b;
  font-weight: 700;
}

/* Printer Specific Overrides */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  body::before, body::after {
    display: none !important;
  }

  .app-container,
  .app-header,
  .control-panel,
  .timer-bar,
  .stage,
  .modal-overlay,
  header, section, main, footer {
    display: none !important;
  }

  .print-area {
    display: block !important;
    width: 100% !important;
  }

  .print-card {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}