/* QF Premieres v3.4.3 — Mobile Grid Fix */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:    #0c0c0f;
  --bg2:   #111115;
  --bg3:   #16161c;
  --bg4:   #1c1c24;
  --line:  #1c1c26;
  --line2: #262634;
  --t:     #ceceda;
  --t2:    #72728a;
  --t3:    #3e3e50;
  --acc:   #E8A020;
  --green: #22c55e;
  --amber: #F59E0B;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --ui:    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--t);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }

.qfp { min-height: 100vh; display: flex; flex-direction: column; }

/* ─── BAR ─── */
.qfp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}
.bar-left  { display: flex; align-items: center; gap: 12px; }
.bar-right { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }

.back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--bg3); border: 1px solid var(--line2);
  border-radius: 7px; color: var(--t2);
  flex-shrink: 0;
}
.back-btn:hover { color: var(--t); border-color: var(--acc); }

.logo { display: flex; align-items: center; gap: 10px; }
.logo svg { flex-shrink: 0; }
.logo-title { font-size: 14px; font-weight: 600; color: #f0f0f5; letter-spacing: -.01em; }
.logo-sub   { font-size: 11px; color: var(--t3); font-family: var(--mono); margin-top: 1px; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 9px; color: var(--t3); pointer-events: none; }

.qfp-search {
  background: var(--bg3); border: 1px solid var(--line2); color: var(--t);
  border-radius: 8px; padding: 0 10px 0 28px;
  font-size: 13px; font-family: var(--ui); width: 200px;
  height: 32px; line-height: 32px;
  outline: none; transition: border-color .14s, width .2s;
}
.qfp-search:focus { border-color: var(--acc); width: 240px; }
.qfp-search::placeholder { color: var(--t3); }

.qfp-sel {
  background: var(--bg3); border: 1px solid var(--line2); color: var(--t);
  border-radius: 8px; padding: 0 28px 0 10px;
  font-size: 13px; font-family: var(--ui);
  height: 32px; line-height: 32px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2372728a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer; outline: none; transition: border-color .14s;
}
.qfp-sel:focus { border-color: var(--acc); }
.qfp-sel option { background: #16161c; }

/* ─── SCROLL WRAPPER ─── */
.tbl-wrap { flex: 1; overflow-x: auto; }
.tbl-wrap::-webkit-scrollbar { height: 3px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 2px; }

/* ─── TABLE ─── */
.tbl {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

/* col widths */
.tbl .c-img    { width: 10px; }
.tbl .c-num    { width: 36px; }
.tbl .c-title  { width: 288px; max-width: 288px; }
.tbl .c-type   { width: 80px; }
.tbl .c-season { width: 62px; }
.tbl .c-ep     { width: 54px; }
.tbl .c-genre  { width: 220px; }
.tbl .c-ch     { width: 116px; }
.tbl .c-date   { width: 140px; }
.tbl .c-rat    { width: 50px; }

/* ─── TH ─── */
.tbl thead tr { border-bottom: 1px solid var(--line2); }

.tbl th {
  padding: 9px 10px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--t3); text-align: left;
  background: var(--bg2);
  white-space: nowrap; user-select: none;
  border-bottom: 1px solid var(--line2);
  overflow: hidden; text-overflow: ellipsis;
}

.tbl th.sortable { cursor: pointer; transition: color .14s; }
.tbl th.sortable:hover { color: var(--t2); }
.tbl th.sorted-asc i,
.tbl th.sorted-desc i { color: var(--acc); }
.tbl th i { font-style: normal; font-size: 11px; margin-left: 2px; }

/* ─── MONTH ROW ─── */
.mrow td {
  padding: 0;
  background: linear-gradient(90deg, rgba(232,160,32,.09) 0%, transparent 55%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid rgba(232,160,32,.12);
  overflow: hidden;
}

.mrow-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 14px 6px;
  gap: 1rem;
}

.mrow-left {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--t);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mrow-right {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--acc);
  white-space: nowrap;
  flex-shrink: 0;
}

.mrow-full { display: inline; }
.mrow-short { display: none; }

/* ─── DATA ROWS ─── */
.drow { border-bottom: 1px solid var(--line); }
@media (hover: hover) { .drow:hover { background: var(--bg3); } }
@media (hover: hover) { .drow:hover .title-link { color: var(--acc); } }

.drow td {
  padding: 9px 10px;
  vertical-align: middle;
  overflow: hidden;
}

.drow td.c-img    { padding: 5px 4px 5px 8px; overflow: visible; }
.drow td.c-num    { font-family: var(--mono); font-size: 11px; color: var(--t3); text-align: right; padding-right: 6px; }

/* Poster */
.c-img img {
  width: 38px; height: 54px;
  object-fit: cover; border-radius: 5px;
  border: 1px solid var(--line2);
}

@media (hover: hover) { .drow:hover .c-img img { opacity: .82; transform: scale(1.06); } }

.no-img {
  width: 38px; height: 54px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--bg3);
  display: flex; align-items: center; justify-content: center; color: var(--t3);
}

/* Title cell */
.title-link {
  font-size: 13px; font-weight: 500; color: var(--t);
  display: block; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.4;
}
.sub-country {
  display: block; font-size: 11px; color: var(--t3);
  margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Type badge */
.tbadge {
  display: inline-block;
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  border-radius: 4px; padding: 2px 6px; line-height: 1.4;
  background: var(--bg4); border: 1px solid var(--line2); color: var(--t3);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.t-аниме   { background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.32); color: #c4b5fd; }
.t-фильм   { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.32); color: #93c5fd; }
.t-сериал  { background: rgba(232,160,32,.12); border-color: rgba(232,160,32,.3);  color: #fcd34d; }
.t-тв_шоу { background: rgba(34,197,94,.11);  border-color: rgba(34,197,94,.3);   color: #86efac; }
.t-докум   { background: rgba(244,114,182,.11);border-color: rgba(244,114,182,.3); color: #f9a8d4; }

/* Season badge */
.s-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px;
  background: var(--bg4); border: 1px solid var(--line2);
  border-radius: 5px; font-family: var(--mono);
  font-size: 11px; font-weight: 500; color: var(--t2);
}

/* Genre */
.genre-txt {
  font-size: 12px; color: var(--t2);
  display: block; line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Channel badge */
.ch-badge {
  display: inline-block;
  background: var(--bg4); border: 1px solid var(--line2);
  border-radius: 5px; padding: 2px 7px;
  font-size: 12px; font-weight: 500; color: var(--t2);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}

/* Date */
.date-txt {
  font-family: var(--mono); font-size: 12px; color: var(--t2);
  white-space: nowrap; display: block;
}
.date-txt.week  { color: var(--amber); font-weight: 600; }
.date-txt.today { color: var(--green); font-weight: 600; }

/* Rating */
.rat-txt { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--acc); }

.na { color: var(--t3); }

/* ─── Filter hidden ─── */
.drow.hidden, .mrow.hidden { display: none; }

/* ─── No results ─── */
.no-res-row td { text-align: center; padding: 36px; color: var(--t3); font-size: 13px; }

/* ─── Lang switcher ─── */
.lang-sw {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 3px;
  height: 32px;
  box-sizing: border-box;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--t3);
  text-decoration: none;
  transition: color .14s, background .14s;
  white-space: nowrap;
}
.lang-btn:hover { color: var(--t); background: var(--bg4); }
.lang-btn.active { background: var(--acc); color: #0d0d0d; }

/* ─── Episode badge ─── */
.ep-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px;
  background: var(--bg4); border: 1px solid var(--line2);
  border-radius: 5px; font-family: var(--mono);
  font-size: 11px; font-weight: 500; color: var(--t2);
}

/* ─── Footer ─── */
.qfp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg2); border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--t3);
  flex-wrap: wrap;
}

/* Breadcrumbs */
.breadcrumbs ol {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0; padding: 0;
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--t3);
}
.breadcrumbs li + li::before {
  content: '/';
  margin: 0 6px;
  color: var(--t3);
  opacity: .4;
}
.breadcrumbs a {
  color: var(--t3);
  text-decoration: none;
  transition: color .14s;
}
.breadcrumbs a:hover { color: var(--acc); }
.breadcrumbs li[aria-current="page"] { color: var(--t2); }

.foot-count { white-space: nowrap; flex-shrink: 0; }

/* ════════════════════════════════════════
   MOBILE ≤768px — Grid Layout (No Table)
════════════════════════════════════════ */
@media (max-width: 768px) {
  .qfp-bar { 
    padding: 10px 14px; 
    gap: 8px;
  }
  
  .bar-left {
    min-width: 0;
  }
  
  .bar-right {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  
  .logo-sub { display: none; }
  
  .search-wrap {
    flex: 1;
    min-width: 0;
    max-width: 200px;
  }
  
  .qfp-search { 
    width: 100%; 
    min-width: 100px;
  }
  .qfp-search:focus { width: 100%; }
  
  /* Compact lang switcher pushed to right */
  .lang-sw {
    height: 28px;
    padding: 2px;
    gap: 1px;
    margin-left: auto;
  }
  
  .lang-btn {
    height: 22px;
    padding: 0 6px;
    font-size: 10px;
    min-width: 26px;
  }

  /* Hide thead on mobile */
  .tbl thead { display: none; }
  
  /* Table as block */
  .tbl {
    display: block;
    min-width: 100%;
    width: 100%;
  }
  
  .tbl tbody {
    display: block;
  }

  /* Month row as flex */
  .mrow {
    display: block !important;
  }
  
  .mrow td {
    display: block;
    width: 100%;
  }
  
  .mrow-flex {
    padding: 8px 14px;
    gap: 8px;
  }
  
  .mrow-left {
    font-size: 12px;
    font-weight: 500;
  }
  
  .mrow-right {
    font-size: 10px;
  }
  
  .mrow-full { display: none; }
  .mrow-short { display: inline; }

  /* Data row as Grid: [img] [title] [date] */
  .drow {
    display: grid !important;
    grid-template-columns: 52px 1fr 80px;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
  }
  
  .drow.hidden { display: none !important; }
  
  .drow td {
    display: block;
    padding: 0;
    overflow: visible;
    width: auto !important;
  }
  
  /* Show only img, title, date */
  .drow td.c-img,
  .drow td.c-title,
  .drow td.c-date {
    display: block;
  }
  
  .drow td:not(.c-img):not(.c-title):not(.c-date) {
    display: none !important;
  }
  
  /* Image column */
  .drow td.c-img {
    grid-column: 1;
    padding: 0;
  }
  
  .c-img img {
    width: 44px;
    height: 62px;
    border-radius: 6px;
  }
  
  .no-img {
    width: 44px;
    height: 62px;
    border-radius: 6px;
  }
  
  /* Title column */
  .drow td.c-title {
    grid-column: 2;
    min-width: 0; /* Critical for ellipsis */
    padding: 0;
  }
  
  .title-link {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 2px;
  }
  
  .sub-country {
    font-size: 11px;
    color: var(--t3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-top: 2px;
  }
  
  /* Date column */
  .drow td.c-date {
    grid-column: 3;
    text-align: right;
    padding: 0;
  }
  
  .date-txt {
    font-size: 12px;
    font-weight: 500;
    white-space: normal; /* Allow "27 февраля" on one line, "2026" on next if needed */
    line-height: 1.2;
  }
  
  /* Promo row adjustments */
  .promo-row {
    display: block !important;
  }
  
  .promo-row td {
    display: block;
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .qfp-sel { display: none; }
  
  .lang-btn {
    padding: 0 5px;
    font-size: 9px;
    min-width: 24px;
    height: 20px;
  }
  
  .lang-sw {
    height: 24px;
  }
  
  /* Smaller grid gaps on tiny screens */
  .drow {
    grid-template-columns: 48px 1fr 70px;
    gap: 10px;
    padding: 8px 12px;
  }
  
  .c-img img, .no-img {
    width: 40px;
    height: 56px;
  }
  
  .title-link {
    font-size: 13px;
  }
  
  .date-txt {
    font-size: 11px;
  }
  
  .mrow-left {
    font-size: 11px;
  }
  
  .mrow-right {
    font-size: 9px;
  }
}

/* Promo block */
.promo-row {
  background: transparent;
}

.promo-row td {
  padding: 15px 10px;
  border: none;
}

.prm-wrap {
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
}

.prm-box {
  background: linear-gradient(135deg, #1e3a5f 0%, #0d2137 100%);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(232, 160, 32, 0.2);
}

.prm-content {
  min-height: 60px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prm-content ins {
  display: block;
  width: 100%;
  min-height: 60px;
}

.prm-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 15px;
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
  white-space: nowrap;
}

.prm-link {
  color: #E8A020;
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  background: rgba(232, 160, 32, 0.1);
  border-radius: 4px;
  transition: all 0.2s;
}

.prm-link:hover {
  color: #ffc94d;
  background: rgba(232, 160, 32, 0.2);
  text-decoration: none;
}

.prm-dot { color: #555; font-weight: bold; }
.prm-txt { color: #888; font-style: italic; }

/* Fallback */
.prm-fallback {
  display: none;
  background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 20px;
}

.prm-fb-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.prm-fb-icon { font-size: 18px; }
.prm-fb-txt { color: #aaa; font-size: 13px; line-height: 1.4; }

@media (max-width: 768px) {
  .prm-wrap { max-width: 100%; }
  .prm-content { min-height: 50px; }
  .prm-footer { font-size: 11px; gap: 6px; padding: 5px 10px; }
  .prm-link { padding: 2px 6px; font-size: 11px; }
  .prm-fb-txt { font-size: 12px; }
}

.promo-row.hidden { display: none !important; }