  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    background: #000;
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
    font-family: 'IRANSansX';
    direction: rtl;
  }

  #reels-container {
    height: 100dvh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #reels-container::-webkit-scrollbar { display: none; }

  .reel-item {
    height: 100dvh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* موبایل: card تمام صفحه */
  .reel-card {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
  }

  .reel-video {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    /* object-fit توسط JS بر اساس VIDEO_ZOOM_ENABLED تنظیم میشه */
  }

  .reel-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    transition: opacity 0.3s;
    z-index: 1;
  }

  .reel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to top,
      rgba(0,0,0,0.82) 0%,
      rgba(0,0,0,0.15) 35%,
      rgba(0,0,0,0.05) 60%,
      transparent 100%
    );
    z-index: 2;
    pointer-events: none;
  }

  .reel-info {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 3;
    padding: 20px 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .reel-title {
    font-size: 17px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    line-height: 1.5;
  }

  .reel-date {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
  }

  .reel-watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(229, 9, 20, 0.92);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    width: fit-content;
    margin-top: 4px;
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
  }
  .reel-watch-btn:hover { background: rgba(200,0,10,1); }
  .reel-watch-btn:active { transform: scale(0.97); }

  .btn-icon {
    width: 20px;
    height: 20px;
    fill: #fff;
    flex-shrink: 0;
  }

  .play-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    background: rgba(0,0,0,0.45);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
  }
  .play-indicator.show { opacity: 1; }
  .play-indicator svg { width: 32px; height: 32px; fill: #fff; }

  .mute-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    background: rgba(0,0,0,0.45);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    backdrop-filter: blur(4px);
  }
  .mute-btn svg { width: 20px; height: 20px; fill: #fff; }

  .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(229,9,20,0.85);
    z-index: 6;
    width: 0%;
    transition: width 0.1s linear;
  }

  .loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
  }
  .loading-spinner.show { display: block; }
  @keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }




  /* ===== دسکتاپ ===== */
  @media (min-width: 600px) {
    body { background: #111; }
    .reel-item { background: #111; }

    /* عرض استاندارد اینستاگرام روی دسکتاپ */
    .reel-card {
      position: relative;
      inset: auto;
      width: 90%;
      height: calc(100dvh - 32px);
      border-radius: 14px;
      flex-shrink: 0;
    }
  }

  /* ===== دیالوگ خوش‌آمدگویی ===== */
  #welcome-dialog {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 32px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeInBg 0.3s ease;
  }
  @keyframes fadeInBg { from { opacity:0; } to { opacity:1; } }

  #welcome-dialog.hiding {
    animation: fadeOutBg 0.32s ease forwards;
  }
  @keyframes fadeOutBg { to { opacity:0; } }

  #welcome-box {
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 28px 24px 24px;
    width: min(380px, calc(100vw - 32px));
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: slideUp 0.35s cubic-bezier(0.34,1.56,0.64,1);
  }
  @keyframes slideUp {
    from { transform:translateY(60px); opacity:0; }
    to   { transform:translateY(0);    opacity:1; }
  }
  #welcome-dialog.hiding #welcome-box {
    animation: slideDown 0.28s ease forwards;
  }
  @keyframes slideDown { to { transform:translateY(40px); opacity:0; } }

  .welcome-icon {
    width: 56px;
    height: 56px;
    background: rgba(229,9,20,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .welcome-icon svg { width:28px; height:28px; fill:#e50914; }

  .welcome-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    line-height: 1.5;
  }

  .welcome-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.68);
    line-height: 1.9;
  }

  .welcome-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
  }
  .welcome-hint-arrow {
    font-size: 24px;
    flex-shrink: 0;
    animation: bounceDown 1.4s ease-in-out infinite;
  }
  @keyframes bounceDown {
    0%,100% { transform:translateY(0); }
    50%      { transform:translateY(6px); }
  }
  .welcome-hint-text {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    text-align: right;
    line-height: 1.7;
  }

  #welcome-close-btn {
    margin-top: 2px;
    width: 100%;
    padding: 13px;
    background: #e50914;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
  }
  #welcome-close-btn:hover  { background: #c0070f; }
  #welcome-close-btn:active { transform: scale(0.98); }