:root {
  --primary: #1e4d3a;
  --accent: #c4a35a;
  --bg: #f3efe6;
  --bg-2: #e8efe6;
  --text: #1a2a22;
  --muted: #5f6f66;
  --card: rgba(255, 252, 246, 0.92);
  --line: rgba(30, 77, 58, 0.12);
  --shadow: 0 18px 50px rgba(26, 42, 34, 0.08);
  --radius: 18px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Literata", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196, 163, 90, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(30, 77, 58, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.main { padding: 28px 0 64px; min-height: 70vh; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(243, 239, 230, 0.82);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 0;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-title {
  height: 52px; width: auto; object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(30, 77, 58, 0.12));
  transition: transform 0.35s ease;
}
.brand:hover .brand-title { transform: translateY(-1px) scale(1.02); text-decoration: none; }
.nav-desktop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.nav-desktop a {
  color: var(--text); font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: color 0.2s;
}
.nav-desktop a:hover, .nav-desktop a.active { color: var(--primary); }
.nav-admin { color: #b45309 !important; }
.nav-cabinet {
  border: 2px solid var(--primary); padding: 6px 14px; border-radius: 999px;
  color: var(--primary) !important;
}
.nav-user { display: inline-flex; align-items: center; gap: 8px; }
.header-avatar, .avatar-placeholder {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--accent); flex-shrink: 0;
}
.header-avatar { object-fit: cover; display: block; }
.avatar-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: #dce8e0; color: var(--primary); font-size: 0.65rem; font-weight: 800;
}
.menu-toggle {
  display: none; background: none; border: 0; font-size: 1.7rem; cursor: pointer; color: var(--text);
}

/* Sidebar */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 90;
  opacity: 0; visibility: hidden; transition: 0.25s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }
.sidebar {
  position: fixed; top: 0; right: -320px; width: 300px; height: 100%;
  background: #fffaf2; z-index: 100; padding: 20px; display: flex; flex-direction: column; gap: 12px;
  transition: right 0.3s ease; box-shadow: -8px 0 30px rgba(0,0,0,0.12); overflow-y: auto;
}
.sidebar.active { right: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; }
.close-btn { background: none; border: 0; font-size: 2rem; cursor: pointer; color: #888; }
.sidebar a, .sidebar-link {
  text-decoration: none; color: var(--text); font-weight: 600;
  padding-bottom: 10px; border-bottom: 1px solid #eee; background: none; border-left: 0; border-right: 0; border-top: 0;
  text-align: left; font: inherit; cursor: pointer;
}
.sidebar-link.danger, .danger { color: #dc2626; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #e5e7eb; font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff; border: 0; border-radius: 12px;
  padding: 10px 18px; font-weight: 700; font-family: inherit; cursor: pointer;
  text-decoration: none; transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 8px 20px rgba(30, 77, 58, 0.22);
}
.btn:hover { opacity: 0.95; transform: translateY(-1px); text-decoration: none; color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; border-radius: 999px; }
.btn-sm { padding: 6px 12px; font-size: 0.9rem; box-shadow: none; }
.btn-block { width: 100%; }
.btn-outline {
  background: transparent; color: var(--primary); border: 2px solid var(--primary); box-shadow: none;
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: #b91c1c; box-shadow: none; }
.btn-success { background: #2f7d57; }
.btn-danger { background: #dc2626; box-shadow: none; }
.btn-muted { background: #6b7280; box-shadow: none; }
.btn-light { background: #fff; color: var(--primary); }

/* Cards / forms */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-top: 16px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.92rem; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid #d5ddd7; border-radius: 10px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(30, 77, 58, 0.25); border-color: var(--primary);
}
.inline-form { display: inline; margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.ok { color: #047857; font-weight: 700; }
.bad { color: #dc2626; font-weight: 700; }
.hint { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 48px; }
.h2 { font-size: 1.4rem; margin: 28px 0 16px; }

.alert {
  padding: 14px 16px; border-radius: 12px; margin: 12px 0 20px; font-weight: 600;
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* Hero */
.hero {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(40px, 8vw, 88px) 24px;
  border-radius: 28px; margin-bottom: 56px;
  background:
    linear-gradient(145deg, rgba(255,252,246,0.95), rgba(220,232,224,0.9)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231e4d3a' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: fadeUp 0.7s ease both;
}
.hero-glow {
  position: absolute; inset: auto auto -40% -20%; width: 60%; height: 70%;
  background: radial-gradient(circle, rgba(196,163,90,0.25), transparent 70%);
  pointer-events: none; animation: drift 8s ease-in-out infinite alternate;
}
.hero-brand {
  width: min(420px, 80%); height: auto; margin: 0 auto 24px; display: block;
  animation: fadeUp 0.8s 0.1s ease both;
}
.hero-title {
  font-family: var(--display); font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15; margin: 0 0 18px; color: var(--primary);
  animation: fadeUp 0.8s 0.18s ease both;
}
.hero-sub {
  max-width: 720px; margin: 0 auto 28px; color: var(--muted); font-size: 1.1rem;
  animation: fadeUp 0.8s 0.26s ease both;
}
.hero-actions {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  animation: fadeUp 0.8s 0.34s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(40px, -20px); }
}

.section { margin-bottom: 64px; }
.section-title {
  text-align: center; font-family: var(--display); font-size: clamp(1.7rem, 3vw, 2.3rem);
  margin: 0 0 28px; color: var(--text);
}
.feature-grid, .reviews, .course-grid, .teacher-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px;
}
.feature, .review, .course-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 22px; box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feature:hover, .course-card:hover { transform: translateY(-4px); box-shadow: 0 22px 40px rgba(26,42,34,0.12); }
.feature-mark {
  display: inline-flex; width: 42px; height: 42px; border-radius: 12px;
  align-items: center; justify-content: center; font-weight: 800;
  background: rgba(30,77,58,0.1); color: var(--primary); margin-bottom: 12px;
}
.panel { background: var(--card); border-radius: 24px; padding: 40px 28px; border: 1px solid var(--line); }
.steps { list-style: none; padding: 0; margin: 0 auto; max-width: 760px; display: flex; flex-direction: column; gap: 22px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.step-num-accent { background: var(--accent); color: #1a2a22; }
.review p { font-style: italic; color: #3f4f46; }
.review cite { font-style: normal; font-weight: 700; }

.cta-block {
  text-align: center; padding: 56px 24px; border-radius: 28px; color: #fff;
  background: linear-gradient(135deg, #163c2e, #1e4d3a 50%, #2a6350);
  box-shadow: var(--shadow);
}
.cta-block h2 { font-family: var(--display); font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 12px; }
.cta-block p { opacity: 0.9; margin: 0 0 24px; }

.page-head { text-align: center; margin-bottom: 28px; }
.page-head.row-between, .row-between {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; text-align: left;
}
.page-head h1 { font-family: var(--display); margin: 0 0 8px; }
.status-pill {
  background: #dcfce7; color: #166534; padding: 6px 12px; border-radius: 999px;
  font-weight: 600; font-size: 0.88rem;
}
.badge {
  display: inline-block; background: rgba(30,77,58,0.08); color: var(--primary);
  padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; text-transform: uppercase;
}
.course-card { display: flex; flex-direction: column; }
.course-card-foot { margin-top: auto; padding-top: 18px; }
.price { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
.price-lg { font-size: 2rem; font-weight: 800; color: var(--primary); }

.progress-wrap { margin: 14px 0 18px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 6px; }
.progress-bar { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #eee; vertical-align: top; }
.table thead { background: rgba(30,77,58,0.05); }
.doc-link {
  display: inline-block; background: rgba(196,163,90,0.2); color: #7a5a1e;
  padding: 6px 12px; border-radius: 8px; font-weight: 600; text-decoration: none;
}

.auth-wrap { display: flex; justify-content: center; padding: 20px 0; }
.auth-card { width: min(420px, 100%); margin-top: 0; }
.auth-logo { display: block; height: 56px; width: auto; margin: 0 auto 12px; }
.auth-card h2 { text-align: center; margin-top: 0; }

.study-wrap { max-width: 800px; margin: 0 auto; }
.back-link { color: var(--muted); font-weight: 600; text-decoration: none; }
.lesson-card h2 { color: var(--primary); margin-top: 0; }
.lesson-content { white-space: pre-wrap; line-height: 1.8; font-size: 1.05rem; }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 12px; margin-bottom: 16px; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.test-cta { text-align: center; border: 2px dashed #cbd5e1; background: #f8faf8; }
.question-block {
  border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; background: #f9faf8; margin: 0;
}
.question-block legend { font-weight: 700; padding: 0 6px; }
.radio-row { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 8px 0; cursor: pointer; }
.radio-row input { width: auto; }
.result-card, .error-card, .checkout-card { max-width: 520px; margin: 0 auto; text-align: center; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--accent); }
.checkout-summary { background: #f5f7f4; padding: 14px; border-radius: 12px; text-align: left; margin-bottom: 16px; }
.promo-row { display: flex; gap: 8px; margin-bottom: 12px; }
.checkout-total { display: flex; justify-content: space-between; font-size: 1.15rem; font-weight: 700; border-top: 2px solid #eee; padding-top: 14px; margin: 14px 0; }

.profile-avatar-row { display: flex; align-items: center; gap: 18px; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: #e5e7eb;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--primary); flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-align: center;
  box-shadow: var(--shadow);
}
.stat-n { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-l { color: var(--muted); font-size: 0.9rem; }
.radio-edit { display: flex; align-items: center; gap: 8px; }
.radio-edit input[type="radio"] { width: auto; }

.site-footer {
  background: rgba(255,252,246,0.85); border-top: 1px solid var(--line);
  padding: 36px 0; text-align: center; color: var(--muted);
}
.footer-logo { height: 44px; width: auto; margin-bottom: 10px; }

@media (max-width: 900px) {
  .nav-desktop { display: none; }
  .menu-toggle { display: block; }
  .brand-title { height: 44px; }
}
