.header-brand {
      justify-self: start;
      display: flex;
      align-items: center;
      min-width: 0;
      min-height: 32px;
    }
.logo {
      width: auto;
      justify-self: start;
      font-size: 15px;
      font-weight: 700;
      letter-spacing: 0.4px;
      color: #fff;
      text-decoration: none;
    }
    body:has(#stage-5.active) #mainHeader .logo {
      display: none;
    }
    
    .profile-wrapper { 
      width: auto; 
      justify-self: end; position: relative; display: flex; justify-content: flex-end; align-items: center; gap: 12px;
    }

    .header-right {
      justify-self: end;
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
    }

    .studio-menu-wrapper {
      position: relative;
    }

    .studio-hub-dropdown {
      position: absolute;
      top: calc(100% + 10px);
      right: 0;
      width: 248px;
      background: rgba(20, 20, 25, 0.95);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 14px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
      padding: 6px;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-6px) scale(0.98);
      transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                  transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                  visibility 0.22s;
      z-index: 10002;
    }

    .studio-hub-dropdown.active {
      opacity: 1;
      visibility: visible;
      transform: translateY(0) scale(1);
    }

    .studio-hub-item {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      border: none;
      border-radius: 8px;
      background: transparent;
      color: #ccc;
      font-size: 12px;
      font-weight: 500;
      font-family: inherit;
      text-align: left;
      cursor: pointer;
      transition: background 0.2s ease, color 0.2s ease;
    }

    .studio-hub-item:hover {
      background: rgba(255, 255, 255, 0.06);
      color: #fff;
    }

    .studio-hub-item:hover .studio-hub-icon {
      color: #fff;
      background: rgba(255, 255, 255, 0.08);
      border-color: rgba(255, 255, 255, 0.12);
    }

    .studio-hub-icon {
      flex-shrink: 0;
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.08);
      display: flex;
      align-items: center;
      justify-content: center;
      color: rgba(255, 255, 255, 0.55);
      transition: background 0.2s, color 0.2s, border-color 0.2s;
    }

    .studio-hub-icon svg {
      width: 16px;
      height: 16px;
      stroke: currentColor;
    }

    .studio-hub-label {
      flex: 1;
      line-height: 1.25;
    }

    .studio-hub-divider {
      height: 1px;
      margin: 4px 6px;
      background: rgba(255, 255, 255, 0.06);
    }

    #header-projects-btn.active {
      background: rgba(255, 255, 255, 0.12);
      border-color: rgba(255, 255, 255, 0.35);
    }

    .project-title { display: flex; justify-content: center; align-items: center; justify-self: center; }

    .s5-view-switch {
      display: inline-flex;
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-radius: 40px;
      padding: 4px;
      gap: 4px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    .s5-view-switch[hidden] { display: none !important; }
    .s5-view-switch-btn {
      font-size: 13px;
      font-weight: 600;
      letter-spacing: 0.4px;
      color: #777;
      cursor: pointer;
      padding: 6px 16px;
      border-radius: 30px;
      border: 1px solid transparent;
      background: transparent;
      font-family: inherit;
      transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .s5-view-switch-btn:hover:not(.active) {
      color: #ccc;
      background: rgba(255, 255, 255, 0.05);
    }
    .s5-view-switch-btn.active {
      color: #eee;
      background: rgba(255, 255, 255, 0.12);
      box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05);
      border-color: rgba(255, 255, 255, 0.1);
    }

    /* Stage 5: the switch sits in the header brand slot, in place of the logo. */
    html:not(.app-phone) #mainHeader .s5-view-switch {
      position: static;
      padding: 3px;
      gap: 2px;
      border-radius: 999px;
      box-shadow: none;
    }
    html:not(.app-phone) #mainHeader .s5-view-switch-btn {
      font-size: 12px;
      letter-spacing: 0.2px;
      padding: 5px 12px;
      transform: none;
    }
    html:not(.app-phone) #mainHeader .s5-view-switch-btn:hover,
    html:not(.app-phone) #mainHeader .s5-view-switch-btn:active {
      transform: none;
    }

    /* ===== PROFILE MENU ===== */
    .profile-btn {
      width: 42px; height: 42px; border-radius: 50%;
      background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15);
      display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s;
      overflow: hidden; position: relative;
    }
    .profile-btn > svg:not(.profile-credit-ring) { width: 18px; height: 18px; stroke: rgba(255, 255, 255, 0.5); transition: stroke 0.3s; }
    .profile-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: #fff; box-shadow: 0 0 15px rgba(255, 255, 255, 0.1); }
    .profile-btn:hover > svg:not(.profile-credit-ring) { stroke: #fff; }
    .profile-avatar-img {
      position: absolute; inset: 0;
      background: center/cover no-repeat #222;
      border-radius: 50%;
    }
    .profile-btn.has-photo { border-color: rgba(255,255,255,0.28); }
    .mini-avatar.has-photo svg { display: none; }
    .dropdown-user .mini-avatar.has-photo {
      background-size: cover; background-position: center;
    }

    #profileToggle {
      overflow: visible;
      border-color: rgba(255, 255, 255, 0.1);
    }
    #profileToggle:hover {
      border-color: rgba(255, 255, 255, 0.16);
      box-shadow: 0 0 14px rgba(255, 255, 255, 0.08);
    }
    #profileToggle.has-photo { border-color: rgba(255, 255, 255, 0.08); }
    .profile-credit-ring {
      position: absolute;
      inset: -4px;
      width: auto;
      height: auto;
      pointer-events: none;
      overflow: visible;
      transform: rotate(-90deg);
      z-index: 2;
    }
    .profile-credit-ring-track,
    .profile-credit-ring-value {
      fill: none;
      stroke-width: 1.85;
      stroke-linecap: round;
    }
    .profile-credit-ring-track {
      stroke: rgba(255, 255, 255, 0.12);
    }
    .profile-credit-ring-value {
      stroke: #fff;
      stroke-dasharray: 100;
      stroke-dashoffset: 100;
      filter: drop-shadow(0 0 2.5px rgba(255, 255, 255, 0.35));
      transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .profile-dropdown {
      position: absolute; top: 55px; right: 0; width: 260px;
      background: rgba(20, 20, 25, 0.95); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
      opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      overflow: hidden; z-index: 100;
    }
    .profile-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }

    .dropdown-user { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
    .dropdown-user .mini-avatar {
      width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; justify-content: center; margin-right: 12px;
    }
    .dropdown-user .mini-avatar svg { width: 16px; height: 16px; stroke: rgba(255, 255, 255, 0.5); }
    .dropdown-user-info { display: flex; flex-direction: column; text-align: left; }
    .dropdown-user-info .username { font-size: 14px; font-weight: 600; color: #fff; }
    .dropdown-user-info .plan { font-size: 11px; color: #aaa; margin-top: 3px; }

    .dropdown-credits { padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
    .credits-labels { display: flex; justify-content: space-between; font-size: 12px; color: #aaa; margin-bottom: 8px; }
    .credits-bar-bg { width: 100%; height: 3px; background: rgba(255, 255, 255, 0.15); border-radius: 2px; overflow: hidden; }
    .credits-bar-fill { height: 100%; background: #fff; width: 0%; border-radius: 2px; transition: width 0.35s ease; }
    .dropdown-menu li.auth-only { display: none; }

    .dropdown-menu { list-style: none; padding: 8px 0; margin: 0; }
    .dropdown-menu li { padding: 10px 20px; font-size: 13px; color: #ccc; cursor: pointer; transition: all 0.2s; text-align: left; }
    .dropdown-menu li:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
    .dropdown-menu li.sign-out { color: #ff5e5e; }
    .dropdown-menu li.sign-out:hover { background: rgba(255, 94, 94, 0.1); }

/* ---- Theme Palette Styles (Updated) ---- */
.has-submenu {
  position: relative;
}

/* انیمیشن چرخش فلش هنگام باز شدن منو */
.has-submenu svg {
  transition: transform 0.3s ease;
}
.has-submenu.open-submenu svg {
  transform: rotate(90deg);
}

/* استایل پالت رنگ که حالا داخل منو و زیر Theme باز می‌شود */
.theme-palette {
  width: 100%;
  margin-top: 5px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  gap: 10px;
  
  /* انیمیشن باز شدن آکاردئونی */
  max-height: 0;
  padding: 0 10px;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* استایل کادر هنگام اضافه شدن کلاس open-submenu */
.has-submenu.open-submenu .theme-palette {
  max-height: 150px; /* فضایی برای نمایش کادر */
  padding: 10px;
  margin-top: 15px;
  opacity: 1;
  visibility: visible;
}

.color-box {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s, border-color 0.2s;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.color-box:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.6);
}

    /* ===== NEW CHIC PIPELINE ===== */
    .pipeline {
      display: inline-flex; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 40px; padding: 4px; gap: 5px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.3); transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
      opacity: 0; pointer-events: none; transform: translateY(10px);
    }
    .pipeline.show-pipeline { opacity: 1; pointer-events: auto; transform: translateY(0); }

    .pipeline span {
      font-size: 13px; font-weight: 600; letter-spacing: 0.5px; color: #777; cursor: pointer;
      padding: 6px 20px; border-radius: 30px; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .pipeline span:hover:not(.active) { color: #ccc; background: rgba(255, 255, 255, 0.05); }
    .pipeline span.active { 
        color: #eee; background: rgba(255, 255, 255, 0.12); 
        box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* ===== STAGES ===== */
    .stages-container { flex-grow: 1; position: relative; margin-top: 10px; }
    .stage {
      position: absolute; top: 0; left: 0; width: 100%; height: 100%;
      display: flex; flex-direction: column; justify-content: space-between;
      opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility .5s ease;
      padding: 1px 0 20px 0;
    }
    .stage.active { opacity: 1; visibility: visible; }

    html.studio-opening-project #main-pipeline {
      opacity: 1;
      pointer-events: auto;
      transform: none;
    }
    html.studio-opening-project .s1-home-workspace {
      display: none !important;
    }
    html.studio-opening-project #s1-dynamic {
      justify-content: center;
    }
    .studio-stage-loading {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 14px;
      color: #8e8e93;
      font-size: 0.85rem;
      letter-spacing: 0.04em;
    }
    html.studio-opening-project .studio-stage-loading {
      display: flex;
    }
    .studio-stage-loading-mark {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      border: 2px solid rgba(255, 255, 255, 0.14);
      border-top-color: rgba(255, 255, 255, 0.85);
      animation: projectSkeletonSpin 0.8s linear infinite;
    }
    html.studio-guest #s1-recent-projects-grid .project-card--skeleton {
      display: none;
    }

    body.ai-generate-mode #main-pipeline,
    html.ai-generate-mode #main-pipeline {
      display: none !important;
      opacity: 0 !important;
      pointer-events: none !important;
    }
    body.ai-generate-mode #stage-1,
    body.ai-generate-mode #stage-2,
    body.ai-generate-mode #stage-3,
    body.ai-generate-mode #stage-4,
    html.ai-generate-mode #stage-1,
    html.ai-generate-mode #stage-2,
    html.ai-generate-mode #stage-3,
    html.ai-generate-mode #stage-4 {
      display: none !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }
    body.ai-generate-mode #stage-5.s5-gallery-mode,
    body.ai-generate-mode #stage-5.active,
    html.ai-generate-mode #stage-5.s5-gallery-mode,
    html.ai-generate-mode #stage-5.active {
      opacity: 1;
      visibility: visible;
    }
    body.ai-generate-mode #s5-btn-prev,
    body.ai-generate-mode #s5-import-s4-btn,
    html.ai-generate-mode #s5-btn-prev,
    html.ai-generate-mode #s5-import-s4-btn {
      display: none !important;
    }
    
    .center-flow { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; text-align: center; }
    #s1-dynamic { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; width: 100%; }

    #s1-text {

      position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
      font-size: 36px; font-weight: 300; letter-spacing: 4px; margin: 0; z-index: 1000;
    }

    .fade { transition: opacity .4s ease; }
    .invisible { opacity: 0; pointer-events: none; }
    
    .nav { display: flex; justify-content: space-between; align-items: center; padding: 1px; }
    
/* =========================================

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {

    .anim-item { opacity: 0; transform: translateY(20px); transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
    .anim-item.show-anim { opacity: 1; transform: translateY(0); }

    .action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
    .action-btn {
      background: linear-gradient(145deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.4) 100%);
      border: 1px solid var(--glass-border); border-radius: var(--radius-lg); cursor: pointer;
      transition: all 0.4s; backdrop-filter: var(--blur-heavy); 
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      padding: 30px 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); gap: 15px;
    }
    .action-btn-icon {
      width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.05); 
      border: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
      font-size: 22px; color: #fff; box-shadow: inset 0 0 10px rgba(255,255,255,0.05);
    }
    .action-btn span { font-weight: 500; font-size: 14px; color: #fff; text-align: center; letter-spacing: 0.5px;}
    .action-btn:hover { transform: translateY(-8px); border-color: rgba(255,255,255,0.3); box-shadow: 0 15px 30px rgba(0,0,0,0.5); background: linear-gradient(145deg, rgba(255,255,255,0.12) 0%, rgba(20, 20, 20, 0.7) 100%); }
    
    .recent-title { font-size: 18px; font-weight: 500; color: var(--text-muted); margin-top: 20px; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; }
    .recent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
    .recent-card {
      background: transparent; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 10px; display: flex; align-items: center; gap: 15px; cursor: pointer; transition: 0.3s;
    }
    .recent-card img { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; background: #333; }
    .recent-info { display: flex; flex-direction: column; gap: 5px; }
    .r-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
    .r-cat { font-size: 12px; color: var(--text-muted); }
    .recent-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }

    /* ===== TEXTAREAS ===== */
    textarea {
      width: 100%; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--glass-border); padding: 1px;
      color: var(--text-main); font-size: 15px; font-family: var(--font-main); resize: vertical; backdrop-filter: var(--blur-light); transition: all 0.3s ease; line-height: 1.6;
      text-align: left; /* حالت پیشفرض */
    }
    textarea:focus { outline: none; border-color: var(--glass-border-hover); background: rgba(10, 10, 10, 0.8); box-shadow: 0 0 20px rgba(255,255,255,0.03); }

    .final-result-box { width: 100%; max-width: 750px; display: flex; flex-direction: column; gap: 20px; transition: 0.4s; }
    .final-result-box.hidden { display: none; }
    .final-actions { display: flex; justify-content: center; gap: 15px; }
    #final-idea-text { min-height: 230px; } 

    /* کلاس برای راست چین کردن متون در صورت نیاز */
    .rtl-content {
      text-align: right !important;
      direction: rtl;
    }
    
    /* ===== CHAT & TOOLBAR ===== */
    .chat-container {
      position: fixed; bottom: 0; left: 0; right: 0; padding: 15px 0 25px 0;
      background: rgba(0, 0, 0, 0.616); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      border-top: 1px solid var(--glass-border); z-index: 100; opacity: 0; transform: translateY(100%); transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .chat-container.show { opacity: 1; transform: translateY(0); }
    
    .chat-input-wrapper {
      display: flex; align-items: center; gap: 12px; padding: 10px 15px;
      background: rgba(20, 20, 20, 0.6); border-radius: var(--radius-pill); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    }
    
    textarea.chat-input-box {
      flex: 1; min-height: 24px; height: 24px; padding: 2px 0; background: transparent; border: none; resize: none;
      color: #fff; font-size: 15px; line-height: 1.5; overflow-y: auto; max-height: 150px; box-shadow: none; backdrop-filter: none;
    }
    textarea.chat-input-box:focus { outline: none; background: transparent; box-shadow: none; }
    textarea.chat-input-box::placeholder { color: var(--text-muted); }

    .chat-file-btn, .chat-submit {
      background: rgba(255,255,255,0.05); border: 1px solid transparent; cursor: pointer; color: var(--text-muted);
      display: flex; align-items: center; justify-content: center; padding: 8px; border-radius: 50%; transition: 0.3s;
    }
    .chat-file-btn:hover, .chat-submit:hover { color: #fff; background: rgba(255,255,255,0.15); border-color: var(--glass-border); }
    .chat-submit svg { width: 18px; height: 18px; fill: currentColor; }


    /* TOOLBARS & PILLS */
    .bottom-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; width: 100%; }
    .setting-pill {
      position: relative; padding: 6px 16px; border-radius: var(--radius-pill); border: 1px solid var(--glass-border); 
      color: #95959c; background: rgba(0,0,0,0.5); font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.3s; display: flex; align-items: center; gap: 6px;
      font-family: inherit;
    }
    button.setting-pill { appearance: none; -webkit-appearance: none; }
    .setting-pill:hover { background: rgba(30,30,30,0.8); border-color: var(--glass-border-hover); color: #ccc; }
    .setting-pill.active { background: var(--glass-bg-active); border-color: rgba(255,255,255,0.2); color: #ddd; box-shadow: 0 0 15px rgba(255,255,255,0.05); }

    .pill-dropdown {
      display: none; position: absolute; bottom: 140%; left: 50%; transform: translateX(-50%);
      background: rgba(15, 15, 15, 0.95); border: 1px solid var(--glass-border); border-radius: var(--radius-md); 
      padding: 12px; grid-template-columns: 1fr 1fr; gap: 8px; z-index: 100; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    }
    .pill-dropdown.show { display: grid; animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
    #menu-count.show, #menu-lang.show { display: block; }
    
    @keyframes popIn { from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.95); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
    
    .view-toggle-btn { background: rgba(0,0,0,0.5); border: 1px solid var(--glass-border); color: #95959c; cursor: pointer; padding: 6px; border-radius: 50%; display: flex; align-items: center; transition: 0.3s; }
    .view-toggle-btn:hover { background: rgba(30,30,30,0.8); border-color: var(--glass-border-hover); color:#ccc; transform: rotate(90deg); }
    
    .pill-input { display: none; width: 40px; background: transparent; border: none; color: #fff; text-align: center; outline: none; font-size: 13px; font-weight: 500; }
    .pill-input.show { display: inline-block; }

    .dropdown-item { padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; transition: .2s; text-align: left; font-size: 14px; color: var(--text-main); }
    .dropdown-item:hover { background: rgba(255,255,255,0.08); }
    .dropdown-item.active { background: rgba(255,255,255,0.15); font-weight: 600; }
    
    .pill-dropdown label { display: flex; align-items: center; gap: 8px; font-size: 14px; color:var(--text-main); cursor: pointer; padding: 6px; border-radius: 8px; transition: 0.2s; }
    .pill-dropdown label:hover { background: rgba(255,255,255,0.05); }

    .lang-dropdown { min-width: 240px; }
    .dark-search-input { width: 100%; background: rgba(0,0,0,0.5); border: 1px solid var(--glass-border); color: #fff; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 14px; }
    .dark-search-input:focus { outline: none; border-color: rgba(255,255,255,0.3); }
    .lang-list { max-height: 180px; overflow-y: auto; }

    .attachment-name { margin-top: 8px; font-size: 12px; color: var(--text-muted); text-align: left; padding-left: 15px; }

    /* ===== DYNAMIC IDEAS ===== */
    #ideas-container {
        position: fixed;
        top: 85px;
        bottom: 160px; /* افزایش فاصله تا ۱۶۰ پیکسل برای اینکه اسکرول بیفتد دقیقاً بالای چت‌بار */
        left: 0;
        right: 0;
        width: 100vw;
        overflow-y: auto;
        overflow-x: auto;
        z-index: 10;
        display: flex;
        gap: 20px;

}

.glass-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(168, 85, 247, 0.4); /* Accent Purple */
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
    transform: translateY(-4px);
}

/* کلاس‌های کنترل انیمیشن ظهور */
.reveal-item {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-item.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* مخفی کردن اسکرول‌بار برای بخش پروژه‌ها */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }


/* ============= stage 02 =============== */

/* تنظیمات چیدمان استیج 2 برای هم‌ترازی میلی‌متری با استیج 1 */
#stage-2 #stage2-flow {
    justify-content: flex-start !important;
    padding-top: 0 !important; /* حذف فاصله اضافه تا کادر دقیقا از نقطه شروع استیج 1 باز شود */
    padding-bottom: 78px !important; /* فضای پایین هم‌اندازه با ارتفاع کم‌شدهٔ s2-chatBar */
    height: 100%;
    box-sizing: border-box; /* برای محاسبه صحیح ارتفاع با پدینگ‌ها */
}

/* ============= Stage 3 ============= */

/* انیمیشن لودینگ با رنگ سفید/خاکستری مینیمال */
.spinner { 
    border: 3px solid rgba(255, 255, 255, 0.1); 
    border-top: 3px solid rgba(255, 255, 255, 0.9); 
    border-radius: 50%; 
    width: 24px; 
    height: 24px; 
    animation: spin 1s linear infinite; 
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Soft generating glow — no sheen line; a blurred light that blooms and fades */
@keyframes gen-wave-sweep {
    0%, 100% { transform: translate(-50%, -50%) scale(0.72); opacity: 0.08; }
    50% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
}
@keyframes gen-wave-breathe {
    0%, 100% { filter: brightness(0.62); }
    50% { filter: brightness(0.9); }
}
@keyframes gen-wave-glow {
    0%, 100% { opacity: 0.18; }
    50% { opacity: 0.55; }
}
.gen-wave-fill {
    position: absolute;
    inset: 0;
    background: #121214;
}
.image-container.is-generating,
.thumb-wrapper.is-loading,
.s3-style-create-drop.is-busy,
.s5-gallery-card.is-generating {
    isolation: isolate;
    overflow: hidden;
}
.image-container.is-generating {
    position: relative;
    background: #121214;
}
.image-container.is-generating.empty-img-placeholder {
    background: #121214;
}
.thumb-wrapper.is-loading::after,
.s3-style-create-drop.is-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 78%;
    height: 92%;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.34) 0%,
        rgba(255, 255, 255, 0.12) 42%,
        rgba(255, 255, 255, 0) 70%
    );
    mix-blend-mode: screen;
    animation: gen-wave-sweep 3.6s ease-in-out infinite;
    pointer-events: none;
    z-index: 4;
    filter: blur(22px);
}
.s5-gallery-card.is-generating::before,
.s5-gallery-card.is-generating::after {
    content: none;
    display: none;
}
.thumb-wrapper.is-loading .thumb-img,
.s3-style-create-drop.is-busy img {
    position: relative;
    z-index: 1;
    animation: gen-wave-breathe 2.4s ease-in-out infinite;
}
.image-container.is-generating img {
    position: relative;
    z-index: 1;
}
.image-container.is-generating > .spinner {
    position: absolute;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    border: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .thumb-wrapper.is-loading::after,
    .s3-style-create-drop.is-busy::after,
    .s5-gallery-card.is-generating .s5-gallery-glow,
    .s5-gallery-card.is-generating .s5-gallery-glows,
    .s5-gallery-card.is-generating .gen-glow,
    .s5-gallery-card.is-generating .gen-glows,
    .image-container.is-generating .gen-glows,
    .image-container.is-generating .gen-glow,
    .thumb-wrapper.is-loading .thumb-img,
    .s3-style-create-drop.is-busy img {
        animation: none;
    }
}

/* ============= Studio left rail ============= */
:root {
    --studio-rail-width: 76px;
}

.studio-rail {
    flex: 0 0 var(--studio-rail-width);
    width: var(--studio-rail-width);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 6px 14px;
    background: #080808c4;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 50;
    box-sizing: border-box;
    overflow: visible;
}

.studio-rail-home {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 2px 0 8px;
    border-radius: 10px;
    text-decoration: none;
}

.studio-rail-home img {
    width: 32px;
    height: 32px;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

.studio-rail-home:hover,
.studio-rail-home:focus-visible {
    background: rgba(255, 255, 255, 0.06);
}

.studio-rail-home:focus {
    outline: none;
}

.studio-rail-btn {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 4px 8px;
    border: 0;
    border-radius: 10px;
    background: transparent !important;
    color: #86868b;
    cursor: pointer;
    font: 700 9px/1.15 var(--font-main);
    letter-spacing: 0.03em;
    text-align: center;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
}

.studio-rail-btn[data-rail="agent"] {
    display: none;
}

.studio-rail-btn[data-rail="projects"]::after,
.studio-rail-btn[data-rail="chats"]::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 20px;
}

.studio-rail-btn svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    stroke: currentColor;
}

.studio-rail-btn span {
    display: block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
}

.studio-rail-btn:hover,
.studio-rail-btn:focus-visible {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff;
    transform: none !important;
    box-shadow: none !important;
    border: 0;
}

.studio-rail-btn:focus {
    outline: none;
}

.studio-rail-btn.active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff;
}

.studio-rail-gap {
    flex: 1 1 auto;
    min-height: 12px;
}

.studio-rail-rule {
    width: 28px;
    height: 1px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

body.studio-app .chat-container {
    left: var(--studio-rail-width);
}

body.studio-app #ideas-container {
    left: var(--studio-rail-width);
    width: auto;
}

/* ============= Projects Sidebar (matches chat-sidebar) ============= */
.projects-sidebar {
    position: absolute;
    top: 0;
    left: -280px;
    width: 268px;
    height: 100%;
    background: #09090a;
    backdrop-filter: blur(48px) saturate(180%);
    -webkit-backdrop-filter: blur(48px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
    transform: translateZ(0);
    z-index: 2000;
    transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 14px 12px 18px;
    pointer-events: none;
    visibility: hidden;
}

.projects-sidebar.open {
    left: 0;
    pointer-events: auto;
    visibility: visible;
}

.projects-sidebar.no-anim {
    transition: none !important;
}

.chats-new-btn {
    width: 100%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    margin: 2px 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04) !important;
    color: #f5f5f7;
    font: 600 13px/1 var(--font-main);
    cursor: pointer;
    box-shadow: none !important;
    backdrop-filter: none !important;
    transform: none !important;
}

.chats-new-btn svg {
    width: 15px;
    height: 15px;
}

.chats-new-btn:hover,
.chats-new-btn:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.18);
    transform: none !important;
    box-shadow: none !important;
}

.chats-history-item {
    width: 100%;
    display: block;
    padding: 9px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #d2d2d7;
    text-align: start;
    cursor: pointer;
    font: 500 13px/1.35 var(--font-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chats-history-item[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.chats-history-item[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.chats-history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.projects-sidebar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.projects-sidebar-logo {
    display: block;
    padding: 6px 10px 10px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.projects-sidebar-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    outline: none;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #fff;
    cursor: pointer;
    transform: none !important;
}

.projects-sidebar-close:hover,
.projects-sidebar-close:focus,
.projects-sidebar-close:focus-visible {
    background: transparent !important;
    border: none;
    box-shadow: none !important;
    outline: none;
    transform: none !important;
    color: #fff;
}

.projects-sidebar-close svg {
    width: 18px;
    height: 18px;
}

.projects-sidebar-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 2px 8px 6px;
}

.projects-sidebar .sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.projects-sidebar .sidebar-content::-webkit-scrollbar { width: 4px; }
.projects-sidebar .sidebar-content::-webkit-scrollbar-track { background: transparent; }
.projects-sidebar .sidebar-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

.projects-sidebar .project-card {
    position: relative;
    width: 100%;
    background: transparent;
    padding: 9px 10px;
    border: 0;
    border-radius: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    color: #d2d2d7;
    transition: background 0.18s ease, color 0.18s ease;
}

.projects-sidebar .project-card:hover,
.projects-sidebar .project-card.active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.projects-sidebar .project-card-thumb {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    overflow: hidden;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #6e6e73;
}

.projects-sidebar .project-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.projects-sidebar .project-card-thumb--placeholder svg {
    width: 16px;
    height: 16px;
    stroke: #6e6e73;
}

.projects-sidebar .project-card:hover .project-card-thumb--placeholder svg,
.projects-sidebar .project-card.active .project-card-thumb--placeholder svg {
    stroke: #a1a1a6;
}

.projects-sidebar .project-card-info {
    min-width: 0;
    flex: 1;
}

.projects-sidebar .project-card-title {
    font: 500 13px/1.35 var(--font-main);
    color: inherit;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.projects-sidebar .project-card-type {
    font-size: 11px;
    color: #6e6e73;
    line-height: 1.3;
}

.project-card.project-card--shared::after {
    content: '';
    position: absolute;
    top: 7px;
    bottom: 7px;
    right: 0;
    width: 3px;
    border-radius: 3px;
    background: #ff3b30;
    pointer-events: none;
    z-index: 2;
}

.projects-sidebar .project-card.project-card--shared {
    padding-right: 14px;
}

.projects-sidebar .project-card-menu {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin-left: 4px;
    border: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.projects-sidebar .project-card-menu svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.projects-sidebar .project-card-menu:hover,
.projects-sidebar .project-card-menu:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    outline: none;
}

.project-card-menu-pop {
    position: fixed;
    z-index: 4000;
    min-width: 168px;
    padding: 6px;
    border-radius: 12px;
    background: #161618;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.project-card-menu-pop[hidden] {
    display: none;
}

.project-card-menu-pop button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #f5f5f7;
    font: 500 13px/1.3 var(--font-main);
    padding: 8px 10px;
    cursor: pointer;
}

.project-card-menu-pop button[hidden] {
    display: none;
}

.project-card-menu-pop button:hover,
.project-card-menu-pop button:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.project-manage-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.project-manage-modal[hidden] {
    display: none;
}

.project-manage-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
}

.project-manage-dialog {
    position: relative;
    width: min(440px, 100%);
    max-height: min(86vh, 720px);
    overflow: auto;
    padding: 28px 24px 22px;
    border-radius: 22px;
    background: #141416;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    color: #f5f5f7;
}

.project-manage-dialog h2 {
    margin: 0 36px 8px 0;
    font: 600 22px/1.2 var(--font-main);
}

.project-manage-lead,
.project-manage-note {
    margin: 0 0 16px;
    color: #9a9aa1;
    font-size: 13px;
    line-height: 1.45;
}

.project-manage-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
}

.project-manage-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.project-manage-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #b5b5ba;
}

.project-manage-field input,
.project-manage-field select,
.project-share-add input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: #0d0d0f;
    color: #fff;
    font: 500 14px/1.3 var(--font-main);
    padding: 10px 12px;
}

.project-thumb-drop {
    width: 100%;
    min-height: 112px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    background: #0d0d0f;
    color: #8e8e93;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    cursor: pointer;
}

.project-thumb-drop.is-dragover {
    border-color: #fff;
    color: #fff;
}

.project-thumb-drop img {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 10px;
}

.project-manage-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.project-manage-btn,
.project-share-add button,
.project-share-row button {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: transparent;
    color: #f5f5f7;
    font: 600 13px/1.3 var(--font-main);
    padding: 10px 12px;
    cursor: pointer;
    text-align: center;
}

.project-manage-btn small {
    display: block;
    margin-top: 4px;
    font-weight: 400;
    color: #9a9aa1;
    line-height: 1.35;
}

.project-manage-btn--primary {
    background: #f5f5f7;
    color: #111;
    border-color: transparent;
}

.project-manage-btn--danger {
    background: #c62828;
    border-color: transparent;
    color: #fff;
}

.project-manage-btn--danger small {
    color: rgba(255, 255, 255, 0.82);
}

.project-manage-btn:disabled,
.project-share-add button:disabled,
.project-share-row button:disabled {
    opacity: 0.55;
    cursor: default;
}

.project-manage-error {
    min-height: 1.2em;
    margin: 10px 0 0;
    color: #ff8a80;
    font-size: 13px;
}

.project-file-list,
.project-share-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.project-file-row,
.project-share-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
}

.project-share-row div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.project-share-row span,
.project-file-list p,
.project-share-list p {
    color: #9a9aa1;
    font-size: 12px;
}

.project-share-add {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.project-share-add button,
.project-share-row button {
    flex: 0 0 auto;
}

.projects-sidebar .projects-empty-hint {
    padding: 18px 10px;
    color: #6e6e73;
    font-size: 13px;
    text-align: left;
    margin: 0;
}

.project-card {
    background: rgba(30, 30, 30, 0.4);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.project-card:hover {
    background: rgba(50, 50, 50, 0.6);
}

.project-card-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #6e6e73;
}

.project-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-card-thumb--placeholder svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.project-card-info {
    min-width: 0;
    flex: 1;
}

.project-card-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ddd;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-card-type {
    font-size: 0.65rem;
    color: #666;
}

.projects-empty-hint {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    padding: 1rem 0.5rem;
    margin: 0;
}

.project-card--skeleton {
    pointer-events: none;
    cursor: default;
}

.project-skeleton-block,
.project-skeleton-line {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.16) 50%, rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    animation: projectSkeleton 1.15s ease-in-out infinite;
}

.project-skeleton-line {
    height: 8px;
    border-radius: 99px;
    margin-bottom: 6px;
}

.project-skeleton-line--short {
    width: 55%;
    margin-bottom: 0;
}

@keyframes projectSkeleton {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@keyframes projectSkeletonSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .project-skeleton-block,
    .project-skeleton-line,
    .studio-stage-loading-mark {
        animation: none;
    }
}

#s1-recent-projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

#s1-recent-projects-grid .project-card {
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    padding: 10px;
    border-radius: 14px;
    overflow: hidden;
    isolation: isolate;
    transition:
        transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#s1-recent-projects-grid .project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 42%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

#s1-recent-projects-grid .project-card:hover,
#s1-recent-projects-grid .project-card:focus-visible {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    outline: none;
}

#s1-recent-projects-grid .project-card:hover::before,
#s1-recent-projects-grid .project-card:focus-visible::before {
    opacity: 1;
}

#s1-recent-projects-grid .project-card-thumb {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 9px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

#s1-recent-projects-grid .project-card:hover .project-card-thumb,
#s1-recent-projects-grid .project-card:focus-visible .project-card-thumb {
    transform: scale(1.06);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

#s1-recent-projects-grid .project-card-thumb img {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#s1-recent-projects-grid .project-card:hover .project-card-thumb img,
#s1-recent-projects-grid .project-card:focus-visible .project-card-thumb img {
    transform: scale(1.08);
}

#s1-recent-projects-grid .project-card-title {
    transition: color 0.25s ease;
}

#s1-recent-projects-grid .project-card:hover .project-card-title,
#s1-recent-projects-grid .project-card:focus-visible .project-card-title {
    color: #f5f5f7;
}

#s1-recent-projects-grid .project-card-type {
    transition: color 0.25s ease;
}

#s1-recent-projects-grid .project-card:hover .project-card-type,
#s1-recent-projects-grid .project-card:focus-visible .project-card-type {
    color: #8e8e93;
}

@media (prefers-reduced-motion: reduce) {
    #s1-recent-projects-grid .project-card,
    #s1-recent-projects-grid .project-card-thumb,
    #s1-recent-projects-grid .project-card-thumb img {
        transition: background 0.2s ease, border-color 0.2s ease;
    }
    #s1-recent-projects-grid .project-card:hover,
    #s1-recent-projects-grid .project-card:focus-visible,
    #s1-recent-projects-grid .project-card:hover .project-card-thumb,
    #s1-recent-projects-grid .project-card:focus-visible .project-card-thumb,
    #s1-recent-projects-grid .project-card:hover .project-card-thumb img,
    #s1-recent-projects-grid .project-card:focus-visible .project-card-thumb img {
        transform: none;
    }
}

@media (max-width: 900px) {
    #s1-recent-projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== PROBLEM REPORT MODAL ===== */
.pr-overlay {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.pr-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
.pr-modal {
  position: relative;
  width: min(520px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  background: linear-gradient(145deg, rgba(30,30,30,0.92) 0%, rgba(10,10,10,0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
  padding: 28px 24px 22px;
  color: #f5f5f7;
}
.pr-modal h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.3px; margin: 0 0 6px; }
.pr-sub { color: #9a9aa0; font-size: 13px; margin: 0 0 16px; line-height: 1.45; }
.pr-close {
  position: absolute; top: 12px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  color: #ccc; font-size: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: none !important; transform: none !important;
}
.pr-close:hover { background: rgba(255,71,87,0.16) !important; color: #fff; transform: none !important; }
.pr-shot {
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: #111;
  margin-bottom: 16px;
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.pr-shot img { display: block; width: 100%; max-height: 240px; object-fit: cover; object-position: top; }
.pr-shot-empty { color: #888; font-size: 13px; padding: 28px 16px; text-align: center; }
.pr-label {
  display: block; font-size: 11px; letter-spacing: 0.7px; text-transform: uppercase;
  color: #bdbdbd; font-weight: 700; margin: 0 0 8px;
}
.pr-select, .pr-textarea {
  width: 100%;
  background: #0d0d0d;
  color: #f5f5f7;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  font: inherit;
  margin-bottom: 14px;
}
.pr-select {
  appearance: none;
  padding: 11px 38px 11px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a0a0a0' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.pr-textarea { padding: 12px 14px; min-height: 110px; resize: vertical; line-height: 1.5; }
.pr-select:focus, .pr-textarea:focus {
  outline: none;
  border-color: rgba(255,140,0,0.7);
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.16);
}
.pr-error { color: #ff6b6b; font-size: 13px; margin: -4px 0 12px; }
.pr-actions { display: flex; justify-content: flex-end; }
.pr-send {
  min-width: 112px;
  padding: 10px 18px !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #ff8c00, #ffb800) !important;
  border: none !important;
  color: #111 !important;
  font-weight: 700 !important;
  backdrop-filter: none !important;
  transform: none !important;
}
.pr-send:hover { transform: none !important; filter: brightness(1.06); }
.pr-send:disabled { opacity: 0.65; cursor: wait; }
.pr-thanks { text-align: center; padding: 18px 8px 4px; }
.pr-thanks h2 { margin-bottom: 10px; }
.pr-thanks p { color: #cfcfcf; font-size: 15px; line-height: 1.5; margin: 0 0 22px; }
.pr-thanks .pr-actions { justify-content: center; }
