/* KalviYogi Shorts — design system + student app */

:root {
  --bg: #07070c;
  --bg-2: #0e0e16;
  --surface: #14141f;
  --surface-2: #1c1c2a;
  --surface-3: #262638;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5fa;
  --text-2: #b4b4c6;
  --text-3: #7c7c92;
  --brand-1: #ff8a00;
  --brand-2: #ff2e74;
  --brand-3: #7b4dff;
  --brand: linear-gradient(135deg, var(--brand-1), var(--brand-2) 52%, var(--brand-3));
  --like: #ff3d6e;
  --save: #ffc83d;
  --ok: #2ad49a;
  --danger: #ff5470;
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Plus Jakarta Sans', 'Noto Sans Tamil', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; flex-shrink: 0; }
img { display: block; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(255, 46, 116, 0.4); }

.gradient-text {
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- buttons & form bits ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font-weight: 700; font-size: 14.5px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: transform 0.15s, background 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; }
.btn.primary {
  background: var(--brand); border: 0; color: #fff;
  box-shadow: 0 8px 24px -8px rgba(255, 46, 116, 0.6);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.white { background: #fff; color: #111; border: 0; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); transition: background 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: #fff; color: #0b0b12; border-color: #fff; }
.chip .count { opacity: 0.6; font-weight: 500; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 1000; pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; text-align: center;
  background: rgba(30, 30, 44, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s cubic-bezier(.2, .9, .3, 1.2);
  transition: opacity 0.35s, transform 0.35s;
}
.toast.ok { border-color: rgba(42, 212, 154, 0.5); }
.toast.error { border-color: rgba(255, 84, 112, 0.6); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }

/* ---------- app shell ---------- */

.app { display: flex; height: 100dvh; }

.sidebar { display: none; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.brand img { width: 36px; height: 36px; border-radius: 11px; }
.brand small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); margin-top: -2px; }

main#view {
  flex: 1; min-width: 0; height: calc(100dvh - var(--tabbar-h) - var(--safe-b));
  overflow-y: auto; overflow-x: hidden; position: relative;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(7, 7, 12, 0.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--text-3); transition: color 0.2s;
}
.tab svg { width: 23px; height: 23px; transition: transform 0.2s; }
.tab.active { color: var(--text); }
.tab.active svg { transform: translateY(-1px); }
.tab.active .tab-dot { opacity: 1; }
.tab-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--brand-2); opacity: 0; margin-top: 1px; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  main#view { height: 100dvh; }
  .toasts { bottom: 28px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px;
    width: 248px; flex-shrink: 0; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--bg);
  }
  .sidebar .brand { padding: 4px 10px 22px; }
  .side-link {
    display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 14px; border-radius: 14px;
    font-weight: 600; color: var(--text-2); transition: background 0.2s, color 0.2s;
  }
  .side-link:hover { background: var(--surface); color: var(--text); }
  .side-link.active { background: var(--surface-2); color: var(--text); }
  .side-link.active svg { color: var(--brand-2); }
  .side-sep { height: 1px; background: var(--line); margin: 12px 8px; }
  .side-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 6px 14px; }
  .side-subjects { display: grid; gap: 2px; overflow-y: auto; min-height: 0; flex: 1; scrollbar-width: none; }
  .side-subject { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: 14px; }
  .side-subject:hover { background: var(--surface); color: var(--text); }
  .side-subject .dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; }
  .side-subject .n { margin-left: auto; font-size: 12px; color: var(--text-3); }
  .side-studio { margin-top: auto; }
}

/* ---------- feed ---------- */

.feed-wrap { position: relative; height: 100%; display: flex; justify-content: center; background: #000; }

.feed-stage { position: relative; height: 100%; width: 100%; }
.feed {
  position: relative; height: 100%; width: 100%;
  overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  position: relative; height: 100%; width: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; background: #000;
}
.slide-media { position: absolute; inset: 0; background: var(--g, var(--brand)); }
.slide-media .poster, .slide-media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent;
}
.slide-media .poster-blur {
  position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px);
  object-fit: cover; filter: blur(40px) brightness(0.45) saturate(1.3);
}
.slide-media video { opacity: 0; transition: opacity 0.25s; }
.slide-media video.ready { opacity: 1; }
.poster-emoji {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 92px;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.tap-zone { position: absolute; inset: 0; z-index: 2; cursor: pointer; }

.slide-shade {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.45), transparent 18%),
    linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0.25) 32%, transparent 52%);
}

.play-indicator {
  position: absolute; left: 50%; top: 50%; z-index: 4; pointer-events: none;
  width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(8px);
  opacity: 0; transform: scale(1.3); transition: opacity 0.2s, transform 0.2s;
}
.play-indicator svg { width: 34px; height: 34px; margin-left: 4px; }
.slide.paused .play-indicator { opacity: 1; transform: scale(1); }

.loader {
  position: absolute; left: 50%; top: 50%; z-index: 4; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,0.18); border-top-color: #fff;
  animation: spin 0.8s linear infinite; opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.slide.buffering .loader { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.heart-pop {
  position: absolute; z-index: 6; width: 110px; height: 110px; margin: -55px 0 0 -55px; pointer-events: none;
  color: var(--like); filter: drop-shadow(0 8px 24px rgba(255, 61, 110, 0.55));
  animation: heart-pop 0.9s cubic-bezier(.2, .9, .3, 1.3) forwards;
}
.heart-pop svg { width: 100%; height: 100%; fill: currentColor; stroke: none; }
@keyframes heart-pop {
  0% { opacity: 0; transform: scale(0.3) rotate(var(--r, -12deg)); }
  25% { opacity: 1; transform: scale(1.15) rotate(var(--r, -12deg)); }
  45% { transform: scale(0.95) rotate(var(--r, -12deg)); }
  80% { opacity: 1; transform: scale(1) translateY(-10px) rotate(var(--r, -12deg)); }
  100% { opacity: 0; transform: scale(1.1) translateY(-60px) rotate(var(--r, -12deg)); }
}

.slide-info {
  position: absolute; left: 0; right: 76px; bottom: 0; z-index: 5; padding: 0 16px 22px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.subject-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 4px; border-radius: 999px;
  font-weight: 700; font-size: 13px; background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.18); text-shadow: none;
}
.subject-pill .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; }
.slide-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.slide-meta .tag { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.82); }
.slide-meta .tag + .tag::before { content: '•'; margin-right: 8px; opacity: 0.6; }
.slide-title { margin: 0 0 6px; font-size: 17px; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.slide-desc {
  margin: 0; font-size: 14px; color: rgba(255, 255, 255, 0.86); cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.slide-desc.open { -webkit-line-clamp: unset; max-height: 30vh; overflow-y: auto; }

.rail {
  position: absolute; right: 8px; bottom: 26px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.rail-btn .ring {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform 0.15s, background 0.2s;
}
.rail-btn:hover .ring { background: rgba(255, 255, 255, 0.22); }
.rail-btn:active .ring { transform: scale(0.88); }
.rail-btn svg { width: 25px; height: 25px; }
.rail-btn.liked .ring { color: var(--like); }
.rail-btn.liked svg { fill: currentColor; animation: bump 0.4s cubic-bezier(.2, .9, .3, 1.5); }
.rail-btn.saved .ring { color: var(--save); }
.rail-btn.saved svg { fill: currentColor; animation: bump 0.4s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes bump { 40% { transform: scale(1.35); } }
.rail-subject {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 20px;
  border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-3px); } }

.progress {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; height: 14px; cursor: pointer;
  display: flex; align-items: flex-end; touch-action: none;
}
.progress-track { position: relative; width: 100%; height: 3px; background: rgba(255, 255, 255, 0.22); transition: height 0.15s; }
.progress:hover .progress-track, .progress.dragging .progress-track { height: 6px; }
.progress-bar { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: var(--brand); }
.progress-time {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.progress.dragging .progress-time { opacity: 1; }

.feed-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20; pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 0;
}
.feed-top > * { pointer-events: auto; }
.feed-top .chips { flex: 1; mask-image: linear-gradient(to right, #000 88%, transparent); -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 30px; }
.feed-top .chip { background: rgba(0, 0, 0, 0.32); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: rgba(255,255,255,0.14); color: rgba(255,255,255,0.88); }
.feed-top .chip.active { background: #fff; color: #0b0b12; }
.feed-top .icon-btn { background: rgba(0, 0, 0, 0.32); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: rgba(255,255,255,0.14); flex-shrink: 0; }
.feed-context { flex: 1; font-weight: 800; font-size: 16px; text-shadow: 0 1px 8px rgba(0,0,0,0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-context small { display: block; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.75); }

.sound-hint {
  position: absolute; top: 62px; left: 50%; z-index: 20; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.16); animation: toast-in 0.4s 0.6s both;
}
.sound-hint svg { width: 17px; height: 17px; }

.feed-nav { display: none; }

@media (min-width: 900px) {
  .feed-wrap { background: var(--bg); padding: 16px 0; align-items: center; }
  .feed-stage {
    width: auto; aspect-ratio: 9 / 16; max-width: calc(100% - 200px); overflow: hidden;
    border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--line);
  }
  .feed-nav {
    display: flex; flex-direction: column; gap: 14px; position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  }
  .feed-nav .icon-btn { width: 52px; height: 52px; }
  .sound-hint { top: 74px; }
  .keys-hint { position: absolute; left: 28px; bottom: 24px; color: var(--text-3); font-size: 12.5px; display: grid; gap: 6px; }
  .keys-hint kbd { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; margin-right: 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-strong); font: 600 11px var(--font); color: var(--text-2); }
}
@media (max-width: 1199px) { .keys-hint { display: none; } }

.feed-empty {
  height: 100%; display: grid; place-items: center; text-align: center; padding: 32px;
  background: radial-gradient(circle at 50% 30%, rgba(123, 77, 255, 0.25), transparent 60%), var(--bg);
}
.feed-empty .art { font-size: 64px; margin-bottom: 8px; }
.feed-empty h2 { margin: 0 0 8px; font-size: 22px; }
.feed-empty p { margin: 0 auto 22px; color: var(--text-2); max-width: 320px; }
.feed-empty .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- pages (subjects, subject, search, saved) ---------- */

.page { max-width: 1180px; margin: 0 auto; padding: 18px 16px 40px; animation: page-in 0.35s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
@media (min-width: 900px) { .page { padding: 34px 36px 60px; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head .brand { font-size: 18px; }
@media (min-width: 900px) { .page-head .brand.mobile-only { display: none; } }

.hello { margin: 4px 0 18px; }
.hello h1 { margin: 0; font-size: clamp(26px, 5vw, 38px); line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; }
.hello p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }

.search-box {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-3); transition: border-color 0.2s, background 0.2s;
}
.search-box:focus-within { border-color: rgba(255, 46, 116, 0.6); background: var(--surface-2); }
.search-box input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 15.5px; color: var(--text); }
.search-box input::placeholder { color: var(--text-3); }
.search-box .icon-btn { width: 32px; height: 32px; background: transparent; border: 0; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 14px; }
.section-title h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.section-title a { font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.section-title a:hover { color: var(--text); }

.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .subject-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.subject-card {
  position: relative; overflow: hidden; border-radius: 22px; padding: 16px; aspect-ratio: 1.35;
  display: flex; flex-direction: column; justify-content: flex-end; background: var(--g);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); transition: transform 0.25s cubic-bezier(.2, .9, .3, 1.2), box-shadow 0.25s;
  isolation: isolate;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 18px 36px -14px var(--glow, rgba(0,0,0,0.6)); }
.subject-card:active { transform: scale(0.98); }
.subject-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 85% 10%, rgba(255,255,255,0.35), transparent 45%), linear-gradient(to top, rgba(0,0,0,0.25), transparent 60%);
}
.subject-card .emoji {
  position: absolute; top: 12px; right: 14px; font-size: 42px; line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.25)); transition: transform 0.3s;
}
.subject-card:hover .emoji { transform: rotate(-8deg) scale(1.08); }
.subject-card .name { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; line-height: 1.2; }
.subject-card .count { font-size: 12.5px; font-weight: 600; opacity: 0.85; margin-top: 2px; }

.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.row-scroll::-webkit-scrollbar { display: none; }
.row-scroll .tile { scroll-snap-align: start; }
@media (min-width: 900px) { .row-scroll { grid-auto-columns: 176px; } }

.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .tile-grid { grid-template-columns: repeat(4, 1fr); gap: 20px 16px; } }
@media (min-width: 1200px) { .tile-grid { grid-template-columns: repeat(5, 1fr); } }

.tile { display: block; min-width: 0; }
.tile-media {
  position: relative; aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: var(--g, var(--surface-2));
  box-shadow: inset 0 0 0 1px var(--line);
}
.tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.tile:hover .tile-media img { transform: scale(1.05); }
.tile-media .poster-emoji { font-size: 46px; }
.tile-media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.65), transparent 40%); }
.tile-badge {
  position: absolute; z-index: 1; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.tile-badge svg { width: 14px; height: 14px; }
.tile-badge.views { left: 10px; bottom: 9px; }
.tile-badge.dur { right: 8px; top: 8px; padding: 2px 7px; border-radius: 7px; background: rgba(0, 0, 0, 0.55); text-shadow: none; }
.tile-badge.subj { left: 8px; top: 8px; width: 26px; height: 26px; border-radius: 8px; justify-content: center; font-size: 13px; text-shadow: none; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.tile-title {
  margin-top: 8px; font-weight: 700; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px; margin-bottom: 18px; background: var(--g);
  display: flex; flex-direction: column; gap: 14px; isolation: isolate;
}
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 90% 0%, rgba(255,255,255,0.35), transparent 50%), linear-gradient(to top, rgba(0,0,0,0.3), transparent 70%); }
.hero .big-emoji { position: absolute; right: 18px; top: 10px; font-size: clamp(64px, 12vw, 110px); line-height: 1; z-index: -1; opacity: 0.95; transform: rotate(-8deg); filter: drop-shadow(0 10px 30px rgba(0,0,0,0.25)); }
.hero .back { width: 40px; height: 40px; background: rgba(0,0,0,0.22); border-color: rgba(255,255,255,0.2); }
.hero h1 { margin: 18px 0 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -0.03em; line-height: 1.05; }
.hero .stats { display: flex; gap: 14px; font-weight: 600; font-size: 14px; opacity: 0.92; }
.hero .stats span { display: inline-flex; align-items: center; gap: 6px; }
.hero .stats svg { width: 16px; height: 16px; }
.hero .actions { display: flex; gap: 10px; }
@media (min-width: 900px) { .hero { padding: 30px 34px; min-height: 240px; justify-content: flex-end; } }

.empty {
  text-align: center; padding: 56px 20px; border-radius: 22px; border: 1px dashed var(--line-strong); color: var(--text-2);
}
.empty .art { font-size: 48px; margin-bottom: 6px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 18px; }
.empty p { margin: 0 auto 18px; max-width: 340px; }

.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.results-meta { color: var(--text-3); font-size: 13.5px; margin: 18px 0 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- form fields (shared with Studio) ---------- */

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--text-2); letter-spacing: 0.01em; }
.field > span em { font-style: normal; font-weight: 500; color: var(--text-3); }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 13px;
  background: var(--bg-2); border: 1px solid var(--line-strong); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4b4c6' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
select.input option { background: var(--surface); }
.input:focus { border-color: rgba(255, 46, 116, 0.7); box-shadow: 0 0 0 4px rgba(255, 46, 116, 0.14); }
.input::placeholder { color: var(--text-3); }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

/* Input with a leading icon, optional +91 prefix and a show-password button. */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.input-wrap .input { padding-left: 42px; }
.input-wrap .prefix { position: absolute; left: 40px; font-style: normal; font-weight: 700; color: var(--text-2); pointer-events: none; }
.input-wrap .prefix + .input { padding-left: 76px; }
.input-wrap .reveal { position: absolute; right: 6px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--text-3); }
.input-wrap .reveal:hover { color: var(--text); background: var(--surface-2); }
.input-wrap .reveal svg { width: 18px; height: 18px; }
.input-wrap:has(.reveal) .input { padding-right: 46px; }
.input-wrap:focus-within > svg { color: var(--brand-2); }
.btn.big { height: 52px; font-size: 15.5px; width: 100%; }

/* ---------- avatar ---------- */

.avatar {
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; letter-spacing: 0.02em;
}
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px rgba(255,255,255,0.15), 0 18px 40px -12px rgba(255,46,116,0.6); }

@media (min-width: 900px) {
  .side-user { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
  .side-user:empty { display: none; }
  .side-user:hover { background: var(--surface-2); }
  .side-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user small { display: block; font-size: 12px; color: var(--text-3); }
  .side-user > span:last-child { min-width: 0; }
  .side-studio { margin-top: 4px; }
}
@media (max-width: 899px) { .side-user { display: none; } }

/* ---------- auth (sign in / sign up) ---------- */

#auth { height: 100dvh; overflow-y: auto; }
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; align-content: start; }
@media (min-width: 960px) { .auth { grid-template-columns: 1.05fr 1fr; align-content: stretch; } }

.auth-show {
  position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: flex-end;
  padding: 28px 22px 44px; min-height: 250px;
  background: linear-gradient(160deg, #1a0f2e, #0b0b14 60%);
}
@media (min-width: 960px) { .auth-show { min-height: 100dvh; padding: 56px; align-items: center; } }
.blobs i { position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: 0.75; animation: drift 14s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { width: 380px; height: 380px; left: -80px; top: -120px; background: #ff8a00; }
.blobs i:nth-child(2) { width: 420px; height: 420px; right: -140px; top: 20%; background: #ff2e74; animation-delay: -5s; }
.blobs i:nth-child(3) { width: 360px; height: 360px; left: 20%; bottom: -160px; background: #7b4dff; animation-delay: -9s; }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.1); } }
.auth-show::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 120%, rgba(7,7,12,0.9), transparent 70%); }

.floaty {
  position: absolute; z-index: 0; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; font-size: 26px;
  background: rgba(255, 255, 255, 0.12); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  animation: bob 6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-12px) rotate(var(--rot, 6deg)); } }
.f0 { top: 12%; right: 8%; --rot: -8deg; }
.f1 { top: 36%; right: 24%; animation-delay: -1s; }
.f2 { top: 10%; right: 40%; animation-delay: -2s; width: 46px; height: 46px; font-size: 21px; }
.f3 { top: 46%; right: 4%; animation-delay: -3s; }
.f4, .f5, .f6, .f7 { display: none; }
@media (min-width: 960px) {
  .f4, .f5, .f6, .f7 { display: grid; }
  .f0 { top: 10%; right: 12%; } .f1 { top: 22%; right: 38%; } .f2 { top: 8%; right: 62%; }
  .f3 { top: 70%; right: 10%; } .f4 { top: 84%; right: 40%; animation-delay: -4s; }
  .f5 { top: 40%; right: 6%; animation-delay: -2.5s; } .f6 { top: 6%; left: 8%; animation-delay: -3.5s; } .f7 { bottom: 8%; left: 10%; animation-delay: -1.5s; }
}
.auth-copy { position: relative; z-index: 1; max-width: 460px; }
.auth-copy .brand { margin-bottom: 18px; color: #fff; }
.auth-copy .brand small { color: rgba(255,255,255,0.7); }
.auth-copy h1 { margin: 0; font-size: clamp(28px, 4.4vw, 50px); line-height: 1.06; letter-spacing: -0.035em; }
.auth-copy ul { display: none; list-style: none; padding: 0; margin: 28px 0 0; gap: 14px; }
@media (min-width: 960px) { .auth-copy ul { display: grid; } }
.auth-copy li { display: flex; align-items: center; gap: 12px; font-weight: 600; color: rgba(255,255,255,0.88); }
.auth-copy li svg { width: 34px; height: 34px; padding: 8px; border-radius: 11px; background: rgba(255,255,255,0.14); }

.auth-main { display: flex; justify-content: center; align-items: flex-start; padding: 0 16px 40px; margin-top: -24px; position: relative; z-index: 2; }
@media (min-width: 960px) { .auth-main { align-items: center; padding: 40px; margin-top: 0; } }
.auth-card {
  width: min(470px, 100%); padding: 22px; border-radius: 28px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  animation: page-in 0.4s ease both;
}
@media (min-width: 960px) { .auth-card { padding: 30px; background: transparent; border: 0; box-shadow: none; } }

.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 22px; }
.seg button { position: relative; z-index: 1; height: 42px; border-radius: 12px; font-weight: 700; color: var(--text-3); transition: color 0.25s; }
.seg button[aria-selected="true"] { color: var(--text); }
.seg i { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 12px; background: var(--surface-3); box-shadow: 0 4px 14px rgba(0,0,0,0.35); transition: transform 0.3s cubic-bezier(.2, .9, .3, 1.1); }
.seg[data-mode="register"] i { transform: translateX(100%); }

.auth-form { display: grid; gap: 14px; animation: page-in 0.3s ease both; }
.auth-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.auth-head p { margin: 4px 0 4px; color: var(--text-2); }
.auth-note { margin: 0; text-align: center; font-size: 13px; color: var(--text-3); }

.grade-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.grade-pick label { cursor: pointer; position: relative; }
.grade-pick input { position: absolute; opacity: 0; pointer-events: none; }
.grade-pick span {
  display: inline-flex; align-items: center; height: 36px; padding: 0 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--line-strong);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.grade-pick span:hover { color: var(--text); }
.grade-pick input:checked + span { background: var(--brand); color: #fff; border-color: transparent; transform: scale(1.04); }
.grade-pick input:focus-visible + span { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* ---------- profile ---------- */

.profile-card {
  position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 24px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line);
}
.profile-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 0% 0%, rgba(255, 46, 116, 0.25), transparent 50%), radial-gradient(circle at 100% 100%, rgba(123, 77, 255, 0.25), transparent 50%); }
.profile-card .who { min-width: 0; flex: 1; }
.profile-card h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); letter-spacing: -0.02em; }
.profile-card p { margin: 2px 0 10px; color: var(--text-2); font-weight: 600; }
.profile-card .facts { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text-3); }
.profile-card .facts span { display: inline-flex; align-items: center; gap: 6px; }
.profile-card .facts svg { width: 15px; height: 15px; }

.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 20px; }
.profile-stats > * { text-align: center; padding: 14px 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); transition: background 0.2s; }
.profile-stats a:hover { background: var(--surface-2); }
.profile-stats b { display: block; font-size: 24px; letter-spacing: -0.02em; }
.profile-stats span { font-size: 12.5px; color: var(--text-3); font-weight: 600; }

.profile-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .profile-grid { grid-template-columns: 1.3fr 1fr; } }
.profile-grid .stack { display: grid; gap: 16px; }
.panel { display: grid; gap: 14px; padding: 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.panel h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 2px; font-size: 17px; }
.panel h2 svg { width: 20px; height: 20px; color: var(--brand-2); }
.panel .btn { justify-self: start; }
.signout { width: 100%; border-color: rgba(255, 84, 112, 0.3); }

/* ---------- dialogs (shared with Studio) ---------- */

dialog {
  width: min(520px, calc(100vw - 24px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 24px;
  background: var(--surface); color: var(--text); box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); }
dialog[open] { animation: page-in 0.25s ease both; }
.modal { padding: 22px; display: grid; gap: 14px; }
.modal h3 { margin: 0; font-size: 19px; }
.modal p { margin: 0; color: var(--text-2); }
.modal .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.btn.danger-fill { background: var(--danger); color: #fff; border: 0; }

/* ---------- learning progress ---------- */

.tile-badge.seen {
  right: 8px; bottom: 8px; padding: 2px 7px 2px 5px; border-radius: 7px; gap: 3px;
  background: rgba(42, 212, 154, 0.92); color: #04261b; text-shadow: none; font-size: 11px;
}
.tile-badge.seen svg { width: 12px; height: 12px; stroke-width: 3; }

.progress-line { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 700; }
.progress-line .bar { flex: 1; max-width: 320px; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.25); overflow: hidden; }
.progress-line .bar i { display: block; height: 100%; border-radius: inherit; background: #fff; transition: width 0.6s ease; }

.link-danger { justify-self: center; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--text-3); text-decoration: underline; text-underline-offset: 3px; }
.link-danger:hover { color: var(--danger); }
.legal { margin: 0; text-align: center; font-size: 12.5px; color: var(--text-3); }
.legal a { text-decoration: underline; text-underline-offset: 3px; }
.auth-note a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- offline banner ---------- */

.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900; padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  text-align: center; font-size: 13px; font-weight: 700; background: #3a2a00; color: #ffd36b; border-bottom: 1px solid rgba(255, 211, 107, 0.3);
}
