  :root {
    --primary: #008f91;
    --primary-dark: #006d6f;
    --secondary: #ffcb05;
    --secondary-dark: #d7a900;
    --neutral: #acacac;
    --dark: #191919;
    --surface: #ffffff;
    --background: #f3f7f7;
    --danger: #b42318;
    --success: #087f5b;
    --gold: #a87500;
    --gold-light: #fff4bf;
    --shadow: 0 16px 45px rgba(25, 25, 25, 0.12);
  }

  * {
    box-sizing: border-box;
  }

  html {
    width: 100%;
    min-height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
  }

  body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    direction: rtl;
    color: var(--dark);
    background:
      radial-gradient(circle at 100% 0, rgba(0, 143, 145, 0.11), transparent 42%),
      var(--background);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-tap-highlight-color: transparent;
  }

  button,
  input,
  a {
    font: inherit;
  }

  button,
  a {
    -webkit-touch-callout: none;
  }

  [hidden] {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    max-width: 680px;
    min-height: 100vh;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .hero {
    padding: 12px 12px 22px;
    overflow: hidden;
    color: #fff;
    text-align: center;
    background:
      linear-gradient(145deg, rgba(0, 143, 145, 0.97), rgba(0, 109, 111, 0.99));
    border-radius: 0 0 28px 28px;
    box-shadow: 0 14px 35px rgba(0, 109, 111, 0.26);
  }

  .cover-container {
    width: 100%;
    margin-bottom: 16px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.38);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
  }

  .cover {
    display: block;
    width: 100%;
    height: auto;
    max-height: 46vh;
    object-fit: cover;
  }

  .brand-block h1 {
    margin: 0;
    font-size: clamp(26px, 7vw, 34px);
    font-weight: 900;
    line-height: 1.3;
  }

  .brand-block p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.93);
    font-size: clamp(14px, 3.6vw, 17px);
    font-weight: 600;
  }

  .panel,
  .social-panel {
    margin: 14px 10px;
    padding: 16px 14px;
    border: 1px solid rgba(0, 143, 145, 0.1);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .social-panel {
    display: grid;
    gap: 8px;
  }

  .social-title {
    margin-bottom: 3px;
    color: var(--primary-dark);
    text-align: center;
    font-size: 17px;
    font-weight: 900;
  }

  .social-panel a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 7px 10px;
    color: var(--dark);
    text-decoration: none;
    border-radius: 12px;
    background: #f6fbfb;
    word-break: break-word;
  }

  .social-icon {
    display: inline-grid;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    place-items: center;
    color: #fff;
    border-radius: 9px;
    background: var(--primary);
    font-size: 14px;
    font-weight: 900;
  }

  .section-heading h2 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 20px;
    font-weight: 900;
  }

  .section-heading p {
    margin: 3px 0 12px;
    color: #606060;
    font-size: 14px;
  }

  .input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 12px;
    border: 2px solid rgba(0, 143, 145, 0.7);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(0, 143, 145, 0.08);
  }

  .input-wrap > span {
    color: var(--primary);
    font-size: 22px;
    line-height: 1;
  }

  .search-input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0;
    color: var(--dark);
    border: 0;
    outline: 0;
    background: transparent;
    direction: rtl;
    text-align: right;
    font-size: 15px;
    font-weight: 600;
  }

  .search-input::placeholder {
    color: #868686;
  }

  .user-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }

  .user-select {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 58px;
    padding: 9px 12px;
    color: var(--dark);
    text-align: right;
    border: 2px solid rgba(0, 143, 145, 0.56);
    border-radius: 15px;
    background: linear-gradient(180deg, #fff, #f7fcfc);
    box-shadow: 0 8px 20px rgba(25, 25, 25, 0.07);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  }

  .user-select:active {
    transform: scale(0.97);
  }

  .user-select-vip {
    border-color: var(--gold);
    background: linear-gradient(135deg, #fffdf2, var(--gold-light));
    box-shadow: 0 10px 25px rgba(168, 117, 0, 0.2);
  }

  .user-id {
    display: inline-grid;
    min-width: 40px;
    height: 40px;
    padding: 0 7px;
    place-items: center;
    color: #fff;
    border-radius: 11px;
    background: var(--primary);
    font-size: 15px;
    font-weight: 900;
  }

  .user-select-vip .user-id {
    color: var(--dark);
    background: var(--secondary);
  }

  .user-name {
    font-size: 16px;
    font-weight: 800;
  }

  .mini-vip {
    padding: 4px 8px;
    color: #fff;
    border-radius: 999px;
    background: var(--gold);
    font-size: 11px;
    font-weight: 900;
  }

  .selected-user-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    margin: 10px;
    padding: 8px 12px;
    color: #fff;
    border-radius: 15px;
    background: rgba(0, 109, 111, 0.96);
    box-shadow: 0 10px 25px rgba(0, 109, 111, 0.28);
    backdrop-filter: blur(8px);
  }

  .selected-label {
    opacity: 0.82;
  }

  .selected-user-bar strong {
    display: block;
    font-size: 15px;
    font-weight: 900;
  }

  .change-user {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 11px;
    color: var(--dark);
    border: 0;
    border-radius: 10px;
    background: var(--secondary);
    font-size: 13px;
    font-weight: 900;
  }

  .search-panel {
    padding: 12px;
  }

  .profiles {
    display: grid;
    gap: 14px;
    padding: 0 10px 18px;
  }

  .profile-card {
    position: relative;
    overflow: hidden;
    padding: 17px 14px 15px;
    border: 2px solid rgba(0, 143, 145, 0.13);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    scroll-margin-top: 72px;
  }

  .vip-card {
    border: 3px solid var(--gold);
    background:
      radial-gradient(circle at 0 0, rgba(255, 203, 5, 0.29), transparent 35%),
      linear-gradient(150deg, #fffdf4 0%, #fff6c9 46%, #fff 100%);
    box-shadow:
      0 0 0 4px rgba(255, 203, 5, 0.17),
      0 20px 48px rgba(168, 117, 0, 0.28);
  }

  .vip-card::after {
    position: absolute;
    top: -70%;
    left: -50%;
    width: 42%;
    height: 240%;
    content: '';
    opacity: 0.55;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    transform: rotate(22deg);
    animation: vipShine 4.5s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes vipShine {
    0%, 55% { transform: translateX(-220%) rotate(22deg); }
    85%, 100% { transform: translateX(520%) rotate(22deg); }
  }

  .self-card {
    border-style: dashed;
    border-color: var(--primary);
  }

  .card-topline {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 2px solid #ececec;
  }

  .profile-name {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: clamp(19px, 5.6vw, 25px);
    font-weight: 900;
    line-height: 1.35;
  }

  .profile-id {
    display: inline-grid;
    min-width: 40px;
    min-height: 40px;
    padding: 3px 8px;
    place-items: center;
    color: #fff;
    border-radius: 12px;
    background: var(--primary);
    font-size: 15px;
  }

  .vip-card .profile-id {
    color: var(--dark);
    background: var(--secondary);
  }

  .vip-badge,
  .self-badge {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
  }

  .vip-badge {
    color: #fff;
    background: linear-gradient(135deg, #6f4c00, var(--gold));
    box-shadow: 0 7px 16px rgba(168, 117, 0, 0.24);
  }

  .self-badge {
    color: #fff;
    background: var(--primary);
  }

  .profile-section {
    position: relative;
    z-index: 1;
    margin-top: 16px;
  }

  .need-section {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px dashed #d5d5d5;
  }

  .profile-section h3 {
    margin: 0 0 6px;
    color: var(--primary-dark);
    font-size: 17px;
    font-weight: 900;
  }

  .profile-section p {
    margin: 0;
    color: #333;
    font-size: 15px;
    line-height: 1.8;
  }

  .suggest-box {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 11px;
    color: var(--dark);
    border: 1px solid rgba(215, 169, 0, 0.55);
    border-radius: 13px;
    background: rgba(255, 203, 5, 0.16);
    font-size: 14px;
  }

  .ai-icon {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: #fff;
    border-radius: 9px;
    background: var(--primary);
    font-size: 11px;
    font-weight: 900;
  }

  .suggest-links {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    direction: ltr;
  }

  .suggest-link {
    display: inline-grid;
    min-width: 28px;
    min-height: 28px;
    padding: 3px 7px;
    place-items: center;
    color: var(--primary-dark);
    text-decoration: underline;
    text-underline-offset: 4px;
    border-radius: 8px;
    background: #fff;
    font-weight: 900;
  }

  .suggest-separator {
    color: #8d7500;
    font-weight: 900;
  }

  .action-buttons {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 10px;
    margin-top: 14px;
  }

  .action-button,
  .primary-button {
    width: 100%;
    min-height: 52px;
    padding: 10px 12px;
    border: 0;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(25, 25, 25, 0.12);
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
  }

  .action-button:active,
  .primary-button:active {
    transform: scale(0.95);
  }

  .action-button:disabled {
    cursor: default;
  }

  .connect-button,
  .primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  }

  .help-button {
    color: var(--dark);
    background: linear-gradient(135deg, var(--secondary), #ffe267);
  }

  .button-loading {
    animation: buttonPulse 0.75s ease-in-out infinite alternate;
  }

  .button-success {
    color: #fff !important;
    background: var(--success) !important;
    animation: successPop 0.42s ease;
  }

  @keyframes buttonPulse {
    from { opacity: 0.62; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
  }

  @keyframes successPop {
    50% { transform: scale(0.94); }
  }

  .self-message {
    margin-top: 14px;
    padding: 11px;
    color: var(--primary-dark);
    text-align: center;
    border-radius: 12px;
    background: rgba(0, 143, 145, 0.1);
    font-size: 14px;
    font-weight: 800;
  }

  .jump-highlight {
    animation: jumpHighlight 1.6s ease;
  }

  @keyframes jumpHighlight {
    0%, 100% { box-shadow: var(--shadow); }
    30%, 65% {
      box-shadow: 0 0 0 7px rgba(255, 203, 5, 0.7), 0 18px 50px rgba(0, 143, 145, 0.27);
      transform: scale(1.012);
    }
  }

  .loading-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--primary-dark);
    font-weight: 800;
  }

  .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 143, 145, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  .error-box {
    color: var(--danger);
    text-align: center;
  }

  .error-box p {
    margin: 6px 0 12px;
  }

  .empty-state {
    padding: 14px;
    color: #666;
    text-align: center;
    font-weight: 700;
  }

  .footer {
    display: grid;
    gap: 6px;
    margin-top: 24px;
    padding: 26px 14px calc(26px + env(safe-area-inset-bottom));
    color: #fff;
    text-align: center;
    background: var(--dark);
  }

  .footer-brand {
    margin-bottom: 4px;
    color: var(--secondary);
    font-size: 16px;
    font-weight: 900;
  }

  .footer a {
    color: #fff;
    text-decoration: none;
    word-break: break-word;
    font-size: 13px;
  }

  .toast {
    position: fixed;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 100;
    max-width: 620px;
    margin: auto;
    padding: 12px 14px;
    color: #fff;
    text-align: center;
    border-radius: 13px;
    opacity: 0;
    transform: translateY(24px);
    pointer-events: none;
    font-size: 14px;
    font-weight: 800;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  .toast-show {
    opacity: 1;
    transform: translateY(0);
  }

  .toast-success {
    background: var(--success);
  }

  .toast-error {
    background: var(--danger);
  }

  @media (max-width: 380px) {
    body {
      font-size: 15px;
    }

    .panel,
    .social-panel {
      margin-right: 8px;
      margin-left: 8px;
      padding-right: 12px;
      padding-left: 12px;
    }

    .profiles {
      padding-right: 8px;
      padding-left: 8px;
    }

    .profile-card {
      padding-right: 13px;
      padding-left: 13px;
    }

    .action-button {
      font-size: 14px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
