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

html, body { height: 100%; }

body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: #1c2b22;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(228, 243, 154, 0.18), transparent 55%),
    linear-gradient(145deg, #0c1914 0%, #12241c 42%, #1a3330 100%);
  overflow: hidden;
  height: 100vh;
}

#hub {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: rgba(12, 25, 20, 0.94);
  border-bottom: 1px solid rgba(228, 243, 154, 0.18);
  backdrop-filter: blur(12px);
}

.hub-group { display: flex; align-items: center; gap: 8px; min-width: 0; }

.hub-btn, .hub-select {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: #e7f0e4;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 12px;
  line-height: 1.2;
}

.hub-btn.home { color: #e4f39a; border-color: rgba(228, 243, 154, 0.45); background: rgba(228, 243, 154, 0.12); }
.hub-btn.practice { color: #12241c; background: #e4f39a; border-color: #e4f39a; }
.hub-label { color: #c5d5c8; font-size: 12px; font-weight: 700; }
.hub-select { color: #f3f6ef; background: #1a3127; cursor: pointer; max-width: 42vw; }

#top-progress-bar {
  position: fixed;
  top: 48px;
  left: 0;
  height: 4px;
  width: 0;
  z-index: 31;
  background: linear-gradient(90deg, #e4f39a, #7dcea0 55%, #f0c27a);
  transition: width 0.25s ease-out;
}

.stage {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 68px 24px 86px;
}

.slide {
  display: none;
  width: min(1480px, 100%);
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 34px 48px 28px;
  background: #fbfcf7;
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  animation: slideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide.active { display: block; }

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

.badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.m1 { background: #e8f6ee; color: #14532d; border: 1px solid #b7e4c7; }
.m2 { background: #f4f8e8; color: #3f6212; border: 1px solid #d9edb0; }
.m3 { background: #fff6e8; color: #9a3412; border: 1px solid #fed7aa; }
.m4 { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }

h1, h2 {
  font-family: Fraunces, "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 700;
  color: #12241c;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); margin-bottom: 8px; }
h2 { font-size: clamp(1.45rem, 2.5vw, 1.95rem); margin-bottom: 6px; }

.sub {
  color: #3d5346;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 16px;
}

.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; margin: 14px 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #f4f7f2;
  border: 1px solid #e1ebe3;
  border-radius: 14px;
  padding: 16px 16px 14px;
}

.card h3 { font-size: 1.02rem; margin-bottom: 8px; color: #12241c; }
.card p, .callout, .slide > p { font-size: 0.95rem; line-height: 1.65; color: #24362c; }
.card-leaf { border-left: 5px solid #1f6b45; }
.card-moss { border-left: 5px solid #4d7c0f; }
.card-amber { border-left: 5px solid #b45309; }
.card-berry { border-left: 5px solid #9f1239; }
.card-ink { border-left: 5px solid #134e4a; }

.callout {
  margin: 14px 0;
  padding: 14px 16px;
  background: #f4f8e8;
  border-left: 4px solid #4d7c0f;
  border-radius: 0 12px 12px 0;
}

.formula {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
  padding: 16px 20px;
  border-radius: 14px;
  background: #12241c;
  color: #f3f6ef;
  font-size: 1.05rem;
  line-height: 1.55;
}

.formula strong { color: #e4f39a; }
.formula .note { color: #c5d5c8; font-size: 0.82rem; text-align: right; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.92rem;
}

th {
  background: #12241c;
  color: #f3f6ef;
  text-align: left;
  padding: 9px 12px;
  font-weight: 700;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid #e1ebe3;
  color: #24362c;
  vertical-align: top;
}

tr:nth-child(even) td { background: #f4f7f2; }

.figure {
  display: flex;
  justify-content: center;
  margin: 8px 0 12px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e1ebe3;
  border-radius: 14px;
}

.figure svg { width: 100%; height: auto; max-height: 280px; }

.slide-counter {
  position: fixed;
  left: 24px;
  bottom: 22px;
  z-index: 30;
  color: rgba(243, 246, 239, 0.86);
  background: rgba(12, 25, 20, 0.72);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
}

.nav-controls {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 30;
  display: flex;
  gap: 8px;
}

.nav-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f3f6ef;
  background: rgba(18, 36, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.nav-btn:hover { background: #1f6b45; }

.toc-drawer {
  position: fixed;
  top: 0;
  left: -400px;
  width: min(380px, 92vw);
  height: 100vh;
  z-index: 40;
  padding: 28px 20px 24px;
  overflow: auto;
  background: #0c1914;
  color: #f3f6ef;
  box-shadow: 12px 0 30px rgba(0, 0, 0, 0.45);
  transition: left 0.28s ease;
}

.toc-drawer.open { left: 0; }
.toc-drawer h2 { color: #e4f39a; font-size: 1.3rem; margin: 0 0 16px; }

.toc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #c5d5c8;
  background: none;
  border: 0;
  font-size: 1.6rem;
  cursor: pointer;
}

.toc-item {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 10px 12px;
  text-align: left;
  color: #d7e4d8;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.toc-item:hover { background: #1a3127; color: #e4f39a; }
.toc-item.active { background: #1f6b45; color: #fff; font-weight: 700; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .slide { padding: 22px 18px 18px; }
  .formula { flex-direction: column; align-items: flex-start; }
  .formula .note { text-align: left; }
}

@media (max-width: 720px) {
  #hub { height: auto; min-height: 48px; flex-wrap: wrap; padding: 8px; }
  .stage { padding: 108px 8px 112px; align-items: flex-start; }
  .slide { max-height: calc(100vh - 232px); border-radius: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hub-select { max-width: 70vw; }
  .nav-controls { left: 8px; right: 8px; justify-content: space-between; }
  .nav-btn { padding: 9px 10px; font-size: 0.82rem; }
  .slide-counter { bottom: 64px; left: 10px; }
}
