/* ===== Casino Card Upgrades — Dark Premium Vibe ===== */
/* brand.json source: image-analysis | vibe: dark, premium, metallic gold, leather-like depth */

/* ===== Google Fonts — loaded via <link> in index.html for faster mobile rendering ===== */

/* ===== CSS Variables ===== */
:root {
    /* Background */
    --bg-primary: #1a1a1a;
    --bg-alt: #222019;
    --bg-surface: #2a2723;
    --bg-surface-border: #b8973a;
    --bg-overlay: rgba(20, 18, 14, 0.85);

    /* Brand: Metallic Hierarchy */
    --primary: #c9a84c;
    --primary-bright: #d4af37;
    --primary-muted: #a68932;
    --champagne-gold: #c9b06b;
    --gunmetal: #3a3a3a;

    /* Accent */
    --accent-burgundy: #6b1c2a;
    --accent-burgundy-glow: #8b2540;
    --burgundy-dark: #3d1119;

    /* Rarity Tiers */
    --rarity-bronze: #8b4513;
    --rarity-silver: #a8a9ad;
    --rarity-gold: #d4a017;
    --rarity-elite: #e8dcc8;
    --rarity-legendary: #ffd700;

    /* Text */
    --text-primary: #f5f0e1;
    --text-muted: #bfb89a;
    --accent-gold: #c9a84c;
    --gold: #d4af37;

    /* Spacing */
    --card-width: 250px;
    --card-height: 350px;
    --spacing-lg: 40px;
    --spacing-md: 20px;
    --spacing-sm: 10px;

    /* Shadows */
    --shadow-premium: 0 4px 20px rgba(30, 20, 0, 0.5);
    --shadow-card: 0 2px 16px rgba(0,0,0,0.4), 0 0 40px rgba(201,168,76,0.06);
    --shadow-gold-glow: 0 0 20px rgba(201,168,76,0.15);
    --shadow-burgundy-glow: 0 0 20px rgba(107,28,42,0.3);

    /* Gradients */
    --gradient-bronze-gold: linear-gradient(135deg, #8b4513 0%, #c9a84c 50%, #8b4513 100%);
    --gradient-fusion-ring: linear-gradient(135deg, #7a5c2e 0%, #c9a84c 40%, #b8973a 70%, #7a5c2e 100%);
    --gradient-burgundy: linear-gradient(135deg, #3d1119 0%, #5c1a2a 50%, #3d1119 100%);
    --gradient-gold-shimmer: linear-gradient(90deg, #b8973a 0%, #d4af37 50%, #b8973a 100%);
    --gradient-vignette: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.6) 100%);
}

/* ===== Reset ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

/* ===== Body ===== */
body {
    font-family: 'Inter', sans-serif;
    background: #0e0e0c;
    color: var(--text-primary);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Fullscreen video background */
.video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    pointer-events: none;
}

/* Subtle noise texture for matte/leather feel */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* ===== Footer ===== */
.grid-services-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 9999;
    padding: 6px 0;
    font-size: 11px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Inter', sans-serif;
    border-top: 1px solid rgba(201, 168, 76, 0.15);
    background: rgba(14, 14, 12, 0.92);
    backdrop-filter: blur(8px);
}

.grid-services-footer__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
    padding-right: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.grid-services-footer__sep { opacity: 0.5; }

.grid-services-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}
.grid-services-footer a:hover {
    color: var(--primary);
}

/* ===== Fusion Combinations Bar ===== */
.sidebar-left {
    margin-top: 0;
    background: rgba(26, 26, 26, 0.6);
    border-radius: 0 0 12px 12px;
    padding: 10px 15px;
    border-top: 1px solid rgba(201, 168, 76, 0.2);
    backdrop-filter: blur(6px);
}

.fusion-combos-header {
    margin-bottom: 8px;
    text-align: center;
}

.fusion-combos-header h3 {
    color: var(--primary);
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.fusion-combos-list {
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.combo-item {
    background: rgba(26, 26, 26, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(201, 168, 76, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.combo-item:hover {
    border-color: rgba(201, 168, 76, 0.4);
    background: rgba(201, 168, 76, 0.08);
}

.combo-item .combo-from { display: flex; align-items: center; gap: 6px; }
.combo-item .combo-arrow { color: var(--primary); font-size: 14px; }
.combo-item .combo-to { display: flex; align-items: center; gap: 6px; }
.combo-count { font-weight: 700; font-size: 14px; min-width: 22px; }
.combo-rarity { font-size: 11px; font-weight: 600; text-transform: uppercase; }

.combo-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.6;
}

/* ===== Right Sidebar ===== */
.sidebar-right {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border-radius: 0;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
}

/* ---- Premium 3D icon button ---- */
.sidebar-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;

    /* Outer gold frame */
    background:
        linear-gradient(160deg, #b8942a 0%, #6a5010 50%, #b8942a 100%);
    border-radius: 14px;
    padding: 2px;

    /* Depth shadow */
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.7),
        0 1px 3px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 220, 100, 0.25);
    color: #d4b462;
}

/* Inner dark face */
.sidebar-icon::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 11px;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(80, 70, 50, 0.5) 0%, transparent 60%),
        linear-gradient(170deg, #302a1e 0%, #1a1710 50%, #12100c 100%);
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.7),
        inset 0 -1px 3px rgba(201, 168, 76, 0.06);
    pointer-events: none;
    z-index: 0;
}

/* Second inner gold ring (subtle inset border) */
.sidebar-icon::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 10px;
    border: 1px solid rgba(201, 168, 76, 0.18);
    pointer-events: none;
    z-index: 0;
}

.sidebar-icon svg {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6))
            drop-shadow(0 0 6px rgba(201, 168, 76, 0.15));
}

.sidebar-icon span {
    position: relative;
    z-index: 1;
}

/* Hover: lift + glow */
.sidebar-icon:hover {
    transform: translateY(-2px) scale(1.06);
    color: #e8c44a;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(201, 168, 76, 0.18),
        inset 0 1px 0 rgba(255, 220, 100, 0.35);
}

.sidebar-icon:hover::before {
    background:
        radial-gradient(ellipse at 50% 15%, rgba(201, 168, 76, 0.12) 0%, transparent 50%),
        linear-gradient(170deg, #3a3224 0%, #1e1a14 50%, #14120e 100%);
}

.sidebar-icon:active {
    transform: translateY(0) scale(1.0);
}

.sidebar-icon:active {
    transform: scale(1.02);
}

/* ===== Main Container ===== */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 20px 20px;
    padding-right: 100px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.wallet-status {
    background: var(--bg-surface);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(201, 168, 76, 0.25);
    transition: all 0.3s ease;
}

.wallet-status #walletAddress {
    color: var(--text-muted);
    font-size: 14px;
    font-family: 'Inter', monospace;
}

.wallet-status.connected {
    border-color: var(--primary);
}

.wallet-status.connected #walletAddress {
    color: var(--primary);
}

.title {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 52px;
    font-weight: 700;
    color: var(--primary-bright);
    text-shadow: 0 2px 12px rgba(201, 168, 76, 0.25);
    letter-spacing: 1px;
    white-space: nowrap;
    text-transform: none;
}

/* ===== Generate Button — Gold Border on Dark ===== */
.generate-btn {
    padding: 10px 24px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-surface);
    color: var(--primary-bright);
    border: 1px solid var(--primary-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.generate-btn:hover {
    background: rgba(201, 168, 76, 0.1);
    box-shadow: var(--shadow-gold-glow);
    transform: translateY(-2px);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    background: var(--gunmetal);
    border-color: #555;
    color: #777;
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

.generate-btn.ready-pulse {
    animation: upgradeReadyPulse 2s ease-in-out infinite;
}

/* ===== Fusion Area ===== */
.fusion-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--spacing-lg);
    margin-top: 40px;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: transparent;
    border-radius: 0;
    border: none;
}

/* ===== Card Slots ===== */
.card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.card-frame {
    width: var(--card-width);
    height: var(--card-height);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-frame.dashed {
    border: 2px dashed rgba(201, 168, 76, 0.3);
    border-radius: 12px;
    background: rgba(42, 39, 35, 0.3);
    backdrop-filter: blur(6px);
    transition: border-color 0.3s ease;
}

.card-frame.dashed:hover {
    border-color: rgba(201, 168, 76, 0.5);
}

/* ===== Filled Card State — Rarity-tinted shimmer border ===== */
.card-frame.card-filled {
    border: 2px solid var(--primary);
    border-radius: 12px;
    animation: filledCardGlow 3s ease-in-out infinite;
}
.card-frame.card-filled.rarity-bronze { border-color: var(--rarity-bronze); animation: filledCardGlow 3s ease-in-out infinite; --glow-color: var(--rarity-bronze); }
.card-frame.card-filled.rarity-silver { border-color: var(--rarity-silver); animation: filledCardGlow 3s ease-in-out infinite; --glow-color: var(--rarity-silver); }
.card-frame.card-filled.rarity-gold   { border-color: var(--rarity-gold);   animation: filledCardGlow 3s ease-in-out infinite; --glow-color: var(--rarity-gold); }
.card-frame.card-filled.rarity-elite  { border-color: var(--rarity-elite);  animation: filledCardGlow 3s ease-in-out infinite; --glow-color: var(--rarity-elite); }
.card-frame.card-filled.rarity-legendary { border-color: var(--rarity-legendary); animation: filledCardGlow 3s ease-in-out infinite; --glow-color: var(--rarity-legendary); }

/* ===== Card Entrance Animation ===== */
.card-entrance {
    animation: cardDealIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    padding: 20px;
    letter-spacing: 1px;
}

.card-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.card-slot-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ===== Select / Remove Card Buttons — Gold Border on Dark ===== */
.select-card-btn, .remove-card-btn {
    padding: 10px 24px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-surface);
    color: var(--primary);
    border: 1px solid var(--primary-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.select-card-btn:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: var(--primary);
    box-shadow: var(--shadow-gold-glow);
}

.remove-card-btn {
    border-color: var(--accent-burgundy);
    color: #d4626e;
}

.remove-card-btn:hover {
    background: rgba(107, 28, 42, 0.15);
    border-color: var(--accent-burgundy-glow);
    color: #e88;
    box-shadow: var(--shadow-burgundy-glow);
}

/* ===== Operators — Soft Gold ===== */
.operator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 100px;
}

.operator-symbol {
    font-family: 'Cinzel', serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--champagne-gold);
    text-shadow: 0 0 12px rgba(201, 168, 76, 0.15);
}

/* ===== Rarity Bar — Badge Buttons ===== */
.rarity-bar {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding: 18px 15px;
    background: rgba(18, 16, 14, 0.7);
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
    border: 1px solid rgba(201, 168, 76, 0.08);
    border-bottom: none;
    backdrop-filter: blur(6px);
}

.rarity-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 130px;
    padding: 12px 24px;
    font-family: 'Cinzel', serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}

/* Shared inner bevel / inset border look */
.rarity-badge::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.rarity-badge:hover {
    transform: translateY(-2px);
}

/* ---- Bronze ---- */
.rarity-badge.bronze {
    background: linear-gradient(180deg, #5c3018 0%, #3a1c0e 40%, #2a1208 100%);
    box-shadow: inset 0 1px 0 rgba(180, 120, 60, 0.25),
                0 2px 8px rgba(0, 0, 0, 0.6);
    color: #c4865a;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.rarity-badge.bronze::before {
    border-color: rgba(180, 120, 60, 0.15);
}

/* ---- Silver ---- */
.rarity-badge.silver {
    background: linear-gradient(180deg, #6a6a6e 0%, #4a4a4e 40%, #353538 100%);
    box-shadow: inset 0 1px 0 rgba(200, 200, 210, 0.2),
                0 2px 8px rgba(0, 0, 0, 0.6);
    color: #b8b8c0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.rarity-badge.silver::before {
    border-color: rgba(200, 200, 210, 0.1);
}

/* ---- Gold ---- */
.rarity-badge.gold {
    background: linear-gradient(180deg, #a07820 0%, #7a5c18 40%, #5a4210 100%);
    box-shadow: inset 0 1px 0 rgba(220, 190, 80, 0.3),
                0 2px 8px rgba(0, 0, 0, 0.6);
    color: #e8c44a;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.rarity-badge.gold::before {
    border-color: rgba(220, 190, 80, 0.15);
}

/* ---- Elite ---- */
.rarity-badge.elite {
    background: linear-gradient(180deg, #8a8070 0%, #6a6258 40%, #4a443e 100%);
    box-shadow: inset 0 1px 0 rgba(220, 210, 195, 0.2),
                0 2px 8px rgba(0, 0, 0, 0.6);
    color: #d8cdb8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.rarity-badge.elite::before {
    border-color: rgba(220, 210, 195, 0.1);
}

/* ---- Legendary ---- */
.rarity-badge.legendary {
    background: linear-gradient(180deg, #b8942a 0%, #8a6e1a 40%, #6a5412 100%);
    box-shadow: inset 0 1px 0 rgba(255, 220, 80, 0.35),
                0 2px 10px rgba(0, 0, 0, 0.6),
                0 0 16px rgba(255, 215, 0, 0.08);
    color: #ffd740;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5),
                 0 0 10px rgba(255, 215, 0, 0.15);
    animation: legendaryBadgePulse 3s ease-in-out infinite;
}
.rarity-badge.legendary::before {
    border-color: rgba(255, 220, 80, 0.15);
}

.rarity-badge-icon {
    font-size: 13px;
    line-height: 1;
}

.rarity-badge-name {
    position: relative;
    z-index: 1;
}

/* Count badge — appears when wallet connected */
.rarity-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.45);
    color: inherit;
    margin-left: 4px;
    line-height: 1;
}

/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000; /* Above all navigation and footer */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 8, 0.92);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(160deg, #1e1c18 0%, #141310 100%);
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(201, 168, 76, 0.05);
    animation: slideIn 0.3s ease;
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
    position: relative;
}

.modal-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--primary-bright);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
}

.modal-header .close-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 32px;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
}

.modal-close:hover { color: var(--primary); }

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 32px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover { color: var(--primary); }

.modal-body {
    padding: 30px;
}

/* ===== Card Grid in Modal ===== */
#cardGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    align-items: start;
}

.rarity-section-header {
    grid-column: 1 / -1;
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    padding: 15px 0 10px 0;
    margin-top: 10px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
    letter-spacing: 1px;
}

.rarity-section-header:first-child {
    margin-top: 0;
}

.card-item {
    cursor: pointer;
    border: 1px solid rgba(201, 168, 76, 0.1);
    border-radius: 8px;
    padding: 8px;
    background: rgba(42, 39, 35, 0.5);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 5/7;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.card-item-name {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.card-item:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    background: rgba(201, 168, 76, 0.06);
}

/* ===== Payment Modal ===== */
.payment-message {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.payment-info {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 30px;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Primary button — Gold border style */
.modal-btn.primary {
    background: var(--bg-surface);
    color: var(--primary-bright);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-gold-glow);
}

.modal-btn.primary:hover {
    background: rgba(201, 168, 76, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.25);
}

/* Secondary button — Dark charcoal */
.modal-btn.secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.modal-btn.secondary:hover {
    background: rgba(201, 168, 76, 0.08);
    border-color: rgba(201, 168, 76, 0.35);
}

/* ===== Motif Pick Modal ===== */
.motif-pick-content {
    max-width: 520px;
}

.motif-pick-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    margin-bottom: 24px;
}

.motif-pick-subtitle span {
    color: var(--primary-bright);
    font-weight: 700;
    text-transform: uppercase;
}

.motif-pick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.motif-pick-card {
    cursor: pointer;
    border: 2px solid rgba(201, 168, 76, 0.15);
    border-radius: 12px;
    padding: 12px;
    background: rgba(42, 39, 35, 0.5);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.motif-pick-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.2);
    background: rgba(201, 168, 76, 0.06);
}

.motif-pick-card img {
    width: 100%;
    aspect-ratio: 5 / 7;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.motif-pick-name {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.motif-pick-motif {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--primary);
    margin: 0;
    font-style: italic;
}

/* ===== Welcome Modal ===== */
.welcome-modal-content {
    max-width: 820px;
    max-height: none;
    overflow: visible;
}

/* Landscape mobile: constrain height and enable scrolling */
@media (orientation: landscape) and (max-height: 600px) {
    .welcome-modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    .welcome-modal-body {
        overflow-y: auto;
    }
    .welcome-columns {
        grid-template-columns: 1fr 1fr;
    }
}

.welcome-modal-content .modal-header {
    padding: 14px 28px;
    justify-content: center;
}

.welcome-modal-content .modal-header h2 {
    font-size: 20px;
}

.welcome-modal-body {
    padding: 14px 28px 18px;
    overflow: visible;
}

.welcome-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 28px;
    margin-bottom: 14px;
}

.welcome-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.welcome-section {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(201, 168, 76, 0.08);
    border-radius: 8px;
}

.welcome-section h3 {
    font-family: 'Cinzel', serif;
    color: var(--primary-bright);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0 0 5px;
}

.welcome-section p,
.welcome-section li {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 2px;
}

.welcome-section ul {
    list-style: none;
    padding: 0;
    margin: 0 0 4px;
}

.welcome-section li {
    padding-left: 14px;
    position: relative;
    margin-bottom: 4px;
}

.welcome-section li::before {
    content: '\2726';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-size: 9px;
}

.welcome-italic {
    font-style: italic;
    color: var(--text-muted) !important;
    margin-top: 4px !important;
    font-size: 11px !important;
}

.welcome-coming-soon {
    border: 1px dashed rgba(201, 168, 76, 0.2);
    background: rgba(201, 168, 76, 0.03);
}

.welcome-coming-soon h3 {
    color: var(--primary) !important;
}

.welcome-coming-soon strong {
    color: var(--primary-bright);
}

.rarity-tag {
    display: inline-block;
    padding: 0px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.rarity-tag.bronze { background: rgba(205, 127, 50, 0.2); color: #cd7f32; border: 1px solid rgba(205, 127, 50, 0.4); }
.rarity-tag.silver { background: rgba(192, 192, 192, 0.15); color: #c0c0c0; border: 1px solid rgba(192, 192, 192, 0.3); }
.rarity-tag.gold { background: rgba(212, 175, 55, 0.15); color: #d4af37; border: 1px solid rgba(212, 175, 55, 0.3); }
.rarity-tag.elite { background: rgba(100, 149, 237, 0.15); color: #6495ed; border: 1px solid rgba(100, 149, 237, 0.3); }
.rarity-tag.legendary { background: rgba(168, 85, 247, 0.15); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }

.upgrade-path-list {
    margin: 6px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.upgrade-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 5px;
    border: 1px solid rgba(201, 168, 76, 0.06);
}

.upgrade-row .arrow {
    color: var(--primary);
    font-size: 13px;
    flex-shrink: 0;
}

.welcome-warning {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 16px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 8px;
    margin-bottom: 10px;
}

.welcome-warning svg {
    flex-shrink: 0;
    color: #ef4444;
}

.welcome-warning strong {
    display: block;
    color: #ef4444;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.welcome-warning p {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    letter-spacing: 0.3px;
}

.welcome-questions {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.welcome-ok-btn {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

/* Welcome modal mobile fallback */
@media (max-width: 700px) {
    .welcome-modal-content {
        max-width: 95vw;
    }
    .welcome-columns {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .welcome-modal-body {
        padding: 18px 20px 22px;
        max-height: 80vh;
        overflow-y: auto;
    }

    /* Motif pick modal mobile */
    .motif-pick-content {
        max-width: 95vw;
    }
    .motif-pick-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .motif-pick-card {
        padding: 10px;
    }
    .motif-pick-card img {
        max-width: 200px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Upgrade progress overlay mobile */
    .upgrade-progress-box {
        min-width: unset;
        max-width: 90vw;
        width: 90vw;
        padding: 24px 20px;
    }
    .upgrade-progress-title {
        font-size: 16px;
        letter-spacing: 2px;
        margin: 0 0 20px;
    }
    .upgrade-steps {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 16px;
    }
    .upgrade-step {
        gap: 3px;
    }
    .upgrade-step-num {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .upgrade-step-label {
        font-size: 9px;
        letter-spacing: 0.5px;
    }
    .upgrade-step-line {
        width: 16px;
        margin: 0 2px;
        margin-bottom: 15px;
    }
    .upgrade-progress-msg {
        font-size: 12px;
    }

    /* Modal mobile improvements */
    .modal-content {
        width: 95vw;
        max-height: 85vh;
    }
    .modal-header {
        padding: 16px 20px;
    }
    .modal-header h2 {
        font-size: 20px;
    }
    .modal-close {
        right: 16px;
        top: 16px;
        font-size: 28px;
        width: 32px;
        height: 32px;
    }
    .modal-body {
        padding: 18px 20px;
    }
    .modal-actions {
        padding: 16px 20px;
        flex-direction: column;
        gap: 10px;
    }
    .modal-btn {
        width: 100%;
        padding: 12px 24px;
    }

    /* Touch target improvements */
    .sidebar-icon {
        min-width: 48px;
        min-height: 48px;
    }
    .card-slot {
        min-height: 220px; /* Reduced for smaller mobile cards */
    }
}

/* ===== Card Preview Tooltip ===== */
.card-preview-tooltip {
    position: fixed;
    display: none;
    pointer-events: none;
    z-index: 9999;
    background: linear-gradient(160deg, #1e1c18 0%, #141310 100%);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), var(--shadow-gold-glow);
    animation: fadeIn 0.2s ease;
}

.card-preview-tooltip.active {
    display: block;
}

.card-preview-tooltip img {
    width: 200px;
    height: 280px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@keyframes shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes legendaryGlow {
    0%, 100% { text-shadow: 0 0 8px rgba(255, 215, 0, 0.2); }
    50%      { text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.15); }
}

@keyframes legendaryBadgePulse {
    0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 220, 80, 0.35), 0 2px 10px rgba(0,0,0,0.6), 0 0 16px rgba(255,215,0,0.08); }
    50%      { box-shadow: inset 0 1px 0 rgba(255, 220, 80, 0.35), 0 2px 10px rgba(0,0,0,0.6), 0 0 28px rgba(255,215,0,0.15); }
}

@keyframes goldPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(201, 168, 76, 0.1); }
    50%      { box-shadow: 0 0 20px rgba(201, 168, 76, 0.25); }
}

@keyframes cardDealIn {
    0%   { opacity: 0; transform: scale(0.7) rotateY(20deg) translateY(30px); }
    60%  { opacity: 1; transform: scale(1.03) rotateY(-3deg) translateY(-5px); }
    100% { opacity: 1; transform: scale(1) rotateY(0) translateY(0); }
}

@keyframes filledCardGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(201, 168, 76, 0.15), inset 0 0 4px rgba(201, 168, 76, 0.05); }
    50%      { box-shadow: 0 0 22px var(--glow-color, rgba(201, 168, 76, 0.35)), inset 0 0 8px rgba(201, 168, 76, 0.1); }
}

@keyframes upgradeReadyPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(201, 168, 76, 0.15); border-color: var(--primary-muted); }
    50%      { box-shadow: 0 0 24px rgba(212, 175, 55, 0.45), 0 0 48px rgba(201, 168, 76, 0.15); border-color: var(--primary-bright); }
}

@keyframes resultRevealBurst {
    0%   { opacity: 0; transform: scale(0.5) rotateY(40deg); filter: brightness(2.5); }
    40%  { opacity: 1; transform: scale(1.08) rotateY(-5deg); filter: brightness(1.6); }
    70%  { transform: scale(0.97) rotateY(2deg); filter: brightness(1.1); }
    100% { transform: scale(1) rotateY(0); filter: brightness(1); }
}

.result-reveal {
    animation: resultRevealBurst 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.result-flash {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(212,175,55,0.6) 0%, rgba(212,175,55,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: flashFade 0.6s ease-out forwards;
    z-index: 10;
}

@keyframes flashFade {
    0%   { opacity: 1; transform: scale(0.5); }
    100% { opacity: 0; transform: scale(2); }
}

/* ===== Upgrade Result Modal ===== */
.upgrade-result-modal {
    z-index: 20000; /* Above progress overlay (10000) and all other modals */
}

.upgrade-result-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(175deg, #1a1710 0%, #0d0b08 100%);
    border: 1px solid rgba(201, 168, 76, 0.25);
    border-radius: 20px;
    padding: 36px 32px 32px;
    max-width: 380px;
    width: 92%;
    overflow: hidden;
    animation: upgradeResultEntry 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Rarity glow line across the top */
.upgrade-result-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--result-rarity-color, #c9a227) 40%, var(--result-rarity-color, #c9a227) 60%, transparent);
    opacity: 0.9;
}

/* Subtle background shimmer */
.upgrade-result-content::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, var(--result-rarity-color-alpha, rgba(201,168,76,0.08)) 0%, transparent 70%);
    pointer-events: none;
}

.upgrade-result-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.upgrade-result-checkmark {
    font-size: 2.2rem;
    color: var(--result-rarity-color, #c9a227);
    line-height: 1;
    animation: upgradeCheckPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    filter: drop-shadow(0 0 8px var(--result-rarity-color, #c9a227));
}

.upgrade-result-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f0e8d0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
    background: linear-gradient(90deg, #c9a227, #f0d060, #c9a227);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: upgradeShimmerText 3s linear infinite;
}

.upgrade-result-rarity-badge {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #0d0b08;
    background: var(--result-rarity-color, #c9a227);
}

.upgrade-result-card-frame {
    width: 190px;
    height: 266px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow:
        0 0 0 2px var(--result-rarity-color, #c9a227),
        0 0 30px var(--result-rarity-color-alpha, rgba(201,168,76,0.35)),
        0 8px 32px rgba(0,0,0,0.6);
    animation: upgradeCardGlow 2.5s ease-in-out infinite;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.upgrade-result-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.upgrade-result-name {
    font-size: 1rem;
    font-weight: 600;
    color: #e8d5a3;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.upgrade-result-tx {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: 8px;
    padding: 8px 12px;
    position: relative;
    z-index: 1;
}

.upgrade-result-tx-label {
    font-size: 0.7rem;
    color: #6b6352;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.upgrade-result-tx-hash {
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
    color: var(--result-rarity-color, #c9a227);
    text-decoration: none;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upgrade-result-tx-hash:hover { text-decoration: underline; }

.upgrade-result-tx-copy {
    background: transparent;
    border: none;
    color: #6b6352;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    flex-shrink: 0;
}
.upgrade-result-tx-copy:hover { color: var(--result-rarity-color, #c9a227); }

.upgrade-result-actions {
    width: 100%;
    position: relative;
    z-index: 1;
}

.upgrade-result-done-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #c9a227 0%, #e8c040 50%, #c9a227 100%);
    background-size: 200% auto;
    color: #0d0b08;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-position 0.4s, transform 0.15s;
}
.upgrade-result-done-btn:hover {
    background-position: right center;
    transform: translateY(-1px);
}
.upgrade-result-done-btn:active { transform: translateY(0); }

/* Keyframes */
@keyframes upgradeResultEntry {
    0%   { opacity: 0; transform: scale(0.8) translateY(24px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes upgradeCheckPop {
    0%   { opacity: 0; transform: scale(0.3) rotate(-20deg); }
    60%  { transform: scale(1.3) rotate(5deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes upgradeShimmerText {
    0%   { background-position: 0% center; }
    100% { background-position: 200% center; }
}

@keyframes upgradeCardGlow {
    0%, 100% { box-shadow: 0 0 0 2px var(--result-rarity-color, #c9a227), 0 0 20px var(--result-rarity-color-alpha, rgba(201,168,76,0.3)), 0 8px 32px rgba(0,0,0,0.6); }
    50%       { box-shadow: 0 0 0 2px var(--result-rarity-color, #c9a227), 0 0 45px var(--result-rarity-color-alpha, rgba(201,168,76,0.55)), 0 8px 32px rgba(0,0,0,0.6); }
}

/* Mobile */
@media (max-width: 500px) {
    .upgrade-result-content { padding: 28px 20px 24px; }
    .upgrade-result-card-frame { width: 155px; height: 218px; }
    .upgrade-result-title { font-size: 1.15rem; }
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .fusion-area { gap: var(--spacing-md); }

    :root {
        --card-width: 160px;
        --card-height: 220px;
    }

    .operator-symbol { font-size: 36px; }
}

@media (max-width: 768px) {
    /* Container adjustments - add bottom clearance for footer + nav */
    .container { 
        padding-right: 20px;
        padding-bottom: 120px; /* Clearance for bottom nav (60px) + footer (30px) + margin */
    }

    /* Mobile background image instead of video */
    .video-bg {
        display: none;
    }
    body {
        background: #0e0e0c url('assets/mobile-bg.png') center center / cover no-repeat fixed;
    }

    /* Bottom Navigation Bar - lift above footer */
    .sidebar-right {
        right: 0;
        top: auto;
        bottom: 32px; /* Lift above footer */
        transform: none;
        flex-direction: row;
        width: 100%;
        justify-content: center;
        padding: 8px 20px;
        gap: 16px;
        background: rgba(14, 12, 10, 0.96);
        border-top: 1px solid rgba(201, 168, 76, 0.2);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
        z-index: 1001; /* Above footer (1000) */
    }

    .sidebar-icon {
        width: 48px;
        height: 48px;
    }

    /* Header - more compact */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .header > div:first-child {
        align-self: center;
    }

    .header > div:first-child img {
        height: 40px !important; /* Smaller logo on mobile */
    }

    .title { 
        font-size: 22px !important;
        white-space: normal;
        text-align: center;
    }

    /* Wallet status - make visible on mobile */
    .header-right {
        width: 100%;
        justify-content: center;
    }

    .wallet-status {
        padding: 8px 16px;
        font-size: 12px;
    }

    .wallet-status #walletAddress {
        font-size: 11px;
    }

    /* Fusion Area - vertical layout */
    .fusion-area {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin-top: 16px;
        margin-bottom: 16px;
        padding: 12px 6px;
    }

    /* Smaller cards on mobile */
    :root {
        --card-width: 140px;
        --card-height: 190px;
    }

    .card-slot {
        align-items: center;
        gap: 8px;
    }

    .operator {
        margin-top: 0;
        transform: none;
    }

    .operator-symbol {
        font-size: 24px;
    }

    /* Rarity Bar - better mobile layout */
    .rarity-bar { 
        gap: 10px;
        padding: 12px 10px;
        flex-wrap: wrap;
    }

    .rarity-badge {
        min-width: 100px;
        padding: 10px 16px;
        font-size: 12px;
        letter-spacing: 1px;
    }

    .rarity-badge-icon {
        font-size: 11px;
    }

    .rarity-badge-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
        padding: 0 4px;
    }

    /* Fusion Combinations - make visible on mobile */
    .sidebar-left {
        margin-top: 0;
        padding: 12px;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .fusion-combos-header h3 {
        font-size: 11px;
        letter-spacing: 1.5px;
    }

    .fusion-combos-list {
        gap: 8px;
    }

    .combo-item {
        padding: 6px 10px;
        font-size: 11px;
    }

    .combo-count {
        font-size: 12px;
        min-width: 20px;
    }

    .combo-rarity {
        font-size: 10px;
    }

    /* Card slot buttons - full width on mobile */
    .card-slot-buttons {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .select-card-btn, .remove-card-btn, .generate-btn {
        width: 100%;
        padding: 10px 20px;
        font-size: 11px;
        letter-spacing: 1.2px;
    }

    /* Card placeholder text - smaller on mobile */
    .card-placeholder {
        font-size: 13px;
        padding: 15px;
    }

    /* Footer adjustments */
    .grid-services-footer {
        z-index: 1000; /* Below bottom nav */
    }

    .grid-services-footer__inner { 
        padding-right: 20px;
        padding-left: 20px;
        font-size: 10px;
        letter-spacing: 0.5px;
    }
}

/* ===== How To Modal ===== */
.how-to-modal-content {
    max-width: 560px;
    background: #0e0c09;
    border: 1px solid rgba(201, 168, 76, 0.35);
}

.how-to-modal-body {
    padding: 32px 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* The card that gets captured as image */
.how-to-card {
    width: 100%;
    background: linear-gradient(160deg, #1e180e 0%, #130f08 60%, #1a1510 100%);
    border: 1px solid rgba(201, 168, 76, 0.5);
    border-radius: 12px;
    padding: 28px 24px 20px;
    color: var(--text-primary, #e8d5a3);
}

.how-to-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.how-to-suit {
    font-size: 20px;
    color: var(--gold, #c9a84c);
    opacity: 0.7;
}

.how-to-title {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    color: var(--gold, #c9a84c);
    letter-spacing: 2px;
    margin: 0;
    text-align: center;
}

.how-to-subtitle {
    text-align: center;
    font-size: 12px;
    color: rgba(232, 213, 163, 0.55);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0 0 20px;
}

/* Steps */
.how-to-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.how-to-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.how-to-step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gold, #c9a84c);
    color: #1a1510;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    margin-top: 1px;
}

.how-to-step-body {
    flex: 1;
}

.how-to-step-body strong {
    display: block;
    color: var(--gold, #c9a84c);
    font-size: 13px;
    margin-bottom: 2px;
}

.how-to-step-body p {
    margin: 0;
    font-size: 12px;
    color: rgba(232, 213, 163, 0.75);
    line-height: 1.65;
}

/* Divider */
.how-to-divider {
    height: 1px;
    background: rgba(201, 168, 76, 0.2);
    margin: 4px 0 16px;
}

/* Upgrade paths */
.how-to-section-title {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: var(--gold, #c9a84c);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0 0 12px;
    text-align: center;
}

.how-to-path-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.how-to-path {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(201, 168, 76, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.12);
    border-radius: 6px;
    padding: 7px 12px;
}

.how-to-rarity {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    min-width: 72px;
}

.how-to-rarity.bronze  { color: #cd7f32; }
.how-to-rarity.silver  { color: #b8bcc8; }
.how-to-rarity.gold    { color: #c9a84c; }
.how-to-rarity.elite   { color: #e5e0d5; }
.how-to-rarity.legendary { color: #a855f7; }

.how-to-arrow {
    color: rgba(201, 168, 76, 0.4);
    font-size: 14px;
    flex-shrink: 0;
}

.how-to-cost {
    margin-left: auto;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: var(--gold, #c9a84c);
    white-space: nowrap;
}

.how-to-footer-note {
    margin-top: 16px;
    text-align: center;
    font-size: 10px;
    color: rgba(201, 168, 76, 0.3);
    letter-spacing: 1px;
}

/* Save button — outside the captured card */
.how-to-save-btn {
    background: transparent;
    border: 1px solid rgba(201, 168, 76, 0.4);
    color: rgba(201, 168, 76, 0.7);
    border-radius: 6px;
    padding: 9px 22px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: border-color 0.2s, color 0.2s;
}

.how-to-save-btn:hover {
    border-color: var(--gold, #c9a84c);
    color: var(--gold, #c9a84c);
}

.how-to-save-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .how-to-modal-body { padding: 20px 16px 20px; }
    .how-to-card       { padding: 22px 16px 16px; }
    .how-to-title      { font-size: 15px; }
    .how-to-path       { flex-wrap: wrap; }
    .how-to-cost       { margin-left: 0; }
}

/* ===== Resume Upgrade Banner ===== */
#resumeUpgradeBanner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(90deg, #1a1200, #2a1e00);
    border-bottom: 2px solid #c9a227;
    font-family: inherit;
    flex-wrap: wrap;
}
.resume-banner-text { color: #e8d5a3; font-size: 0.95rem; flex: 1; min-width: 160px; }
.resume-banner-text strong { color: #c9a227; }
.resume-banner-btn {
    background: #c9a227;
    color: #1a1200;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.resume-banner-btn:hover { background: #e8c040; }
.resume-banner-close {
    background: transparent;
    border: 1px solid #555;
    color: #888;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s;
}
.resume-banner-close:hover { color: #fff; border-color: #888; }

/* ===== Upgrade Progress Overlay ===== */
.upgrade-progress-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
}

.upgrade-progress-overlay.active {
    display: flex;
}

.upgrade-progress-box {
    background: var(--charcoal, #1a1a1a);
    border: 1px solid var(--gold, #c9a84c);
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    min-width: 340px;
    max-width: 440px;
}

.upgrade-progress-title {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    color: var(--gold, #c9a84c);
    letter-spacing: 3px;
    margin: 0 0 24px;
}

.upgrade-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
}

.upgrade-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.35;
    transition: opacity 0.3s;
    min-width: 0;
}

.upgrade-step.active {
    opacity: 1;
}

.upgrade-step.done {
    opacity: 0.8;
}

.upgrade-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--gold, #c9a84c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--gold, #c9a84c);
    flex-shrink: 0;
}

.upgrade-step.active .upgrade-step-num {
    background: var(--gold, #c9a84c);
    color: var(--charcoal, #1a1a1a);
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.5);
    animation: upgrade-pulse 1.4s ease-in-out infinite;
}

.upgrade-step.done .upgrade-step-num {
    background: rgba(201, 168, 76, 0.25);
    color: var(--gold, #c9a84c);
    border-color: rgba(201, 168, 76, 0.6);
}

@keyframes upgrade-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(201, 168, 76, 0.4); }
    50%       { box-shadow: 0 0 14px rgba(201, 168, 76, 0.75); }
}

.upgrade-step-label {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: #888;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
    text-align: center;
}

.upgrade-step.active .upgrade-step-label {
    color: var(--gold, #c9a84c);
}

.upgrade-step.done .upgrade-step-label {
    color: rgba(201, 168, 76, 0.7);
}

.upgrade-step-line {
    width: 16px;
    height: 2px;
    background: rgba(201, 168, 76, 0.2);
    margin: 0 2px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.upgrade-progress-msg {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    margin: 20px 0 0;
    min-height: 24px;
    line-height: 1.5;
}

.upgrade-progress-msg .card-name {
    color: var(--gold, #c9a84c);
    font-weight: 700;
    font-size: 17px;
}

/* ===== Xaman Modal Mobile ===== */
@media (max-width: 768px) {
    #xamanModal .modal-content {
        width: 92vw;
        max-width: 360px;
        margin: auto;
    }
    /* QR is hidden on mobile — button is the CTA */
    #xamanModal #xamanQR {
        display: none !important;
    }
    #xamanModal .modal-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
    #xamanModal .modal-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 15px;
    }
    #xamanModal .modal-btn.primary {
        font-size: 16px;
        padding: 18px 20px;
    }
}

/* ===== Upgrade Progress Overlay — Mobile ===== */
@media (max-width: 520px) {
    .upgrade-progress-box {
        min-width: unset;
        width: 92vw;
        padding: 24px 16px;
    }
    .upgrade-steps {
        gap: 0;
        overflow-x: auto;
        padding-bottom: 4px;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .upgrade-steps::-webkit-scrollbar { display: none; }
    .upgrade-step {
        min-width: 48px;
    }
    .upgrade-step-num {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    .upgrade-step-label {
        font-size: 8px;
        max-width: 52px;
    }
    .upgrade-step-line {
        width: 12px;
    }
    .upgrade-progress-title {
        font-size: 15px;
    }
    .upgrade-progress-msg {
        font-size: 12px;
    }
}

/* ===== Landscape Orientation Popup ===== */
.orientation-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
}

.orientation-popup.active {
    display: flex;
}

.orientation-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.orientation-popup-icon {
    font-size: 48px;
    animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.orientation-popup-text {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    color: var(--primary-bright);
    letter-spacing: 2px;
}

.orientation-popup-sub {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--text-muted);
}

.orientation-popup-dismiss {
    margin-top: 12px;
    padding: 10px 28px;
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary-bright);
    font-family: 'Cinzel', serif;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}

.orientation-popup-dismiss:hover {
    background: rgba(201, 168, 76, 0.15);
}
