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

:root {
  --navy:       #1b2d4f;
  --navy-dark:  #111e35;
  --navy-light: #2a4270;
  --gold:       #c8a84b;
  --gold-light: #f5e9c8;
  --red:        #c0392b;
  --green:      #27ae60;
  --bg:         #f0f2f5;
  --card-bg:    #ffffff;
  --border:     #dde3ec;
  --text:       #1a1a2e;
  --muted:      #6b7a96;
  --radius:     10px;
  --shadow:     0 2px 10px rgba(0,0,0,0.07);
  --shadow-lg:  0 6px 24px rgba(0,0,0,0.13);
}

body {
  font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  font-size: 15px;
  padding-bottom: 110px;
}

a { color: inherit; text-decoration: none; }

/* ══ Header ══ */
.site-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: #fff;
  box-shadow: 0 3px 16px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-area  { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.logo-img   { height: 46px; width: auto; object-fit: contain; }
.logo-text  { display: flex; flex-direction: column; }
.logo-main  { font-size: 1.2rem; font-weight: 800; }
.logo-sub   { font-size: 0.74rem; color: var(--gold); }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.bc-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.18s;
}
.bc-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }
.bc-sep  { color: rgba(255,255,255,0.4); font-size: 0.9rem; }
.bc-current {
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-reload-top {
  margin-right: auto;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.18s;
  flex-shrink: 0;
}
.btn-reload-top:hover { background: rgba(255,255,255,0.2); }

/* ══ Filter Bar ══ */
.filter-bar { background: var(--navy-light); border-bottom: 3px solid var(--gold); }
.filter-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.search-wrap { display: flex; flex: 1; min-width: 180px; }

/* Search scope select */
.search-scope-select {
  padding: 0.5rem 0.5rem;
  background: var(--navy-dark);
  color: var(--gold);
  border: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  direction: rtl;
  flex-shrink: 0;
  outline: none;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.search-scope-select option { background: var(--navy-dark); color: #fff; }

.search-wrap input {
  border-radius: 0 !important;
  flex: 1;
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  direction: rtl;
}
.search-wrap input:focus { outline: none; }

/* Loading sub-text */
.loading-sub { font-size: 0.82rem; color: var(--muted); margin-top: -0.5rem; }

/* Series search rabbi label */
.series-search-rabbi {
  font-size: 0.74rem; font-weight: 700;
  color: var(--gold); margin-bottom: -0.1rem;
}
.search-btn {
  padding: 0.5rem 0.85rem;
  background: var(--gold);
  color: var(--navy-dark);
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.18s;
}
.search-btn:hover { background: #dbb952; }

.filter-group { display: flex; flex-direction: column; gap: 0.2rem; }
.filter-group label { font-size: 0.68rem; color: rgba(255,255,255,0.6); font-weight: 700; text-transform: uppercase; }
.filter-group select {
  padding: 0.45rem 0.6rem;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  direction: rtl;
}
.filter-group select option { background: var(--navy); }
.filter-group select:focus  { outline: none; border-color: var(--gold); }

.btn-reset {
  align-self: flex-end;
  padding: 0.45rem 0.85rem;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}
.btn-reset:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ══ Quick Filter Bar ══ */
.quick-filter-bar { background: var(--card-bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.quick-filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.qf-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.qf-btn {
  padding: 0.26rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}
.qf-btn:hover, .qf-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.stats-pill {
  font-size: 0.76rem; color: var(--muted);
  background: var(--bg); padding: 0.2rem 0.6rem;
  border-radius: 12px; border: 1px solid var(--border);
}
#statsTotal   { margin-right: auto; }
.btn-dl-all {
  padding: 0.26rem 0.85rem;
  background: var(--navy); color: #fff;
  border: none; border-radius: 20px;
  font-size: 0.78rem; font-weight: 700;
  font-family: inherit; cursor: pointer;
  transition: background 0.18s; white-space: nowrap;
}
.btn-dl-all:hover { background: var(--navy-light); }
.liked-pill   { color: var(--red);   border-color: #f5c6c2; background: #fdf1f0; }
.watched-pill { color: var(--green); border-color: #b7e4c7; background: #eafaf1; }

/* ══ Main ══ */
.site-main { max-width: 1200px; margin: 1.5rem auto 2rem; padding: 0 1.5rem; }

/* ══ States ══ */
.loading-state, .error-state, .empty-state {
  text-align: center; padding: 5rem 1rem; color: var(--muted);
}
.error-icon, .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.error-state p, .empty-state p { font-size: 1rem; margin-bottom: 1.5rem; }
.btn-setup {
  display: inline-block; padding: 0.65rem 1.6rem;
  background: var(--navy); color: #fff; border: none;
  border-radius: var(--radius); font-size: 0.95rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.btn-setup:hover { background: var(--navy-light); }
.spinner {
  width: 48px; height: 48px;
  border: 5px solid var(--border); border-top-color: var(--navy);
  border-radius: 50%; margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ Card Grid (rabbis & series) ══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.4rem;
}

.grid-card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.22s, transform 0.22s, border-color 0.22s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.grid-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
  border-color: var(--gold);
}

/* Cover image area */
.grid-card-cover {
  height: 150px;
  background: linear-gradient(145deg, var(--navy-light), var(--navy-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.grid-card-cover::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 50px;
  background: linear-gradient(to top, rgba(0,0,0,0.35), transparent);
}
.grid-card-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(200,168,75,0.18);
  border: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  z-index: 1;
  flex-shrink: 0;
}

/* Card body */
.grid-card-body {
  padding: 1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.grid-card-name {
  font-size: 1.05rem; font-weight: 800;
  color: var(--navy-dark); line-height: 1.35;
}
.grid-card-meta {
  font-size: 0.8rem; color: var(--muted);
  display: flex; align-items: center; gap: 0.3rem;
  flex-wrap: wrap;
}
.grid-card-meta strong { color: var(--navy); }
.progress-bar {
  height: 5px; background: var(--border);
  border-radius: 3px; overflow: hidden; margin-top: auto; padding-top: 0.4rem;
}
.progress-fill {
  height: 100%; background: var(--green);
  border-radius: 3px; transition: width 0.3s;
}

/* ══ Shiurim List ══ */
.shiurim-list { display: flex; flex-direction: column; gap: 0.85rem; }

.shiur-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  display: flex; align-items: stretch; overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.shiur-card:hover  { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.shiur-card.is-liked   { border-right: 4px solid var(--red); }
.shiur-card.is-watched { opacity: 0.68; }
.shiur-card.is-playing { border-right: 4px solid var(--gold); background: #fffdf5; }

.card-icon-col {
  width: 62px; min-width: 62px; background: var(--navy);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.75rem 0;
}
.file-icon   { font-size: 1.7rem; }
.watched-dot { font-size: 1rem; }

.card-body {
  flex: 1; padding: 0.8rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.4rem; min-width: 0;
}
.card-meta-top { display: flex; }
.card-date { font-size: 0.73rem; color: var(--muted); margin-right: auto; }
.card-title { font-size: 0.98rem; font-weight: 700; line-height: 1.4; color: var(--navy-dark); word-break: break-word; }

.card-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.1rem; }

.btn-play {
  padding: 0.38rem 0.95rem; background: var(--navy); color: #fff;
  border: none; border-radius: 7px; font-size: 0.83rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.18s; white-space: nowrap;
}
.btn-play:hover   { background: var(--navy-light); }
.btn-play.playing { background: var(--gold); color: var(--navy-dark); }

.btn-dl {
  padding: 0.38rem 0.95rem; background: var(--gold-light); color: #7a5c00;
  border-radius: 7px; font-size: 0.83rem; font-weight: 700;
  border: 1.5px solid var(--gold); transition: background 0.18s;
  white-space: nowrap; display: inline-block;
}
.btn-dl:hover { background: #edd98a; }

.btn-cache {
  display: none; /* מוסתר בדפדפן — מוצג רק ב-PWA מותקן */
  padding: 0.38rem 0.95rem; background: #e8f4fd; color: #1a5276;
  border: 1.5px solid #aed6f1; border-radius: 7px; font-size: 0.83rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: background 0.18s;
}
.btn-cache:hover    { background: #aed6f1; }
.btn-cache:disabled { opacity: 0.5; cursor: wait; }
@media (display-mode: standalone) { .btn-cache { display: inline-block; } }

.btn-wa {
  padding: 0.38rem 0.7rem; background: #e9fbe9; color: #1a7a1a;
  border-radius: 7px; font-size: 0.9rem;
  border: 1.5px solid #7bc67b; transition: background 0.18s;
  white-space: nowrap; display: inline-block;
}
.btn-wa:hover { background: #c8f0c8; }

.card-marks { display: flex; gap: 0.35rem; margin-right: auto; }
.btn-like, .btn-watched, .btn-save-offline {
  width: 33px; height: 33px; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--bg); font-size: 1rem;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-like:hover         { border-color: var(--red);   background: #fdf1f0; }
.btn-watched:hover      { border-color: var(--green);  background: #eafaf1; }
.btn-save-offline:hover { border-color: #2980b9; background: #eaf4fc; }
.btn-like.active        { border-color: var(--red);   background: #fdf1f0; }
.btn-watched.active     { border-color: var(--green);  background: #eafaf1; }
.btn-save-offline.active{ border-color: var(--green);  background: #eafaf1; }

/* ══ Player Page ══ */
.player-page {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: 600;
  background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column;
  -webkit-overflow-scrolling: touch;
}
.pp-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  padding: 0.75rem 1.5rem; display: flex; align-items: center;
  gap: 1rem; position: sticky; top: 0; z-index: 10;
  box-shadow: 0 3px 16px rgba(0,0,0,0.3);
}
.pp-close {
  background: rgba(255,255,255,0.12); border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 0.88rem; font-weight: 700;
  padding: 0.35rem 0.85rem; border-radius: 8px;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
  white-space: nowrap; flex-shrink: 0;
}
.pp-close:hover { background: rgba(255,255,255,0.22); }
.pp-crumb {
  font-size: 0.82rem; color: var(--gold); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pp-body {
  max-width: 860px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem;
  display: flex; flex-direction: column; gap: 1.2rem; width: 100%;
}
.pp-frame {
  width: 100%; height: 120px; border: none; display: block;
  border-radius: 12px; box-shadow: var(--shadow-lg);
}
.pp-audio {
  width: 100%; border-radius: 12px; margin-bottom: 8px;
  box-shadow: var(--shadow-lg); background: var(--navy-dark);
}


/* Fixed header on mobile so back button always visible */
@media (max-width: 768px) {
  .pp-header { position: sticky; top: 0; left: 0; right: 0; }
  .pp-body   { padding-top: 1rem; }
}
.pp-speed {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}
.pp-speed-label {
  font-size: 0.82rem; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.pp-speed-btn {
  padding: 0.3rem 0.7rem; border-radius: 20px; font-size: 0.82rem; font-weight: 700;
  border: 1.5px solid var(--border); background: var(--bg); color: var(--navy-dark);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.pp-speed-btn:hover { border-color: var(--navy); background: #e8ecf4; }
.pp-speed-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.pp-meta {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1.5px solid var(--border); padding: 1.1rem 1.3rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.pp-title {
  font-size: 1.15rem; font-weight: 800; color: var(--navy-dark);
  line-height: 1.4; margin: 0;
}
.pp-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pp-action-btn {
  padding: 0.42rem 1rem; border-radius: 8px; font-size: 0.85rem;
  font-weight: 700; cursor: pointer; font-family: inherit;
  transition: background 0.18s; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); white-space: nowrap;
  display: inline-block;
}
.pp-action-btn:hover { background: var(--border); }
.pp-action-btn.active { border-color: var(--gold); background: var(--gold-light); }
.pp-like.active  { border-color: var(--red);   background: #fdf1f0; color: var(--red); }
.pp-watch.active { border-color: var(--green);  background: #eafaf1; color: var(--green); }

.pp-sources {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1.5px solid var(--border); overflow: hidden;
}
.pp-sources-title {
  padding: 0.75rem 1.1rem; font-weight: 700; font-size: 0.9rem;
  color: var(--navy-dark); border-bottom: 1px solid var(--border);
  background: var(--gold-light);
}
.pp-source-frame {
  width: 100%; height: 600px; border: none; display: block;
}

@media (max-width: 600px) {
  .pp-source-frame { height: 400px; }
}

.pp-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.pp-nav-btn {
  padding: 0.6rem 1.4rem; background: var(--navy); color: #fff;
  border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.pp-nav-btn:hover:not(:disabled) { background: var(--navy-light); }
.pp-nav-btn:disabled { opacity: 0.3; cursor: default; }
.pp-counter { font-size: 0.82rem; color: var(--muted); font-weight: 600; }

@media (max-width: 600px) {
  .pp-body { padding: 1rem 1rem 3rem; }
  .pp-nav-btn { padding: 0.5rem 0.9rem; font-size: 0.82rem; }
}

/* ══ Admin modal ══ */
.admin-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.admin-box {
  background: var(--card-bg); border-radius: 14px;
  padding: 1.8rem; width: 100%; max-width: 340px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 0.8rem;
}
.admin-title { font-size: 1.05rem; font-weight: 800; color: var(--navy-dark); }
.admin-row   { display: flex; gap: 0.5rem; align-items: center; }

/* ══ Auth / Password ══ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(145deg, var(--navy-dark), var(--navy));
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.auth-box {
  background: rgba(255,255,255,0.07); border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 18px; padding: 2.5rem 2rem; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.auth-logo  { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; }
.auth-title { color: #fff; font-size: 1.4rem; font-weight: 800; text-align: center; }
.auth-sub   { color: rgba(255,255,255,0.65); font-size: 0.9rem; text-align: center; }
.auth-input {
  width: 100%; padding: 0.7rem 1rem; border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.1);
  color: #fff; font-size: 1rem; text-align: center; outline: none;
  font-family: inherit; transition: border-color 0.18s;
}
.auth-input:focus  { border-color: var(--gold); }
.auth-input::placeholder { color: rgba(255,255,255,0.4); }
.auth-btn {
  width: 100%; padding: 0.7rem; background: var(--gold); color: var(--navy-dark);
  border: none; border-radius: 10px; font-size: 1rem; font-weight: 800;
  cursor: pointer; font-family: inherit; transition: opacity 0.18s;
}
.auth-btn:hover { opacity: 0.88; }
.auth-error { color: #ff8080; font-size: 0.85rem; }

/* ══ Mobile back button ══ */
.mobile-back-btn {
  display: none; /* JS controls visibility */
  position: fixed; bottom: 1.2rem; left: 1rem; z-index: 200;
  background: var(--navy); color: #fff;
  border: none; border-radius: 50px; padding: 0.55rem 1.2rem;
  font-size: 0.9rem; font-weight: 700; font-family: inherit;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25); cursor: pointer;
  transition: background 0.18s;
}
.mobile-back-btn:hover { background: var(--navy-light); }
@media (min-width: 601px) { .mobile-back-btn { display: none !important; } }

/* ══ About Page ══ */
.about-page {
  position: fixed; inset: 0; z-index: 400;
  background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column;
}
.about-body {
  max-width: 680px; margin: 0 auto; padding: 2rem 1.5rem 4rem;
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
}
.about-logo-wrap { margin-top: 0.5rem; }
.about-logo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-lg); }
.about-title { font-size: 1.6rem; font-weight: 800; color: var(--navy-dark); text-align: center; }
.about-content { width: 100%; background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem; border: 1.5px solid var(--border); line-height: 1.8; font-size: 0.98rem; }
.about-content p { margin-bottom: 0.8rem; }
.about-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.about-contact { color: var(--muted); font-size: 0.9rem; }

/* Location section */
.about-location-section {
  width: 100%; background: var(--card-bg); border-radius: var(--radius);
  border: 1.5px solid var(--border); overflow: hidden;
}
.about-section-title {
  padding: 0.7rem 1.2rem; font-weight: 700; font-size: 0.9rem;
  color: var(--navy-dark); background: var(--gold-light);
  border-bottom: 1px solid var(--border);
}
.about-location-text {
  padding: 0.6rem 1.2rem; font-size: 0.92rem; color: var(--muted);
}
.about-map-wrap { width: 100%; }
.about-map-frame { width: 100%; height: 260px; border: none; display: block; }

/* Edit button */
.about-edit-btn {
  align-self: flex-end; margin-top: 0.5rem;
  padding: 0.45rem 1.1rem; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.85rem; font-weight: 700; color: var(--navy-dark);
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.about-edit-btn:hover { background: var(--border); }

/* Edit form */
.about-edit-group { width: 100%; display: flex; flex-direction: column; gap: 0.3rem; }
.about-edit-label {
  font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
}
.about-edit-hint { font-size: 0.74rem; color: var(--muted); }
.about-edit-input {
  width: 100%; padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; font-family: inherit; background: var(--bg);
  color: var(--text); outline: none; transition: border-color 0.18s;
  direction: rtl;
}
.about-edit-input:focus { border-color: var(--navy); }
.about-edit-title-input { font-size: 1.1rem; font-weight: 800; }
.about-edit-textarea {
  width: 100%; padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; font-family: inherit; background: var(--bg);
  color: var(--text); outline: none; resize: vertical; line-height: 1.6;
  transition: border-color 0.18s; direction: rtl;
}
.about-edit-textarea:focus { border-color: var(--navy); }
.about-edit-actions { display: flex; gap: 0.6rem; width: 100%; flex-wrap: wrap; }
.about-save-btn {
  padding: 0.6rem 1.4rem; background: var(--navy); color: #fff;
  border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.about-save-btn:hover { background: var(--navy-light); }
.about-cancel-btn {
  padding: 0.6rem 1.1rem; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.9rem;
  font-weight: 700; cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.about-cancel-btn:hover { background: var(--border); }

/* ══ Path breadcrumb in search/favorites ══ */
.path-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--navy); font-size: 0.73rem; font-family: inherit;
  font-weight: 700; text-decoration: underline dotted;
  transition: color 0.15s;
}
.path-btn:hover { color: var(--gold); }

/* ══ Settings Modal ══ */
.header-actions { display: flex; align-items: center; gap: 0.35rem; }
.btn-header-icon {
  background: rgba(255,255,255,0.12); border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 1rem; padding: 0.3rem 0.55rem; border-radius: 8px;
  cursor: pointer; transition: background 0.18s;
}
.btn-header-icon:hover { background: rgba(255,255,255,0.22); }
.btn-install {
  background: var(--gold); border: none; color: var(--navy-dark);
  font-size: 0.85rem; font-weight: 700; padding: 0.35rem 0.8rem; border-radius: 8px;
  cursor: pointer; transition: background 0.18s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.btn-install:hover { background: #e0be6a; }
.btn-settings {
  background: rgba(255,255,255,0.12); border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 1rem; padding: 0.3rem 0.6rem; border-radius: 8px;
  cursor: pointer; transition: background 0.18s;
}
.btn-settings:hover { background: rgba(255,255,255,0.22); }

.settings-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.55); display: flex;
  align-items: center; justify-content: center; padding: 1.5rem;
}
.settings-box {
  background: var(--card-bg); border-radius: 14px;
  padding: 1.8rem; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 0.9rem;
}
.settings-title { font-size: 1.1rem; font-weight: 800; color: var(--navy-dark); }
.settings-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.settings-input {
  width: 100%; padding: 0.65rem 0.9rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.83rem; font-family: monospace;
  color: var(--navy-dark); background: var(--bg); outline: none;
  transition: border-color 0.18s;
}
.settings-input:focus { border-color: var(--navy); }
.settings-note { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.settings-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.3rem; }
.btn-sync {
  padding: 0.55rem 1.1rem; background: var(--green); color: #fff;
  border: none; border-radius: 8px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.btn-sync:hover    { background: #1e9149; }
.btn-sync:disabled { opacity: 0.6; cursor: wait; }
.settings-sync-status { font-size: 0.82rem; font-weight: 600; min-height: 1.1em; }
.btn-settings-save {
  padding: 0.55rem 1.2rem; background: var(--navy); color: #fff;
  border: none; border-radius: 8px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.btn-settings-save:hover { background: var(--navy-light); }
.btn-settings-cancel {
  padding: 0.55rem 1rem; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.88rem;
  font-weight: 700; cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.btn-settings-cancel:hover { background: var(--border); }

/* ══ Toast ══ */
.toast {
  position: fixed; top: 72px; left: 50%;
  transform: translateX(-50%) translateY(-16px);
  opacity: 0;
  background: var(--navy-dark); color: #fff;
  padding: 0.55rem 1.4rem; border-radius: 24px;
  font-size: 0.9rem; font-weight: 600;
  transition: transform 0.28s ease, opacity 0.28s ease;
  z-index: 999; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35); border-bottom: 2px solid var(--gold);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.grid-card-cover--series {
  background: linear-gradient(145deg, #2d5a8e, #1b2d4f);
}

/* ══ Responsive ══ */
@media (max-width: 600px) {
  /* Header: 2 rows on mobile */
  .header-top {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem 0.4rem;
    gap: 0.3rem;
  }
  .logo-area  { flex: 1; min-width: 0; }
  .logo-img   { height: 34px; }
  .logo-main  { font-size: 0.95rem; }
  .logo-sub   { display: none; }
  .btn-reload-top {
    order: 2;
    margin-right: 0;
    padding: 0.28rem 0.5rem;
    font-size: 0.9rem;
  }
  .header-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    padding-bottom: 0.2rem;
    gap: 0.25rem;
  }
  .btn-header-icon {
    padding: 0.28rem 0.5rem;
    font-size: 0.95rem;
  }
  .breadcrumb { display: none !important; }

  /* Cards */
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-card-cover { height: 110px; }
  .grid-card-avatar { width: 60px; height: 60px; font-size: 1.6rem; }

  /* Filter bar */
  .filter-bar-inner { flex-direction: column; }
  .search-wrap { width: 100%; }
}
