/* ==========================================================================
   TRACEAI - Modern Child-Friendly Design System & Styles
   Matching exact UI layout: Soft Purple/Indigo palette, Glassmorphism, 
   Rounded Cards, Micro-animations, and High-DPI Canvas Tracing.
   ========================================================================== */

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

:root {
  /* Brand Colors */
  --primary: #5B47E0;
  --primary-light: #7E6FF3;
  --primary-dark: #4634B8;
  --primary-subtle: #ECEAFE;
  
  --accent-orange: #FF7675;
  --accent-yellow: #FDCA40;
  --accent-green: #00B894;
  --accent-blue: #0984E3;
  --accent-pink: #FD79A8;

  /* Surfaces & Backgrounds */
  --bg-app: #F2F5FD;
  --surface-card: #FFFFFF;
  --bg-card: #FFFFFF;
  --surface-subtle: #F7F9FD;
  --bg-subtle: #F8FAFD;
  --border-subtle: #E2E8F0;
  --border-card: rgba(220, 226, 245, 0.85);
  --surface-sidebar: #5343E8;
  --surface-sidebar-gradient: linear-gradient(180deg, #5B48E8 0%, #4E39DC 100%);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;

  /* Text Colors */
  --text-main: #2D3436;
  --text-dark: #2D3436;
  --text-muted: #636E72;
  --text-light: #A4B0BE;
  --text-white: #FFFFFF;

  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(91, 71, 224, 0.06);
  --shadow-md: 0 10px 25px rgba(91, 71, 224, 0.09);
  --shadow-lg: 0 18px 45px rgba(91, 71, 224, 0.14);
  --shadow-card: 0 12px 30px rgba(78, 57, 220, 0.07);

  /* Borders & Radius */
  --radius-xs: 8px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --radius-full: 9999px;

  /* Font */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-friendly: 'Quicksand', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  height: 58px;
  min-height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  z-index: 100;
  border-bottom: 1px solid rgba(230, 235, 248, 0.8);
}

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

.logo-text {
  font-size: 22px;
  font-weight: 900;
  color: #1E272E;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.logo-text .logo-ai {
  color: #FD9644;
  position: relative;
}

.logo-text .logo-star {
  font-size: 16px;
  color: #FDCA40;
  animation: starPulse 2.5s infinite ease-in-out;
}

.logo-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: #6C5CE7;
  border-left: 1px solid #DFE6E9;
  padding-left: 10px;
}

.header-center {
  font-size: 16px;
  font-weight: 700;
  color: #5B47E0;
}

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

.points-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  font-weight: 700;
  font-size: 14px;
  color: #2D3436;
  border: 1px solid #EEF2F6;
  transition: transform 0.2s ease;
}

.points-pill:hover {
  transform: translateY(-1px);
}

.points-star {
  color: #FDCA40;
  font-size: 16px;
}

.user-avatar-wrapper {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: #FFEAA7;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #5B47E0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-demo-header-pill {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 6px 15px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: 0.2px;
}

.btn-demo-header-pill:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, #34D399 0%, #059669 100%);
}

.btn-demo-header-pill:active {
  transform: translateY(0) scale(0.98);
}

.btn-demo-header-pill.running {
  background: #6B7280 !important;
  cursor: not-allowed;
  opacity: 0.85;
  box-shadow: none;
}

.btn-webmcp-pill {
  background: linear-gradient(135deg, #FF7675 0%, #D63031 100%);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 10px rgba(214, 48, 49, 0.2);
  transition: all 0.2s ease;
}

.btn-webmcp-pill:hover {
  transform: scale(1.03);
  box-shadow: 0 5px 14px rgba(214, 48, 49, 0.3);
}

/* ==========================================================================
   WORKSPACE SUBVIEWS (EXERCISE, PROGRESS, REWARDS, SETTINGS)
   ========================================================================== */
.workspace-subview {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  gap: var(--space-3);
  animation: fadeInView 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace-subview.active {
  display: flex;
}

/* ==========================================================================
   HOME DASHBOARD STYLES
   ========================================================================== */
.home-dashboard-card {
  flex: 1;
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(220, 226, 245, 0.8);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
}

/* Hero Banner */
.home-hero-banner {
  background: linear-gradient(135deg, #5B47E0 0%, #7D6EF9 60%, #9080F9 100%);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 10px 24px rgba(91, 71, 224, 0.25);
  position: relative;
  overflow: hidden;
}

.home-hero-banner::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.home-hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-tag-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  color: #FFEAA7;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.home-hero-title {
  font-size: 24px;
  font-weight: 900;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.2;
}

.home-hero-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
  margin: 0;
}

.home-hero-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.hero-stat-chip {
  background: rgba(255, 255, 255, 0.16);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
}

/* Quick Start Hero CTA Box */
.home-quick-start-box {
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  min-width: 170px;
  backdrop-filter: blur(6px);
}

.quick-start-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.quick-start-badge {
  font-size: 9px;
  font-weight: 800;
  color: #FFEAA7;
  letter-spacing: 0.5px;
}

.quick-start-char {
  font-size: 32px;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1;
}

.quick-start-desc strong {
  font-size: 12px;
  display: block;
}

.quick-start-desc p {
  font-size: 10px;
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
}

.btn-hero-start {
  background: #FDCA40;
  color: #2D3436;
  border: none;
  font-weight: 800;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(253, 202, 64, 0.35);
}

.btn-hero-start:hover {
  transform: translateY(-2px) scale(1.04);
  background: #FFEAA7;
  box-shadow: 0 6px 16px rgba(253, 202, 64, 0.5);
}

/* Home Categories Grid */
.home-activities-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-heading-mini {
  font-size: 13px;
  font-weight: 800;
  color: #2D3436;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.home-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.home-category-card {
  background: #F8FAFD;
  border: 1.5px solid rgba(220, 226, 245, 0.9);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.home-category-card:hover {
  transform: translateY(-4px);
  background: #FFFFFF;
  box-shadow: 0 10px 24px rgba(91, 71, 224, 0.12);
  border-color: #5B47E0;
}

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

.cat-card-icon {
  font-size: 26px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-purple .cat-card-icon { background: rgba(91, 71, 224, 0.12); }
.card-blue .cat-card-icon { background: rgba(59, 130, 246, 0.12); }
.card-green .cat-card-icon { background: rgba(16, 185, 129, 0.12); }

.cat-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.05);
  color: #636E72;
}

.cat-card-title {
  font-size: 15px;
  font-weight: 800;
  color: #2D3436;
  margin: 0;
}

.cat-card-desc {
  font-size: 11px;
  color: #636E72;
  line-height: 1.35;
  margin: 0;
  flex: 1;
}

.cat-card-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.cat-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #636E72;
}

.cat-progress-bar {
  height: 6px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cat-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.btn-cat-action {
  margin-top: 4px;
  background: #F0F3FF;
  color: #5B47E0;
  border: none;
  font-weight: 800;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.home-category-card:hover .btn-cat-action {
  background: #5B47E0;
  color: #FFFFFF;
}

/* Home AI Advice Banner */
.home-ai-banner {
  background: linear-gradient(135deg, rgba(91, 71, 224, 0.06) 0%, rgba(253, 202, 64, 0.1) 100%);
  border: 1.5px dashed rgba(91, 71, 224, 0.3);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.home-ai-avatar {
  font-size: 28px;
  animation: floatAvatar 3s ease-in-out infinite;
}

.home-ai-message strong {
  font-size: 12px;
  color: #5B47E0;
  display: block;
}

.home-ai-message p {
  font-size: 11px;
  color: #2D3436;
  margin: 2px 0 0 0;
  line-height: 1.3;
}

.view-panel-card {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-card);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  min-height: 0;
  box-sizing: border-box;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(220, 226, 245, 0.7);
  padding-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.panel-main-title {
  font-size: 20px;
  font-weight: 900;
  color: #1E272E;
  margin: 0;
  letter-spacing: -0.3px;
}

.panel-subtitle {
  font-size: 12px;
  color: #636E72;
  margin: 0;
}

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

.standard-tag {
  background: rgba(91, 71, 224, 0.1);
  color: #5B47E0;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.rewards-points-count {
  background: linear-gradient(135deg, #FDCA40 0%, #FFA801 100%);
  color: #2D3436;
  font-weight: 900;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 3px 12px rgba(253, 202, 64, 0.35);
}

/* ==========================================================================
   PROGRESS VIEW STYLES
   ========================================================================== */
.progress-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.stat-box-card {
  background: #F8FAFD;
  border: 1.5px solid rgba(220, 226, 245, 0.85);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-box-card:hover {
  transform: translateY(-3px);
  background: #FFFFFF;
  box-shadow: 0 8px 20px rgba(91, 71, 224, 0.1);
  border-color: #5B47E0;
}

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

.stat-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.stat-purple { background: rgba(91, 71, 224, 0.12); }
.stat-blue { background: rgba(59, 130, 246, 0.12); }
.stat-green { background: rgba(16, 185, 129, 0.12); }
.stat-orange { background: rgba(249, 115, 22, 0.12); }
.stat-pink { background: rgba(236, 72, 153, 0.12); }
.stat-yellow { background: rgba(234, 179, 8, 0.15); }

.stat-trend {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.stat-trend.positive {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.stat-trend.neutral {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}

.stat-badge-hot {
  font-size: 9px;
  font-weight: 800;
  background: #FF7675;
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 20px;
  font-weight: 900;
  color: #1E272E;
  line-height: 1.1;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #636E72;
  margin-top: 2px;
}

.stat-bar {
  height: 5px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.stat-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.fill-purple { background: #5B47E0; }
.fill-blue { background: #3B82F6; }
.fill-green { background: #10B981; }
.fill-orange { background: #F97316; }
.fill-pink { background: #EC4899; }
.fill-yellow { background: #F59E0B; }

/* AI Telemetry Insights Box */
.ai-insights-box {
  background: linear-gradient(135deg, rgba(91, 71, 224, 0.05) 0%, rgba(253, 202, 64, 0.08) 100%);
  border: 1.5px dashed rgba(91, 71, 224, 0.35);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.ai-coach-icon-badge {
  font-size: 24px;
  width: 38px;
  height: 38px;
  background: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(91, 71, 224, 0.15);
  animation: floatAvatar 3s ease-in-out infinite;
}

.ai-insights-title {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ai-insights-title strong {
  font-size: 13px;
  font-weight: 800;
  color: #5B47E0;
}

.ai-insights-title span {
  font-size: 11px;
  color: #636E72;
}

.ai-insights-status {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.ai-insights-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #2D3436;
  margin: 0;
}

.ai-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.ai-tag.tag-good {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.ai-tag.tag-focus {
  background: rgba(249, 115, 22, 0.12);
  color: #C2410C;
  border: 1px dashed rgba(249, 115, 22, 0.4);
}

/* Progress Columns Grid */
.progress-columns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.progress-subpanel {
  background: #F8FAFD;
  border: 1.5px solid rgba(220, 226, 245, 0.85);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subpanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 8px;
}

.subpanel-title {
  font-size: 13px;
  font-weight: 800;
  color: #1E272E;
  margin: 0;
}

.subpanel-badge {
  font-size: 10px;
  font-weight: 700;
  background: #FFFFFF;
  color: #636E72;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid #E2E8F0;
}

.competency-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comp-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comp-info {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
}

.comp-name { color: #2D3436; }
.comp-score { color: #636E72; font-size: 11px; }

.comp-bar {
  height: 6px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.comp-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease;
}

.history-item:hover {
  transform: translateX(3px);
  border-color: #5B47E0;
}

.history-char-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
}

.bg-letter { background: rgba(91, 71, 224, 0.15); color: #5B47E0; }
.bg-guided { background: rgba(249, 115, 22, 0.15); color: #EA580C; }
.bg-number { background: rgba(59, 130, 246, 0.15); color: #2563EB; }
.bg-shape { background: rgba(16, 185, 129, 0.15); color: #059669; }

.history-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.history-details strong {
  font-size: 12px;
  color: #1E272E;
}

.history-details span {
  font-size: 10px;
  color: #636E72;
}

.history-score-chip {
  font-size: 12px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.score-high { background: #ECFDF5; color: #059669; }
.score-med { background: #FFFBEB; color: #D97706; }

/* ==========================================================================
   REWARDS VIEW STYLES
   ========================================================================== */
.level-progress-hero {
  background: linear-gradient(135deg, #5B47E0 0%, #7D6EF9 60%, #9080F9 100%);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(91, 71, 224, 0.22);
}

.level-badge-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-num {
  font-size: 11px;
  font-weight: 800;
  color: #FFEAA7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.level-title {
  font-size: 18px;
  font-weight: 900;
}

.level-xp-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.xp-text-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.xp-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: #FDCA40;
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px rgba(253, 202, 64, 0.5);
}

.level-multiplier-chip {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 800;
  color: #FFEAA7;
}

.rewards-section-heading {
  font-size: 13px;
  font-weight: 800;
  color: #1E272E;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Badges Grid Layout */
.badges-grid-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.badge-item-card {
  background: #F8FAFD;
  border: 1.5px solid rgba(220, 226, 245, 0.85);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.badge-item-card:hover {
  transform: translateY(-3px) scale(1.02);
  background: #FFFFFF;
  box-shadow: 0 10px 24px rgba(91, 71, 224, 0.12);
}

.badge-item-card.unlocked {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, #FFFFFF 0%, rgba(16, 185, 129, 0.06) 100%);
}

.badge-item-card.locked {
  opacity: 0.65;
  filter: grayscale(0.4);
}

.badge-icon-wrap {
  font-size: 32px;
  margin-bottom: 2px;
}

.badge-name {
  font-size: 13.5px;
  font-weight: 800;
  color: #1E272E;
}

.badge-desc {
  font-size: 11px;
  color: #636E72;
  line-height: 1.35;
  flex: 1;
}

.badge-status-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.tag-unlocked {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-locked {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #CBD5E1;
}

.badge-mini-bar {
  width: 80%;
  height: 4px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 2px;
}

.badge-mini-fill {
  height: 100%;
  background: #5B47E0;
  border-radius: var(--radius-full);
}

/* Pen Themes Grid */
.pen-themes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.pen-theme-card {
  background: #F8FAFD;
  border: 1.5px solid rgba(220, 226, 245, 0.85);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.pen-theme-card.active {
  border-color: #5B47E0;
  background: #FFFFFF;
  box-shadow: 0 4px 14px rgba(91, 71, 224, 0.12);
}

.pen-theme-preview {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.pen-rainbow { background: linear-gradient(135deg, #FF7675 0%, #FDCA40 50%, #00B894 100%); }
.pen-starlight { background: linear-gradient(135deg, #FFEAA7 0%, #FDCB6E 100%); }
.pen-neon { background: linear-gradient(135deg, #0984E3 0%, #6C5CE7 100%); }
.pen-gold { background: linear-gradient(135deg, #E17055 0%, #D63031 100%); }

.pen-theme-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pen-theme-meta strong {
  font-size: 12px;
  color: #1E272E;
}

.pen-theme-meta span {
  font-size: 10px;
  color: #636E72;
}

.btn-theme-select {
  background: #F0F3FF;
  color: #5B47E0;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-select.selected {
  background: #5B47E0;
  color: white;
}

.locked-btn {
  background: #E2E8F0;
  color: #64748B;
  cursor: not-allowed;
}

/* ==========================================================================
   SETTINGS VIEW STYLES
   ========================================================================== */
.settings-sections-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #1E272E;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-grid-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.setting-card-item {
  background: #F8FAFD;
  border: 1.5px solid rgba(220, 226, 245, 0.85);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  transition: all 0.2s ease;
}

.setting-card-item:hover {
  background: #FFFFFF;
  border-color: #5B47E0;
  box-shadow: 0 4px 12px rgba(91, 71, 224, 0.08);
}

.setting-meta-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-title {
  font-size: 13px;
  font-weight: 800;
  color: #1E272E;
}

.setting-sub {
  font-size: 11px;
  color: #636E72;
  line-height: 1.3;
}

.setting-input, .setting-select {
  padding: 8px 12px;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: #FFFFFF;
  color: #1E272E;
  font-weight: 700;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.setting-input:focus, .setting-select:focus {
  border-color: #5B47E0;
  box-shadow: 0 0 0 3px rgba(91, 71, 224, 0.12);
}

.btn-save-settings-pill {
  background: #5B47E0;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(91, 71, 224, 0.25);
}

.btn-save-settings-pill:hover {
  background: #4634B8;
  transform: translateY(-1px);
}

.btn-action-outline {
  background: #FFFFFF;
  border: 1.5px solid #5B47E0;
  color: #5B47E0;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-outline:hover {
  background: #5B47E0;
  color: white;
}

.btn-action-danger {
  background: #FFF5F5;
  border: 1.5px solid #FEB2B2;
  color: #E53E3E;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-danger:hover {
  background: #E53E3E;
  color: white;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CBD5E1;
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 26px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle-switch input:checked + .slider {
  background: #5B47E0;
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   MAIN DASHBOARD LAYOUT
   ========================================================================== */
.main-layout {
  display: grid;
  grid-template-columns: 195px minmax(0, 1fr) 275px;
  gap: 12px;
  padding: 8px 14px;
  height: calc(100vh - 58px);
  max-height: calc(100vh - 58px);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 0;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-layout.no-right-sidebar {
  grid-template-columns: 195px minmax(0, 1fr);
}

.main-layout.no-right-sidebar .sidebar-right {
  display: none !important;
}

/* ==========================================================================
   LEFT SIDEBAR
   ========================================================================== */
.sidebar-left {
  background: var(--surface-sidebar-gradient);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  color: white;
  min-height: 0;
  height: 100%;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  transform: translateX(3px);
}

.nav-item.active {
  background: #FFFFFF;
  color: #5B47E0;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.nav-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Coach Card in Sidebar */
.coach-robot-card {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.coach-robot-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.24);
}

.coach-robot-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: floatAvatar 3s ease-in-out infinite;
}

.coach-robot-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 2px;
  color: #FFFFFF;
}

.coach-robot-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
}

/* ==========================================================================
   CENTER WORKSPACE & CANVAS
   ========================================================================== */
.workspace-center {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.canvas-card {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid rgba(220, 226, 245, 0.8);
}

.canvas-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.icon-btn-round {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: #F0F3FF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #5B47E0;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(91, 71, 224, 0.08);
}

.icon-btn-round:hover {
  background: #5B47E0;
  color: white;
  transform: scale(1.05);
}

.exercise-letter-title {
  font-size: 28px;
  font-weight: 900;
  color: #5B47E0;
  line-height: 1;
}

.step-indicator-badge {
  background: #F0F3FF;
  color: #2D3436;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.canvas-interactive-area {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 0;
  height: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: crosshair;
}

.canvas-bottom-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

/* ==========================================================================
   BOTTOM WORKSPACE CONTROLS
   ========================================================================== */
.bottom-controls-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(220, 226, 245, 0.8);
  gap: 10px;
  min-height: 46px;
  min-width: 0;
  flex-shrink: 0;
}

.control-group-section {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.control-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #636E72;
  white-space: nowrap;
}

.mode-selector-pill {
  display: flex;
  background: #F4F6FC;
  padding: 2px;
  border-radius: var(--radius-full);
  gap: 2px;
  flex-shrink: 0;
}

.btn-mode-choice {
  background: transparent;
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  color: #636E72;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-mode-choice.active {
  background: #FFFFFF;
  color: #5B47E0;
  box-shadow: 0 2px 8px rgba(91, 71, 224, 0.15);
}

.letter-tray-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 80px;
  max-width: 270px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 71, 224, 0.3) transparent;
}

.letter-tray-wrapper::-webkit-scrollbar {
  height: 4px;
}

.letter-tray-wrapper::-webkit-scrollbar-thumb {
  background: rgba(91, 71, 224, 0.35);
  border-radius: 4px;
}

.letter-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: var(--radius-xs);
  border: 1px solid #E4E9F2;
  background: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  color: #2D3436;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.letter-btn:hover {
  border-color: #5B47E0;
  transform: translateY(-1px);
}

.letter-btn.active {
  background: #5B47E0;
  color: #FFFFFF;
  border-color: #5B47E0;
  box-shadow: 0 3px 10px rgba(91, 71, 224, 0.25);
}

.btn-next-action {
  background: #5B47E0;
  color: #FFFFFF;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(91, 71, 224, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-next-action:hover {
  background: #4634B8;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(91, 71, 224, 0.35);
}

/* ==========================================================================
   RIGHT SIDEBAR: METRICS & COACH
   ========================================================================== */
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.metrics-panel-card {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 10px 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(220, 226, 245, 0.8);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: space-between;
  box-sizing: border-box;
}

/* Bravo card header */
.bravo-badge-header {
  background: linear-gradient(135deg, #00B894 0%, #00CEC9 100%);
  color: white;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 3px 8px rgba(0, 184, 148, 0.2);
}

.bravo-title {
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bravo-star-icon {
  font-size: 18px;
  animation: starWiggle 2s infinite ease-in-out;
}

/* Score Circle Gauge */
.score-overview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.score-text-title {
  font-size: 13px;
  font-weight: 800;
  color: #2D3436;
  margin-bottom: 0px;
}

.score-text-sub {
  font-size: 10.5px;
  color: #636E72;
  margin-bottom: 2px;
}

.circular-gauge-box {
  position: relative;
  width: 68px;
  height: 68px;
}

.circular-gauge-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.gauge-bg {
  fill: none;
  stroke: #EAEFFC;
  stroke-width: 7;
}

.gauge-progress {
  fill: none;
  stroke: #00B894;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease-in-out, stroke 0.4s ease;
}

.gauge-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-percent {
  font-size: 17px;
  font-weight: 900;
  color: #00B894;
  line-height: 1;
}

.gauge-label {
  font-size: 9.5px;
  font-weight: 700;
  color: #636E72;
}

/* Metric Bars */
.metrics-breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metrics-section-title {
  font-size: 11px;
  font-weight: 800;
  color: #5B47E0;
  margin-bottom: 1px;
}

.metric-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  color: #2D3436;
}

.metric-bar-bg {
  width: 100%;
  height: 5px;
  background: #EDF2F7;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease-in-out;
}

.fill-green {
  background: #00B894;
}

.fill-orange {
  background: #FD9644;
}

.fill-coral {
  background: #FF7675;
}

/* Coach Advice Card */
.coach-advice-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(220, 226, 245, 0.8);
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.coach-advice-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 800;
  color: #5B47E0;
}

.coach-advice-body {
  font-size: 10.5px;
  color: #4B5563;
  line-height: 1.3;
  font-weight: 500;
}

/* Gemini Key Notice Card in Stats Sidebar */
.gemini-key-notice-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid #E0E7FF;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.gemini-key-notice-card.key-missing {
  border-color: rgba(255, 118, 117, 0.5);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF7F6 100%);
}

.gemini-key-notice-card.key-connected {
  border-color: rgba(0, 184, 148, 0.4);
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FBF8 100%);
}

.gemini-notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.gemini-notice-title-box {
  display: flex;
  align-items: center;
  gap: 5px;
}

.gemini-notice-icon {
  font-size: 13px;
}

.gemini-notice-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #5B47E0;
}

.gemini-notice-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.gemini-notice-status-pill.pill-warning {
  background: #FFEAA7;
  color: #D63031;
  border: 1px solid rgba(214, 48, 49, 0.25);
}

.gemini-notice-status-pill.pill-connected {
  background: #E8F8F5;
  color: #00B894;
  border: 1px solid rgba(0, 184, 148, 0.25);
}

.gemini-notice-text {
  font-size: 10.5px;
  color: #4B5563;
  line-height: 1.35;
  margin: 0;
  font-weight: 500;
}

.btn-notice-open-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(135deg, #5B47E0 0%, #7E6FF3 100%);
  color: #FFFFFF;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-top: 2px;
}

.btn-notice-open-key:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(91, 71, 224, 0.25);
}

.btn-notice-open-key.connected-mode {
  background: #F1F3F9;
  color: #5B47E0;
  border: 1px solid rgba(91, 71, 224, 0.2);
}

.input-error-pulse {
  animation: keyInputShake 0.45s ease-in-out;
  border-color: #FF7675 !important;
  box-shadow: 0 0 0 3px rgba(255, 118, 117, 0.35) !important;
}

@keyframes keyInputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ==========================================================================
   STATUS BANNER FOR DEMO
   ========================================================================== */
.demo-banner {
  display: none;
  background: linear-gradient(135deg, #6C5CE7 0%, #a29bfe 100%);
  color: white;
  padding: 10px 24px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  animation: pulseGlow 1.5s infinite alternate;
}

.demo-banner.active {
  display: block;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes starPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2) rotate(15deg); }
}

@keyframes starWiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-10deg) scale(1.1); }
  75% { transform: rotate(10deg) scale(1.1); }
}

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

@keyframes pulseGlow {
  0% { box-shadow: 0 0 10px rgba(108, 92, 231, 0.4); }
  100% { box-shadow: 0 0 22px rgba(108, 92, 231, 0.85); }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1380px) {
  .main-layout {
    grid-template-columns: 185px minmax(0, 1fr) 265px;
    gap: 10px;
    padding: 8px 12px;
  }
  .letter-tray-wrapper {
    max-width: 240px;
  }
  .sidebar-left {
    padding: 12px 10px;
  }
  .nav-item {
    padding: 6px 10px;
    font-size: 12px;
  }
}

@media (max-width: 1180px) {
  .main-layout {
    grid-template-columns: 175px minmax(0, 1fr) 250px;
    padding: 8px 10px;
    gap: 8px;
  }
  .coach-robot-card {
    padding: 8px;
  }
  .coach-robot-avatar {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  .letter-tray-wrapper {
    max-width: 200px;
  }
}

@media (max-width: 980px) {
  .main-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow-y: auto;
  }
  .sidebar-left {
    flex-direction: row;
    align-items: center;
    padding: 12px;
  }
  .nav-menu {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .coach-robot-card {
    display: none;
  }
}

/* ==========================================================================
   DEMO RUNNING LOCK OVERLAY & COMPLETION MODAL
   ========================================================================== */
.demo-lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.15);
  cursor: wait;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 24px;
  pointer-events: all;
  animation: fadeIn 0.2s ease;
}

.demo-lock-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  padding: 10px 22px;
  border-radius: 9999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
}

.demo-lock-spinner {
  animation: pulseSpin 1.4s infinite ease-in-out;
  display: inline-block;
  font-size: 16px;
}

@keyframes pulseSpin {
  0% { transform: scale(1) rotate(0deg); opacity: 0.8; }
  50% { transform: scale(1.25) rotate(180deg); opacity: 1; }
  100% { transform: scale(1) rotate(360deg); opacity: 0.8; }
}

.demo-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-modal-card {
  background: #FFFFFF;
  border-radius: 24px;
  padding: 32px 36px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.05);
  text-align: center;
  animation: scaleUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUpModal {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.demo-modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: inline-block;
  animation: bounceCelebration 0.8s ease;
}

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

.demo-modal-title {
  font-size: 22px;
  font-weight: 800;
  color: #1E293B;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.demo-modal-desc {
  font-size: 14px;
  color: #64748B;
  line-height: 1.5;
  margin-bottom: 18px;
}

.demo-modal-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  text-align: left;
  background: #F8FAFC;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-modal-steps li {
  font-size: 13px;
  color: #334155;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.demo-modal-steps code {
  background: #E2E8F0;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #0F172A;
  font-weight: 600;
}

.btn-demo-modal-ok {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  border: none;
  padding: 14px 28px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-demo-modal-ok:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, #34D399 0%, #059669 100%);
}

.btn-demo-modal-ok:active {
  transform: translateY(0) scale(0.98);
}
