:root {
    --em: #10b981;
    --em-dim: rgba(16, 185, 129, 0.12);
    --em-glow: rgba(16, 185, 129, 0.4);
    --rose: #f43f5e;
    --gold: #f59e0b;
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.4);
    --card-border: rgba(255, 255, 255, 0.08);
    --font-main: 'Inter', sans-serif;
    --font-title: 'Outfit', sans-serif;
    --spectator: #f59e0b;
}

.avatar-bg-0 { background: linear-gradient(135deg, #FF6B6B, #EE5253); }
.avatar-bg-1 { background: linear-gradient(135deg, #4834D4, #686DE0); }
.avatar-bg-2 { background: linear-gradient(135deg, #6AB04C, #BADC58); }
.avatar-bg-3 { background: linear-gradient(135deg, #F0932B, #FFBE76); }
.avatar-bg-4 { background: linear-gradient(135deg, #EB4D4B, #FF7979); }
.avatar-bg-5 { background: linear-gradient(135deg, #22A6B3, #7ED6DF); }
.avatar-bg-6 { background: linear-gradient(135deg, #BE2EDD, #E056FD); }
.avatar-bg-7 { background: linear-gradient(135deg, #4834D4, #686DE0); }

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html,
body {
    background: var(--bg);
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: #f1f5f9;
    min-height: 100vh;
    padding-bottom: 12rem;
    position: relative;
}

/* Subtle background glow */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: 
        radial-gradient(circle at 50% -20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
}

.z1 {
    position: relative;
    z-index: 1;
}

/* Typography */
.font-title {
    font-family: var(--font-title);
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Glassmorphism Refined */
.glass {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
}

.player-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.player-card.winning {
    border-color: rgba(16, 185, 129, 0.25);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(30, 41, 59, 0.4) 100%);
}

.player-card.losing {
    border-color: rgba(244, 63, 94, 0.15);
}

/* Badges */
.net-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.net-badge.winning {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.1);
}

.net-badge.losing {
    background: rgba(244, 63, 94, 0.1);
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.1);
}

.net-badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
}

/* Control Buttons */
.btn-quick {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    color: #94a3b8;
    font-size: 0.75rem;
    padding: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-quick:active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    transform: scale(0.95);
}

.btn-quick:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Action Buttons */
.btn-primary {
    width: 100%;
    background: #10b981;
    color: white;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    border: none;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-primary:hover:not(:disabled) {
    background: #059669;
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.4);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    color: #94a3b8;
    font-family: var(--font-title);
    font-weight: 600;
    padding: 1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-ghost:active {
    background: rgba(255, 255, 255, 0.06);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

/* Form Controls */
.input-group {
    position: relative;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group:focus-within {
    border-color: var(--em);
    box-shadow: 0 0 0 1px var(--em);
}

.input-transparent {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
    outline: none;
}

.input-transparent::placeholder {
    color: #475569;
}

.btn-add-inner {
    background: #10b981;
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 0.85rem;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-add-inner:active {
    transform: scale(0.95);
}

/* Player Card Refined Fields */
.field-block {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 1rem;
    padding: 0.75rem;
    flex: 1;
    transition: border-color 0.2s;
}

.field-block:focus-within {
    border-color: rgba(16, 185, 129, 0.3);
}

.lbl {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.5rem;
    display: block;
}

.input-num {
    background: transparent;
    border: none;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    width: 100%;
    outline: none;
    padding: 0;
}

.input-final {
    color: #10b981;
}

/* Bottom Dock Refined */
.dock {
    position: fixed;
    bottom: 1.5rem;
    left: 1rem;
    right: 1rem;
    max-width: 32rem;
    margin: 0 auto;
    border-radius: 2rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    z-index: 100;
}

/* Animations */
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.anim-entry {
    animation: fadeInScale 0.4s cubic-bezier(0.2, 0, 0, 1) both;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.tx-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.25rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-pay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-revolut { background: #FFFFFF; color: #000000; }

.spectator-only {
    pointer-events: none !important;
    opacity: 0.8;
}

.spectator-hidden {
    display: none !important;
}
.tx-card.paid {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.04);
    opacity: 0.9;
}
.check-box {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.check-box.checked {
    background: #10b981;
    border-color: #10b981;
}

.modal-backdrop {
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.modal-sheet {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -20px 50px rgba(0,0,0,0.6);
}

/* Small Alert Modal */
#alert-modal { background: rgba(2, 6, 23, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.alert-sheet {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#alert-modal:not(.hidden) .alert-sheet { transform: scale(1); }

/* Logo background in empty state */
#empty-logo {
    opacity: 0.1;
    filter: grayscale(1) invert(1);
    max-width: 120px;
    margin: 0 auto 2rem;
}

.hero-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    opacity: 0.15;
    background-image: url('../imagen1.png');
    background-size: cover;
    background-position: center;
    filter: blur(4px);
}

/* History Modal specific scrollbar */
#history-list::-webkit-scrollbar {
    width: 4px;
}
#history-list::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    border-radius: 10px;
}

/* Fast Add Glow Effects */
.fast-add-active .player-card {
    cursor: pointer;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.15);
}
.fast-add-active .player-card:not(.grayscale):hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.05);
    transform: translateY(-2px);
}
.fast-add-active .player-card:active {
    transform: scale(0.98);
}
.fast-add-active .input-num {
    pointer-events: none;
    opacity: 0.5;
}
.fast-add-active .btn-quick {
    pointer-events: none;
    opacity: 0.3;
}

.spectator-hidden { display: none !important; }
.spectator-only { display: block; }
body:not(.is-spectator) .spectator-only { display: none; }
