/* ============================================================
   AI Strategy Lab (/social/ai-players) + AI player profile bits
   Shared: .aip-chip--ai (also used on user_profile.html),
           .aip-strategy-card (profile strategy card)
   ============================================================ */

/* ── Shared chip ── */
.aip-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
    vertical-align: middle;
}
.aip-chip--ai {
    color: var(--accent-purple, #8957e5);
    background: rgba(137, 87, 229, 0.14);
    border: 1px solid rgba(137, 87, 229, 0.42);
}
[data-theme="light"] .aip-chip--ai { color: #6639ba; background: rgba(137, 87, 229, 0.1); }

.aip-page .pos, .aip-strategy-card .pos { color: var(--positive, #3fb950); }
.aip-page .neg, .aip-strategy-card .neg { color: var(--text-negative, #f85149); }
.aip-page .flat { color: var(--text-secondary); }

/* ── Page ── */
.aip-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 48px;
    min-width: 0;
}
.aip-muted { color: var(--text-muted); }
.aip-link {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
}
.aip-link:hover { text-decoration: underline; }

/* ── Hero ── */
.aip-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.aip-hero-text { flex: 1 1 420px; min-width: 0; }
.aip-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 8px;
}
.aip-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.aip-sub {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
    max-width: 62ch;
}
.aip-hero-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.aip-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    min-width: 96px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
}
.aip-hero-num { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.aip-hero-num.pos { color: var(--positive, #3fb950); }
.aip-hero-lbl { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); }

/* ── Sections ── */
.aip-section { margin-bottom: 28px; min-width: 0; }
.aip-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.aip-section-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.aip-section-note { font-size: 0.78rem; color: var(--text-muted); }

/* ── Avatars / identity ── */
.aip-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.aip-avatar--lg { width: 48px; height: 48px; font-size: 0.95rem; }
.aip-avatar img, .aip-avatar .av-img { width: 100%; height: 100%; object-fit: cover; }
.aip-avatar-link { display: inline-flex; flex-shrink: 0; text-decoration: none; }
.aip-id { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.aip-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.aip-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.aip-name:hover { color: var(--accent-primary); }
.aip-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Follow button ── */
.aip-follow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--accent-green, #238636);
    background: var(--accent-green, #238636);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.aip-follow:hover { background: var(--accent-green-light, #2ea043); color: #fff; }
.aip-follow--sm { height: 28px; padding: 0 12px; font-size: 0.74rem; }
.aip-follow[data-following="true"] {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.aip-follow[data-following="true"]:hover { color: var(--text-negative, #f85149); border-color: var(--text-negative, #f85149); }
.aip-follow[disabled] { opacity: 0.6; cursor: default; }

/* ── Featured row ── */
.aip-featured-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.aip-feat-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-card);
    background-image: linear-gradient(135deg, rgba(137, 87, 229, 0.08), transparent 55%);
}
.aip-feat-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.aip-feat-pitch { font-size: 0.85rem; line-height: 1.45; color: var(--text-secondary); margin: 0; flex: 1; }
.aip-feat-stats { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; }
.aip-units { font-size: 1.05rem; font-weight: 700; }
.aip-rec { color: var(--text-primary); font-weight: 600; }
.aip-feat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ── Family chips ── */
.aip-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.aip-fchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.aip-fchip .mono { font-size: 0.7rem; color: var(--text-muted); }
.aip-fchip:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.aip-fchip.active { color: #fff; background: var(--accent-primary); border-color: var(--accent-primary); }
.aip-fchip.active .mono { color: rgba(255, 255, 255, 0.8); }

/* ── Toolbar ── */
.aip-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.aip-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 240px;
    min-width: 0;
    margin: 0;
}
.aip-search svg { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.aip-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}
.aip-search input:focus, .aip-select:focus { outline: none; border-color: var(--accent-primary); box-shadow: var(--focus-ring); }
.aip-selects { display: flex; gap: 8px; flex: 0 1 auto; min-width: 0; }
.aip-select {
    height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    min-width: 0;
    cursor: pointer;
}

/* ── Grid + cards ── */
.aip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 12px;
}
.aip-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s;
}
.aip-card:hover { border-color: var(--text-muted); }
.aip-card[hidden] { display: none; }
.aip-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.aip-rank { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); min-width: 30px; }
.aip-strategy { font-size: 0.84rem; line-height: 1.45; color: var(--text-secondary); margin: 0; }
.aip-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.aip-tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}
.aip-tag--family { color: var(--accent-primary); border-color: rgba(46, 160, 67, 0.35); background: var(--accent-primary-soft, rgba(46, 160, 67, 0.14)); }
.aip-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light, var(--border-color));
    border-radius: var(--radius-md, 8px);
}
.aip-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.aip-stat-lbl { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.aip-stat-val { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.aip-rules { font-size: 0.8rem; }
.aip-rules summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.aip-rules summary::-webkit-details-marker { display: none; }
.aip-rules summary::before { content: '\25B8'; font-size: 0.7rem; transition: transform 0.15s; }
.aip-rules[open] summary::before { transform: rotate(90deg); }
.aip-rules ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-secondary); line-height: 1.5; }
.aip-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    font-size: 0.76rem;
}

/* ── Empty / footnote ── */
.aip-empty {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg, 12px);
    color: var(--text-secondary);
}
.aip-empty h3 { margin: 0 0 6px; color: var(--text-primary); font-size: 1.05rem; }
.aip-empty p { margin: 0 0 12px; font-size: 0.88rem; }
.aip-empty a { color: var(--accent-primary); font-weight: 600; }
.aip-empty[hidden] { display: none; }
.aip-footnote { font-size: 0.76rem; color: var(--text-muted); line-height: 1.5; margin: 8px 0 0; }

/* ── Cross-links (cappers / leaderboard banners) ── */
.aip-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin: 0 0 16px;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid rgba(137, 87, 229, 0.35);
    background: linear-gradient(90deg, rgba(137, 87, 229, 0.12), rgba(137, 87, 229, 0.02));
    color: var(--text-primary);
    text-decoration: none;
    min-width: 0;
}
.aip-banner:hover { border-color: rgba(137, 87, 229, 0.65); color: var(--text-primary); }
.aip-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aip-banner-title { font-size: 0.9rem; font-weight: 700; }
.aip-banner-sub { font-size: 0.78rem; color: var(--text-secondary); }
.aip-banner-cta { font-size: 0.8rem; font-weight: 700; color: var(--accent-purple, #8957e5); white-space: nowrap; }

/* ── Profile: strategy card ── */
.aip-strategy-card {
    margin: 16px 0;
    padding: 16px;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid rgba(137, 87, 229, 0.35);
    background: var(--bg-secondary);
    background-image: linear-gradient(135deg, rgba(137, 87, 229, 0.1), transparent 60%);
    min-width: 0;
}
.aip-strategy-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.aip-strategy-card-kicker { font-size: 0.68rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.aip-strategy-card-title { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); margin: 0 0 4px; }
.aip-strategy-card-desc { font-size: 0.9rem; line-height: 1.5; color: var(--text-secondary); margin: 0 0 10px; }
.aip-strategy-card-headline { font-size: 0.85rem; color: var(--text-primary); font-style: italic; margin: 0 0 10px; }
.aip-strategy-card-rules { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.aip-strategy-card-rules li {
    font-size: 0.78rem;
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.aip-strategy-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .aip-featured-row {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .aip-feat-card { flex: 0 0 78%; max-width: 320px; scroll-snap-align: start; }
}
@media (max-width: 640px) {
    .aip-title { font-size: 1.4rem; }
    .aip-hero { gap: 14px; }
    .aip-hero-stats { width: 100%; }
    .aip-hero-stat { flex: 1 1 0; min-width: 0; padding: 8px 10px; }
    .aip-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .aip-chips::-webkit-scrollbar { display: none; }
    .aip-search { flex: 1 1 100%; }
    .aip-selects { width: 100%; }
    .aip-select { flex: 1 1 0; }
    .aip-section-head { flex-wrap: wrap; }
    .aip-banner-sub { display: none; }
}
