:root {
  color-scheme: dark;
  --bg: #050505;
  --ink: #f6f2ea;
  --muted: #b7b0a7;
  --line: #302b27;
  --accent: #f59a2f;
  --accent-ink: #111111;
  --soft: #171615;
  --soft-2: #22201e;
  --warn: #ffd28a;
  --blue: #7295ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -80px, rgba(245, 154, 47, 0.22), transparent 250px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: 24px;
  background: rgba(5, 5, 5, 0.88);
  backdrop-filter: blur(8px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-overlay.hidden {
  display: grid;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-overlay p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.loading-emblem {
  width: 74px;
  height: 74px;
  perspective: 360px;
}

.loading-emblem img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  object-fit: cover;
  animation: coin-fall-spin 1.25s ease-in-out infinite;
  box-shadow: 0 12px 28px rgba(245, 154, 47, 0.18);
}

@keyframes coin-fall-spin {
  0% {
    transform: rotateX(62deg) rotateZ(0deg) scale(0.94);
  }

  48% {
    transform: rotateX(72deg) rotateZ(182deg) scale(1);
  }

  100% {
    transform: rotateX(62deg) rotateZ(360deg) scale(0.94);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-emblem img {
    animation: none;
  }
}

#app {
  min-height: 100vh;
  padding: 18px 16px 28px;
}

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

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 13px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.leader-hero {
  display: grid;
  grid-template-columns: 108px 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(245, 154, 47, 0.18), rgba(255, 255, 255, 0.04));
}

.leader-hero img {
  width: 108px;
  height: 122px;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px;
  background: #0c0b0a;
}

.leader-hero h2 {
  margin-bottom: 6px;
  color: var(--accent);
}

.leader-hero p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.quick-links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 22px;
}

.panel,
.status,
.lesson-panel {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.status {
  color: var(--muted);
}

.hidden {
  display: none;
}

.profile-panel {
  padding: 10px;
}

.profile-auth h2 {
  margin-bottom: 6px;
}

.profile-auth p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.email-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.email-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0e0d0c;
  color: var(--ink);
}

.code-hint {
  margin: 8px 0 0;
  color: var(--warn);
  font-size: 13px;
}

.profile-toggle {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 1fr 22px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--soft-2);
  color: var(--ink);
  text-align: left;
}

.profile-toggle span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-arrow {
  color: var(--accent);
  text-align: center;
}

.profile-menu {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.profile-menu p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.email-form button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
}

.email-form button,
.primary-button {
  background: var(--accent);
  color: var(--accent-ink);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--soft-2);
  color: var(--ink);
}

.primary-button,
.secondary-button {
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

.courses {
  display: grid;
  gap: 12px;
}

.course-card {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.course-card.is-locked {
  background: rgba(23, 22, 21, 0.38);
  border-color: rgba(48, 43, 39, 0.68);
}

.course-card.is-locked .course-head,
.course-card.is-locked .course-actions,
.course-card.is-locked .lessons,
.course-card.is-locked .course-mark {
  opacity: 0.58;
}

.course-card.is-locked .primary-button,
.course-card.is-locked .secondary-button {
  opacity: 0.88;
}

.course-head {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  padding: 14px;
}

.course-mark {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #f8b955, #f08225);
  color: #15110d;
  font-weight: 700;
}

.course-icon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.course-card[data-cover="flowers"] .course-mark {
  background: linear-gradient(135deg, #b995ff, #f8b955);
  color: #15110d;
}

.course-card[data-cover="curls"] .course-mark {
  background: linear-gradient(135deg, #7295ff, #f8b955);
  color: #15110d;
}

.course-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.course-title-row h3 {
  margin-bottom: 5px;
  font-size: 18px;
  line-height: 1.2;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  background: rgba(114, 149, 255, 0.18);
  color: #cbd6ff;
}

.badge.locked {
  background: rgba(245, 154, 47, 0.17);
  color: var(--warn);
}

.course-description,
.lesson-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.course-price {
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
}

.locked-note {
  margin-top: 9px;
  color: #d8cbbd;
  font-size: 13px;
  line-height: 1.4;
}

.course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.lessons {
  border-top: 1px solid var(--line);
}

.lesson-row {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  color: var(--ink);
}

.lesson-row:disabled {
  color: var(--muted);
}

.lesson-row.empty-lessons {
  color: var(--muted);
}

.lesson-row:last-child {
  border-bottom: 0;
}

.lesson-check {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.lesson-row.completed .lesson-check {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.locked-lessons {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
}

.lock-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.player-shell {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  margin-bottom: 12px;
}

.player-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.empty-video {
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

@media (max-width: 430px) {
  #app {
    padding: 14px 12px 22px;
  }

  .email-form,
  .course-head {
    grid-template-columns: 1fr;
  }

  .course-mark {
    width: 48px;
    height: 48px;
  }

  .course-title-row {
    display: block;
  }

  .badge {
    display: inline-block;
    margin-bottom: 8px;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }

  .leader-hero {
    grid-template-columns: 88px 1fr;
  }

  .leader-hero img {
    width: 88px;
    height: 104px;
  }
}
