:root {
  --kq-accent: #E8375A;
  --kq-nav-bg: #E8375A;
  --kq-nav-h: 50px;
  --kq-white: #fff;
  --kq-gray-cap: #e8e8e8;
  --kq-gray-cap-txt: #444;
  --kq-correct: #37B24D;
  --kq-wrong: #E03131;
  --kq-star: #FFD700;
  --kq-sky: #87CEEB;
  --kq-grass: #5AAA30;
  --kq-hero-h: 280px;
  --kq-radius: 10px;
  --kq-shadow: 0 2px 8px rgba(0,0,0,.12);
  --kq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

body {
  font-family: var(--kq-font);
  background: #f4f4f4;
  color: #222;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

.kq-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--kq-accent);
  color: #fff;
  padding: 6px 12px;
  z-index: 9999;
  transition: top .2s;
}
.kq-skip-link:focus { top: 0; }

.kq-main { min-height: 60vh; }

.kq-ad { display: block; text-align: center; }
.kq-ad--sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(255,255,255,.97);
  padding: 4px 0;
  border-top: 1px solid #ddd;
  text-align: center;
}

/* ── NAV ── */
.kq-nav {
  background: var(--kq-nav-bg);
  position: sticky;
  top: 0;
  z-index: 800;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.kq-nav__inner {
  display: flex;
  align-items: center;
  height: var(--kq-nav-h);
  padding: 0 12px;
  gap: 0;
  overflow: hidden;
}
.kq-nav__hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.kq-nav__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.kq-nav__logo {
  display: flex;
  align-items: center;
  margin: 0 10px 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -.5px;
}
.kq-nav__logo img { height: 36px; width: auto; }
.kq-nav__cats {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.kq-nav__cats::-webkit-scrollbar { display: none; }
.kq-nav__cat {
  display: block;
  padding: 0 14px;
  height: var(--kq-nav-h);
  line-height: var(--kq-nav-h);
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.kq-nav__cat:hover,
.kq-nav__cat[aria-current="page"] { background: rgba(255,255,255,.15); color: #FFE066; }

/* ── DRAWER ── */
.kq-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 850;
}
.kq-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  z-index: 860;
  transform: translateX(-100%);
  transition: transform .3s ease;
  overflow-y: auto;
}
.kq-nav-drawer[aria-hidden="false"] { transform: translateX(0); }
.kq-nav-overlay.is-open { display: block; }
.kq-nav-drawer__inner { padding: 16px; }
.kq-nav-drawer__close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  float: right;
  padding: 4px 8px;
}
.kq-nav-drawer__link {
  display: block;
  padding: 12px 8px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
  font-weight: 600;
  color: #222;
}
.kq-nav-drawer__link:hover { color: var(--kq-accent); }

/* ── HERO ── */
.kq-hero {
  position: relative;
  height: var(--kq-hero-h);
  overflow: hidden;
  background: linear-gradient(180deg, var(--kq-sky) 0%, #98D8C8 40%, #7DC84A 70%, var(--kq-grass) 100%);
}
.kq-hero__scene { position: absolute; inset: 0; }
.kq-hero__sky {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% 10%, rgba(255,255,255,.07) 0deg 12deg, transparent 12deg 24deg);
}
.kq-hero__ground {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 90px;
  background: linear-gradient(180deg, #7DC84A, var(--kq-grass));
  border-radius: 60% 60% 0 0 / 24px 24px 0 0;
}
.kq-hero__path {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 90px solid transparent;
  border-right: 90px solid transparent;
  border-bottom: 90px solid #C8A060;
}
.kq-hero__mascot {
  position: absolute;
  bottom: 72px;
  left: 48px;
  font-size: 80px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.25));
  user-select: none;
}
.kq-hero__content {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 20px 40px 90px 200px;
  gap: 16px;
}
.kq-hero__question-box {
  background: rgba(255,255,255,.94);
  border: 3px solid var(--kq-star);
  border-radius: 14px;
  padding: 12px 22px;
  font-size: 18px;
  font-weight: 800;
  color: #1A3FCC;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  max-width: 500px;
}
.kq-hero__play-btn {
  display: inline-block;
  background: linear-gradient(180deg, #FF7A7A, var(--kq-accent));
  border: 4px solid #fff;
  border-radius: 40px;
  padding: 12px 38px;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  box-shadow: 0 5px 0 #A01030, 0 8px 20px rgba(0,0,0,.3);
  transition: transform .12s, box-shadow .12s;
}
.kq-hero__play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #A01030, 0 10px 24px rgba(0,0,0,.3);
}
.kq-hero__play-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #A01030; }

/* ── THUMB STRIP ── */
.kq-thumb-strip {
  display: flex;
  border-top: 3px solid var(--kq-accent);
}
.kq-thumb-strip__item {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: block;
}
.kq-thumb-strip__item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  transition: transform .2s;
}
.kq-thumb-strip__item:hover img { transform: scale(1.06); }

/* ── ADS STRIP ── */
.kq-ad--banner-top {
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
  padding: 6px 16px;
  text-align: center;
}

/* ── QUIZ GRID ── */
.kq-grid-section { background: #fff; }
.kq-quiz-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.kq-quiz-grid__ad-row {
  grid-column: 1 / -1;
  text-align: center;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  padding: 6px;
  background: #f8f8f8;
}
.kq-card {
  border: 1px solid #eee;
  overflow: hidden;
  background: #fff;
}
.kq-card__link { display: block; }
.kq-card__thumb-wrap { overflow: hidden; position: relative; }
.kq-card__thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.kq-card:hover .kq-card__thumb { transform: scale(1.04); }
.kq-card__caption {
  background: var(--kq-gray-cap);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kq-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--kq-gray-cap-txt);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kq-card__meta { font-size: 10px; color: #888; }

/* ── ARCHIVE HEADER ── */
.kq-archive-header {
  padding: 16px 20px;
  background: #fff;
  border-bottom: 3px solid var(--kq-accent);
}
.kq-archive-header__title {
  font-size: 22px;
  font-weight: 800;
  color: var(--kq-accent);
}

/* ── PAGINATION ── */
.kq-pagination { padding: 20px; text-align: center; background: #fff; }
.kq-pagination .page-numbers {
  display: inline-flex;
  gap: 4px;
  list-style: none;
}
.kq-pagination .page-numbers a,
.kq-pagination .page-numbers span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  transition: background .15s;
}
.kq-pagination .page-numbers a:hover { background: #f0f0f0; }
.kq-pagination .page-numbers .current { background: var(--kq-accent); color: #fff; border-color: var(--kq-accent); }

.kq-no-results { padding: 40px; text-align: center; color: #888; }

/* ── QUIZ PLAY PAGE ── */
.kq-quiz-page { background: #f4f4f4; min-height: calc(100vh - var(--kq-nav-h)); }
.kq-quiz-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
  align-items: start;
}
.kq-quiz-main {
  background: #fff;
  min-height: calc(100vh - var(--kq-nav-h));
  position: relative;
}

.kq-quiz-topbar {
  background: #7C3AED;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 44px;
  position: sticky;
  top: var(--kq-nav-h);
  z-index: 100;
}
.kq-quiz-topbar__back {
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .15s;
}
.kq-quiz-topbar__back:hover { background: rgba(255,255,255,.2); }
.kq-quiz-topbar__title {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kq-quiz-topbar__progress { flex: 1; display: flex; align-items: center; gap: 8px; }
.kq-progress-bar {
  flex: 1;
  background: rgba(255,255,255,.25);
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
}
.kq-progress-bar__fill {
  height: 6px;
  background: #FFE066;
  border-radius: 10px;
  transition: width .4s ease;
}
.kq-quiz-topbar__counter { color: rgba(255,255,255,.8); font-size: 12px; white-space: nowrap; }
.kq-quiz-topbar__score { color: #FFE066; font-size: 13px; font-weight: 700; white-space: nowrap; }

/* INTERSTITIAL */
.kq-interstitial {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}
.kq-interstitial[aria-hidden="true"] { display: none; }
.kq-interstitial__inner {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 360px;
  width: 90%;
}
.kq-interstitial__skip {
  display: inline-block;
  margin-top: 16px;
  background: var(--kq-accent);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.kq-interstitial__skip:hover { opacity: .9; }

/* QUIZ PLAY AREA */
.kq-quiz-play { padding: 20px; }
.kq-quiz-play[aria-hidden="true"] { display: none; }
.kq-quiz-play__mascot {
  font-size: 64px;
  text-align: center;
  margin-bottom: 12px;
  transition: transform .2s;
  user-select: none;
}
.kq-quiz-play__mascot.bounce { animation: kq-bounce .4s ease; }
@keyframes kq-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  60% { transform: scale(.95); }
  100% { transform: scale(1); }
}
.kq-question-box {
  background: #FFF9E6;
  border: 2.5px solid #FFD43B;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.kq-question-box__text {
  font-size: 17px;
  font-weight: 700;
  color: #5F3E00;
  text-align: center;
  line-height: 1.5;
}
.kq-question-box__video { margin-top: 12px; border-radius: 8px; overflow: hidden; }

.kq-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.kq-choice {
  border: 2.5px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, transform .12s;
  list-style: none;
}
.kq-choice:hover:not(.is-correct):not(.is-wrong) { border-color: #aaa; transform: scale(1.02); }
.kq-choice.is-correct { border-color: var(--kq-correct); background: #F0FFF4; }
.kq-choice.is-wrong   { border-color: var(--kq-wrong);   background: #FFF5F5; }
.kq-choice__img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}
.kq-choice__img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.kq-choice__label {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: #333;
  border-top: 1px solid #eee;
}
.kq-choice.is-correct .kq-choice__label { color: var(--kq-correct); }
.kq-choice.is-wrong   .kq-choice__label { color: var(--kq-wrong); }

.kq-feedback {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  min-height: 28px;
  margin-bottom: 12px;
}
.kq-feedback.correct { color: var(--kq-correct); }
.kq-feedback.wrong   { color: var(--kq-wrong); }

.kq-next-btn {
  display: block;
  width: 100%;
  background: var(--kq-accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  animation: kq-fadein .3s ease;
}
.kq-next-btn:hover { opacity: .9; }
@keyframes kq-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* RESULT */
.kq-result { padding: 0; }
.kq-result[aria-hidden="true"] { display: none; }
.kq-result__hero {
  background: linear-gradient(180deg, #3B82F6, #1D4ED8);
  padding: 32px 20px;
  text-align: center;
}
.kq-result__stars { font-size: 36px; margin-bottom: 8px; }
.kq-result__score { font-size: 36px; font-weight: 800; color: #FFE066; margin-bottom: 6px; }
.kq-result__message { font-size: 16px; color: rgba(255,255,255,.9); }
.kq-result__ad { padding: 16px; text-align: center; }
.kq-result__actions { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.kq-result__btn {
  display: block;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}
.kq-result__btn:hover { opacity: .88; }
.kq-result__btn--primary  { background: var(--kq-accent); color: #fff; }
.kq-result__btn--secondary { background: #f0f0f0; color: #333; }

/* ── SIDEBAR ── */
.kq-quiz-sidebar {
  position: sticky;
  top: calc(var(--kq-nav-h) + 44px);
  max-height: calc(100vh - var(--kq-nav-h) - 44px);
  overflow-y: auto;
  background: #fafafa;
  border-left: 1px solid #eee;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.kq-quiz-sidebar::-webkit-scrollbar { width: 4px; }
.kq-quiz-sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }
.kq-quiz-sidebar__related-title {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.kq-related-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
  margin-bottom: 6px;
  transition: background .15s;
}
.kq-related-item:hover { background: #f0f0f0; }
.kq-related-item img { width: 72px; height: 40px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.kq-related-item span { font-size: 12px; font-weight: 600; color: #333; line-height: 1.3; }

/* ── FOOTER ── */
.kq-footer {
  background: #222;
  color: #aaa;
  padding: 24px 20px;
  margin-top: 20px;
}
.kq-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.kq-footer__logo { font-size: 16px; font-weight: 700; color: #fff; }
.kq-footer__nav { display: flex; gap: 16px; flex-wrap: wrap; }
.kq-footer__nav a { font-size: 13px; color: #aaa; transition: color .15s; }
.kq-footer__nav a:hover { color: #fff; }
.kq-footer__copy { font-size: 12px; margin-left: auto; }

/* ── ADMIN NOTICE ── */
.kq-admin-wrap h1 { font-size: 22px; margin-bottom: 16px; }
.kq-settings-form { max-width: 900px; }
.kq-admin-tabs { display: flex; gap: 0; border-bottom: 2px solid #ddd; margin-bottom: 20px; }
.kq-tab {
  display: block;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
}
.kq-tab.active, .kq-tab:focus { color: #E8375A; border-bottom-color: #E8375A; }
.kq-tab-panel { padding: 8px 0 20px; }
.kq-slot-box {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 14px;
}
.kq-slot-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; cursor: pointer; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .kq-quiz-layout { grid-template-columns: 1fr; }
  .kq-quiz-sidebar { position: static; max-height: none; }
}

@media (max-width: 768px) {
  .kq-quiz-grid { grid-template-columns: repeat(2, 1fr); }
  :root { --kq-hero-h: 200px; }
  .kq-hero__mascot { font-size: 52px; bottom: 56px; }
  .kq-hero__question-box { font-size: 13px; padding: 8px 14px; }
  .kq-hero__play-btn { font-size: 16px; padding: 9px 24px; }
  .kq-hero__content { padding: 14px 16px 70px 140px; }
  .kq-thumb-strip__item img { height: 60px; }
  .kq-question-box__text { font-size: 15px; }
  .kq-choices { gap: 8px; }
  .kq-nav__cats .kq-nav__cat { padding: 0 10px; font-size: 13px; }
}

@media (max-width: 480px) {
  .kq-quiz-grid { grid-template-columns: 1fr; }
  .kq-card { display: flex; }
  .kq-card__thumb-wrap { width: 120px; flex-shrink: 0; }
  .kq-card__thumb { height: 100%; aspect-ratio: unset; }
  .kq-card__caption { flex: 1; justify-content: center; }
  .kq-hero__content { padding: 12px 12px 64px 110px; }
  .kq-hero__mascot { font-size: 44px; left: 10px; }
  .kq-choices { grid-template-columns: 1fr 1fr; }
  .kq-quiz-topbar__title { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
