:root {
  --bg: #0E1B2B;
  --card: #12243a;
  --card-2: #172d47;
  --text: #eef3ff;
  --muted: #9facc4;
  --accent: #8B5CF6;
  --accent-rgb: 139, 92, 246;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  --radius-lg: 20px;
  --radius-md: 18px;
}

body.theme-dark-premium {
  --bg: #0E1B2B;
  --card: #12243A;
  --card-2: #172E4A;
  --text: #F8FAFC;
  --muted: #94A3B8;
  --accent: #8B5CF6;
  --accent-rgb: 139, 92, 246;
  --border: rgba(139, 92, 246, 0.22);
}

body.theme-light-clean {
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --card-2: #F1F5F9;
  --text: #111827;
  --muted: #64748B;
  --accent: #2563EB;
  --accent-rgb: 37, 99, 235;
  --border: rgba(15, 23, 42, 0.10);
  --button-bg: #2563EB;
  --button-text: #FFFFFF;
  --button-border: rgba(37, 99, 235, 0.35);
  --badge-bg: rgba(37, 99, 235, 0.12);
  --badge-text: #1D4ED8;
  --module-text: #64748B;
  --card-border-strong: rgba(37, 99, 235, 0.30);
}

body.theme-fitness-power {
  --bg: #031812;
  --card: #041F18;
  --card-2: #062720;
  --text: #F2FFF8;
  --muted: #9AC7B8;
  --accent: #67F08F;
  --accent-rgb: 103, 240, 143;
  --border: rgba(122, 219, 173, 0.22);
}

body.theme-soft-women {
  --bg: #FFF7F2;
  --card: #FFFFFF;
  --card-2: #FFEDE5;
  --text: #3B2520;
  --muted: #9A6B60;
  --accent: #E8799A;
  --accent-rgb: 232, 121, 154;
  --border: rgba(232, 121, 154, 0.22);
  --button-bg: #DB5F87;
  --button-text: #FFFFFF;
  --button-border: rgba(219, 95, 135, 0.35);
  --badge-bg: rgba(219, 95, 135, 0.12);
  --badge-text: #BE426E;
  --module-text: #8A5A50;
  --card-border-strong: rgba(219, 95, 135, 0.28);
}

body.theme-business-black {
  --bg: #080808;
  --card: #141414;
  --card-2: #1F1F1F;
  --text: #F8F5EC;
  --muted: #A8A29E;
  --accent: #D4AF37;
  --accent-rgb: 212, 175, 55;
  --border: rgba(212, 175, 55, 0.24);
}


body.theme-wow-glass {
  --bg: #04111f;
  --card: rgba(8, 20, 34, 0.72);
  --card-2: rgba(10, 34, 56, 0.68);
  --text: #eef7ff;
  --muted: #9bb8d1;
  --accent: #5ff2ff;
  --accent-rgb: 95, 242, 255;
  --border: rgba(255, 255, 255, 0.16);
  --button-bg: linear-gradient(90deg, #5ff2ff, #87fbff);
  --button-text: #03212a;
  --button-border: rgba(255, 255, 255, 0.14);
  --badge-bg: rgba(95, 242, 255, 0.22);
  --badge-text: #e8f8ff;
  --module-text: #b8d5ec;
}

body.theme-wow-glass {
  background:
    radial-gradient(circle at 20% 20%, rgba(95,242,255,0.16), transparent 28%),
    radial-gradient(circle at 80% 30%, rgba(255,184,77,0.14), transparent 24%),
    linear-gradient(135deg, #04111f, #0a2238 60%, #06101a);
  background-attachment: fixed;
}

body.theme-wow-glass .card,
body.theme-wow-glass .lesson-card,
body.theme-wow-glass .lesson-block,
body.theme-wow-glass .video-link-card,
body.theme-wow-glass .attachments,
body.theme-wow-glass .state,
body.theme-wow-glass .debug-panel {
  background: rgba(8,20,34,0.68);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 18px 60px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.theme-wow-glass .btn,
body.theme-wow-glass .btn-primary {
  background: linear-gradient(90deg, #5ff2ff, #87fbff);
  color: #03212a;
  box-shadow: 0 10px 30px rgba(95,242,255,0.28);
}

body.theme-wow-glass .status.done,
body.theme-wow-glass .status.locked {
  background: rgba(95, 242, 255, 0.22);
  color: #e8f8ff;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(900px 500px at 20% -15%, rgba(var(--accent-rgb), 0.16), transparent 55%), var(--bg);
  color: var(--text);
}

body {
  max-width: 460px;
  margin: 0 auto;
  padding: 18px 14px 30px;
}

a { color: inherit; }

.header-brand {
  margin: 6px 2px 14px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.profile-card {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.02));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  border: 1px solid var(--border);
}

.profile-meta h1 { margin: 0; font-size: 18px; }
.profile-meta p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.section-title {
  margin: 22px 4px 10px;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.progress-wrap { padding: 14px; }

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.progress-bar {
  width: 100%;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 85%, white), var(--accent));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: width .35s ease;
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 2px;
}

.lesson-card {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border-strong, color-mix(in srgb, var(--accent) 25%, var(--border)));
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(var(--accent-rgb), 0.08) inset;
  overflow: hidden;
}

.lesson-card.locked {
  opacity: 0.72;
}

.lesson-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(120% 110% at 0% 0%, rgba(var(--accent-rgb), 0.28), transparent 58%),
    linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.01));
  position: relative;
}

.lesson-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.05) 50%, transparent 65%);
}

.lesson-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lesson-card-body {
  padding: 12px 14px 14px;
}

.lesson-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 6px;
}

.lesson-day {
  color: var(--module-text, #d8def0);
}

.lesson-indicators {
  display: inline-flex;
  gap: 6px;
}

.status {
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}

.status.done {
  color: var(--badge-text, #f2eaff);
  background: var(--badge-bg, rgba(var(--accent-rgb), 0.2));
}

.status.locked {
  color: #ffe2e5;
  background: rgba(255, 111, 125, 0.16);
}

.lesson-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.35;
}

.lesson-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.lesson-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn {
  border: 1px solid var(--button-border, rgba(var(--accent-rgb), 0.35));
  border-radius: 12px;
  background: var(--button-bg, rgba(var(--accent-rgb), 0.18));
  color: var(--button-text, var(--text));
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: .65;
}

.btn-primary {
  background: var(--button-bg, linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, black)));
  color: var(--button-text, var(--text));
  border-color: var(--button-border, transparent);
}


.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.state {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150px;
  width: 120px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.09), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer { to { transform: translateX(420px); } }

.lesson-page h1 {
  margin: 14px 0 8px;
  font-size: 24px;
}

.lesson-subtitle {
  margin: 0 0 14px;
  color: var(--muted);
}

.video-wrap {
  margin: 14px 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}


.video-link-card {
  margin: 14px 0;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

.video-link-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.content-card {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  line-height: 1.6;
}

.attachments {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.attachments ul { margin: 10px 0 0; padding-left: 16px; }
.attachments li { margin-bottom: 8px; }

.top-back {
  margin-bottom: 8px;
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.debug-panel {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-height: 34vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(6, 12, 24, 0.88);
  color: #dbe7ff;
  font-size: 11px;
  line-height: 1.35;
  z-index: 9999;
  backdrop-filter: blur(6px);
}
/* =========================
   Lesson content blocks (cards inside lesson)
   Add to the END of styles.css
   ========================= */

.lesson-content,
#lessonContent,
#lessonContent .lesson-block {
  line-height: 1.5;
}

.lesson-content h2 {
  margin: 0 0 12px 0;
  font-size: 20px;
  line-height: 1.25;
}

.lesson-content h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  line-height: 1.35;
  color: #dbe7ff;
}

.lesson-content p,
#lessonContent p,
#lessonContent .lesson-block p,
.lesson-content div,
#lessonContent div,
#lessonContent .lesson-block div,
.lesson-content ul,
#lessonContent ul,
#lessonContent .lesson-block ul,
.lesson-content ol,
#lessonContent ol,
#lessonContent .lesson-block ol {
  margin: 0 0 12px 0;
}

.lesson-content p,
#lessonContent p,
#lessonContent .lesson-block p {
  color: var(--text);
}

.lesson-content p:last-child,
#lessonContent p:last-child,
#lessonContent .lesson-block p:last-child,
.lesson-content div:last-child,
#lessonContent div:last-child,
#lessonContent .lesson-block div:last-child,
.lesson-content ul:last-child,
#lessonContent ul:last-child,
#lessonContent .lesson-block ul:last-child,
.lesson-content ol:last-child,
#lessonContent ol:last-child,
#lessonContent .lesson-block ol:last-child {
  margin-bottom: 0;
}

/* Card-block inside lesson */
.lesson-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin: 0 0 16px 0;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.lesson-block:last-child {
  margin-bottom: 0;
}

.lesson-block img {
  display: block;
  width: 100%;
  border-radius: 14px;
  margin-bottom: 14px;
}

/* Lists inside lesson */
.lesson-content ul,
#lessonContent ul,
#lessonContent .lesson-block ul,
.lesson-content ol,
#lessonContent ol,
#lessonContent .lesson-block ol {
  margin: 10px 0 0;
  padding-left: 18px;
}

.lesson-content li,
#lessonContent li,
#lessonContent .lesson-block li {
  margin: 0 0 8px 0;
}

.lesson-content li:last-child,
#lessonContent li:last-child,
#lessonContent .lesson-block li:last-child {
  margin-bottom: 0;
}

.lesson-content ul ul {
  margin-top: 8px;
  padding-left: 18px;
}

#lessonContent ul ul,
#lessonContent ol ol,
#lessonContent .lesson-block ul ul,
#lessonContent .lesson-block ol ol {
  margin-top: 8px;
  padding-left: 18px;
}

.lesson-content p:empty,
#lessonContent p:empty,
#lessonContent .lesson-block p:empty {
  margin: 0;
  min-height: 0;
}

/* Links inside lesson */
.lesson-content a {
  color: color-mix(in srgb, var(--accent) 85%, white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lesson-content a:hover {
  opacity: 0.9;
}

/* Divider */
.lesson-content hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  margin: 14px 0;
}
/* Accent inner blocks inside lesson */

.lesson-note {
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  margin: 14px 0;
  background: rgba(var(--accent-rgb), 0.08);
  border-radius: 12px;
}

.lesson-warning {
  border-left: 4px solid #ff6f7d;
  padding: 12px 14px;
  margin: 14px 0;
  background: rgba(255, 111, 125, 0.08);
  border-radius: 12px;
}

.lesson-soft {
  border-left: 4px solid rgba(255,255,255,0.2);
  padding: 12px 14px;
  margin: 14px 0;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
}
.attach-item { margin: 8px 0; }

.attach-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
}

.attach-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tag {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.12);
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.04em;
}
/* ===== Materials: force-style (Telegram WebApp) ===== */
.lesson-attachments #attachmentsList{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.lesson-attachments #attachmentsList li{
  margin: 0;
  padding: 0;
}

.lesson-attachments #attachmentsList a.attach-link{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 12px;
  border-radius: 14px;

  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);

  text-decoration: none;
  -webkit-tap-highlight-color: transparent;

  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.lesson-attachments #attachmentsList a.attach-link:active{
  transform: scale(0.99);
}

@media (hover:hover){
  .lesson-attachments #attachmentsList a.attach-link:hover{
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
  }
}

.lesson-attachments #attachmentsList .attach-name{
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 10px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-attachments #attachmentsList .attach-name::before{
  content: "📎";
  width: 28px;
  height: 28px;
  border-radius: 10px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  flex: 0 0 auto;

  font-size: 14px;
}

.lesson-attachments #attachmentsList .file-tag{
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;

  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.10);
  color: rgba(255,255,255,0.92);

  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.lesson-media {
  width: 100%;
  margin: 14px 0 18px;
}

}
.lesson-media {
  width: 100%;
  margin: 14px 0 18px;
}

.lesson-media__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.lesson-media__content {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
}

.lesson-media iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Final override: compact Quill HTML spacing in lesson WebApp */
#lessonContent .lesson-block {
  font-size: clamp(16px, 3.9vw, 18px);
  line-height: 1.5;
}

#lessonContent .lesson-block p,
#lessonContent .lesson-block div {
  margin: 0 0 8px;
  line-height: 1.5;
}

#lessonContent .lesson-block p:empty,
#lessonContent .lesson-block div:empty {
  margin: 0;
  min-height: 0;
}

#lessonContent .lesson-block ul,
#lessonContent .lesson-block ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

#lessonContent .lesson-block li {
  margin: 0 0 4px;
  line-height: 1.5;
}

#lessonContent .lesson-block li:last-child,
#lessonContent .lesson-block p:last-child,
#lessonContent .lesson-block div:last-child,
#lessonContent .lesson-block ul:last-child,
#lessonContent .lesson-block ol:last-child {
  margin-bottom: 0;
}

.rich-text-content {
  font-size: 16px !important;
  line-height: 1.5 !important;
  color: var(--text) !important;
}

.rich-text-content p,
.rich-text-content div {
  margin: 0 0 1px 0 !important;
  padding: 0 !important;
  line-height: 1.5 !important;
}

.rich-text-content p:empty,
.rich-text-content div:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}

.rich-text-content br {
  line-height: 1.2 !important;
}

.rich-text-content ul,
.rich-text-content ol {
  margin: 8px 0 8px 0 !important;
  padding-left: 20px !important;
}

.rich-text-content li {
  margin: 0 0 6px 0 !important;
  line-height: 1.5 !important;
}

.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3 {
  margin: 14px 0 8px 0 !important;
  line-height: 1.25 !important;
}

.rich-text-content h1:first-child,
.rich-text-content h2:first-child,
.rich-text-content h3:first-child,
.rich-text-content p:first-child {
  margin-top: 0 !important;
}

.lesson-inline-image {
  width: 100%;
  margin: 14px 0 18px;
}

.lesson-inline-image img {
  width: 100%;
  max-width: 100%;
  display: block;
  border-radius: 16px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.03);
}

.lesson-inline-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
