
:root {
  --c-bg: #faf9f6;
  --c-surface: #ffffff;
  --c-primary: #2d6a4f;
  --c-primary-light: #52b788;
  --c-accent: #e76f51;
  --c-text: #2b2b2b;
  --c-text-light: #666;
  --c-border: #e0ddd5;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --max-w: 800px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--c-bg); color: var(--c-text);
  line-height: 1.7; min-height: 100vh;
}

/* top nav */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--c-primary); padding: .7rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.home-link { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; }

/* hamburger button */
.menu-btn {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px;
}
.menu-btn span {
  display: block; width: 22px; height: 2.5px;
  background: #fff; border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.drawer-open .menu-btn span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.drawer-open .menu-btn span:nth-child(2) { opacity: 0; }
.drawer-open .menu-btn span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* drawer overlay */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.4); opacity: 0;
  pointer-events: none; transition: opacity .25s;
}
.drawer-open .drawer-overlay { opacity: 1; pointer-events: auto; }

/* drawer panel */
.drawer {
  position: fixed; top: 0; right: 0; z-index: 95;
  width: 280px; max-width: 80vw; height: 100vh;
  background: var(--c-surface);
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.drawer-open .drawer { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; background: var(--c-primary); color: #fff;
  font-weight: 600; font-size: 1rem; flex-shrink: 0;
}
.drawer-close {
  background: none; border: none; color: #fff;
  font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 0 .2rem;
}
.drawer-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: .4rem 0;
}
.drawer-list a {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem 1rem; text-decoration: none;
  color: var(--c-text); font-size: .95rem;
  border-bottom: 1px solid var(--c-border);
  transition: background .12s;
}
.drawer-list a:hover { background: #f0faf4; }
.drawer-list a.active {
  background: #e8f5ef; color: var(--c-primary); font-weight: 600;
  border-left: 3px solid var(--c-primary);
}
.drawer-ep {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-primary-light); color: #fff;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.drawer-list a.active .drawer-ep { background: var(--c-primary); }

/* hero */
.hero {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  color: #fff; text-align: center; padding: 3rem 1rem 2.5rem;
}
.hero h1 { font-size: 2rem; margin-bottom: .4rem; }
.hero p { font-size: 1.1rem; opacity: .9; }

/* card grid */
.index-page { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}
.card {
  background: var(--c-surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.card-thumb {
  height: 160px; background-size: cover; background-position: center;
  position: relative;
}
.card-ep {
  position: absolute; bottom: .5rem; left: .5rem;
  background: var(--c-accent); color: #fff;
  font-size: .8rem; font-weight: 600;
  padding: .2rem .6rem; border-radius: 6px;
}
.card-body { padding: .8rem 1rem; }
.card-body h2 { font-size: 1.05rem; font-weight: 600; }

/* lesson page */
.lesson-page { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem 3rem; }
.video-container {
  position: relative; width: 100%; padding-bottom: 56.25%;
  margin: 1.2rem 0; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.video-container iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}

/* article content */
.lesson-content {
  background: var(--c-surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem 1.5rem; margin-top: 1.2rem;
}
.lesson-content h1 { font-size: 1.5rem; color: var(--c-primary); margin-bottom: 1rem; border-bottom: 2px solid var(--c-primary-light); padding-bottom: .5rem; }
.lesson-content h2 { font-size: 1.25rem; color: var(--c-primary); margin: 1.8rem 0 .8rem; }
.lesson-content h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; color: var(--c-accent); }
.lesson-content p { margin: .5rem 0; }
.lesson-content strong { color: var(--c-primary); }
.lesson-content blockquote {
  border-left: 4px solid var(--c-primary-light);
  background: #f0faf4; padding: .6rem 1rem; margin: .8rem 0;
  border-radius: 0 8px 8px 0; font-size: .95rem;
}
.lesson-content ul, .lesson-content ol { padding-left: 1.5rem; margin: .5rem 0; }
.lesson-content li { margin: .3rem 0; }
.lesson-content table {
  width: 100%; border-collapse: collapse; margin: .8rem 0;
  font-size: .95rem;
}
.lesson-content th {
  background: var(--c-primary); color: #fff;
  padding: .5rem .8rem; text-align: left;
}
.lesson-content td {
  padding: .45rem .8rem; border-bottom: 1px solid var(--c-border);
}
.lesson-content tr:nth-child(even) td { background: #f8f8f5; }
.lesson-content hr { border: none; border-top: 1px solid var(--c-border); margin: 1.5rem 0; }
.lesson-content code {
  background: #f0ede6; padding: .15em .4em; border-radius: 4px;
  font-size: .9em;
}

/* lesson nav */
.lesson-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.5rem; padding: 1rem 0; gap: .5rem;
}
.lesson-nav a {
  background: var(--c-primary); color: #fff;
  padding: .5rem 1rem; border-radius: 8px;
  text-decoration: none; font-weight: 500; font-size: .95rem;
  transition: background .15s;
}
.lesson-nav a:hover { background: var(--c-primary-light); }
.lesson-nav .nav-home { background: var(--c-text-light); }

/* footer */
footer {
  text-align: center; padding: 1.5rem; font-size: .85rem;
  color: var(--c-text-light); border-top: 1px solid var(--c-border);
}
footer a { color: var(--c-primary); }

/* mobile */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .lesson-content { padding: 1.2rem 1rem; }
  .lesson-content h1 { font-size: 1.25rem; }
  .card-grid { grid-template-columns: 1fr; }
}
