:root {
      --primary-color: #7c3aed;
      --primary-light: #a855f7;
      --primary-dark: #4c1d95;
      --secondary-color: #c084fc;
      --accent-color: #f59e0b;
      --text-light: #f5f3ff;
      --bg-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 45%, #c084fc 100%);
      --bg-deep: #1a0a2e;
      --bg-mid: #22103a;
      --border-bright: rgba(168, 85, 247, 0.55);
    }

    * {
      box-sizing: border-box;
    }

    html, body {
      height: 100%;
      overflow: hidden;
    }
    
    @media (max-width: 767px) {
      html, body {
        overflow-y: auto;
        overflow-x: hidden;
      }
    }

    /* ======== أحجام معتدلة لكل شاشة ======== */

    /* الشاشات الكبيرة جداً (أكبر من 1600px) */
    @media (min-width: 1600px) {
      html {
        font-size: 18px;
      }
      :root {
        --h1-size: 2rem;
        --h2-size: 1.7rem;
        --tab-size: 1.3rem;
        --plan-name-size: 1.5rem;
        --plan-price-size: 1.8rem;
        --plan-duration-size: 1.1rem;
        --feature-size: 1rem;
        --btn-size: 1.1rem;
        --note-size: 0.9rem;
      }
    }

    /* الشاشات الكبيرة (1200px - 1599px) */
    @media (min-width: 1200px) and (max-width: 1599px) {
      html {
        font-size: 17px;
      }
      :root {
        --h1-size: 1.9rem;
        --h2-size: 1.6rem;
        --tab-size: 1.2rem;
        --plan-name-size: 1.4rem;
        --plan-price-size: 1.7rem;
        --plan-duration-size: 1rem;
        --feature-size: 0.95rem;
        --btn-size: 1rem;
        --note-size: 0.85rem;
      }
    }

    /* الشاشات المتوسطة (992px - 1199px) */
    @media (min-width: 992px) and (max-width: 1199px) {
      html {
        font-size: 16px;
      }
      :root {
        --h1-size: 1.8rem;
        --h2-size: 1.5rem;
        --tab-size: 1.1rem;
        --plan-name-size: 1.3rem;
        --plan-price-size: 1.6rem;
        --plan-duration-size: 0.95rem;
        --feature-size: 0.9rem;
        --btn-size: 0.95rem;
        --note-size: 0.8rem;
      }
    }

    /* الشاشات الصغيرة (768px - 991px) */
    @media (min-width: 768px) and (max-width: 991px) {
      html {
        font-size: 15px;
      }
      :root {
        --h1-size: 1.7rem;
        --h2-size: 1.4rem;
        --tab-size: 1rem;
        --plan-name-size: 1.2rem;
        --plan-price-size: 1.5rem;
        --plan-duration-size: 0.9rem;
        --feature-size: 0.85rem;
        --btn-size: 0.9rem;
        --note-size: 0.75rem;
      }
    }

    /* الشاشات الصغيرة جداً (أقل من 768px) */
    @media (max-width: 767px) {
      html {
        font-size: 14px;
      }
      :root {
        --h1-size: 1.6rem;
        --h2-size: 1.3rem;
        --tab-size: 0.95rem;
        --plan-name-size: 1.1rem;
        --plan-price-size: 1.4rem;
        --plan-duration-size: 0.85rem;
        --feature-size: 0.8rem;
        --btn-size: 0.85rem;
        --note-size: 0.7rem;
      }
    }

    /* شاشات الموبايل الصغيرة (أقل من 480px) */
    @media (max-width: 480px) {
      html {
        font-size: 12px;
      }
      :root {
        --h1-size: 1.4rem;
        --h2-size: 1.1rem;
        --tab-size: 0.85rem;
        --plan-name-size: 0.95rem;
        --plan-price-size: 1.2rem;
        --plan-duration-size: 0.75rem;
        --feature-size: 0.7rem;
        --btn-size: 0.75rem;
        --note-size: 0.6rem;
      }
    }

    .logo-container {
      text-align: center;
      margin-bottom: 10px;
      position: relative;
      z-index: 2;
      flex-shrink: 0;
    }
    
    @media (max-width: 767px) {
      .logo-container {
        margin-bottom: 6px;
      }
    }
    
    .logo {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      object-fit: cover;
      border: 3px solid var(--secondary-color);
      box-shadow: 0 4px 15px rgba(0,0,0,0.3);
      transition: transform 0.3s;
    }
    
    @media (max-width: 767px) {
      .logo {
        width: 60px;
        height: 60px;
        border: 2px solid var(--secondary-color);
      }
    }
    
    @media (min-width: 1200px) {
      .logo {
        width: 100px;
        height: 100px;
      }
    }
    
    @media (min-width: 1600px) {
      .logo {
        width: 110px;
        height: 110px;
      }
    }
    
    .home-btn {
      position: absolute;
      top: 18px;
      right: 18px;
      background: linear-gradient(135deg, #7c3aed 0%, #a855f7 55%, #f59e0b 130%);
      color: white;
      border: 1px solid rgba(255, 255, 255, 0.3);
      padding: 12px 20px;
      border-radius: 999px;
      font-size: 1rem;
      font-weight: 800;
      letter-spacing: 0.2px;
      cursor: pointer;
      transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
      box-shadow: 0 14px 34px rgba(0,0,0,0.35), 0 0 34px rgba(124, 58, 237, 0.45);
      z-index: 1000;
      display: flex;
      align-items: center;
      gap: 10px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      overflow: hidden;
    }
    
    .home-btn::before {
      content: "";
      position: absolute;
      top: -30%;
      right: -120%;
      width: 60%;
      height: 170%;
      background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
      transform: rotate(18deg);
      transition: right 0.5s ease;
      pointer-events: none;
    }

    @media (min-width: 1200px) {
      .home-btn {
        top: 18px;
        right: 18px;
        padding: 12px 20px;
        font-size: 1.1rem;
      }
    }

    .home-btn:hover {
      transform: translateY(-3px) scale(1.03);
      filter: saturate(1.1);
      box-shadow: 0 18px 38px rgba(0,0,0,0.38), 0 0 42px rgba(124, 58, 237, 0.55);
    }

    .home-btn:hover::before {
      right: 130%;
    }

    .home-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 31px;
      height: 31px;
      border-radius: 50%;
      background: rgba(255,255,255,0.24);
      border: 1px solid rgba(255,255,255,0.35);
      font-size: 0.95em;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
      flex-shrink: 0;
    }
    
    .home-icon i {
      color: #ffffff;
      font-size: 0.95rem;
      text-shadow: 0 1px 6px rgba(0,0,0,0.35);
    }

    .home-btn-label {
      position: relative;
      top: 1px;
    }

    body {
      font-family: 'Cairo', sans-serif;
      background:
        radial-gradient(1200px 700px at 85% -10%, rgba(168, 85, 247, 0.2), transparent 60%),
        radial-gradient(1000px 600px at 0% 100%, rgba(245, 158, 11, 0.12), transparent 65%),
        linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 45%, #2b0e46 100%);
      margin: 0;
      padding: 10px;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      height: 100vh;
      overflow: hidden;
    }

    #particles-bg {
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
    }
    
    @media (max-width: 767px) {
      body {
        min-height: 100vh;
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
      }
    }
    
    @media (min-width: 768px) {
      body {
        padding: 15px;
      }
    }

    .main-content {
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;
      max-width: 1600px;
      overflow: hidden;
      padding-top: 40px;
      position: relative;
      z-index: 1;
    }
    
    @media (max-width: 767px) {
      .main-content {
        padding-top: 30px;
        height: auto;
        min-height: 100%;
        overflow: visible;
        padding-bottom: 20px;
      }
    }
    
    @media (min-width: 768px) {
      .main-content {
        padding-top: 50px;
      }
    }

    .container {
      background: linear-gradient(145deg, rgba(45, 26, 74, 0.88), rgba(34, 16, 58, 0.82));
      border-radius: 15px;
      padding: 15px;
      width: 100%;
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      box-shadow: 0 18px 44px rgba(0,0,0,0.45), 0 0 30px rgba(124,58,237,0.18);
      backdrop-filter: blur(12px);
      border: 1.5px solid var(--border-bright);
      text-align: center;
      position: relative;
      z-index: 2;
      min-height: 0;
    }
    
    @media (max-width: 767px) {
      .container {
        padding: 10px;
        border-radius: 12px;
        overflow: visible;
        flex: 0 1 auto;
      }
    }
    
    @media (min-width: 992px) {
      .container {
        padding: 20px;
        border-radius: 20px;
      }
    }

    h1 {
      color: var(--secondary-color);
      margin: 0 0 10px 0;
      font-size: var(--h1-size);
      text-shadow: 0 2px 4px rgba(0,0,0,0.3);
      flex-shrink: 0;
      line-height: 1.2;
    }
    
    @media (max-width: 767px) {
      h1 {
        margin: 0 0 6px 0;
      }
    }

    h2 {
      color: var(--text-light);
      margin: 0 0 10px 0;
      font-size: var(--h2-size);
      text-align: center;
      flex-shrink: 0;
      line-height: 1.2;
    }
    
    @media (max-width: 767px) {
      h2 {
        margin: 0 0 8px 0;
      }
    }

    .subscription-types {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-bottom: 15px;
      flex-wrap: wrap;
      flex-shrink: 0;
    }
    
    @media (max-width: 767px) {
      .subscription-types {
        margin-bottom: 10px;
        gap: 8px;
      }
    }
    
    @media (min-width: 768px) {
      .subscription-types {
        gap: 15px;
        margin-bottom: 20px;
      }
    }

    .subscription-tab {
      padding: 8px 20px;
      background: rgba(255, 255, 255, 0.1);
      border: none;
      color: var(--text-light);
      font-size: var(--tab-size);
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s;
      border-radius: 50px;
      border: 2px solid transparent;
      white-space: nowrap;
    }
    
    @media (max-width: 480px) {
      .subscription-tab {
        white-space: normal;
        padding: 6px 15px;
      }
    }

    .subscription-tab.active {
      background: var(--bg-gradient);
      border-color: var(--accent-color);
    }

    .subscription-tab:hover {
      background: rgba(106, 13, 173, 0.3);
      border-color: var(--primary-light);
    }

    .subscription-plans {
      display: none;
      width: 100%;
      flex: 1;
      flex-direction: column;
      overflow: hidden;
      min-height: 0;
    }
    
    @media (max-width: 767px) {
      .subscription-plans {
        overflow: visible;
        flex: 0 1 auto;
      }
    }

    .subscription-plans.active {
      display: flex;
    }

    .plans-container {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      width: 100%;
      flex: 1;
      overflow: hidden;
      min-height: 0;
      align-items: stretch;
    }
    
    @media (max-width: 992px) {
      .plans-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        overflow-y: visible;
        padding-bottom: 10px;
      }
    }
    
    @media (max-width: 767px) {
      .plans-container {
        gap: 15px;
        overflow-y: visible;
        padding-bottom: 15px;
      }
    }
    
    @media (max-width: 480px) {
      .plans-container {
        grid-template-columns: 1fr;
        gap: 15px;
        overflow-y: visible;
        padding-bottom: 20px;
      }
    }

    .plan-card {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 12px 8px 8px 8px;
      text-align: center;
      transition: all 0.3s;
      border: 2px solid var(--primary-light);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow-y: auto;
    }
    
    @media (max-width: 767px) {
      .plan-card {
        overflow-y: visible;
        height: 100%;
        align-self: stretch;
        padding: 12px 8px 10px 8px;
        margin-bottom: 0;
      }
    }
    
    .plan-card::-webkit-scrollbar {
      width: 3px;
    }
    
    .plan-card::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 10px;
    }
    
    .plan-card::-webkit-scrollbar-thumb {
      background: var(--accent-color);
      border-radius: 10px;
    }

    .plan-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 10px 20px rgba(0,0,0,0.4);
      border-color: var(--accent-color);
    }

    /* إزالة تأثير التحديد البنفسجي */
    .plan-card.selected {
      /* إبقاء نفس الخلفية الأصلية بدون تغيير */
      background: rgba(255, 255, 255, 0.1);
      /* يمكن إضافة تأثير بسيط آخر إذا أردت */
      border-color: var(--accent-color);
    }

    .plan-name {
      font-size: var(--plan-name-size);
      font-weight: bold;
      margin-bottom: 5px;
      color: var(--text-light);
      flex-shrink: 0;
      line-height: 1.2;
    }
    
    @media (max-width: 767px) {
      .plan-name {
        margin-bottom: 3px;
      }
    }

    .plan-price-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      margin-bottom: 2px;
      flex-shrink: 0;
    }

    .plan-price-block--sale .plan-price-original {
      font-size: calc(var(--plan-price-size) * 0.72);
      font-weight: 600;
      color: rgba(255, 255, 255, 0.55);
      text-decoration: line-through;
      text-decoration-thickness: 2px;
      line-height: 1.2;
    }

    .plan-price-sale-row {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .plan-offer-tag {
      font-size: calc(var(--plan-duration-size) * 0.95);
      font-weight: 800;
      padding: 3px 10px;
      border-radius: 999px;
      background: linear-gradient(90deg, #f59e0b, #eab308);
      color: #1a0826;
      line-height: 1.2;
      box-shadow: 0 2px 10px rgba(245, 158, 11, 0.45);
      white-space: nowrap;
    }

    .plan-price {
      font-size: var(--plan-price-size);
      font-weight: bold;
      margin-bottom: 0;
      color: var(--accent-color);
      flex-shrink: 0;
      line-height: 1.2;
    }

    /* خطط الفترة فقط: السعر ابن مباشر للبطاقة */
    .plan-card > .plan-price {
      margin-bottom: 2px;
    }
    
    @media (max-width: 767px) {
      .plan-card > .plan-price {
        margin-bottom: 1px;
      }
    }

    .plan-duration {
      font-size: var(--plan-duration-size);
      margin-bottom: 8px;
      color: var(--secondary-color);
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(255,255,255,0.2);
      flex-shrink: 0;
      line-height: 1.2;
    }
    
    @media (max-width: 767px) {
      .plan-duration {
        margin-bottom: 6px;
        padding-bottom: 6px;
      }
    }

    .plan-features {
      list-style: none;
      padding: 0 5px;
      margin: 0 0 5px 0;
      flex: 1 1 auto;
      min-height: 0;
      text-align: right;
      overflow-y: visible;
    }
    
    @media (max-width: 767px) {
      .plan-features {
        margin: 0 0 8px 0;
        padding: 0 3px;
        flex: 1 1 auto;
      }
    }

    .plan-features li {
      margin-bottom: 6px;
      color: var(--text-light);
      font-size: var(--feature-size);
      display: flex;
      align-items: flex-start;
      gap: 6px;
      line-height: 1.3;
    }
    
    @media (max-width: 767px) {
      .plan-features li {
        margin-bottom: 4px;
        gap: 4px;
        line-height: 1.2;
      }
    }

    .plan-features li::before {
      content: "✓";
      color: var(--accent-color);
      font-weight: bold;
      font-size: 1.2em;
      flex-shrink: 0;
    }

    /* تنسيق خاص للعنصر الذي يحتوي على جزئين */
    .plan-features li.feature-with-note {
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
    }

    .plan-features li.feature-with-note::before {
      display: none;
    }

    .plan-features .feature-main {
      display: flex;
      align-items: center;
      gap: 6px;
      width: 100%;
    }

    .plan-features .feature-main::before {
      content: "✓";
      color: var(--accent-color);
      font-weight: bold;
      font-size: 1.2em;
      flex-shrink: 0;
    }

    .plan-features .feature-note {
      font-size: var(--note-size);
      color: #ccc;
      margin-right: 22px;
      line-height: 1.3;
      display: block;
    }
    
    @media (max-width: 767px) {
      .plan-features .feature-note {
        margin-right: 18px;
        line-height: 1.2;
      }
    }

    .subscribe-btn {
      background: var(--accent-color);
      color: white;
      border: none;
      padding: 6px 10px;
      border-radius: 50px;
      font-size: var(--btn-size);
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s;
      width: 100%;
      margin-top: auto;
      border: 2px solid transparent;
      flex-shrink: 0;
      line-height: 1.2;
    }
    
    @media (max-width: 767px) {
      .subscribe-btn {
        padding: 5px 8px;
        margin-top: auto;
      }
    }

    .subscribe-btn:hover {
      background: #f57c00;
      transform: translateY(-2px);
      box-shadow: 0 3px 8px rgba(255,152,0,0.4);
    }

    /* الشاشات القصيرة: لا نضغط الكروت أكثر، نخلي سكرول للصفحة */
    @media (max-height: 700px) {
      html, body {
        height: auto !important;
        min-height: 100%;
        overflow-y: auto !important;
        overflow-x: hidden !important;
      }

      body {
        min-height: 100vh;
      }

      .main-content,
      .container,
      .subscription-plans,
      .plans-container {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
      }

      .plan-card {
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
      }

      .plan-card::-webkit-scrollbar {
        display: none;
      }
    }

    .checkout-loading-overlay {
      position: fixed;
      inset: 0;
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1.25rem;
      background: rgba(26, 10, 46, 0.85);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }

    .checkout-loading-overlay[hidden] {
      display: none !important;
    }

    .checkout-loading-panel {
      max-width: 22rem;
      text-align: center;
      background: linear-gradient(145deg, rgba(76, 29, 149, 0.95), rgba(124, 58, 237, 0.88));
      border: 1px solid var(--border-bright);
      border-radius: 1rem;
      padding: 1.75rem 1.35rem;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    }

    .checkout-loading-spinner {
      font-size: 2.25rem;
      color: var(--accent-color);
      margin-bottom: 1rem;
    }

    .checkout-loading-title {
      margin: 0 0 0.65rem;
      font-size: 1.15rem;
      font-weight: 700;
      color: var(--text-light);
      line-height: 1.4;
    }

    .checkout-loading-hint {
      margin: 0;
      font-size: 0.88rem;
      font-weight: 500;
      color: rgba(245, 243, 255, 0.88);
      line-height: 1.55;
    }
