        :root {
            --genshin-blue: #1b1e2a;
            --genshin-gold: #ece5d8;
            --genshin-bright-gold: #ffcc33;
            --genshin-purple: #42366b;
            --primogem-purple: #a291f0;
            --stellar-white: #fcfaf2;
            --card-bg-common: #2c3148;
            --card-bg-rare: #42366b;
            --card-bg-legendary: #8e6c27;
        }

        /* Define color variables */
:root {
	--bg: #131313; /* Off-black */
	--color1: #f54b73; /* Pink */
	--color1-hover: #f33a65;
	--color1-transparent: #f54b73c8;
	--foreground: #131313; /* Dark greyish */
	--text-color: #e0e0e0; /* Light grey for text */
	--accent: #d14d7b; /* Pink */
	--error: #ff4444; /* Red for errors */
	--success: #44ff44; 
	--grey-border: #222222;
	--color2: #5c4bf5;
	--color2-dark: #4539c6;
	--header-height: 60px;
	--color1-faded: rgba(73, 36, 49, 0.737);
	--message-bg-color: 2a2a2a;
	--bot-message-color:  rgba(73, 36, 49, 0.829);
}

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
            min-height: 100vh;
            background: radial-gradient(circle at top center, #2c3148 0%, #161824 100%);
            color: var(--genshin-gold);
            font-family: 'Inter', sans-serif;
            overflow-x: hidden;
            display: block;
        }

        /* Starry Background */
        .stars-bg {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: url('https://www.transparenttextures.com/patterns/stardust.png');
            opacity: 0.3;
            pointer-events: none;
            z-index: 0;
        }

        .market-container {
            position: relative;
            z-index: 10;
            max-width: 1400px;
            margin: 0 auto;
            margin-top: 0;
            padding: 16px 20px 40px;
        }

        h1, h2 {
            font-family: 'Zhcn', sans-serif;
            text-transform: uppercase;
            letter-spacing: 2px;
            color: var(--genshin-gold);
            text-align: center;
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 50px;
            text-shadow: 0 0 20px rgba(255, 204, 51, 0.5);
        }

        h2 {
            font-size: 1.5rem;
            margin-top: 60px;
            margin-bottom: 20px;
            text-align: left;
            border-bottom: 2px solid rgba(236, 229, 216, 0.2);
            padding-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        h2 i {
            color: var(--genshin-bright-gold);
        }

        /* Market Sub Tabs */
        .market-sub-tabs {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin: 0 auto 20px auto;
            padding: 5px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            border: 1px solid rgba(236, 229, 216, 0.1);
            width: fit-content;
        }

        .market-sub-tab {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 24px;
            background: transparent;
            border: none;
            border-radius: 8px;
            color: rgba(236, 229, 216, 0.6);
            font-family: 'Zhcn', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .market-sub-tab:hover {
            color: var(--genshin-gold);
            background: rgba(255, 255, 255, 0.05);
        }

        .market-sub-tab.active {
            background: linear-gradient(135deg, rgba(255, 204, 51, 0.2), rgba(255, 204, 51, 0.1));
            color: var(--genshin-bright-gold);
            box-shadow: 0 0 15px rgba(255, 204, 51, 0.2);
            border: 1px solid rgba(255, 204, 51, 0.3);
        }

        .market-sub-tab i {
            font-size: 1.1rem;
        }

        @media (max-width: 768px) {
            .market-sub-tabs {
                width: fit-content;
                max-width: 100%;
                margin-left: auto;
                margin-right: auto;
                justify-content: center;
                flex-wrap: wrap;
            }
            
            .market-sub-tab {
                flex: 0 1 auto;
                justify-content: center;
                padding: 10px 12px;
                font-size: 0.8rem;
            }
        }

        @media (max-width: 600px) {
            .market-sub-tabs {
                gap: 5px;
                padding: 4px;
            }

            .market-sub-tab {
                flex-direction: column;
                gap: 4px;
                padding: 10px 4px;
                font-size: 0.65rem;
                flex: 1;
                min-width: 65px;
                text-align: center;
                line-height: 1;
                border-radius: 10px;
            }

            .market-sub-tab i {
                font-size: 1.3rem; /* Slightly larger icons for vertical layout */
                margin-bottom: 2px;
            }

            .market-sub-tab[data-subtab="karma"] {
                font-size: 0.65rem;
            }

            .shop-tabs-overlay {
                width: calc(100% - 30px) !important;
                bottom: 15px !important;
                padding: 6px !important;
            }
        }

        .market-row {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 20px;
            padding: 20px 5px;
        }

        .waifu-card {
            flex: 0 0 220px;
            height: 340px;
            background: var(--card-bg-common);
            border-radius: 12px;
            position: relative;
            overflow: hidden;
            border: 2px solid rgba(255,255,255,0.1);
            transition: transform 0.3s, box-shadow 0.3s;
            display: flex;
            flex-direction: column;
        }

        .waifu-card:hover {
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            z-index: 2;
        }

      /*   .waifu-card.rarity-common { border-color: #a0a0a0; } */
        .waifu-card.rarity-rare { border-color: var(--primogem-purple); box-shadow: 0 0 15px rgba(162, 145, 240, 0.3); }
        .waifu-card.rarity-legendary { border-color: var(--genshin-bright-gold); box-shadow: 0 0 15px rgba(255, 204, 51, 0.3); }
        .waifu-card.rarity-common { border-width: 0px; border-color: purple; box-shadow: 0 0 15px rgba(255, 51, 133, 0.3); }


        .card-image {
            width: 100%;
            height: 70%;
            object-fit: cover;
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .card-info {
            padding: 10px;
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            background: rgba(0,0,0,0.2);
        }

        .shop-banner-container {
            position: relative;
            max-width: 900px;
            margin: 0 auto 30px auto;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 15px 40px rgba(0,0,0,0.5);
            border: 1px solid rgba(236, 229, 216, 0.1);
        }

        #shopbannerimage {
            width: 100%;
            height: 480px;
            object-fit: cover;
            display: block;
            transition: transform 0.8s ease;
        }

        .shop-banner-container:hover #shopbannerimage {
            transform: scale(1.05);
        }

        .shop-banner-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 60%;
            background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
            pointer-events: none;
        }

        .shop-tabs-overlay {
            position: absolute !important;
            bottom: 25px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 5;
            margin-bottom: 0 !important;
            background: rgba(255, 255, 255, 0.08) !important;
            backdrop-filter: blur(12px) saturate(180%);
            -webkit-backdrop-filter: blur(12px) saturate(180%);
            border: 1px solid rgba(255, 255, 255, 0.15) !important;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
        }

        .shop-tabs-overlay .market-sub-tab {
            color: rgba(255, 255, 255, 0.8);
            text-shadow: 0 2px 4px rgba(0,0,0,0.5);
        }

        .shop-tabs-overlay .market-sub-tab.active {
            background: var(--genshin-bright-gold);
            color: #1b1e2a;
            text-shadow: none;
        }

        .waifu-card-name {
            font-weight: 700;
            font-size: 16px;
            color: #fff;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-family: 'Zhcn', sans-serif;
            margin-bottom: 15px;
        }

        .card-creator {
            font-size: 0.75rem;
            color: rgba(255,255,255,0.6);
            margin-top: 2px;
        }

        .card-stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: auto;
        }

        .stars {
            color: var(--genshin-bright-gold);
            font-size: 0.8rem;
            letter-spacing: -1px;
        }

        .karma-price {
            display: flex;
            align-items: center;
            gap: 4px;
            font-weight: bold;
            color: var(--genshin-gold);
            font-family: 'Zhcn', sans-serif;
            font-size: 0.9rem;
        }

   .action-btn {
	background-color: #a5a5a526;
	border: 1px solid #444;
	color: var(--text-color);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	padding: 5px 5px;
}


.buy-waifu-btn.btn-buy {
    font-family: Zhcn;
}

        .btn-buy {
            background: linear-gradient(90deg, #4CAF50, #8BC34A);
            color: #fff;
        }
        .btn-buy:hover { background: linear-gradient(90deg, #43A047, #7CB342); }

        .btn-sell {
            background: linear-gradient(90deg, #F44336, #E57373);
            color: #fff;
        }

        .btn-sell:hover { background: linear-gradient(90deg, #D32F2F, #EF5350); }

        .empty-message {
            color: rgba(255,255,255,0.4);
            font-style: italic;
            padding: 20px;
        }
        

        .karma-display-row {
            display: flex; 
            justify-content: flex-end; 
            margin-bottom: 20px;
        }

        #userKarmaDisplay {
            color: var(--genshin-bright-gold);
            font-family: 'Zhcn';
            font-size: 1.2rem;
        }

        /* Ranking Table Styles */
        .ranking-container {
            max-width: 1000px;
            margin: 0 auto;
            margin-top: 20px;
            padding: 20px;
            z-index: 10;
            position: relative;
        }

        /* Shop Specific Styles */
        .shop-container {
            padding-bottom: 80px;
        }

        .shop-container .quick-actions-grid {
            background: rgba(27, 30, 42, 0.4);
            backdrop-filter: blur(5px);
            padding: 25px;
            border-radius: 16px;
            border: 1px solid rgba(236, 229, 216, 0.05);
            margin-top: 15px;
            box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
        }

        .shop-container h2 {
            margin-top: 40px;
        }

        .shop-container .tier-divider {
            margin-top: 30px;
            margin-bottom: 15px;
        }

        .ranking-table {
            background: rgba(27, 30, 42, 0.8);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            border: 1px solid rgba(236, 229, 216, 0.1);
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0,0,0,0.5);
        }

        #leaderboard-karma-header {
            grid-column: 1 / -1;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .ranking-header {
            display: grid;
            grid-template-columns: 80px 1fr 150px;
            padding: 20px;
            background: rgba(0,0,0,0.3);
            font-family: 'Zhcn', sans-serif;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--genshin-bright-gold);
            border-bottom: 2px solid rgba(255, 204, 51, 0.2);
        }

        .ranking-row {
            display: grid;
            grid-template-columns: 80px 1fr 150px;
            padding: 15px 20px;
            align-items: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            transition: background 0.2s;
        }

        .ranking-row:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        .current-user-row {
            background: rgba(255, 204, 51, 0.15) !important;
            border-left: 3px solid var(--genshin-bright-gold);
        }

        .rank-number {
            font-family: 'Zhcn', sans-serif;
            font-weight: 700;
            font-size: 1.2rem;
            color: rgba(255,255,255,0.7);
        }

        .ranking-row:nth-child(2) .rank-number { color: #ffcc33; font-size: 1.5rem; text-shadow: 0 0 10px rgba(255, 204, 51, 0.5); } /* 1st */
        .ranking-row:nth-child(3) .rank-number { color: #e5e4e2; font-size: 1.3rem; } /* 2nd */
        .ranking-row:nth-child(4) .rank-number { color: #cd7f32; font-size: 1.2rem; } /* 3rd */

        .rank-user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .rank-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            border: 2px solid var(--genshin-gold);
            object-fit: cover;
        }

        .rank-username {
            font-weight: 600;
            font-size: 1.2rem;
            color: var(--stellar-white);
            text-shadow: 3px 3px 3px black;
        }

          .rank-level {
            margin-top: 9px;
            display: flex;
            font-weight: 500;
            font-size: 9px;
            color: var(--stellar-white);
            background-color: #4caf4f39;
            border-radius: 10px;
            padding: 10px;
            width: fit-content;
            height: 20px;
            text-align: center;
            align-items: center;
        }

        .rank-level.npc {
    background: var(--color1);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}



        .rank-karma {
            font-family: 'Zhcn', sans-serif;
            font-weight: bold;
            color: var(--genshin-bright-gold);
            text-align: right;
            font-size: 1.1rem;
        }

        .tabs-container {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 40px;
            margin-top: calc(var(--header-height, 60px) + 12px);
            z-index: 20;
            position: relative;
            align-self: start;
        }

        .tabs-container h1 {
            cursor: pointer;
            opacity: 0.5;
            margin: 0;
            font-size: 1.8rem;
        }

        .tabs-container h1.active {
            opacity: 1;
            text-shadow: 0 0 20px rgba(255, 204, 51, 0.8);
        }

        .short-text { display: none; }
        .full-text { display: inline; }

        @media (max-width: 768px) {

            .market-sub-tabs {
                width: fit-content;
                max-width: 100%;
                margin-left: auto;
                margin-right: auto;
                justify-content: center;
                flex-wrap: wrap;
            }


             .market-container {
                margin-top: 20px;
                padding: 20px 15px;
            }
            .ranking-container {
                padding: 10px;
                margin-top: 20px;
            }
            .ranking-header, .ranking-row {
                grid-template-columns: 50px 1fr 100px;
                padding: 12px 10px;
            }
            .rank-username { font-size: 0.9rem; }
            .rank-karma { font-size: 0.9rem; }
            
            .tabs-container { 
                margin-top: 80px; 
                width: 100vw;/* dont fucking change this! */
                display: flex;
                justify-content: stretch;
                padding: 0;
                gap: 0;
                border-bottom: 1px solid rgba(236, 229, 216, 0.1);
            }

            .tabs-container h1 { 
                font-size: 0.75rem; 
                flex: 1;
                margin: 0 !important;
                padding: 15px 0;
                text-align: center;
                display: flex;
                align-items: center;
                justify-content: center;
                position: relative;
                transition: color 0.3s;
            }

            .tabs-container h1.active {
                transform: none;
                color: var(--genshin-bright-gold);
            }

           

            .full-text { display: none; }
            .short-text { display: inline; }

            .market-row {
                grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
                gap: 15px;
                padding: 20px 0;
            }

            .waifu-card {
                flex: 0 0 170px;
                height: 270px;
            }
            
            .card-name {
                font-size: 0.8rem;
            }
            
            #userKarmaDisplay {
                font-size: 1rem;
            }

            /* Responsive Shop Banner */
            #shopbannerimage {
                height: 250px;
            }

            .shop-tabs-overlay {
                bottom: 15px;
                padding: 4px;
                gap: 6px;
                width: 95%;
                justify-content: center;
            }
        }

        @media (max-width: 480px) {
            #shopbannerimage {
                height: 380px;
            }

            .shop-tabs-overlay {
                bottom: 10px;
            }
        }

        @media (max-width: 400px) {

                .shop-container .quick-actions-grid {
            padding: 3px;
        }


            .market-sub-tabs {
                gap: 6px;
            }

            .market-sub-tab {
                font-size: 0.7rem;
                padding: 8px 10px;
            }

            .market-sub-tab i {
                font-size: 0.95rem;
            }
        }

/* Transactions Table Grid */
.transaction-grid {
    display: grid;
    grid-template-columns: minmax(180px, 0.95fr) minmax(360px, 1.9fr) minmax(90px, 0.45fr) minmax(180px, 0.95fr);
    gap: 12px;
}

.tx-details-sub {
    display: block;
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 2px;
}

.transaction-header {
    background: rgba(0,0,0,0.3);
    font-family: 'Zhcn', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--genshin-bright-gold);
    border-bottom: 2px solid rgba(255, 204, 51, 0.2);
    padding: 20px;
}

.transaction-row {
    padding: 15px 20px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
}

.transaction-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tx-user {
  background: linear-gradient(90deg, #0f172a, #1e293b);
  color: #c3daff;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid #334155;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.tx-user::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.12), transparent);
  animation: shine 6s linear infinite;
}

.tx-to {
  background: linear-gradient(135deg, #61db904d 0%, #1e4a2832 100%);
  color: #e8f5e9;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid rgba(76, 175, 80, 0.12);
  box-shadow: 
    0 4px 12px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(6px);
  transition: all 0.18s ease;
  min-width: 0;
}

.tx-to:hover {
  transform: translateY(-1px);
  box-shadow: 
    0 6px 20px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.1);
  border-color: rgba(100, 200, 110, 0.2);
}

.tx-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tx-user span,
.tx-to span {
    display: block;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-details {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    min-width: 0;
}

.tx-item-image {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #333;
    flex-shrink: 0;
}

.tx-details-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tx-item-name-row {
    display: block;
    min-width: 0;
}

.tx-item-name {
    font-weight: 500;
    white-space: normal;
    overflow: hidden;
    line-height: 1.15;
}

.tx-karma-inline {
    display: none;
    color: #ffd700;
    font-family: 'Zhcn', sans-serif;
    font-weight: 700;
}

.tx-tier-pill {
    font-size: 0.65rem;
    line-height: 1;
    display: inline-flex;
    padding: 3px 6px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    margin-top: 4px;
}

.tx-details.tier-c {
    border-color: rgba(255, 255, 255, 0.12);
}

.tx-details.tier-b {
    border-color: rgba(180, 200, 220, 0.35);
    box-shadow: inset 0 0 16px rgba(180, 200, 220, 0.08);
}

.tx-details.tier-a {
    border-color: rgba(255, 200, 0, 0.45);
    box-shadow: inset 0 0 16px rgba(255, 200, 0, 0.08);
}

.tx-details.tier-s {
    border-color: rgba(180, 100, 255, 0.45);
    box-shadow: inset 0 0 16px rgba(180, 100, 255, 0.09);
}

.tx-tier-pill.tier-c {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.08);
}

.tx-tier-pill.tier-b {
    color: #c7d8ea;
    background: rgba(180, 200, 220, 0.15);
}

.tx-tier-pill.tier-a {
    color: #ffe082;
    background: rgba(255, 200, 0, 0.16);
}

.tx-tier-pill.tier-s {
    color: #e7b4ff;
    background: rgba(180, 100, 255, 0.16);
}


@keyframes shine {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.tx-type {
    text-transform: capitalize;
    color: #a291f0;
}

.tx-karma {
    font-family: 'Zhcn', sans-serif;
    font-weight: bold;
    color: var(--genshin-gold);
    text-align: right;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-bottom: 40px;
}

.pagination-controls button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-family: 'Zhcn', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination-controls button:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
    border-color: var(--genshin-gold);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .transaction-header.transaction-grid {
        grid-template-columns: minmax(124px, 1.2fr) minmax(88px, 0.82fr) minmax(124px, 1.2fr);
        gap: 10px;
    }

    .transaction-row.transaction-grid {
        grid-template-columns: minmax(124px, 1.2fr) minmax(88px, 0.82fr) minmax(124px, 1.2fr);
        row-gap: 0;
        column-gap: 10px;
    }

    .transaction-header .ranking-header-item {
        font-size: 0.8rem;
        letter-spacing: 0.6px;
        white-space: nowrap;
    }

    .transaction-header .ranking-header-item:nth-child(3) {
        display: none;
    }

    .transaction-row {
        font-size: 0.78rem;
        padding: 10px 8px;
        align-items: stretch;
    }

    .transaction-row > .tx-karma {
        display: none;
    }

    .transaction-header {
        padding: 10px 8px;
    }

    .tx-user,
    .tx-to {
        padding: 8px 10px;
        gap: 8px;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }

    .tx-details {
        padding: 6px 6px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 4px;
    }

    .tx-details-text {
        align-items: center;
        justify-content: center;
    }

    .tx-avatar {
        width: 40px;
        height: 40px;
    }

    .tx-item-image {
        width: 32px;
        height: 32px;
    }

    .tx-item-name {
        font-size: 0.7rem;
        line-height: 1.1;
    }

    .tx-details-sub {
        display: none;
    }

    .tx-tier-pill {
        font-size: 0.52rem;
        padding: 2px 5px;
        margin-top: 3px;
        letter-spacing: 0.2px;
    }

    .tx-karma-inline {
        display: inline-block;
        margin-top: 3px;
        font-size: 0.92rem;
        letter-spacing: 0.2px;
    }

    .tx-user span,
    .tx-to span {
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1.1;
        white-space: nowrap;
        max-width: 100%;
        flex: 0 0 auto;
    }
}

@media (max-width: 480px) {
    .transaction-header.transaction-grid {
        grid-template-columns: minmax(114px, 1.25fr) minmax(82px, 0.75fr) minmax(114px, 1.25fr);
        gap: 8px;
    }

    .transaction-row.transaction-grid {
        grid-template-columns: minmax(114px, 1.25fr) minmax(82px, 0.75fr) minmax(114px, 1.25fr);
        row-gap: 0;
        column-gap: 8px;
    }

    .transaction-header .ranking-header-item {
        font-size: 0.72rem;
        letter-spacing: 0.4px;
    }

    .tx-user,
    .tx-to {
        padding: 7px 9px;
        max-height: 90px;
    }

    .tx-details {
        gap: 5px;
    }

    .tx-avatar {
        width: 42px;
        height: 42px;
    }

    .tx-item-image {
        width: 30px;
        height: 30px;
    }

    .tx-item-name {
        font-size: 0.66rem;
    }

    .tx-tier-pill {
        display: none;
    }

    .tx-karma-inline {
        font-size: 0.86rem;
    }

    .tx-user span,
    .tx-to span {
        font-size: 0.64rem;
    }
}

.text-green { color: #22c55e !important; }
.text-red { color: #ef4444 !important; }
.text-gold { color: var(--genshin-bright-gold) !important; }

/* Buy Item Modal */
.buy-modal-content {
    background: linear-gradient(135deg, #1b1e2a 0%, #2c3148 100%);
    border: 2px solid var(--genshin-bright-gold);
    box-shadow: 0 0 30px rgba(255, 204, 51, 0.2);
    max-width: 500px;
    padding: 0;
    overflow: hidden;
}

.buy-modal-content .modal-header {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-bottom: 1px solid rgba(255, 204, 51, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.buy-modal-content .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--genshin-bright-gold);
    border: none;
    padding: 0;
}

.buy-modal-content .close-modal {
    color: var(--genshin-gold);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.buy-modal-content .modal-body {
    padding: 30px;
}

.item-preview-container {
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#modal-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--genshin-gold);
    background: #000;
}

.item-info-text h3 {
    margin: 0;
    font-family: 'Zhcn', sans-serif;
    font-size: 1.3rem;
    color: #fff;
}

.item-price-tag {
    margin: 5px 0 0 0;
    color: var(--genshin-bright-gold);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.item-description {
    margin: 10px 0 0 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    font-style: italic;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 4px;
    border-left: 2px solid var(--genshin-bright-gold);
}

.purchase-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.amount-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.amount-selector label {
    font-weight: 600;
    color: var(--genshin-gold);
}

.number-input {
    display: flex;
    align-items: center;
    background: #000;
    border: 1px solid var(--genshin-gold);
    border-radius: 6px;
    overflow: hidden;
}

.number-input button {
    background: transparent;
    border: none;
    color: var(--genshin-gold);
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.number-input button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.number-input input {
    width: 50px;
    height: 35px;
    background: transparent;
    border-left: 1px solid var(--genshin-gold);
    border-right: 1px solid var(--genshin-gold);
    color: #fff;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
}

/* Remove arrows from number input */
.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.karma-stats {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.stat-row.total-row {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    font-weight: bold;
    color: #fff;
    font-size: 1rem;
}

.stat-row.balance-row {
     font-size: 0.85rem;
     font-style: italic;
}

.buy-modal-content .modal-footer {
    padding: 20px 30px 30px;
    display: flex;
    gap: 15px;
}

.buy-modal-content .btn-buy, 
.buy-modal-content .btn-cancel {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    font-family: 'Zhcn', sans-serif;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    border: none;
}

.buy-modal-content .btn-buy {
    background: linear-gradient(90deg, #ffcc33, #e5a004);
    color: #000;
}

.buy-modal-content .btn-buy:hover {
    transform: scale(1.02);
    background: linear-gradient(90deg, #ffd75e, #fbb005);
}

.buy-modal-content .btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.buy-modal-content .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================= */
/* SHOP UNIFORMITY FIXES */
/* ========================================= */

/* Force flexible grid with minimum width that allows for squares */
.shop-container .quick-actions-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; 
    gap: 15px;
    align-items: stretch;
    display: grid;
}

/* Force square aspect ratio and uniform flexible container */
.shop-container .quick-actions-grid .action-card {
    /* aspect-ratio: 1 / 1; REMOVED to allow height growth */
    width: 100%;
    min-height: 160px; /* Ensure at least a square-ish base */
    height: 100%; /* Stretch to fill grid row height */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute space: Icon top, Button/Price bottom */
    align-items: center;
    padding: 15px 10px;
}

/* Reset Spans for Tier S (Legendary) in Shop to ensure uniformity */
.shop-container .quick-actions-grid .action-card.tier-s {
    grid-column: auto !important;
    grid-row: auto !important;
}

/* Improve text wrapping for cards that are now constrained to squares */
.shop-container .quick-actions-grid .action-card .action-name {
    white-space: normal;
    text-align: center;
    display: block; /* Remove flex box clamping */
    overflow: visible;
    height: auto;
    max-height: none; /* Allow full growth */
    font-size: 0.85rem;
    margin: 8px 0;
    line-height: 1.3;
    flex-grow: 1; /* Push content apart */
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-description {
    font-size: 12px;
width: 100%;
    text-align: center;
    word-wrap: break-word;
    white-space: pre-wrap;          /* or normal */
    hyphens: auto;
    line-height: 1.3;
    padding: 0 8px;
    box-sizing: border-box;

}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .shop-container .quick-actions-grid {
        /* Force 2 columns on mobile for decent size squares, overriding chat.css */
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .shop-container #karmaCategory {
        grid-template-columns: 1fr !important;
    }
}



	.shop-item-xp {
            font-size: 12px;
			color: #60a5fa;
			border: 1px solid rgba(59, 130, 246, 0.4);
			box-shadow: 0 0 12px rgba(59, 130, 246, 0.3), inset 0 0 8px rgba(59, 130, 246, 0.1);
			text-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
			animation-delay: 0.1s;
            padding: 2px 5px;
            min-width: 60px;
            border-radius: 3px;
		}

        .shop-item-karma {
            font-size: 12px;
			background: linear-gradient(135deg, rgba(246, 215, 59, 0.086) 0%, rgba(235, 232, 37, 0.153) 100%);
			color: #fad360;
			border: 1px solid rgba(240, 196, 19, 0.315);
			box-shadow: 0 0 12px rgba(240, 196, 19, 0.312), inset 0 0 8px rgba(240, 196, 19, 0.1);
			text-shadow: 0 0 8px rgba(240, 196, 19, 0.6);
			animation-delay: 0.1s;
            padding: 2px 5px;
            min-width: 60px;
            border-radius: 3px;
		}

        .shop-container .karma-card {
            gap: 10px;
            position: relative;
            overflow: hidden;
        }

        .shop-container .karma-card .karma-stat {
            font-size: 1.05rem;
            font-weight: 700;
            color: #4ade80;
			color: #fad360;
            text-shadow: 0 0 10px rgba(215, 40, 119, 0.758);
            letter-spacing: 0.4px;
        }

        .shop-container .karma-card .karma-price-btn {
            width: 100%;
            border-radius: 8px;
            padding: 6px 10px;
            font-size: 0.85rem;
            font-weight: 700;
            border: 1px solid rgba(255, 255, 255, 0.2);
            cursor: pointer;
            letter-spacing: 0.3px;
        }

        .shop-container .karma-card .karma-price-btn.standard {
            background: linear-gradient(135deg, #f5f5f5 0%, #d9d9d9 100%);
            color: #1b1b1b;
            border-color: rgba(255, 255, 255, 0.6);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
        }

        .shop-container .karma-card .karma-price-btn.pack {
            background: linear-gradient(135deg, #ab36d2 0%, #e02358 100%);
            color: #ffffff;
            border-color: rgba(242, 196, 90, 0.7);
            box-shadow: 0 4px 14px rgba(37, 24, 221, 0.35), 0 0 12px rgba(242, 196, 90, 0.3);
            font-size: 20px;
            font-family: "Montserrat";
            filter: contrast(1.3);
            animation: pulse-scale 3s infinite ease-in-out;
        }

        @keyframes pulse-scale {
  0%, 100% { transform: scale(0.98); }
  50%      { transform: scale(1.00); }
}

         .shop-container  {
            font-family: Zhcn;
        }

        .shop-container .karma-card .karma-price-btn:hover {
            transform: translateY(-1px);
            filter: brightness(1.05);
        }

        .shop-container .karma-card .karma-ribbon {
            position: absolute;
            top: 12px;
            right: -48px;
            z-index: 3;
            transform: rotate(35deg);
            pointer-events: none;
        }

        .shop-container .karma-card .karma-ribbon span {
            display: block;
            min-width: 170px;
            text-align: center;
            padding: 6px 10px;
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 1.2px;
            color: #1b1b1b;
            font-weight: 800;
            background: linear-gradient(135deg, #ffe38b 0%, #ffb703 100%);
            border: 1px solid rgba(255, 255, 255, 0.6);
            box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
        }

        	.affinity-badge {
            font-size: 12px;
			background: linear-gradient(135deg, rgba(236, 72, 153, 0.25) 0%, rgba(219, 39, 119, 0.35) 100%);
			color: #f472b6;
			border: 1px solid rgba(236, 72, 153, 0.4);
			box-shadow: 0 0 12px rgba(236, 72, 153, 0.3), inset 0 0 8px rgba(236, 72, 153, 0.1);
			text-shadow: 0 0 8px rgba(236, 72, 153, 0.6);
			animation-delay: 0.25s;
		}


        .tier-a.disabled, .tier-b.disabled{
            opacity: 60% !important;
            filter: grayscale();
            cursor: not-allowed;
        }
       
        .karma-card-image {
            width: 60px ;
            height: 50px ;
        }

         #chest-img-karma-vault-promo1 {
            width: 252px !important;
            height: 194px !important;
        }


        #karmaCategory {
            max-width: 900px;
            margin-left: auto;
            margin-right: auto;
            justify-content: center;
            grid-template-columns: repeat(auto-fit, minmax(160px, 220px)) !important;
        }

/* Karma Bundle Premium Styles */
.karma-bundle.promo {
    background: linear-gradient(135deg, rgba(142, 108, 39, 0.4), rgba(0, 0, 0, 0.6));
    border: 1px solid rgba(255, 204, 51, 0.5);
    border-radius: 12px;
    padding: 12px;
    margin: 12px 0;
    width: 100%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 204, 51, 0.1);
    animation: bundle-glow-pulse 4s infinite ease-in-out;
}

@keyframes bundle-glow-pulse {
    0%, 100% { border-color: rgba(255, 204, 51, 0.4); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); }
    50% { border-color: rgba(255, 204, 51, 0.8); box-shadow: 0 4px 25px rgba(255, 204, 51, 0.2); }
}

.karma-bundle .bundle-label {
    position: absolute;
    top: -10px;
    left: 12px;
    background: linear-gradient(90deg, #ffcc33, #ffb703);
    color: #1b1b1b;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 2;
}

.karma-bundle .bundle-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 2px;
}

.karma-bundle .bundle-icon {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(255, 204, 51, 0.6);
    background: #0d0f17;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.karma-bundle .bundle-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 3px;
}

.karma-bundle .bundle-name {
    font-size: 0.95rem;
    color: #fff;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.karma-bundle .bundle-tier {
    font-size: 0.75rem;
    color: #ffcc33;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.karma-bundle .bundle-tier::before {
    content: "★";
    font-size: 0.8rem;
}

