@font-face {
  font-family: IRANSansWeb;
  src: url("./assets/fonts/iransans_regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: IRANSansWeb;
  src: url("./assets/fonts/iransans_medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: IRANSansWeb;
  src: url("./assets/fonts/iransans_demibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: IRANSansWeb;
  src: url("./assets/fonts/iransans_bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: IRANSansWeb;
  src: url("./assets/fonts/iransans_extrabold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8f9fa;
  --primary: #0a6b8d;
  --primary-soft: #d6eaf5;
  --secondary: #e3f2fd;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --seek-track: #e6edf4;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  --content-scale: 1;
}

* { box-sizing: border-box; }

html {
  background: #e8eef2;
  color: var(--text);
  font-family: IRANSansWeb, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0, #ffffff 0, #eef5f8 38%, #dfe8ed 100%);
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
  font-variant-numeric: lining-nums;
}

button { -webkit-tap-highlight-color: transparent; }

.phone-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 24px 80px rgba(15, 23, 42, 0.18);
  touch-action: manipulation;
}

.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  background: rgba(248, 249, 250, 0.92);
  backdrop-filter: blur(18px);
}

.top-app-bar h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.icon-button {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 22px;
}

.badge-button small {
  position: absolute;
  top: 6px;
  left: 4px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  line-height: 18px;
}

.screen {
  min-height: calc(100dvh - 72px);
  padding: 12px 16px 178px;
  outline: none;
}

.phone-shell.auth-mode .top-app-bar,
.phone-shell.auth-mode .bottom-bar { display: none; }

.phone-shell.auth-mode .screen {
  min-height: 100dvh;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

.login-screen {
  display: flex;
  min-height: 100dvh;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 16px);
  overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top)) 0 calc(18px + env(safe-area-inset-bottom));
  background: #f8f9fa;
  text-align: center;
}

.login-logo-wrap {
  display: grid;
  width: clamp(112px, 34vw, 160px);
  height: clamp(112px, 34vw, 160px);
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, #e3f2fd 0, rgba(227, 242, 253, 0) 72%);
}

.login-logo {
  width: clamp(78px, 24vw, 112px);
  height: clamp(78px, 24vw, 112px);
  border-radius: clamp(20px, 6vw, 28px);
  box-shadow: 0 8px 18px rgba(10, 107, 141, 0.2);
}

.login-screen h1 {
  margin: clamp(8px, 2vh, 16px) 0 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
}

.login-screen p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  width: 100%;
  max-width: 382px;
  gap: 16px;
  margin-top: clamp(8px, 2vh, 16px);
}

.input-field {
  width: 100%;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  color: var(--text);
  direction: ltr;
  outline: none;
  padding: 0 16px;
  text-align: left;
}

.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(10, 107, 141, 0.08); }

.phone-field {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  direction: ltr;
}

.phone-prefix {
  display: flex;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #d1d5db;
  color: var(--text);
  font-weight: 700;
}

.phone-field input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 14px;
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.otp-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(5px, 1.7vw, 8px);
  width: 100%;
  max-width: 342px;
  justify-self: center;
  direction: ltr;
}

.otp-cell {
  width: 100%;
  min-width: 0;
  height: clamp(42px, 12.4vw, 48px);
  border: 1px solid var(--border);
  border-radius: clamp(10px, 3vw, 12px);
  background: white;
  text-align: center;
  font-size: clamp(17px, 5vw, 20px);
  font-weight: 700;
  padding: 0;
  direction: ltr;
  unicode-bidi: plaintext;
}

.login-link {
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 500;
}

.login-error {
  color: #dc2626;
  font-size: 12px;
}

.terms-text {
  margin-top: clamp(6px, 2vh, 18px);
  padding-bottom: 0;
  color: var(--muted);
  font-size: 11px;
}

.login-screen:has(.otp-grid) .login-logo-wrap,
.login-screen.otp-mode .login-logo-wrap {
  width: clamp(92px, 28vw, 130px);
  height: clamp(92px, 28vw, 130px);
}

.login-screen:has(.otp-grid) .login-logo,
.login-screen.otp-mode .login-logo {
  width: clamp(66px, 20vw, 92px);
  height: clamp(66px, 20vw, 92px);
  border-radius: clamp(18px, 5vw, 24px);
}

.login-screen:has(.otp-grid) .login-form,
.login-screen.otp-mode .login-form { gap: 12px; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(15, 23, 42, 0.28);
}

.drawer.open { display: block; }

.drawer-panel {
  width: 280px;
  max-width: 82vw;
  height: 100%;
  padding: calc(18px + env(safe-area-inset-top)) 10px 18px;
  background: white;
  box-shadow: -24px 0 48px rgba(15, 23, 42, 0.18);
}

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

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.drawer-profile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.drawer-panel button {
  width: 100%;
  margin: 2px 0;
  padding: 13px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #334155;
  text-align: right;
  font-weight: 700;
}

.drawer-panel button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.hero-slider {
  display: grid;
  gap: 8px;
}

.banner-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 16px;
  scrollbar-width: none;
}

.banner-track::-webkit-scrollbar { display: none; }

.banner-card {
  position: relative;
  height: 180px;
  overflow: hidden;
  scroll-snap-align: start;
  background: linear-gradient(135deg, var(--primary), #38bdf8);
}

.banner-card img,
.media-card img,
.product-image img,
.article-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

.image-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 80px;
  place-items: center;
  background: linear-gradient(135deg, #e3f2fd, #f8fafc);
}

.image-placeholder::after {
  content: "تصویر";
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.dots { display: flex; justify-content: center; gap: 4px; height: 24px; align-items: center; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(30, 41, 59, 0.2); }
.dot.active { background: var(--primary); }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px 0;
}

.quick-item {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.quick-icon {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border-radius: 16px;
  background: var(--secondary);
  font-size: 30px;
  box-shadow: inset 0 0 0 1px rgba(10, 107, 141, 0.08);
}

.quick-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 8px;
}

.section-header h2 {
  margin: 0;
  font-size: 20px;
}

.section-header button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

.horizontal-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: 16px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.horizontal-list.compact { grid-auto-columns: 220px; }
.horizontal-list::-webkit-scrollbar { display: none; }

.card,
.product-card,
.empty-card,
.detail-card {
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.media-card { scroll-snap-align: start; }

.media-image { position: relative; height: 140px; background: var(--secondary); }
.video-image { height: 160px; }
.podcast-image {
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  background: var(--secondary);
}

.podcast-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.play-bubble {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
}

.duration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 10px;
}

.card-body { padding: 12px; }
.card h3, .product-card h3, .article-card h3 { margin: 0; font-size: 15px; line-height: 1.5; }
.card p, .product-card p, .article-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.product-card p {
  display: -webkit-box;
  max-height: 58px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.meta { margin-top: 8px; color: var(--primary); font-size: 11px; }

.podcast-card { padding: 8px; text-align: center; }
.podcast-card h3 { margin-top: 8px; }

.article-list,
.product-list { display: grid; gap: 12px; }

.article-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  align-items: center;
  padding: 8px;
}

.article-image,
.favorite-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--secondary);
}

.podcast-list-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  padding: 8px;
}

.podcast-list-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--secondary);
}

.course-player {
  display: grid;
  gap: 14px;
}

.course-hero {
  height: 210px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--secondary);
}

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

.course-player h2,
.course-player p {
  margin: 0;
  text-align: right;
}

.track-player-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}

.track-player-card h3 { margin: 2px 0 10px; }

.lesson-list {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
}

.lesson-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 16px;
  background: white;
  color: var(--text);
  text-align: right;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.lesson-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.lesson-item.locked {
  color: var(--faint);
  background: #f8fafc;
}

.lesson-play {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.lesson-play .ic { width: 18px; height: 18px; }

.lesson-item.active .lesson-play { background: var(--primary); color: #ffffff; }
.lesson-item.locked .lesson-play { background: #f1f5f9; color: var(--faint); }

.lesson-title { font-weight: 700; }
.lesson-duration { color: var(--muted); font-size: 11px; }

.podcast-list-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.article-card img { border-radius: 8px; background: var(--secondary); }

.favorite-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: center;
  padding: 8px;
}

.favorite-card h3 { margin: 4px 0 0; font-size: 15px; }
.favorite-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.text-settings-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.text-settings-card h2,
.text-settings-card p { margin: 0; }
.text-settings-card p { color: var(--muted); font-size: 13px; }
.text-settings-card output { color: var(--primary); font-size: 22px; font-weight: 800; }
.text-settings-card input { width: 100%; accent-color: var(--primary); direction: ltr; }

.detail-content,
.course-player > p { font-size: calc(1rem * var(--content-scale)); }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 -16px 8px;
  background: white;
  border-block: 1px solid var(--border);
}

.tab {
  padding: 12px 8px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: white;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.category-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 8px -16px 12px;
  padding: 0 16px 8px;
  scrollbar-width: none;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.product-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 16px;
  border-radius: 24px;
}

.product-image {
  position: relative;
  height: 90px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--secondary);
}

.favorite {
  float: left;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.favorite.active { color: #ef4444; }

.outline-button,
.primary-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border-radius: 12px;
  font-weight: 700;
}

.course-status {
  margin-top: 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.outline-button {
  border: 1px solid var(--primary);
  background: white;
  color: var(--primary);
}

.primary-button {
  border: 0;
  background: var(--primary);
  color: white;
}

.detail-card { padding: 14px; }
.detail-card .primary-button,
.detail-card .outline-button { margin-top: 10px; }
.detail-cover { width: 100%; max-height: 260px; object-fit: cover; border-radius: 18px; background: var(--secondary); }
.detail-content { color: #334155; font-size: 14px; }
.detail-content img { max-width: 100%; height: auto; border-radius: 14px; }
.detail-content a { color: var(--primary); }

/* ------- Profile (matches Android app) ------- */
.profile-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px 20px;
}

.profile-avatar {
  display: grid;
  width: 100px;
  height: 100px;
  place-items: center;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #ffffff;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(10, 107, 141, 0.28);
}

.profile-avatar-icon { font-size: 44px; }
.profile-name { margin: 16px 0 2px; font-size: 22px; font-weight: 700; }
.profile-email { margin: 0; color: var(--muted); font-size: 14px; }

.profile-info-card {
  width: 100%;
  margin-top: 24px;
  padding: 4px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.profile-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}

.profile-info-row + .profile-info-row { border-top: 1px solid #eef2f7; }
.profile-info-row span { color: var(--muted); font-size: 13px; }
.profile-info-row strong { font-size: 15px; }

.mentor-entry {
  display: flex;
  width: 100%;
  gap: 14px;
  align-items: center;
  margin-top: 24px;
  padding: 18px 16px;
  border: 1px solid rgba(10, 107, 141, 0.35);
  border-radius: 16px;
  background: var(--primary-soft);
  box-shadow: 0 10px 26px rgba(10, 107, 141, 0.14);
  text-align: start;
}

.mentor-entry-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 22px;
}

.mentor-entry-text { display: grid; flex: 1; min-width: 0; }
.mentor-entry-text strong { font-size: 16px; font-weight: 700; color: #08415a; }
.mentor-entry-text small { color: rgba(8, 65, 90, 0.72); font-size: 12px; }

.mentor-entry-badge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.mentor-entry-arrow { color: var(--primary); font-size: 22px; line-height: 1; }

.profile-logout {
  width: 100%;
  height: 56px;
  margin-top: 28px;
  border: 0;
  border-radius: 16px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 16px;
  font-weight: 700;
}

/* ------- Consultations (matches Android app) ------- */
.consult-page { display: grid; gap: 14px; }
.consult-section-title { margin: 0; font-size: 16px; font-weight: 700; }
.consult-list { display: grid; gap: 14px; }

.consult-card {
  display: grid;
  width: 100%;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
  text-align: start;
}

.consult-card.is-active { border-color: rgba(10, 107, 141, 0.3); }
.consult-card.is-expired { border-color: rgba(148, 163, 184, 0.5); }

.consult-image {
  display: block;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--secondary);
}

.consult-image img,
.consult-image .image-placeholder { width: 100%; height: 100%; object-fit: cover; }

.consult-body { display: grid; min-width: 0; gap: 6px; }
.consult-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 15px;
  font-weight: 700;
}

.consult-status { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.consult-status.on { color: #31c48d; }
.consult-status.off { color: #ef4444; }
.consult-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.consult-expire { color: var(--muted); font-size: 12px; }

.consult-side { display: grid; gap: 6px; justify-items: center; }

.consult-badge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.consult-arrow { color: var(--primary); font-size: 22px; line-height: 1; }

.consult-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.consult-state-icon { font-size: 56px; opacity: 0.45; }
.consult-state-error { color: #ef4444; }

/* ------- Chat (matches Android app) ------- */
.chat-page { display: flex; flex-direction: column; gap: 10px; }
.chat-status { font-size: 12px; font-weight: 700; }
.chat-status.on { color: #31c48d; }
.chat-status.off { color: #ef4444; }

.chat-bubbles {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 260px;
  max-height: calc(100dvh - 330px);
  overflow-y: auto;
  padding: 4px 2px 12px;
}

.chat-empty { padding: 40px 12px; color: var(--muted); text-align: center; }

.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-start; }
.chat-bubble-row.mentor { justify-content: flex-end; }

.chat-bubble {
  max-width: min(82%, 310px);
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 16px 16px 4px 16px;
  background: #eef2f9;
  color: var(--text);
  font-size: 15px;
  line-height: 1.9;
  overflow: hidden;
}

.mine .chat-bubble {
  border-radius: 16px 16px 16px 4px;
  background: var(--primary);
  color: #ffffff;
}

.mentor .chat-bubble { border-color: rgba(148, 163, 184, 0.4); }

.chat-bubble img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; }
.chat-bubble audio { width: 220px; max-width: 100%; }
.chat-bubble p { margin: 6px 0 0; }
.chat-bubble a { color: inherit; font-weight: 700; }
.chat-bubble time { display: block; margin-top: 4px; color: inherit; font-size: 10px; opacity: 0.7; }

.chat-expired {
  padding: 14px;
  border-radius: 12px;
  background: var(--secondary);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.chat-composer {
  position: sticky;
  bottom: 8px;
  z-index: 35;
  display: grid;
  grid-template-columns: 40px 1fr 46px 46px;
  gap: 6px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.recording-state { grid-column: 1 / -1; color: #ef4444; font-size: 12px; font-weight: 700; }

.chat-input {
  min-width: 0;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: 0;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}

.composer-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary);
  font-size: 18px;
}

.composer-icon.mic { width: 46px; height: 46px; }
.composer-icon.recording { background: #ef4444; color: #ffffff; }

.composer-send {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 18px;
}

.video-player {
  width: 100%;
  margin-top: 14px;
  border-radius: 14px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: #020617;
}

.video-frame .video-player {
  display: block;
  width: 100%;
  height: 100%;
  margin-top: 0;
  border-radius: 0;
  object-fit: contain;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.resume-hint {
  display: inline-flex;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.secure-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 14px;
  background: #020617;
  user-select: none;
}

.secure-video-wrap .video-player {
  display: block;
  width: 100%;
  height: 100%;
  margin-top: 0;
  border-radius: 0;
  object-fit: contain;
}

.secure-video::-webkit-media-controls-fullscreen-button,
.secure-video::-webkit-media-controls-picture-in-picture-button {
  display: none !important;
}

.video-fullscreen-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(8px);
  color: white;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.video-fullscreen-btn .ic { width: 20px; height: 20px; }

.video-fullscreen-btn:hover {
  opacity: 1;
  background: rgba(2, 6, 23, 0.75);
}

.video-fullscreen-btn:active { transform: scale(0.9); }

.secure-video-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.secure-video-wrap:fullscreen .video-player {
  width: 100%;
  height: 100%;
  margin-top: 0;
  object-fit: contain;
}

.secure-video-wrap:fullscreen .video-watermark-layer {
  position: absolute;
  inset: 0;
}

.secure-video-wrap:fullscreen .video-fullscreen-btn {
  top: 18px;
  left: 18px;
}

.secure-video-wrap:fullscreen .video-watermark {
  font-size: 16px;
}

.video-watermark-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.video-watermark {
  position: absolute;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.34);
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transform-origin: center center;
  animation: video-watermark-orbit 22s linear infinite;
}

.wm-1 { top: 10%; right: 8%; animation-delay: 0s; }
.wm-2 { top: 24%; right: 58%; animation-delay: -3s; opacity: 0.68; }
.wm-3 { top: 46%; right: 18%; animation-delay: -6s; opacity: 0.62; }
.wm-4 { top: 66%; right: 66%; animation-delay: -9s; opacity: 0.58; }
.wm-5 { top: 78%; right: 28%; animation-delay: -12s; opacity: 0.64; }
.wm-6 { top: 36%; right: 78%; animation-delay: -15s; opacity: 0.55; }
.wm-7 { top: 58%; right: 44%; animation-delay: -18s; opacity: 0.6; }
.wm-8 { top: 15%; right: 34%; animation-delay: -21s; opacity: 0.56; }

@keyframes video-watermark-orbit {
  0% { transform: translate(0, 0) rotate(-18deg); }
  20% { transform: translate(-42px, 28px) rotate(16deg); }
  40% { transform: translate(36px, 64px) rotate(-10deg); }
  60% { transform: translate(-18px, -34px) rotate(22deg); }
  80% { transform: translate(48px, -12px) rotate(-26deg); }
  100% { transform: translate(0, 0) rotate(342deg); }
}

.empty-card {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.loader {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--primary);
  font-weight: 700;
}

.bottom-bar {
  position: fixed;
  right: 50%;
  bottom: 12px;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr 56px 1fr;
  align-items: end;
  width: min(calc(100% - 32px), 398px);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  transform: translateX(50%);
  border-radius: 28px;
  background: white;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.16);
}

.bottom-bar.no-store {
  grid-template-columns: repeat(3, 1fr);
}

.bottom-item {
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 6px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
}

.bottom-item.active { color: var(--primary); }
.nav-icon-img { width: 22px; height: 22px; object-fit: contain; opacity: 0.55; }
.bottom-item.active .nav-icon-img { filter: sepia(1) saturate(7) hue-rotate(155deg) brightness(0.65); opacity: 1; }

.store-fab {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: -22px auto 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 18px rgba(10, 107, 141, 0.32);
  font-size: 24px;
}

.store-fab[hidden] { display: none; }

.store-fab img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: 104px;
  z-index: 80;
  width: min(calc(100% - 32px), 398px);
  padding: 12px 14px;
  transform: translateX(50%);
  border-radius: 16px;
  background: #0f172a;
  color: white;
  font-size: 13px;
  box-shadow: var(--shadow);
}

.ic {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.audio-shell {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  background: linear-gradient(165deg, #ffffff 0%, #f4fafe 100%);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.audio-el { display: none; }

.audio-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.audio-badge {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--primary) 0%, #0f9bc2 100%);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(10, 107, 141, 0.28);
  overflow: hidden;
}

.audio-badge .ic { width: 26px; height: 26px; }

.eq-bar {
  position: absolute;
  bottom: 10px;
  width: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.92);
  transform-origin: bottom;
  opacity: 0;
  transition: opacity 0.25s ease;
  animation: audioEq 1s ease-in-out infinite;
}

.eq-bar:nth-of-type(1) { inset-inline-start: 40%; height: 7px; }
.eq-bar:nth-of-type(2) { inset-inline-start: 47%; height: 11px; animation-delay: 0.16s; }
.eq-bar:nth-of-type(3) { inset-inline-start: 54%; height: 5px; animation-delay: 0.32s; }

.audio-shell.playing .eq-bar { opacity: 1; }

@keyframes audioEq {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1.15); }
}

.audio-head {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.audio-title {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-sub {
  font-size: 12px;
  color: var(--muted);
}

.audio-download {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.audio-download:active { transform: scale(0.92); }

.audio-download .ic:last-child { display: none; }

.audio-download.downloaded {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #059669;
}

.audio-download.downloaded .ic:last-child { display: block; }
.audio-download.downloaded .ic:first-child { display: none; }

.audio-progress {
  display: grid;
  gap: 6px;
}

.audio-seek {
  width: 100%;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  border-radius: 999px;
  background: var(--seek-track);
  outline: none;
  cursor: pointer;
}

.audio-seek::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 999px;
  background: transparent;
}

.audio-seek::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -2px;
  appearance: none;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(10, 107, 141, 0.4);
  transition: transform 0.15s ease;
}

.audio-seek::-webkit-slider-thumb:hover { transform: scale(1.12); }

.audio-seek::-moz-range-track {
  height: 16px;
  border-radius: 999px;
  background: transparent;
}

.audio-seek::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  background: var(--primary);
}

.audio-seek:focus-visible { box-shadow: 0 0 0 3px rgba(10, 107, 141, 0.22); }

.audio-times {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.audio-time {
  min-width: 34px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.audio-sep { color: var(--faint); font-size: 12px; }

.audio-meta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-transport {
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-center {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.audio-actions {
  position: absolute;
  inset-inline-end: 0;
  display: flex;
  gap: 8px;
  align-items: center;
}

.audio-toggle {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--primary) 0%, #0f9bc2 100%);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(10, 107, 141, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, filter 0.2s ease;
}

.audio-toggle:active { transform: scale(0.92); }

.audio-toggle .ic { width: 28px; height: 28px; }

.audio-toggle.playing { filter: saturate(1.15) brightness(1.05); }

.audio-toggle .ic-pause { display: none; }
.audio-toggle.playing .ic-play { display: none; }
.audio-toggle.playing .ic-pause { display: block; }

.audio-skip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--primary);
}

.audio-skip:active { background: var(--primary-soft); }

.audio-skip .ic { width: 24px; height: 24px; }
.audio-skip b { font-size: 11px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

.audio-rate {
  display: grid;
  min-width: 48px;
  height: 40px;
  padding: 0 12px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.audio-rate.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 14px;
}

.page-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.page-head span {
  color: var(--muted);
  font-size: 13px;
}

.download-list {
  display: grid;
  gap: 10px;
}

.download-item {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 16px;
  background: white;
}

.download-play {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: white;
}

.download-play .ic { width: 20px; height: 20px; }

.download-delete {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.download-delete:active { background: #f1f5f9; }

.download-delete .ic { width: 18px; height: 18px; }

.download-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.download-info strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-info span {
  color: var(--muted);
  font-size: 12px;
}

.download-player {
  display: grid;
  gap: 14px;
}

.download-player .audio-shell[data-standalone="1"] {
  margin-top: 0;
}

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(10px);
}

.install-modal[hidden] { display: none; }

.install-card {
  width: min(100%, 340px);
  padding: 24px;
  border-radius: 28px;
  background: white;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  text-align: center;
}

.install-card img {
  width: 76px;
  height: 76px;
  border-radius: 20px;
}

.install-card h2 {
  margin: 14px 0 8px;
  font-size: 20px;
}

.install-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 360px) {
  .screen { padding-inline: 12px; }
  .quick-icon { width: 58px; height: 58px; }
  .product-card { grid-template-columns: 118px 1fr; gap: 12px; padding: 12px; }
  .product-image { height: 84px; }
}

@media (min-width: 700px) {
  .phone-shell { min-height: min(100dvh, 920px); }
}
