/* =========================================================
   KRUPREM Learning Space
   เว็บไซต์สื่อการสอนแบบสาธารณะ
   ========================================================= */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf2ff;
  --accent: #0ea5e9;
  --text: #1e293b;
  --muted: #64748b;
  --surface: #ffffff;
  --background: #f6f8fc;
  --border: #e2e8f0;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai",
    "Tahoma", sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.65;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.brand-text strong,
.brand-text span {
  display: block;
}

.brand-text span {
  color: var(--muted);
  font-size: 13px;
}

.main-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-link {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  font-size: 26px;
}

/* Buttons */
.btn {
  border: 0;
  border-radius: 13px;
  padding: 12px 20px;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.btn-soft {
  color: var(--primary);
  background: var(--primary-soft);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

/* Hero */
.hero {
  padding: 64px 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(14, 165, 233, 0.14), transparent 35%),
    radial-gradient(circle at 90% 20%, rgba(37, 99, 235, 0.12), transparent 34%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 50px;
}

.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.page-banner h1 {
  margin: 12px 0 18px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero h1 span {
  color: var(--primary);
}

.hero-content>p {
  max-width: 680px;
  font-size: 18px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin: 28px 0;
}

.hero-stats {
  display: flex;
  gap: 34px;
  margin-top: 34px;
}

.hero-stats div {
  display: grid;
}

.hero-stats strong {
  font-size: 28px;
}

.hero-stats span {
  color: var(--muted);
  font-size: 13px;
}

.hero-visual img {
  width: 100%;
  filter: drop-shadow(0 24px 40px rgba(37, 99, 235, 0.14));
}

/* Sections */
.section {
  padding: 70px 0;
}

.section-soft {
  background: #eef4ff;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: clamp(30px, 4vw, 42px);
}

.page-banner {
  padding: 64px 0;
  background: linear-gradient(135deg, #eaf2ff, #effcff);
}

.page-banner h1 {
  margin-bottom: 8px;
  font-size: clamp(38px, 6vw, 58px);
}

.page-banner p {
  color: var(--muted);
  font-size: 18px;
}

/* Cards */
.card-grid,
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.course-card,
.feature-card,
.teacher-profile,
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.course-card {
  overflow: hidden;
  transition: 0.2s ease;
}

.course-card:hover {
  transform: translateY(-6px);
}

.course-cover {
  height: 175px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
}

.course-cover img {
  width: 145px;
  height: 145px;
  object-fit: contain;
}

.course-body {
  padding: 22px;
}

.course-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.course-card h3 {
  margin: 12px 0 8px;
  font-size: 23px;
}

.course-card p {
  min-height: 78px;
  color: var(--muted);
}

.course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 800;
}

.feature-card {
  padding: 26px;
}

.icon-box {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--primary-soft);
  font-size: 28px;
}

.feature-card h3 {
  margin: 18px 0 8px;
}

.feature-card p {
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
  margin-bottom: 28px;
}

.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 15px;
  background: white;
}

/* Lesson */
.lesson-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
}

.lesson-sidebar {
  position: sticky;
  top: 105px;
  padding: 22px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lesson-sidebar h2 {
  margin: 6px 0 18px;
}

.lesson-menu-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 6px;
  text-align: left;
  background: transparent;
  color: var(--muted);
}

.lesson-menu-item:hover,
.lesson-menu-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.lesson-content {
  padding: 34px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lesson-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reading-time {
  color: var(--muted);
  font-size: 14px;
}

.lesson-content>h1 {
  margin: 18px 0 12px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.15;
}

.lead {
  color: var(--muted);
  font-size: 18px;
}

.media-box {
  min-height: 330px;
  margin: 28px 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, #eef4ff, #e6fbff);
}

.media-box img {
  max-height: 310px;
}

.media-box iframe {
  width: 100%;
  min-height: 430px;
  border: 0;
}

.content-block {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.highlight-block {
  margin: 24px 0;
  padding: 24px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: #f8fbff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.summary-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--background);
}

.summary-card strong {
  display: block;
  margin-bottom: 6px;
}

.lesson-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
}

/* Media library */
.media-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.filter-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  background: white;
  color: var(--muted);
  font-weight: 700;
}

.filter-button:hover,
.filter-button.active {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.media-card:hover {
  transform: translateY(-5px);
}

.media-thumbnail {
  height: 190px;
  padding: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eaf2ff, #ecfeff);
}

.media-thumbnail img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.media-card-body {
  padding: 22px;
}

.media-card-body h3 {
  margin: 14px 0 8px;
  font-size: 21px;
}

.media-card-body p {
  min-height: 75px;
  color: var(--muted);
}

.media-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.media-link {
  display: inline-flex;
  margin-top: 12px;
  text-decoration: none;
}

/* About */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: center;
}

.teacher-profile,
.about-card {
  padding: 34px;
}

.teacher-avatar {
  width: 90px;
  height: 90px;
  margin-bottom: 24px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  color: white;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.about-card li {
  margin-bottom: 12px;
}

/* Footer */
.site-footer {
  padding: 36px 0;
  background: #0f172a;
  color: white;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.footer-inner p {
  margin: 4px 0 0;
  color: #cbd5e1;
}

/* Responsive */
@media (max-width: 900px) {
  .menu-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 78px;
    left: 20px;
    right: 20px;
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }

  .main-nav.open {
    display: flex;
  }

  .hero-grid,
  .lesson-layout,
  .about-layout {
    grid-template-columns: 1fr;
  }

  .lesson-sidebar {
    position: static;
  }

  .card-grid,
  .feature-grid,
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    padding: 42px 0;
  }

  .hero-actions,
  .hero-stats,
  .lesson-actions,
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .card-grid,
  .feature-grid,
  .media-grid,
  .summary-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .lesson-content {
    padding: 22px;
  }

  .media-box {
    min-height: 230px;
  }

  .media-box iframe {
    min-height: 240px;
  }
}


.lesson-quiz-section {
  margin-top: 36px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #f8fbff;
}

.lesson-quiz-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.lesson-quiz-heading h2 {
  margin: 6px 0 0;
}

.lesson-question-card {
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
}

.lesson-question-card h3 {
  margin-top: 0;
  font-size: 19px;
}

.lesson-options {
  display: grid;
  gap: 10px;
}

.lesson-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.lesson-option:hover {
  background: var(--primary-soft);
  border-color: #bfdbfe;
}

.lesson-option input {
  margin-top: 6px;
}

.lesson-quiz-submit {
  width: 100%;
  margin-top: 8px;
}

.lesson-quiz-result {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid #bbf7d0;
  border-radius: 18px;
  background: #ecfdf5;
}

.result-summary {
  text-align: center;
  margin-bottom: 24px;
}

.result-summary h2 {
  margin-bottom: 8px;
}

.result-percent {
  display: block;
  color: #15803d;
  font-size: 38px;
}

.answer-list {
  margin: 24px 0;
}

.answer-explanation {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 14px;
  background: white;
  border: 1px solid #d1fae5;
}

.answer-explanation p {
  margin: 6px 0;
}

.answer-explanation small {
  color: var(--muted);
}

.empty-quiz {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  background: white;
}

.hidden {
  display: none !important;
}

@media (max-width: 620px) {
  .lesson-quiz-section {
    padding: 18px;
  }

  .lesson-quiz-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .lesson-question-card {
    padding: 16px;
  }
}

/* ===============================
   ใบงานประกอบบทเรียน
   =============================== */

.worksheet-section {
  border-bottom: 0;
}

.worksheet-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;

  padding: 24px;

  border: 1px solid #bfdbfe;
  border-radius: 20px;

  background: linear-gradient(135deg,
      #eff6ff,
      #ecfeff);
}

.worksheet-icon {
  width: 65px;
  height: 65px;

  display: grid;
  place-items: center;

  border-radius: 18px;

  background: white;

  font-size: 32px;

  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
}

.worksheet-info h2 {
  margin: 5px 0;
  font-size: 23px;
}

.worksheet-info p {
  margin: 0;
  color: var(--muted);
}

.worksheet-button {
  white-space: nowrap;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 700px) {
  .worksheet-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .worksheet-button {
    width: 100%;
    text-align: center;
  }
}

/* =====================================
   หน้าแรกแบบ Modern Website
   ===================================== */

/* แบนเนอร์ */

.modern-hero {
  padding: 30px 0 35px;
}

.modern-hero-card {
  position: relative;

  min-height: 430px;

  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;

  padding: 55px 60px 70px;

  overflow: hidden;

  border-radius: 28px;

  background:
    linear-gradient(100deg,
      #dff3f1 0%,
      #edf8f6 48%,
      #f5eadc 100%);

  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.09);
}

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

.hero-label {
  display: inline-block;

  color: #0f5c5f;

  font-size: 13px;
  font-weight: 800;

  letter-spacing: 0.1em;
}

.modern-hero-content h1 {
  margin: 14px 0 18px;

  color: #1e293b;

  font-size: clamp(42px,
      5vw,
      68px);

  line-height: 1.08;

  letter-spacing: -0.04em;
}

.modern-hero-content p {
  max-width: 610px;

  margin: 0;

  color: #64748b;

  font-size: 18px;
  line-height: 1.8;
}

.modern-hero-buttons {
  display: flex;
  gap: 12px;

  margin-top: 28px;
}

.modern-hero-image {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* กรอบรูปด้านขวาในแบนเนอร์ */

.modern-hero-image {
  width: 100%;
  max-width: 530px;
  height: 340px;

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 24px;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.12);
}

/* รูปภาพภายในกรอบ */

.modern-hero-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 24px;
}

.hero-dots {
  position: absolute;
  left: 50%;
  bottom: 20px;
  display: flex;
  gap: 9px;
  transform: translateX(-50%);
}

.hero-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #b6c7c5;
  cursor: pointer;
  transition:
    width 0.25s ease,
    border-radius 0.25s ease,
    background 0.25s ease;
}

.hero-dot:hover {
  background: #60a5fa;
}

.hero-dot.active {
  width: 25px;
  border-radius: 999px;
  background: #0f5c5f;
}

/* สีปุ่มให้ใกล้ภาพตัวอย่าง */

.modern-hero .btn-primary {
  color: white;
  background: #0f5c5f;
}

.modern-hero .btn-primary:hover {
  background: #0a4547;
}

.modern-hero .btn-soft {
  color: #0f5c5f;
  background: white;
  border: 1px solid #c9ddda;
}

/* พื้นที่รายวิชาและตัวกรอง */

.modern-course-layout {
  display: grid;

  grid-template-columns:
    250px minmax(0, 1fr);

  gap: 28px;

  align-items: start;
}

.course-filter-box {
  position: sticky;
  top: 100px;

  padding: 24px;

  border: 1px solid #e2e8f0;
  border-radius: 20px;

  background: white;

  box-shadow:
    0 15px 35px rgba(15, 23, 42, 0.07);
}

.course-filter-box h3 {
  margin: 0 0 18px;

  font-size: 21px;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 9px;

  padding: 11px 13px;

  border: 1px solid #e2e8f0;
  border-radius: 12px;

  background: #ffffff;
}

.filter-search span {
  color: #64748b;

  font-size: 20px;
}

.filter-search input {
  width: 100%;

  border: 0;
  outline: 0;

  color: #1e293b;
  background: transparent;
}

.filter-section {
  margin-top: 24px;
}

.filter-section h4 {
  margin: 0 0 12px;
}

.filter-section label {
  display: flex;
  align-items: center;
  gap: 9px;

  margin: 10px 0;

  color: #64748b;

  cursor: pointer;
}

.filter-section input {
  width: 17px;
  height: 17px;

  accent-color: #0f5c5f;
}

.filter-reset-button {
  width: 100%;

  margin-top: 18px;
  padding: 10px 14px;

  border: 1px solid #cbd5e1;
  border-radius: 10px;

  color: #475569;
  background: white;

  font-weight: 700;
}

.filter-reset-button:hover {
  color: #0f5c5f;
  border-color: #0f5c5f;
}

.modern-course-area {
  min-width: 0;
}

.modern-course-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;

  margin-bottom: 22px;
}

.modern-course-heading h2 {
  margin: 5px 0 0;

  font-size: 34px;
}

.modern-course-heading>span {
  color: #64748b;

  font-size: 14px;
}

/* ปรับการ์ดรายวิชา */

.modern-course-area .course-card {
  border-radius: 18px;

  box-shadow:
    0 13px 30px rgba(15, 23, 42, 0.07);
}

.modern-course-area .course-cover {
  background:
    linear-gradient(135deg,
      #e6f3f1,
      #f3e9dc);
}

.modern-course-area .btn-primary {
  background: #0f5c5f;
}

/* Responsive */

@media (max-width: 950px) {
  .modern-hero-card {
    grid-template-columns: 1fr;

    padding: 45px 38px 70px;
  }

  .modern-hero-image {
    margin-top: 25px;
  }

  .modern-hero-image img {
    max-width: 520px;
  }

  .modern-course-layout {
    grid-template-columns: 1fr;
  }

  .course-filter-box {
    position: static;
  }

  .filter-section {
    display: grid;

    grid-template-columns:
      repeat(3, 1fr);

    gap: 5px 12px;
  }

  .filter-section h4 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .modern-hero {
    padding-top: 16px;
  }

  .modern-hero-card {
    min-height: 620px;

    padding: 36px 24px 70px;

    border-radius: 20px;
  }

  .modern-hero-content h1 {
    font-size: 42px;
  }

  .modern-hero-content p {
    font-size: 16px;
  }

  .modern-hero-buttons {
    flex-direction: column;
  }

  .modern-hero-buttons .btn {
    width: 100%;
  }

  .filter-section {
    grid-template-columns: 1fr 1fr;
  }

  .modern-course-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

.hero-highlight {
  color: #7dd3fc;
}

#heroMainImage {
  opacity: 1;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

#heroMainImage.changing {
  opacity: 0;
  transform: scale(0.98);
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

#coursesPage .section {
  min-height: 520px;
}

.site-footer {
  margin-top: auto;
}
.empty-search-result {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: #ffffff;
  border: 1px dashed var(--border);
  border-radius: 16px;
}

/* พื้นหลังส่วนรูปภาพด้านบนของการ์ด */
.course-card .course-image,
.home-course-card .course-image {
  background: #dbeafe;
}

/* ป้ายจำนวนบทเรียน */
.course-card .lesson-count,
.home-course-card .lesson-count {
  background: #eff6ff;
  color: #2563eb;
}

/* ปุ่มเข้าเรียน */
.course-card .course-btn,
.home-course-card .course-btn,
.course-card .btn-primary,
.home-course-card .btn-primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* สีตอนเอาเมาส์ชี้ปุ่ม */
.course-card .course-btn:hover,
.home-course-card .course-btn:hover,
.course-card .btn-primary:hover,
.home-course-card .btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* ขอบและเงาของการ์ด */
.course-card,
.home-course-card {
  border: 1px solid #dbeafe;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

/* ========================================
   เกมจับคู่คำศัพท์
======================================== */

.matching-game-section {
  margin-top: 30px;
  margin-bottom: 30px;
  padding: 28px;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #dbeafe;
  border-radius: 22px;
}

.matching-game-header h2 {
  margin: 5px 0 6px;
  color: #1d4ed8;
}

.matching-game-header p {
  margin: 0 0 20px;
  color: #64748b;
}

.matching-status {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.matching-status span {
  padding: 9px 16px;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1e40af;
  font-weight: 700;
}

.matching-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.matching-column h3 {
  margin-top: 0;
  text-align: center;
  color: #334155;
}

.matching-list {
  display: grid;
  gap: 12px;
}

.matching-card {
  width: 100%;
  min-height: 72px;
  padding: 14px;
  border: 2px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
  color: #1e3a8a;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}

.matching-card:hover {
  transform: translateY(-2px);
  background: #dbeafe;
}

.matching-card.matching-selected {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.matching-card.matching-correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
  cursor: default;
}

.matching-card.matching-wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.matching-message {
  min-height: 28px;
  margin: 20px 0 12px;
  text-align: center;
  color: #1d4ed8;
  font-weight: 800;
}

.matching-restart-button {
  display: block;
  margin: 0 auto;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.matching-restart-button:hover {
  background: #1d4ed8;
}

@media screen and (max-width: 768px) {
  .matching-game-section {
    padding: 18px 14px;
  }

  .matching-board {
    grid-template-columns: 1fr;
  }

  .matching-card {
    min-height: 62px;
  }
}

/* จัดปุ่มเข้าเรียนให้อยู่ระดับเดียวกัน */
.card-grid {
  align-items: stretch;
}

.course-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.course-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.course-card p {
  min-height: 0;
  margin-bottom: 0;
  flex: 1;
}

.course-footer {
  margin-top: auto;
  padding-top: 18px;
}

/* จัดหัวข้อเกม 3 บรรทัดให้อยู่ตรงกลาง */
.matching-game-header {
  display: flex;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.matching-game-header > div {
  width: 100%;
}

.matching-game-header .eyebrow,
.matching-game-header h2,
.matching-game-header p {
  display: block;
  width: 100%;
  text-align: center;
}

.matching-game-header .eyebrow {
  margin-bottom: 8px;
}

.matching-game-header h2 {
  margin: 0 0 8px;
}

.matching-game-header p {
  margin: 0 0 22px;
}

/* จัดปุ่มเปิดดูสื่อให้อยู่ด้านล่างตรงกัน */
.media-grid {
  align-items: stretch;
}

.media-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.media-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.media-card-body p {
  min-height: 0;
  margin-bottom: 0;
  flex: 1;
}

.media-link {
  margin-top: auto;
  align-self: flex-start;
}