:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --font-main: 'Outfit', sans-serif;
    --glass-border: rgba(255, 255, 255, 0.1);
    --transition-fast: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

.app-header {
    text-align: center;
    padding: 20px 0 40px;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism Card Style */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Base UI Elements */
button {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    transform: scale(0.98);
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

button:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    border-color: rgba(255, 255, 255, 0.05) !important;
    background: rgba(0, 0, 0, 0.2) !important;
}

/* Scroller */
.scroller-container {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 20px 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.scroller-container:active {
    cursor: grabbing;
}

.scroller-container::-webkit-scrollbar {
    display: none;
}

.scroller-item {
    flex: 0 0 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    font-size: 2rem;
    font-weight: 800;
    cursor: pointer;
    scroll-snap-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.scroller-item:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(30, 41, 59, 0.9);
}

.scroller-item.selected {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.6);
    z-index: 10;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 10px;
    /* padding to prevent scale clipping */
    max-height: 350px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.category-grid::-webkit-scrollbar {
    width: 4px;
}

.category-grid::-webkit-scrollbar-track {
    background: transparent;
}

.category-grid::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}

.category-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

.category-grid .btn-outline {
    height: 100px;
    width: 100%;
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 800;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background: var(--card-bg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 10px;
}

.category-grid .btn-outline:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(30, 41, 59, 0.9);
}

.category-grid .btn-outline.selected {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.6);
}

/* Loader */
.loader-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    gap: 20px;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Animations for screen transitions */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lightbox / Reveal Overlay */
.reveal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
}

.reveal-overlay h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.reveal-overlay p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Player Grid */
.player-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 10px;
}

.player-btn {
    aspect-ratio: 1 / 1;
    height: auto;
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--card-bg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-btn:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(30, 41, 59, 0.9);
}

.player-btn.revealed {
    opacity: 0.3;
    pointer-events: none;
    border-color: transparent;
}

/* Custom Confirm Dialog */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: all 0.3s ease;
    opacity: 0;
}

.confirm-overlay.visible {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
}

.confirm-dialog {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.15);
    transform: scale(0.85) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-overlay.visible .confirm-dialog {
    transform: scale(1) translateY(0);
}

.confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.confirm-message {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 28px;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
}

.confirm-buttons button {
    flex: 1;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
}

.confirm-cancel {
    border: 1px solid var(--glass-border) !important;
}

.confirm-cancel:active {
    background: rgba(255, 255, 255, 0.05) !important;
}

.confirm-ok:active {
    transform: scale(0.97);
    background: var(--primary-hover) !important;
}