:root {
  --bg: #f7f5ef;
  --paper: #ffffff;
  --panel: #fbfaf7;
  --ink: #202833;
  --muted: #667085;
  --line: #ddd8ca;
  --teal: #0f766e;
  --teal-soft: #ddf3ee;
  --indigo: #3730a3;
  --indigo-soft: #e8e7ff;
  --amber: #b7791f;
  --amber-soft: #fff1cf;
  --rose: #be123c;
  --green: #15803d;
  --shadow: 0 16px 34px rgba(32, 40, 51, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
  outline: 0;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus,
.visual-editor:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

main {
  padding-bottom: 48px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 239, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.site-header nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-header nav a,
.user-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 750;
}

.site-header nav a.active,
.site-header nav a:hover,
.user-pill:hover {
  background: var(--teal-soft);
  color: #0f4f49;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.container,
.container-wide {
  width: min(1160px, calc(100% - 36px));
  margin: 0 auto;
}

.container-wide {
  width: min(1360px, calc(100% - 28px));
}

.narrow {
  width: min(760px, calc(100% - 36px));
}

.btn {
  border: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 13px;
  font-weight: 850;
  cursor: pointer;
}

.btn.primary {
  background: var(--teal);
  color: #fff;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.btn.danger {
  background: #fff1f2;
  color: var(--rose);
  border: 1px solid #fecdd3;
}

.btn.big {
  min-height: 46px;
  padding: 12px 18px;
}

.btn.tiny {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
}

.btn.full {
  width: 100%;
}

.hero {
  min-height: 460px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  align-items: center;
  padding: 44px 0 28px;
}

.eyebrow {
  color: var(--teal);
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero h1,
.learn-top h1,
.reader-article h1,
.pricing h1,
.auth-card h1,
.admin-main h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  margin: 0 0 14px;
  letter-spacing: 0;
}

.hero p,
.learn-top p,
.section-head p,
.pricing-card p,
.lead {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-card,
.panel,
.pricing-card,
.auth-card,
.metric-card,
.table-card,
.category-card,
.article-card,
.study-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
}

.hero-card strong,
.price {
  display: block;
  font-size: 42px;
  line-height: 1;
  margin-bottom: 8px;
}

.hero-card span {
  color: var(--muted);
}

.hero-card ul,
.feature-list {
  margin: 18px 0 0;
  padding-left: 20px;
  line-height: 1.75;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 34px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 28px;
}

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

.category-card {
  padding: 18px;
  min-height: 154px;
}

.category-card b {
  display: block;
  font-size: 18px;
}

.category-card span,
.article-card div,
.muted,
small {
  color: var(--muted);
}

.category-card p {
  color: var(--muted);
  line-height: 1.55;
}

.article-card {
  display: grid;
  gap: 10px;
  min-height: 184px;
  padding: 18px;
  position: relative;
}

.article-card h3 {
  font-size: 19px;
  line-height: 1.2;
  margin: 18px 0 0;
}

.article-card p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.article-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  align-self: end;
}

.badge {
  position: absolute;
  top: 14px;
  right: 14px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.article-card.read .badge {
  background: #dcfce7;
  color: var(--green);
}

.flash,
.notice {
  width: min(1060px, calc(100% - 36px));
  margin: 14px auto;
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.flash.success,
.notice.success {
  border-color: #86efac;
  background: #ecfdf3;
  color: #14532d;
}

.flash.error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #881337;
}

.auth-wrap,
.pricing {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 36px 0;
}

.pricing {
  align-content: start;
  place-items: stretch;
}

.pricing-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.auth-card,
.pricing-card {
  width: min(520px, 100%);
  padding: 26px;
}

.pricing-card {
  width: 100%;
}

label {
  display: grid;
  gap: 7px;
  color: #4a4438;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 14px;
}

.payment-box {
  border: 1px dashed #c6bca5;
  border-radius: var(--radius);
  padding: 16px;
  background: #fffdf8;
  margin-top: 18px;
}

.payment-box code,
pre {
  background: #17231f;
  color: #e5f6f1;
  border-radius: var(--radius);
}

.payment-box code {
  padding: 4px 8px;
}

.paste-upload-zone {
  display: grid;
  gap: 8px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
  cursor: pointer;
}

.paste-upload-zone.dragging,
.paste-upload-zone:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.paste-upload-zone span {
  color: var(--muted);
  font-size: 13px;
}

.paste-upload-zone input[type="file"] {
  display: none;
}

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.upload-preview-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

.upload-preview-item img,
.upload-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.upload-preview-item span {
  display: block;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-thumb {
  width: 92px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.learn-page {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 0;
}

.learn-sidebar,
.reader-nav,
.admin-nav {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.learn-sidebar h3,
.reader-nav h3 {
  margin: 6px 8px 12px;
}

.learn-sidebar a,
.reader-nav a,
.admin-nav a {
  display: grid;
  gap: 4px;
  border-radius: var(--radius);
  padding: 11px 10px;
  margin-bottom: 4px;
  color: var(--ink);
}

.learn-sidebar a.active,
.reader-nav a.active,
.admin-nav a.active,
.learn-sidebar a:hover,
.reader-nav a:hover,
.admin-nav a:hover {
  background: var(--teal-soft);
  color: #0f4f49;
}

.learn-sidebar span,
.reader-nav span {
  color: var(--muted);
  font-size: 12px;
}

.learn-main {
  display: grid;
  gap: 14px;
}

.learn-wow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: stretch;
  background: #14221f;
  color: #f4fbf8;
  border: 1px solid #203a35;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  overflow: hidden;
  position: relative;
}

.learn-wow::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -260px;
  top: -240px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 50%;
}

.learn-wow h2 {
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1;
  margin: 0 0 12px;
  max-width: 760px;
}

.learn-wow p {
  color: #bdd2cc;
  font-size: 16px;
  line-height: 1.62;
  margin: 0;
  max-width: 740px;
}

.learn-wow .eyebrow {
  color: #5eead4;
}

.quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.quick-pills span {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8f7f3;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 800;
}

.unlock-card {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  padding: 18px;
}

.unlock-card b {
  display: block;
  font-size: 28px;
  line-height: 1.05;
}

.unlock-card span {
  color: #bdd2cc;
  line-height: 1.45;
}

.unlock-card.done {
  background: rgba(134, 239, 172, 0.12);
}

.learn-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.learn-top.compact {
  padding: 18px;
}

.learn-top h1 {
  font-size: clamp(30px, 4vw, 46px);
}

.stat-row,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 96px);
  gap: 8px;
}

.stat-row div,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fffdf8;
}

.stat-row b,
.metric-card b {
  display: block;
  font-size: 26px;
}

.stat-row span,
.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.filter-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

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

.lesson-list {
  display: grid;
  gap: 6px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 12px;
  box-shadow: 0 8px 18px rgba(32, 40, 51, 0.04);
}

.lesson-row:hover {
  border-color: #9dd8cf;
  background: #fffdf8;
}

.lesson-row.read {
  background: #f2fff6;
  border-color: #bbf7d0;
}

.lesson-row.locked {
  background: #fcfaf5;
}

.lesson-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: #0f4f49;
  font-size: 16px;
  font-weight: 900;
}

.lesson-row.locked .lesson-icon {
  background: #f2eee4;
  color: #7a6b52;
}

.lesson-row.read .lesson-icon {
  background: var(--green);
  color: #fff;
}

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

.lesson-main b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.25;
}

.lesson-main small {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 430px;
}

.lesson-meta span {
  border-radius: 999px;
  background: #f2eee4;
  color: #5c5243;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.lesson-meta .lesson-status {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.lesson-meta .lesson-lock {
  background: var(--amber-soft);
  color: var(--amber);
}

.lesson-row.read .lesson-meta .lesson-status {
  background: #dcfce7;
  color: var(--green);
}

.article-card.locked {
  background: #fcfaf5;
}

.article-card.locked .badge {
  background: var(--amber-soft);
  color: var(--amber);
}

.empty {
  padding: 18px;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.pager div {
  display: flex;
  gap: 8px;
}

.reader {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 22px 0;
}

.reader-article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-2);
}

.breadcrumb [aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}

.breadcrumb-separator {
  color: var(--muted);
}

.reader-article h1 {
  font-size: clamp(34px, 4vw, 52px);
}

.video-frame {
  aspect-ratio: 16 / 9;
  background: #17231f;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 22px 0;
}

.video-frame iframe,
.video-frame video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.content-body {
  font-size: 17px;
  line-height: 1.78;
}

.content-body h2,
.content-body h3 {
  margin-top: 34px;
}

.content-body img {
  max-width: 100%;
  border-radius: var(--radius);
}

.study-card {
  position: sticky;
  top: 86px;
  align-self: start;
  padding: 18px;
}

.study-card ul {
  padding-left: 20px;
  line-height: 1.7;
}

.read-status {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.45;
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 0;
}

.admin-main {
  display: grid;
  gap: 16px;
}

.admin-main h1 {
  font-size: 40px;
}

.admin-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  padding: 22px;
}

.admin-form {
  display: grid;
  gap: 10px;
}

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

.table-card {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #fffdf8;
  color: #6f5f46;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inline {
  display: inline-flex;
  margin-left: 6px;
}

.editor-tabs,
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-tabs button,
.editor-toolbar button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  min-height: 34px;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 800;
}

.editor-tabs button.active {
  background: var(--teal-soft);
  color: #0f4f49;
  border-color: #9dd8cf;
}

.visual-editor,
.html-editor {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 18px;
  line-height: 1.75;
  outline: 0;
}

.html-editor {
  display: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.article-editor-form.html-mode .visual-editor,
.article-editor-form.html-mode .editor-toolbar {
  display: none;
}

.article-editor-form.html-mode .html-editor {
  display: block;
}

pre {
  overflow: auto;
  padding: 16px;
  line-height: 1.55;
}

@media (max-width: 1050px) {
  .hero,
  .learn-page,
  .learn-wow,
  .reader,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .learn-sidebar,
  .reader-nav,
  .study-card,
  .admin-nav {
    position: static;
    max-height: none;
  }

  .category-grid,
  .article-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .site-header nav,
  .header-actions {
    overflow-x: auto;
  }

  .container,
  .container-wide {
    width: min(100% - 20px, 100%);
  }

  .hero {
    min-height: auto;
    padding-top: 24px;
  }

  .hero h1,
  .reader-article h1,
  .pricing h1,
  .auth-card h1,
  .admin-main h1 {
    font-size: 34px;
  }

  .category-grid,
  .article-grid,
  .metric-grid,
  .pricing-options,
  .form-grid,
  .filter-line,
  .learn-top,
  .lesson-row,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .lesson-meta {
    justify-content: flex-start;
    max-width: none;
  }

  .reader-article {
    padding: 20px;
  }

  .section-head,
  .admin-title,
  .pager {
    align-items: stretch;
    flex-direction: column;
  }
}
