:root {
  --ink: #17211d;
  --muted: #61706a;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #dedbd0;
  --green: #1f6b57;
  --green-soft: #dceee7;
  --gold: #b7791f;
  --rose: #a74754;
  --blue: #315f9a;
  --shadow: 0 18px 45px rgba(23, 33, 29, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.6;
}

button,
textarea,
input {
  font: inherit;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 107, 87, 0.92), rgba(49, 95, 154, 0.86)),
    var(--paper);
}

.access-gate.unlocked {
  display: none;
}

.access-panel {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.access-panel h1 {
  margin: 4px 0 8px;
  font-size: 30px;
}

.access-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}

.access-panel label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.access-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.access-panel button,
.control-button,
.tab-button,
.copy-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.access-panel button {
  width: 100%;
  margin-top: 16px;
}

.access-error {
  display: block;
  min-height: 24px;
  margin-top: 10px;
  color: var(--rose);
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #f3f0e8;
  overflow: auto;
}

.brand h1 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.brand p:last-child {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.module-nav {
  display: grid;
  gap: 8px;
  margin: 28px 0;
}

.module-nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.module-nav a:hover {
  border-color: var(--line);
  background: #fff;
}

.sidebar-note {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-left: 4px solid var(--gold);
  background: #fff;
  color: var(--muted);
}

.sidebar-note strong {
  color: var(--ink);
}

.logout-button {
  width: 100%;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.logout-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.content {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 44px) 64px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.topbar h2 {
  max-width: 820px;
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.12;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.tab-button.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.hero-panel,
.schedule,
.view,
.checklist-section,
.homework {
  margin-top: 20px;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(23, 33, 29, 0.06);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 28px;
  align-items: start;
}

.hero-panel h2,
.section-heading h2,
.schedule h2 {
  margin: 4px 0 10px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.18;
}

.hero-panel p,
.section-heading p,
.lesson-block p,
.homework li {
  color: var(--muted);
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.outcome-grid div {
  min-height: 146px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.outcome-grid span {
  display: block;
  color: var(--gold);
  font-weight: 900;
}

.outcome-grid strong {
  display: block;
  margin-top: 10px;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.timeline div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: var(--green-soft);
}

.timeline time {
  color: var(--green);
  font-weight: 900;
}

.schedule-note {
  margin: 16px 0 0;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.slide-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.slide-toolbar span {
  min-width: 76px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.control-button {
  background: var(--blue);
}

.control-button.ghost {
  color: var(--blue);
  background: #fff;
  border-color: #c9d7e8;
}

.slide-stage {
  min-height: 390px;
  padding: clamp(22px, 4vw, 46px);
  border: 1px solid #c9d7e8;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff, #ffffff 60%, #f8f0ea);
}

body.slide-fullscreen {
  overflow: hidden;
}

body.slide-fullscreen .sidebar,
body.slide-fullscreen .topbar,
body.slide-fullscreen .hero-panel,
body.slide-fullscreen .schedule,
body.slide-fullscreen .checklist-section,
body.slide-fullscreen .homework,
body.slide-fullscreen .slide-strip,
body.slide-fullscreen .section-heading {
  display: none;
}

body.slide-fullscreen .app-shell {
  display: block;
}

body.slide-fullscreen .content {
  min-height: 100vh;
  padding: 0;
  background: #07130f;
}

body.slide-fullscreen .view {
  display: none;
}

body.slide-fullscreen #slides {
  display: grid;
  min-height: 100vh;
  margin: 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: #07130f;
  box-shadow: none;
  grid-template-rows: auto 1fr;
}

body.slide-fullscreen .slide-toolbar {
  justify-content: center;
  margin: 0 0 14px;
}

body.slide-fullscreen .slide-toolbar span {
  color: #eaf2ee;
}

body.slide-fullscreen .slide-stage {
  display: flex;
  min-height: 0;
  height: calc(100vh - 86px);
  flex-direction: column;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: clamp(28px, 6vw, 86px);
  background: linear-gradient(135deg, #f8fbff, #ffffff 58%, #f7eee6);
}

body.slide-fullscreen .slide-stage h3 {
  font-size: clamp(44px, 7vw, 96px);
}

body.slide-fullscreen .slide-stage p,
body.slide-fullscreen .slide-stage li,
body.slide-fullscreen .slide-stage code {
  font-size: clamp(24px, 3vw, 42px);
}

.slide-kicker {
  color: var(--blue);
  font-weight: 900;
}

.slide-stage h3 {
  margin: 4px 0 18px;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.05;
}

.slide-stage ul,
.slide-stage ol {
  padding-left: 22px;
  font-size: clamp(18px, 2vw, 24px);
}

.slide-stage code,
.prompt-card pre {
  white-space: pre-wrap;
}

.slide-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.slide-thumb {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.slide-thumb.active {
  border-color: var(--blue);
  background: #eef5ff;
}

.slide-thumb span {
  display: block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.handout-layout {
  display: grid;
  gap: 18px;
}

.lesson-block {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.lesson-block h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.teacher-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.teacher-block {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfaf6;
}

.teacher-block h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

.teacher-block p,
.teacher-block li {
  color: var(--muted);
}

.worksheet-line,
.example {
  padding: 14px;
  border-radius: 8px;
  background: #f8f6ef;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.form-grid label.wide {
  grid-column: 1 / -1;
}

textarea {
  min-height: 92px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.flow-map {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.flow-map span {
  display: grid;
  min-height: 76px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--green-soft);
  text-align: center;
  font-weight: 800;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.reference-grid div {
  min-height: 130px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.reference-grid strong {
  display: block;
  margin-bottom: 8px;
}

.reference-grid p {
  margin: 0;
}

.reference-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.reference-list li {
  color: var(--muted);
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  overflow: hidden;
}

.prompt-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.prompt-card h3 {
  margin: 0;
  font-size: 18px;
}

.prompt-card pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #26312d;
}

.copy-button {
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checklist-grid label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  font-weight: 700;
}

.homework ol {
  display: grid;
  gap: 10px;
  margin: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .module-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-panel,
  .timeline,
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .content {
    padding: 18px 14px 44px;
  }

  .module-nav,
  .outcome-grid,
  .form-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .slide-stage {
    min-height: 340px;
  }
}

@media print {
  .access-gate,
  .sidebar,
  .topbar-actions,
  .slide-toolbar,
  .slide-strip {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .view {
    display: block;
  }

  .content {
    padding: 0;
  }
}
