/* ============================================================
   THEME.CSS — single project stylesheet
   ------------------------------------------------------------
   Contains:
     - Theme variables (dark / light)
     - Reset / base
     - Header #masthead, drawer
     - Grid .story-grid
     - Cards: .story-card, .story-mini, .related-v, .related-row
     - Fullstory: .fullstory, .fs-*
     - Media-slot (iframe placeholder)
     - Infinite (indicators)
     - Responsive
   ============================================================ */

/* ---------- THEME: DARK (default) ---------- */
:root,
[data-theme="dark"] {
    --bg:        #181818;
    --bg-2:      #212121;
    --bg-3:      #2a2a2a;
    --text:      #ffffff;
    --text-dim:  #aaaaaa;
    --text-mute: #777777;
    --accent:    #ffb400;
    --accent-2:  #ff8a00;
    --border:    rgba(255, 255, 255, .08);
    --shadow:    0 8px 24px rgba(0, 0, 0, .45);
    --radius:    10px;
    --radius-sm: 6px;
    --header-h:  56px;
    --drawer-w:  260px;
}

/* ---------- THEME: LIGHT ---------- */
[data-theme="light"] {
    --bg:        #f5f5f5;
    --bg-2:      #ffffff;
    --bg-3:      #ececec;
    --text:      #111111;
    --text-dim:  #555555;
    --text-mute: #888888;
    --accent:    #ff8a00;
    --accent-2:  #e07000;
    --border:    rgba(0, 0, 0, .08);
    --shadow:    0 8px 24px rgba(0, 0, 0, .12);
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

img { max-width: 100%; height: auto; display: block; }


/* ============================================================
   HEADER #masthead
   ============================================================ */
#masthead {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    transition: transform .25s ease;
}
#masthead.is-hidden { transform: translateY(-100%); }

#masthead #container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 16px;
}
/* --- START: hamburger + logo --- */
#start {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

/* ===== Контейнер ===== */
.cat-buttons {
    width: 100%;
    margin: 0 0 12px;
}

.cat-buttons__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* ===== Кнопка (полоска #181818) ===== */
.cat-buttons__item {
    margin: 0;
}

.cat-buttons__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: #181818;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    border-radius: 4px;
    overflow: hidden;
    transition: color 0.25s ease;
    white-space: nowrap;
}

/* ===== Жёлтое подчёркивание (слева → направо) ===== */
.cat-buttons__link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: #FFD700;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s ease;
    pointer-events: none;
}

/* ===== Hover ===== */
.cat-buttons__link:hover,
.cat-buttons__link:focus-visible {
    color: #FFD700;            
    outline: none;
}

.cat-buttons__link:hover::after,
.cat-buttons__link:focus-visible::after {
    transform: scaleX(1);       
}


@media (max-width: 767px) {
    .cat-buttons {
        display: none !important;
    }
}
/* Container */
.lang-hlang {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 40px;
  cursor: pointer;
  margin-left: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  border-radius: 2px;
  text-align: center;
  vertical-align: middle;
}

.lang-hlang > i {
  display: block;
  width: 100%;
  height: 100%;
  line-height: 40px;
  font-style: normal;
}

.lang-hlang > i img {
  display: inline-block;
  vertical-align: middle;
  width: 28px;
  height: 28px;
  border-radius: 2px;
}

.lang-hlang .lang-hidden {
  position: absolute;
  top: 100%;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;        
  padding: 6px;
  margin-top: 10px;   
  border: 1px solid #ddd;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  z-index: 1000;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  pointer-events: none;
}

/* Show on click (.open) and on keyboard focus */
.lang-hlang.open .lang-hidden,
.lang-hlang:focus-within .lang-hidden {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Flag links */
.lang-hlang .lang-hidden a {
  display: block;
  line-height: 0;
  border-radius: 2px;
  transition: background .15s, transform .15s;
}

.lang-hlang .lang-hidden a:hover {
  background: #f0f0f0;
  transform: scale(1.08);
}

.lang-hlang .lang-hidden a img {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .lang-hlang { margin-left: 0; margin-right: 5px; width: 36px; height: 36px; }
  .lang-hlang > i img,
  .lang-hlang .lang-hidden a img { width: 24px; height: 24px; }
}
/* --- END: hamburger + logo --- */

/* Hack: right edge of .page on desktop */
@media (min-width: 769px) {
    #container #end {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
    }
}

#menu-toggle {
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}
#menu-toggle:hover { background: var(--bg-3); }

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 148px;
    height: 40px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
    font-size: 16px;
    font-size: 25px;
    color: #ffb400;
}
.logo:hover { color: var(--accent); }

/* --- CENTER: search --- */
#center {
    flex: 1 1 auto;
    max-width: 640px;
    display: flex;
    align-items: center;         /* ← center the form vertically in the header */
    justify-content: center;
    height: 100%;
    min-width: 0;
}

.video-preview {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}
.vp-stage {
    position: relative;
    width: 100%;
    height: 100%;
}
.vp-thumb, .vp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.vp-progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    height: 6px;
    background: rgba(0,0,0,0.45);
    z-index: 2;
}
.vp-seg {
    flex: 1;
    border-right: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
}
.vp-seg:last-child { border-right: none; }
.vp-seg.active { background: #ff3b3b; }
.vp-seg.passed { background: #ff9b9b; }

/* === The form itself === */
#q_search {
    display: flex;
    align-items: stretch;        /* ← input and button share the same height */
    width: 100%;
    height: 50px;                /* ← DESIRED HEIGHT */
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    box-sizing: border-box;
}

/* === Input === */
#q_search input[type="search"],
#q_search input#story {
    flex: 1 1 auto;
    height: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    padding: 0 20px;             /* horizontal padding only */
    font-size: 15px;
    line-height: 1;              /* ← remove "jumping" */
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

#q_search input::placeholder {
    color: var(--text-mute);
    line-height: 1;              /* ← placeholder centered */
}

/* === "Search" button === */
#q_search .q_search_btn {
    flex: 0 0 auto;
    height: 100%;
    background: var(--accent);
    color: #000;
    border: 0;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;              /* ← remove "jumping" */
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;        /* ← center the text in the button */
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}

#q_search .q_search_btn:hover {
    background: var(--accent-2);
}

/* --- END: right side --- */
#end {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 40px;
}
/* === Theme button === */
#theme-toggle {
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}
#theme-toggle:hover { background: var(--bg-3); color: var(--accent); }
#theme-toggle.is-light svg { transform: rotate(180deg); transition: transform .3s ease; }
/* ============================================================
   DRAWER
   ============================================================ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 200;
    opacity: 0;
    transition: opacity .2s ease;
}
.drawer-overlay.is-open { opacity: 1; }

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--drawer-w);
    max-width: 85vw;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    z-index: 201;
    transform: translateX(-100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); }

body.drawer-lock { overflow: hidden; }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
#drawer-close {
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}
#drawer-close:hover { background: var(--bg-3); }

.drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}
.drawer-item {
    display: block;
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}
.drawer-item:hover {
    background: var(--bg-3);
    color: var(--accent);
}

/* ============================================================
   PAGE / CONTAINER
   ============================================================ */
.page {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px;
}

.page-title {
    margin: 0 0 16px;
}
.page-title h1 {
    margin: 0 0 6px;
    font-size: 22px;
    color: var(--text);
}
.page-title p { margin: 0; color: var(--text-dim); }

.lastcomments { margin: 16px 0; }
.lastcomments h2 {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--text);
}

/* ============================================================
   GRID — auto-fill (as many as fit), 1 column on mobile
   ============================================================ */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Mobile: strictly 1 column, card full width */
@media (max-width: 640px) {
    .story-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ============================================================
   MEDIA-SLOT — iframe placeholder
   ============================================================ */
.media-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 160px;
    font-size: 11px;
    color: var(--text-dim);
    border: 1px dashed var(--text-mute);
    border-radius: var(--radius-sm);
    text-align: center;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .12);
}
.media-slot--player  { min-height: 600px; font-size: 13px; }
.media-slot--mini    { font-size: 10px; }
.media-slot--related { font-size: 10px; }
.media-slot--row     { font-size: 9px; }

[data-theme="light"] .media-slot {
    background: rgba(0, 0, 0, .04);
}

.fs-player {
    position: relative;   /* чтобы стрелка позиционировалась относительно .fs-player */
}

.fs-player-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);   /* точный центр */
    width: 0;
    height: 0;
    border-top: 10px solid transparent;   /* 10px — размер стрелки */
    border-bottom: 10px solid transparent;
    border-left: 16px solid #FFD700;      /* жёлтый цвет, ширина стрелки */
    pointer-events: none;                 /* НЕ перехватывает клик */
    z-index: 10;                          /* поверх видео */
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.6)); /* тень для видимости на светлом */
    transition: opacity 0.2s ease;
    opacity: 0.9;
}

/* Скрываем стрелку, когда видео играет (Plyr добавляет .plyr--playing) */
.fs-player .plyr--playing ~ .fs-player-arrow,
.fs-player.plyr--playing .fs-player-arrow {
    opacity: 0;
}
.fs-player:has(.plyr--playing) .fs-player-arrow {
    opacity: 0;
    pointer-events: none;
}

/* ============================================================
   STORY CARD — tile
   ============================================================ */
.story-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-2);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
    min-width: 0;              /* ← so auto-fill doesn't stretch it */
}
.story-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.story-card__thumb-link { display: block; color: inherit; text-decoration: none; }
.story-card__thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.story-card__thumb .media-slot {
    position: absolute;
    inset: 8px;
    width: auto;
    height: auto;
    min-height: 0;
}
.story-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #000;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 2;
}

.story-card__body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;              /* ← critical for the grid */
}
.story-card__title {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
    min-width: 0;
}
.story-card__title a {
    color: var(--text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;    /* ← long words don't overflow */
}
.story-card__title a:hover { color: var(--accent-2); }

.story-card__desc {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;    /* ← long words don't overflow */
}
.story-card__desc * {
    margin: 0;
    color: inherit;
    font-size: inherit;
}

/* Mobile: slightly larger text, card full width */
@media (max-width: 640px) {
    .story-card__title { font-size: 16px; }
    .story-card__desc  { font-size: 13px; }
}

/* ============================================================
   STORY MINI — compact
   ============================================================ */
.story-mini {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 8px;
    background: var(--bg-2);
    border-radius: var(--radius);
    transition: background .15s ease;
    align-items: flex-start;
}
.story-mini:hover { background: var(--bg-3); }

.story-mini__thumb-link {
    display: block;
    color: inherit;
    text-decoration: none;
    flex: 0 0 120px;
    max-width: 120px;
}
.story-mini__thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.story-mini__thumb .media-slot {
    position: absolute;
    inset: 4px;
    width: auto;
    height: auto;
    min-height: 0;
}
.story-mini__badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--accent);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.story-mini__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.story-mini__title {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
}
.story-mini__title a {
    color: var(--text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.story-mini__title a:hover { color: var(--accent-2); }

.story-mini__desc {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.story-mini__desc * { margin: 0; color: inherit; font-size: inherit; }

@media (max-width: 480px) {
    .story-mini__thumb-link { flex-basis: 96px; max-width: 96px; }
    .story-mini__title      { font-size: 12px; }
    .story-mini__desc       { font-size: 10px; }
}
/* ============================================================
   GRID — .story-grid
   ------------------------------------------------------------
   Use it on the home / category pages like this:
   <div class="story-grid">{content}</div>
   ============================================================ */
/* ============================================================
   GRID — auto-fill (as many as fit), 1 column on mobile
   ============================================================ */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Mobile: strictly 1 column, card full width */
@media (max-width: 640px) {
    .story-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ============================================================
   MEDIA-SLOT — iframe placeholder
   ============================================================ */
.media-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 160px;
    font-size: 11px;
    color: var(--text-dim);
    border: 1px dashed var(--text-mute);
    border-radius: var(--radius-sm);
    text-align: center;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .12);
}
.media-slot--player  { min-height: 600px; font-size: 13px; }
.media-slot--mini    { font-size: 10px; }
.media-slot--related { font-size: 10px; }
.media-slot--row     { font-size: 9px; }

[data-theme="light"] .media-slot {
    background: rgba(0, 0, 0, .04);
}


/* ============================================================
   RELATED VERTICAL — "similar" in the sidebar
   ============================================================ */
.related-v {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}
.related-v:last-child { margin-bottom: 0; }

.related-v__link {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius);
    overflow: hidden;
    transition: background .15s ease;
}
.related-v__link:hover { background: rgba(255, 255, 255, .04); }

.related-v__thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}
.related-v__thumb .media-slot {
    position: absolute;
    inset: 6px;
    width: auto;
    height: auto;
    min-height: 0;
}

.related-v__title {
    margin: 8px 4px 4px;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-v__link:hover .related-v__title { color: var(--accent-2); }

.related-v__meta {
    margin: 0 4px 6px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .related-v__link:hover {
    background: rgba(0, 0, 0, .04);
}

/* ============================================================
   RELATED ROW — inline card
   ============================================================ */
.related-row {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
}
.related-row:last-child { margin-bottom: 0; }

.related-row__link {
    display: flex;
    gap: 10px;
    padding: 6px;
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    align-items: center;
    transition: background .15s ease;
}
.related-row__link:hover { background: rgba(255, 255, 255, .05); }

[data-theme="light"] .related-row__link:hover {
    background: rgba(0, 0, 0, .04);
}

.related-row__thumb {
    position: relative;
    flex: 0 0 96px;
    max-width: 96px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.related-row__thumb .media-slot {
    position: absolute;
    inset: 3px;
    width: auto;
    height: auto;
    min-height: 0;
}

.related-row__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.related-row__title {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-row__link:hover .related-row__title { color: var(--accent-2); }

.related-row__meta {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .related-row__thumb { flex-basis: 80px; max-width: 80px; }
    .related-row__title { font-size: 12px; }
}

/* ============================================================
   FULLSTORY
   ============================================================ */
.fullstory {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px;
}

.fs-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.fs-main { min-width: 0; }

.fs-player {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    aspect-ratio: 16 / 9; /* вместо min-height: 600px */
    background: #000;
}
.fs-player .plyr {
    width: 100%;
    height: 100%;
}
.fs-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fs-title {
    margin: 16px 0 28px;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text);
}

.fs-meta { margin: 8px 0 12px; }
.fs-meta__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--text-dim);
}
.fs-meta__item { display: inline-flex; gap: 4px; }
.fs-meta__label { color: var(--text-dim); }
.fs-meta__value { color: var(--text); }
.fs-meta__value a { color: var(--accent); text-decoration: none; }
.fs-meta__value a:hover { color: var(--accent-2); }
.fs-meta__item--dim { font-style: italic; opacity: .7; }

.fs-desc {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dim);
}
.fs-desc * { color: inherit; }

.fs-sidebar {
    background: var(--bg-2);
    border-radius: var(--radius);
    padding: 12px;
}
.fs-sidebar__title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.fs-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fs-related { margin-top: 32px; }
.fs-related__title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.fs-related__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.fs-comments { margin-top: 32px; }
.fs-comments__title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.fs-comments__num { color: var(--text-dim); font-weight: 400; }

@media (max-width: 1199px) {
    .fs-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .fs-layout { grid-template-columns: 1fr; }
    .fs-sidebar { display: none; }
    .fs-player { min-height: 400px; }
    .fs-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fs-title { font-size: 18px; }
}
@media (max-width: 600px) {
    .fullstory { padding: 10px; }
    .fs-player { min-height: 220px; }
    .fs-related__grid { grid-template-columns: 1fr; }
    .fs-title { font-size: 16px; }
}

/* ============================================================
   INFINITE — load indicators
   ============================================================ */
.infinite-sentinel { width: 100%; height: 1px; }
.infinite-loader {
    text-align: center;
    padding: 16px;
    font-size: 13px;
    color: var(--text-dim);
}

/* ============================================================
   HEADER RESPONSIVE
   ============================================================ */
@media (max-width: 899px) {
    #center { max-width: none; }
    #q_search .q_search_btn { padding: 10px 14px; font-size: 12px; }
}

@media (max-width: 599px) {
    .logo { width: auto; height: 32px; font-size: 22px; }
    #masthead #container { padding: 0 10px; gap: 8px; }
    #q_search input#story { padding: 9px 12px; font-size: 13px; }
    .page { padding: 10px; }
}

/* ============================================================
   REGISTRATION / PASSWORD RESET PAGES
   ============================================================ */
.page_form {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    color: var(--text);
}
.page_form__back {
    position: absolute;
    top: 16px;
    left: 16px;
    color: var(--text);
    font-size: 20px;
    text-decoration: none;
}
.page_form__back:hover { color: var(--accent); }
.page_form__body {
    width: 100%;
    max-width: 400px;
    background: var(--bg-2);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.page_form__logo {
    text-align: center;
    margin-bottom: 16px;
    font-weight: 700;
    font-size: 18px;
}
.page_form__logo a { color: var(--text); text-decoration: none; }

/* ============================================================
   PAGINATION — .navigation / .pages
   ============================================================ */

/* ---------- Container ---------- */
.navigation.ignore-select,
div.navigation {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    margin: 24px 0 !important;
    padding: 0 8px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    align-self: start !important;      /* prevent stretching to grid row height */
    grid-column: 1 / -1 !important;    /* span full row in grid parent */
    box-sizing: border-box !important;
}

/* ---------- Pages wrapper ---------- */
.navigation .pages {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
}

/* ---------- Prev / next arrows ---------- */
.navigation .page_prev,
.navigation .page_next {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 auto !important;
    border-radius: var(--radius-sm, 6px) !important;
    background: var(--bg-2, #1a1a1a) !important;
    border: 1px solid var(--border, #333) !important;
    color: var(--text, #fff) !important;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    user-select: none;
    box-sizing: border-box !important;
}

.navigation .page_prev > a,
.navigation .page_next > a,
.navigation .page_prev > span,
.navigation .page_next > span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    color: inherit !important;
    text-decoration: none !important;
}

.navigation .page_prev:hover,
.navigation .page_next:hover {
    background: var(--accent, #ffcc00) !important;
    color: #000 !important;
    border-color: var(--accent, #ffcc00) !important;
}

/* Disabled arrow (no link inside) */
.navigation .page_prev:not(:has(a)),
.navigation .page_next:not(:has(a)) {
    opacity: .4 !important;
    cursor: default !important;
    pointer-events: none !important;
}

.navigation .page_prev .icon,
.navigation .page_next .icon {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
    display: block !important;
}

/* ---------- Page numbers and "..." ---------- */
.navigation .pages > a,
.navigation .pages > span:not(.page_prev):not(.page_next) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 12px !important;
    flex: 0 0 auto !important;
    border-radius: var(--radius-sm, 6px) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

/* Active (current) page */
.navigation .pages > span:not(.page_prev):not(.page_next) {
    background: var(--accent, #ffcc00) !important;
    color: #000 !important;
    border: 1px solid var(--accent, #ffcc00) !important;
}

/* Inactive links */
.navigation .pages > a {
    background: var(--bg-2, #1a1a1a) !important;
    color: var(--text, #fff) !important;
    border: 1px solid var(--border, #333) !important;
}

.navigation .pages > a:hover {
    background: var(--accent, #ffcc00) !important;
    color: #000 !important;
    border-color: var(--accent, #ffcc00) !important;
}

/* "..." — plain text, not a button */
.navigation .pages > span.nav_ext {
    background: transparent !important;
    border: none !important;
    color: var(--text, #fff) !important;
    opacity: .6 !important;
    min-width: auto !important;
    padding: 0 4px !important;
    font-weight: 400 !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 599px) {
    .navigation.ignore-select,
    div.navigation {
        gap: 10px !important;
        margin: 18px 0 !important;
    }

    .navigation .pages {
        gap: 5px !important;
    }

    .navigation .page_prev,
    .navigation .page_next {
        width: 44px !important;
        height: 44px !important;
    }

    .navigation .pages > a,
    .navigation .pages > span:not(.page_prev):not(.page_next) {
        min-width: 36px !important;
        height: 36px !important;
        padding: 0 10px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 380px) {
    /* Keep prev, 1, ..., last, next only */
    .navigation .pages > a:not(:first-of-type):not(:last-of-type) {
        display: none !important;
    }
}