/* ================= LINES OF SYMMETRY STUDIO STYLES ================= */
:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #06B6D4;
  --bg-gradient: linear-gradient(135deg, #EEF2FF 0%, #F8FAFC 50%, #E0E7FF 100%);
  --card-bg: #FFFFFF;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.09);
}

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

html, body {
  overflow-x: hidden;
}

body {
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Global Utility */
.hidden {
  display: none !important;
}

/* ================= HEADER & LESSON SWITCHER ================= */
.main-header {
  position: sticky;
  top: 0;
  background: #FFFFFF;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
  border-bottom: 2px solid #E0E7FF;
  z-index: 100;
  flex-wrap: wrap;
  gap: 12px;
}

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

.brand-logo {
  font-size: 1.8rem;
  background: #EEF2FF;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid #C7D2FE;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #312E81;
  line-height: 1.2;
}

.studio-badge {
  display: inline-block;
  background: linear-gradient(90deg, #4338CA, #7C3AED);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.lesson-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F8FAFC;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid #CBD5E1;
  flex-wrap: wrap;
}

.lesson-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 2px;
}

.lesson-chip {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lesson-chip.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.lesson-chip.link {
  color: #334155;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
}

.lesson-chip.link:hover {
  background: #EEF2FF;
  border-color: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
}

.lesson-chip.home {
  color: #78350F;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  font-weight: 800;
}

.lesson-chip.home:hover {
  background: #FDE68A;
  border-color: #F59E0B;
  color: #92400E;
  transform: translateY(-1px);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.mode-tabs {
  display: flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.mode-tabs::-webkit-scrollbar {
  height: 4px;
}

.mode-tabs::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.28);
}

.icon-toggle-btn {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  font-size: 1.15rem;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.1s;
}

.icon-toggle-btn:active {
  transform: scale(0.92);
}

/* ================= APP CONTAINER ================= */
.app-container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 12px auto;
  padding: 8px 18px;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

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

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

/* ================= SHELF CAROUSEL ================= */
.shelf-wrapper {
  margin-bottom: 12px;
  max-width: 100%;
  overflow: hidden;
}

.shelf-scroll {
  display: flex;
  gap: 10px;
  padding: 4px 2px 10px 2px;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.shelf-scroll::-webkit-scrollbar {
  height: 6px;
}

.shelf-scroll::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 10px;
}

.shelf-chip {
  flex: 0 0 auto;
  background: var(--card-bg);
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.shelf-chip:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.shelf-chip.active {
  background: #EEF2FF;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
  transform: translateY(-2px);
}

.shelf-chip .chip-icon {
  font-size: 1.35rem;
}

.shelf-chip .chip-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* ================= STAGE LAYOUT ================= */
.activity-stage-grid {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .activity-stage-grid {
    grid-template-columns: 1fr;
  }
}

.fold-canvas-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 580px;
}

.stage-top-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #F8FAFC;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  flex-wrap: wrap;
  gap: 10px;
}

.line-orientation-picker, .detective-status-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
}

.hud-chip {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-chip:hover {
  border-color: var(--primary-light);
  background: #EEF2FF;
}

.hud-chip.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.hud-counter-badge {
  background: #EEF2FF;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid #C7D2FE;
}

.secondary-sm-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.secondary-sm-btn:hover {
  background: #F1F5F9;
}

.primary-sm-btn {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.primary-sm-btn:hover {
  background: var(--primary-dark);
}

/* ================= 3D PAPER FOLD VIEWPORT ================= */
.paper-viewport {
  flex: 1;
  min-height: 380px;
  background: radial-gradient(circle at center, #FFFFFF 0%, #F1F5F9 100%);
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px; /* Crucial for 3D paper fold! */
  position: relative;
  overflow: hidden; /* Prevent 3D flapper or line overflow outside card */
  padding: 16px;
  max-width: 100%;
}

.paper-sheet {
  width: min(380px, 100%);
  aspect-ratio: 1 / 1;
  height: auto;
  position: relative;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  transform-style: preserve-3d;
  border: 1px solid #E2E8F0;
}

.paper-half {
  width: 50%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.left-half {
  background: #FFFFFF;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.right-half {
  background: #FFFFFF;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transform-origin: left center; /* Folds like a book hinge */
  transform-style: preserve-3d;
  backface-visibility: visible;
  transition: transform 0.05s linear;
}

.paper-half svg {
  width: 100%;
  height: 100%;
  display: block;
}

.symmetry-mirror-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #4F46E5;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
  z-index: 20;
  pointer-events: none;
}

.line-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #4F46E5;
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Horizontal Fold Mode */
.paper-sheet.horizontal-mode {
  flex-direction: column;
}

.paper-sheet.horizontal-mode .paper-half {
  width: 100%;
  height: 50%;
}

.paper-sheet.horizontal-mode .left-half {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.paper-sheet.horizontal-mode .right-half {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transform-origin: center top;
}

.paper-sheet.horizontal-mode .symmetry-mirror-line {
  top: 50%;
  left: 0;
  right: 0;
  bottom: auto;
  width: 100%;
  height: 2px;
}

/* Diagonal Fold Mode */
.paper-sheet.diagonal-mode {
  position: relative;
  display: block;
}

.paper-sheet.diagonal-mode .paper-half {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.paper-sheet.diagonal-mode .left-half {
  background: transparent;
  border-radius: var(--radius-md);
  z-index: 5;
}

.paper-sheet.diagonal-mode .right-half {
  background: transparent;
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  backface-visibility: visible;
  border-radius: var(--radius-md);
  z-index: 10;
}

.paper-sheet.diagonal-mode .symmetry-mirror-line {
  top: 0;
  left: 0;
  bottom: auto;
  width: 141.42%;
  height: 2px;
  transform: rotate(45deg);
  transform-origin: 0 0;
  z-index: 25;
}

/* ================= BOTTOM FOLD CONTROLS BAR ================= */
.fold-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #F8FAFC;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  flex-wrap: wrap;
  max-width: 100%;
}

.fold-slider-block {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fold-slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dark);
}

.fold-percent-text {
  font-weight: 800;
  color: var(--primary);
}

input[type="range"] {
  accent-color: var(--primary);
  cursor: pointer;
  width: 100%;
}

.primary-action-btn {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.primary-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.4);
}

.match-feedback-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
  animation: popIn 0.25s ease;
}

.match-feedback-banner.correct {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #10B981;
}

.match-feedback-banner.wrong {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #EF4444;
}

.match-feedback-banner.hidden {
  display: none;
}

@keyframes popIn {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ================= SIDEBAR DETAILS CARD ================= */
.sidebar-details-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.details-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.details-icon {
  font-size: 2.2rem;
  background: #EEF2FF;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid #C7D2FE;
}

.details-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1E1B4B;
}

.details-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  background: #D1FAE5;
  color: #065F46;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.fact-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.fact-box h4 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.fact-box p {
  font-size: 0.85rem;
  color: var(--text-dark);
  line-height: 1.35;
}

.stats-card-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-stat-card {
  background: #F1F5F9;
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--primary);
}

.fun-kid-tip {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tip-icon {
  font-size: 1.2rem;
}

.tip-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #92400E;
  line-height: 1.3;
}

/* ================= ACTIVITY 2: LINE DETECTIVE ================= */
.detective-canvas-box {
  flex: 1;
  min-height: 380px;
  background: #F8FAFC;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 14px;
  max-width: 100%;
}

.detective-svg {
  width: min(340px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
}

.detective-actions-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #F8FAFC;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
}

.detective-tap-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: #312E81;
}

.tap-banner-icon {
  font-size: 1.4rem;
  animation: tapPulse 1.4s infinite ease-in-out;
}

@keyframes tapPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25) translateY(-2px); }
}

.actions-hint {
  font-size: 0.88rem;
  font-weight: 700;
  color: #312E81;
  line-height: 1.35;
}

/* On-Shape Interactive SVG Guidelines */
.detective-guide-group {
  cursor: pointer;
  outline: none;
}

.detective-guide-group:hover .guideline-visible {
  stroke: #4F46E5 !important;
  stroke-width: 4.5 !important;
  filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.7));
}

.detective-guide-group:hover .line-handle-circle {
  transform: scale(1.28);
  fill: #4F46E5 !important;
}

.guideline-visible {
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.guideline-visible.verified {
  stroke: #10B981 !important;
  stroke-width: 4 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6));
}

.guideline-visible.failed {
  stroke: #EF4444 !important;
  stroke-width: 4 !important;
}

.line-handle-circle {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), fill 0.2s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.line-handle-circle.verified {
  fill: #10B981 !important;
}

.line-handle-circle.failed {
  fill: #EF4444 !important;
}

.detective-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.test-line-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.test-line-btn:hover {
  background: #EEF2FF;
  border-color: var(--primary);
  color: var(--primary);
}

.test-line-btn.verified {
  background: #D1FAE5;
  border-color: #10B981;
  color: #065F46;
}

.confirmed-lines-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.confirmed-lines-list li {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  background: #F1F5F9;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.confirmed-lines-list li .check-icon {
  color: #10B981;
  font-weight: 900;
}

/* ================= ACTIVITY 3: MIRROR PAINTER ================= */
.painter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.painter-top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
  max-width: 100%;
}

.painter-mode-switches, .painter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.guided-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 280px;
}

.guided-selector .hud-label {
  white-space: nowrap;
  flex-shrink: 0;
}

.pattern-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
  padding: 2px 2px 4px 2px;
}

.pattern-chips::-webkit-scrollbar {
  height: 4px;
}

.pattern-chips::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.pattern-chips .hud-chip {
  flex-shrink: 0;
}

.painter-mode-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border: 2px solid #C7D2FE;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.mode-badge-pill {
  background: var(--primary);
  color: #FFFFFF;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.mode-instruction-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: #312E81;
}

.free-draw-inspirations {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  min-width: 0;
  max-width: 100%;
}

.free-draw-inspirations.hidden {
  display: none !important;
}

.inspiration-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #FCD34D transparent;
  padding: 2px 0 4px 0;
}

.inspiration-chips::-webkit-scrollbar {
  height: 4px;
}

.inspiration-chips::-webkit-scrollbar-thumb {
  background: #FCD34D;
  border-radius: 4px;
}

.inspire-chip {
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1px solid #F59E0B;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: #92400E;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inspire-chip:hover {
  background: #FEF3C7;
  transform: translateY(-2px);
}

.inspire-chip.active {
  background: #F59E0B;
  color: #FFFFFF;
}

.painter-main-layout {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .painter-main-layout {
    grid-template-columns: 1fr;
  }
}

.painter-grid-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.painter-grid-header {
  width: 100%;
  max-width: 320px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #F8FAFC;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
}

.grid-center-mirror-tag {
  color: var(--primary);
  background: #EEF2FF;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.paint-grid-container {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  background: #CBD5E1;
  padding: 4px;
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 310px;
  aspect-ratio: 1 / 1;
  position: relative;
}

/* Middle Line Highlight */
.paint-grid-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  background: #4F46E5;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.6);
  pointer-events: none;
  z-index: 10;
}

.paint-cell {
  background: #FFFFFF;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.paint-cell:hover {
  filter: brightness(0.92);
}

.paint-cell.locked {
  cursor: not-allowed;
  opacity: 0.95;
}

.painter-palette-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 320px;
  gap: 10px;
  background: #F8FAFC;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid #E2E8F0;
  flex-wrap: wrap;
}

.palette-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
}

.palette-swatches {
  display: flex;
  gap: 8px;
}

.paint-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1px #CBD5E1;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.paint-color-dot:hover {
  transform: scale(1.18);
}

.paint-color-dot.active {
  transform: scale(1.22);
  box-shadow: 0 0 0 2px var(--primary);
}

.eraser-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.eraser-btn.active {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #991B1B;
}

/* ================= ACTIVITY 4: QUIZ ================= */
.quiz-container {
  max-width: 720px;
  margin: 16px auto;
  width: 100%;
}

.quiz-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
}

.quiz-select-header {
  text-align: center;
  margin-bottom: 22px;
}

.quiz-select-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #312E81;
  margin-bottom: 6px;
}

.quiz-select-header .subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.symm-quiz-levels-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 620px) {
  .symm-quiz-levels-grid {
    grid-template-columns: 1fr;
  }
}

.symm-level-card {
  background: #FFFFFF;
  border: 2px solid #CBD5E1;
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.symm-level-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.18);
}

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-card-icon {
  font-size: 2.2rem;
}

.level-badge-pill {
  font-size: 0.74rem;
  font-weight: 800;
  background: #EEF2FF;
  color: var(--primary);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.level-card-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: #1E293B;
  margin: 0;
}

.level-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.level-card-footer {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.quiz-back-pill {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.15s ease;
}

.quiz-back-pill:hover {
  background: #C7D2FE;
}

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

.quiz-level-indicator {
  font-size: 1.1rem;
  font-weight: 800;
  color: #312E81;
}

.quiz-progress-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 10px;
}

.quiz-score-badge {
  background: #FEF3C7;
  color: #92400E;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
}

.quiz-progress-bar {
  height: 8px;
  background: #EEF2FF;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 22px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4F46E5, #10B981);
  transition: width 0.3s ease;
}

.quiz-question-body {
  text-align: center;
  margin-bottom: 22px;
}

.question-illustration {
  font-size: 3.5rem;
  margin-bottom: 10px;
}

.quiz-question-body h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.35;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 580px) {
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
}

.quiz-opt-btn {
  background: #FFFFFF;
  border: 2px solid #CBD5E1;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1E293B;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.quiz-opt-btn:hover {
  background: #F8FAFC;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.quiz-opt-btn.correct {
  background: #D1FAE5 !important;
  border-color: #10B981 !important;
  color: #065F46 !important;
}

.quiz-opt-btn.wrong {
  background: #FEE2E2 !important;
  border-color: #EF4444 !important;
  color: #991B1B !important;
}

.quiz-feedback {
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 14px;
  animation: popIn 0.25s ease;
}

.quiz-feedback.correct {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #10B981;
}

.quiz-feedback.wrong {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #EF4444;
}

.quiz-feedback.hidden {
  display: none;
}

.quiz-nav-row {
  display: flex;
  justify-content: center;
}

.btn-next-question {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 12px 30px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.15s ease;
}

.btn-next-question:hover {
  transform: translateY(-2px);
}

.btn-next-question.hidden {
  display: none;
}

.trophy-bounce {
  font-size: 4rem;
  margin-bottom: 12px;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.final-score-box {
  background: #FEF3C7;
  border: 2px solid #FCD34D;
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 18px auto;
  max-width: 300px;
}

.stars-row {
  font-size: 2rem;
  margin-bottom: 4px;
}

.score-display {
  font-size: 1.25rem;
  font-weight: 800;
  color: #92400E;
}

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

.primary-big-btn {
  background: #10B981;
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.primary-big-btn:hover {
  background: #059669;
}

.secondary-big-btn {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: var(--text-dark);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.secondary-big-btn:hover {
  background: #E2E8F0;
}

/* ================= FOOTER ================= */
.main-footer {
  text-align: center;
  padding: 24px 20px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 30px;
}

.main-footer strong {
  color: var(--primary);
}

.main-footer .copyright {
  font-size: 0.75rem;
  margin-top: 4px;
}

/* ================= ACTIVITY: MIRROR MATCH STYLES ================= */
.match-stage-container {
  max-width: 960px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
}

.match-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #F1F5F9;
  flex-wrap: wrap;
  gap: 10px;
}

.match-status-left, .match-status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.match-streak-badge {
  background: linear-gradient(135deg, #FFEDD5, #FEF3C7);
  color: #C2410C;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid #FDBA74;
}

.match-prompt-banner {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: #166534;
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.mirror-arena {
  display: grid;
  grid-template-columns: 1fr auto 1.3fr;
  gap: 28px;
  align-items: center;
  justify-items: center;
  padding: 10px 0;
}

.mirror-source-wrapper, .mirror-choices-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.mirror-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.box-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #EEF2FF;
  color: #4338CA;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid #C7D2FE;
}

.mirror-item-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1E293B;
}

.helper-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
}

.mirror-object-card {
  width: 220px;
  height: 220px;
  background: #F8FAFC;
  border: 3px solid #C7D2FE;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(79, 70, 229, 0.05);
  position: relative;
  overflow: hidden;
}

.mirror-object-card svg, .match-choice-card svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mirror-clue-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
  font-weight: 600;
}

.center-mirror-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  padding: 0 10px;
}

.mirror-glass-line {
  width: 6px;
  height: 260px;
  background: linear-gradient(180deg, #A5B4FC, #4F46E5, #A5B4FC);
  border-radius: 4px;
  box-shadow: 0 0 16px rgba(79, 70, 229, 0.7), 0 0 28px rgba(99, 102, 241, 0.4);
}

.mirror-badge-label {
  font-size: 0.72rem;
  font-weight: 900;
  color: #4338CA;
  background: #EEF2FF;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid #C7D2FE;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.match-choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 380px;
}

.match-choice-card {
  background: #FFFFFF;
  border: 3px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 120px;
}

.match-choice-card:hover:not(.locked) {
  transform: translateY(-3px);
  border-color: #818CF8;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.12);
}

.match-choice-card .choice-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-weight: 800;
  font-size: 0.8rem;
  background: #F1F5F9;
  color: #475569;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.match-choice-card.correct {
  border-color: #10B981 !important;
  background: #F0FDF4 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
  transform: scale(1.04);
}

.match-choice-card.correct .choice-badge {
  background: #10B981;
  color: #FFFFFF;
}

.match-choice-card.wrong {
  border-color: #EF4444 !important;
  background: #FEF2F2 !important;
  animation: shake 0.35s ease;
}

.match-choice-card.wrong .choice-badge {
  background: #EF4444;
  color: #FFFFFF;
}

.match-choice-card.locked {
  cursor: default;
}

.match-footer-row {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

/* ================= MOBILE RESPONSIVENESS ================= */
@media (max-width: 768px) {
  .main-header {
    padding: 8px 12px;
  }

  .brand-logo {
    font-size: 1.4rem;
  }

  .brand-text h1 {
    font-size: 1.05rem;
  }

  .nav-controls {
    width: 100%;
    order: 3;
    justify-content: space-between;
  }

  .mode-tabs {
    flex: 1 1 auto;
  }

  .icon-toggle-btn {
    flex-shrink: 0;
  }

  .tab-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .paper-sheet {
    width: min(320px, 100%);
  }

  .paper-viewport {
    padding: 10px;
    min-height: 320px;
  }

  .detective-canvas-box {
    padding: 10px;
    min-height: 320px;
  }

  .guided-selector {
    width: 100%;
    order: 2;
  }

  .painter-top-controls {
    gap: 8px;
    padding: 10px 12px;
  }

  .painter-mode-switches {
    width: 100%;
    justify-content: center;
  }

  .painter-actions {
    width: 100%;
    justify-content: center;
    order: 3;
  }

  .paint-grid-container {
    max-width: min(300px, 100%);
  }

  .paint-color-dot {
    width: 20px;
    height: 20px;
  }

  .mirror-arena {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .mirror-glass-line {
    width: 200px;
    height: 6px;
  }

  .center-mirror-divider {
    padding: 10px 0;
  }
}

@media (max-width: 420px) {
  .app-container {
    padding: 6px 8px;
  }

  .fold-canvas-card, .painter-grid-card, .match-stage-container, .sidebar-details-card {
    padding: 12px 10px;
  }

  .stage-top-hud {
    padding: 6px 8px;
  }

  .line-orientation-picker {
    gap: 4px;
  }

  .hud-chip {
    padding: 5px 8px;
    font-size: 0.76rem;
  }

  .fold-controls-bar {
    padding: 8px 10px;
  }

  .primary-action-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}
