*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color-scheme: dark;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
:root[data-theme="light"] body { color-scheme: light; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Boot loader */
.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.boot-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-spinner { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; }
.boot-spinner svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 16px var(--brand-accent-tint-strong);
}
.brand-dot { color: var(--accent); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: 8px;
}
.nav-link {
  position: relative;
  height: 68px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
  transition: color 0.15s ease;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
}

.header-spacer { flex: 1; }

.header-search {
  position: relative;
  width: 240px;
  display: flex;
  align-items: center;
}
.header-search input {
  width: 100%;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 34px 0 36px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}
.header-search input:focus { border-color: var(--accent); }
.header-search .search-ico {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}
.header-search .search-kbd {
  position: absolute;
  right: 9px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  line-height: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--line); }
.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
}

.lang-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
}
.lang-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover { background: var(--surface2); border-color: var(--brand-accent-border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.btn-primary:hover { background: var(--brand-accent-hover); border-color: transparent; }
.btn-ghost { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.16); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 3px 12px 3px 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.user-pill:hover { border-color: var(--accent); }
.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-accent-tint);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}

/* Container */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* Hero (matches FEMUTSU full-bleed fade) */
.hero {
  position: relative;
  min-height: 490px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #141418;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 22%;
  transform: scale(1.02);
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(16, 16, 18, 0.86) 38%, rgba(16, 16, 18, 0.25) 78%, rgba(16, 16, 18, 0.45) 100%),
    linear-gradient(180deg, rgba(16, 16, 18, 0.15) 0%, rgba(16, 16, 18, 0.3) 65%, var(--bg) 100%);
}
:root[data-theme="light"] .hero-scrim {
  background:
    linear-gradient(90deg, rgba(248, 246, 247, 0.96) 0%, rgba(248, 246, 247, 0.82) 40%, rgba(248, 246, 247, 0.18) 80%),
    linear-gradient(180deg, rgba(248, 246, 247, 0.05) 0%, var(--bg) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 52px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.hero-main { max-width: 580px; }
.dub-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hero-title {
  margin: 0 0 10px;
  font-size: clamp(32px, 4.2vw, 48px);
  line-height: 1.1;
  font-weight: 800;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
.hero-desc {
  margin: 0 0 24px;
  color: color-mix(in srgb, var(--text) 82%, transparent);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-corner {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.hero-corner::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent);
}

/* Genre strip */
.tagline { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.genre-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 34px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pill:hover { color: var(--text); border-color: var(--brand-accent-border); }
.pill.active {
  color: var(--text);
  background: var(--brand-accent-tint);
  border-color: var(--accent);
}

/* Section headers & Poster Grid */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 16px;
}
.section-head h2 { margin: 0; font-size: 24px; font-weight: 800; }
.section-link { color: var(--muted); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.section-link:hover { color: var(--accent); }

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 20px;
}
.anime-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  group: true;
}
.poster-box {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.anime-card:hover .poster-box {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px var(--shadow);
}
.poster-box img { width: 100%; height: 100%; object-fit: cover; }
.poster-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  background: linear-gradient(145deg, var(--surface), var(--surface2));
}
.ep-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(16, 16, 18, 0.85);
  color: #fff;
  backdrop-filter: blur(6px);
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.score-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
}
.card-title { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.card-sub { color: var(--muted); font-size: 12.5px; }

/* Catalog Layout */
.catalog-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.filter-panel {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 88px; resize: vertical; }

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

/* Anime Detail */
.detail-banner {
  position: relative;
  height: 320px;
  background-size: cover;
  background-position: center 25%;
  background-color: var(--surface);
}
.detail-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 16, 18, 0.15) 0%, var(--bg) 100%);
}
.detail-wrap { margin-top: -80px; position: relative; z-index: 2; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--accent); }

.detail-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.detail-sidebar { display: flex; flex-direction: column; gap: 12px; }
.detail-poster {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 40px var(--shadow);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }

.detail-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.meta-pill {
  padding: 4px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 700;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 20px 0;
}
.meta-item span { display: block; font-size: 11.5px; color: var(--muted); }
.meta-item strong { font-size: 14px; }

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.episode-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.episode-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.episode-card.active { border-color: var(--accent); background: var(--brand-accent-tint); }
.ep-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface2);
  overflow: hidden;
}
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-info { padding: 10px 12px; }
.ep-num { font-size: 11.5px; color: var(--accent); font-weight: 800; }
.ep-title { font-weight: 700; font-size: 13.5px; margin-top: 2px; }

/* Video Player */
.player-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.player-shell video, .player-shell iframe { width: 100%; height: 100%; display: block; border: 0; }
.skip-overlay {
  position: absolute;
  right: 20px;
  bottom: 72px;
  z-index: 10;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: rgba(16, 16, 18, 0.9);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: none;
}
.skip-overlay.visible { display: inline-flex; align-items: center; gap: 8px; }
.player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.player-controls-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox-inline input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Comments */
.comments-box { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.comment-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.comment-author { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.spoiler-blur { filter: blur(6px); cursor: pointer; transition: filter 0.2s ease; }
.spoiler-blur.revealed { filter: none; }

/* Cards / Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; }

/* Progress bar */
.progress-track { height: 4px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--accent); }

/* Modal */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-root.open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.auth-providers { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.provider-btn:hover { border-color: var(--accent); background: var(--surface2); }
.provider-yandex { background: #fc3f1d; border-color: transparent; color: #fff; }
.provider-yandex:hover { background: #e53515; border-color: transparent; }
.provider-telegram { background: #2aabee; border-color: transparent; color: #fff; }
.provider-telegram:hover { background: #2298d6; border-color: transparent; }

/* Toast */
.toast-root {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 28px var(--shadow);
  font-weight: 600;
  font-size: 13px;
}
.toast.error { border-color: var(--danger); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--accent); }

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mobile-search-btn { display: none; }
.mobile-search-bar {
  display: none;
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  background: var(--header);
}
.mobile-search-bar.open { display: block; }
.mobile-search-form {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

.mobile-filter-toggle,
.filter-close-mobile { display: none; }

.mobile-bottom-nav { display: none; }

/* Responsive — Large / QHD / 4K screens */
@media (min-width: 1600px) {
  .header-inner,
  .container,
  .hero-content,
  .footer-inner { max-width: 1520px; }
  .hero { min-height: 540px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 22px; }
}

/* Responsive — Small Laptops & Landscape Tablets */
@media (max-width: 1120px) {
  .header-inner { padding: 0 18px; gap: 14px; }
  .header-search { width: 195px; }
  .catalog-layout { grid-template-columns: 236px minmax(0, 1fr); gap: 20px; }
  .detail-grid { grid-template-columns: 236px minmax(0, 1fr); gap: 24px; }
}

/* Responsive — Portrait & Landscape Tablets */
@media (max-width: 960px) {
  .header-search { display: none; }
  .mobile-search-btn { display: inline-grid; }
  .header-nav { gap: 16px; }

  .hero { min-height: 420px; }
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
    padding: 36px 20px 40px;
  }
  .hero-main { max-width: 100%; }

  /* Collapsible catalog filter panel on tablets & phones */
  .catalog-layout { grid-template-columns: 1fr; gap: 16px; }
  .mobile-filter-toggle { display: inline-flex; }
  .filter-close-mobile { display: inline-flex; }
  .filter-panel {
    display: none;
    position: static;
    margin-bottom: 6px;
  }
  .filter-panel.mobile-open {
    display: flex;
  }

  /* Clean 2-col detail header on tablets */
  .detail-grid {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 22px;
  }
  .poster-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}

/* Responsive — Smartphones & Phablets */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }
  .site-header {
    padding-top: env(safe-area-inset-top, 0px);
  }
  .header-inner {
    height: 58px;
    padding: 0 14px;
    gap: 8px;
  }
  .header-nav { display: none; }
  .brand-link { font-size: 17px; gap: 8px; }
  .brand-mark { width: 31px; height: 31px; font-size: 15px; border-radius: 9px; }

  /* Prevent iOS Safari auto-zoom on form focus */
  .input, .select, .textarea, .header-search input {
    font-size: 16px;
  }

  /* Horizontal momentum-scrolling genre pills & tabs */
  .genre-strip,
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .genre-strip::-webkit-scrollbar,
  .tabs::-webkit-scrollbar { display: none; }
  .genre-strip .pill,
  .tabs .pill { flex-shrink: 0; white-space: nowrap; }

  /* Sticky App-like Bottom Tab Bar */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--header);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .mob-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    min-width: 0;
  }
  .mob-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mob-tab.active { color: var(--accent); }

  .toast-root {
    left: 14px;
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

/* Responsive — Portrait Phones */
@media (max-width: 640px) {
  .container { padding: 18px 14px 36px; }
  .hide-xs { display: none; }
  .user-pill { padding: 3px; border-radius: 50%; width: 36px; height: 36px; justify-content: center; }
  .user-pill-name { display: none; }

  .hero { min-height: 360px; }
  .hero-scrim {
    background:
      linear-gradient(180deg, rgba(16, 16, 18, 0.2) 0%, rgba(16, 16, 18, 0.72) 52%, var(--bg) 100%);
  }
  :root[data-theme="light"] .hero-scrim {
    background:
      linear-gradient(180deg, rgba(248, 246, 247, 0.15) 0%, rgba(248, 246, 247, 0.85) 55%, var(--bg) 100%);
  }
  .hero-content { padding: 28px 14px 28px; }
  .hero-title { font-size: clamp(26px, 7.5vw, 34px); }
  .hero-desc { font-size: 13px; margin-bottom: 18px; }
  .hero-cta { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-cta .btn { width: 100%; padding: 0 12px; }
  .hero-corner { display: none; }

  .section-head { margin: 22px 0 12px; }
  .section-head h2 { font-size: 19px; }
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-title { font-size: 13.5px; }

  /* Anime Detail stacked layout on phones */
  .detail-banner { height: 220px; }
  .detail-wrap { margin-top: -64px; }
  .detail-grid { grid-template-columns: 1fr; gap: 20px; }
  .detail-poster { max-width: 200px; margin: 0 auto; }
  .detail-wrap h1 { font-size: clamp(24px, 6.8vw, 32px) !important; }
  .meta-grid { padding: 14px; gap: 10px; }
  .episode-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

  /* Video player & controls on phones */
  .player-shell { border-radius: 12px; }
  .skip-overlay {
    right: 10px;
    bottom: 50px;
    padding: 7px 12px;
    font-size: 12px;
  }
  .player-bar { gap: 10px; padding: 12px 0; }
  .player-controls-group { width: 100%; justify-content: space-between; gap: 8px; }

  .form-grid-2 { grid-template-columns: 1fr; }
  .panel { padding: 15px; border-radius: 14px; }

  /* Native bottom-sheet modals on phones */
  .modal-root {
    align-items: flex-end;
    padding: 0;
  }
  .modal-card {
    max-width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  }
  #google-signin-slot,
  #telegram-signin-slot {
    max-width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 14px;
    gap: 10px;
  }
}

/* Responsive — Compact Phones (<= 380px, iPhone SE / Fold) */
@media (max-width: 380px) {
  .container { padding: 14px 10px 32px; }
  .poster-grid { gap: 10px; }
  .hero-cta { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .episode-grid { grid-template-columns: 1fr; }
}

/* Responsive — Landscape Phone Video Watching */
@media (max-height: 520px) and (orientation: landscape) {
  .player-shell {
    max-height: calc(100dvh - 68px);
    margin: 0 auto;
  }
  .mobile-bottom-nav { display: none; }
  body { padding-bottom: 0; }
}
