:root {
  --bg: #f8f4ed;
  --surface: rgba(255, 251, 246, 0.92);
  --surface-strong: #fffaf4;
  --text: #2d241d;
  --muted: #786b60;
  --line: rgba(189, 166, 145, 0.18);
  --shadow: 0 12px 40px rgba(83, 58, 37, 0.08);
  --peach: #efd6c4;
  --cream: #f4edd8;
  --yellow: #f3e39d;
  --radius-xl: 32px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --max: 1180px;
}

* { box-sizing: border-box; }

html {
  background:
    radial-gradient(circle at top left, rgba(244, 237, 216, 0.95), transparent 34%),
    radial-gradient(circle at top right, rgba(243, 227, 157, 0.22), transparent 26%),
    linear-gradient(180deg, #fbf7f0 0%, #f7f2ea 100%);
}

body {
  margin: 0;
  color: var(--text);
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Inter, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }

.page {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 34px 0 88px;
}

.home-page {
  padding-top: 28px;
}

.hero-shell,
.lessons-section,
.video-panel,
.content-card,
.materials,
.auth-card,
.form-section,
.admin-row {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-shell {
  border-radius: var(--radius-xl);
  padding: 36px;
  margin-bottom: 24px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(243, 227, 157, 0.46), rgba(244, 237, 216, 0.92));
  color: #7b6956;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 650;
}

h3 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 650;
}

.hero-text {
  max-width: 640px;
  margin-bottom: 18px;
  color: #4f443a;
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.5;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(239, 214, 196, 0.92), rgba(244, 237, 216, 0.96));
  border: 1px solid rgba(183, 154, 132, 0.22);
  text-decoration: none;
  font-weight: 600;
}

.hero-note {
  color: var(--muted);
  font-size: 15px;
}

.lessons-section {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head.compact {
  margin-bottom: 8px;
}

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

.lesson-card {
  min-width: 0;
}

.card-main {
  display: block;
  padding: 14px;
  border-radius: 28px;
  background: transparent;
  text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.card-main:hover,
.card-main:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 252, 247, 0.94);
  box-shadow: 0 10px 28px rgba(85, 61, 41, 0.06);
  outline: none;
}

.preview {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(244, 237, 216, 0.7), rgba(239, 214, 196, 0.55));
}

.preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease;
}

.card-main:hover .preview img,
.card-main:focus-visible .preview img {
  transform: scale(1.02);
}

.preview-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.card-copy {
  padding: 16px 4px 4px;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.lesson-number {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.done-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(243, 227, 157, 0.5);
  color: #705b2c;
  font-size: 13px;
  font-weight: 600;
}

.empty-panel {
  padding: 32px 24px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.lesson-page {
  max-width: 980px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--muted);
  text-decoration: none;
}

.lesson-head {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.lesson-head h1 {
  font-size: clamp(36px, 6vw, 68px);
  margin-bottom: 0;
}

.video-panel,
.content-card,
.materials {
  border-radius: var(--radius-xl);
}

.video-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.lesson-video,
.video-missing {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #111;
  border-radius: 24px;
}

.video-missing {
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.74);
}

.lesson-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.complete-form {
  margin: 0;
}

.complete-button,
.text-size-button,
.button-primary,
.button-quiet,
.admin-actions button,
.admin-actions a,
.editor-block-head button {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  text-decoration: none;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease;
}

.complete-button:hover,
.text-size-button:hover,
.button-primary:hover,
.button-quiet:hover,
.admin-actions button:hover,
.admin-actions a:hover,
.editor-block-head button:hover {
  transform: translateY(-1px);
}

.complete-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244, 237, 216, 0.52));
}

.complete-button.is-done {
  background: linear-gradient(180deg, rgba(243, 227, 157, 0.34), rgba(244, 237, 216, 0.8));
}

.check {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
}

.reading-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 237, 216, 0.76), rgba(239, 214, 196, 0.36));
  border: 1px solid var(--line);
}

.reading-tools-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.reading-tools-buttons {
  display: flex;
  gap: 8px;
}

.text-size-button {
  min-width: 56px;
  padding: 8px 12px;
}

.text-size-button.is-active {
  background: rgba(239, 214, 196, 0.8);
  border-color: rgba(183, 154, 132, 0.24);
}

.content-card {
  padding: 26px;
  margin-bottom: 18px;
}

.lesson-content {
  --lesson-font-scale: 0;
  width: min(100%, 760px);
}

.description-text {
  margin: 0 0 28px;
  white-space: pre-line;
  font-size: calc(20px + (var(--lesson-font-scale) * 2px));
  line-height: 1.82;
  color: #342b24;
}

.description-image {
  margin: 0 0 30px;
}

.description-image img {
  width: 100%;
  display: block;
  border-radius: 22px;
}

.description-image figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: calc(14px + (var(--lesson-font-scale) * 1px));
}

.materials {
  padding: 20px;
}

.material-list {
  display: grid;
  gap: 10px;
}

.material-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  text-decoration: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 400px);
  border-radius: var(--radius-xl);
  padding: 28px;
}

.auth-card h1 {
  font-size: 32px;
  margin-bottom: 22px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

label > span {
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.86);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(183, 154, 132, 0.28);
  box-shadow: 0 0 0 4px rgba(239, 214, 196, 0.22);
}

input[type="file"] {
  width: 100%;
}

small {
  color: var(--muted);
  line-height: 1.5;
}

.button-primary {
  background: linear-gradient(180deg, rgba(239, 214, 196, 0.92), rgba(244, 237, 216, 0.98));
  font-weight: 600;
}

.button-quiet {
  background: rgba(255,255,255,0.58);
}

.form-error,
.danger-link {
  color: #92554a !important;
}

.admin-page {
  max-width: 1020px;
}

.admin-page h1 {
  font-size: clamp(40px, 6vw, 62px);
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 34px;
}

.admin-top-actions,
.admin-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-top-actions form,
.admin-actions form {
  margin: 0;
}

.admin-list {
  display: grid;
  gap: 14px;
}

.admin-row {
  padding: 16px 18px;
  border-radius: 24px;
}

.admin-row-main {
  display: flex;
  gap: 14px;
  align-items: baseline;
}

.form-page {
  max-width: 880px;
}

.form-page > h1 {
  margin-bottom: 28px;
}

.lesson-form {
  display: grid;
  gap: 22px;
}

.form-section {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.form-section h2 {
  font-size: 20px;
  font-weight: 650;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title h2 {
  margin-bottom: 0;
}

.editor-block {
  padding: 16px 0;
  border-top: 1px solid rgba(189, 166, 145, 0.16);
}

.editor-block:first-child {
  border-top: 0;
}

.editor-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.editor-block-head > span {
  color: var(--muted);
  font-size: 13px;
}

.image-block-body {
  display: grid;
  gap: 12px;
}

.admin-thumb {
  width: min(100%, 260px);
  max-height: 180px;
  object-fit: cover;
  border-radius: 16px;
}

.existing-materials {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.material-keep {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
}

.material-keep > span {
  color: var(--text);
}

.form-submit {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1024px) {
  .page {
    width: min(calc(100% - 28px), var(--max));
    padding-top: 24px;
  }

  .hero-shell {
    padding: 28px;
  }

  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .description-text {
    font-size: calc(21px + (var(--lesson-font-scale) * 2px));
  }
}

@media (max-width: 820px) {
  .page {
    width: min(calc(100% - 20px), var(--max));
    padding-bottom: 68px;
  }

  .hero-shell,
  .lessons-section,
  .video-panel,
  .content-card,
  .materials,
  .form-section,
  .auth-card,
  .admin-row {
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(42px, 12vw, 72px);
  }

  h3 {
    font-size: 24px;
  }

  .lesson-toolbar,
  .admin-top,
  .admin-row,
  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .reading-tools {
    width: 100%;
    justify-content: space-between;
  }

  .reading-tools-buttons {
    width: 100%;
    justify-content: flex-end;
  }

  .text-size-button {
    flex: 1 1 0;
    max-width: 88px;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(calc(100% - 16px), var(--max));
  }

  .hero-shell,
  .lessons-section,
  .video-panel,
  .content-card,
  .materials,
  .form-section,
  .auth-card,
  .admin-row {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero-shell {
    padding-top: 22px;
    padding-bottom: 22px;
  }

  .hero-text {
    font-size: 18px;
  }

  .hero-meta {
    align-items: flex-start;
  }

  .pill-link {
    width: 100%;
  }

  .description-text {
    font-size: calc(19px + (var(--lesson-font-scale) * 2px));
  }
}

