@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --font-main: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-gradient: linear-gradient(180deg, #FFF5F8 0%, #FAF5FF 50%, #FFFFFF 100%);
  --primary-gradient: linear-gradient(135deg, #EC4899 0%, #3B82F6 100%);
  --primary-hover: linear-gradient(135deg, #DB2777 0%, #2563EB 100%);
  --secondary-gradient: linear-gradient(135deg, #F472B6 0%, #A855F7 100%);
  --card-bg: #FFFFFF;
  --text-main: #2D2B3D;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border-color: #F3E8FF;
  --pill-bg-pink: #FCE7F3;
  --pill-text-pink: #DB2777;
  --shadow-soft: 0 12px 32px rgba(236, 72, 153, 0.08);
  --shadow-card: 0 8px 24px rgba(149, 157, 165, 0.06);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 60px;
  -webkit-font-smoothing: antialiased;
}

/* Top Navbar */
.top-navbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.05);
}

.nav-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(236, 72, 153, 0.15);
  flex-shrink: 0;
}

.nav-logo img,
.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(236, 72, 153, 0.15);
  flex-shrink: 0;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
}

.nav-brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.nav-brand-subtitle {
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* User Dropdown in Navbar */
.user-dropdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 14px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s;
}

.user-dropdown:hover {
  background: #FAF5FF;
  border-color: #E9D5FF;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-school {
  font-size: 0.725rem;
  color: var(--text-muted);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #F472B6;
}

.dropdown-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.user-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu Popup */
.dropdown-content {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  padding: 8px 0;
  display: none;
  z-index: 200;
  animation: fadeInDown 0.2s ease;
}

.user-dropdown.active .dropdown-content {
  display: block;
}

.dropdown-header {
  padding: 8px 16px 6px;
  display: flex;
  flex-direction: column;
}

.dropdown-header strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.dropdown-header small {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: #F3F4F6;
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: #FAF5FF;
  color: #EC4899;
}

.dropdown-item.logout-item {
  color: #EF4444;
}

.dropdown-item.logout-item:hover {
  background: #FEE2E2;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: #FFFFFF;
  padding: 6px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  width: fit-content;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #EC4899;
}

.tab-btn.active {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25);
}

/* Container */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(236, 72, 153, 0.35);
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.btn-secondary:hover {
  background: #FAF5FF;
  border-color: #E9D5FF;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Hero Section */
.hero-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(243, 232, 255, 0.6);
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pill-bg-pink);
  color: var(--pill-text-pink);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 12px;
}

.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  padding-bottom: 4px;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #F3F4F6;
}

.stat-item h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.stat-item p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Progress Score Card */
.score-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
  border: 1px solid rgba(243, 232, 255, 0.6);
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.score-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.score-badge {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 24px;
  box-shadow: 0 6px 16px rgba(236, 72, 153, 0.3);
}

.score-number {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 16px;
}

.score-number span {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 14px;
  background: #F3F4F6;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Section Titles */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Week Navigator Controls */
.week-navigator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.week-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.btn-nav-week {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-nav-week:hover {
  background: #F3E8FF;
  color: #EC4899;
}

/* 7-Day Weekly Grid Table */
.weekly-table-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
  border: 1px solid rgba(243, 232, 255, 0.6);
  overflow-x: auto;
}

.weekly-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

.weekly-table th {
  padding: 10px 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid #F3F4F6;
}

.weekly-table th.day-header {
  background: #FAF5FF;
  border-radius: 10px;
}

.weekly-table td {
  padding: 12px 6px;
  vertical-align: middle;
  border-bottom: 1px solid #F9FAFB;
}

.habit-name-col {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  min-width: 180px;
}

.habit-name-col small {
  display: block;
  font-weight: 400;
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* Switch / Checkbox Toggle */
.day-cell {
  text-align: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #E5E7EB;
  transition: .3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

input:checked + .slider {
  background: var(--primary-gradient);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* Submission Card */
.submission-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
  border: 1px solid rgba(243, 232, 255, 0.6);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #E5E7EB;
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
}

.form-control:focus {
  border-color: #EC4899;
}

/* Photo Upload Grid (Up to 5 Photos) */
.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.photo-slot {
  aspect-ratio: 1;
  border: 2px dashed #E5E7EB;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: #FAF5FF;
  transition: border-color 0.2s;
}

.photo-slot:hover {
  border-color: #EC4899;
}

.photo-slot input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.photo-slot.photo-slot--readonly {
  cursor: default;
  border-style: solid;
  border-color: #E5E7EB;
  background: #F9FAFB;
}

.photo-slot.photo-slot--readonly:hover {
  border-color: #E5E7EB;
}

.photo-slot.photo-slot--readonly input[type="file"] {
  display: none;
  pointer-events: none;
}

.photo-slot.photo-slot--readonly img {
  cursor: zoom-in;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-slot-icon {
  font-size: 1.4rem;
  color: var(--text-muted);
}

.photo-slot-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.swal2-modal-round {
  border-radius: 24px !important;
  font-family: 'Sarabun', sans-serif !important;
}

/* Lightbox — รูปผลงานไม่ล้นจอ */
.swal2-popup.swal2-image-viewer {
  max-width: min(92vw, 760px) !important;
  width: auto !important;
  padding: 14px 14px 18px !important;
}

.swal2-popup.swal2-image-viewer .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}

.kb-image-lightbox-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: min(72vh, 680px);
  max-width: min(88vw, 720px);
}

.kb-image-lightbox {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 680px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}

.swal2-popup.swal2-image-viewer .swal2-image {
  max-width: min(88vw, 720px) !important;
  max-height: min(72vh, 680px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}

.swal2-popup.swal2-photos-grid {
  max-width: min(96vw, 640px) !important;
}

/* Responsive Rules */
@media (max-width: 640px) {
  .user-info {
    display: none;
  }
  .hero-title {
    font-size: 1.6rem;
    line-height: 1.4;
  }
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .stat-item h3 {
    font-size: 1.25rem;
  }
  .photo-upload-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .zoom-slots-grid {
    grid-template-columns: 1fr !important;
  }
  .nav-tabs {
    width: 100%;
    overflow-x: auto;
  }
}

/* --- Custom Additions for Krutonboon 2569 edits --- */
.kb-concept-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .kb-concept-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.kb-header-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 40px 28px 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(243, 232, 255, 0.6);
  text-align: center;
}

.kb-header-logo {
  width: 110px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
  transition: transform 0.3s ease;
}

.kb-header-logo:hover {
  transform: scale(1.06);
}

.kb-header-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 14px;
  line-height: 1.3;
}

.kb-header-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 24px;
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  margin-bottom: 24px;
  border: none;
}

.kb-header-glow-bar {
  height: 8px;
  background: linear-gradient(90deg, #EC4899 0%, #A855F7 35%, #3B82F6 70%, #06B6D4 100%);
  border-radius: 999px;
  margin-top: 32px;
  opacity: 0.85;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

/* Indicators Images */
.kb-indicator-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.kb-indicator-img-wrapper {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kb-indicator-img-wrapper:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}

.kb-indicator-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Rewards Section Redesign */
.kb-rewards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
  align-items: stretch;
}

.kb-reward-card {
  background: #FFFFFF;
  padding: 28px 24px;
  border-radius: 24px;
  text-align: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.kb-reward-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  transition: 0.75s;
  opacity: 0;
  pointer-events: none;
}

.kb-reward-card:hover::before {
  left: 150%;
  opacity: 1;
}

.kb-reward-card:hover {
  transform: translateY(-8px) scale(1.02);
}

.kb-reward-card.excellent {
  background: linear-gradient(#ffffff, #ffffff) padding-box,
              linear-gradient(135deg, #F59E0B 0%, #FBBF24 50%, #F59E0B 100%) border-box;
  border: 3px solid transparent;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.12), inset 0 0 24px rgba(253, 224, 71, 0.05);
}

.kb-reward-card.excellent:hover {
  box-shadow: 0 20px 40px rgba(245, 158, 11, 0.25), inset 0 0 24px rgba(253, 224, 71, 0.1);
}

.kb-reward-card.good {
  background: linear-gradient(#ffffff, #ffffff) padding-box,
              linear-gradient(135deg, #3B82F6 0%, #60A5FA 50%, #3B82F6 100%) border-box;
  border: 3px solid transparent;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.1), inset 0 0 24px rgba(59, 130, 246, 0.03);
}

.kb-reward-card.good:hover {
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.2), inset 0 0 24px rgba(59, 130, 246, 0.05);
}

.kb-reward-card.participant {
  background: linear-gradient(#ffffff, #ffffff) padding-box,
              linear-gradient(135deg, #EC4899 0%, #F472B6 50%, #EC4899 100%) border-box;
  border: 3px solid transparent;
  box-shadow: 0 10px 30px rgba(236, 72, 153, 0.1), inset 0 0 24px rgba(236, 72, 153, 0.03);
}

.kb-reward-card.participant:hover {
  box-shadow: 0 20px 40px rgba(236, 72, 153, 0.2), inset 0 0 24px rgba(236, 72, 153, 0.05);
}

.kb-reward-img-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  min-height: 140px;
  width: 100%;
  border-radius: 16px;
  padding: 10px;
  transition: background 0.3s ease;
}

.kb-reward-card.excellent .kb-reward-img-container {
  background: radial-gradient(circle, rgba(254, 243, 199, 0.6) 0%, rgba(255, 255, 255, 0) 70%);
}

.kb-reward-card.good .kb-reward-img-container {
  background: radial-gradient(circle, rgba(219, 234, 254, 0.6) 0%, rgba(255, 255, 255, 0) 70%);
}

.kb-reward-card.participant .kb-reward-img-container {
  background: radial-gradient(circle, rgba(252, 231, 243, 0.6) 0%, rgba(255, 255, 255, 0) 70%);
}

.kb-reward-img {
  height: 130px;
  width: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.05);
}

.kb-reward-card:hover .kb-reward-img {
  transform: scale(1.05) rotate(2deg);
}

.kb-reward-overlap-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.kb-reward-overlap-wrapper .cert-img {
  display: block;
  height: 130px;
  width: auto;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
}

.kb-reward-card:hover .kb-reward-overlap-wrapper .cert-img {
  transform: scale(1.05) rotate(1deg);
}

.kb-reward-badge-overlay {
  position: absolute;
  bottom: -8px;
  right: -14px;
  height: 72px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
  transition: transform 0.3s ease;
}

.kb-reward-card:hover .kb-reward-badge-overlay {
  transform: scale(1.15) rotate(-6deg);
}

.kb-reward-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 8px;
}

.kb-reward-card.excellent .kb-reward-title { color: #B45309; }
.kb-reward-card.good .kb-reward-title { color: #1D4ED8; }
.kb-reward-card.participant .kb-reward-title { color: #BE185D; }

.kb-reward-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* Slideshow Gallery */
.kb-slideshow-container {
  position: relative;
  max-width: 100%;
  margin: 24px auto 0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-color);
  aspect-ratio: 16/9;
}

@media (min-width: 768px) {
  .kb-slideshow-container {
    height: 480px;
    aspect-ratio: auto;
  }
}

.kb-slide {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
  animation: fadeEffect 1s ease-in-out;
}

.kb-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kb-slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%);
  color: #FFFFFF;
  padding: 20px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.kb-slideshow-prev, .kb-slideshow-next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  color: var(--text-main);
  font-weight: bold;
  font-size: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.5);
  z-index: 10;
}

.kb-slideshow-prev:hover, .kb-slideshow-next:hover {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.kb-slideshow-prev { left: 16px; }
.kb-slideshow-next { right: 16px; }

.kb-slideshow-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.kb-slideshow-dot {
  cursor: pointer;
  height: 8px;
  width: 8px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: inline-block;
  transition: all 0.2s ease;
}

.kb-slideshow-dot.active {
  background-color: #FFFFFF;
  width: 24px;
  border-radius: 4px;
}

@keyframes fadeEffect {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* LINE Section */
.kb-line-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-color);
  margin-top: 36px;
}

.kb-line-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: center;
}

.kb-line-qr-wrapper {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: transform 0.3s ease;
}

.kb-line-qr-wrapper:hover {
  transform: scale(1.03);
}

.kb-line-qr {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}

.kb-line-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kb-line-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}

.kb-line-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Download PDF Zone */
.kb-download-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  margin-top: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.kb-download-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.kb-download-icon {
  font-size: 2.2rem;
  color: #EF4444;
  background: #FEE2E2;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kb-download-text h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.kb-download-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.kb-leaderboard-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.kb-leaderboard-card {
  background: #FFFFFF;
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kb-leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #FAF5FF;
  border-radius: 16px;
  border: 1px solid #E9D5FF;
  gap: 12px;
  min-width: 0;
}

.kb-leaderboard-row.national {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 8px 12px;
}

.kb-leaderboard-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.kb-leaderboard-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  flex-shrink: 0;
}

.kb-leaderboard-rank.national {
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
}

.kb-leaderboard-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #FFF;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.kb-leaderboard-avatar.national {
  width: 38px;
  height: 38px;
}

.kb-leaderboard-info {
  min-width: 0;
  flex: 1;
}

.kb-leaderboard-info h5 {
  font-weight: 700;
  font-size: 0.925rem;
  color: var(--text-main);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-leaderboard-info.national h5 {
  font-size: 0.9rem;
}

.kb-leaderboard-info p {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-leaderboard-info.national p {
  font-size: 0.75rem;
}

.kb-leaderboard-score {
  text-align: right;
  flex-shrink: 0;
  margin-left: 8px;
}

.kb-leaderboard-score .score-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #DB2777;
  display: block;
  line-height: 1.1;
}

.kb-leaderboard-score.national .score-val {
  color: #2563EB;
  font-size: 1.1rem;
}

.kb-leaderboard-score .score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .kb-header-title {
    font-size: 1.6rem;
  }
  .kb-header-pill {
    font-size: 0.85rem;
    padding: 6px 18px;
  }
  .kb-indicator-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .kb-leaderboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .kb-leaderboard-card {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .kb-leaderboard-row {
    padding: 8px 10px;
    gap: 8px;
  }
  .kb-leaderboard-left {
    gap: 8px;
  }
  .kb-leaderboard-info h5 {
    font-size: 0.875rem;
  }
  .kb-leaderboard-info p {
    font-size: 0.725rem;
  }
  .kb-leaderboard-score .score-val {
    font-size: 1.05rem;
  }
  .kb-rewards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .kb-line-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: center;
  }
  .kb-line-qr-wrapper {
    max-width: 180px;
    margin: 0 auto;
  }
  .kb-download-card {
    flex-direction: column;
    text-align: center;
  }
  .kb-download-info {
    flex-direction: column;
  }
}
