/* =========================================================
   Malayalam InScript Master Typing Tutor - Standalone App Styles
   Clean, Aligned, Responsive, Modern Glassmorphism
   ========================================================= */

@import url('./style.css');

body.tutor-app-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.tutor-standalone-app {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

/* App Header */
.tutor-app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
}

.tutor-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tutor-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  overflow: hidden;
  flex-shrink: 0;
}

.tutor-brand-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tutor-brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-sub-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.tutor-brand-title .badge {
  font-size: 0.72rem;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
}

.back-editor-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  transition: all 0.2s ease;
}

.back-editor-link:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.tutor-header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.stars-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.88rem;
}

/* =========================================================
   Stage Navigation Bar (Sleek, Aligned, Never Wraps)
   ========================================================= */
.tutor-subnav-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  min-height: 60px;
  box-sizing: border-box;
}

.subnav-left,
.subnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.subnav-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  max-width: 580px;
  justify-content: center;
}

/* Stage Select Box with Custom Dark/Light Styling */
.stage-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.stage-select-icon {
  position: absolute;
  left: 12px;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.stage-nav-select {
  width: 100%;
  height: 42px;
  background: var(--bg-editor);
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 0 36px 0 38px;
  font-family: var(--font-malayalam), var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.stage-nav-select:hover {
  border-color: #38bdf8;
}

.stage-nav-select:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.stage-nav-select option,
.stage-nav-select optgroup {
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.9rem;
}

[data-theme="light"] .stage-nav-select {
  background-color: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .stage-nav-select option,
[data-theme="light"] .stage-nav-select optgroup {
  background: #ffffff;
  color: #0f172a;
}

/* Stars Pill */
.current-stage-stars-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 0 12px;
  height: 42px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.current-stage-stars {
  font-size: 1.2rem;
  letter-spacing: 3px;
  color: #f59e0b;
  line-height: 1;
}

/* Navigation Buttons in Subnav */
.tutor-subnav-strip .btn {
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.2s ease;
  cursor: pointer;
}

.tutor-subnav-strip .btn-secondary {
  background: var(--bg-editor);
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
}

.tutor-subnav-strip .btn-secondary:hover {
  background: var(--key-bg-hover);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.tutor-subnav-strip .btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: none;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.tutor-subnav-strip .btn-primary:hover {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.45);
  transform: translateY(-1px);
}

/* Short label responsive behavior */
.btn-label-short {
  display: none;
}

@media (max-width: 960px) {
  .btn-label-full {
    display: none;
  }
  .btn-label-short {
    display: inline;
  }
  .tutor-subnav-strip .btn {
    padding: 0 12px;
  }
}

@media (max-width: 720px) {
  .tutor-subnav-strip {
    flex-wrap: wrap;
    padding: 10px;
    gap: 8px;
    min-height: auto;
  }

  .subnav-center {
    order: 1;
    width: 100%;
    max-width: 100%;
  }

  .subnav-left {
    order: 2;
    flex: 1;
  }

  .subnav-left .btn {
    width: 100%;
  }

  .subnav-right {
    order: 3;
    flex: 2;
    display: flex;
    gap: 8px;
  }

  .subnav-right .btn {
    flex: 1;
  }
}

/* Level Overview Banner */
.level-banner-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.level-title-group h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-accent);
}

.level-title-group p {
  margin: 3px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Overall Progress Bar */
.overall-progress-track {
  width: 140px;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.overall-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #0ea5e9);
  transition: width 0.3s ease;
}

/* =========================================================
   Guidance Arena: Perfectly Aligned 3-Column Card
   ========================================================= */
.tutor-guide-arena {
  display: grid;
  grid-template-columns: 140px 1fr 270px;
  gap: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  align-items: stretch;
}

/* Column 1: Target Char */
.guide-target-box {
  background: var(--bg-editor);
  border: 2px solid #f59e0b;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
  min-height: 105px;
}

.guide-target-char {
  font-family: var(--font-malayalam);
  font-size: 3.2rem;
  font-weight: 800;
  color: #f59e0b;
  line-height: 1;
}

.guide-target-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
}

/* Column 2: Instruction Details */
.guide-details-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.instruction-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.instr-label {
  color: var(--text-muted);
  font-weight: 500;
  min-width: 120px;
}

.finger-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
}

.finger-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #f59e0b;
}

.key-pill {
  background: var(--primary-btn-bg);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pill-req {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.pill-normal {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.pill-shift {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.pill-zwj {
  background: rgba(236, 72, 153, 0.2);
  color: #ec4899;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.guide-desc-text {
  font-size: 0.86rem;
  color: var(--text-accent);
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid #0ea5e9;
  padding: 6px 10px;
  border-radius: 4px;
}

/* Column 3: Hands Visual */
.guide-hands-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-editor);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 8px;
}

.hands-svg {
  width: 100%;
  max-width: 250px;
  height: 90px;
}

.hand-palm {
  fill: var(--bg-secondary);
  stroke: var(--border-color);
  stroke-width: 1.5;
}

.hand-finger {
  fill: var(--bg-secondary);
  stroke: var(--border-color);
  stroke-width: 1.5;
  transition: all 0.25s ease;
}

.hand-finger.active-finger {
  stroke: #ffffff;
  stroke-width: 2.2;
}

.hand-label {
  font-size: 9px;
  font-weight: 600;
  fill: var(--text-muted);
}

/* =========================================================
   Target Text Stream Card (Full Width)
   ========================================================= */
.tutor-stream-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.stream-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tutor-text-stream {
  font-family: var(--font-malayalam);
  font-size: 2.2rem;
  line-height: 1.6;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 4px;
  letter-spacing: 2px;
  user-select: none;
  scrollbar-width: thin;
}

.tutor-text-stream span.char-done {
  color: #10b981;
  opacity: 0.85;
}

.tutor-text-stream span.char-current {
  color: #ffffff;
  background: #f59e0b;
  padding: 2px 8px;
  border-radius: 8px;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.85);
  animation: charPulse 1s infinite alternate;
  display: inline-block;
}

@keyframes charPulse {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
  100% { transform: scale(1.08); box-shadow: 0 0 18px rgba(245, 158, 11, 0.9); }
}

.tutor-text-stream span.char-upcoming {
  color: var(--text-muted);
  opacity: 0.65;
}

/* Character Error Shake Animation */
.char-error-shake {
  animation: charShake 0.25s ease-in-out !important;
  color: #ffffff !important;
  background: #ef4444 !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.9) !important;
}

@keyframes charShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* =========================================================
   Live Performance HUD Metrics Bar (Full Width, 4 Cards)
   ========================================================= */
.tutor-hud-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.hud-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  min-height: 56px;
  box-sizing: border-box;
}

.hud-card:hover {
  border-color: var(--border-focus);
}

.hud-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hud-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.hud-unit {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.hud-progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  transition: width 0.25s ease;
}

.stat-val-progress {
  color: #f59e0b;
}

.stat-val-accuracy {
  color: #10b981;
}

.stat-val-wpm {
  color: #0ea5e9;
}

.stat-val-errors {
  color: #f43f5e;
}

/* =========================================================
   Virtual Keyboard & Finger Layout Arena
   ========================================================= */
.tutor-keyboard-arena {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutor-keyboard-arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tutor-keyboard-arena-header .title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-finger-toggle {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 20px;
}

.btn-finger-toggle.active {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: #10b981;
}

/* Finger Legend Strip */
.finger-legend-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 6px 0;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2px 8px;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Color-Coded Keys */
.finger-colors-enabled .kb-key.finger-LP {
  border-bottom: 3.5px solid #ec4899 !important;
}
.finger-colors-enabled .kb-key.finger-LR {
  border-bottom: 3.5px solid #8b5cf6 !important;
}
.finger-colors-enabled .kb-key.finger-LM {
  border-bottom: 3.5px solid #3b82f6 !important;
}
.finger-colors-enabled .kb-key.finger-LI {
  border-bottom: 3.5px solid #10b981 !important;
}
.finger-colors-enabled .kb-key.finger-RI {
  border-bottom: 3.5px solid #f59e0b !important;
}
.finger-colors-enabled .kb-key.finger-RM {
  border-bottom: 3.5px solid #06b6d4 !important;
}
.finger-colors-enabled .kb-key.finger-RR {
  border-bottom: 3.5px solid #a855f7 !important;
}
.finger-colors-enabled .kb-key.finger-RP {
  border-bottom: 3.5px solid #f43f5e !important;
}
.finger-colors-enabled .kb-key.finger-LT,
.finger-colors-enabled .kb-key.finger-RT,
.finger-colors-enabled .key-space {
  border-bottom: 3.5px solid #64748b !important;
}

/* Glowing Target Key Override */
.kb-key.practice-target {
  background: rgba(245, 158, 11, 0.3) !important;
  border: 2px solid #f59e0b !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.85), inset 0 0 8px rgba(245, 158, 11, 0.5) !important;
  transform: translateY(-2px) scale(1.04);
}

/* Clean Embedded Keyboard */
.tutor-keyboard-slot .keyboard-wrapper {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

/* =========================================================
   Keyboard Tab Toolbar & Panes (Main vs Chillus)
   ========================================================= */
.keyboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-tab-group {
  display: flex;
  gap: 6px;
}

.kb-tab-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kb-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.kb-tab-btn.active {
  background: var(--primary-btn-bg);
  color: #ffffff;
  border-color: transparent;
}

.kb-tools .kb-layout-pill {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Tab Panes: Crucial rule to prevent secondary panes from displaying by default */
.kb-tab-pane {
  display: none !important;
}

.kb-tab-pane.active {
  display: block !important;
}

/* Atomic Chillu Tray Styling */
.special-tray-section {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 6px;
}

.special-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.special-tray-section h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-accent);
  font-weight: 700;
}

.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 10px;
}

.special-insert-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.special-insert-btn:hover {
  border-color: #f59e0b;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.special-insert-btn .char-large {
  font-family: var(--font-malayalam);
  font-size: 1.8rem;
  font-weight: 700;
  color: #f59e0b;
  line-height: 1;
}

.special-insert-btn small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =========================================================
   Modal System (Curriculum & Celebration)
   ========================================================= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  z-index: 10000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.modal-content {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  max-height: 90vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* =========================================================
   Curriculum Drawer / Modal
   ========================================================= */
.curriculum-modal-content {
  max-width: 940px;
  width: 95%;
}

.curriculum-list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(85vh - 70px);
  overflow-y: auto;
  padding: 18px 22px;
  box-sizing: border-box;
}

.curriculum-level-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.curriculum-level-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.curriculum-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.curriculum-stage-item {
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 120px;
  box-sizing: border-box;
}

.curriculum-stage-item:hover {
  background: var(--key-bg-hover);
  border-color: #0ea5e9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.curriculum-stage-item.current-active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

/* Card Header: Code Badge + Stars */
.curriculum-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stage-code {
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--bg-editor);
  color: var(--text-accent);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap !important;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
}

.stage-stars {
  font-size: 0.95rem;
  letter-spacing: 2px;
  line-height: 1;
  white-space: nowrap;
}

.stage-stars.stars-earned {
  color: #f59e0b;
  filter: drop-shadow(0 1px 3px rgba(245, 158, 11, 0.4));
}

.stage-stars.stars-none {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Card Body: Title + Description */
.curriculum-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.stage-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin: 0;
}

.stage-desc {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* Card Bottom: Performance Badge */
.curriculum-item-bottom {
  display: flex;
  align-items: center;
  padding-top: 4px;
}

.stage-perf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.stage-perf-badge.perf-done {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.stage-perf-badge.perf-pending {
  background: var(--bg-editor);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Light Mode Overrides for Crisp Appearance */
[data-theme="light"] .curriculum-level-block {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .curriculum-stage-item {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .curriculum-stage-item:hover {
  background: #f1f5f9;
  border-color: #0284c7;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.12);
}

[data-theme="light"] .curriculum-stage-item.current-active {
  background: #fffbeb;
  border-color: #f59e0b;
}

[data-theme="light"] .stage-code {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #bae6fd;
}

[data-theme="light"] .stage-title {
  color: #0f172a;
}

[data-theme="light"] .stage-desc {
  color: #64748b;
}

[data-theme="light"] .stage-perf-badge.perf-done {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

[data-theme="light"] .stage-perf-badge.perf-pending {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

/* =========================================================
   Celebration Modal
   ========================================================= */
.celebration-modal-content {
  max-width: 540px;
  text-align: center;
}

.celebration-icon {
  font-size: 3.5rem;
  margin-bottom: 6px;
}

.celebration-stars {
  font-size: 2.4rem;
  letter-spacing: 6px;
  margin: 8px 0;
}

.celebration-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
}

.celebration-stat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.celebration-stat-item .label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.celebration-stat-item .val {
  font-size: 1.3rem;
  font-weight: 800;
  color: #10b981;
}

.celebration-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* =========================================================
   Responsive Adjustments
   ========================================================= */
@media (max-width: 900px) {
  .tutor-guide-arena {
    grid-template-columns: 120px 1fr;
  }
  .guide-hands-box {
    grid-column: 1 / -1;
  }
  .hands-svg {
    max-width: 280px;
  }
}

@media (max-width: 768px) {
  .tutor-standalone-app {
    padding: 10px;
    gap: 12px;
  }
  .tutor-guide-arena {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .guide-target-box {
    min-height: auto;
  }
  .instruction-row {
    justify-content: center;
  }
  .tutor-hud-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .tutor-text-stream {
    font-size: 1.7rem;
  }
}
