/* =================================================================
   Amimo — editorial news reader
   Type: Fraunces (headlines) + Inter (UI/meta)
   Palette: cool paper, ink navy, rust accent, teal secondary
   ================================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --paper: #f2f4f3;
  --surface: #ffffff;
  --surface-2: #ebeeec;
  --ink: #16181d;
  --ink-soft: #52565f;
  --ink-faint: #8b8f97;
  --line: rgba(22, 24, 29, 0.12);
  --line-soft: rgba(22, 24, 29, 0.07);
  --rust: #b8441f;
  --rust-dark: #8f3417;
  --teal: #0f6a5e;
  --teal-dark: #0b4f46;
  --gold: #b3841a;
  --shadow: 0 1px 2px rgba(22,24,29,.04);
  --shadow-lift: 0 10px 24px rgba(22,24,29,.10);
  --radius: 10px;
  --radius-lg: 16px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

body.dark {
  --paper: #101114;
  --surface: #17181c;
  --surface-2: #1e2024;
  --ink: #eef0f2;
  --ink-soft: #b7bac0;
  --ink-faint: #7d818a;
  --line: rgba(238, 240, 242, 0.14);
  --line-soft: rgba(238, 240, 242, 0.08);
  --rust:  #1A73E8;
  --rust-dark: #046BF2;
  --teal: #3fb3a1;
  --teal-dark: #63c6b6;
  --gold: #d8ac4c;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-lift: 0 12px 28px rgba(0,0,0,.5);
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  padding-bottom: 64px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 50%;
  color: var(--ink); font-size: 1rem; cursor: pointer;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--surface-2); }

.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}
.wordmark.small { font-size: 1rem; }

/* ================= BOOT LOADER ================= */
/* Shown immediately on page load, before auth state is known.
   Hides only when Firebase Auth reports a definite signed-in/out state. */
.boot-loader {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .28s ease, visibility .28s ease;
}
.boot-loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-inner {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1rem;
}
.boot-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.boot-spinner {
  width: 30px; height: 30px;
  border-width: 3px;
}
.boot-text {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-weight: 500;
  min-height: 1.2em;
}

/* ================= HEADER ================= */
.site-header {
  position: sticky; top: 0; z-index: 500;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem;
  max-width: 1200px; margin: 0 auto;
  gap: 0.5rem;
}

.header-actions { display: flex; align-items: center; gap: 0.2rem; }

.place-btn {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--surface-2);
  border: none; border-radius: 30px;
  padding: 0.4rem 0.8rem;
  font-size: 0.72rem; font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  margin-left: 0.2rem;
}
.place-btn i { color: var(--rust); font-size: 0.75rem; }

.search-row {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  border-bottom: 0px solid transparent;
}
.search-row.open { max-height: 70px; border-bottom: 1px solid var(--line); }

.search-box {
  display: flex; align-items: center; gap: 0.6rem;
  max-width: 1200px; margin: 0 auto;
  padding: 0.6rem 1rem;
}
.search-box i.fa-search { color: var(--ink-faint); }
.search-box input {
  flex: 1; border: none; background: transparent;
  font-size: 1rem; color: var(--ink); outline: none;
  font-family: var(--sans);
}
.search-box input::placeholder { color: var(--ink-faint); }

.tabs {
  display: flex; gap: 1.4rem;
  overflow-x: auto;
  max-width: 1200px; margin: 0 auto;
  padding: 0 1rem;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-faint);
  font-size: 0.85rem; font-weight: 600;
  padding: 0.7rem 0.1rem;
  white-space: nowrap;
  cursor: pointer;
  display: flex; align-items: center; gap: 0.4rem;
}
.tab i { font-size: 0.78rem; }
.tab.active { color: var(--ink); border-bottom-color: var(--rust); }
.tab:hover { color: var(--ink); }

.progress-bar {
  height: 2px; width: 0%;
  background: var(--rust);
  transition: width .3s ease;
}

/* ================= LAYOUT ================= */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
}

.status-msg {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-soft);
}
.status-msg p { margin-top: 0.9rem; font-size: 0.9rem; }

.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--line);
  border-top-color: var(--rust);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= HERO ================= */
.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.6rem;
  padding-bottom: 1.8rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--line);
}

.hero-main { position: relative; border-radius: var(--radius-lg); overflow: hidden; }
.hero-main .hero-img-wrap { position: relative; width: 100%; height: 420px; aspect-ratio: auto; }
.hero-main img {
  width: 100%; height: 420px; object-fit: cover;
  background: var(--surface-2);
}
.hero-main .hero-overlay {
  position: absolute; inset: auto 0 0 0;
  background: linear-gradient(0deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.35) 60%, transparent 100%);
  padding: 2.5rem 1.4rem 1.2rem;
}
.hero-main .eyebrow { color: #ffd9c6; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.hero-main h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.18;
  color: #fff;
  margin: 0.5rem 0 0.6rem;
}
.hero-main a.hero-link { text-decoration: none; }
.hero-main .hero-meta { color: rgba(255,255,255,.78); font-size: 0.78rem; display: flex; gap: 0.9rem; }

.hero-list { display: flex; flex-direction: column; gap: 0; }
.hero-list-item {
  display: flex; gap: 0.9rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
}
.hero-list-item:first-child { padding-top: 0; }
.hero-list-item .num {
  font-family: var(--serif);
  font-size: 1.4rem; font-weight: 600;
  color: var(--ink-faint);
  min-width: 1.6rem;
}
.hero-list-item h3 {
  font-size: 0.94rem; font-weight: 600; line-height: 1.35;
  margin-bottom: 0.3rem;
}
.hero-list-item .src { font-size: 0.72rem; color: var(--ink-faint); }
.hero-list-item:hover h3 { color: var(--rust); }

/* ================= LIVE CHANNELS RAIL ================= */
.live-channels { margin: 0 0 2rem; }
.live-channels .rail-head h2 {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.5rem;
}
.live-channels .rail-head h2 i { color: #d6314a; font-size: 0.9rem; }
.live-channels-viewport {
  overflow: hidden; width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.live-channels-track {
  display: flex; gap: 1.1rem; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 0.3rem 0.1rem 0.6rem; scrollbar-width: none;
}
.live-channels-track::-webkit-scrollbar { display: none; }
.live-channel-chip {
  scroll-snap-align: start;
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  text-decoration: none; color: var(--ink); width: 76px;
}
.live-channel-chip .lc-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  position: relative;
}
.live-channel-chip .lc-icon::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 9px; height: 9px; border-radius: 50%; background: #d6314a;
  border: 2px solid var(--surface);
}
.live-channel-chip .lc-icon img { width: 100%; height: 100%; object-fit: cover; }
.live-channel-chip .lc-icon i { font-size: 1.2rem; color: var(--ink-faint); }
.live-channel-chip .lc-name {
  font-size: 0.7rem; font-weight: 600; text-align: center; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.live-channel-chip:hover .lc-icon { border-color: var(--rust); }

/* ================= FOLLOW TOPIC CHIP ================= */
#topicChipZone:not(:empty) { margin-bottom: 1rem; }
#topicChipZone .follow-topic-chip { margin-left: 0; }

.follow-topic-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: 0.76rem; font-weight: 600;
  padding: 0.35rem 0.8rem; border-radius: 20px; cursor: pointer;
  margin-left: 0.7rem;
}
.follow-topic-chip.following { background: var(--teal); border-color: var(--teal); color: #fff; }
.follow-topic-chip:hover { border-color: var(--teal); color: var(--teal); }
.follow-topic-chip.following:hover { color: #fff; }

/* ================= TRENDING RAIL (auto-scrolling, flat items) ================= */
.trending { margin-bottom: 2.2rem; }
.rail-head { margin-bottom: 0.8rem; display: flex; align-items: center; justify-content: space-between; }
.rail-head h2 {
  font-family: var(--serif);
  font-size: 1.3rem; font-weight: 600;
}

.trending-viewport {
  overflow: hidden;
  width: 100%;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.trending-track {
  display: flex; gap: 1.3rem;
  width: max-content;
  will-change: transform;
}
.trending-track.paused { animation-play-state: paused; }

.trend-item {
  flex: 0 0 210px;
  display: flex; flex-direction: column; gap: 0.55rem;
  text-decoration: none; color: var(--ink);
}
.trend-item .card-img-wrap {
  width: 210px; height: 130px; border-radius: 10px; aspect-ratio: auto;
}
.trend-item .card-title { font-size: 0.86rem; }
.trend-item .card-desc, .trend-item .card-actions { display: none; }
.trend-item .card-body { padding: 0; gap: 0.3rem; }

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.trending-track.auto-scroll {
  animation: marquee-scroll 50s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .trending-track.auto-scroll { animation: none; }
}

/* ================= SECTIONS + FEED LIST (Google News style rows) ================= */
.feed-section { margin-bottom: 0.4rem; }
.feed-section .section-title {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin-bottom: 0.3rem;
  font-family: var(--serif);
  font-size: 1.35rem; font-weight: 600;
  border-left: 3px solid var(--rust);
  padding-left: 0.7rem;
}

.feed-list, .card-grid {
  display: flex; flex-direction: column;
  width: 100%;
}

.feed-row, .news-card {
  display: flex; align-items: flex-start; gap: 1rem;
  width: 100%;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  transition: background .15s ease;
}
.feed-row:hover, .news-card:hover { background: var(--surface-2); }
.feed-row:hover .card-title, .news-card:hover .card-title { color: var(--rust); }
main .feed-row, main .news-card { margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem; width: calc(100% + 2rem); }

.card-img-wrap {
  position: relative;
  flex: 0 0 118px; width: 118px; height: 90px;
  border-radius: 10px; overflow: hidden;
  background: var(--surface-2);
}
.card-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .35s ease;
}
.card-img-wrap img.loaded { opacity: 1; }

.img-skel {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(110deg, var(--surface-2) 8%, var(--line-soft) 18%, var(--surface-2) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.img-skel span {
  font-family: var(--serif); font-weight: 600; font-size: 0.66rem;
  color: var(--ink-faint); text-align: center; padding: 0 0.4rem;
  line-height: 1.25;
}
@keyframes shimmer { to { background-position-x: -200%; } }

.card-cat-badge { display: none; }

.card-save-btn, .card-like-btn {
  position: static;
  width: 30px; height: 30px; border-radius: 50%;
  background: transparent;
  color: var(--ink-faint); border: 1px solid var(--line); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
}
.card-save-btn.saved { background: var(--rust); border-color: var(--rust); color: #fff; }
.card-save-btn:hover { border-color: var(--rust); color: var(--rust); }
.card-save-btn.saved:hover { color: #fff; }
.card-like-btn.liked { background: #d6314a; border-color: #d6314a; color: #fff; }
.card-like-btn:hover { border-color: #d6314a; color: #d6314a; }
.card-like-btn.liked:hover { color: #fff; }

.card-body { padding: 0; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; min-width: 0; }
.card-title {
  font-size: 0.95rem; font-weight: 600; line-height: 1.35;
  text-decoration: none; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: 0.8rem; color: var(--ink-soft); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  font-size: 0.74rem; color: var(--ink-faint);
}
.card-meta .src { font-weight: 600; color: var(--ink-soft); }
.card-meta .cat-dot { color: var(--rust); font-weight: 700; text-transform: uppercase; font-size: 0.66rem; letter-spacing: 0.03em; }
.card-actions { display: flex; gap: 0.5rem; margin-top: 0.15rem; align-items: center; }
.card-actions a {
  font-size: 0.76rem; font-weight: 600;
  color: var(--rust);
  text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.card-actions a:hover { text-decoration: underline; }
.card-actions .share-btn {
  font-size: 0.76rem; font-weight: 600; color: var(--ink-soft);
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.card-actions .share-btn:hover { color: var(--rust); }
.card-actions .icon-actions { margin-left: auto; display: flex; gap: 0.5rem; }
.card-actions button.remove-btn {
  font-size: 0.72rem; font-weight: 600;
  border-radius: 20px; padding: 0.35rem 0.75rem;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem;
}
.card-actions button.remove-btn:hover { border-color: #c0392b; color: #c0392b; }

/* -------- skeleton placeholder rows -------- */
.skeleton-row { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line-soft); }
.skeleton-thumb {
  flex: 0 0 118px; width: 118px; height: 90px; border-radius: 10px;
  background: linear-gradient(110deg, var(--surface-2) 8%, var(--line-soft) 18%, var(--surface-2) 33%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 0.6rem; padding-top: 0.2rem; }
.skeleton-line {
  height: 12px; border-radius: 6px;
  background: linear-gradient(110deg, var(--surface-2) 8%, var(--line-soft) 18%, var(--surface-2) 33%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w35 { height: 9px; width: 35%; margin-top: 0.3rem; }

/* ================= LOAD MORE / EMPTY ================= */
.load-more-zone { display: flex; justify-content: center; align-items: center; gap: 0.8rem; padding: 1.5rem 0; }
.btn-outline {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink); font-weight: 600; font-size: 0.85rem;
  padding: 0.6rem 1.4rem; border-radius: 30px; cursor: pointer;
}
.btn-outline:hover { border-color: var(--rust); color: var(--rust); }

.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--ink-faint); }
.empty-state i { font-size: 2rem; margin-bottom: 0.8rem; color: var(--ink-faint); }
.empty-state h3 { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); margin-bottom: 0.4rem; }

/* ================= SAVED VIEW ================= */
.section-head { margin-bottom: 1.4rem; }
.section-head h1 { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; }
.section-head p { color: var(--ink-faint); font-size: 0.85rem; margin-top: 0.2rem; }

/* ================= FOOTER ================= */
footer {
  max-width: 1200px; margin: 1rem auto 0;
  padding: 1.6rem 1rem 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 0.8rem;
}
footer .fine { margin-top: 0.3rem; font-size: 0.72rem; }

/* ================= BOTTOM NAV ================= */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: none;
  justify-content: space-around;
  padding: 6px 0 8px;
  z-index: 600;
}
.nav-item {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-faint); font-size: 0.62rem; font-weight: 600;
  padding: 4px 12px;
}
.nav-item i { font-size: 1.15rem; }
.nav-item.active { color: var(--rust); }

.nav-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: var(--ink-soft);
  overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-item.active .nav-avatar { border-color: var(--rust); }

@media (max-width: 780px) {
  .bottom-nav { display: flex; }
  body { padding-bottom: 70px; }
  .hero { grid-template-columns: 1fr; }
  .hero-main img, .hero-main .hero-img-wrap { height: 260px; }
}

/* ================= SIDE MENU ================= */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  z-index: 800; display: none;
}
.overlay.show { display: block; }

.side-menu {
  position: fixed; top: 0; left: -320px; width: 300px; height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 900;
  padding: 1.2rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  transition: left .28s cubic-bezier(.32,.72,0,1);
  overflow-y: auto;
}
.side-menu.open { left: 0; }
.menu-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.menu-link {
  display: flex; align-items: center; gap: 0.8rem;
  background: none; border: none; text-align: left;
  padding: 0.75rem 0.5rem; border-radius: 8px;
  color: var(--ink); font-size: 0.9rem; font-weight: 500; cursor: pointer;
}
.menu-link:hover { background: var(--surface-2); }
.menu-divider { height: 1px; background: var(--line); margin: 0.6rem 0; }
.menu-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); margin: 0 0 0.4rem 0.5rem; font-weight: 700; }
.menu-select {
  width: 100%; padding: 0.6rem 0.7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 0.88rem;
}
.menu-row { display: flex; justify-content: space-between; align-items: center; padding: 0 0.5rem; font-size: 0.9rem; }
.menu-fine { font-size: 0.75rem; color: var(--ink-faint); padding: 0 0.5rem; margin-top: 0.4rem; line-height: 1.5; }
.menu-legal-links {
  margin-top: 1rem; padding: 0 0.5rem; display: flex; gap: 0.5rem;
  font-size: 0.75rem; color: var(--ink-faint);
}
.menu-legal-links a { color: var(--ink-faint); text-decoration: underline; }
.menu-legal-links a:hover { color: var(--rust); }

/* ================= SIGN-IN BOTTOM SHEET ================= */
.auth-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 950;
}
.auth-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 1.8rem 1.6rem 2rem;
  z-index: 960;
  max-width: 460px; margin: 0 auto;
  box-shadow: var(--shadow-lift);
  text-align: center;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
}
.auth-sheet.open { transform: translateY(0); }
.auth-sheet-close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--ink-soft); cursor: pointer;
}
.auth-sheet-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 0.8rem;
  background: var(--surface-2); color: var(--rust);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.auth-sheet h2 { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; margin-bottom: 0.4rem; }
.auth-sheet p { color: var(--ink-faint); font-size: 0.85rem; margin-bottom: 1.2rem; line-height: 1.5; }
.auth-sheet .auth-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.6rem; text-decoration: none; }
.auth-sheet-later {
  background: none; border: none; color: var(--ink-faint);
  font-size: 0.82rem; font-weight: 600; cursor: pointer; margin-top: 0.4rem;
}
.auth-sheet-later:hover { color: var(--ink); }

.switch { position: relative; display: inline-block; width: 40px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 30px; transition: .2s; }
.slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px; background: var(--ink-faint); border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--rust); border-color: var(--rust); }
.switch input:checked + .slider::before { transform: translateX(16px); background: #fff; }

/* ================= TOAST ================= */
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1.2rem; border-radius: 30px;
  font-size: 0.82rem; z-index: 1000;
  box-shadow: var(--shadow-lift);
}
body.dark .toast { background: var(--surface-2); color: var(--ink); }

/* ================= PROFILE PAGE ================= */
.profile-hero {
  display: flex; align-items: center; gap: 1.2rem;
  padding: 1.6rem 0 1.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.6rem;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.7rem; font-weight: 600;
  color: var(--rust); overflow: hidden; flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info h1 { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.profile-name-row { display: flex; align-items: center; gap: 0.4rem; }
.profile-name-row .icon-btn { width: 30px; height: 30px; font-size: 0.8rem; color: var(--ink-faint); }
.name-edit-field { max-width: 260px; margin-bottom: 0.3rem; padding: 0.4rem 0.6rem; font-size: 1rem; }
.member-since { color: var(--ink-faint); font-size: 0.76rem; margin-top: 0.1rem; }
.profile-info p { color: var(--ink-faint); font-size: 0.85rem; margin-top: 0.2rem; }
.profile-stats { display: flex; gap: 1.4rem; margin-top: 0.6rem; font-size: 0.78rem; color: var(--ink-soft); }
.profile-stats b { color: var(--ink); font-family: var(--serif); font-size: 1rem; }

.auth-card {
  max-width: 380px; margin: 2rem auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.8rem; text-align: center;
}
.auth-card i.fa-user-circle { font-size: 2.4rem; color: var(--rust); margin-bottom: 0.6rem; }
.auth-card h2 { font-family: var(--serif); font-size: 1.3rem; margin-bottom: 0.4rem; }
.auth-card p { color: var(--ink-faint); font-size: 0.85rem; margin-bottom: 1.2rem; }
.auth-field {
  width: 100%; padding: 0.7rem 0.9rem; margin-bottom: 0.7rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: 0.9rem;
  font-family: var(--sans);
}
.auth-btn {
  width: 100%; padding: 0.75rem; border-radius: 30px; border: none;
  background: var(--rust); color: #fff; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; margin-top: 0.3rem;
  position: relative; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.auth-btn:hover { background: var(--rust-dark); }
.auth-btn.google { background: var(--ink); }
.auth-btn:disabled { opacity: 0.75; cursor: default; }
.btn-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
  position: absolute; left: 50%; top: 50%; margin: -8px 0 0 -8px;
}
.auth-forgot {
  display: block; margin: 0.6rem auto 0; background: none; border: none;
  color: var(--ink-faint); font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.auth-forgot:hover { color: var(--rust); }
.auth-switch { font-size: 0.8rem; color: var(--ink-faint); margin-top: 1rem; }
.auth-switch button { background: none; border: none; color: var(--rust); font-weight: 600; cursor: pointer; }
.auth-error { color:  #1A73E8; font-size: 0.8rem; margin: -0.3rem 0 0.7rem; text-align: left; }
.auth-divider { display: flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0; color: var(--ink-faint); font-size: 0.75rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.profile-tabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; overflow-x: auto; }
.profile-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--ink-faint); font-weight: 600; font-size: 0.86rem;
  padding: 0.7rem 0.1rem; cursor: pointer; white-space: nowrap;
}
.profile-tab.active { color: var(--ink); border-bottom-color: var(--rust); }

.history-list { display: flex; flex-direction: column; gap: 0.5rem; }
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0.9rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.86rem;
}
.history-item button { background: none; border: none; color: var(--ink-faint); cursor: pointer; }
.history-item button:hover { color: #046BF2; }
.history-item .h-text { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-soft); }
.history-item .h-text i { color: var(--ink-faint); }

.interest-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.interest-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--line);
  padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
}
.interest-chip.suggested { color: var(--ink-faint); border-style: dashed; cursor: pointer; }
.interest-chip.suggested:hover { border-color: var(--teal); color: var(--teal); }
.interest-chip .remove-x { cursor: pointer; color: var(--ink-faint); }
.interest-chip .remove-x:hover { color: #c0392b; }

.signout-row { margin-top: 1.6rem; text-align: center; }
.signout-btn { background: none; border: 1px solid var(--line); color: var(--ink-soft); padding: 0.55rem 1.2rem; border-radius: 30px; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.signout-btn:hover { border-color: #046BF2; color:  #1A73E8; }

/* ================= CHANNEL CARD ================= */
.channel-card .card-img-wrap {
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}
.channel-card .card-img-wrap img {
  object-fit: cover;
}
.channel-icon-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rust), var(--rust-dark));
  color: #fff;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
}
.channel-live-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #d6314a;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px rgba(214, 49, 74, 0.2);
}

/* ================= LEGAL / ABOUT PAGES ================= */
.legal-page { max-width: 720px; }
.legal-page h1 { font-family: var(--serif); font-size: 1.8rem; font-weight: 600; margin-bottom: 0.3rem; }
.legal-page .legal-updated { color: var(--ink-faint); font-size: 0.82rem; margin-bottom: 1.4rem; }
.legal-page h2 { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin: 1.6rem 0 0.6rem; }
.legal-page p { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.65; margin-bottom: 0.8rem; }
.legal-page a { color: var(--rust); text-decoration: underline; }
.legal-list { padding-left: 1.2rem; margin-bottom: 0.8rem; }
.legal-list li { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.65; margin-bottom: 0.5rem; }

@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
  .card-body { padding: 0.7rem 0.8rem 0.8rem; }
  .card-desc { display: none; }
  .trend-chip { flex-basis: 200px; }
}