:root {
  --cream: #FFF8F0;
  --cream-deep: #FBEFE0;
  --surface: #FFFFFF;
  --ink: #3A3A3A;
  --ink-soft: #6E6E6E;
  --ink-faint: #9A9A9A;
  --peach: #FFD4B8;
  --peach-deep: #FFB991;
  --sage: #B8D4C2;
  --sage-deep: #8FB8A0;
  --sky: #BFD8E8;
  --sky-deep: #93BBD3;
  --lavender: #D4C2E8;
  --lavender-deep: #B095D0;
  --coral: #FF8A65;
  --shadow: 0 4px 16px rgba(80, 60, 40, 0.06);
  --shadow-lift: 0 10px 28px rgba(80, 60, 40, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ---------- Site header ---------- */
.site-header {
  padding: 28px 24px;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.site-header .back-link:hover { transform: translateX(-2px); text-decoration: none; }

.class-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}

.class-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.class-badge.class-3iy { background: var(--peach); color: #6B3A1F; }
.class-badge.class-3sy { background: var(--sage); color: #2C5236; }
.class-badge.class-4g2 { background: var(--sky); color: #234B66; }
.class-badge.class-interactives { background: var(--lavender); color: #443268; }

/* ---------- Landing hero ---------- */
.hero {
  text-align: center;
  padding: 80px 24px 40px;
  max-width: 760px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.5px;
}
.hero h1 .accent { color: var(--coral); }
.hero p {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Class card grid (landing) ---------- */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  max-width: 980px;
  margin: 32px auto 0;
  padding: 0 24px;
}
.class-card {
  display: block;
  padding: 32px 28px;
  border-radius: var(--radius);
  text-align: left;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}
.class-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}
.class-card.bg-peach { background: var(--peach); }
.class-card.bg-sage { background: var(--sage); }
.class-card.bg-sky { background: var(--sky); }
.class-card.bg-lavender { background: var(--lavender); }

.class-card .label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.7;
}
.class-card h2 {
  font-size: 32px;
  font-weight: 800;
  margin: 6px 0 8px;
}
.class-card p {
  margin: 0;
  font-size: 15px;
  opacity: 0.8;
}
.class-card .arrow {
  position: absolute;
  top: 28px;
  right: 28px;
  font-size: 22px;
  opacity: 0.6;
  transition: transform .2s ease;
}
.class-card:hover .arrow { transform: translateX(4px); opacity: 1; }

/* ---------- Class file listing ---------- */
.term-section {
  margin-top: 40px;
}
.term-section h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--ink);
}
.term-section .term-rule {
  height: 3px;
  background: var(--cream-deep);
  border-radius: 2px;
  margin-bottom: 24px;
}

.week-block {
  margin-bottom: 28px;
}
.week-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.file-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  color: var(--ink);
}
.file-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}
.file-card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--cream-deep);
  background-size: cover;
  background-position: top center;
  position: relative;
}
.file-card .thumb.no-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: var(--ink-faint);
}
.file-card .meta {
  padding: 12px 14px 14px;
}
.file-card .type {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink);
}
.file-card .name {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Interactives ---------- */
.interactive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 24px;
}
.interactive-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  color: var(--ink);
}
.interactive-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}
.interactive-card .preview {
  position: relative;
  width: 100%;
  background: var(--cream-deep);
  overflow: hidden;
}
.interactive-card .preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  pointer-events: none;
  transform-origin: 0 0;
}
.interactive-card .preview .preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0) 60%, rgba(255,248,240,0.4) 100%);
}
.interactive-card .body {
  padding: 18px 20px 20px;
}
.interactive-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}
.interactive-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- States ---------- */
.loading, .empty, .error-box {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}
.error-box {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  text-align: left;
  padding: 24px 28px;
}
.error-box h3 {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 18px;
}
.error-box code {
  background: var(--cream-deep);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

footer.site-footer {
  text-align: center;
  padding: 40px 20px 60px;
  color: var(--ink-faint);
  font-size: 14px;
}
