:root {
  --bg: #1c1108;
  --bg-elevated: #2a1810;
  --card-top: #3a2415;
  --card-bot: #2a1810;
  --card-border-lo: #17100a;
  --card-border-hi: #5a3a22;
  --text: #f3e5d8;
  --text-dim: #c9a88f;
  --fire-1: #ff7a1a;
  --fire-2: #ffb347;
  --fire-3: #ff4d1a;
  --success: #4caf7d;
  --error: #e0574f;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: var(--app-height, 100dvh);
  min-height: var(--app-height, 100dvh);
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Vazirmatn", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(255, 122, 26, 0.16) 0%, transparent 60%),
    radial-gradient(120% 100% at 50% 0%, #3a2013 0%, #1c1108 60%);
}

.icon { display: inline-flex; color: var(--fire-2); }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Splash ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background:
    radial-gradient(70% 50% at 50% 42%, rgba(255, 122, 26, 0.14) 0%, transparent 65%),
    radial-gradient(130% 100% at 50% 0%, #2e1810 0%, #140c06 65%);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.splash.hide { opacity: 0; transform: scale(1.06); pointer-events: none; }

.splash-crest {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: crestIn 1s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

/* Embers behind the crest — the glow breathes rather than blinking, so it reads as heat. */
.splash-crest::before {
  content: "";
  position: absolute;
  width: 86%;
  height: 86%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 110, 20, 0.45) 0%, rgba(255, 60, 10, 0.12) 45%, transparent 72%);
  filter: blur(26px);
  animation: emberBreathe 3s ease-in-out infinite;
}

.splash-crest img {
  position: relative;
  width: min(64vw, 268px);
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 34px rgba(255, 80, 10, 0.32));
  animation: crestFloat 4.5s ease-in-out infinite;
}

@keyframes crestIn {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes crestFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes emberBreathe {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

.splash-text {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: linear-gradient(180deg, #ffd79a, var(--fire-1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: crestIn 1s ease 0.15s both;
}

.splash-dots { display: inline-flex; gap: 3px; padding-right: 3px; }
.splash-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--fire-1);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.splash-dots i:nth-child(2) { animation-delay: 0.18s; }
.splash-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.splash-bar {
  width: min(52vw, 180px);
  height: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 179, 71, 0.13);
  animation: crestIn 1s ease 0.25s both;
}
.splash-bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transform-origin: right center;
  background: linear-gradient(90deg, var(--fire-3), var(--fire-2), #ffd79a);
  box-shadow: 0 0 10px rgba(255, 122, 26, 0.6);
  animation: splashFill 3s cubic-bezier(0.35, 0.1, 0.25, 1) forwards;
}
@keyframes splashFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-crest img,
  .splash-crest::before,
  .splash-dots i { animation: none; }
}

/* ---------- Top bar ---------- */
.topbar {
  flex-shrink: 0;
  padding: 14px 16px calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--card-border-lo);
  background: rgba(20, 12, 6, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(65% 65% at 50% 30%, #4a2c17 0%, #251508 100%);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 200, 140, 0.35),
    inset 0 -3px 4px rgba(0, 0, 0, 0.55),
    0 4px 10px rgba(255, 90, 20, 0.25),
    0 0 0 1px var(--card-border-lo);
}
.brand-mark .icon { width: 20px; height: 20px; filter: drop-shadow(0 0 6px rgba(255, 122, 26, 0.65)); }

.brand-name {
  background: linear-gradient(180deg, var(--fire-2), var(--fire-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 16px 24px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Bottom tab bar ---------- */
.tabbar {
  flex-shrink: 0;
  display: flex;
  background: rgba(18, 11, 6, 0.97);
  border-top: 1px solid var(--card-border-lo);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(10px);
  z-index: 10;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
  font-family: inherit;
}

.tab-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #3a2716, #201207);
  box-shadow:
    inset 0 1px 0 rgba(255, 210, 160, 0.12),
    inset 0 -3px 5px rgba(0, 0, 0, 0.5),
    0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tab-icon { width: 20px; height: 20px; color: var(--text-dim); }
.tab-icon .icon { width: 100%; height: 100%; }

.tab-label { font-size: 11px; font-weight: 700; }

.tab.active { color: var(--fire-2); }
.tab.active .tab-icon-badge {
  background: linear-gradient(160deg, #ff9a3d, #ff4d1a);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 235, 200, 0.55),
    inset 0 -3px 6px rgba(120, 20, 0, 0.5),
    0 6px 14px rgba(255, 90, 20, 0.4);
}
.tab.active .tab-icon { color: #2a1206; }

.tab:active .tab-icon-badge { transform: translateY(1px) scale(0.96); }

/* ---------- Cards (raised bevel panel) ---------- */
.card {
  position: relative;
  background: linear-gradient(165deg, var(--card-top), var(--card-bot));
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 200, 150, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.card h2 {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--fire-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .icon { width: 19px; height: 19px; }

.card p { margin: 0 0 8px; line-height: 1.9; color: var(--text-dim); font-size: 14px; }

/* ---------- "Coming soon" screens ---------- */
.soon { text-align: center; padding: 56px 16px; color: var(--text-dim); }
.soon-badge {
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(70% 70% at 50% 25%, #4a2c17 0%, #201207 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 200, 150, 0.18),
    inset 0 -6px 10px rgba(0, 0, 0, 0.55),
    0 12px 30px rgba(0, 0, 0, 0.4);
}
.soon-badge .icon { width: 40px; height: 40px; filter: drop-shadow(0 0 10px rgba(255, 122, 26, 0.35)); }
.soon h2 { color: var(--text); margin: 0 0 6px; }

/* ---------- Academy ---------- */
.academy-hero { text-align: center; padding: 4px 0 20px; }

.academy-logo {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
  margin: 0 auto 10px;
  filter: drop-shadow(0 10px 26px rgba(255, 90, 20, 0.28));
}

.academy-user { font-size: 19px; font-weight: 800; color: var(--text); }

.academy-rank {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--fire-2), var(--fire-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Featured lesson (episode one) — poster on top, course title underneath. */
.lesson-hero {
  display: block;
  width: 100%;
  text-align: right;
  font-family: inherit;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--card-top), var(--card-bot));
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.08), 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.lesson-hero:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,200,150,0.06), 0 4px 12px rgba(0,0,0,0.3); }

.lesson-hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 132px;
  background:
    radial-gradient(70% 120% at 50% 0%, rgba(255, 122, 26, 0.3) 0%, transparent 70%),
    linear-gradient(165deg, #4a2c17, #1c1108);
  border-bottom: 1px solid var(--card-border-lo);
}

.lesson-hero-play {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 4px; /* optical centering of the play triangle */
  color: #2a1206;
  background: linear-gradient(180deg, #ffcf7a 0%, var(--fire-1) 55%, var(--fire-3) 100%);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 245, 220, 0.7),
    inset 0 -3px 6px rgba(140, 30, 0, 0.35),
    0 10px 22px rgba(255, 77, 26, 0.4);
}
.lesson-hero-play .icon { color: currentColor; }

.lesson-hero-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fire-2);
  background: rgba(20, 12, 6, 0.72);
  border: 1px solid var(--card-border-hi);
  border-radius: 999px;
  padding: 5px 11px;
  backdrop-filter: blur(4px);
}

.lesson-hero-body { display: block; padding: 15px 18px 17px; }
.lesson-hero-title { display: block; font-size: 17px; font-weight: 800; color: var(--fire-2); margin-bottom: 7px; }
.lesson-hero-meta { display: block; font-size: 13px; line-height: 1.8; color: var(--text-dim); }

.lesson-hero.is-soon .lesson-hero-play {
  background: linear-gradient(165deg, #4a3126, #2a1810);
  color: #a8776a;
  padding-right: 0;
  box-shadow: inset 0 1px 0 rgba(255,200,150,0.1), inset 0 -2px 4px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.3);
}

/* Episode list */
.lesson-list { margin-top: 8px; display: flex; flex-direction: column; gap: 9px; }

.lesson-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: right;
  font-family: inherit;
  padding: 11px 12px;
  border-radius: 14px;
  background: linear-gradient(165deg, #33210f, #251507);
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.06), 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.lesson-row:active { transform: translateY(1.5px); box-shadow: inset 0 1px 0 rgba(255,200,150,0.05), 0 2px 6px rgba(0,0,0,0.28); }

.lesson-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--fire-2);
  background: linear-gradient(165deg, #4a2c17, #2a1810);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.15), 0 3px 6px rgba(0, 0, 0, 0.35);
}

.lesson-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lesson-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.lesson-topics {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lesson-state { flex-shrink: 0; color: var(--fire-2); display: flex; }
.lesson-row.is-soon { opacity: 0.62; }
.lesson-row.is-soon .lesson-state,
.lesson-row.is-soon .lesson-num { color: #a8776a; }

.lesson-row.is-sending,
.lesson-hero.is-sending { opacity: 0.6; pointer-events: none; }

/* ---------- Player overlay ---------- */
.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #120b05;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.player-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--card-border-lo);
  background: rgba(20, 12, 6, 0.92);
}

.player-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fire-2);
  background: linear-gradient(165deg, #4a2c17, #2a1810);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.15), 0 3px 6px rgba(0, 0, 0, 0.35);
}
.player-close:active { transform: translateY(1px); }

.player-bar-title { font-size: 14px; font-weight: 700; color: var(--text); }

.player-stage {
  flex-shrink: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-video { width: 100%; max-height: 56vh; display: block; background: #000; }

.player-info { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 26px; }
.player-info h3 { margin: 0 0 12px; font-size: 16px; color: var(--fire-2); }

.player-topics { margin: 0; padding: 0; list-style: none; }
.player-topics li {
  position: relative;
  padding: 0 15px 0 0;
  margin-bottom: 9px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text-dim);
}
.player-topics li::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fire-1);
}
.player-ref { margin-top: 8px; }

/* ---------- Admin panel ---------- */
.admin-card { border-top-color: var(--fire-1); }

.admin-select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--card-border-lo);
  background: linear-gradient(180deg, #1a0f07, #211307);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}
.admin-select:focus { outline: none; border-color: var(--fire-1); }
.admin-select:disabled { opacity: 0.6; }

.admin-file { margin-top: 12px; font-size: 12.5px; color: var(--text-dim); word-break: break-all; }

.admin-summary { margin-top: 12px; text-align: center; font-size: 12.5px; color: var(--text-dim); }

.admin-divider { height: 1px; margin: 18px 0 14px; background: var(--card-border-lo); }

.admin-subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--fire-2);
}

.staged-item {
  padding: 13px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: linear-gradient(165deg, #3a2716, #251507);
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.06), 0 4px 10px rgba(0, 0, 0, 0.3);
}
.staged-name { font-size: 12.5px; color: var(--text); margin-bottom: 10px; word-break: break-all; }
.staged-item .admin-select { margin-bottom: 10px; }
.staged-item .actions-row { margin-top: 0; }
.staged-item .btn-primary { margin-top: 0; flex: 3; }
.staged-item .staged-discard { flex: 1; }
.staged-partial { font-size: 12px; line-height: 1.8; color: var(--fire-2); margin-bottom: 10px; }

.err-detail {
  display: block;
  margin-top: 6px;
  direction: ltr;
  text-align: left;
  font-size: 11px;
  opacity: 0.75;
  word-break: break-all;
}

.admin-hint { font-size: 12.5px; line-height: 1.9; color: var(--text-dim); margin: 0 0 10px; }
.admin-hint code {
  direction: ltr;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--fire-2);
  background: rgba(20, 12, 6, 0.7);
  border: 1px solid var(--card-border-lo);
}
#adminScan { width: 100%; }

.admin-progress:not(:empty) { margin-top: 14px; }

.progress-track {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #1a0f07, #211307);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fire-3), var(--fire-2));
  box-shadow: 0 0 10px rgba(255, 122, 26, 0.5);
  transition: width 0.25s ease;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--text-dim);
}
.progress-note { color: var(--fire-2); }
.admin-progress .btn { margin-top: 10px; width: 100%; }

/* ---------- Form fields ---------- */
.field { margin-top: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--card-border-lo);
  background: linear-gradient(180deg, #1a0f07, #211307);
  color: var(--text);
  font-size: 16px; /* iOS/Android auto-zoom on focus if an input's font-size is below 16px */
  font-family: inherit;
  direction: ltr;
  text-align: left;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}
.field input::placeholder { color: #7a5c46; }
.field input:focus { outline: none; border-color: var(--fire-1); box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 0 0 3px rgba(255, 122, 26, 0.18); }

/* ---------- 3D buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 13px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  width: 100%;
  margin-top: 18px;
  color: #2a1206;
  background: linear-gradient(180deg, #ffcf7a 0%, var(--fire-1) 55%, var(--fire-3) 100%);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 245, 220, 0.7),
    inset 0 -3px 6px rgba(140, 30, 0, 0.35),
    0 10px 22px rgba(255, 77, 26, 0.38),
    0 2px 0 #a83000;
}
.btn-primary:active { transform: translateY(2px); box-shadow: inset 0 1.5px 0 rgba(255,245,220,0.5), inset 0 -2px 4px rgba(140,30,0,0.35), 0 4px 10px rgba(255,77,26,0.3); }
.btn-primary:disabled { filter: grayscale(0.4) brightness(0.75); }

.btn-ghost {
  background: linear-gradient(165deg, #3a2716, #201207);
  color: var(--fire-2);
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  box-shadow:
    inset 0 1px 0 rgba(255, 200, 150, 0.12),
    0 5px 12px rgba(0, 0, 0, 0.35),
    0 1.5px 0 #120a04;
}
.btn-ghost:active { transform: translateY(1.5px); box-shadow: inset 0 1px 0 rgba(255,200,150,0.1), 0 2px 6px rgba(0,0,0,0.3); }

.btn-small { padding: 9px 14px; font-size: 12.5px; border-radius: 11px; }

.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: linear-gradient(180deg, #1a0f07, #211307);
  border: 1px solid var(--card-border-lo);
  border-radius: 13px;
  padding: 11px 11px 11px 7px;
  margin-top: 10px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}
.link-row input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text); direction: ltr; text-align: left; font-size: 16px; }
.link-row input:focus { outline: none; }
.link-row .icon-btn { width: 30px; height: 30px; flex-shrink: 0; }

/* The link text is tappable, so it's styled like a link rather than like a read-only field. */
.link-open {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  direction: ltr;
  text-align: left;
  color: var(--fire-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 179, 71, 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.link-open:active { color: #ffd79a; }

.icon-btn {
  border: none;
  border-radius: 9px;
  background: linear-gradient(165deg, #4a2c17, #2a1810);
  color: var(--fire-2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,200,150,0.15), 0 3px 6px rgba(0,0,0,0.35);
}
.icon-btn .icon { width: 15px; height: 15px; }
.icon-btn:active { transform: translateY(1px); }

.actions-row { display: flex; gap: 8px; margin-top: 10px; }
.actions-row .btn { flex: 1; }

.msg {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.7;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.msg .icon { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.msg-error { background: rgba(224, 87, 79, 0.14); color: #ff9d97; border: 1px solid rgba(224, 87, 79, 0.28); }
.msg-error .icon { color: #ff9d97; }
.msg-success { background: rgba(76, 175, 125, 0.14); color: #8fe0b6; border: 1px solid rgba(76, 175, 125, 0.28); }
.msg-success .icon { color: #8fe0b6; }
.msg-soon { background: rgba(255, 122, 26, 0.12); color: var(--fire-2); border: 1px solid rgba(255, 122, 26, 0.28); }
.msg-soon .icon { color: var(--fire-2); }

/* ---------- Feature intro screens (assistant, live trade) ---------- */
.feature-hero { text-align: center; padding: 22px 12px 20px; }
.feature-badge {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(70% 70% at 50% 25%, #4a2c17 0%, #201207 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 200, 150, 0.18),
    inset 0 -6px 10px rgba(0, 0, 0, 0.55),
    0 12px 30px rgba(0, 0, 0, 0.4);
}
.feature-badge .icon { width: 40px; height: 40px; filter: drop-shadow(0 0 10px rgba(255, 122, 26, 0.35)); }
.feature-hero h2 {
  margin: 0;
  font-size: 20px;
  background: linear-gradient(180deg, var(--fire-2), var(--fire-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.invitee-list { margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }

.invitee-card {
  border-radius: 14px;
  background: linear-gradient(165deg, #33210f, #251507);
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.06), 0 4px 10px rgba(0, 0, 0, 0.3);
  padding: 12px 12px 6px;
}

.invitee-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.invitee-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #4a2c17, #2a1810);
  box-shadow: inset 0 1px 0 rgba(255,200,150,0.15), 0 3px 6px rgba(0,0,0,0.35);
  color: var(--fire-2);
  flex-shrink: 0;
}
.invitee-avatar .icon { width: 14px; height: 14px; }
.invitee-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.invitee-title-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.invitee-title-date { font-size: 11px; color: var(--text-dim); }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 2px;
  border-top: 1px solid var(--card-border-lo);
  font-size: 12.5px;
  color: var(--text-dim);
}
.status-row:first-of-type { border-top: none; }

.status-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-badge .icon { width: 12px; height: 12px; }
.status-badge.yes {
  background: linear-gradient(160deg, #6fdb9e, var(--success));
  color: #0e2c1d;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -2px 3px rgba(0,60,30,0.4), 0 3px 8px rgba(76,175,125,0.35);
}
.status-badge.no {
  background: linear-gradient(160deg, #4a3126, #2a1810);
  color: #a8776a;
  box-shadow: inset 0 1px 0 rgba(255,200,150,0.1), inset 0 -2px 3px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
}

.invitee-empty { color: var(--text-dim); font-size: 13px; padding: 14px 4px; text-align: center; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 179, 71, 0.25);
  border-top-color: var(--fire-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translate(-50%, 12px);
  background: linear-gradient(165deg, #3a2716, #201207);
  color: var(--text);
  border: 1px solid var(--card-border-hi);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  white-space: nowrap;
}
.toast .icon { width: 16px; height: 16px; color: var(--success); }
.toast.toast-warn .icon { color: var(--fire-2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* A hidden tab must actually leave the row, not just go invisible. */
.tab[hidden] { display: none; }

/* ---------- Launch notice (assistant) ---------- */
.launch-note {
  margin-top: 18px;
  padding: 16px 14px;
  border-radius: 14px;
  text-align: center;
  background: linear-gradient(165deg, #3a2716, #201207);
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.08), 0 5px 14px rgba(0, 0, 0, 0.3);
}
.launch-label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.launch-date {
  display: block;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, #ffd79a, var(--fire-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.launch-soon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fire-2);
}
.launch-soon .icon { width: 15px; height: 15px; }

/* ---------- Quality picker + download (player) ---------- */
.quality-row { margin-bottom: 18px; }
.quality-caption,
.download-caption {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 9px;
}

.quality-chips,
.download-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.quality-chip,
.download-chip {
  flex: 1 1 auto;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(165deg, #33210f, #251507);
  border: 1px solid var(--card-border-lo);
  border-top-color: var(--card-border-hi);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.06), 0 3px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease;
}
.quality-chip em,
.download-chip em { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--text-dim); }

.quality-chip:active,
.download-chip:active { transform: translateY(1.5px); }

.quality-chip.is-active {
  color: #2a1206;
  background: linear-gradient(180deg, #ffcf7a 0%, var(--fire-1) 55%, var(--fire-3) 100%);
  border-color: transparent;
  box-shadow: inset 0 1.5px 0 rgba(255, 245, 220, 0.6), 0 6px 14px rgba(255, 77, 26, 0.35);
}
.quality-chip.is-active em { color: rgba(42, 18, 6, 0.7); }

.download-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--card-border-lo); }
.download-chip:disabled { opacity: 0.5; }
.download-note:not(:empty) { margin-top: 12px; text-align: center; }

/* Course cover on the featured lesson. The art box keeps its fixed height so the card never
   jumps while the image loads, and a scrim keeps the play button and tag readable over it. */
.lesson-hero-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lesson-hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 12, 6, 0.45) 0%, rgba(20, 12, 6, 0.15) 45%, rgba(20, 12, 6, 0.7) 100%);
}
.lesson-hero-art > .lesson-hero-play,
.lesson-hero-art > .lesson-hero-tag { position: relative; z-index: 1; }
.lesson-hero-art > .lesson-hero-tag { position: absolute; }
