* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--color-ink);
  background: var(--color-canvas);
  font-family: var(--font-body);
  line-height: var(--leading-body);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.lc-container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }
.display { font-family: var(--font-display); line-height: var(--leading-tight); }
.hero-title { font-family: var(--font-display); font-size: var(--text-hero); line-height: .98; letter-spacing: -.035em; }
.muted { color: var(--color-muted); }
.eyebrow { color: var(--color-accent); font-size: var(--text-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

.site-header {
  min-height: 86px;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
}

.brand { font-size: 15px; font-weight: 700; letter-spacing: .06em; }

.card {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.panel { padding: var(--space-6); }
.panel-lg { padding: clamp(24px, 4vw, 44px); }

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 700;
  transition: transform .15s ease, background-color .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--color-accent); }
.btn-secondary { color: white; background: var(--color-primary); }
.btn-ghost { color: var(--color-ink); border-color: var(--color-line); background: var(--color-surface); }

.chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.chip-active { color: white; border-color: var(--color-primary); background: var(--color-primary); }

.field { display: grid; gap: 7px; }
.field label { color: var(--color-muted); font-size: var(--text-xs); font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--color-surface);
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }

.progress { height: 9px; overflow: hidden; border-radius: var(--radius-pill); background: #ebe6dd; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--color-accent); }

.avatar { display: inline-grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: white; background: var(--color-accent); font-weight: 700; }
.avatar-sm { width: 34px; height: 34px; font-size: var(--text-xs); }

.video {
  display: grid;
  min-height: 380px;
  place-items: center;
  border-radius: var(--radius-md);
  color: white;
  background: linear-gradient(135deg, #c8b994, var(--color-video));
}
.play { display: grid; width: 76px; height: 76px; place-items: center; border-radius: 50%; color: var(--color-primary); background: white; font-size: 28px; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: var(--sidebar) minmax(0, 1fr); background: var(--color-surface); }
.sidebar { display: flex; position: sticky; top: 0; height: 100vh; flex-direction: column; padding: 28px 22px; border-right: 1px solid var(--color-line); background: #ede8de; }
.sidebar-nav { display: grid; gap: 6px; margin-top: 42px; }
.sidebar-link { display: flex; min-height: 42px; align-items: center; padding: 0 14px; border-radius: var(--radius-sm); color: var(--color-muted); font-size: var(--text-sm); }
.sidebar-link:hover, .sidebar-link.is-active { color: white; background: var(--color-primary); }
.sidebar-profile { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 24px; border-top: 1px solid var(--color-line); }
.app-content { min-width: 0; padding: clamp(28px, 5vw, 64px); background: var(--color-surface); }
.content-wrap { width: min(100%, 1100px); margin-inline: auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.page-title { margin: 0; font-family: var(--font-display); font-size: clamp(30px, 4vw, 42px); line-height: var(--leading-tight); }
.page-subtitle { margin: 8px 0 0; color: var(--color-muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.list { display: grid; gap: 12px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-card); }
.screen { display: none; }
.screen:target { display: block; }
body:not(:has(.screen:target)) #dashboard { display: block; }

.modal-screen::before { position: fixed; z-index: 40; inset: 0; background: var(--color-overlay); content: ""; }
.modal-card { position: fixed; z-index: 50; top: 50%; left: 50%; width: min(calc(100% - 40px), 620px); max-height: calc(100vh - 40px); overflow: auto; transform: translate(-50%, -50%); }

.auth-shell { display: grid; min-height: 100vh; grid-template-rows: auto 1fr; background: var(--color-surface); }
.auth-main { display: grid; place-items: center; padding: 48px 20px; }
.auth-card { width: min(100%, 760px); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 8px; }
.step { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: var(--color-muted); background: #ebe6dd; font-size: var(--text-xs); font-weight: 700; }
.step-active { color: white; background: var(--color-primary); }
.step-done { color: white; background: var(--color-accent); }

.success-mark { display: grid; width: 84px; height: 84px; margin-inline: auto; place-items: center; border-radius: 50%; color: var(--color-primary); background: var(--color-primary-soft); font-size: 38px; font-weight: 700; }

body:has(#broadcasts:target) .nav-broadcasts,
body:has(#live:target) .nav-broadcasts,
body:has(#schedule:target) .nav-broadcasts,
body:has(#group:target) .nav-group,
body:has(#group-live:target) .nav-group,
body:has(#message-leader:target) .nav-group,
body:has(#courses:target) .nav-courses,
body:has(#course-detail:target) .nav-courses,
body:has(#lesson:target) .nav-courses,
body:has(#quiz:target) .nav-courses,
body:has(#course-complete:target) .nav-courses,
body:has(#materials:target) .nav-materials,
body:has(#material-preview:target) .nav-materials,
body:has(#library:target) .nav-library,
body:has(#book-detail:target) .nav-library,
body:has(#donations:target) .nav-donations,
body:has(#donation-confirm:target) .nav-donations,
body:has(#donation-success:target) .nav-donations,
body:has(#dashboard:target) .nav-dashboard,
body:has(#event:target) .nav-dashboard,
body:has(#notifications:target) .nav-dashboard,
body:not(:has(.screen:target)) .nav-dashboard { color: white; background: var(--color-primary); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 20px; border-right: 0; border-bottom: 1px solid var(--color-line); }
  .sidebar-nav { display: flex; margin-top: 20px; overflow-x: auto; padding-bottom: 4px; }
  .sidebar-link { white-space: nowrap; }
  .sidebar-profile { display: none; }
  .stat-grid, .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .lc-container { width: min(calc(100% - 28px), var(--container)); }
  .site-header { min-height: 72px; }
  .app-content { padding: 24px 16px 48px; }
  .page-header { flex-direction: column; margin-bottom: 24px; }
  .stat-grid, .three-col { grid-template-columns: 1fr; }
  .list-row { align-items: flex-start; flex-direction: column; }
  .video { min-height: 260px; }
  .panel, .panel-lg { padding: 20px; }
}
