/* ─────────────────────────────────────────────────────────
   Febe ClassMaster — Playful Cloud-Glass Theme
   Vibrant, Cheerful & Playful Light Theme for Kids & Teachers
   ───────────────────────────────────────────────────────── */

:root {
  /* Cheerful Child-Friendly Pastel Colors */
  --bg-space: #f3f6ff; /* Soft pastel morning blue background */
  --bg-surface: rgba(255, 255, 255, 0.75); /* Soft white glass clouds */
  --bg-surface-hover: rgba(255, 255, 255, 0.9);
  --border: rgba(255, 255, 255, 0.6); /* Soft glass boundary */
  --border-neon: rgba(99, 102, 241, 0.15); /* Soft Indigo border */
  --border-neon-hover: rgba(99, 102, 241, 0.35);
  --primary-neon: #6366f1; /* Cheerful Indigo Violet */
  --primary-neon-hover: #8b5cf6; /* Candy Purple */
  --secondary-neon: #10b981; /* Mint Green */
  --accent-neon: #fbbf24; /* Sun Gold */
  
  --text-main: #1e293b; /* Readable Slate Grey */
  --text-muted: #64748b; /* Soft Muted Slate */
  
  /* Playful System Sizing */
  --sidebar-width: 280px;
  --radius-lg: 24px; /* Playful large round corner */
  --radius-md: 16px; /* Playful medium round corner */
  --radius-sm: 10px; /* Playful small round corner */
  --transition-elastic: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-smooth: all 0.25s ease;
  
  /* Fluffy Soft Drop Shadows & Glows */
  --glow-primary: 0 8px 22px rgba(99, 102, 241, 0.2);
  --glow-secondary: 0 8px 22px rgba(16, 185, 129, 0.2);
  --shadow-dark: 0 10px 30px rgba(99, 102, 241, 0.05), 0 2px 4px rgba(99, 102, 241, 0.02);
  --shadow-paper: 0 20px 50px rgba(99, 102, 241, 0.08);
}

/* ─── BASE RESET ─────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Sans SC', sans-serif;
  background-color: var(--bg-space);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(244, 63, 94, 0.06) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.06) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  padding: 32px 0 24px;
  z-index: 100;
  position: relative;
  flex-shrink: 0;
}

.brand {
  display: flex;
  padding: 0 28px;
  margin-bottom: 36px;
}

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

.brand-logo {
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-neon) 0%, var(--primary-neon-hover) 100%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  box-shadow: var(--glow-primary);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 900;
  font-size: 20px;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--primary-neon-hover);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 1px;
}

.nav-menu {
  flex: 1;
  padding: 0 16px;
  overflow-y: auto;
}

.nav-menu::-webkit-scrollbar {
  width: 4px;
}
.nav-menu::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.15);
  border-radius: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition-elastic);
  margin: 8px 8px;
  color: var(--text-muted);
  position: relative;
  border: 1px solid transparent;
  font-weight: 700;
}

.nav-item:hover {
  background-color: rgba(99, 102, 241, 0.05);
  color: var(--primary-neon);
  transform: translateX(6px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary-neon) 0%, var(--primary-neon-hover) 100%);
  color: white;
  box-shadow: var(--glow-primary);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 25%;
  height: 50%;
  width: 4px;
  background: white;
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.06);
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.2);
}

.nav-text {
  font-size: 14px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(99, 102, 241, 0.08);
}

.user-profile {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-neon) 0%, var(--primary-neon-hover) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
  font-size: 18px;
  box-shadow: var(--glow-primary);
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: var(--primary-neon);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logout-btn {
  width: 100%;
  padding: 12px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-elastic);
}

.logout-btn:hover {
  background: #ef4444;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(239, 68, 68, 0.18);
}

/* ─── MAIN CONTENT ───────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.header {
  height: 80px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  flex-shrink: 0;
  z-index: 50;
}

.header-title-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.org-selector {
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  background-color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  min-width: 190px;
  transition: var(--transition-smooth);
}

.org-selector:hover {
  border-color: var(--primary-neon);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.org-selector:focus {
  border-color: var(--primary-neon);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ─── APP WORKSPACE GRID LAYOUT ───────────────────────── */
.app-workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  height: calc(100vh - 80px); /* Subtract header height */
  padding: 0 40px 24px 40px;
  overflow: hidden;
}

.app-workspace.full-width-workspace {
  grid-template-columns: 1fr;
}

.app-workspace.full-width-workspace .app-controls {
  display: none;
}

.app-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  overflow-y: auto;
  padding-right: 6px;
  padding-top: 10px;
}

.app-display {
  height: 100%;
  overflow-y: auto;
  padding-right: 6px;
  padding-top: 10px;
}

/* Sleek custom scrollbars */
.app-controls::-webkit-scrollbar,
.app-display::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.app-controls::-webkit-scrollbar-track,
.app-display::-webkit-scrollbar-track {
  background: transparent;
}

.app-controls::-webkit-scrollbar-thumb,
.app-display::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.15);
  border-radius: 3px;
}

.app-controls::-webkit-scrollbar-thumb:hover,
.app-display::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.3);
}

.tab-pane {
  display: none;
}

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

/* ─── CARDS & SECTIONS ────────────────────────────────── */
.card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-dark);
  transition: var(--transition-elastic);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-neon-hover);
  transform: translateY(-4px);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.08), 0 2px 5px rgba(0, 0, 0, 0.02);
}

.card-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.08);
  padding-bottom: 12px;
}

.card-title span {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 950;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.form-select, .form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(99, 102, 241, 0.15);
  background-color: rgba(255, 255, 255, 0.8);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-smooth);
}

.form-select:hover, .form-input:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background-color: #ffffff;
}

.form-select:focus, .form-input:focus {
  border-color: var(--primary-neon);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Chips selection grid */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(99, 102, 241, 0.18);
}

.chip {
  padding: 10px 16px;
  background: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-elastic);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip:hover {
  border-color: var(--primary-neon);
  color: var(--primary-neon);
  transform: translateY(-2px) scale(1.02);
}

.chip.active {
  background: linear-gradient(135deg, var(--primary-neon) 0%, var(--primary-neon-hover) 100%) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: var(--glow-primary);
}

/* Accordion for advanced parameters */
.accordion {
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.3);
}

.accordion-header {
  width: 100%;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  font-size: 12.5px;
  font-weight: 900;
  color: var(--primary-neon);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.8);
}

.accordion-body {
  padding: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-top: 1px solid rgba(99, 102, 241, 0.08);
  display: none;
}

.accordion.active .accordion-body {
  display: block;
}

/* ─── PREVIEW & ACTION CARD (STEP 3) ─────────────────── */
.preview-action-card {
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.6));
  box-shadow: 0 20px 50px rgba(99, 102, 241, 0.05);
}

.preview-container {
  min-height: 280px;
  background: #f8faff; /* Bright visual board background */
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  overflow: auto;
  max-height: 400px;
  box-shadow: inset 0 2px 8px rgba(99, 102, 241, 0.03);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.preview-container:has(.empty-preview) {
  align-items: center;
}

.empty-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: inherit;
  text-align: center;
}

.empty-preview i {
  font-size: 38px;
  margin-bottom: 14px;
  color: var(--primary-neon);
  filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.2));
}

.btn-primary {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, var(--primary-neon) 0%, var(--primary-neon-hover) 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  font-weight: 900;
  font-size: 15.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-elastic);
  box-shadow: var(--glow-primary);
}

.btn-primary:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.35);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  height: 48px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-elastic);
  margin-top: 12px;
}

.btn-secondary:hover {
  border-color: var(--primary-neon);
  color: var(--primary-neon);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.08);
}

/* ─── REALISTIC PHYSICAL PAPER VIEW ──────────────────── */
.print-page-container, #printable-area {
  background: #ffffff !important;
  color: #000000 !important;
  margin: 10px auto !important;
  box-shadow: var(--shadow-paper) !important;
  border-radius: 8px;
  transform-origin: top center;
  border: 1px solid rgba(99, 102, 241, 0.08);
}

/* A4 scaling is handled by JS zoomPreview() on #paper-a4-scaling-wrapper */
#paper-a4-scaling-wrapper {
  transform-origin: top center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-block;
}

#paper-preview {
  display: inline-block;
  background: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

/* ─── CLASSROOM PRESENTATION OVERLAY ─────────────────── */
.classroom-overlay {
  position: fixed;
  inset: 0;
  background: #FFF9E6; /* Eden Sunny Background */
  background-image: radial-gradient(rgba(224, 208, 176, 0.3) 2px, transparent 2px);
  background-size: 30px 30px;
  z-index: 1000;
  display: none;
  flex-direction: column;
  color: var(--text-main);
  user-select: none;
  padding: 40px;
  animation: fadeIn 0.3s ease-out;
}

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

.classroom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 850;
  color: var(--text-muted);
  border-bottom: 2px solid var(--v2-border-main, #E0D0B0);
  padding-bottom: 20px;
}

.classroom-close-btn {
  background: white;
  border: 3px solid #E0D0B0;
  color: #FF8A00;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 0 #E0D0B0;
  transition: all 0.1s;
}

.classroom-close-btn:hover {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #E0D0B0;
}

.classroom-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.classroom-number-display {
  font-size: 180px;
  font-weight: 900;
  font-family: 'Outfit', 'Fredoka One', 'Noto Sans SC', sans-serif;
  color: var(--text-main);
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s ease-out;
}

/* EdenAbacus Look Mode Styles (Vertical List) */
.v2-look-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px;
  min-width: 260px;
  background: white;
  border-radius: 24px;
  border: 4px solid #E0D0B0;
  box-shadow: 0 10px 0 #E0D0B0;
  margin: 20px 0;
}

.v2-look-item {
  font-size: 64px;
  font-weight: 900;
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
  display: grid;
  grid-template-columns: 0.5fr 1.5fr;
  align-items: center;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.v2-look-item.pos { color: #2196F3; }
.v2-look-item.neg { color: #FF5252; }

.v2-look-item .symbol {
  text-align: left;
  opacity: 0.8;
  padding-left: 10px;
}

.v2-look-item .val {
  text-align: right;
  padding-right: 10px;
}

.v2-look-divider {
  width: 100%;
  height: 4px;
  background: #4A4A4A;
  margin: 15px 0;
  border-radius: 2px;
}

@keyframes v2PulseQuick {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Circular glowing ring countdown wrapper */
.classroom-progress-bar-container {
  width: 60%;
  height: 20px;
  background: white;
  border-radius: 20px;
  margin-top: 50px;
  overflow: hidden;
  border: 3px solid #E0D0B0;
  box-shadow: 0 4px 0 #E0D0B0;
}

.classroom-progress-bar {
  height: 100%;
  width: 0%;
  background: #FF8A00;
  border-radius: 20px;
  transition: width 0.1s linear;
}

.classroom-footer {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
}

.btn-control {
  background: white;
  border: 3px solid #E0D0B0;
  color: #FF8A00;
  padding: 14px 28px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.1s ease;
  box-shadow: 0 6px 0 #E0D0B0;
}

.btn-control:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #E0D0B0;
}

.btn-control.active-play {
  background: #FF8A00;
  border-color: #E67E00;
  color: white;
  box-shadow: 0 6px 0 #E67E00;
}

.btn-control.active-play:active {
  box-shadow: 0 3px 0 #E67E00;
}

/* Sound Wave/Speaker Indicator */
.sound-indicator {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 100px;
  margin-top: 40px;
  opacity: 0.3;
  transition: var(--transition-smooth);
}

.sound-indicator.animating {
  opacity: 1;
}

.sound-bar {
  width: 14px;
  height: 20px;
  background: linear-gradient(to top, #34d399, #fbbf24);
  border-radius: 8px;
  transition: height 0.15s ease;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.sound-indicator.animating .sound-bar:nth-child(1) { animation: soundWave 0.8s infinite ease-in-out alternate; }
.sound-indicator.animating .sound-bar:nth-child(2) { animation: soundWave 0.8s infinite ease-in-out alternate 0.2s; }
.sound-indicator.animating .sound-bar:nth-child(3) { animation: soundWave 0.8s infinite ease-in-out alternate 0.4s; }
.sound-indicator.animating .sound-bar:nth-child(4) { animation: soundWave 0.8s infinite ease-in-out alternate 0.1s; }

/* Grid answers layout for review */
.classroom-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding: 10px;
}

.review-item {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition-elastic);
  color: white;
}

.review-item:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.review-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 750;
}

.review-nums {
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.5px;
  color: #fff;
  word-wrap: break-word;
}

.review-ans {
  font-size: 24px;
  font-weight: 900;
  color: #fef08a; /* Sunny Yellow */
  text-align: right;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 8px;
  text-shadow: 0 0 10px rgba(254, 240, 138, 0.4);
}

/* ─── ANIMATIONS ─────────────────────────────────────── */
@keyframes numPop {
  0% { transform: scale(0.7); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes soundWave {
  0% { height: 10px; }
  100% { height: 90px; }
}

/* ─── CUSTOM RULES MATRIX STYLING (JONAS STYLE) ───────── */
.rules-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  background: rgba(255, 255, 255, 0.4);
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.rule-card {
  padding: 14px 10px;
  background: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: var(--transition-elastic);
  color: var(--text-main);
}

.rule-card:hover {
  border-color: var(--primary-neon);
  background-color: rgba(99, 102, 241, 0.02);
  transform: translateY(-2px);
  color: var(--primary-neon);
}

.rule-card.active {
  background: linear-gradient(135deg, var(--primary-neon) 0%, var(--primary-neon-hover) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-primary);
}

.rule-card-title {
  font-weight: 900;
  font-size: 14px;
  margin-bottom: 6px;
}

.rule-card-desc {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
}

.rule-card.active .rule-card-desc {
  color: rgba(255, 255, 255, 0.85);
}

/* Rule chips grid inside sub-options */
.rule-chip {
  padding: 8px 12px;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-main);
  font-weight: 700;
  transition: all 0.15s ease;
  user-select: none;
}

.rule-chip:hover {
  border-color: var(--primary-neon);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.rule-chip.selected {
  background: var(--primary-neon) !important;
  border-color: var(--primary-neon) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

/* ─── TOAST NOTIFICATION ────────────────────────────── */
#toast-container {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: var(--text-main);
  padding: 14px 28px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(99, 102, 241, 0.12);
  animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.success {
  border-left: 5px solid var(--secondary-neon);
}

.toast.error {
  border-left: 5px solid #ef4444;
}

@keyframes toastIn {
  from { transform: translateY(-20px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ─── PRINT OVERLAY & HIDES ─────────────────────────── */
@media print {
  body {
    background-color: white !important;
    background-image: none !important;
    overflow: visible !important;
    height: auto !important;
  }
  #app-container, .sidebar, .header, .classroom-overlay, #toast-container, #global-question-config {
    display: none !important;
  }
  .print-page-container, #printable-area {
    display: block !important;
    transform: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: auto !important;
  }
}

/* ─── MODAL OVERLAYS ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-neon);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(99, 102, 241, 0.12);
  position: relative;
  overflow: hidden;
  animation: modalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
  pointer-events: none;
}

@keyframes modalIn {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.abacus-container {
  background: #fdf6e3;
  border: 8px solid #8b5e3c;
  border-radius: 20px;
  padding: 20px 30px;
  display: inline-flex;
  gap: 32px;
  box-shadow: 0 10px 0 #5d3a24, inset 0 2px 10px rgba(0,0,0,0.1);
  position: relative;
  margin-top: 20px;
  touch-action: none;
}
.abacus-rod {
  width: 64px; height: 300px;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.abacus-rod::before {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 4px;
  background: #d4a574;
  border-radius: 2px;
  box-shadow: inset 1px 0 2px rgba(0,0,0,0.2);
}
.abacus-divider-bar {
  position: absolute;
  top: 85px; left: -15px; right: -15px;
  height: 12px;
  background: #8b5e3c;
  z-index: 10;
  border-radius: 6px;
}
.abacus-divider-bar.has-dot::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: 6px; height: 6px;
  background: white;
  border-radius: 50%;
}
.bead {
  width: 76px; height: 44px;
  border-radius: 22px;
  position: absolute;
  z-index: 5;
  transition: all 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  cursor: pointer;
  pointer-events: all;
  touch-action: none;
  user-select: none;
}
.bead:active { filter: brightness(1.3); transform: scale(1.05); }
.bead-up  { background: linear-gradient(to bottom,#ffcc33,#e6b800); box-shadow: 0 4px 0 #b38f00, inset 0 2px 4px rgba(255,255,255,0.6); top: 5px; }
.bead-up.active { top: 38px; }
.bead-down { background: linear-gradient(to bottom,#a0522d,#8b4513); box-shadow: 0 4px 0 #5d2e0a, inset 0 2px 4px rgba(255,255,255,0.3); }
.bead-down-1 { bottom:145px; } .bead-down-2 { bottom:98px; }
.bead-down-3 { bottom:51px;  } .bead-down-4 { bottom:4px;  }
.bead-down-1.active { bottom:162px; } .bead-down-2.active { bottom:115px; }
.bead-down-3.active { bottom:68px;  } .bead-down-4.active { bottom:21px;  }
.abacus-label {
  position: absolute; bottom: -30px;
  font-family: "Outfit", sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #8b5e3c;
}
