/* ============================================================
   StitchCraft Edu (바느질 배움터 & 워크북 공방) — sewing-style.css
   디자인 기준: student/DESIGN.md & shared/yuja-tokens.css
   ============================================================ */

/* 바느질 전용 기능 토큰 (Yuja EDU 팔레트와 조화) */
:root {
  --sewing-in-color: #2563EB;        /* 겉 -> 안 (IN): 선명한 로열 블루 (●) */
  --sewing-out-color: #DC2626;       /* 안 -> 겉 (OUT): 활력 있는 레드 오렌지 (○) */
  --sewing-thread-front: #854D0E;    /* 겉면 실: 짙은 웜 린넨 브라운 */
  --sewing-thread-back: #D97706;     /* 안면 실: 골드 앰버 (점선) */
  --sewing-thread-active: #B45309;  /* 현재 진행 중인 실: 진한 포인트 앰버 */
  --sewing-fabric-bg: #FAF6F0;       /* 원단 베이스: 포근한 코튼 크림 */
  --sewing-fabric-grid: #EAE3D6;     /* 원단 텍스처/격자 가이드 */
  --sewing-needle-metal: #71717A;    /* 바늘 메탈 그레이 */
}

/* 기본 리셋 & 공통 레이아웃 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background-color: var(--color-canvas-cream);
  color: var(--color-ink);
  line-height: 1.6;
  letter-spacing: var(--letter-spacing-normal);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------
   상단 글로벌 네비게이션
   ------------------------------------------------------------ */
.sewing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
  box-shadow: var(--shadow-subtle);
}

.sewing-nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sewing-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-ink-deep);
}

.sewing-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--color-yuja-lemon-tint);
  border: 1.5px solid var(--color-yuja-lemon-amber);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sewing-brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.sewing-brand-text span {
  font-size: 11px;
  color: var(--color-slate);
  font-weight: 500;
}

.sewing-nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sewing-nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-charcoal);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  transition: all 150ms ease;
}

.sewing-nav-link:hover, .sewing-nav-link.active {
  background-color: var(--color-surface);
  color: var(--color-ink-deep);
}

/* 워크북 바구니 버튼 (Starbucks Frap/Pill 변형) */
.basket-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--color-yuja-forest);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease;
  text-decoration: none;
}

.basket-pill-btn:hover {
  opacity: 0.92;
}

.basket-pill-btn:active {
  transform: var(--btn-press-scale);
}

.basket-count-badge {
  background-color: var(--color-yuja-lemon-amber);
  color: var(--color-ink-deep);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* ------------------------------------------------------------
/* ------------------------------------------------------------
   유튜브 영상 시청 버튼
   ------------------------------------------------------------ */
.btn-youtube {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: #FFFFFF;
  border: 1.5px solid #FF0000;
  color: #CC0000;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-subtle);
  transition: all 150ms ease;
}

.btn-youtube:hover {
  background-color: #FFF5F5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.15);
}

/* ------------------------------------------------------------
   히어로 섹션 (컴팩트 Notion 디자인)
   ------------------------------------------------------------ */
.sewing-hero {
  background: linear-gradient(180deg, var(--color-canvas) 0%, var(--color-canvas-cream) 100%);
  padding: 28px 24px 22px;
  text-align: center;
  border-bottom: 1px solid var(--color-hairline);
}

.sewing-hero-inner {
  max-width: 860px;
  margin: 0 auto;
}

.sewing-hero h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--color-ink-deep);
  margin-bottom: 12px;
  line-height: 1.3;
}

/* 상황별 퀵 필터 리본 */
.situation-ribbon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.situation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-charcoal);
  cursor: pointer;
  transition: all 150ms ease;
}

.situation-chip:hover {
  background-color: var(--color-yuja-lemon-tint);
  border-color: var(--color-yuja-lemon-amber);
  color: var(--color-ink-deep);
  transform: translateY(-1px);
}

.situation-chip.active {
  background-color: var(--color-yuja-forest);
  border-color: var(--color-yuja-forest);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(30, 70, 32, 0.25);
}

/* ------------------------------------------------------------
   메인 콘텐츠 레이아웃
   ------------------------------------------------------------ */
.sewing-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

/* 컨트롤 툴바 (카테고리 탭, 정렬, 전체선택) */
.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-hairline);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.cat-tab-btn {
  padding: 8px 16px;
  border: 1px solid var(--color-hairline);
  background-color: var(--color-canvas);
  color: var(--color-charcoal);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cat-tab-btn:hover {
  background-color: var(--color-surface);
}

.cat-tab-btn.active {
  background-color: var(--color-yuja-forest);
  color: #FFFFFF;
  border-color: var(--color-yuja-forest);
}

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

/* 툴바용 컴팩트 유튜브 버튼 */
.btn-youtube-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  gap: 6px;
  border-radius: var(--radius-md);
  border: 1px solid #FF0000;
  box-shadow: none;
}

.sort-select {
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-canvas);
  color: var(--color-ink);
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--color-leaf-green);
}

/* 뷰 모드 전환 버튼 (목록형 ☰ / 카드형 ☷) */
.view-mode-toggle {
  display: inline-flex;
  background-color: var(--color-surface);
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.view-toggle-btn {
  width: 32px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 15px;
  color: var(--color-slate);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}

.view-toggle-btn:hover {
  color: var(--color-ink-deep);
}

.view-toggle-btn.active {
  background-color: var(--color-canvas);
  color: var(--color-yuja-forest);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ------------------------------------------------------------
   게시판 형태 (1행 목록형 뷰) — Stitch List View (기본값)
   ------------------------------------------------------------ */
.stitch-list-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stitch-list-row {
  background-color: var(--color-canvas);
  border: 1.5px solid var(--color-hairline);
  border-radius: var(--radius-xl);
  padding: 16px 22px;
  min-height: 84px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  user-select: none;
}

.stitch-list-row:hover {
  border-color: var(--color-yuja-lemon-amber);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.stitch-list-row.dragging {
  opacity: 0.4;
  border: 2px dashed var(--color-leaf-green);
}

.stitch-list-row.drag-over {
  border-top: 3px solid var(--color-leaf-green);
}

.drag-handle {
  color: var(--color-steel);
  font-size: 20px;
  cursor: grab;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1;
}

.drag-handle:hover {
  color: var(--color-ink-deep);
  background-color: var(--color-surface);
}

.drag-handle:active {
  cursor: grabbing;
}

.stitch-list-preview {
  width: 110px;
  height: 64px;
  flex-shrink: 0;
  background-color: var(--sewing-fabric-bg);
  border: 1.5px solid var(--sewing-fabric-grid);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.stitch-list-preview:hover {
  border-color: var(--color-yuja-lemon-amber);
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stitch-list-preview::after {
  content: '🔍';
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 11px;
  opacity: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  padding: 1px 3px;
  line-height: 1;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.stitch-list-preview:hover::after {
  opacity: 1;
}

.stitch-list-preview svg {
  width: 100%;
  height: 100%;
}

.stitch-list-main {
  flex: 1;
  min-width: 220px;
}

.stitch-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.stitch-list-name-ko {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--color-ink-deep);
}

.stitch-list-name-en {
  font-size: 12.5px;
  color: var(--color-steel);
  font-weight: 600;
}

.stitch-list-summary {
  font-size: 13.5px;
  color: var(--color-slate);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.stitch-list-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.stitch-list-diff {
  min-width: 75px;
  text-align: center;
}

.stitch-list-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stitch-learn-btn-sm {
  height: 42px;
  padding: 0 20px;
  background-color: var(--color-yuja-lemon-amber);
  color: var(--color-ink-deep);
  font-size: 13.5px;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 150ms ease;
  white-space: nowrap;
}

.stitch-learn-btn-sm:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .stitch-list-row {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
  }
  .stitch-list-summary {
    white-space: normal;
    max-width: 100%;
  }
  .stitch-list-tags {
    display: none;
  }
}

/* ------------------------------------------------------------
   썸네일 마우스 호버 시 대형 돋보기 팝오버 (Hover Large Preview)
   ------------------------------------------------------------ */
.stitch-hover-preview-popover {
  position: fixed;
  z-index: 1000;
  width: 460px;
  background-color: #FFFFFF;
  border: 2px solid var(--color-yuja-lemon-amber);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22), 0 4px 14px rgba(0, 0, 0, 0.08);
  padding: 16px 18px;
  pointer-events: none; /* 마우스 간섭 방지 */
  opacity: 0;
  transform: scale(0.95) translateY(6px);
  transition: opacity 160ms cubic-bezier(0.16, 1, 0.3, 1), transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stitch-hover-preview-popover.active {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.hover-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-hairline);
  padding-bottom: 8px;
}

.hover-preview-titles {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hover-preview-name-ko {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-ink-deep);
}

.hover-preview-name-en {
  font-size: 13px;
  color: var(--color-steel);
  font-weight: 600;
}

.hover-preview-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background-color: var(--color-leaf-green-tint);
  color: var(--color-leaf-green-deep);
}

.hover-preview-canvas {
  width: 100%;
  height: 200px;
  background-color: var(--sewing-fabric-bg);
  border: 1.5px solid var(--sewing-fabric-grid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hover-preview-canvas svg {
  width: 100%;
  height: 100%;
}

.hover-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--color-slate);
  padding-top: 4px;
}

.hover-preview-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hover-preview-hint {
  color: var(--color-leaf-green-deep);
  font-weight: 700;
}

/* ------------------------------------------------------------
   바느질 카드 그리드
   ------------------------------------------------------------ */
.stitch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.stitch-card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  position: relative;
}

.stitch-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-mockup);
  border-color: var(--color-yuja-lemon-amber);
}

.stitch-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.stitch-category-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background-color: var(--color-leaf-green-tint);
  color: var(--color-leaf-green-deep);
}

.stitch-basket-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-slate);
  cursor: pointer;
  user-select: none;
}

.stitch-basket-checkbox input {
  accent-color: var(--color-leaf-green);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.stitch-preview-box {
  background-color: var(--sewing-fabric-bg);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.stitch-preview-box:hover {
  border-color: var(--color-yuja-lemon-amber);
  transform: scale(1.02);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.stitch-preview-box::after {
  content: '🔍 크게보기';
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-ink-deep);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--color-hairline);
  border-radius: 4px;
  padding: 2px 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.stitch-preview-box:hover::after {
  opacity: 1;
}

.stitch-preview-box svg {
  width: 100%;
  height: 100%;
}

.stitch-info {
  margin-bottom: 16px;
}

.stitch-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.stitch-name-ko {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-ink-deep);
}

.stitch-name-en {
  font-size: 12px;
  color: var(--color-steel);
  font-weight: 500;
}

.stitch-diff-rating {
  font-size: 11px;
  color: #F59E0B;
  margin-bottom: 8px;
}

.stitch-summary {
  font-size: 13px;
  color: var(--color-charcoal);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.stitch-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.stitch-tag {
  font-size: 11px;
  background-color: var(--color-surface);
  color: var(--color-slate);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.stitch-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--color-hairline);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stitch-learn-btn {
  flex: 1;
  height: 40px;
  background-color: var(--color-yuja-lemon-amber);
  color: var(--color-ink-deep);
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms ease, filter 150ms ease;
}

.stitch-learn-btn:hover { filter: brightness(1.05); }
.stitch-learn-btn:active { transform: var(--btn-press-scale); }

/* ------------------------------------------------------------
   필수 기초관 섹션 (도구 백과, 매듭법, 안전 수칙)
   ------------------------------------------------------------ */
.basics-section {
  margin-top: 60px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-card);
}

.basics-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 28px;
}

.basics-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-ink-deep);
  margin-bottom: 8px;
}

.basics-tab-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--color-hairline);
  padding-bottom: 12px;
}

.basics-tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-slate);
  cursor: pointer;
  transition: all 150ms ease;
}

.basics-tab-btn.active {
  color: var(--color-leaf-green-deep);
  border-bottom-color: var(--color-leaf-green);
}

.basics-content-pane {
  display: none;
}

.basics-content-pane.active {
  display: block;
}

/* 도구 백과 카드 그리드 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.tool-card {
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  background-color: var(--color-canvas-cream);
}

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

.tool-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-title h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-ink-deep);
}

.tool-tag {
  font-size: 11px;
  background-color: var(--color-yuja-lemon-tint);
  border: 1px solid var(--color-yuja-lemon-amber);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.tool-desc {
  font-size: 13px;
  color: var(--color-charcoal);
  margin-bottom: 12px;
}

.tool-usage-list {
  font-size: 12px;
  color: var(--color-slate);
  margin-left: 16px;
  margin-bottom: 10px;
}

.tool-caution {
  font-size: 12px;
  color: var(--color-error);
  background-color: #FEF2F2;
  border-left: 3px solid var(--color-error);
  padding: 6px 10px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   학습관 (learn.html) 2-Column 인터랙티브 화면
   ------------------------------------------------------------ */
.learn-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.learn-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-charcoal);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
}

.back-link-btn:hover { background-color: var(--color-surface); }

.learn-main-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
}

@media (max-width: 992px) {
  .learn-main-grid {
    grid-template-columns: 1fr;
  }
}

/* 좌측 SVG 캔버스 박스 */
.canvas-card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-hairline);
}

.view-mode-tabs {
  display: flex;
  background-color: var(--color-surface);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.view-mode-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-slate);
  cursor: pointer;
  transition: all 150ms ease;
}

.view-mode-btn.active {
  background-color: var(--color-canvas);
  color: var(--color-ink-deep);
  box-shadow: var(--shadow-subtle);
}

.canvas-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-charcoal);
  cursor: pointer;
  user-select: none;
}

/* 인터랙티브 캔버스 뷰포트 */
.svg-viewport-wrapper {
  background-color: var(--sewing-fabric-bg);
  border: 2px dashed var(--sewing-fabric-grid);
  border-radius: var(--radius-lg);
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 300ms ease;
}

.svg-viewport-wrapper.mirrored svg {
  transform: scaleX(-1);
}

/* 왼손잡이 모드에서 숫자 및 텍스트는 좌우 반전되지 않도록 원상태 유지 */
.svg-viewport-wrapper.mirrored svg text {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleX(-1);
}

/* =====================================================
   태블릿 터치 실습 최적화
   ===================================================== */

/* SVG 전체 터치 지연 제거 */
.svg-viewport-wrapper svg {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 실습 모드 홀 — 포인터 이벤트 + 터치 최적화 */
.stitch-hole-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 투명 터치 히트박스 — 터치는 받지만 시각적으로는 보이지 않음 */
.stitch-hole-touch-hitbox {
  pointer-events: all;
  touch-action: manipulation;
}

/* 실습 모드 활성 시 — 홀에 커서 포인터 강조 */
.practice-interactive-hole {
  cursor: pointer;
}

/* 정답 애니메이션 (초록 펄스) */
@keyframes hole-correct-pulse {
  0%   { filter: drop-shadow(0 0 0px #22C55E); transform: scale(1); }
  40%  { filter: drop-shadow(0 0 10px #22C55E); transform: scale(1.18); }
  100% { filter: drop-shadow(0 0 0px #22C55E); transform: scale(1); }
}

.hole-correct-anim {
  animation: hole-correct-pulse 0.45s ease-out both;
  transform-origin: center center;
  transform-box: fill-box;
}

/* 오답 애니메이션 (빨간 흔들림) */
@keyframes hole-wrong-shake {
  0%   { transform: translateX(0);    filter: drop-shadow(0 0 0px #EF4444); }
  20%  { transform: translateX(-5px); filter: drop-shadow(0 0 7px #EF4444); }
  40%  { transform: translateX(5px);  filter: drop-shadow(0 0 7px #EF4444); }
  60%  { transform: translateX(-4px); filter: drop-shadow(0 0 5px #EF4444); }
  80%  { transform: translateX(3px);  filter: drop-shadow(0 0 3px #EF4444); }
  100% { transform: translateX(0);    filter: drop-shadow(0 0 0px #EF4444); }
}

.hole-wrong-anim {
  animation: hole-wrong-shake 0.45s ease-out both;
  transform-origin: center center;
  transform-box: fill-box;
}

/* practice-active: 실습 모드 캔버스 테두리 강조 */
.svg-viewport-wrapper.practice-active {
  border-color: var(--color-yuja-forest);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.25);
  background-color: #FAFFF9;
}


.practice-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: #FFFFFF;
  border: 1.5px solid var(--color-yuja-forest);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-yuja-forest);
  cursor: pointer;
  transition: all 180ms ease;
  box-shadow: 0 2px 6px rgba(46, 125, 50, 0.12);
  user-select: none;
}

.practice-toggle-btn:hover {
  background-color: var(--color-leaf-green-tint);
  transform: translateY(-1px);
}

.practice-toggle-btn.active {
  background-color: var(--color-yuja-forest);
  color: #FFFFFF;
  border-color: var(--color-leaf-green-deep);
  box-shadow: 0 3px 12px rgba(46, 125, 50, 0.35);
}

.practice-btn-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-slate);
  letter-spacing: 0.5px;
}

.practice-toggle-btn.active .practice-btn-pill {
  background: #FFFFFF;
  color: var(--color-yuja-forest);
}

.svg-viewport-wrapper svg {
  width: 100%;
  height: 100%;
  max-height: 420px;
}

/* 캔버스 하단 재생 컨트롤러 바 */
.canvas-player-bar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background-color: var(--color-surface-soft);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
}

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

.player-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-hairline-strong);
  background-color: var(--color-canvas);
  color: var(--color-ink-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 150ms ease;
}

.player-btn:hover { background-color: var(--color-surface); }
.player-btn:active { transform: var(--btn-press-scale); }

.player-btn-primary {
  background-color: var(--color-yuja-lemon-amber);
  border-color: var(--color-yuja-lemon-amber);
}

.speed-select {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-canvas);
  cursor: pointer;
}

/* 우측 스텝 가이드 카드 */
.guide-card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.step-indicator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.step-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background-color: var(--color-yuja-forest);
  color: #FFFFFF;
}

.action-type-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.action-type-badge.out {
  background-color: #FEE2E2;
  color: var(--sewing-out-color);
  border: 1px solid #FCA5A5;
}

.action-type-badge.in {
  background-color: #DBEAFE;
  color: var(--sewing-in-color);
  border: 1px solid #93C5FD;
}

.step-instruction-box {
  background-color: var(--color-canvas-cream);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.step-instruction-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink-deep);
  line-height: 1.5;
  margin-bottom: 8px;
}

.step-tip-text {
  font-size: 13px;
  color: var(--color-slate);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

/* 연습 모드 퀴즈 배너 */
.practice-alert-box {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}

.practice-alert-box.correct {
  display: block;
  background-color: var(--color-leaf-green-tint);
  border: 1px solid var(--color-leaf-green);
  color: var(--color-leaf-green-deep);
}

.practice-alert-box.wrong {
  display: block;
  background-color: #FEF2F2;
  border: 1px solid #F87171;
  color: var(--color-error);
}

/* ------------------------------------------------------------
   인쇄 워크북 화면 (workbook.html)
   ------------------------------------------------------------ */
.workbook-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

.workbook-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .workbook-layout {
    grid-template-columns: 1fr;
  }
}

.settings-panel {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 80px;
}

.preview-stage {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* A4 시뮬레이션 용지 (화면 표시용) */
.a4-sheet {
  background-color: #FFFFFF;
  width: 100%;
  max-width: 800px;
  min-height: 1100px;
  margin: 0 auto;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  border-radius: 4px;
  border: 1px solid #D1D5DB;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 우측 하단 위아래로 긴 컴팩트 플로팅 버튼 (텍스트 없이 아이콘과 수량만) */
.floating-basket-vertical {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 52px;
  height: 104px;
  background-color: var(--color-yuja-forest);
  border: 2px solid var(--color-yuja-lemon-amber);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  text-decoration: none;
  cursor: pointer;
  z-index: 999;
  transform: translateY(160px);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease, box-shadow 150ms ease, filter 150ms ease;
  user-select: none;
}

.floating-basket-vertical.show {
  transform: translateY(0);
  opacity: 1;
}

.floating-basket-vertical:hover {
  filter: brightness(1.12);
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.floating-basket-vertical:active {
  transform: translateY(0) scale(0.97);
}

.fb-icon-top {
  font-size: 22px;
  line-height: 1;
}

.fb-badge-count {
  width: 26px;
  height: 26px;
  background-color: var(--color-yuja-lemon-amber);
  color: var(--color-ink-deep);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  line-height: 1;
}

.fb-icon-bottom {
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 640px) {
  .floating-basket-vertical {
    right: 18px;
    bottom: 22px;
    width: 48px;
    height: 96px;
  }
  .fb-icon-top { font-size: 20px; }
  .fb-badge-count { width: 24px; height: 24px; font-size: 12px; }
  .fb-icon-bottom { font-size: 16px; }
}
