﻿/* ═══════════════════════════════════════════════════════════════════════════
   podcast.nassabeh.com — style.css
   THEME 01: CLASSIC — تم پایه (طلایی روی مشکی گرم)
   ─────────────────────────────────────────────────────────────────────────
   نسخهٔ ۴.۰ — بازطراحی‌شده برای app.js v34
   ─────────────────────────────────────────────────────────────────────────
   ساختار:
     ۰۰. فونت و پایه
     ۰۱. متغیرها (Design Tokens)
     ۰۲. ریست و پایه
     ۰۳. هدر
     ۰۴. نوار پخش‌کننده
     ۰۵. زیرنویس
     ۰۶. نمایشگر و نقشه
     ۰۷. تمام‌صفحه
     ۰۸. پنل تنظیمات
     ۰۹. مودال‌ها
     ۱۰. بریک‌پوینت‌های اختصاصی
     ۱۱. حالت افقی موبایل
     ۱۲. تبلت و دسکتاپ
     ۱۳. دسترس‌پذیری و کمکی
     ۱۴. اتصال به سیستم تم‌ها (theme-hooks)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۰. فونت
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'IRRoyaBold';
  src: url('fonts/IRRoyaBold.ttf') format('truetype');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۱. متغیرها — Design Tokens
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ═══ رنگ‌های تم پایه (theme1) ═══ */
  --bg-1: #0a0705;
  --bg-2: #1a1208;
  --panel: #14100a;
  --panel-2: #0a0805;
  --carbon: #0d0d0d;
  --gold: #d4af37;
  --gold-bright: #f5d76e;
  --gold-dim: #8a6e1f;
  --text: #f5e6a3;
  --text-dim: #a08f56;
  --green-play: #7ad04a;
  --green-play-bright: #9aed6a;
  --red-stop: #ff5b6e;
  --blue-info: #5ba9ff;
  --font-fa: 'IRRoyaBold', Tahoma, sans-serif;

  /* ═══ مقیاس فونت پویا ═══ */
  --fs-xs:  clamp(11.5px, 2.8vw, 13px);
  --fs-sm:  clamp(12.5px, 3.2vw, 14px);
  --fs-md:  clamp(13.5px, 3.6vw, 15.5px);
  --fs-lg:  clamp(15.5px, 4.2vw, 17.5px);
  --fs-xl:  clamp(18px, 4.8vw, 21px);
  --fs-xxl: clamp(22px, 5.8vw, 25px);

  /* ═══ فاصله‌ها ═══ */
  --gap-xs: clamp(2px, 0.5vw, 4px);
  --gap-sm: clamp(4px, 0.9vw, 7px);
  --gap-md: clamp(6px, 1.2vw, 10px);
  --gap-lg: clamp(10px, 1.6vw, 14px);

  /* ═══ شعاع ═══ */
  --radius-sm: clamp(5px, 1vw, 8px);
  --radius-md: clamp(8px, 1.4vw, 12px);
  --radius-lg: clamp(12px, 2vw, 16px);

  /* ═══ زیرنویس (توسط JS قابل تغییر) ═══ */
  --sub-fs: clamp(14px, 4vw, 20px);
  --sub-pad-x: clamp(8px, 2vw, 18px);
  --sub-pad-y: clamp(6px, 1.6vw, 12px);
  --subtitle-opacity: 0.72;      /* ✅ بهبودیافته از 0.55 برای خوانایی بهتر */

  /* ═══ ابعاد کنترل‌ها ═══ */
  --btn-h: clamp(28px, 4.4vw, 36px);
  --btn-h-lg: clamp(36px, 5.6vw, 48px);
  --icon-size: clamp(28px, 4.4vw, 34px);
  --touch-target: 44px;

  /* ═══ پدینگ‌ها ═══ */
  --header-pad-y: clamp(4px, 1vw, 6px);
  --header-pad-x: clamp(8px, 2vw, 10px);
  --player-pad-y: clamp(3px, 0.8vw, 5px);
  --player-pad-x: clamp(6px, 1.4vw, 8px);

  /* ═══ Safe Area (notch) ═══ */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* ═══ حاشیه طلایی گرادیانی ═══ */
  --border-gold: linear-gradient(135deg,
    rgba(255, 215, 0, .9), rgba(180, 140, 40, .6), rgba(90, 70, 20, .8),
    rgba(200, 160, 50, .55), rgba(120, 90, 25, .75), rgba(230, 190, 60, .65));

  /* ═══ ارتفاع Viewport با dvh ═══ */
  --viewport-h: 100vh;
}

@supports (height: 100dvh) {
  :root { --viewport-h: 100dvh; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۲. ریست و پایه
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font-fa);
  direction: rtl;
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(212, 175, 55, .08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(180, 140, 40, .06) 0%, transparent 45%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-1) 100%);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

#app {
  display: flex;
  flex-direction: column;
  min-height: var(--viewport-h);
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۳. هدر
   ═══════════════════════════════════════════════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-bottom: 1.5px solid var(--gold-dim);
  padding: calc(var(--header-pad-y) + var(--safe-top))
           calc(var(--header-pad-x) + var(--safe-right))
           var(--header-pad-y)
           calc(var(--header-pad-x) + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
  transition: background 0.4s ease;
}

.header-row-1 {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  min-height: var(--btn-h);
}

.header-chapter-icon {
  font-size: var(--fs-xxl);
  flex-shrink: 0;
  line-height: 1;
}

.header-chapter-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-chapter-title {
  font-size: var(--fs-md);
  font-weight: 900;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.header-chapter-sub {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ── وضعیت پخش ── */
.player-status {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .5);
  border: 1.5px solid var(--gold-dim);
  color: var(--text-dim);
  white-space: nowrap;
  transition: all 0.3s;
  display: none;
}

@media (min-width: 640px) {
  .player-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
}

.player-status[data-state="idle"] {
  background: rgba(0, 0, 0, .5);
  border-color: var(--gold-dim);
  color: var(--text-dim);
}

.player-status[data-state="loading"] {
  background: rgba(245, 215, 110, .15);
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  animation: pulse-gold 1.5s ease-in-out infinite;
}

.player-status[data-state="ready"] {
  background: rgba(91, 169, 255, .15);
  border-color: var(--blue-info);
  color: var(--blue-info);
}

.player-status[data-state="playing"] {
  background: rgba(122, 208, 74, .2);
  border-color: var(--green-play-bright);
  color: var(--green-play-bright);
  animation: pulse-green 1.8s ease-in-out infinite;
}

.player-status[data-state="paused"],
.player-status[data-state="ended"] {
  background: rgba(160, 143, 86, .15);
  border-color: var(--gold-dim);
  color: var(--text-dim);
}

.player-status[data-state="error"] {
  background: rgba(255, 91, 110, .2);
  border-color: var(--red-stop);
  color: var(--red-stop);
}

@keyframes pulse-gold {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245, 215, 110, .4); }
  50%      { opacity: 0.8; box-shadow: 0 0 0 6px rgba(245, 215, 110, 0); }
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(122, 208, 74, .4); }
  50%      { opacity: 0.85; box-shadow: 0 0 0 6px rgba(122, 208, 74, 0); }
}

.header-help {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  background: rgba(212, 175, 55, .08);
  border: 1px dashed var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 32%;
  display: none;
}

@media (min-width: 1000px) {
  .header-help { display: block; }
}

.header-actions {
  display: flex;
  gap: var(--gap-xs);
  flex-shrink: 0;
}

.icon-btn {
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, .1);
  border: 1.5px solid var(--gold-dim);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  transition: 0.2s;
  flex-shrink: 0;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

.icon-btn:hover {
  background: rgba(212, 175, 55, .3);
  border-color: var(--gold);
}

.icon-btn:active { transform: scale(0.94); }

/* ── چیپ فصل ── */
.header-chapters {
  display: flex;
  gap: var(--gap-xs);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
  min-height: 32px;
}

.header-chapters::-webkit-scrollbar { height: 3px; }
.header-chapters::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 2px;
}

.chapter-chip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 9px;
  background: rgba(212, 175, 55, .08);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
  user-select: none;
  min-width: 64px;
  line-height: 1.2;
}

.chapter-chip:hover {
  background: rgba(212, 175, 55, .2);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.chapter-chip.active {
  background: rgba(212, 175, 55, .3);
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow: 0 0 8px rgba(212, 175, 55, .4);
}

.chapter-chip .cc-icon { font-size: var(--fs-sm); }
.chapter-chip .cc-name { font-weight: 900; }
.chapter-chip .cc-time {
  font-family: monospace;
  font-size: 10px;
  opacity: 0.7;
  direction: ltr;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۴. نوار پخش‌کننده
   ═══════════════════════════════════════════════════════════════════════════ */

.player-bar {
  position: sticky;
  top: 0;
  z-index: 850;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-bottom: 2px solid var(--gold);
  padding: var(--player-pad-y) var(--player-pad-x);
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .7);
}

.pb-selectors {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.pb-selectors::-webkit-scrollbar { display: none; }

.pb-selector-item {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  flex: 1 1 0;
  min-width: 130px;
}

.pb-selector-item .sel-label {
  font-size: var(--fs-xs);
  color: var(--gold);
  font-weight: 900;
  flex-shrink: 0;
  white-space: nowrap;
}

.pb-selector-item .sel-icon {
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

.pb-select {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--gold-dim);
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 900;
  padding: 5px 7px;
  padding-left: 24px;
  cursor: pointer;
  min-height: var(--btn-h);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 4px center;
  background-size: 12px;
}

.pb-select:hover:not(:disabled) {
  border-color: var(--gold);
  background-color: rgba(212, 175, 55, .05);
}

.pb-select option {
  background: #14100a;
  color: var(--text);
}

.pb-select option[value=""] {
  color: var(--text-dim);
  font-style: italic;
}

.pb-select option:disabled {
  color: #5a4a25;
  font-style: italic;
}

/* ── نوار پیشرفت ── */
.pb-progress-wrap {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  height: 18px;
}

.pb-progress {
  flex: 1;
  height: 22px;
  background: transparent;
  border: none;
  position: relative;
  cursor: pointer;
  touch-action: none;
  direction: ltr;
  display: flex;
  align-items: center;
}

.pb-progress::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 7px;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, .7);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  z-index: 1;
}

.pb-progress-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 7px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  width: 0%;
  transition: width .12s linear;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
}

.pb-marks {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 7px;
  pointer-events: none;
  z-index: 3;
}

.pb-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--green-play);
  opacity: .8;
  border-radius: 1px;
}

.pb-time {
  font-family: monospace;
  font-size: var(--fs-xs);
  color: var(--gold-bright);
  background: rgba(0, 0, 0, .5);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--gold-dim);
  direction: ltr;
  white-space: nowrap;
  flex-shrink: 0;
}

.pb-controls {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.pb-controls::-webkit-scrollbar { display: none; }

.pb-btn {
  background: rgba(212, 175, 55, .1);
  border: 1.5px solid var(--gold-dim);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: var(--fs-md);
  font-weight: 900;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--btn-h);
  flex-shrink: 0;
  line-height: 1;
}

.pb-btn:hover:not(:disabled) {
  background: rgba(212, 175, 55, .25);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.pb-btn:active:not(:disabled) { transform: scale(0.94); }

.pb-btn.play-btn {
  background: rgba(122, 208, 74, .15);
  border-color: rgba(122, 208, 74, .5);
  color: var(--green-play);
  font-size: var(--fs-lg);
  min-width: var(--btn-h-lg);
}

.pb-btn.play-btn.ready {
  background: linear-gradient(135deg, rgba(122, 208, 74, .35), rgba(122, 208, 74, .2));
  border-color: var(--green-play-bright);
  color: #fff;
  box-shadow: 0 0 14px rgba(122, 208, 74, .6);
}

.pb-btn.play-btn.playing {
  background: linear-gradient(135deg, rgba(217, 64, 64, .4), rgba(217, 64, 64, .2));
  border-color: #ff5b6e;
  color: #fff;
}

.pb-btn.speed-btn {
  background: rgba(122, 208, 74, .1);
  border-color: rgba(122, 208, 74, .4);
  color: var(--green-play);
  font-family: monospace;
  min-width: 40px;
}

.pb-spacer { flex: 1; min-width: 4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۵. زیرنویس
   ═══════════════════════════════════════════════════════════════════════════ */

.subtitle-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.subtitle-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  padding: 5px 12px;
  background: linear-gradient(180deg, rgba(20, 16, 10, .95), rgba(10, 8, 5, .9));
  border: 1.5px solid var(--gold-dim);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 34px;
  font-size: var(--fs-xs);
  user-select: none;
}

.sub-ctrl-label-center {
  color: var(--gold);
  font-weight: 900;
  font-size: var(--fs-sm);
  white-space: nowrap;
  padding: 0 4px;
  letter-spacing: 0.5px;
}

.sub-ctrl-value {
  font-family: monospace;
  font-size: var(--fs-xs);
  color: var(--gold-bright);
  background: rgba(0, 0, 0, .55);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--gold-dim);
  min-width: 42px;
  text-align: center;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.sub-ctrl-btn {
  width: var(--btn-h);
  height: var(--btn-h);
  border-radius: 50%;
  font-size: var(--fs-lg);
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  border: 1.5px solid;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

.sub-ctrl-btn-minus {
  background: rgba(255, 91, 110, .12);
  border-color: rgba(255, 91, 110, .5);
  color: #ff9090;
}

.sub-ctrl-btn-minus:hover {
  background: rgba(255, 91, 110, .3);
  border-color: var(--red-stop);
  color: #fff;
  transform: scale(1.08);
}

.sub-ctrl-btn-minus:active {
  transform: scale(0.92);
  background: var(--red-stop);
  color: #fff;
}

.sub-ctrl-btn-plus {
  background: rgba(122, 208, 74, .12);
  border-color: rgba(122, 208, 74, .5);
  color: var(--green-play-bright);
}

.sub-ctrl-btn-plus:hover {
  background: rgba(122, 208, 74, .3);
  border-color: var(--green-play-bright);
  color: #fff;
  transform: scale(1.08);
}

.sub-ctrl-btn-plus:active {
  transform: scale(0.92);
  background: var(--green-play);
  color: #000;
}

.subtitle-row {
  position: relative;
  display: flex;
  align-items: stretch;
  background: rgba(10, 7, 5, var(--subtitle-opacity));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid var(--gold);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  min-height: 50px;
  max-height: 30vh;
  overflow: hidden;
  transition: 0.2s;
  direction: rtl;                /* ✅ پیش‌فرض rtl — JS در صورت نیاز تغییر می‌دهد */
}

.subtitle-row.hidden { display: none; }

.sub-text-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sub-pad-y) var(--sub-pad-x);
  text-align: center;
  color: #fff;
  font-weight: bold;
  font-size: var(--sub-fs);
  line-height: 1.5;
  white-space: pre-line;         /* ✅ حفظ خطوط جدید بدون innerHTML */
  word-wrap: break-word;
  overflow: hidden;
  min-width: 0;
  transition: color 0.2s, background 0.2s;
}

.sub-shadow {
  text-shadow:
    0 0 6px rgba(0, 0, 0, 1),
    0 0 12px rgba(0, 0, 0, 0.85),
    0 2px 3px rgba(0, 0, 0, 0.95);
}

.sub-text-area > span {
  width: 100%;
  display: block;
}

.fs-sub-large {
  font-size: clamp(18px, 4vw, 44px);
  min-height: 80px;
  max-height: 40vh;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۶. نمایشگر و نقشه
   ═══════════════════════════════════════════════════════════════════════════ */

.main-scroll {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-md);
  padding: var(--gap-md);
  padding-bottom: calc(var(--gap-md) + var(--safe-bottom));
  min-height: 0;
}

.zone-controls-bar {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 4px 8px;
  background: linear-gradient(180deg, rgba(20, 16, 10, .95), rgba(10, 8, 5, .9));
  border: 1.5px solid var(--gold-dim);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 34px;
  font-size: var(--fs-xs);
  user-select: none;
}

.zone-ctrl-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.zone-ctrl-left { order: 1; }
.zone-ctrl-right { order: 3; margin-left: auto; }

.zone-ctrl-label {
  order: 2;
  flex: 1;
  text-align: center;
  color: var(--gold);
  font-weight: 900;
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}

.zone-ctrl-btn {
  width: var(--btn-h);
  height: var(--btn-h);
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, .1);
  border: 1.5px solid var(--gold-dim);
  color: var(--gold-bright);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

.zone-ctrl-btn:hover {
  background: rgba(212, 175, 55, .3);
  border-color: var(--gold);
  color: #fff;
}

.zone-ctrl-btn:active { transform: scale(0.92); }

.zone-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-width: 0;
}

/* ── نمایشگر ── */
.zone-display {
  position: relative;
  background: var(--carbon);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .8);
  display: block;
  padding: 6px;
  overflow: hidden;
  transition: aspect-ratio 0.3s ease, max-height 0.3s ease;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: min(75vh, calc(100vw * 0.75));
  align-self: center;
  justify-self: center;
  margin-inline: auto;
}

.zone-display[data-orient="vertical"] {
  aspect-ratio: 3 / 4;
  max-height: min(80vh, calc(100vh - 240px));
  width: min(100%, calc(80vh * 0.75));
  max-width: 100%;
}

.zone-display[data-orient="horizontal"] {
  aspect-ratio: 4 / 3;
  max-height: min(70vh, calc(100vw * 0.75));
  width: min(100%, calc(70vh * 1.333));
  max-width: 100%;
}

.zone-display::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 2px;
  background: var(--border-gold);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 30;
}

.slide-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #000;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.slide-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  overflow: hidden;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.slide-frame img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

.slide-frame.transition-fade { transition: opacity 0.5s ease; }

.slide-frame.transition-slide-right {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
  transform: translateX(100%);
  opacity: 0;
}
.slide-frame.transition-slide-right.active {
  transform: translateX(0);
  opacity: 1;
}
.slide-frame.transition-slide-right.leaving {
  transform: translateX(-100%);
  opacity: 0;
}

.slide-frame.transition-slide-left {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
  transform: translateX(-100%);
  opacity: 0;
}
.slide-frame.transition-slide-left.active {
  transform: translateX(0);
  opacity: 1;
}
.slide-frame.transition-slide-left.leaving {
  transform: translateX(100%);
  opacity: 0;
}

.slide-frame.transition-zoom {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
  transform: scale(0.85);
  opacity: 0;
}
.slide-frame.transition-zoom.active {
  transform: scale(1);
  opacity: 1;
}
.slide-frame.transition-zoom.leaving {
  transform: scale(1.15);
  opacity: 0;
}

.slide-frame.transition-flip {
  transition: transform 0.6s ease, opacity 0.5s ease;
  transform: perspective(1200px) rotateY(90deg);
  opacity: 0;
}
.slide-frame.transition-flip.active {
  transform: perspective(1200px) rotateY(0);
  opacity: 1;
}
.slide-frame.transition-flip.leaving {
  transform: perspective(1200px) rotateY(-90deg);
  opacity: 0;
}

.slide-frame.active {
  opacity: 1;
  z-index: 2;
}

.slide-sample {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 8px;
  text-align: center;
}

.slide-sample .ss-icon { font-size: 2rem; }
.slide-sample .ss-num {
  font-family: monospace;
  font-size: 1.3rem;
  font-weight: 900;
  padding: 4px 16px;
  border-radius: var(--radius-md);
  border: 2px solid;
  letter-spacing: 2px;
}
.slide-sample .ss-title { font-size: var(--fs-lg); font-weight: 900; }
.slide-sample .ss-code {
  font-family: monospace;
  font-size: var(--fs-sm);
  background: rgba(0, 0, 0, .5);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  color: #7FFFD4;
  word-break: break-all;
  max-width: 90%;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  gap: 12px;
  color: var(--text-dim);
}

.empty-state .es-icon { font-size: 2.2rem; opacity: 0.5; }
.empty-state .es-title { font-size: var(--fs-lg); color: var(--gold); }
.empty-state .es-desc { font-size: var(--fs-sm); line-height: 1.7; }

/* ── Orient Selector ── */
.orient-selector {
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, .85);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 2px;
}

.orient-btn {
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 28px;
  position: relative;
}

.orient-btn:hover {
  background: rgba(212, 175, 55, .2);
  color: var(--gold-bright);
}

.orient-btn.active {
  background: var(--gold);
  color: #000;
}

.orient-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .96);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  font-family: var(--font-fa);
}

/* ── نقشه ── */
.zone-map {
  position: relative;
  background: var(--carbon);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  transition: aspect-ratio 0.3s ease, max-height 0.3s ease;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: min(75vh, calc(100vw * 0.75));
  align-self: center;
  justify-self: center;
  margin-inline: auto;
}

.zone-map[data-orient="vertical"] {
  aspect-ratio: 3 / 4;
  max-height: min(80vh, calc(100vh - 240px));
  width: min(100%, calc(80vh * 0.75));
  max-width: 100%;
}

.zone-map[data-orient="horizontal"] {
  aspect-ratio: 4 / 3;
  max-height: min(70vh, calc(100vw * 0.75));
  width: min(100%, calc(70vh * 1.333));
  max-width: 100%;
}

.zone-map::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 2px;
  background: var(--border-gold);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 30;
}

.map-top-strip {
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(10, 8, 5, .98), rgba(20, 16, 10, .92));
  border-bottom: 1.5px solid var(--gold-dim);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 42px;
  font-size: var(--fs-xs);
  position: relative;
  z-index: 15;
  flex-wrap: wrap;
}

.map-coords-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.map-coords {
  font-family: monospace;
  color: #7FFFD4;
  direction: ltr;
  background: rgba(0, 0, 0, .5);
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid transparent;
}

.map-coords:hover {
  background: rgba(46, 197, 255, .2);
  border-color: #7FFFD4;
}

.map-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, rgba(122, 208, 74, .2), rgba(122, 208, 74, .1));
  border: 1px solid rgba(122, 208, 74, .5);
  color: var(--green-play-bright);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.15s;
}

.map-nav-btn:hover {
  background: linear-gradient(135deg, rgba(122, 208, 74, .4), rgba(122, 208, 74, .2));
  border-color: var(--green-play-bright);
  color: #fff;
}

.map-count {
  font-family: monospace;
  color: var(--gold-bright);
  background: rgba(212, 175, 55, .15);
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  font-weight: 900;
  flex-shrink: 0;
}

.map-slider {
  flex: 1;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, rgba(212, 175, 55, .15), rgba(212, 175, 55, .5));
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0 4px;
  min-width: 60px;
}

.map-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid var(--panel);
  cursor: pointer;
  box-shadow: 0 0 4px var(--gold-bright);
}

.map-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid var(--panel);
  cursor: pointer;
}

#map {
  flex: 1;
  width: 100%;
  background: #041018;
  min-height: 100px;
}

.leaflet-container {
  background: #041018 !important;
  font-family: var(--font-fa) !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(10, 7, 5, .96);
  color: #fff;
  border: 2px solid var(--gold);
  border-radius: var(--radius-md);
}

.leaflet-popup-tip {
  background: rgba(10, 7, 5, .96);
  border: 2px solid var(--gold);
}

.leaflet-popup-close-button {
  color: var(--gold-bright) !important;
  font-size: 1.1rem !important;
  font-weight: bold !important;
  top: 4px !important;
  right: 4px !important;
  width: 22px !important;
  height: 22px !important;
  line-height: 20px !important;
  border-radius: 50% !important;
  background: rgba(212, 175, 55, .15) !important;
}

.leaflet-popup-content {
  margin: 10px 12px;
  font-family: var(--font-fa);
  direction: rtl;
  text-align: right;
  min-width: 160px;
  font-size: var(--fs-sm);
}

.popup-title {
  font-size: var(--fs-lg);
  font-weight: 900;
  color: var(--gold-bright);
  margin-bottom: 5px;
}

.popup-desc {
  font-size: var(--fs-sm);
  color: #fff;
  line-height: 1.6;
  margin-bottom: 6px;
}

.popup-coords {
  font-family: monospace;
  font-size: var(--fs-xs);
  color: #7FFFD4;
  direction: ltr;
  text-align: left;
  background: rgba(0, 0, 0, .5);
  padding: 3px 7px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 5px;
}

.popup-nav-btn {
  display: block;
  width: 100%;
  margin: 6px 0 4px;
  padding: 7px 11px;
  background: linear-gradient(135deg, rgba(122, 208, 74, .3), rgba(122, 208, 74, .15));
  border: 1px solid var(--green-play-bright);
  color: #fff;
  border-radius: 6px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 900;
  cursor: pointer;
  text-align: center;
  transition: 0.15s;
}

.popup-nav-btn:hover {
  background: linear-gradient(135deg, rgba(122, 208, 74, .5), rgba(122, 208, 74, .3));
}

.popup-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.popup-keywords .kw {
  font-size: var(--fs-xs);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(212, 175, 55, .2);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, .4);
}

.map-toolbar {
  flex-shrink: 0;
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 4px 6px;
  background: rgba(0, 0, 0, .85);
  overflow-x: auto;
  min-height: 34px;
  border-top: 1px solid rgba(212, 175, 55, .2);
  scrollbar-width: none;
}

.map-toolbar::-webkit-scrollbar { display: none; }

.map-toolbar-label {
  font-size: var(--fs-xs);
  color: var(--gold);
  padding: 0 3px;
}

.map-toolbar button {
  background: rgba(212, 175, 55, .08);
  border: 1px solid var(--gold-dim);
  color: var(--text-dim);
  font-size: var(--fs-xs);
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 4px;
  transition: 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.map-toolbar button:hover,
.map-toolbar button.active {
  background: rgba(212, 175, 55, .3);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.map-toolbar .sep {
  width: 1px;
  height: 14px;
  background: var(--gold-dim);
  margin: 0 2px;
  flex-shrink: 0;
}

.fs-exit-inline {
  display: none;
  background: rgba(217, 64, 64, .25) !important;
  border-color: rgba(217, 64, 64, .6) !important;
  color: #ff9090 !important;
  font-weight: 900 !important;
}

body.fs-map .fs-exit-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 3px;
}

body.fs-map .fs-exit-inline:hover {
  background: rgba(217, 64, 64, .5) !important;
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۷. تمام‌صفحه
   ═══════════════════════════════════════════════════════════════════════════ */

body.fs-mode { overflow: hidden; }

body.fs-mode #app > header,
body.fs-mode #app > .player-bar {
  display: none !important;
}

body.fs-mode .main-scroll {
  padding: 0;
  gap: 0;
  overflow: hidden;
  height: var(--viewport-h);
  display: flex;
  flex-direction: column;
}

body.fs-mode .zone-controls-bar { display: none !important; }

body.fs-mode .zone-display,
body.fs-mode .zone-map {
  border-radius: 0;
  padding: 0;
  max-height: none;
  width: 100%;
  aspect-ratio: auto;
}

body.fs-mode .zone-display::before,
body.fs-mode .zone-map::before {
  border-radius: 0;
  display: none;
}

body.fs-mode .zone-wrapper { gap: 0; }

/* ── تمام‌صفحه: پخش‌کننده ── */
body.fs-player .main-scroll {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  padding: 16px;
  gap: 12px;
}

body.fs-player .zone-wrapper { display: none; }
body.fs-player .fs-player-panel { display: flex !important; }

.fs-player-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
  background: rgba(10, 7, 5, .7);
  border: 2px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .7);
  margin: 0 auto;
  max-width: 900px;
  width: 100%;
}

/* ── تمام‌صفحه: نمایشگر ── */
body.fs-display .main-scroll {
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}

body.fs-display .zone-display {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-height: none;
  align-self: center;
  justify-self: center;
  border-radius: 0;
}

body.fs-display[data-orient-page="portrait"] .zone-display {
  aspect-ratio: 3 / 4;
  max-width: min(100%, calc(100dvh * 0.75));
  margin-inline: auto;
}

body.fs-display .zone-wrapper.map-wrapper { display: none; }
body.fs-display .fs-bottom-bar { display: flex !important; }

/* ── تمام‌صفحه: نقشه ── */
body.fs-map .main-scroll {
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}

body.fs-map .zone-map {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-height: none;
  align-self: center;
  justify-self: center;
  border-radius: 0;
}

body.fs-map[data-orient-page="portrait"] .zone-map {
  aspect-ratio: 3 / 4;
  max-width: min(100%, calc(100dvh * 0.75));
  margin-inline: auto;
}

body.fs-map .zone-wrapper.display-wrapper { display: none; }
body.fs-map .fs-bottom-bar { display: flex !important; }

/* ── نوار پایین تمام‌صفحه ── */
.fs-bottom-bar {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-top: 2px solid var(--gold);
  padding: 8px;
  padding-bottom: calc(8px + var(--safe-bottom));
  flex-shrink: 0;
  z-index: 100;
}

.subtitle-controls-fs {
  border: 1.5px solid var(--gold-dim);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: none;
}

.fs-row-1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fs-mini-preview,
.fs-mini-map {
  width: clamp(68px, 12vw, 90px);
  height: clamp(68px, 12vw, 90px);
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .7);
  display: none;
  user-select: none;
}

.fs-mini-preview { background: #000; }
.fs-mini-map { background: #041018; }

.fs-mini-preview * { pointer-events: none; }

.fs-mini-preview:hover,
.fs-mini-map:hover {
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(212, 175, 55, .7);
}

.fs-mini-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  pointer-events: none;
}

.fs-mini-preview .mini-content {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
  color: var(--gold);
}

.fs-mini-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, .95), rgba(0, 0, 0, .6));
  color: var(--gold-bright);
  font-size: 9px;
  font-weight: 900;
  padding: 3px 4px;
  text-align: center;
  pointer-events: none;
  border-top: 1px solid rgba(212, 175, 55, .4);
}

.fs-mini-map .mini-map-inner,
.fs-mini-map .mini-map-inner * {
  pointer-events: none !important;
}

.fs-mini-map .mini-map-inner {
  width: 100%;
  height: 100%;
}

body.fs-display .fs-mini-map { display: block; }
body.fs-display .fs-mini-preview { display: none; }
body.fs-map .fs-mini-preview { display: block; }
body.fs-map .fs-mini-map { display: none; }

.fs-mini-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
}

.fs-mini-btn {
  width: var(--btn-h-lg);
  height: var(--btn-h-lg);
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, .1);
  border: 1.5px solid var(--gold-dim);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
  font-family: inherit;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

.fs-mini-btn:hover {
  background: rgba(212, 175, 55, .3);
  border-color: var(--gold);
}

.fs-mini-btn:active { transform: scale(0.94); }

.fs-mini-btn.play-fs {
  background: rgba(122, 208, 74, .15);
  border-color: rgba(122, 208, 74, .5);
  color: var(--green-play);
}

.fs-mini-btn.speed-btn-mini {
  font-family: monospace;
  font-size: var(--fs-sm);
  background: rgba(122, 208, 74, .1);
  border-color: rgba(122, 208, 74, .4);
  color: var(--green-play);
}

.fs-mini-time {
  font-family: monospace;
  font-size: var(--fs-sm);
  color: var(--gold-bright);
  background: rgba(0, 0, 0, .5);
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--gold-dim);
  white-space: nowrap;
  direction: ltr;
  flex-shrink: 0;
}

.fs-mini-title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.fs-exit-display-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
  width: clamp(52px, 10vw, 64px);
}

.fs-exit-display-col .fs-mini-time {
  width: 100%;
  text-align: center;
}

.fs-exit-display-col .fs-exit-btn-display {
  width: 100%;
  height: var(--btn-h-lg);
  border-radius: var(--radius-sm);
  background: rgba(217, 64, 64, .25);
  border: 1.5px solid rgba(217, 64, 64, .6);
  color: #ff9090;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 900;
  cursor: pointer;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.fs-exit-display-col .fs-exit-btn-display:hover {
  background: rgba(217, 64, 64, .5);
  color: #fff;
}

body:not(.fs-display) .fs-exit-display-col { display: none !important; }

.fs-row-2 { width: 100%; }

.fs-row-2 .subtitle-row {
  width: 100%;
  min-height: 52px;
  max-height: 22vh;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.exit-fs-btn {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: calc(16px + var(--safe-left));
  z-index: 3000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10, 7, 5, .92);
  border: 2px solid var(--gold);
  color: var(--gold-bright);
  font-size: var(--fs-lg);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .7);
  font-family: inherit;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.fs-player .exit-fs-btn { display: flex; }
body.fs-map .exit-fs-btn,
body.fs-display .exit-fs-btn { display: none !important; }

.exit-fs-btn:hover {
  background: var(--gold);
  color: #000;
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۸. پنل تنظیمات
   ═══════════════════════════════════════════════════════════════════════════ */

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: min(400px, 88vw);
  height: var(--viewport-h);
  z-index: 1500;
  background: rgba(10, 7, 5, .98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
  padding-right: calc(16px + var(--safe-right));
  box-shadow: -12px 0 40px rgba(0, 0, 0, .9);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.settings-panel.open { transform: translateX(0); }

.settings-title {
  font-size: var(--fs-lg);
  color: var(--gold-bright);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gold-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
}

.settings-close {
  color: var(--text-dim);
  font-size: var(--fs-xl);
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-close:hover {
  background: rgba(217, 64, 64, .2);
  color: #ff9090;
}

.settings-section {
  font-size: var(--fs-sm);
  color: var(--gold-bright);
  margin: 16px 0 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--gold-dim);
  font-weight: 900;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.setting-row > label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gold);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
}

.setting-row > label .val {
  color: var(--text);
  background: rgba(212, 175, 55, .1);
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--gold-dim);
  font-size: var(--fs-xs);
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.setting-row input[type="range"] {
  width: 100%;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--panel);
  cursor: pointer;
  box-shadow: 0 0 6px var(--gold);
  margin-top: -8px;
}

.setting-row input[type="range"]::-moz-range-track {
  height: 6px;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
}

.setting-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--panel);
  cursor: pointer;
}

.setting-row input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.setting-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.setting-switch > span {
  color: var(--gold);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--gold-dim);
  border-radius: 13px;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
  min-width: 46px;
  min-height: 26px;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: var(--gold);
  border-radius: 50%;
  transition: 0.2s;
}

.switch-track.on {
  background: rgba(212, 175, 55, .4);
  border-color: var(--gold-bright);
}

.switch-track.on::after {
  right: calc(100% - 22px);
  background: var(--gold-bright);
  box-shadow: 0 0 8px var(--gold-bright);
}

.setting-select {
  width: 100%;
  padding: 9px 11px;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 900;
  cursor: pointer;
  min-height: var(--touch-target);
}

.setting-select option { background: #14100a; color: var(--text); }

.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۰۹. مودال‌ها
   ═══════════════════════════════════════════════════════════════════════════ */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
  overflow-y: auto;
}

.confirm-overlay.open { display: flex; }

.confirm-dialog {
  max-width: min(440px, 100%);
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 0;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .9);
}

.confirm-dialog .cd-scroll-body {
  padding: 20px 20px 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.confirm-dialog .cd-footer {
  padding: 12px 20px 18px;
  border-top: 1px solid rgba(212, 175, 55, .2);
  background: rgba(0, 0, 0, .2);
  flex-shrink: 0;
}

.confirm-dialog .cd-icon { font-size: 2rem; margin-bottom: 10px; }
.confirm-dialog .cd-title {
  font-size: var(--fs-xl);
  font-weight: 900;
  color: var(--gold-bright);
  margin-bottom: 10px;
}
.confirm-dialog .cd-message {
  font-size: var(--fs-md);
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 12px;
  text-align: right;
}
.confirm-dialog .cd-message strong { color: var(--gold-bright); }
.confirm-dialog .cd-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.confirm-dialog .cd-btn {
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 900;
  cursor: pointer;
  border: 2px solid;
  min-width: 96px;
  min-height: var(--touch-target);
  transition: 0.2s;
  font-family: inherit;
}
.confirm-dialog .cd-btn.cancel {
  background: rgba(217, 64, 64, .15);
  border-color: rgba(217, 64, 64, .5);
  color: #ff9090;
}
.confirm-dialog .cd-btn.confirm {
  background: rgba(122, 208, 74, .2);
  border-color: var(--green-play-bright);
  color: #fff;
}

.nav-dialog { max-width: min(480px, 100%); }

.nav-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.nav-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  background: rgba(212, 175, 55, .06);
  border: 1.5px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: 0.15s;
  text-align: right;
  font-family: inherit;
  color: var(--text);
  width: 100%;
  min-height: var(--touch-target);
}

.nav-option:hover {
  background: rgba(212, 175, 55, .15);
  border-color: var(--gold);
}

.nav-option .nav-icon { font-size: 1.4rem; flex-shrink: 0; }
.nav-option .nav-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nav-option .nav-name {
  font-size: var(--fs-md);
  font-weight: 900;
  color: var(--gold-bright);
}
.nav-option .nav-desc {
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

.nav-coords-display {
  font-family: monospace;
  font-size: var(--fs-xs);
  color: #7FFFD4;
  direction: ltr;
  background: rgba(0, 0, 0, .5);
  padding: 6px 10px;
  border-radius: 4px;
  margin: 8px auto 12px;
  display: inline-block;
  border: 1px solid rgba(127, 255, 212, .3);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۱۰. بریک‌پوینت‌های اختصاصی
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .header-help { display: none; }
  .pb-selector-item .sel-label { display: none; }

  .zone-display,
  .zone-map {
    border-radius: var(--radius-sm);
  }

  .orient-btn {
    min-width: 26px;
    min-height: 24px;
    padding: 3px 6px;
  }

  .fs-mini-preview,
  .fs-mini-map {
    width: 68px;
    height: 68px;
  }

  .map-top-strip {
    min-height: 38px;
    padding: 4px 6px;
  }

  .zone-controls-bar {
    min-height: 32px;
    padding: 3px 6px;
  }

  .subtitle-controls-bar {
    min-height: 32px;
    padding: 4px 8px;
  }
}

@media (min-width: 481px) and (max-width: 639px) {
  .header-help { display: none; }

  .zone-display[data-orient="vertical"],
  .zone-map[data-orient="vertical"] {
    width: min(100%, calc(75vh * 0.75));
  }

  .fs-mini-preview,
  .fs-mini-map {
    width: 76px;
    height: 76px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۱۱. حالت افقی موبایل
   ═══════════════════════════════════════════════════════════════════════════ */

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --fs-xs: clamp(10.5px, 1.6vw, 12px);
    --fs-sm: clamp(11.5px, 1.8vw, 13px);
    --fs-md: clamp(12.5px, 2vw, 14px);
    --fs-lg: clamp(14px, 2.2vw, 15.5px);
    --fs-xl: clamp(16px, 2.6vw, 18px);
    --fs-xxl: clamp(19px, 3vw, 22px);
    --sub-fs: clamp(13px, 2.2vw, 16px);
    --sub-pad-y: 6px;
    --gap-md: 6px;
    --gap-lg: 9px;
    --btn-h: 28px;
    --btn-h-lg: 34px;
    --icon-size: 28px;
    --header-pad-y: 3px;
    --header-pad-x: 8px;
    --player-pad-y: 3px;
    --player-pad-x: 6px;
  }

  .header {
    padding: 3px 8px;
    gap: 3px;
  }

  .header-row-1 { min-height: 26px; }
  .header-chapters { min-height: 24px; }

  .chapter-chip {
    padding: 3px 7px;
    min-width: 56px;
  }

  .chapter-chip .cc-time { font-size: 9px; }

  .player-bar {
    padding: 3px 6px;
    gap: 3px;
  }

  .pb-select { min-height: 28px; padding: 3px 6px; }
  .pb-btn { min-height: 28px; padding: 3px 6px; }
  .pb-btn.play-btn { min-width: 42px; }
  .pb-progress { height: 20px; }
  .pb-progress::before,
  .pb-progress-fill,
  .pb-marks { height: 6px; }

  .zone-display[data-orient="horizontal"],
  .zone-map[data-orient="horizontal"] {
    max-height: 55vh;
  }

  .zone-display[data-orient="vertical"],
  .zone-map[data-orient="vertical"] {
    max-height: 65vh;
  }

  .subtitle-row {
    min-height: 40px;
    max-height: 26vh;
  }

  .sub-text-area {
    font-size: clamp(12px, 2vw, 15px);
    padding: 5px 8px;
  }

  .orient-selector { padding: 1px; gap: 1px; }

  .orient-btn {
    padding: 2px 5px;
    font-size: 11px;
    min-width: 22px;
    min-height: 20px;
  }

  .orient-btn[data-tooltip]:hover::after { display: none; }

  .map-top-strip {
    min-height: 34px;
    padding: 3px 6px;
  }

  .map-toolbar { min-height: 30px; padding: 3px 5px; }

  .map-toolbar button { padding: 3px 7px; font-size: 10px; }

  .fs-bottom-bar { padding: 5px; gap: 4px; }

  .fs-mini-preview,
  .fs-mini-map { width: 60px; height: 60px; }

  .fs-mini-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .fs-row-2 .subtitle-row { min-height: 36px; max-height: 30vh; }

  .settings-panel { max-width: min(360px, 70vw); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۱۲. تبلت و دسکتاپ
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 640px) and (max-width: 900px) {
  .main-scroll {
    grid-template-columns: 1fr;
    gap: var(--gap-md);
  }

  .fs-player-panel { grid-column: 1 / -1; }
  .zone-wrapper { min-width: 0; }

  .zone-display,
  .zone-map {
    max-height: min(70vh, calc(100vw * 0.75));
  }
}

@media (min-width: 901px) and (max-width: 1023px) {
  .main-scroll {
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-md);
  }

  .fs-player-panel { grid-column: 1 / -1; }

  .zone-display,
  .zone-map {
    max-height: min(65vh, calc(50vw * 0.75));
  }

  .zone-display[data-orient="vertical"],
  .zone-map[data-orient="vertical"] {
    max-height: 60vh;
    width: min(100%, calc(60vh * 0.75));
  }
}

@media (min-width: 1024px) {
  .main-scroll {
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-lg);
    padding: var(--gap-lg);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
  }

  .fs-player-panel { grid-column: 1 / -1; }

  .zone-display,
  .zone-map {
    max-height: min(70vh, calc(50vw * 0.75));
  }

  .zone-display[data-orient="vertical"],
  .zone-map[data-orient="vertical"] {
    max-height: 60vh;
    width: min(100%, calc(60vh * 0.75));
  }

  .zone-display[data-orient="horizontal"],
  .zone-map[data-orient="horizontal"] {
    max-height: min(70vh, calc(50vw * 0.75));
  }
}

@media (min-width: 1400px) {
  .main-scroll { max-width: 1600px; }

  .zone-display,
  .zone-map {
    max-height: min(72vh, calc(50vw * 0.75));
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۱۳. دسترس‌پذیری و کمکی
   ═══════════════════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --text: #ffffff;
    --text-dim: #e0cf9a;
    --gold-dim: #b89840;
    --subtitle-opacity: 0.85;   /* ✅ خوانایی بالاتر در حالت کنتراست بالا */
  }

  .sub-shadow {
    text-shadow:
      0 0 4px #000,
      0 0 8px #000,
      0 2px 3px #000,
      1px 1px 0 #000,
      -1px -1px 0 #000;
  }

  button {
    border-width: 2px;
  }

  .pb-select,
  .pb-btn,
  .icon-btn,
  .sub-ctrl-btn {
    border-width: 2px;
  }
}

@media print {
  .header,
  .player-bar,
  .zone-controls-bar,
  .settings-panel,
  .confirm-overlay,
  .exit-fs-btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .main-scroll {
    display: block;
    padding: 0;
  }

  .zone-display,
  .zone-map {
    border: 1px solid #ccc;
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ۱۴. اتصال به سیستم تم‌ها — Theme Hooks
   ─────────────────────────────────────────────────────────────────────────
   کلاس‌های زیر توسط JS (Theme.init) روی <body> قرار می‌گیرند:
       .theme-theme1  → کلاسیک (همین فایل — بدون override)
       .theme-theme2  → شفق چندرنگ (themes/theme-02-aurora.css)
       .theme-theme3  → فلز آینده (themes/theme-03-cocoa.css)
       .theme-theme4  → رنگ زمینی (themes/theme-04-atlas.css)
       .theme-theme5  → شیشه‌ای تیره (themes/theme-05-glass-dark.css)

   همچنین JS ویژگی‌های زیر را روی <body> قرار می‌دهد (برای CSS targeting):
       data-theme="themeX"       — شناسهٔ تم فعلی
       data-screen-mode="..."    — portrait-mobile | landscape-mobile | ...
       data-is-portrait="true|false"
       data-is-short-landscape="true|false"
       data-orient-page="..."    — فقط در حالت تمام‌صفحه
       data-page-aspect="9-16|16-9" — فقط در حالت تمام‌صفحه
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── state-hook: تم ۱ (کلاسیک) ── */
body.theme-theme1 {
  /* ارث‌بری کامل از :root — نیازی به تکرار نیست */
}

/* ── state-hook: در حالت تمام‌صفحه‌ی landscape کوتاه ── */
body[data-screen-mode="landscape-short"].fs-mode .main-scroll {
  padding: 0;
}

/* ── state-hook: portrait-page در تمام‌صفحه ── */
body[data-orient-page="portrait"].fs-display .zone-display,
body[data-orient-page="portrait"].fs-map .zone-map {
  /* اطمینان از نسبت ۳:۴ در حالت portrait تمام‌صفحه */
  aspect-ratio: 3 / 4;
  margin-inline: auto;
}

/* ── state-hook: ارتفاع کم در landscape (جلوگیری از بریدگی) ── */
body[data-is-short-landscape="true"] .header,
body[data-is-short-landscape="true"] .player-bar {
  min-height: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   پایان style.css v4.0
   ═══════════════════════════════════════════════════════════════════════════ */