/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

/* ── TOKENS ── */
:root {
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans:  'Geist', 'Helvetica Neue', sans-serif;
  --ease:       cubic-bezier(.22, 1, .36, 1);
}

[data-theme="dark"] {
  --bg:         #0c0c0e;
  --bg-raised:  #131316;
  --bg-hover:   #1a1a1e;
  --border:     #222226;
  --border-mid: #2e2e34;
  --text:       #e8e8ec;
  --text-2:     #888892;
  --text-3:     #55555f;
  --accent:     #e8d5a3;
  --accent-dim: rgba(232, 213, 163, 0.08);
  --ink:        #ffffff;
}

[data-theme="light"] {
  --bg:         #fafaf8;
  --bg-raised:  #f3f3f0;
  --bg-hover:   #ebebea;
  --border:     #e2e2de;
  --border-mid: #d0d0ca;
  --text:       #1a1a1e;
  --text-2:     #666660;
  --text-3:     #aaaaaa;
  --accent:     #8a6a20;
  --accent-dim: rgba(138, 106, 32, 0.08);
  --ink:        #000000;
}

/* ── BASE ── */
body {
  font-family: var(--font-sans);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  transition: color 0.3s;
  position: relative;
  background-color: var(--bg);
  background-image: url('bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* Dark overlay so text stays readable */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0.78;
  z-index: 0;
  pointer-events: none;
}

[data-theme="light"] body::before {
  opacity: 0.85;
}

body > * {
  position: relative;
  z-index: 1;
}

a { color: inherit; text-decoration: none; }

/* ── NAV ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  backdrop-filter: blur(12px);
}

.nav-logo {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.nav-logo-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-mid);
  flex-shrink: 0;
}

/* Hero logo */
.hero-logo-wrap {
  margin-bottom: 1.5rem;
}
.hero-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-mid);
  display: block;
}

.nav-center {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.82rem;
  color: var(--text-2);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  font-weight: 400;
}
.nav-link:hover {
  background: var(--bg-raised);
  color: var(--text);
}

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.theme-btn:hover { border-color: var(--border-mid); color: var(--text); background: var(--bg-raised); }
.theme-btn svg { width: 15px; height: 15px; }

/* ── HERO ── */
.hero-bg {
  position: relative;
}
.hero {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 6rem 2rem 5rem;
  animation: fadeIn 0.6s var(--ease) both;
}

.hero-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 2rem;
}

.hero-h1 {
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 7vw, 5.5rem);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.5rem;
}
.hero-h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero-p {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 480px;
  line-height: 1.75;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-sans);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-block;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: none;
  border: 1px solid var(--border-mid);
  color: var(--text-2);
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 400;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: inline-block;
}
.btn-secondary:hover { border-color: var(--text-3); color: var(--text); background: var(--bg-raised); }

/* STATS */
.hero-stats {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.stat-item { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-n {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
}
.stat-l {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 500;
}
.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border-mid);
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ── SECTION ── */
.section { padding: 4rem 0; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 2rem; }

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.section-sub {
  font-size: 0.82rem;
  color: var(--text-3);
  font-weight: 400;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.search-wrap {
  position: relative;
  max-width: 380px;
}
.search-ico {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--border-mid); }
.search-input::placeholder { color: var(--text-3); }

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  min-width: 52px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.chip:hover {
  border-color: var(--border-mid);
  color: var(--text);
  background: var(--bg-raised);
}
.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* ── LEVEL HEADING ── */
.level-heading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 1.6rem 0 0.6rem;
}
.level-heading:first-child { padding-top: 0; }

.quiz-list-inner {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

/* ── QUIZ LIST (outer wrapper) ── */
.quiz-list {
  display: flex;
  flex-direction: column;
}

.quiz-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: fadeIn 0.4s var(--ease) both;
}
.quiz-row:last-child { border-bottom: none; }
.quiz-row:hover { background: var(--bg-raised); }

.qr-left { min-width: 0; }

.qr-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}
.qr-course {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.qr-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.qr-cat {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.qr-level {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
}

.qr-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.qr-topic {
  font-size: 0.82rem;
  color: var(--text-2);
  font-weight: 300;
  margin-bottom: 0.6rem;
  line-height: 1.5;
}
.qr-desc {
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.6;
  font-weight: 300;
}

.qr-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}
.qr-count {
  font-size: 0.75rem;
  color: var(--text-3);
  white-space: nowrap;
  font-weight: 400;
}
.qr-count strong {
  font-weight: 600;
  color: var(--text-2);
  font-size: 0.82rem;
}

.btn-open {
  display: inline-block;
  background: var(--accent-dim);
  border: 1px solid var(--border-mid);
  color: var(--accent);
  padding: 0.45rem 1.1rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.btn-open:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.btn-open.unavailable {
  color: var(--text-3);
  border-color: var(--border);
  background: none;
  pointer-events: none;
  cursor: default;
}
.btn-pay {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-family: var(--font-sans);
  cursor: pointer;
}
.btn-pay:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-unlocked {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}
.btn-unlocked:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #22c55e;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: none;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-3);
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.empty-state.show { display: block; }

/* ── ABOUT ── */
.about-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4rem;
  align-items: start;
}
@media (max-width: 680px) { .about-layout { grid-template-columns: 1fr; gap: 2rem; } }

.about-p {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.75;
  margin: 1rem 0 1.5rem;
  font-weight: 300;
}
.about-p strong { font-weight: 500; color: var(--text); }

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.about-list li {
  font-size: 0.85rem;
  color: var(--text-2);
  padding-left: 1.1rem;
  position: relative;
  font-weight: 300;
  line-height: 1.5;
}
.about-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-3);
}
.about-list strong { font-weight: 500; color: var(--text); }

.info-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.info-table tr { border-bottom: 1px solid var(--border); }
.info-table tr:last-child { border-bottom: none; }
.info-table td { padding: 0.85rem 1.2rem; font-size: 0.82rem; }
.it-label { color: var(--text-3); font-weight: 400; width: 45%; }
.it-val { color: var(--text); font-weight: 500; }

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-logo {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
}
.footer-copy {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── ANIMATION ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .nav { padding: 0 1.2rem; }
  .nav-center { display: none; }
  .hero { padding: 4rem 1.2rem 3.5rem; }
  .container { padding: 0 1.2rem; }
  .quiz-row { grid-template-columns: 1fr; }
  .qr-right { flex-direction: row; align-items: center; justify-content: space-between; }
  .hero-stats { gap: 1.2rem; }
}
