/* ==============================================================================
   🏛️ STYLE.CSS - สไตล์ชีตสำหรับเว็บไซต์ห้องเรียนประวัติศาสตร์ คุณครูสุพัฒน์ จันทร์เหลือง
   ธีม: การ์ตูนผจญภัยย้อนรอยประวัติศาสตร์ (Historical Cartoon Adventure Theme)
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Sarabun:wght@300;400;500;600;700&family=Mali:wght@500;600;700&display=swap');

:root {
  /* โทนสีหลัก: โบราณคดี & ผจญภัยย้อนกาลเวลา */
  --primary-gold: #F59E0B;
  --primary-gold-dark: #D97706;
  --primary-gold-light: #FEF3C7;
  --terracotta: #E05626;
  --terracotta-dark: #B83A11;
  --terracotta-light: #FFEDD5;
  --indigo-history: #1E293B;
  --indigo-dark: #0F172A;
  --indigo-light: #F1F5F9;
  --jade-green: #059669;
  --jade-light: #D1FAE5;
  --purple-magic: #8B5CF6;
  --purple-light: #EDE9FE;
  
  /* พื้นหลังกระดาษสา/คัมภีร์ใบลานโบราณ */
  --bg-parchment: #FDFBF7;
  --bg-parchment-soft: #F9F6EE;
  --bg-card: #FFFFFF;
  --border-parchment: #E6D8C3;
  --border-bold: #2D251E;
  
  /* ตัวอักษร */
  --text-main: #2D251E;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  
  /* สไตล์การ์ตูน: เส้นขอบหนานุ่ม & เงาป๊อปอัป 3D */
  --cartoon-border: 2.5px solid #2D251E;
  --cartoon-border-thin: 1.5px solid #E6D8C3;
  --cartoon-shadow-sm: 3px 3px 0 #2D251E;
  --cartoon-shadow: 5px 5px 0 #2D251E;
  --cartoon-shadow-lg: 8px 8px 0 #2D251E;
  --cartoon-shadow-hover: 2px 2px 0 #2D251E;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 9999px;
  
  /* ฟอนต์ */
  --font-heading: 'Prompt', -apple-system, sans-serif;
  --font-body: 'Sarabun', -apple-system, sans-serif;
  --font-cartoon: 'Mali', cursive, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-parchment);
  color: var(--text-main);
  line-height: 1.65;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(224, 86, 38, 0.05) 0%, transparent 40%),
    linear-gradient(to right, rgba(230, 216, 195, 0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(230, 216, 195, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

/* ==============================================================================
   🧭 NAVIGATION BAR
   ============================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 251, 247, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: var(--cartoon-border);
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-gold);
  border: var(--cartoon-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--cartoon-shadow-sm);
  transform: rotate(-3deg);
  transition: transform 0.2s ease;
}

.nav-brand:hover .brand-icon {
  transform: rotate(3deg) scale(1.08);
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--indigo-dark);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--terracotta);
  font-weight: 600;
  font-family: var(--font-cartoon);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-link {
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link:hover {
  background: var(--primary-gold-light);
  color: var(--terracotta-dark);
}

.nav-link.active {
  background: var(--primary-gold);
  color: var(--indigo-dark);
  border: 1.5px solid var(--border-bold);
  box-shadow: 2px 2px 0 var(--border-bold);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-toc {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-gold-light);
  border: var(--cartoon-border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--cartoon-shadow-sm);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-toc:hover {
  transform: translateY(-2px);
  box-shadow: var(--cartoon-shadow);
  background: var(--primary-gold);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: var(--cartoon-border);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  font-size: 1.25rem;
  cursor: pointer;
  background: #FFF;
}

/* ==============================================================================
   📜 QUICK INDEX CAROUSEL / BAR (ตามแบบร่าง PDF หน้า 2: เบื้องต้น & เกี่ยวกับเนื้อหา)
   ============================================================================== */
.quick-index-banner {
  background: #FFFDF9;
  border-bottom: 2px dashed var(--border-parchment);
  padding: 0.75rem 1.5rem;
}

.quick-index-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.index-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.index-tag {
  font-family: var(--font-cartoon);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-bold);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.index-tag.basics {
  background: var(--purple-light);
  color: #5B21B6;
}

.index-tag.lessons {
  background: #DCFCE7;
  color: #166534;
}

.index-btn {
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  background: #FFF;
  border: 1.5px solid var(--border-parchment);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.index-btn:hover {
  border-color: var(--border-bold);
  background: var(--primary-gold-light);
  transform: translateY(-1px);
}

/* ==============================================================================
   👑 HERO BANNER SECTION (ต้อนรับสู่ห้องเรียนครูสุพัฒน์)
   ============================================================================== */
.hero-section {
  position: relative;
  padding: 3rem 1.5rem 4rem;
  overflow: hidden;
}

.hero-container {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 2.5rem;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
  border: var(--cartoon-border);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-cartoon);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--cartoon-shadow-sm);
  margin-bottom: 1.25rem;
  transform: rotate(-1deg);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--indigo-dark);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero-title .highlight-gold {
  color: var(--terracotta);
  position: relative;
  display: inline-block;
}

.hero-title .highlight-gold::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 10px;
  background: rgba(245, 158, 11, 0.35);
  border-radius: 4px;
  z-index: -1;
}

.hero-teacher-name {
  font-size: 1.4rem;
  color: var(--indigo-history);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--terracotta);
  color: #FFF;
  border: var(--cartoon-border);
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--cartoon-shadow);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--cartoon-shadow-lg);
  background: var(--terracotta-dark);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #FFF;
  color: var(--text-main);
  border: var(--cartoon-border);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--cartoon-shadow);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: var(--cartoon-shadow-lg);
  background: var(--primary-gold-light);
}

/* การ์ดโปรไฟล์คุณครู & ภาพประกอบประวัติศาสตร์ */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.teacher-card-frame {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow-lg);
  padding: 1.25rem;
  transform: rotate(1.2deg);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.teacher-card-frame:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 10px 10px 0 #2D251E;
}

.teacher-backdrop {
  height: 310px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: var(--cartoon-border);
  position: relative;
  background: linear-gradient(135deg, #FDE68A 0%, #F59E0B 100%);
  cursor: pointer;
}

.teacher-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  transition: transform 0.4s ease;
}

.teacher-backdrop:hover img {
  transform: scale(1.05);
}

.zoom-hint-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.82);
  color: #FFF;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.teacher-backdrop:hover .zoom-hint-badge {
  transform: scale(1.05);
  background: var(--terracotta);
}

.historical-badge-seal {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 75px;
  height: 75px;
  background: var(--primary-gold);
  border: var(--cartoon-border);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-cartoon);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  color: var(--indigo-dark);
  box-shadow: var(--cartoon-shadow-sm);
  transform: rotate(12deg);
  z-index: 5;
}

.teacher-info-banner {
  margin-top: 1rem;
  text-align: center;
}

.teacher-info-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--indigo-dark);
}

.teacher-info-subject {
  font-size: 0.88rem;
  color: var(--terracotta);
  font-weight: 600;
}

.teacher-speech-bubble {
  position: absolute;
  bottom: -20px;
  left: -20px;
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.1rem;
  box-shadow: var(--cartoon-shadow-sm);
  font-family: var(--font-cartoon);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--indigo-dark);
  transform: rotate(-3deg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==============================================================================
   📂 SECTION: ข้อมูลรายวิชา (COURSE INFO - ข้อ 1 ในลายมือ)
   ============================================================================== */
.section-wrapper {
  padding: 4rem 1.5rem;
  position: relative;
}

.section-wrapper:nth-child(even) {
  background: rgba(249, 246, 238, 0.7);
  border-top: 2px dashed var(--border-parchment);
  border-bottom: 2px dashed var(--border-parchment);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.9rem;
  border-radius: var(--radius-full);
  font-family: var(--font-cartoon);
  font-size: 0.88rem;
  font-weight: 700;
  border: 1.5px solid var(--border-bold);
  margin-bottom: 0.6rem;
}

.section-tag.gold {
  background: var(--primary-gold-light);
  color: var(--primary-gold-dark);
}

.section-tag.terracotta {
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
}

.section-tag.jade {
  background: var(--jade-light);
  color: var(--jade-green);
}

.section-tag.purple {
  background: var(--purple-light);
  color: var(--purple-magic);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--indigo-dark);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
}

/* การ์ดข้อมูลรายวิชาแบบรวมไฟล์ */
.course-info-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow-lg);
  padding: 2.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.course-info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 100%;
  background: var(--terracotta);
}

.course-icon-badge {
  width: 90px;
  height: 90px;
  background: var(--primary-gold-light);
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: var(--cartoon-shadow-sm);
}

.course-meta-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--indigo-dark);
  margin-bottom: 0.35rem;
}

.course-code-tag {
  display: inline-block;
  background: var(--indigo-light);
  color: var(--indigo-history);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid #CBD5E1;
  margin-bottom: 0.6rem;
}

.course-description {
  font-size: 0.98rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.course-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.course-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.course-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 180px;
}

/* ==============================================================================
   📢 SECTION: โซนนักเรียน (STUDENT ZONE - ตาม PDF หน้า 3)
   ============================================================================== */
.student-zone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.student-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.student-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--cartoon-shadow-lg);
}

.student-card.announcements {
  background: #FFF9F5;
  border-top: 6px solid var(--terracotta);
}

.student-card.collaboration {
  background: #F4FDF7;
  border-top: 6px solid var(--jade-green);
}

.student-card.assignments {
  background: #F7F5FF;
  border-top: 6px solid var(--purple-magic);
}

.student-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.student-card-icon {
  width: 54px;
  height: 54px;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: var(--cartoon-shadow-sm);
  background: #FFF;
}

.student-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--indigo-dark);
}

.student-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.announcement-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.announcement-item {
  background: #FFF;
  border: 1.5px solid var(--border-parchment);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  transition: border-color 0.2s ease;
}

.announcement-item:hover {
  border-color: var(--border-bold);
}

.announcement-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.announcement-badge {
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

.announcement-badge.urgent {
  background: #FEE2E2;
  color: #DC2626;
}

.announcement-badge.info {
  background: #E0E7FF;
  color: #4F46E5;
}

.announcement-badge.event {
  background: #FEF3C7;
  color: #D97706;
}

.announcement-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--indigo-dark);
}

/* ==============================================================================
   📚 SECTION: เนื้อหาบทเรียน (UNITS 1, 2, 3 - ตาม PDF หน้า 4-7 & ลายมือ 2, 3, 4)
   ============================================================================== */
.unit-section-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow-lg);
  padding: 2.5rem;
  margin-bottom: 3.5rem;
  position: relative;
}

.unit-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px dashed var(--border-parchment);
}

.unit-title-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.unit-number-badge {
  width: 64px;
  height: 64px;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--cartoon-shadow-sm);
  color: #FFF;
  font-family: var(--font-heading);
  font-weight: 800;
}

.unit-number-badge.unit-1 {
  background: var(--primary-gold);
  color: var(--indigo-dark);
}

.unit-number-badge.unit-2 {
  background: #3B82F6;
}

.unit-number-badge.unit-3 {
  background: var(--jade-green);
}

.unit-heading {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--indigo-dark);
  line-height: 1.25;
}

.unit-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-cartoon);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-bold);
  margin-top: 0.35rem;
  background: var(--primary-gold-light);
  color: var(--terracotta-dark);
}

.unit-description-box {
  background: var(--bg-parchment-soft);
  border: 1.5px solid var(--border-parchment);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.unit-description-text {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.85rem;
}

.unit-objectives-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--indigo-dark);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.unit-objectives-list {
  padding-left: 1.25rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ตารางการ์ดสื่อการเรียนรู้รายหน่วย */
.unit-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .unit-tools-grid {
    grid-template-columns: 1fr;
  }
}

.tool-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: var(--cartoon-shadow-sm);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--cartoon-shadow);
}

.tool-icon-wrapper {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  margin-bottom: 0.75rem;
  transition: transform 0.2s ease;
}

.tool-card:hover .tool-icon-wrapper {
  transform: scale(1.12) rotate(3deg);
}

.tool-card.content .tool-icon-wrapper { background: #EDE9FE; }
.tool-card.slides .tool-icon-wrapper { background: #FEF3C7; }
.tool-card.worksheet .tool-icon-wrapper { background: #FEE2E2; }
.tool-card.survey .tool-icon-wrapper { background: #E0E7FF; }
.tool-card.quiz .tool-icon-wrapper { background: #DCFCE7; }
.tool-card.bonus .tool-icon-wrapper { background: #FFF1F2; }

.tool-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--indigo-dark);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.tool-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* การ์ดพิเศษหน่วยที่ 3: ลิงก์อารยธรรมทวารวดี */
.special-civilization-banner {
  margin-top: 1.75rem;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--cartoon-shadow);
  gap: 1.5rem;
  flex-wrap: wrap;
}

.civilization-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.civilization-icon {
  font-size: 2.5rem;
  background: #FFF;
  border: var(--cartoon-border);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  box-shadow: var(--cartoon-shadow-sm);
}

.civilization-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--indigo-dark);
}

.civilization-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==============================================================================
   📝 SECTION: คลังข้อสอบ & การประเมินผล (ASSESSMENT HUB - ข้อ 5 ในลายมือ)
   ============================================================================== */
.assessment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.assessment-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.assessment-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--cartoon-shadow-lg);
}

.assessment-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.assessment-icon {
  width: 58px;
  height: 58px;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: var(--cartoon-shadow-sm);
  background: var(--primary-gold-light);
}

.assessment-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--indigo-dark);
  line-height: 1.3;
}

.assessment-badge {
  display: inline-block;
  font-family: var(--font-cartoon);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-top: 0.35rem;
  border: 1px solid var(--terracotta);
}

.assessment-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.assessment-meta-info {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-parchment-soft);
  border: 1px solid var(--border-parchment);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.assessment-actions {
  display: flex;
  gap: 0.75rem;
}

/* ==============================================================================
   🎬 SECTION: คลังวิดีโอทบทวนบทเรียน (VIDEO HUB - ตาม PDF หน้า 1, 9)
   ============================================================================== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.video-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--cartoon-shadow);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--cartoon-shadow-lg);
}

.video-thumbnail-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.video-thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.video-card:hover .video-thumbnail-wrapper img {
  transform: scale(1.06);
  opacity: 1;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: var(--terracotta);
  border: var(--cartoon-border);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-size: 1.3rem;
  box-shadow: var(--cartoon-shadow-sm);
  transition: transform 0.2s ease;
}

.video-thumbnail-wrapper:hover .video-play-btn {
  transform: translate(-50%, -50%) scale(1.15);
  background: #FF0000;
}

.video-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #FFF;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.video-week-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary-gold);
  color: var(--indigo-dark);
  font-family: var(--font-cartoon);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-bold);
  box-shadow: var(--cartoon-shadow-sm);
}

.video-info {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.video-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--indigo-dark);
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* ==============================================================================
   ✍️ SECTION: นักเขียนแห่งเดือน (STUDENT SHOWCASE - ตาม PDF หน้า 8)
   ============================================================================== */
.writers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.writer-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.writer-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--cartoon-shadow-lg);
}

.writer-badge-tag {
  display: inline-block;
  font-family: var(--font-cartoon);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-bold);
  background: var(--primary-gold-light);
  color: var(--terracotta-dark);
  margin-bottom: 1rem;
  align-self: flex-start;
}

.writer-article-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--indigo-dark);
  margin-bottom: 0.35rem;
}

.writer-article-sub {
  font-size: 0.9rem;
  color: var(--terracotta);
  font-weight: 600;
  margin-bottom: 1rem;
}

.writer-excerpt {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.writer-footer {
  border-top: 1.5px dashed var(--border-parchment);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.writer-author {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--indigo-dark);
}

.writer-grade {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ==============================================================================
   📞 SECTION: ช่องทางการติดต่อครูสุพัฒน์ (CONTACT & SUPPORT - ตาม PDF หน้า 9)
   ============================================================================== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.contact-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: all 0.25s ease;
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cartoon-shadow-lg);
}

.contact-icon-large {
  width: 72px;
  height: 72px;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: var(--cartoon-shadow-sm);
  flex-shrink: 0;
}

.contact-card.email .contact-icon-large {
  background: var(--terracotta-light);
}

.contact-card.support .contact-icon-large {
  background: #DCFCE7;
}

.contact-details {
  flex-grow: 1;
}

.contact-label {
  font-family: var(--font-cartoon);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--terracotta);
  margin-bottom: 0.25rem;
}

.contact-value {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--indigo-dark);
  margin-bottom: 0.6rem;
  word-break: break-all;
}

/* ==============================================================================
   FOOTER
   ============================================================================== */
.footer {
  background: var(--indigo-dark);
  color: #FFF;
  border-top: var(--cartoon-border);
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 2rem;
}

.footer-brand-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-gold);
  margin-bottom: 0.35rem;
}

.footer-brand-desc {
  font-size: 0.9rem;
  color: #94A3B8;
  max-width: 450px;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-link {
  color: #CBD5E1;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--primary-gold);
}

.footer-bottom {
  max-width: 1280px;
  margin: 1.5rem auto 0;
  text-align: center;
  font-size: 0.85rem;
  color: #64748B;
}

/* ==============================================================================
   🪟 MODALS & POPUPS (ระบบหน้าต่างพรีวิวเอกสาร ข้อสอบ และวิดีโอ)
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-parchment);
  border: var(--cartoon-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--cartoon-shadow-lg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: var(--cartoon-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFF;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--indigo-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-close-modal {
  background: #FEE2E2;
  border: 1.5px solid var(--border-bold);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--border-bold);
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  background: #EF4444;
  color: #FFF;
  transform: rotate(90deg);
}

.modal-body {
  padding: 1.75rem;
}

.modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1.5px solid var(--border-parchment);
  background: #FFF;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* สไตล์กล่องพรีวิวเอกสาร */
.document-preview-box {
  background: #FFF;
  border: 2px dashed var(--border-parchment);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.document-preview-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.document-preview-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--indigo-dark);
  margin-bottom: 0.4rem;
}

.document-preview-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* สไตล์กล่องทำแบบทดสอบ (Interactive Quiz) */
.quiz-question-box {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--cartoon-shadow-sm);
}

.quiz-question-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.quiz-question-num {
  font-family: var(--font-cartoon);
  font-weight: 700;
  color: var(--terracotta);
  font-size: 0.9rem;
}

.quiz-question-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--indigo-dark);
  margin-bottom: 1rem;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.quiz-option-btn {
  background: var(--bg-parchment-soft);
  border: 1.5px solid var(--border-parchment);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.quiz-option-btn:hover {
  background: var(--primary-gold-light);
  border-color: var(--border-bold);
  transform: translateX(4px);
}

.quiz-option-btn.selected {
  background: var(--primary-gold);
  border-color: var(--border-bold);
  font-weight: 700;
}

.quiz-option-btn.correct {
  background: #DCFCE7;
  border-color: #166534;
  color: #166534;
  font-weight: 700;
}

.quiz-option-btn.wrong {
  background: #FEE2E2;
  border-color: #991B1B;
  color: #991B1B;
}

.quiz-explanation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  font-size: 0.88rem;
  color: #166534;
  display: none;
}

/* Toast Message */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--indigo-dark);
  color: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.4rem;
  box-shadow: var(--cartoon-shadow);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 2000;
  transform: translateY(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-notice.show {
  transform: translateY(0);
}

/* ==============================================================================
   📱 RESPONSIVE ADJUSTMENTS
   ============================================================================== */
@media (max-width: 960px) {
  .hero-container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hero-title {
    font-size: 2.2rem;
  }
  
  .hero-teacher-name {
    justify-content: center;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .hero-visual {
    margin-top: 2rem;
  }
  
  .student-zone-grid,
  .assessment-grid,
  .video-grid,
  .writers-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  
  .course-info-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .course-icon-badge {
    margin: 0 auto;
  }
  
  .course-tags {
    justify-content: center;
  }
  
  .nav-links {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ==============================================================================
   🎬 คลังคลิปสั้น 7 อาณาจักรโบราณ (KINGDOM REELS MODAL & CARDS)
   ============================================================================== */
.kingdoms-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

@media (max-width: 680px) {
  .kingdoms-modal-grid {
    grid-template-columns: 1fr;
  }
}

.kingdom-reel-card {
  background: #FFF;
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--cartoon-shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.kingdom-reel-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--cartoon-shadow);
}

.kingdom-reel-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.kingdom-reel-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 2px 2px 0 var(--border-bold);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.kingdom-reel-card:hover .kingdom-reel-icon {
  transform: scale(1.1) rotate(5deg);
}

.kingdom-region-pill {
  display: inline-block;
  font-family: var(--font-cartoon);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-parchment-soft);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-parchment);
  margin-bottom: 0.2rem;
}

.kingdom-reel-name {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--indigo-dark);
  line-height: 1.2;
}

.kingdom-reel-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.kingdom-reel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kingdom-play-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #FFF;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-bold);
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--border-bold);
  transition: all 0.15s ease;
}

.kingdom-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--border-bold);
  filter: brightness(1.1);
}

.kingdom-copy-btn {
  background: var(--bg-parchment-soft);
  border: 1.5px solid var(--border-bold);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--border-bold);
  transition: all 0.15s ease;
}

.kingdom-copy-btn:hover {
  background: var(--primary-gold-light);
  transform: translateY(-2px);
}

.kingdoms-banner-card {
  margin-top: 1.5rem;
  background: linear-gradient(135deg, #FFF1F2 0%, #FFE4E6 100%);
  border: var(--cartoon-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--cartoon-shadow);
  gap: 1.5rem;
  flex-wrap: wrap;
}

