/* D&D Cosmetic Battle Pass – tool-specific styles (plan §13) */

/* ---------------------------------------------------------------------------
   CSS variables: level-themed gradients and accents
   Early: cotton/wool → Mid: leather/silk → Late: crystal/gold/ruby
--------------------------------------------------------------------------- */
.battle-pass-app {
    /* Design system */
    --bp-spacing-xs: 0.25rem;
    --bp-spacing-sm: 0.5rem;
    --bp-spacing-md: 1rem;
    --bp-spacing-lg: 1.5rem;
    --bp-card-padding: 1rem;
    --bp-radius: 8px;
    --bp-input-height: 2.5rem;
    --bp-btn-height: 2.5rem;
    /* Tier theme */
    --tier-unlock-glow: 0 0 12px rgba(212, 175, 55, 0.6);
    --tier-active-glow: 0 0 10px rgba(80, 200, 120, 0.5);
    --tier-card-radius: 12px;
    --tier-card-shadow: 0 2px 8px var(--shadow);
    --tier-card-shadow-hover: 0 4px 16px var(--shadow-hover);
    --progress-fill-transition: 0.5s ease-out;
    color: var(--text);
}

/* Reusable design system classes */
.battle-pass-app .card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--bp-radius);
    padding: var(--bp-card-padding);
    box-shadow: var(--tier-card-shadow);
}
.battle-pass-app .card-header {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: var(--bp-spacing-sm);
    color: var(--text);
}
.battle-pass-app .form-row {
    display: flex;
    gap: var(--bp-spacing-md);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--bp-spacing-sm);
}
.battle-pass-app .form-row label { font-weight: 600; }
.battle-pass-app .hint,
.battle-pass-app .help-text {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: var(--bp-spacing-xs);
}
.battle-pass-app .grid {
    display: grid;
    gap: var(--bp-spacing-md);
}
.battle-pass-app .stack {
    display: flex;
    flex-direction: column;
    gap: var(--bp-spacing-sm);
}
.battle-pass-app .is-hidden { display: none !important; }
.battle-pass-app .is-visible { display: block !important; }

/* Level-themed gradient + fantasy glow (early pastels → late fiery gold/ruby) */
[data-level="1"] { --tier-gradient-start: #f5f0e6; --tier-gradient-end: #e8dfd0; --tier-accent: #a08060; --hero-text: #2d2d2d; --hero-badge: #1a1a1a; --hero-glow: rgba(160,128,96,0.4); --progress-glow: rgba(160,128,96,0.8); }
[data-level="2"] { --tier-gradient-start: #e8e4dc; --tier-gradient-end: #d4cfc4; --tier-accent: #8b7355; --hero-text: #2d2d2d; --hero-badge: #1a1a1a; --hero-glow: rgba(139,115,85,0.4); --progress-glow: rgba(139,115,85,0.8); }
[data-level="3"] { --tier-gradient-start: #e8e0f0; --tier-gradient-end: #d0c8e0; --tier-accent: #8a7a9e; --hero-text: #2d2d2d; --hero-badge: #1a1a1a; --hero-glow: rgba(138,122,158,0.5); --progress-glow: rgba(138,122,158,0.9); }
[data-level="4"] { --tier-gradient-start: #3d2c1e; --tier-gradient-end: #5c4033; --tier-accent: #c4a574; --hero-glow: rgba(196,165,116,0.4); --progress-glow: rgba(196,165,116,0.8); }
[data-level="5"] { --tier-gradient-start: #4a3a5c; --tier-gradient-end: #6b5b7b; --tier-accent: #c9b8d4; --hero-glow: rgba(201,184,212,0.4); --progress-glow: rgba(201,184,212,0.8); }
[data-level="6"] { --tier-gradient-start: #2d3d2d; --tier-gradient-end: #3d5240; --tier-accent: #8fbc8f; --hero-glow: rgba(143,188,143,0.4); --progress-glow: rgba(143,188,143,0.8); }
[data-level="7"] { --tier-gradient-start: #5c5c5c; --tier-gradient-end: #7a7a7a; --tier-accent: #c0c0c0; --hero-glow: rgba(192,192,192,0.4); --progress-glow: rgba(192,192,192,0.8); }
[data-level="8"] { --tier-gradient-start: #4a5568; --tier-gradient-end: #718096; --tier-accent: #a0aec0; --hero-glow: rgba(160,174,192,0.4); --progress-glow: rgba(160,174,192,0.8); }
[data-level="9"] { --tier-gradient-start: #553c2b; --tier-gradient-end: #7a5540; --tier-accent: #cd7f32; --hero-glow: rgba(205,127,50,0.5); --progress-glow: rgba(205,127,50,0.9); }
[data-level="10"] { --tier-gradient-start: #3d3d3d; --tier-gradient-end: #5a5a5a; --tier-accent: #888; --hero-glow: rgba(136,136,136,0.4); --progress-glow: rgba(136,136,136,0.8); }
[data-level="11"] { --tier-gradient-start: #4a4a4a; --tier-gradient-end: #6b6b6b; --tier-accent: #aaa; --hero-glow: rgba(170,170,170,0.4); --progress-glow: rgba(170,170,170,0.8); }
[data-level="12"] { --tier-gradient-start: #f5f5f5; --tier-gradient-end: #e8e8e8; --tier-accent: #666; --hero-text: #2d2d2d; --hero-badge: #1a1a1a; --hero-glow: rgba(102,102,102,0.35); --progress-glow: rgba(102,102,102,0.7); }
[data-level="13"] { --tier-gradient-start: #e0f4ff; --tier-gradient-end: #b8e0f0; --tier-accent: #5eb8e0; --hero-text: #2d2d2d; --hero-badge: #1a1a1a; --hero-glow: rgba(94,184,224,0.4); --progress-glow: rgba(94,184,224,0.8); }
[data-level="14"] { --tier-gradient-start: #c0c0c0; --tier-gradient-end: #e8e8e8; --tier-accent: #505050; --hero-glow: rgba(80,80,80,0.4); --progress-glow: rgba(80,80,80,0.8); }
[data-level="15"] { --tier-gradient-start: #f0e8f0; --tier-gradient-end: #e0d0e0; --tier-accent: #a07090; --hero-text: #2d2d2d; --hero-badge: #1a1a1a; --hero-glow: rgba(160,112,144,0.4); --progress-glow: rgba(160,112,144,0.8); }
[data-level="16"] { --tier-gradient-start: #2d4a3d; --tier-gradient-end: #4a6b5a; --tier-accent: #c08080; --hero-glow: rgba(192,128,128,0.5); --progress-glow: rgba(192,128,128,0.9); }
[data-level="17"] { --tier-gradient-start: #8b0000; --tier-gradient-end: #b22222; --tier-accent: #ff4444; --hero-glow: rgba(255,68,68,0.5); --progress-glow: rgba(255,68,68,0.9); }
[data-level="18"] { --tier-gradient-start: #0a0a3d; --tier-gradient-end: #1a1a5c; --tier-accent: #4444cc; --hero-glow: rgba(68,68,204,0.5); --progress-glow: rgba(68,68,204,0.9); }
[data-level="19"] { --tier-gradient-start: #5c4a00; --tier-gradient-end: #8b6914; --tier-accent: #ffd700; --hero-glow: rgba(255,215,0,0.5); --progress-glow: rgba(255,215,0,0.9); }
[data-level="20"] { --tier-gradient-start: #1a0a00; --tier-gradient-end: #2d1510; --tier-accent: #ffdd44; --hero-text: #fff8e7; --hero-badge: #fff; --hero-glow: rgba(255,221,68,0.6); --progress-glow: rgba(255,221,68,1); }

/* Battle pass header */
.bp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}
.bp-header h1 { font-size: 1.5rem; color: var(--text); }
.bp-header-actions { display: flex; gap: 0.5rem; align-items: center; }
.bp-header .intro { margin-top: 0.25rem; color: var(--text-light); font-size: 0.95rem; }

/* Two columns: hero + portrait side by side; stack on mobile */
.bp-dashboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bp-spacing-lg);
    align-items: flex-start;
    margin-bottom: var(--bp-spacing-lg);
    border: 3px solid transparent;
    border-image: linear-gradient(#c9a66b, #8b5a2b) 1;
    border-radius: 16px;
    padding: 12px;
    background: linear-gradient(#1e170f, #2a2118);
}
.bp-dashboard-left {
    flex: 1 1 0;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: var(--bp-spacing-sm);
}
.bp-at-a-glance {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: var(--bp-spacing-sm);
    align-items: center;
}
.bp-at-a-glance span { margin-right: var(--bp-spacing-xs); }
.bp-character-card .bp-character-card-header {
    margin-bottom: var(--bp-spacing-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bp-character-card .bp-char-card-name { font-weight: 700; }
.bp-dashboard-hero {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.2),
        0 8px 32px rgba(0,0,0,0.3),
        0 0 60px var(--hero-glow, rgba(120,80,160,0.25));
    color: var(--hero-text, #fff);
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    animation: bp-hero-enter 0.6s ease-out;
}
@keyframes bp-hero-enter {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
.bp-hero-fantasy {
    animation: bp-hero-enter 0.6s ease-out, bp-hero-glow-pulse 4s ease-in-out infinite;
}
@keyframes bp-hero-glow-pulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 8px 32px rgba(0,0,0,0.3), 0 0 60px var(--hero-glow); }
    50% { box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 8px 32px rgba(0,0,0,0.3), 0 0 80px var(--hero-glow); }
}
@keyframes bp-sparkle {
    0%, 100% { box-shadow: 0 0 60px var(--hero-glow); }
    50% { box-shadow: 0 0 120px #ffd700; }
}
.bp-unlock-sparkle { animation: bp-sparkle 1.2s ease-out; }
/* Epic fantasy background: purple magical energy, depth */
.bp-hero-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(160deg, rgba(60,30,80,0.85) 0%, rgba(30,15,50,0.95) 40%, rgba(20,10,35,0.98) 100%),
        radial-gradient(ellipse 120% 80% at 80% 20%, rgba(140,80,180,0.35) 0%, transparent 50%),
        radial-gradient(ellipse 100% 60% at 20% 80%, rgba(100,60,140,0.3) 0%, transparent 45%),
        linear-gradient(135deg, var(--tier-gradient-start, #2d1a4a) 0%, var(--tier-gradient-end, #1a0d2d) 100%);
    pointer-events: none;
}
.bp-hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06) 0%, transparent 2rem),
                      radial-gradient(circle at 70% 60%, rgba(255,255,255,0.05) 0%, transparent 2rem),
                      radial-gradient(circle at 50% 50%, rgba(255,255,255,0.03) 0%, transparent 3rem);
    animation: bp-particles-float 8s ease-in-out infinite;
    pointer-events: none;
}
@keyframes bp-particles-float {
    0%, 100% { opacity: 1; transform: translate(0, 0); }
    33% { opacity: 0.8; transform: translate(2px, -3px); }
    66% { opacity: 1; transform: translate(-1px, 2px); }
}
.bp-hero-content {
    position: relative;
    z-index: 1;
    padding: 1.75rem 1.5rem;
}
.bp-hero-top {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.bp-dashboard-portrait {
    flex-shrink: 0;
}
.bp-hero-portrait-wrap {
    width: 200px;
    height: 280px;
    border-radius: 8px;
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--surface);
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.75rem;
}
.bp-hero-portrait-wrap:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
}
.bp-hero-portrait-wrap:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.bp-hero-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}
.bp-hero-portrait-img.bp-hero-portrait-visible { display: block; }
.bp-hero-portrait-placeholder {
    text-align: center;
    padding: 0.5rem;
}
.bp-hero-portrait-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.bp-dashboard-hero[data-level="1"],
.bp-dashboard-hero[data-level="2"],
.bp-dashboard-hero[data-level="3"],
.bp-dashboard-hero[data-level="12"],
.bp-dashboard-hero[data-level="13"],
.bp-dashboard-hero[data-level="15"],
.bp-dashboard-hero[data-level="20"] {
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}
.bp-dashboard-hero .bp-level-badge {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, #f4e8c1 0%, #d4af37 40%, #b8972e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px #ffd700) drop-shadow(2px 2px 4px #000);
}
/* Light-level hero: dark badge for readability */
.bp-dashboard-hero[data-level="1"] .bp-level-badge,
.bp-dashboard-hero[data-level="2"] .bp-level-badge,
.bp-dashboard-hero[data-level="3"] .bp-level-badge,
.bp-dashboard-hero[data-level="12"] .bp-level-badge,
.bp-dashboard-hero[data-level="13"] .bp-level-badge,
.bp-dashboard-hero[data-level="15"] .bp-level-badge,
.bp-dashboard-hero[data-level="20"] .bp-level-badge {
    background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.3)) drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}
.bp-dashboard-hero .bp-theme-name {
    font-family: 'Cinzel Decorative', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    opacity: 0.95;
    text-transform: uppercase;
    color: var(--hero-text, #fff);
}
.bp-next-unlock {
    margin-top: 1.25rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.bp-next-unlock-icon {
    font-size: 1rem;
    color: #ffd700;
    filter: drop-shadow(0 0 6px rgba(255,215,0,0.8));
}
#bp-next-unlock-text {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255,215,0,0.6), 0 1px 2px rgba(0,0,0,0.4);
    font-weight: 600;
}
.bp-ring-wrap {
    width: 48px;
    height: 48px;
    position: relative;
    flex-shrink: 0;
}
.bp-ring-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}
.bp-ring-bg { stroke: rgba(255,255,255,0.3); fill: none; }
.bp-dashboard-hero[data-level="1"] .bp-ring-bg,
.bp-dashboard-hero[data-level="2"] .bp-ring-bg,
.bp-dashboard-hero[data-level="3"] .bp-ring-bg,
.bp-dashboard-hero[data-level="12"] .bp-ring-bg,
.bp-dashboard-hero[data-level="13"] .bp-ring-bg,
.bp-dashboard-hero[data-level="15"] .bp-ring-bg,
.bp-dashboard-hero[data-level="20"] .bp-ring-bg {
    stroke: rgba(0,0,0,0.2);
}
.bp-ring-fill {
    stroke: var(--tier-accent, #ffd700);
    fill: none;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--progress-fill-transition);
    filter: drop-shadow(0 0 4px var(--progress-glow, rgba(255,215,0,0.5)));
}

/* Progress bar: thick, radiant glowing, theme-colored fill + particle shine */
.bp-progress-bar-wrap {
    position: relative;
    height: 22px;
    background: rgba(0,0,0,0.4);
    border-radius: 11px;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), 0 0 20px rgba(0,0,0,0.2);
}
.bp-progress-bar-fill {
    width: 0;
    height: 100%;
    border-radius: 11px;
    transition: width var(--progress-fill-transition);
    background: linear-gradient(90deg, var(--tier-accent, #8a7a9e) 0%, rgba(255,255,255,0.5) 100%);
    box-shadow: 0 0 20px var(--progress-glow, rgba(138,122,158,0.9)), 0 0 40px var(--progress-glow);
    position: relative;
    z-index: 1;
}
.bp-progress-bar-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 11px;
    background: linear-gradient(105deg, transparent 0%, transparent 35%, rgba(255,255,255,0.25) 50%, transparent 65%, transparent 100%);
    background-size: 200% 100%;
    animation: bp-progress-shine 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}
@keyframes bp-progress-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.bp-progress-tier-markers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: stretch;
    z-index: 3;
}
.bp-progress-tier-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 0 6px rgba(255,255,255,0.6), 0 0 0 1px rgba(0,0,0,0.2);
    border-radius: 1px;
    transform: translateX(-50%);
}

/* XP input row */
.bp-xp-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.bp-xp-row label { font-weight: 600; }
.bp-xp-row input[type="number"] { width: 8rem; padding: 0.5rem; border-radius: 6px; border: 2px solid var(--border); background: var(--input-bg); color: var(--text); }
.bp-xp-error { color: var(--error); font-size: 0.9rem; margin-top: 0.25rem; }
.bp-xp-error.is-hidden { display: none !important; }
#bp-gear-error.is-hidden { display: none !important; }

/* Tier cards – fantasy style: rounded, theme glow, micro-animation */
.bp-tier-card {
    border-radius: 14px;
    padding: 1rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    box-shadow: var(--tier-card-shadow), 0 0 0 1px rgba(0,0,0,0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    color: var(--text);
    position: relative;
    overflow: hidden;
}
.bp-tier-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%, rgba(0,0,0,0.05) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.bp-tier-card:hover {
    box-shadow: var(--tier-card-shadow-hover), 0 4px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.bp-tier-card.active {
    border-color: var(--success);
    box-shadow: var(--tier-active-glow), var(--tier-card-shadow), 0 0 24px var(--hero-glow, rgba(80,200,120,0.25));
}
.bp-tier-card.bp-tier-card-new {
    animation: bp-card-flash 0.6s ease-out;
}
@keyframes bp-card-flash {
    0% { box-shadow: 0 0 24px rgba(212, 175, 55, 0.9); transform: scale(1.05); }
    100% { box-shadow: var(--tier-card-shadow); transform: scale(1); }
}
.bp-tier-card .bp-tier-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.bp-tier-card .bp-tier-theme-name { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; color: var(--text); }
.bp-tier-card .bp-tier-gear { font-size: 0.9rem; color: var(--text-light); }
.bp-tier-card .bp-tier-narrative { font-size: 0.85rem; margin-top: 0.25rem; color: var(--text-light); }
.bp-tier-card .bp-tier-toggle-wrap { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; color: var(--text); }
.bp-tier-card .bp-tier-toggle-wrap input[type="checkbox"] { width: 1.2rem; height: 1.2rem; cursor: pointer; }
.bp-tier-card .bp-tier-toggle-wrap label { color: var(--text); }

/* Accordions (by level) – use theme text for dark/light mode */
.bp-accordion { margin-bottom: 0.5rem; color: var(--text); }
.bp-accordion-header {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    color: var(--text);
}
.bp-accordion-header:hover { background: var(--card-bg); }
.bp-accordion-header .bp-accordion-icon { transition: transform 0.2s; }
.bp-accordion.open .bp-accordion-icon { transform: rotate(90deg); }
.bp-accordion-content { padding: 0.5rem 0; display: none; }
.bp-accordion.open .bp-accordion-content { display: block; }
.bp-tier-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Loadout – graphical gear cards */
.bp-loadout-section { margin-bottom: 1.5rem; }
.bp-loadout-section .btn-secondary { margin-bottom: 1rem; }
.bp-loadout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Segmented controls – horizontal connected row */
.bp-segmented {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--surface);
}
.bp-segmented-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.4rem 0.5rem;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.bp-segmented-option:last-child { border-right: none; }
.bp-segmented-option:hover:not(:disabled):not(.bp-tier-step-locked) { background: var(--card-bg); }
.bp-segmented-option-active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: inset 0 0 0 1px var(--primary-color);
}
.bp-segmented-option-active:hover:not(:disabled) { background: var(--primary-color); opacity: 0.95; }
.bp-segmented .bp-mat-icon,
.bp-segmented .bp-tier-icon {
    width: 20px;
    height: 20px;
    display: block;
}
.bp-segmented .bp-mat-icon svg,
.bp-segmented .bp-tier-icon svg { width: 100%; height: 100%; }
.bp-segmented-option.bp-mat-cotton { background: linear-gradient(135deg, #faf8f5 0%, #f0ebe3 100%); color: #4a4a4a; }
.bp-segmented-option.bp-mat-wool { background: linear-gradient(135deg, #e8e2d8 0%, #d4ccc0 100%); color: #3d3d3d; }
.bp-segmented-option.bp-mat-lace { background: repeating-linear-gradient(90deg, #f5f2ef 0, #f5f2ef 2px, #ebe6e0 2px, #ebe6e0 4px); color: #4a4a4a; }
.bp-segmented-option.bp-mat-leather { background: linear-gradient(135deg, #5c4a3a 0%, #4a3c2e 100%); color: #e8e0d8; }
.bp-segmented-option.bp-mat-silk { background: linear-gradient(135deg, #6b5b7b 0%, #4a3a5c 100%); color: #e8e0f0; }
/* Generic fallback for materials without a specific class (e.g. Wood, Steel, Gold) */
.bp-segmented-option[class*="bp-mat-"]:not(.bp-mat-cotton):not(.bp-mat-wool):not(.bp-mat-lace):not(.bp-mat-leather):not(.bp-mat-silk) {
    background: linear-gradient(135deg, var(--surface) 0%, var(--card-bg) 100%);
    color: var(--text);
}
.bp-segmented-option.bp-mat-cotton.bp-segmented-option-active,
.bp-segmented-option.bp-mat-wool.bp-segmented-option-active,
.bp-segmented-option.bp-mat-lace.bp-segmented-option-active,
.bp-segmented-option.bp-mat-leather.bp-segmented-option-active,
.bp-segmented-option.bp-mat-silk.bp-segmented-option-active,
.bp-segmented-option[class*="bp-mat-"].bp-segmented-option-active {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 138, 122, 158), 0.3);
}
.bp-slot-control-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.bp-slot-material-row {
    margin-bottom: 0.25rem;
}
.bp-slot-control-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    flex-shrink: 0;
}

/* Material dropdown */
.bp-mat-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}
.bp-mat-dropdown-wrap {
    position: relative;
}
.bp-mat-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 8rem;
    padding: 0.4rem 0.6rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bp-mat-dropdown-trigger:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}
.bp-mat-dropdown-trigger-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bp-mat-dropdown-trigger-icon .bp-mat-icon,
.bp-mat-dropdown-trigger-icon svg {
    width: 100%;
    height: 100%;
}
.bp-mat-dropdown-trigger-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bp-mat-dropdown-chevron {
    flex-shrink: 0;
    font-size: 0.65rem;
    opacity: 0.8;
    transition: transform 0.2s;
}
.bp-mat-dropdown-open .bp-mat-dropdown-chevron {
    transform: rotate(-180deg);
}
.bp-mat-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: min(24rem, 70vh);
    overflow-y: auto;
    overflow-x: hidden;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.bp-mat-dropdown-open .bp-mat-dropdown-panel {
    display: block;
}
.bp-mat-dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.bp-mat-dropdown-option:last-child {
    border-bottom: none;
}
.bp-mat-dropdown-option:hover {
    background: rgba(255,255,255,0.08);
}
.bp-mat-dropdown-option .bp-mat-icon,
.bp-mat-dropdown-option svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.bp-mat-dropdown-option span:last-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bp-mat-dropdown-trigger.bp-mat-cotton { background: linear-gradient(135deg, #faf8f5 0%, #f0ebe3 100%); color: #4a4a4a; }
.bp-mat-dropdown-trigger.bp-mat-wool { background: linear-gradient(135deg, #e8e2d8 0%, #d4ccc0 100%); color: #3d3d3d; }
.bp-mat-dropdown-trigger.bp-mat-lace { background: repeating-linear-gradient(90deg, #f5f2ef 0, #f5f2ef 2px, #ebe6e0 2px, #ebe6e0 4px); color: #4a4a4a; }
.bp-mat-dropdown-trigger.bp-mat-leather { background: linear-gradient(135deg, #5c4a3a 0%, #4a3c2e 100%); color: #e8e0d8; }
.bp-mat-dropdown-trigger.bp-mat-silk { background: linear-gradient(135deg, #6b5b7b 0%, #4a3a5c 100%); color: #e8e0f0; }
.bp-mat-dropdown-trigger[class*="bp-mat-"]:not(.bp-mat-cotton):not(.bp-mat-wool):not(.bp-mat-lace):not(.bp-mat-leather):not(.bp-mat-silk) {
    background: linear-gradient(135deg, var(--surface) 0%, var(--card-bg) 100%);
    color: var(--text);
}
.bp-mat-dropdown-option.bp-mat-cotton { background: linear-gradient(135deg, #faf8f5 0%, #f0ebe3 100%); color: #4a4a4a; }
.bp-mat-dropdown-option.bp-mat-wool { background: linear-gradient(135deg, #e8e2d8 0%, #d4ccc0 100%); color: #3d3d3d; }
.bp-mat-dropdown-option.bp-mat-lace { background: repeating-linear-gradient(90deg, #f5f2ef 0, #f5f2ef 2px, #ebe6e0 2px, #ebe6e0 4px); color: #4a4a4a; }
.bp-mat-dropdown-option.bp-mat-leather { background: linear-gradient(135deg, #5c4a3a 0%, #4a3c2e 100%); color: #e8e0d8; }
.bp-mat-dropdown-option.bp-mat-silk { background: linear-gradient(135deg, #6b5b7b 0%, #4a3a5c 100%); color: #e8e0f0; }
.bp-mat-dropdown-option[class*="bp-mat-"]:not(.bp-mat-cotton):not(.bp-mat-wool):not(.bp-mat-lace):not(.bp-mat-leather):not(.bp-mat-silk) {
    background: linear-gradient(135deg, var(--surface) 0%, var(--card-bg) 100%);
    color: var(--text);
}
.bp-mat-dropdown-option.bp-mat-dropdown-option-selected {
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

.bp-customize-tier,
.bp-reset-to-global {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.bp-customize-tier:hover,
.bp-reset-to-global:hover {
    background: var(--card-bg);
    color: var(--primary-color);
}
.bp-loadout-slot-overridden {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb, 138, 122, 158), 0.25);
}
.bp-tier-control-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.bp-gear-card {
    padding: 0;
    overflow: visible;
    background: linear-gradient(145deg, #2a2118 0%, #1e170f 100%);
    border: 3px solid transparent;
    border-image: linear-gradient(#c9a66b, #8b5a2b) 1;
    border-radius: 12px;
    box-shadow: inset 0 0 20px rgba(139,90,43,0.3), 0 8px 20px rgba(0,0,0,0.6);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bp-gear-card:hover {
    box-shadow: inset 0 0 20px rgba(139,90,43,0.3), 0 8px 20px rgba(0,0,0,0.6), 0 0 18px #ffd700;
}

.bp-gear-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    background: rgba(0,0,0,0.03);
    border-bottom: 1px solid var(--border);
}
.bp-gear-icon-wrap {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.bp-gear-icon { width: 24px; height: 24px; color: var(--text); }
.bp-gear-header-middle {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.bp-slot-label { font-size: 0.75rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; }
.bp-gear-select {
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.95rem;
}
.bp-gear-header-chips {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.bp-summary-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}

.bp-gear-card-body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Material chips – pill buttons with textures */
.bp-mat-chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bp-mat-chip {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.6), inset 0 -2px 3px rgba(0,0,0,0.4);
    transition: border-color 0.2s, transform 0.15s;
}
.bp-mat-chip:hover { transform: scale(1.03); }
.bp-mat-chip-active { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 138, 122, 158), 0.3); }
.bp-mat-cotton {
    background: linear-gradient(135deg, #faf8f5 0%, #f0ebe3 100%);
    color: #4a4a4a;
}
.bp-mat-wool {
    background: linear-gradient(135deg, #e8e2d8 0%, #d4ccc0 100%);
    color: #3d3d3d;
}
.bp-mat-lace {
    background: repeating-linear-gradient(90deg, #f5f2ef 0, #f5f2ef 2px, #ebe6e0 2px, #ebe6e0 4px);
    color: #4a4a4a;
}
.bp-mat-leather {
    background: linear-gradient(135deg, #5c4a3a 0%, #4a3c2e 100%);
    color: #e8e0d8;
}
.bp-mat-silk {
    background: linear-gradient(135deg, #6b5b7b 0%, #4a3a5c 100%);
    color: #e8e0f0;
}
/* Generic fallback for material chips (e.g. Wood, Steel, Gold) */
.bp-mat-chip[class*="bp-mat-"]:not(.bp-mat-cotton):not(.bp-mat-wool):not(.bp-mat-lace):not(.bp-mat-leather):not(.bp-mat-silk) {
    background: linear-gradient(135deg, var(--surface) 0%, var(--card-bg) 100%);
    color: var(--text);
}

/* Tier step buttons – 4-step visual selector */
.bp-tier-step-group { display: flex; gap: 0.25rem; }
.bp-tier-step {
    flex: 1;
    min-width: 2.5rem;
    padding: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bp-tier-step:hover { border-color: var(--primary-color); }
.bp-tier-t0 { border-color: var(--border); }
.bp-tier-t1 { border-color: rgba(160, 140, 180, 0.5); }
.bp-tier-t2 { border-color: rgba(160, 140, 180, 0.7); box-shadow: 0 0 6px rgba(160, 140, 180, 0.2); }
.bp-tier-t3 { border-color: rgba(160, 140, 180, 0.9); box-shadow: 0 0 10px rgba(160, 140, 180, 0.3); }
.bp-tier-step-active.bp-tier-t0 { border-color: var(--primary-color); background: var(--surface); }
.bp-tier-step-active.bp-tier-t1 { border-color: var(--primary-color); box-shadow: 0 0 4px rgba(138, 122, 158, 0.4); }
.bp-tier-step-active.bp-tier-t2 { border-color: var(--primary-color); box-shadow: 0 0 8px rgba(138, 122, 158, 0.5); }
.bp-tier-step-active.bp-tier-t3 { border-color: var(--primary-color); box-shadow: 0 0 14px rgba(138, 122, 158, 0.6); }
.bp-tier-step.bp-tier-step-locked,
.bp-tier-step:disabled,
.bp-segmented-option.bp-tier-step-locked,
.bp-segmented-option:disabled { opacity: 0.5; cursor: not-allowed; }

.bp-tier-chip.bp-tier-t0 { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.bp-tier-chip.bp-tier-t1 { background: rgba(160, 140, 180, 0.2); border: 1px solid rgba(160, 140, 180, 0.5); color: var(--text); }
.bp-tier-chip.bp-tier-t2 { background: rgba(160, 140, 180, 0.25); border: 1px solid rgba(160, 140, 180, 0.7); color: var(--text); }
.bp-tier-chip.bp-tier-t3 { background: rgba(160, 140, 180, 0.3); border: 1px solid rgba(160, 140, 180, 0.9); color: var(--text); }

/* Tier legend and meanings (Loadout) */
.bp-tier-legend { margin: 0.75rem 0 0.25rem; font-size: 0.95rem; color: var(--text-light); }
.bp-tier-meanings-details { margin-bottom: 1rem; }
.bp-tier-meanings-details summary { cursor: pointer; font-weight: 600; }
.bp-tier-meanings-list { margin: 0.5rem 0 0 1.25rem; padding: 0; }

/* Slot header tier label */
.bp-slot-tier-label { display: block; font-size: 0.85rem; color: var(--text-light); margin-top: 0.15rem; }

/* Tier control: per-slot override (segmented + reset) */
.bp-tier-tooltip-desktop {
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 0.35rem;
    padding: 0.5rem 0.75rem;
    max-width: 280px;
    font-size: 0.85rem;
    line-height: 1.35;
    background: var(--card-bg, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--tier-card-shadow);
    color: var(--text);
    z-index: 5;
    pointer-events: none;
}
.bp-tier-tooltip-desktop[hidden] { display: none !important; }

/* Desktop: show hover tooltip; hide mobile panel */
@media (hover: hover) {
    .bp-tier-meaning-mobile-panel { display: none !important; }
}

/* Mobile/touch: hide desktop tooltip; show collapsible tier meaning */
@media (hover: none) {
    .bp-tier-tooltip-desktop { display: none !important; }
    .bp-tier-meaning-mobile-panel { display: block; margin-top: 0.5rem; }
    .bp-tier-meaning-mobile-panel summary { font-size: 0.9rem; }
    .bp-tier-meaning-text { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--text-light); }
}

@media (max-width: 600px) {
    .bp-loadout-grid { grid-template-columns: 1fr; }
    .bp-gear-card-header { flex-wrap: wrap; }
    .bp-gear-select { max-width: 100%; }
}

/* Current level section */
#bp-current-level-section { margin-bottom: 1rem; }
#bp-other-levels-section.is-hidden { display: none !important; }
#bp-current-level-section h2 { margin-bottom: 0.25rem; }


/* Other levels (details/summary) */
#bp-other-levels-details { margin-top: 1.5rem; }
#bp-other-levels-details summary { cursor: pointer; font-weight: 600; margin-bottom: 0.75rem; }

/* Filter bar */
.bp-filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: center;
}
.bp-filter-bar input, .bp-filter-bar select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 2px solid var(--border);
    min-width: 120px;
}

/* Generate button */
.bp-generate-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.bp-generate-btn:hover { transform: scale(1.02); }
.bp-generate-btn:active { transform: scale(0.98); }
.bp-generate-btn.bp-pulse-available {
    animation: bp-btn-pulse 1.5s ease-in-out infinite;
}
@keyframes bp-btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.5); }
    50% { box-shadow: 0 0 16px 4px rgba(212, 175, 55, 0.4); }
}
.bp-generate-btn.bp-success { background: var(--success); border-color: var(--success); }

/* Current build summary – chips above Generate button */
.bp-current-build {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--bp-radius);
}
.bp-build-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}
.bp-build-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.bp-build-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.bp-build-empty { color: var(--text-light); font-style: italic; }

/* Catalog tab */
.bp-catalog-gear-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.bp-catalog-gear-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
}
.bp-catalog-gear-item .bp-catalog-gear-icon,
.bp-catalog-gear-item .bp-catalog-gear-icon svg { width: 32px; height: 32px; display: block; margin: 0 auto; }
.bp-catalog-gear-name { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.bp-catalog-add { margin-top: 1rem; }
.bp-catalog-add .bp-gear-custom-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.bp-emoji-input { width: 3rem; text-align: center; }
.bp-custom-gear-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.bp-custom-gear-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.bp-custom-gear-remove {
    padding: 0 0.25rem;
    margin-left: 0.25rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
}
.bp-custom-gear-remove:hover { color: var(--error, #c00); }

.bp-gen-preview {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--bp-radius);
    font-size: 0.9rem;
    color: var(--text-light);
}
.bp-gen-preview p { margin: 0.25rem 0; }
.bp-gen-preview p:first-child { margin-top: 0; }
.bp-gen-preview p:last-child { margin-bottom: 0; }

/* Forms */
.bp-form-section { margin-bottom: 1.5rem; }
.bp-tab-nav { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.bp-form-section h2 { font-size: 1.2rem; margin-bottom: 0.75rem; color: var(--primary-color); }
.bp-form-group { margin-bottom: 0.75rem; }
.bp-form-group label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.bp-form-group input[type="text"],
.bp-form-group input[type="number"],
.bp-form-group select,
.bp-form-group textarea {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
}
#bp-current-level-hint { font-size: 0.9rem; color: var(--text-light); margin-bottom: 0.75rem; }
.bp-form-group:has(#bp-portrait-file) .help-text { font-size: 0.85rem; color: var(--text-light); margin-top: 0.25rem; }
.bp-optional-controls { margin-top: 1rem; }
.bp-reseed-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.bp-reseed-btn:hover { background: var(--card-bg); color: var(--text); }
.bp-optional-controls .help-text { font-size: 0.8rem; color: var(--text-light); margin-top: 0.25rem; }
.bp-reset-btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.bp-reset-btn:hover { background: var(--surface); color: var(--error, #c00); border-color: var(--text-light); }
.bp-gear-custom-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bp-gear-custom-row input,
#bp-gear-custom {
    color: var(--text);
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
}
.bp-generate-status { margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--text-light); }
.bp-generate-status:empty { display: none; }
.bp-advanced-prompts { margin-top: var(--bp-spacing-md); }
.bp-advanced-prompts summary { cursor: pointer; font-weight: 600; margin-bottom: var(--bp-spacing-sm); }
.bp-form-group textarea + .btn-secondary { margin-top: 0.5rem; }
#bp-tab-generate .bp-form-section > .help-text { font-size: 0.85rem; margin-bottom: 0.5rem; }
.bp-help-light { color: var(--text-light); }
.bp-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.1em;
    margin-left: 0.2em;
    border-radius: 50%;
    background: var(--text-light);
    color: var(--card-bg);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
}
.bp-help-icon:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Gear pool: searchable list – use theme text for dark/light mode */
.bp-gear-search { margin-bottom: 0.5rem; }
.bp-gear-search input { max-width: 100%; color: var(--text); background: var(--input-bg); }
.bp-gear-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem;
    color: var(--text);
}
.bp-gear-list-item {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text);
}
.bp-gear-list-item:hover { background: var(--card-bg); }
.bp-gear-pool-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; color: var(--text); }
.bp-gear-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
}
.bp-gear-chip:hover { background: var(--card-bg); border-color: var(--text-light); }

/* Tabs – horizontal scroll only, no vertical wrap */
.bp-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.bp-tabs .bp-tab {
    flex-shrink: 0;
    white-space: nowrap;
    overflow: visible;
}
.bp-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.bp-tab:hover { color: var(--primary-color); }
.bp-tab:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.bp-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.bp-tab.bp-tab-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    color: var(--text-light);
}
.bp-tab.bp-tab-disabled:hover { color: var(--text-light); }
.bp-tab-content { display: none; }
.bp-tab-content.active { display: block; }

/* Gallery */
.bp-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.bp-gallery-item {
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}
.bp-gallery-item img { width: 100%; height: 120px; object-fit: contain; display: block; background: var(--surface); cursor: pointer; }
.bp-gallery-item-actions { padding: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Lightbox (Discord-style enlarged image) */
.bp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s;
}
.bp-lightbox.bp-lightbox-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.bp-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}
.bp-lightbox-img {
    position: relative;
    z-index: 1;
    max-width: calc(100vw - 4rem);
    max-height: calc(100vh - 4rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}
.bp-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.bp-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}
.bp-gallery-item-actions button { padding: 0.25rem 0.5rem; font-size: 0.85rem; cursor: pointer; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); }

/* Generate with OpenAI */
.bp-generate-api-row { margin-bottom: 1.5rem; }
.bp-generate-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.75rem; }
.bp-generate-control { display: flex; align-items: center; gap: 0.5rem; }
.bp-generate-control span { font-weight: 600; }
.bp-generate-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
#bp-gen-result-wrap {
    margin-top: 1rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    min-height: 180px;
}
.bp-gen-result-status { margin-bottom: 0.5rem; font-size: 0.9rem; }
#bp-gen-result-image-wrap {
    margin-bottom: 0.75rem;
    min-height: 120px;
    overflow: visible;
}
#bp-gen-result-image-wrap img,
#bp-gen-result-image-wrap .bp-gen-result-img {
    display: block !important;
    max-width: 100%;
    width: auto;
    cursor: pointer;
    height: auto;
    max-height: min(400px, 60vh);
    min-height: 120px;
    object-fit: contain;
    border-radius: 6px;
    vertical-align: top;
}
.bp-gen-result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bp-gen-result-hidden { display: none !important; }
.bp-gen-result-wrap.bp-gen-result-visible { display: block !important; }
.bp-gen-result-actions.bp-gen-result-visible { display: flex !important; }

/* Tooltip for tier card narrative */
.bp-tier-card[title] { cursor: help; }
.bp-error-msg { color: var(--error); font-size: 0.9rem; margin-top: 0.25rem; }

/* Desktop: ensure hero (Battle Pass card) is visible and has space */
@media (min-width: 901px) {
    .bp-dashboard-hero {
        min-height: 180px;
        display: block;
    }
}

/* 900px: single column dashboard, compact portrait */
@media (max-width: 900px) {
    .bp-dashboard-row { flex-direction: column; }
    .bp-dashboard-left { flex: 1 1 100%; }
    .bp-dashboard-hero { flex: 1 1 100%; min-width: 0; }
    .bp-dashboard-portrait { width: 100%; }
    .bp-character-card { max-width: 280px; margin: 0 auto; }
    .bp-hero-portrait-wrap {
        max-height: 320px;
        width: 100%;
        height: 320px;
    }
    .bp-hero-portrait-img { object-fit: contain; }
}

/* 601px: stack hero card cleanly, smaller portrait for readability */
@media (max-width: 601px) {
    .bp-dashboard-row { flex-direction: column; }
    .bp-hero-portrait-wrap {
        height: 240px;
        max-height: 240px;
    }
}

/* 600px: compact padding, full-width controls, result image constrained */
@media (max-width: 600px) {
    .container.battle-pass-app { padding: 10px; }
    .bp-dashboard-hero .bp-hero-content { padding: 1.25rem 1rem; }
    .bp-dashboard-hero .bp-level-badge { font-size: 2.5rem; }
    .bp-dashboard-hero .bp-theme-name { font-size: 1.1rem; letter-spacing: 0.08em; }
    .bp-progress-bar-wrap { height: 18px; margin-top: 0.75rem; }
    .bp-next-unlock { margin-top: 1rem; font-size: 0.85rem; }
    .bp-tier-cards-grid { grid-template-columns: 1fr; }
    .bp-header { flex-direction: column; align-items: flex-start; }
    .bp-tabs { position: sticky; top: env(safe-area-inset-top, 0); z-index: 10; background: var(--surface); padding-top: 4px; }
    .bp-tab { padding: 0.5rem 0.75rem; font-size: 0.875rem; }
    .bp-form-group input,
    .bp-form-group select,
    .bp-form-group textarea,
    .bp-filter-bar input,
    .bp-filter-bar select,
    .bp-filter-bar button { max-width: 100%; width: 100%; }
    .bp-filter-bar { flex-direction: column; }
    #bp-gen-result-image-wrap img { max-height: min(400px, 60vh); }
}
