/* How to Draw: Step by Step — Stylesheet */

:root {
  --h-primary: #3b82f6;
  --h-success: #10b981;
  --h-gold: #f59e0b;
  --h-pink: #ec4899;
  --h-canvas-w: min(72vw, 640px);
  --h-canvas-h: min(58vh, 460px);
}

body {
  background: radial-gradient(circle at 50% 20%, #e0f2fe 0%, #f1f5f9 100%);
  color: #1e293b;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

#instruction {
  cursor: pointer;
}

.draw-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 8px 16px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Lessons Dock Sidebar */
.lessons-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 3px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px;
  box-shadow: 0 10px 28px rgba(100, 116, 139, 0.14);
  max-height: 94%;
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 10;
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.lesson-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 64px;
  padding: 8px 6px;
  border-radius: 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lesson-card .lesson-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.lesson-card .lesson-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
  text-align: center;
}

.lesson-card:hover {
  background: #ffffff;
  border-color: var(--h-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.lesson-card.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.18));
  border-color: var(--h-primary);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
  transform: scale(1.04);
}

.lesson-card.active .lesson-name {
  color: var(--h-primary);
}

/* Center Easel Stage */
.easel-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.easel-canvas-frame {
  position: relative;
  background: #ffffff;
  padding: 12px;
  border-radius: 28px;
  box-shadow: 0 16px 36px rgba(100, 116, 139, 0.2), 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 4px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  max-height: 100%;
}

.easel-viewport {
  position: relative;
  width: var(--h-canvas-w);
  height: var(--h-canvas-h);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

.easel-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.fx-layer {
  pointer-events: none;
  z-index: 5;
}

/* Guide Hand */
.guide-hand {
  position: absolute;
  font-size: 2.2rem;
  pointer-events: none;
  z-index: 6;
  transform: translate(-35%, 0);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
  animation: hand-pulse 1.4s infinite ease-in-out;
  transition: opacity 0.3s ease;
}

.guide-hand.hidden {
  opacity: 0;
  visibility: hidden;
}

@keyframes hand-pulse {
  0%, 100% { transform: translate(-35%, 0) scale(1); }
  50% { transform: translate(-35%, -8px) scale(1.15) rotate(-6deg); }
}

/* Bottom Step Controls Strip */
.easel-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}

/* Step Progress Dots */
.step-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 800;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-dot.active {
  background: var(--h-primary);
  color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

.step-dot.completed {
  background: var(--h-success);
  color: #ffffff;
}

/* Easel Action Buttons */
.easel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.easel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.easel-btn .btn-icon {
  font-size: 1.25rem;
}

.next-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.45);
}

.restart-btn {
  background: #f1f5f9;
  color: #334155;
}

.restart-btn:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

.save-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.save-btn:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Responsive - Portrait & Narrow Screens */
@media (max-width: 820px) and (orientation: portrait), (max-width: 640px) {
  .draw-field {
    flex-direction: column-reverse;
    gap: 8px;
    padding: 4px 8px;
  }

  .lessons-dock {
    width: 100%;
    max-height: 22vh;
    border-radius: 18px;
    padding: 6px;
    overflow-y: hidden;
    overflow-x: auto;
  }

  .lessons-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .lesson-card {
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
  }

  .lesson-card .lesson-icon {
    font-size: 1.3rem;
  }

  .lesson-card .lesson-name {
    display: none;
  }

  :root {
    --h-canvas-w: min(94vw, 480px);
    --h-canvas-h: min(44vh, 340px);
  }

  .easel-btn .btn-text {
    display: none;
  }
}

/* Responsive - Landscape on small screens (phones/tablets) */
@media (max-height: 520px) and (orientation: landscape) {
  .draw-field {
    flex-direction: row;
    gap: 8px;
    padding: 4px 8px;
  }

  .lessons-dock {
    max-height: 94%;
    padding: 4px;
  }

  .lessons-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .lesson-card {
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
  }

  .lesson-card .lesson-name {
    display: none;
  }

  :root {
    --h-canvas-w: min(65vw, 480px);
    --h-canvas-h: min(66vh, 340px);
  }

  .easel-btn .btn-text {
    display: none;
  }
}
