@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap");

:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #66bb6a;

  --bg: #f1f8e9;
  --card: #ffffff;

  --success: #43a047;
  --danger: #e53935;
  --warning: #ff9800;

  --text: #263238;
  --text-light: #607d8b;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans Thai", sans-serif;

  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);

  color: var(--text);

  min-height: 100vh;

  padding: 20px;
}

/* =========================
   Container
========================= */

.container {
  width: min(100%, 1200px);
  margin: auto;
}

/* =========================
   Header
========================= */

header {
  background: var(--card);
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* =========================
   Banner
========================= */

.top-banner {
  width: 100%;

  display: flex;

  justify-content: center;

  align-items: center;

  padding: 0;

  background: linear-gradient(135deg, #f8fff8, #edf7ed);
}

.banner-logo {
  width: 100%;

  max-width: 1200px;

  height: auto;

  display: block;

  object-fit: contain;
}

h1 {
  text-align: center;

  color: var(--primary-dark);

  font-size: clamp(1.5rem, 4vw, 2.8rem);

  font-weight: 700;

  margin: 20px 15px 10px;
}

.subtitle {
  text-align: center;

  color: var(--text-light);

  margin-bottom: 25px;

  font-size: 1rem;
}

/* =========================
   Top Bar
========================= */

.top-bar {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));

  gap: 15px;

  padding: 0 20px 20px;
}

.box {
  background: white;

  border: 2px solid #e8f5e9;

  border-radius: 18px;

  padding: 18px;

  text-align: center;

  font-weight: 600;

  transition: 0.25s;

  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
}

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

.box span {
  display: block;

  margin-top: 5px;

  font-size: 1.5rem;

  font-weight: 700;

  color: var(--primary-dark);
}

.timer {
  background: #fff8e1;

  border-color: #ffe082;
}

/* =========================
   Loading
========================= */

.loading {
  background: white;

  border-radius: 20px;

  padding: 20px;

  margin-bottom: 20px;

  text-align: center;

  font-size: 1rem;

  font-weight: 600;

  color: var(--primary);

  box-shadow: var(--shadow);
}

/* =========================
   Quiz Card
========================= */

.quiz-card {
  background: white;

  border-radius: 24px;

  padding: 30px;

  box-shadow: var(--shadow);
}

.question {
  text-align: center;

  font-size: clamp(2rem, 6vw, 4rem);

  font-weight: 700;

  color: var(--primary-dark);

  margin-bottom: 30px;

  line-height: 1.4;

  word-break: break-word;
}

/* =========================
   Options
========================= */

.options {
  display: grid;

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

  gap: 15px;
}

.option-btn {
  border: none;

  border-radius: 18px;

  padding: 18px;

  background: #f7fff7;

  border: 2px solid #dcedc8;

  cursor: pointer;

  font-size: clamp(0.95rem, 2vw, 1.1rem);

  font-weight: 500;

  transition: 0.25s;
}

.option-btn:hover {
  transform: translateY(-3px);

  background: #e8f5e9;

  border-color: #81c784;
}

.option-btn:disabled {
  cursor: not-allowed;
}

.game-controls {
  display: flex;

  justify-content: center;

  gap: 10px;

  flex-wrap: wrap;

  margin-top: 20px;
}

.control-btn {
  border: none;

  border-radius: 12px;

  padding: 12px 20px;

  font-size: 1rem;

  cursor: pointer;

  font-weight: 600;

  color: white;

  transition: 0.25s;
}

.pause-btn {
  background: #ff9800;
}

.resume-btn {
  background: #43a047;
}

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

/* =========================
   Answer Status
========================= */

.correct {
  background: var(--success) !important;

  color: white !important;

  border-color: var(--success) !important;
}

.wrong {
  background: var(--danger) !important;

  color: white !important;

  border-color: var(--danger) !important;
}

.message {
  margin-top: 20px;

  text-align: center;

  font-size: 1.1rem;

  font-weight: 600;

  min-height: 35px;
}

/* =========================
   Result
========================= */

.result-area {
  margin-top: 20px;

  background: white;

  border-radius: 24px;

  padding: 25px;

  box-shadow: var(--shadow);
}

#result {
  text-align: center;

  line-height: 2;

  font-size: 1.1rem;
}

.pass {
  color: var(--success);

  font-weight: 700;
}

.fail {
  color: var(--danger);

  font-weight: 700;
}

/* =========================
   Button
========================= */

#restartBtn {
  display: block;

  margin: 20px auto 0;

  border: none;

  background: var(--primary);

  color: white;

  padding: 14px 30px;

  border-radius: 14px;

  cursor: pointer;

  font-size: 1rem;

  font-weight: 600;

  transition: 0.25s;
}

#restartBtn:hover {
  background: var(--primary-dark);

  transform: translateY(-2px);
}

/* =========================
   Leaderboard
========================= */

.leaderboard {
  margin-top: 20px;

  background: white;

  border-radius: 24px;

  padding: 25px;

  box-shadow: var(--shadow);
}

.leaderboard h2 {
  color: var(--primary-dark);

  margin-bottom: 15px;
}

.leaderboard ol {
  padding-left: 20px;
}

.leaderboard li {
  padding: 12px;

  margin-bottom: 10px;

  background: #f7fff7;

  border-left: 5px solid var(--primary-light);

  border-radius: 10px;

  font-size: 0.95rem;
}

.leaderboard li:nth-child(1) {
  border-left-color: #fbc02d;

  background: #fffde7;

  font-weight: 700;
}

.leaderboard li:nth-child(2) {
  border-left-color: #9e9e9e;
}

.leaderboard li:nth-child(3) {
  border-left-color: #a1887f;
}

/* =========================
   Footer
========================= */

.footer {
  margin-top: 25px;

  text-align: center;

  color: var(--text-light);

  font-size: 0.9rem;
}

/* =========================
   Responsive Tablet
========================= */

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .top-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  h1 {
    font-size: 1.7rem;
  }

  .question {
    font-size: 2rem;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .box {
    min-width: 100px;
  }
}

/* =========================
   Responsive Mobile
========================= */

@media (max-width: 480px) {
  header,
  .quiz-card,
  .leaderboard,
  .result-area {
    padding: 18px;
  }

  .top-bar {
    grid-template-columns: 1fr;
  }

  .box {
    width: 100%;
  }

  #restartBtn {
    width: 100%;
  }
}

/* ==========================
   PRODUCTS
========================== */

.recommended-products {
  margin-top: 25px;

  background: #fff;

  border-radius: 24px;

  padding: 25px;

  box-shadow: var(--shadow);
}

.recommended-products h2 {
  text-align: center;

  color: var(--primary-dark);

  margin-bottom: 25px;
}

.product-grid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));

  gap: 20px;
}

/* ==========================
   Product Card
========================== */

.product-card {
  background: #fff;

  border: 1px solid #e8f5e9;

  border-radius: 18px;

  overflow: hidden;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);

  transition: 0.25s;

  display: flex;

  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);

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

/* ==========================
   Product Image
========================== */

.product-image {
  width: 100%;

  aspect-ratio: 3/4;

  background: #fff;

  display: flex;

  justify-content: center;

  align-items: center;

  padding: 12px;

  border-bottom: 1px solid #f1f1f1;
}

.product-image img {
  width: 100%;

  height: 100%;

  object-fit: contain;

  object-position: center;

  display: block;
}

.product-info {
  padding: 15px;
}

.product-info h3 {
  font-size: 1rem;

  color: var(--text);

  margin-bottom: 10px;

  min-height: 50px;
}

.price {
  font-size: 1.3rem;

  font-weight: 700;

  color: #e53935;

  margin-bottom: 15px;
}

.detail-btn {
  display: block;

  text-align: center;

  text-decoration: none;

  background: var(--primary);

  color: white;

  padding: 12px;

  border-radius: 12px;

  font-weight: 600;

  transition: 0.25s;
}

.detail-btn:hover {
  background: var(--primary-dark);
}
