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

:root {
  --neon-purple: #9333ea;
  --neon-purple-glow: rgba(147, 51, 234, 0.5);
  --neon-purple-light: #a855f7;
  --neon-magenta: #c026d3;
  --neon-cyan: #06b6d4;
  --siyosis-dark: #0f172a;
  --header-bg: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  --stage-bg: #f8fafc;
  --border-color: #cbd5e1;
  --text-dark: #0f172a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--stage-bg);
  font-family: 'Plus Jakarta Sans', 'Fredoka', sans-serif;
  touch-action: none !important;
  -ms-touch-action: none !important;
  -webkit-touch-callout: none !important;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background-color: var(--stage-bg);
  position: relative;
}

/* =========================================================
   TOP HEADER BAR
   ========================================================= */
.top-bar {
  height: 54px;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 2px solid rgba(168, 85, 247, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 20;
  flex-shrink: 0;
}

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

.brand-logo-img {
  height: 38px;
  max-width: 120px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(168, 85, 247, 0.35));
}

.app-title {
  color: #ffffff;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-shadow: 0 2px 10px rgba(168, 85, 247, 0.4);
}

.app-title span.neon-text {
  background: linear-gradient(135deg, #c084fc 0%, #e879f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

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

/* Neon Purple Print Action Button */
.btn-print-action {
  background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
  color: #ffffff;
  border: 1.5px solid rgba(216, 180, 254, 0.4);
  border-radius: 12px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 14px rgba(147, 51, 234, 0.5), 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.15s ease;
}

.btn-print-action:hover {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.7);
  transform: translateY(-1px);
}

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

.btn-print-action svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(192, 132, 252, 0.5);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

/* =========================================================
   CONTROLS BAR - Neon Accents
   ========================================================= */
.controls-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 15;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  flex-shrink: 0;
}
.controls-bar::-webkit-scrollbar {
  display: none;
}

.btn-group {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}

.btn-pill {
  border: none;
  background: transparent;
  padding: 7px 15px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-pill:hover:not(.active) {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-pill.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.45);
}

.btn-group.labeled-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding-left: 8px;
}

.group-label {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  margin-right: 4px;
}

.btn-pill.size-btn.active {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.btn-pill.speed-btn.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* =========================================================
   LINE SELECTION STRIP
   ========================================================= */
.lines-strip {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  z-index: 14;
  flex-shrink: 0;
}

.line-item-btn {
  flex: 0 0 auto;
  min-width: 105px;
  height: 52px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 2px;
}

.line-item-btn:hover:not(.active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.line-item-btn.active {
  background: #faf5ff;
  border-color: #a855f7;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.25), 0 2px 6px rgba(0,0,0,0.04);
}

.line-item-btn.active .line-item-name {
  color: #7e22ce;
  font-weight: 800;
}

.line-item-preview {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.line-item-preview svg {
  max-width: 95%;
  max-height: 26px;
  stroke: #475569;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-item-btn.active .line-item-preview svg {
  stroke: #9333ea;
}

.line-item-name {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

/* =========================================================
   STAGE WORKSPACE
   ========================================================= */
.stage-area {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 18px 6px 18px;
  overflow: hidden;
}

.stage-header-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-shrink: 0;
  z-index: 10;
}

.current-line-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.guide-pill {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 18px;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.guide-pill.feedback-badge {
  font-size: 15px;
  font-weight: 800;
}
.guide-pill.feedback-badge.great {
  background: #ecfdf5;
  color: #065f46;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
.guide-pill.feedback-badge.good {
  background: #eff6ff;
  color: #1e40af;
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
.guide-pill.feedback-badge.try {
  background: #fffbeb;
  color: #92400e;
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.canvas-wrapper {
  width: 100%;
  max-width: 1240px;
  flex: 1;
  min-height: 0;
  max-height: 480px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none !important;
  -ms-touch-action: none !important;
}

#draw-canvas {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  display: block;
  touch-action: none !important;
  -ms-touch-action: none !important;
  -webkit-touch-callout: none !important;
  cursor: crosshair;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

/* =========================================================
   BOTTOM TOOLBAR
   ========================================================= */
.bottom-bar {
  height: 54px;
  background: transparent;
  padding: 0 20px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 15;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.palette-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.palette-container .color-picker-bar {
  pointer-events: auto;
}

.bottom-controls-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-counter {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  min-width: 80px;
  text-align: center;
}

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

/* Common Secondary Button Style */
.btn-secondary {
  height: 40px;
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.1s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #a855f7;
  color: #7c3aed;
  transform: translateY(-1px);
}

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

/* Play Button: Exactly the same height as Clear button, with neon purple gradient! */
.btn-secondary.btn-action-play {
  background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
  color: #ffffff;
  border: 1.5px solid rgba(216, 180, 254, 0.4);
  box-shadow: 0 0 14px rgba(147, 51, 234, 0.45);
  font-weight: 800;
}
.btn-secondary.btn-action-play:hover {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.65);
}

/* Next Button */
.btn-secondary.btn-next {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  border: none;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.45);
  font-weight: 800;
}
.btn-secondary.btn-next:hover {
  background: linear-gradient(135deg, #22d3ee 0%, #0369a1 100%);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.65);
}

/* =========================================================
   COLOR PICKER
   ========================================================= */
.color-picker-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 4px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.color-dot {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.color-dot.active {
  transform: scale(1.25);
  border: 2.5px solid #0f172a;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

/* Rainbow Dot */
.color-dot.rainbow-dot {
  background: conic-gradient(#ef4444, #f59e0b, #10b981, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}
.color-dot.rainbow-dot.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 2.5px #ffffff, 0 0 0 4.5px #a855f7, 0 0 12px rgba(168, 85, 247, 0.6);
  border: none;
}

/* =========================================================
   CONFETTI & MODALS
   ========================================================= */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 36px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  text-align: center;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
}

.modal-text {
  font-size: 14.5px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 22px;
}

/* =========================================================
   WORKSHEET STYLES
   ========================================================= */
.worksheet-page {
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  color: #0f172a;
  width: 100%;
}

.ws-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2.5px solid #7c3aed;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.ws-brand {
  display: flex;
  align-items: center;
}

.ws-logo-img {
  height: 48px;
  max-width: 160px;
  object-fit: contain;
}

.ws-header-badge {
  background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: 20px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ws-info-bar {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  margin-bottom: 12px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ws-objective {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #faf5ff;
  border: 1.5px solid #d8b4fe;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  margin-bottom: 12px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ws-obj-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-obj-badge {
  background: #7c3aed;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ws-obj-name {
  font-weight: 800;
  font-size: 14px;
  color: #581c87;
}

.ws-obj-hint {
  font-size: 12.5px;
  color: #6b21a8;
  font-weight: 600;
}

.ws-content-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-row-container {
  width: 100%;
  page-break-inside: avoid;
  break-inside: avoid;
}

.ws-row-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-row-num {
  width: 18px;
  height: 18px;
  background: #7c3aed;
  color: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ws-row-canvas {
  width: 100%;
  border-radius: 10px;
}

/* Footer: Big Empty Stars and Signature */
.ws-footer-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 10px 20px;
  margin-top: 10px;
  font-size: 13px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  page-break-inside: avoid;
  break-inside: avoid;
}

.ws-eval-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-eval-title {
  font-weight: 800;
  color: #334155;
  font-size: 13.5px;
}

.ws-empty-stars {
  font-size: 28px;
  letter-spacing: 6px;
  color: #7c3aed;
  font-weight: 400;
  line-height: 1;
}

.ws-signature-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.ws-sig-label {
  font-weight: 700;
  color: #475569;
  font-size: 13px;
}

.ws-sig-line {
  color: #94a3b8;
  letter-spacing: 1px;
}

.ws-bottom-bar {
  text-align: center;
  margin-top: 8px;
  font-size: 11px;
  color: #64748b;
  font-style: italic;
}

.btn-text-short {
  display: none;
}
.btn-text-full {
  display: inline;
}

/* =========================================================
   RESPONSIVE ADJUSTMENTS (Smartboard, Tablet & Mobile)
   ========================================================= */
@media (max-width: 900px) {
  .app-title { font-size: 19px; }
  .current-line-title { font-size: 22px; }
  .btn-pill { padding: 6px 11px; font-size: 12.5px; }
  .line-item-btn { min-width: 95px; height: 50px; }
  .line-item-name { font-size: 11px; }
  .btn-secondary { height: 38px; padding: 0 14px; font-size: 13px; }
  .bottom-bar { padding: 0 16px; height: 56px; }
  .btn-print-action span { display: none; }
}

@media (max-width: 650px) {
  .top-bar {
    height: 50px;
    padding: 0 10px;
  }
  .brand-logo-img {
    height: 28px;
  }
  .app-title {
    font-size: 17px;
  }
  .top-actions {
    gap: 6px;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
  .icon-btn svg {
    width: 17px;
    height: 17px;
  }
  .btn-print-action {
    padding: 6px 10px;
    height: 32px;
    border-radius: 9px;
  }
  .btn-print-action svg {
    width: 16px;
    height: 16px;
  }

  .controls-bar {
    padding: 6px 8px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .btn-pill {
    padding: 5px 9px;
    font-size: 11.5px;
    border-radius: 8px;
  }
  .group-label {
    font-size: 11.5px;
  }

  .lines-strip {
    padding: 5px 8px;
    gap: 6px;
  }
  .line-item-btn {
    min-width: 80px;
    height: 44px;
    padding: 3px 6px;
    border-radius: 9px;
  }
  .line-item-preview svg {
    height: 18px;
  }
  .line-item-name {
    font-size: 10px;
  }

  .stage-area {
    padding: 6px 8px;
    justify-content: flex-start;
  }
  .stage-header-info {
    flex-direction: column;
    gap: 3px;
    margin-bottom: 4px;
  }
  .current-line-title {
    font-size: 18px;
    margin-bottom: 2px;
  }
  .guide-pill {
    font-size: 11.5px;
    padding: 4px 12px;
  }

  /* Canvas on mobile: Keep it an authentic wide notebook row, never a giant square! */
  .canvas-wrapper {
    width: 100%;
    max-width: 100%;
    max-height: 220px;
    min-height: 160px;
    aspect-ratio: 16 / 8;
    flex: none;
    margin: auto 0;
  }

  .bottom-bar {
    height: auto;
    flex-direction: column;
    padding: 2px 10px 6px 10px;
    gap: 6px;
    margin-bottom: 2px;
  }
  .palette-container {
    position: static;
    transform: none;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: auto;
  }
  .color-picker-bar {
    gap: 6px;
    padding: 3px 8px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
  }
  .color-dot {
    width: 24px;
    height: 24px;
  }
  .bottom-controls-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .progress-counter {
    padding: 5px 8px;
    font-size: 12px;
    min-width: 46px;
    border-radius: 9px;
  }
  .right-actions {
    gap: 5px;
  }
  .btn-secondary {
    height: 36px;
    padding: 0 9px;
    font-size: 12px;
    border-radius: 9px;
    gap: 4px;
  }
  .btn-secondary.btn-action-play {
    padding: 0 11px;
  }
  .btn-text-full {
    display: none;
  }
  .btn-text-short {
    display: inline;
  }
}

@media (max-width: 380px) {
  .btn-secondary {
    padding: 0 7px;
    font-size: 11px;
  }
  .progress-counter {
    padding: 5px 6px;
    font-size: 11px;
    min-width: 44px;
  }
}
