/* ============================================
   MUZeeD v2 - Dark Theme with Glassmorphism
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #e5e7eb;
    --text-muted: #9ca3af;
    --accent-gold: #f59e0b;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --font-family: 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.1);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* ---------- Performance ---------- */
html { scroll-behavior: smooth; }
* { -webkit-font-smoothing: antialiased; }

/* Alpine.js cloak — hide elements until Alpine initializes */
[x-cloak] { display: none !important; }

/* ---------- Bootstrap Dark Overrides ---------- */
.text-muted { color: #9ca3af !important; }
.text-secondary { color: #9ca3af !important; }
.text-body-secondary { color: #9ca3af !important; }
.text-light { color: #e5e7eb !important; }
.text-dark { color: #e5e7eb !important; }
.bg-dark { background-color: #111827 !important; }
.bg-secondary { background-color: rgba(255,255,255,0.1) !important; }
.border-secondary { border-color: rgba(255,255,255,0.15) !important; }
.form-label { color: #d1d5db !important; }
.form-text { color: #9ca3af !important; }
.card-body, .card-header, .card-footer { color: #e5e7eb; }
small, .small { color: #9ca3af; }
.lead { color: #d1d5db; }
p { color: #d1d5db; }
h1, h2, h3, h4, h5, h6 { color: #f3f4f6; }
label { color: #d1d5db; }
.list-unstyled li { color: #d1d5db; }
.alert-warning { color: #92400e; }
.alert-danger { color: #fecaca; background-color: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); }
.alert-success { color: #a7f3d0; background-color: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.3); }
.alert-info { color: #bfdbfe; background-color: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.3); }
.dropdown-item { color: #d1d5db; }
.nav-link { color: #d1d5db; }
.breadcrumb-item, .breadcrumb-item a { color: #9ca3af; }
.modal-content { background-color: #1f2937; color: #e5e7eb; border: 1px solid rgba(255,255,255,0.1); }

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: var(--accent-gold);
    color: #000;
}

a { color: var(--accent-gold); text-decoration: none; }
a:hover { color: #fbbf24; }

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ---------- Glassmorphism Card ---------- */
.card-glass {
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: box-shadow 0.2s ease;
}

.card-glass:hover {
    box-shadow: var(--shadow-glow);
}

/* ---------- Navbar ---------- */
.navbar {
    background: rgba(10, 14, 26, 0.97) !important;
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    will-change: transform;
}

.navbar-brand { font-weight: 700; letter-spacing: 1px; }
.navbar .nav-link { font-weight: 400; transition: color 0.2s ease; }
.navbar .nav-link:hover, .navbar .nav-link:focus { color: var(--accent-gold) !important; }
.navbar .nav-link.active { color: var(--accent-gold) !important; font-weight: 500; }

.dropdown-menu-dark {
    background: rgba(17, 24, 39, 0.98);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.dropdown-item:hover { background: rgba(245, 158, 11, 0.08); color: var(--accent-gold); }

/* ---------- Form Controls (Dark) ---------- */
.form-control-dark,
.form-control {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control::placeholder { color: var(--text-muted); opacity: 0.6; }
.form-control:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
    color: #fff;
}

.form-control:disabled, .form-control[readonly] {
    background-color: rgba(255, 255, 255, 0.03);
    opacity: 0.6;
}

.form-control.is-valid { border-color: var(--accent-green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.form-control.is-invalid { border-color: var(--accent-red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

.form-select {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: var(--radius-sm);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23f59e0b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
}

.form-select:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
    color: #fff;
}
.form-select option {
    background: #1a1f2e;
    color: #e5e7eb;
}
.form-select option:checked {
    background: #f59e0b;
    color: #000;
}

.form-label { font-weight: 500; font-size: 0.9rem; color: var(--text-muted); }

.input-group .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
}

.input-group .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* ---------- Tables (Dark) ---------- */
.table-dark, .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(245, 158, 11, 0.06);
    --bs-table-border-color: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.table thead tr {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 2px solid rgba(245, 158, 11, 0.3);
}

.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem;
    white-space: nowrap;
    color: var(--text-muted);
}

.table td { vertical-align: middle; padding: 0.65rem 0.75rem; color: #e5e7eb !important; }
.table td.fw-bold { color: #f3f4f6 !important; }
.table td.text-gold { color: #f59e0b !important; }
.table td.text-blue { color: #3b82f6 !important; }
.table td.text-green { color: #10b981 !important; }
.table td.text-red { color: #ef4444 !important; }
.table th { color: #9ca3af !important; }
.table th.text-gold { color: #f59e0b !important; }
.table th.text-blue { color: #3b82f6 !important; }
.table th.text-green { color: #10b981 !important; }

/* ---------- Buttons ---------- */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: #000;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.btn-outline-warning {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.btn-outline-warning:hover {
    background-color: var(--accent-gold);
    color: #000;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.btn { border-radius: var(--radius-sm); font-weight: 500; transition: all 0.2s ease; }

/* ---------- Alerts ---------- */
.alert {
    border-radius: var(--radius-md);
    border-width: 1px;
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
    border-radius: 6px;
}

/* ---------- Pagination ---------- */
.page-link {
    border-radius: var(--radius-sm) !important;
    margin: 0 2px;
    font-size: 0.85rem;
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.page-link:hover {
    background: rgba(245,158,11,0.15);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.page-item.active .page-link {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #000;
}

.page-item.disabled .page-link {
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
}

/* ---------- Hero Section ---------- */
.hero-section {
    position: relative;
    overflow: hidden;
    padding: 80px 0;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 60% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.stat-box {
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.stat-box:hover { box-shadow: 0 0 20px rgba(245,158,11,0.1); }

/* ---------- War Champions ---------- */
.war-champion-card {
    background: linear-gradient(135deg, rgba(15,15,35,0.95), rgba(10,10,30,0.98));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.war-champion-card:hover { transform: translateY(-2px); }

/* === Castle Siege - Epic Gold Theme === */
.war-champion-castle {
    border-color: rgba(245,158,11,0.4);
    box-shadow: 0 0 30px rgba(245,158,11,0.08), inset 0 0 60px rgba(245,158,11,0.03);
}
.war-champion-castle:hover {
    box-shadow: 0 0 60px rgba(245,158,11,0.25), 0 4px 30px rgba(0,0,0,0.5);
    border-color: rgba(245,158,11,0.6);
}
.war-champion-castle::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(245,158,11,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(245,158,11,0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 80%, rgba(245,158,11,0.04) 0%, transparent 40%);
}
.war-champion-castle::after {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%; pointer-events: none;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(245,158,11,0.04) 30deg, transparent 60deg);
    animation: castle-rotate 15s linear infinite;
}
@keyframes castle-rotate { 100% { transform: rotate(360deg); } }

.war-champion-castle .war-champion-header {
    border-bottom: 1px solid rgba(245,158,11,0.2);
    background: linear-gradient(180deg, rgba(245,158,11,0.06) 0%, transparent 100%);
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}
.war-champion-castle .war-champion-header i {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 12px rgba(245,158,11,0.5));
    animation: crown-pulse 2s ease-in-out infinite;
}
@keyframes crown-pulse {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(245,158,11,0.5)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 24px rgba(245,158,11,0.8)); transform: scale(1.08); }
}

.war-champion-castle .war-champion-guild {
    background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(245,158,11,0.02));
    border: 1px solid rgba(245,158,11,0.12);
}
.war-champion-castle .war-champion-logo {
    border-color: rgba(245,158,11,0.4);
    box-shadow: 0 0 15px rgba(245,158,11,0.15);
}

/* === Arca War - Element Theme === */
.war-champion-arca {
    border-color: rgba(79,195,247,0.3);
    box-shadow: 0 0 20px rgba(79,195,247,0.06);
}
.war-champion-arca:hover {
    box-shadow: 0 0 50px rgba(79,195,247,0.2), 0 4px 24px rgba(0,0,0,0.4);
    border-color: rgba(79,195,247,0.5);
}
.war-champion-arca::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; pointer-events: none;
    background: radial-gradient(ellipse at 50% 0%, rgba(79,195,247,0.08) 0%, transparent 50%);
}

.war-champion-arca .war-champion-header {
    border-bottom: 1px solid rgba(79,195,247,0.15);
}

/* Arca element pillar backgrounds */
.arca-pillar-fire { background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02)) !important; border-color: rgba(239,68,68,0.15) !important; }
.arca-pillar-water { background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(59,130,246,0.02)) !important; border-color: rgba(59,130,246,0.15) !important; }
.arca-pillar-earth { background: linear-gradient(135deg, rgba(180,140,60,0.08), rgba(180,140,60,0.02)) !important; border-color: rgba(180,140,60,0.15) !important; }
.arca-pillar-wind { background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(16,185,129,0.02)) !important; border-color: rgba(16,185,129,0.15) !important; }
.arca-pillar-dark { background: linear-gradient(135deg, rgba(168,85,247,0.08), rgba(168,85,247,0.02)) !important; border-color: rgba(168,85,247,0.15) !important; }

/* === Common War Styles === */
.war-champion-header {
    text-align: center;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
}
.war-champion-header i { font-size: 1.8rem; }

.war-champion-guild {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    transition: background 0.3s;
}
.war-champion-guild:hover { background: rgba(255,255,255,0.04); }

.war-champion-logo {
    width: 72px; height: 72px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.war-champion-logo-sm {
    width: 56px; height: 56px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* Element badge on ArcaWar guild logo */
.war-logo-wrap {
    position: relative;
    flex-shrink: 0;
}
.war-ele-badge {
    position: absolute;
    bottom: -4px; right: -4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    border: 2px solid rgba(10,10,30,0.9);
    box-shadow: 0 0 10px currentColor;
    animation: ele-glow 2s ease-in-out infinite alternate;
}
@keyframes ele-glow {
    0% { box-shadow: 0 0 6px currentColor; }
    100% { box-shadow: 0 0 14px currentColor, 0 0 20px currentColor; }
}

.war-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.war-stat-item {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(245,158,11,0.03);
    border: 1px solid rgba(245,158,11,0.08);
    text-align: center;
    transition: background 0.3s;
}
.war-stat-item:hover { background: rgba(245,158,11,0.06); }
.war-stat-item .war-stat-label { font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.war-stat-item .war-stat-value { font-weight: 700; font-size: 0.95rem; }

.war-countdown {
    text-align: center;
    margin-top: 1rem;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.war-countdown-castle { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.15); }
.war-countdown-arca { background: rgba(79,195,247,0.08); border: 1px solid rgba(79,195,247,0.15); }

/* ---------- Cards ---------- */
.card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    background: var(--bg-card) !important;
}

.card-header {
    background: rgba(255,255,255,0.03) !important;
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem 1.25rem;
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border-glass); }

/* ---------- Password Strength Bar ---------- */
.password-strength .progress {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    height: 4px;
}

/* ---------- Toast Notification ---------- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

.toast-custom {
    background: rgba(17, 24, 39, 0.98);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* ---------- Animations ---------- */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Utility ---------- */
.text-gold { color: var(--accent-gold) !important; }
.text-blue { color: var(--accent-blue) !important; }
.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }
.text-purple { color: var(--accent-purple) !important; }
.bg-glass {
    background: rgba(17, 24, 39, 0.85);
}

/* Result Popup pulse */
@keyframes popupPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 currentColor; }
    50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(255,255,255,0.1); }
}

/* Rank medals */
.rank-1 { color: #ffd700; font-weight: 700; }
.rank-2 { color: #c0c0c0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .hero-section { padding: 50px 0 !important; }
    .hero-section h1 { font-size: 1.8rem; }
    .stat-box { padding: 0.75rem 1rem !important; }
    .stat-box .h3 { font-size: 1.3rem !important; }
    .card-glass { border-radius: var(--radius-md); }
    .table-responsive { font-size: 0.85rem; }
    .btn-lg { padding: 0.6rem 1.2rem; font-size: 1rem; }
    .main-content { margin-top: 60px !important; }
}

@media (max-width: 576px) {
    .table-responsive .table th,
    .table-responsive .table td { white-space: nowrap; }
    .pagination .page-link { padding: 0.3rem 0.5rem; font-size: 0.78rem; }
}

/* ============================================
   Treasure Chest Gacha Animation
   ============================================ */

/* Chest Overlay */
.chest-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
}

/* Chest Container */
.chest-container { text-align: center; position: relative; }

/* Chest Base - Image Based with Lid Split */
.chest {
    width: 220px;
    height: 220px;
    position: relative;
    margin: 0 auto 2rem;
}

/* Lid (top 45% of image) */
.chest-lid-img {
    position: absolute;
    top: 0; left: 0;
    width: 220px; height: 220px;
    object-fit: contain;
    clip-path: inset(0 0 55% 0);
    z-index: 3;
    transform-origin: 50% 45%;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.4));
}

/* Body (bottom 55% of image) */
.chest-body-img {
    position: absolute;
    top: 0; left: 0;
    width: 220px; height: 220px;
    object-fit: contain;
    clip-path: inset(45% 0 0 0);
    z-index: 2;
    filter: drop-shadow(0 4px 15px rgba(0,0,0,0.5));
}

/* Soft inner glow from chest opening */
.chest-light {
    position: absolute;
    top: 25%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    opacity: 0;
    transition: all 0.6s ease;
}
.chest.bronze .chest-light { background: radial-gradient(ellipse, rgba(255,180,80,0.7) 0%, rgba(255,120,30,0.2) 40%, transparent 70%); }
.chest.silver .chest-light { background: radial-gradient(ellipse, rgba(150,210,255,0.7) 0%, rgba(80,150,255,0.2) 40%, transparent 70%); }
.chest.gold .chest-light { background: radial-gradient(ellipse, rgba(210,170,255,0.7) 0%, rgba(160,80,255,0.2) 40%, transparent 70%); }

/* Burst flash */
.chest-burst {
    position: absolute;
    top: 30%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    opacity: 0;
}
.chest.bronze .chest-burst { background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,180,80,0.4) 30%, transparent 60%); }
.chest.silver .chest-burst { background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(130,200,255,0.4) 30%, transparent 60%); }
.chest.gold .chest-burst { background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(200,150,255,0.4) 30%, transparent 60%); }

/* Ring pulse */
.chest-ring {
    position: absolute;
    top: 35%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    border: 2px solid;
    transform: translate(-50%, -50%);
    z-index: 3;
    opacity: 0;
}
.chest.bronze .chest-ring { border-color: rgba(255,180,80,0.5); }
.chest.silver .chest-ring { border-color: rgba(130,200,255,0.5); }
.chest.gold .chest-ring { border-color: rgba(200,150,255,0.5); }

/* Chest Glow */
.chest-glow {
    position: absolute;
    top: -60px; left: -60px; right: -60px; bottom: -60px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.6s;
    z-index: 1;
}
.chest.bronze .chest-glow { background: radial-gradient(circle, rgba(255,120,30,0.25) 0%, transparent 65%); }
.chest.silver .chest-glow { background: radial-gradient(circle, rgba(80,150,255,0.25) 0%, transparent 65%); }
.chest.gold .chest-glow { background: radial-gradient(circle, rgba(160,80,255,0.25) 0%, transparent 65%); }

/* Animation States */
.chest.appearing { animation: chestAppear 0.5s ease-out; }
.chest.shaking .chest-lid-img, .chest.shaking .chest-body-img { animation: chestShake 0.8s ease-in-out; }

/* Opening: lid lifts gently + soft glow + burst + ring */
.chest.opening .chest-lid-img {
    transform: rotate(-20deg) translateY(-15px);
    filter: drop-shadow(0 -5px 25px rgba(255,215,0,0.4));
}
.chest.opening .chest-body-img {
    filter: drop-shadow(0 0 20px rgba(255,215,0,0.3));
}
.chest.opening .chest-light {
    width: 280px; height: 280px;
    opacity: 1;
}
.chest.opening .chest-burst {
    animation: burstFlash 0.6s ease-out forwards;
}
.chest.opening .chest-ring {
    animation: ringPulse 1s ease-out forwards;
}
.chest.opening .chest-glow { opacity: 1; }
.chest.revealing .chest-glow { opacity: 0.6; }

@keyframes burstFlash {
    0% { width: 0; height: 0; opacity: 0; }
    30% { width: 350px; height: 350px; opacity: 1; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

@keyframes ringPulse {
    0% { width: 0; height: 0; opacity: 0.7; border-width: 3px; }
    100% { width: 450px; height: 450px; opacity: 0; border-width: 1px; }
}

/* Revealing: chest shrinks softly, prize appears */
.chest.revealing .chest-lid-img,
.chest.revealing .chest-body-img {
    transition: all 0.5s ease;
    opacity: 0.15;
    transform: scale(0.6);
    filter: blur(2px) drop-shadow(0 0 10px rgba(255,215,0,0.2));
}
.chest.revealing .chest-light { width: 100px; height: 100px; opacity: 0; transition: all 0.5s; }

.chest.done .chest-lid-img,
.chest.done .chest-body-img { opacity: 0.1; transform: scale(0.5); filter: blur(3px); }
.chest.done .chest-light { opacity: 0; }

@keyframes chestAppear {
    from { transform: scale(0.3) translateY(50px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes chestShake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px) rotate(-2deg); }
    20%, 40%, 60%, 80% { transform: translateX(5px) rotate(2deg); }
}

/* Particles */
.particles { position: absolute; top: 50%; left: 50%; pointer-events: none; }
.particle {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    animation: particleFly 1s ease-out forwards;
}

@keyframes particleFly {
    from { transform: translate(0, 0) scale(1); opacity: 1; }
    to { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* Prize Reveal */
.prize-reveal {
    animation: prizeFloat 0.6s ease-out;
}
.prize-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.prize-name { font-size: 1.5rem; font-weight: 700; color: #f59e0b; }
.prize-amount { font-size: 2rem; font-weight: 700; color: #e5e7eb; }

@keyframes prizeFloat {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Gacha active badge */
.gacha-badge { font-size: 0.55rem; position: absolute; top: -4px; right: -4px; }

/* Bronze badge color */
.bg-bronze { background-color: #CD7F32 !important; color: #fff; }
