@import url('stream-theme.css');

/* ══════════════════════════════════════════════════════════════
   styles.css — Overrides & additions for the local PencariMovie
   downloader app (settings gate, bot badge, file detail page).
   ══════════════════════════════════════════════════════════════ */

/* ─── Utility ────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ─── Settings Gate (bot-login overlay) ───────────────────────── */

.settings-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-gate__card {
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 32px 24px 24px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.settings-gate__header-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.settings-gate__version-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.02em;
}

.settings-gate__version-badge:empty {
  display: none;
}

.settings-gate__title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
}

.settings-gate__desc {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 28px;
  line-height: 1.5;
}

.settings-gate__desc a {
  color: var(--accent, #ff6b35);
  text-decoration: none;
}

.settings-gate__desc a:hover {
  text-decoration: underline;
}

.settings-gate__field {
  text-align: left;
  margin-bottom: 18px;
}

.settings-gate__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-gate__input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.settings-gate__input:focus {
  border-color: var(--accent, #ff6b35);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
}

.settings-gate__input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.settings-gate__status {
  font-size: 0.9rem;
  min-height: 1.4em;
  margin: 6px 0 12px;
  color: rgba(255, 255, 255, 0.6);
}

.settings-gate__status.error {
  color: #ff6b6b;
}

.settings-gate__status.ok {
  color: #51cf66;
}

.settings-gate__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.settings-gate__btn {
  background: var(--accent, #ff6b35);
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 32px;
  transition: filter 0.2s, transform 0.15s;
}

.settings-gate__btn:hover {
  filter: brightness(1.1);
}

.settings-gate__btn:active {
  transform: scale(0.97);
}

.settings-gate__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.settings-gate__hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
}

.settings-gate__link {
  background: none;
  border: none;
  color: var(--accent, #ff6b35);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
}

.settings-gate__link:hover {
  color: #ff8a5c;
}

.settings-gate__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  z-index: 1;
}

.settings-gate__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.settings-gate__card {
  position: relative;
}

.settings-gate__card--addon {
  width: min(520px, 100%);
  text-align: left;
}

/* ─── Catalog Settings Card Styles ─── */
.addon-catalog-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  text-align: left;
}

.addon-catalog-card--frozen {
  opacity: 0.65;
  user-select: none;
  cursor: not-allowed !important;
}

.addon-catalog-card--frozen .addon-catalog-card__modes,
.addon-catalog-card--frozen .addon-catalog-details,
.addon-catalog-card--frozen .addon-catalog-save-row {
  pointer-events: none !important;
  cursor: not-allowed !important;
}

.addon-catalog-card--frozen * {
  cursor: not-allowed !important;
}

.addon-catalog-card__frozen-notice {
  background: rgba(255, 107, 53, 0.14);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #ff9d76;
  display: flex;
  align-items: center;
  gap: 8px;
}

.addon-catalog-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.addon-catalog-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.addon-catalog-card__badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 210, 106, 0.15);
  color: #00d26a;
}

.addon-catalog-card__badge.disabled {
  background: rgba(255, 107, 53, 0.18);
  color: #ff8a5b;
}

.addon-catalog-card__modes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.addon-catalog-mode-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
}

.addon-catalog-mode-opt:hover {
  background: rgba(255, 255, 255, 0.06);
}

.addon-catalog-mode-opt:has(input:checked) {
  border-color: var(--accent, #ff6b35);
  background: rgba(255, 107, 53, 0.12);
}

.addon-catalog-mode-opt input {
  margin-top: 3px;
  accent-color: var(--accent, #ff6b35);
}

.addon-catalog-mode-opt__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.addon-catalog-mode-opt__info strong {
  font-size: 0.84rem;
  color: #fff;
}

.addon-catalog-mode-opt__info span {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.55);
}

.addon-catalog-details {
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  margin-top: 8px;
}

.addon-catalog-details.hidden {
  display: none !important;
}

.addon-catalog-section {
  margin-bottom: 12px;
}

.addon-catalog-section__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}

.addon-catalog-quick-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.addon-catalog-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.72rem;
  color: #ff8a5b;
  cursor: pointer;
  text-decoration: underline;
}

.addon-catalog-pill-group {
  display: flex;
  gap: 8px;
}

.addon-catalog-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  user-select: none;
}

.addon-catalog-pill:has(input:checked) {
  border-color: #00d26a;
  background: rgba(0, 210, 106, 0.12);
  color: #fff;
}

.addon-catalog-pill input {
  accent-color: #00d26a;
}

.addon-catalog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.addon-catalog-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.addon-catalog-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.addon-catalog-item:has(input:checked) {
  border-color: rgba(255, 107, 53, 0.5);
  background: rgba(255, 107, 53, 0.1);
  color: #fff;
}

.addon-catalog-item input {
  accent-color: var(--accent, #ff6b35);
}

.addon-catalog-save-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.addon-catalog-save-btn {
  padding: 8px 16px;
  font-size: 0.82rem;
  width: auto;
  margin-top: 0;
}

.addon-catalog-status-msg {
  font-size: 0.78rem;
  color: #00d26a;
  font-weight: 600;
}

.addon-catalog-status-msg.error {
  color: #ff4757;
}

.addon-stremio-sync {
  margin-top: 8px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-align: left;
}

.addon-stremio-sync__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.addon-stremio-sync__desc {
  margin: 0 0 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}

.addon-stremio-sync__desc code {
  font-size: 0.74rem;
  color: #ff8a5b;
}

.addon-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.addon-mode-toggle__option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.addon-mode-toggle__option:has(input:checked) {
  border-color: var(--accent, #ff6b35);
  background: rgba(255, 107, 53, 0.14);
  color: #fff;
}

.addon-mode-toggle__option:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.addon-mode-toggle__option input {
  margin: 0;
}

.addon-stremio-sync__url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  color: #00d26a;
  word-break: break-all;
  margin-bottom: 12px;
  min-height: 1.2em;
}

.addon-stremio-sync__hint {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.4);
}

.addon-stremio-sync__hint code {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.55);
}

.addon-stremio-sync__btn {
  width: 100%;
  margin-top: 4px;
  padding: 12px 16px;
}

/* ─── Connected-info section (overlay mode) ───────────────────── */

.settings-gate__connected-info {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  gap: 20px;
  padding: 8px 0 4px;
}

.settings-gate__addon-box {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  width: 100%;
  box-sizing: border-box;
}

.settings-gate__addon-link {
  color: var(--accent, #ff6b35);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s;
}

.settings-gate__addon-link:hover {
  opacity: 0.85;
  text-decoration: underline;
}

.settings-gate__connected-bot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.settings-gate__bot-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 2px;
}

.settings-gate__bot-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  word-break: break-word;
}

.settings-gate__bot-username {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.5);
  word-break: break-all;
}

.settings-gate__btn--danger {
  background: #e03131;
  min-width: 180px;
}

.settings-gate__tunnel-box {
  align-items: stretch;
  text-align: left;
}

.settings-gate__tunnel-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}

.settings-gate__tunnel-desc code {
  font-size: 0.74rem;
  color: #ff8a5b;
}

.settings-gate__tunnel-status {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.settings-gate__tunnel-status.is-on {
  color: #00d26a;
}

.settings-gate__tunnel-status.is-busy {
  color: #ffb020;
}

.settings-gate__tunnel-status.is-error {
  color: #ff6b6b;
}

.settings-gate__tunnel-url-row,
.settings-gate__tunnel-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.settings-gate__tunnel-url-row .settings-gate__input {
  font-family: monospace;
  font-size: 0.82rem;
  color: #ff8a5b;
}

.settings-gate__tunnel-url-row .settings-gate__btn,
.settings-gate__tunnel-actions .settings-gate__btn {
  white-space: nowrap;
  min-width: unset;
  padding: 10px 14px;
  font-size: 0.82rem;
}

.settings-gate__tunnel-actions .settings-gate__btn--danger {
  flex: 0 0 auto;
}

.settings-gate__tunnel-remote-note {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

.settings-gate__btn--danger:hover {
  background: #c92a2a;
  filter: brightness(1.05);
}

/* ─── Bot Pool Styles ────────────────────────────────────────── */

.settings-gate__bots-container {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.settings-gate__bots-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.settings-gate__bots-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-gate__bots-list {
  max-height: 150px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding-right: 2px;
}

.bot-pool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.bot-pool-item__info {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.bot-pool-item__dot {
  font-size: 0.65rem;
  flex-shrink: 0;
}

.bot-pool-item__dot--active {
  color: #51cf66;
}

.bot-pool-item__dot--inactive {
  color: #aaa;
}

.bot-pool-item__name-wrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.bot-pool-item__name {
  font-weight: 600;
  color: #fff;
}

.bot-pool-item__user {
  color: #aaa;
  font-size: 0.72rem;
  margin-left: 4px;
}

.bot-pool-item__actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.bot-pool-item__badge {
  font-size: 0.68rem;
  background: rgba(81, 207, 102, 0.15);
  color: #51cf66;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.bot-pool-item__set-btn {
  background: none;
  border: none;
  color: var(--accent, #ff6b35);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 4px;
  white-space: nowrap;
}

.bot-pool-item__set-btn:hover {
  text-decoration: underline;
}

.bot-pool-item__remove-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  flex-shrink: 0;
}

.bot-pool-item__remove-btn:hover {
  color: #ff4949;
}

/* ─── Mobile Optimizations for Settings Gate ─────────────────── */

@media (max-width: 600px) {
  .settings-gate {
    padding: 10px 8px;
    align-items: center;
  }

  .settings-gate__card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 20px);
    padding: 20px 12px 16px;
    border-radius: 14px;
    box-sizing: border-box;
  }

  .settings-gate__title {
    font-size: 1.3rem;
  }

  .settings-gate__desc {
    font-size: 0.82rem;
    margin-bottom: 16px;
  }

  .settings-gate__bot-icon {
    font-size: 1.8rem;
  }

  .settings-gate__bot-name {
    font-size: 1rem;
  }

  .settings-gate__bot-username {
    font-size: 0.82rem;
  }

  .settings-gate__connected-info {
    gap: 14px;
    padding: 4px 0;
    width: 100%;
  }

  .settings-gate__bots-container {
    padding: 10px 8px;
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .bot-pool-item {
    padding: 6px 8px;
    gap: 6px;
  }

  .bot-pool-item__name {
    font-size: 0.76rem;
  }

  .bot-pool-item__user {
    font-size: 0.7rem;
  }

  .settings-gate__input {
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  .settings-gate__btn {
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .settings-gate__btn--danger {
    min-width: unset;
  }
}

/* ─── Bot Status Badge (inline in navbar) ─────────────────────── */

.bot-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.bot-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  flex-shrink: 0;
}

.bot-status--connected::before {
  background: #51cf66;
  box-shadow: 0 0 6px rgba(81, 207, 102, 0.5);
}

.bot-status--connected {
  color: #51cf66;
}

/* ─── Loading screen ────────────────────────────────────────── */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--bg-primary, #141414);
  color: #fff;
}

.loading-screen__spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent, #ff6b35);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.loading-screen__text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ─── File detail resolving state ───────────────────────────── */

.file-detail__resolving {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.6);
}

.file-detail__resolving-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent, #ff6b35);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.file-detail__resolving-text {
  font-size: 0.95rem;
  margin: 0;
  animation: loading-pulse 1.5s ease-in-out infinite;
}

/* ─── Search results layout fix ──────────────────────────────── */

#searchResults {
  display: block !important;
}

/* ─── File Detail Page ────────────────────────────────────────── */

.file-detail-page {
  position: fixed;
  inset: 0;
  z-index: 1600;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary, #141414);
  color: #fff;
}

.file-detail__backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  opacity: 0.2;
  pointer-events: none;
}

.file-detail__backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    var(--bg-primary, #141414) 85%
  );
}

.file-detail__content {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.file-detail__back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  transition: background 0.2s;
}

.file-detail__back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.file-detail__info {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.file-detail__thumb {
  flex-shrink: 0;
  width: 240px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  aspect-ratio: 16 / 9;
}

.file-detail__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-detail__meta {
  flex: 1;
  min-width: 0;
}

.file-detail__title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-detail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.file-detail__tags .tag {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

.file-detail__size {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 20px;
}

.file-detail__actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.file-detail__stream-btn,
.file-detail__download-btn,
.file-detail__sponsor-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 10px;
  cursor: pointer;
  border: 0;
  text-decoration: none;
  transition: filter 0.2s, transform 0.15s;
}

.file-detail__stream-btn {
  background: var(--accent, #ff6b35);
  color: #fff;
}

.file-detail__stream-btn:hover {
  filter: brightness(1.1);
}

.file-detail__download-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.file-detail__download-btn:hover {
  background: rgba(255, 255, 255, 0.17);
}

.file-detail__sponsor-btn {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.25), rgba(255, 107, 53, 0.1));
  color: #fff;
  border: 1px solid var(--accent, #ff6b35);
}

.file-detail__sponsor-btn:hover {
  background: var(--accent, #ff6b35);
  color: #fff;
  filter: brightness(1.1);
}

.file-detail__stream-btn:active,
.file-detail__download-btn:active,
.file-detail__sponsor-btn:active {
  transform: scale(0.97);
}

/* ─── Stream app visibility toggle ────────────────────────────── */

.stream-app.hidden {
  display: none !important;
}

/* ─── Embedded video/audio player ───────────────────────────── */

.file-detail__player {
  margin-top: 28px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.file-detail__video {
  width: 100%;
  max-height: 70vh;
  display: block;
  outline: none;
}

.file-detail__audio {
  width: 100%;
  display: block;
  outline: none;
  padding: 20px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
}

.file-detail__audio::-webkit-media-controls-panel {
  background: #1a1a2e;
}

/* ─── Responsive: file detail page ────────────────────────────── */

@media (max-width: 700px) {
  .file-detail__content {
    padding: max(12px, env(safe-area-inset-top, 0px))
      max(16px, env(safe-area-inset-right, 0px))
      calc(24px + env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
  }

  .file-detail__back-btn {
    margin-bottom: 16px;
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .file-detail__info {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    text-align: left;
  }

  .file-detail__thumb {
    width: 100%;
    max-width: none;
    border-radius: 10px;
  }

  .file-detail__title {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }

  .file-detail__tags {
    justify-content: flex-start;
  }

  .file-detail__tags > div {
    width: 100%;
    box-sizing: border-box;
  }

  .file-detail__size {
    margin-bottom: 14px;
  }

  .file-detail__resolving {
    padding: 28px 8px;
    gap: 12px;
  }

  .file-detail__actions {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    gap: 10px;
  }

  .file-detail__stream-btn,
  .file-detail__download-btn,
  .file-detail__sponsor-btn {
    width: 100%;
    justify-content: center;
    padding: 13px 16px;
    font-size: 0.95rem;
  }

  .file-detail__player {
    margin-top: 18px;
    border-radius: 8px;
  }

  .file-detail__video {
    max-height: 52vh;
    background: #000;
  }

  .file-detail__audio {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .file-detail__content {
    padding: max(10px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      calc(20px + env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
  }

  .file-detail__title {
    font-size: 1.08rem;
    line-height: 1.35;
  }

  .file-detail__thumb {
    border-radius: 8px;
  }
}

/* ─── Category Page ──────────────────────────── */

.category-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  background: var(--bg-primary, #141414);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.category-page__header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-primary, #141414);
  border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.category-page__back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.category-page__back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.category-page__title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary, #fff);
}

.category-page__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.category-page__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--text-muted, #888);
  font-size: 0.9rem;
}

.category-page__sentinel {
  height: 1px;
}

/* Category page card variant */
.category-page .stream-card {
  width: 100%;
}

.category-page .stream-card__thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 6px;
}

.category-page .stream-file-card {
  width: 100%;
}

/* Responsive grid */
@media (max-width: 768px) {
  .category-page__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .category-page__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
  }
}

/* View All button in track headers */
.stream-content-row__view-all {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted, #aaa);
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
  margin-left: auto;
}

.stream-content-row__view-all:hover {
  background: var(--accent, #ff6b35);
  border-color: var(--accent, #ff6b35);
  color: #fff;
}

/* ─── Update Required Overlay ───────────────────────────────── */

.update-required {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #141414);
}

.update-required__card {
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 2.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.update-required__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.update-required__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text-primary, #fff);
}

.update-required__desc {
  font-size: 0.95rem;
  color: var(--text-muted, #999);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.update-required__details {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted, #999);
  margin-bottom: 1.5rem;
}

.update-required__details strong {
  color: var(--text-primary, #fff);
}

.update-required__link {
  display: inline-block;
  background: var(--accent, #ff6b35);
  color: #fff;
  padding: 0.7rem 2rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.2s;
}

.update-required__link:hover {
  opacity: 0.85;
}
