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

:root {
  --bg: #09090b;
  --surface: #111114;
  --surface-2: #18181b;
  --border: #27272a;
  --border-hover: #3f3f46;
  --accent: #c4a44a;
  --accent-dim: rgba(196,164,74,0.12);
  --accent-glow: rgba(196,164,74,0.25);
  --red: #991b1b;
  --red-light: #f87171;
  --green: #16a34a;
  --green-light: #4ade80;
  --text: #f0f0f0;
  --text-secondary: #c0c0c8;
  --text-muted: #9898a2;
  --radius: 10px;
}

html {
  font-size: 18px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* ── Hero ── */

.hero {
  position: relative;
  height: 380px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.35);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 40px;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(196,164,74,0.2);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.hero-title {
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 10px;
}

.hero-title .kanji {
  display: block;
  font-size: 0.45em;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 6px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 28px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.89rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.hero-cta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ── Stats Bar ── */

.stats-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.stats-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Noto Serif JP', serif;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  align-self: center;
}

/* ── Intro Section ── */

.intro-section {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.intro-text h2 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 20px;
}

.intro-text p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
}

.intro-text p:last-child {
  margin-bottom: 0;
}

.intro-text strong {
  color: var(--text);
  font-weight: 600;
}

/* ── How It Works ── */

.how-section {
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

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

.how-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.how-number {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  opacity: 0.4;
  margin-bottom: 12px;
}

.how-card h3 {
  font-size: 0.94rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.how-card p {
  font-size: 0.89rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Sensei Section ── */

.sensei-section {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 40px;
}

.sensei-section-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.sensei-section-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

.sensei-section-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.sensei-section-body p {
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.sensei-quote {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  position: relative;
}

.sensei-quote svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0.4;
  margin-bottom: 6px;
}

.sensei-quote em {
  display: block;
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-style: italic;
}

.sensei-quote span {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Levels Section ── */

.levels-section {
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

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

.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.level-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: 6px;
}

.level-kanji {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.2rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.level-card p {
  font-size: 0.89rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}

.level-modules {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Layout ── */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Rank Progress ── */

.rank-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.rank-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.rank-steps {
  display: flex;
  gap: 4px;
  align-items: center;
}

.rank-step {
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.rank-step.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(196,164,74,0.3);
}

.rank-step.completed {
  background: rgba(22,163,74,0.1);
  color: var(--green-light);
  border-color: rgba(22,163,74,0.25);
}

.rank-connector {
  width: 16px;
  height: 1px;
  background: var(--border);
}

/* ── Exam Info Banner ── */

.exam-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 32px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.exam-info-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid rgba(196,164,74,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.exam-info-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.exam-info-body h3 {
  font-size: 0.94rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.exam-info-body p {
  font-size: 0.89rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.exam-info-body .exam-details {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.exam-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam-detail svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.exam-detail strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── Section Headers ── */

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.section-header p {
  font-size: 0.89rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Course Cards ── */

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding-bottom: 60px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
}

.course-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.course-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.course-card-body {
  padding: 18px;
}

.course-card-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.course-card-body p {
  font-size: 0.89rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.course-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.course-card-meta .lessons-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.course-card-meta .status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.status-pending {
  background: var(--accent-dim);
  color: var(--accent);
}

.status-done {
  background: rgba(22,163,74,0.1);
  color: var(--green-light);
}

.status-locked {
  background: rgba(140,140,150,0.1);
  color: var(--text-muted);
}

/* ── Locked Course Cards ── */

.course-card-locked {
  cursor: not-allowed;
  position: relative;
}

.course-card-locked:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.course-card-locked .course-card-img {
  filter: grayscale(1) brightness(0.4);
}

.course-card-locked .course-card-body {
  opacity: 0.45;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(9,9,11,0.6);
  border-radius: var(--radius);
}

.lock-overlay svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.lock-overlay span {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Lesson View ── */

.lesson-view { display: none; }
.lesson-view.active { display: block; padding-bottom: 60px; }
.course-list.hidden { display: none; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  padding: 20px 0 24px;
  transition: color 0.2s;
}

.back-btn:hover { color: var(--text); }
.back-btn svg { width: 16px; height: 16px; }

.progress-bar-container {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.progress-bar-step {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.3s;
}

.progress-bar-step.done { background: var(--green-light); }
.progress-bar-step.current { background: var(--accent); }

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 16px;
}

.lesson-counter {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.lesson-card h2 {
  font-size: 1.33rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.35;
}

.lesson-card .theory {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.85;
}

.lesson-card .theory strong {
  color: var(--text);
  font-weight: 600;
}

.note-box {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.89rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.note-box strong {
  color: var(--accent);
  font-weight: 600;
}

/* ── Exam Section ── */

.exam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.exam-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.exam-header svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.exam-header h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.exam-question {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 12px 0 20px;
  line-height: 1.5;
}

.options-list {
  display: grid;
  gap: 8px;
}

.option-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.94rem;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: #1f1f23;
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(22,163,74,0.08);
}

.option-btn.correct .option-letter {
  background: var(--green);
  border-color: var(--green);
  color: #09090b;
}

.option-btn.wrong {
  border-color: var(--red-light);
  background: rgba(248,113,113,0.08);
  color: var(--red-light);
}

.option-btn.wrong .option-letter {
  background: var(--red-light);
  border-color: var(--red-light);
  color: #09090b;
}

.option-btn:disabled { cursor: default; opacity: 0.85; }

/* ── Sensei Response ── */

.sensei-box {
  display: none;
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sensei-box.visible {
  display: block;
  animation: slideUp 0.35s ease;
}

.sensei-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sensei-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.sensei-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
}

.sensei-role {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sensei-text {
  font-size: 0.94rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.next-btn {
  display: none;
  margin-top: 20px;
  background: var(--accent);
  border: none;
  color: var(--bg);
  padding: 11px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.89rem;
  font-weight: 600;
  transition: all 0.2s;
}

.next-btn.visible { display: inline-flex; align-items: center; gap: 6px; }
.next-btn:hover { filter: brightness(1.1); }
.next-btn svg { width: 16px; height: 16px; }

.score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.score-bar span {
  font-weight: 600;
  color: var(--text);
}

/* ── Certificate ── */

.certificate { display: none; padding-bottom: 60px; }
.certificate.active { display: block; }

.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 560px;
  margin: 40px auto 0;
  overflow: hidden;
}

.cert-top {
  background: linear-gradient(135deg, #1a1708, #12100a);
  border-bottom: 1px solid rgba(196,164,74,0.2);
  padding: 40px 32px 32px;
  text-align: center;
}

.cert-seal {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-seal svg {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.cert-top h2 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.cert-top .cert-subtitle {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.cert-body {
  padding: 28px 32px;
}

.cert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.89rem;
}

.cert-row:last-child { border-bottom: none; }
.cert-row .label { color: var(--text-muted); }
.cert-row .value { font-weight: 600; }
.cert-row .value.gold { color: var(--accent); }
.cert-row .value.green { color: var(--green-light); }
.cert-row .value.red { color: var(--red-light); }

.cert-message {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.89rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.cert-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.cert-actions button {
  flex: 1;
  padding: 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.89rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  border: none;
  color: var(--bg);
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ── Footer ── */

footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 0.83rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  line-height: 1.7;
}

footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

/* ── Animations ── */

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .how-grid, .levels-grid { grid-template-columns: 1fr; }
  .sensei-section { flex-direction: column; align-items: center; text-align: center; }
  .sensei-quote { text-align: left; }
  .stats-inner { gap: 20px; }
  .stat-divider { display: none; }
}

@media (max-width: 600px) {
  html { font-size: 16px; }
  .hero { height: 300px; }
  .hero-content { padding-bottom: 28px; }
  .lesson-card, .exam-card { padding: 20px; }
  .cert-top, .cert-body { padding-left: 20px; padding-right: 20px; }
  .rank-steps { gap: 2px; }
  .rank-connector { width: 8px; }
  .exam-info { flex-direction: column; gap: 14px; }
  .sensei-section { padding: 20px; }
  .intro-text h2 { font-size: 1.2rem; }
}
