        * { box-sizing: border-box; }

        .shop-page {
            min-height: 0;
            padding: 16px;
            overscroll-behavior: none;
            font-family: 'IBM Plex Sans', sans-serif;
            background: var(--surface-shop);
            color: var(--text-primary);
        }

        .shop-container {
            max-width: 960px;
            margin: 0 auto;
        }

        /* === BALANCE BAR === */
        .balance-bar {
            display: flex;
            justify-content: center;
            gap: 24px;
            padding: 14px 20px;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            margin-bottom: 24px;
        }

        .balance-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 18px;
            font-weight: 700;
        }

        .balance-icon { font-size: 22px; }
        .balance-coins { color: var(--coin-color); }
        .balance-gems { color: var(--gem-color); }

        /* === SECTION HEADERS === */
        .section-header {
            font-size: 20px;
            font-weight: 700;
            margin: 28px 0 14px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* === FEATURED SECTION === */
        .featured-wrap {
            position: relative;
            background: linear-gradient(135deg, #2a1a0a 0%, #1a1a1b 50%, #0a1a2a 100%);
            border: 2px solid var(--accent);
            border-radius: 16px;
            padding: 28px;
            margin-bottom: 24px;
            overflow: hidden;
            cursor: pointer;
            transition: transform 0.2s;
        }

        .featured-wrap:hover { transform: scale(1.01); }

        .featured-wrap::before {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: 18px;
            background: conic-gradient(from 0deg, var(--accent), var(--rarity-legendary), var(--accent));
            z-index: -1;
            animation: featuredGlow 4s linear infinite;
        }

        @keyframes featuredGlow {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 0.55; }
        }

        .featured-badge {
            position: absolute;
            top: 12px;
            right: 12px;
            background: var(--accent);
            color: #fff;
            font-size: 11px;
            font-weight: 700;
            padding: 4px 10px;
            border-radius: 6px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .featured-content {
            display: flex;
            align-items: center;
            gap: 24px;
        }

        .featured-icon {
            font-size: 72px;
            flex-shrink: 0;
            filter: drop-shadow(0 0 12px rgba(255, 107, 53, 0.35));
            animation: floatChest 3s ease-in-out infinite;
        }

        @keyframes floatChest {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-8px); }
        }

        .featured-info { flex: 1; }
        .featured-name { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
        .featured-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
        .featured-price { font-size: 20px; font-weight: 700; }

        /* === CHEST GRID === */
        .chest-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 16px;
            margin-bottom: 32px;
        }

        .chest-card {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 14px;
            padding: 20px 16px 16px;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            transition: transform 0.2s, border-color 0.3s, box-shadow 0.3s;
            position: relative;
        }

        .chest-card:hover {
            transform: translateY(-4px);
        }

        .chest-card[data-rarity="common"] { border-color: var(--rarity-common); }
        .chest-card[data-rarity="rare"] { border-color: var(--rarity-rare); box-shadow: 0 0 12px rgba(77,171,247,0.12); }
        .chest-card[data-rarity="epic"] { border-color: var(--rarity-epic); box-shadow: 0 0 12px rgba(180,77,255,0.14); }
        .chest-card[data-rarity="legendary"] { border-color: var(--rarity-legendary); box-shadow: 0 0 16px rgba(255,215,0,0.2); animation: legendaryPulse 2.2s ease-in-out infinite; }

        @keyframes legendaryPulse {
            0%, 100% { box-shadow: 0 0 14px rgba(255,215,0,0.16); }
            50% { box-shadow: 0 0 24px rgba(255,215,0,0.3); }
        }

        .chest-emoji {
            font-size: 56px;
            margin-bottom: 10px;
            filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
        }

        .chest-name {
            font-size: 16px;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .chest-contents {
            font-size: 11px;
            color: var(--text-secondary);
            margin-bottom: 12px;
            line-height: 1.6;
            width: 100%;
            text-align: left;
        }

        .chest-contents .drop-line {
            display: block;
            padding: 1px 0;
        }

        .chest-contents .drop-magie {
            margin-top: 2px;
        }

        .chest-contents .rarity-common { color: var(--rarity-common); }
        .chest-contents .rarity-rare { color: var(--rarity-rare); }
        .chest-contents .rarity-epic { color: var(--rarity-epic); }
        .chest-contents .rarity-legendary { color: var(--rarity-legendary); }

        .chest-contents .best-drop {
            display: block;
            margin-top: 4px;
            padding: 3px 6px;
            background: rgba(255,215,0,0.1);
            border-radius: 4px;
            font-size: 10px;
            font-weight: 600;
        }

        .chest-buy-btn {
            width: 100%;
            padding: 10px;
            min-height: 44px;
            border: none;
            border-radius: 10px;
            font-family: inherit;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.2s, transform 0.1s, opacity 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .chest-buy-btn:active { transform: scale(0.96); }

        .chest-buy-btn.coin-btn {
            background: linear-gradient(135deg, #e6a800, #ffcc00);
            color: #1a1a1b;
        }

        .chest-buy-btn.gem-btn {
            background: linear-gradient(135deg, #2980d9, #4dabf7);
            color: #fff;
        }

        .chest-buy-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            transform: none;
        }

        /* === CURRENCY EXCHANGE === */
        .exchange-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 32px;
        }

        .exchange-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            padding: 20px 16px 16px;
            text-align: center;
            transition: transform 0.2s;
        }

        .exchange-card:hover { transform: translateY(-3px); }
        .exchange-icon { font-size: 40px; margin-bottom: 8px; }
        .exchange-name { font-weight: 700; margin-bottom: 4px; }
        .exchange-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }

        /* === LOADING === */
        .shop-loading {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 80px 0;
            font-size: 16px;
            color: var(--text-secondary);
        }

        .shop-loading .spinner {
            width: 28px; height: 28px;
            border: 3px solid var(--border-color);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin-right: 12px;
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        /* ========== UNBOXING OVERLAY ========== */
        .unbox-overlay {
            position: fixed;
            inset: 0;
            z-index: 9999;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,0.92);
        }

        .unbox-overlay.active {
            display: flex;
        }

        .unbox-canvas {
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 1;
        }

        .unbox-content {
            position: relative;
            z-index: 2;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            max-width: 500px;
            padding: 20px;
        }

        /* Phase 1: Chest */
        .unbox-chest {
            font-size: 120px;
            animation: chestBounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
            cursor: pointer;
            filter: drop-shadow(0 0 40px rgba(255,107,53,0.6));
            user-select: none;
        }

        @keyframes chestBounceIn {
            0% { transform: translateY(-300px) scale(0.5); opacity: 0; }
            60% { transform: translateY(20px) scale(1.1); opacity: 1; }
            80% { transform: translateY(-10px) scale(0.95); }
            100% { transform: translateY(0) scale(1); }
        }

        .unbox-tap-hint {
            margin-top: 20px;
            font-size: 16px;
            color: var(--text-secondary);
            animation: tapPulse 1.5s ease-in-out infinite;
        }

        @keyframes tapPulse {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 1; }
        }

        /* Phase 2: Shaking */
        .chest-shaking {
            animation: chestShake 0.4s ease-in-out infinite;
        }

        @keyframes chestShake {
            0%, 100% { transform: rotate(0) scale(1); }
            15% { transform: rotate(-8deg) scale(1.02); }
            30% { transform: rotate(8deg) scale(1.04); }
            45% { transform: rotate(-10deg) scale(1.06); }
            60% { transform: rotate(10deg) scale(1.08); }
            75% { transform: rotate(-6deg) scale(1.05); }
            90% { transform: rotate(6deg) scale(1.02); }
        }

        .light-beams {
            position: fixed;
            width: 300px; height: 300px;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%) scale(0.3);
            background: radial-gradient(ellipse at center, rgba(255,215,0,0.4) 0%, transparent 70%);
            border-radius: 50%;
            animation: beamExpand 1.5s ease-out forwards;
            pointer-events: none;
            z-index: 0;
        }

        @keyframes beamExpand {
            0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
            50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
        }

        /* Phase 3: Reward cards */
        .reward-card {
            background: var(--bg-card);
            border: 3px solid var(--border-color);
            border-radius: 16px;
            padding: 24px 20px;
            text-align: center;
            min-width: 240px;
            max-width: 300px;
            animation: rewardSlam 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
            opacity: 0;
            position: absolute;
        }

        @keyframes rewardSlam {
            0% { transform: translateY(-60px) scale(0.5); opacity: 0; }
            70% { transform: translateY(5px) scale(1.08); opacity: 1; }
            100% { transform: translateY(0) scale(1); opacity: 1; }
        }

        .reward-card[data-rarity="common"] { border-color: var(--rarity-common); }
        .reward-card[data-rarity="rare"] { border-color: var(--rarity-rare); box-shadow: 0 0 30px rgba(77,171,247,0.3); }
        .reward-card[data-rarity="epic"] { border-color: var(--rarity-epic); box-shadow: 0 0 30px rgba(180,77,255,0.4); }
        .reward-card[data-rarity="legendary"] { border-color: var(--rarity-legendary); box-shadow: 0 0 40px rgba(255,215,0,0.5); }

        .reward-emoji { font-size: 48px; margin-bottom: 8px; }
        .reward-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
        .reward-amount { font-size: 32px; font-weight: 700; }

        .magie-reward-card .magie-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
        .magie-reward-card .magie-for { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
        .magie-reward-card .magie-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.4; }
        .magie-reward-card .magie-uses {
            display: inline-block;
            background: rgba(255,255,255,0.1);
            padding: 4px 12px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
        }

        .magie-reward-card .magie-icon { font-size: 40px; margin-bottom: 8px; }

        /* Phase 4: Summary */
        .summary-container {
            width: 100%;
            max-width: 500px;
            animation: fadeSlideUp 0.5s ease-out forwards;
        }

        @keyframes fadeSlideUp {
            0% { transform: translateY(30px); opacity: 0; }
            100% { transform: translateY(0); opacity: 1; }
        }

        .summary-title {
            text-align: center;
            font-size: 22px;
            font-weight: 700;
            margin-bottom: 20px;
        }

        .summary-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            justify-content: center;
            margin-bottom: 16px;
        }

        .summary-item {
            background: var(--bg-secondary);
            border-radius: 12px;
            padding: 14px 18px;
            text-align: center;
            min-width: 100px;
        }

        .summary-item-icon { font-size: 28px; }
        .summary-item-value { font-size: 20px; font-weight: 700; margin-top: 4px; }

        .summary-magie-header {
            text-align: center;
            font-size: 18px;
            font-weight: 700;
            margin: 20px 0 12px;
        }

        .summary-magie-card {
            background: var(--bg-secondary);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 14px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .summary-magie-card[data-rarity="common"] { border-color: var(--rarity-common); }
        .summary-magie-card[data-rarity="rare"] { border-color: var(--rarity-rare); }
        .summary-magie-card[data-rarity="epic"] { border-color: var(--rarity-epic); }
        .summary-magie-card[data-rarity="legendary"] { border-color: var(--rarity-legendary); }

        .smc-icon { font-size: 32px; flex-shrink: 0; }
        .smc-info { flex: 1; text-align: left; }
        .smc-name { font-weight: 700; font-size: 15px; }
        .smc-target { font-size: 12px; color: var(--text-secondary); }
        .smc-uses {
            background: rgba(255,255,255,0.1);
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 12px;
            font-weight: 600;
            flex-shrink: 0;
        }

        .summary-buttons {
            display: flex;
            gap: 12px;
            margin-top: 20px;
            justify-content: center;
        }

        .summary-btn {
            padding: 12px 24px;
            min-height: 44px;
            border: none;
            border-radius: 10px;
            font-family: inherit;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.1s;
        }

        .summary-btn:active { transform: scale(0.96); }
        .summary-btn.primary { background: var(--accent); color: #fff; }
        .summary-btn.secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); }

        /* Screen flash for legendary */
        .legendary-flash {
            position: fixed;
            inset: 0;
            background: rgba(255, 215, 0, 0.3);
            z-index: 10000;
            pointer-events: none;
            animation: flashFade 0.6s ease-out forwards;
        }

        @keyframes flashFade {
            0% { opacity: 1; }
            100% { opacity: 0; }
        }

        @media (max-width: 768px) {
            .shop-page { padding: 12px; }
            .balance-bar { gap: 12px; padding: 12px; flex-wrap: wrap; }
            .featured-wrap { padding: 16px; }
            .featured-content { flex-direction: column; text-align: center; gap: 12px; }
            .featured-icon { font-size: 56px; }
            .featured-name { font-size: 1.35rem; }
            .chest-grid, .exchange-grid { grid-template-columns: 1fr; }
            .summary-buttons { flex-direction: column; }
            .reward-card, .summary-container { max-width: 100%; }
        }

        @media (max-width: 390px) {
            .section-header { font-size: 1.05rem; }
            .balance-item { font-size: 1rem; }
            .chest-card { padding: 16px 12px 12px; }
            .unbox-chest { font-size: 88px; }
        }

        @media (max-width: 360px) {
            .shop-page { padding: 10px; }
            .summary-item { min-width: 86px; padding: 10px; }
        }
