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

* { 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(139, 92, 246, 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 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(139, 92, 246, 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(139, 92, 246, 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: #d8def0;
}

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

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

.status.done {
  color: #f2eaff;
  background: rgba(139, 92, 246, 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 rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.28), rgba(139, 92, 246, 0.18));
  color: #f7f3ff;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

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

.btn-primary {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, black));
  border-color: 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,
.attachments {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.content-card { line-height: 1.6; }

.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 {
  line-height: 1.65;
}

.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 {
  margin: 0 0 12px 0;
  color: var(--text);
}

.lesson-content p: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 {
  margin: 10px 0 0;
  padding-left: 18px;
}

.lesson-content li {
  margin: 0 0 12px 0;
}

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

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

/* 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(139, 92, 246, 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(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 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(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 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;
}
