/* Root CSS Variables for Theming */
:root {
    --sand-light: #f7ebc8;
    --sand-medium: #eed9b3;
    --sand-dark: #d8b98a;
    --ocean-navy: #0119B9;
    --ocean-light: #00d4ff;
    --ocean-cyan: #00f3ff;
    --action-red: #ff3b30;
    --action-red-hover: #ff4f45;
    --action-red-active: #c30010;
    --action-red-edge: #9e000c;
    --font-primary: 'Chillax', sans-serif;
    --font-display: 'Chillax', sans-serif;
    --glow-color: rgba(0, 243, 255, 0.4);
    --screen-width: 380px;
    --screen-height: 780px;
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-primary);
    background: #0119B9; /* Solid blue background */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: #1a2530;
}

/* App Wrapper for centering and presentation */
.app-wrapper {
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Glassmorphism Phone Frame */
.mobile-screen {
    width: 90vw;
    max-width: var(--screen-width);
    height: 90vh;
    max-height: var(--screen-height);
    min-height: 540px;
    background: linear-gradient(135deg, var(--sand-light), var(--sand-medium));
    border-radius: 44px;
    border: 8px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.3),
        inset 0 -4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1;
}



/* Magical Particles Canvas */
.particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Header styling */
.header {
    width: 100%;
    padding: 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.logo-container {
    max-width: 120px;
    display: flex;
    align-items: center;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05) rotate(-2deg);
}

.logo {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--ocean-navy);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1) translateY(-2px);
}

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

.sound-icon.hidden {
    display: none;
}

/* Card Viewport / Playing Board */
.card-viewport {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 5;
    padding-bottom: 20px;
}

/* 2D Modern Card Display */
.card-display {
    width: min(220px, 58vw);
    height: auto;
    aspect-ratio: 2 / 3;
    position: relative;
    border-radius: 24px;
    outline: 6px solid #ffffff;
    outline-offset: 0;
    background: #ffffff;
    box-shadow: 
        0 16px 36px rgba(0, 0, 0, 0.28),
        0 4px 12px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
    z-index: 5;
    will-change: transform;
}

.card-display:hover {
    transform: scale(1.04) translateY(-4px);
    box-shadow: 
        0 22px 42px rgba(0, 0, 0, 0.32),
        0 6px 16px rgba(0, 0, 0, 0.15);
}

.card-display:active {
    transform: scale(0.96) translateY(0);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 24px;
    pointer-events: none;
}

/* 2D Ultra-smooth Slide & Fade Animation for Drawing */
.card-display.animate-card-draw {
    animation: cardSlideFade 0.32s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes cardSlideFade {
    0% {
        opacity: 0.3;
        transform: translateY(-22px) scale(0.96);
    }
    60% {
        opacity: 1;
        transform: translateY(4px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 3-Second Chillax Countdown Overlay */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(1, 25, 185, 0.55);
    backdrop-filter: blur(6px);
    border-radius: 24px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.countdown-overlay.active {
    opacity: 1;
}

.countdown-overlay.hidden {
    display: none;
}

.countdown-number {
    font-family: 'Chillax', sans-serif;
    font-size: 72px;
    font-weight: 700;
    color: #F6E2C0;
    text-shadow: 
        0 0 20px rgba(246, 226, 192, 0.8),
        0 0 40px rgba(0, 243, 255, 0.5);
    line-height: 1;
    user-select: none;
}

.countdown-number.animate-tick {
    animation: countdownTick 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes countdownTick {
    0% {
        transform: scale(0.4);
        opacity: 0.2;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* Action Viewport / Button Container */
.action-viewport {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 40px;
    z-index: 10;
}

/* Custom 3D Action Button (Compact size, Chillax font, #0119B9 bg, #F6E2C0 text, gradient bottom stroke) */
.custom-action-btn {
    position: relative;
    width: min(230px, 62vw);
    height: 56px;
    border: none;
    background: transparent;
    cursor: pointer;
    outline: none;
    padding: 0;
    user-select: none;
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Bottom stroke layer with gradient from #0119B9 to #000B53 */
.btn-stroke-bottom {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 26px;
    background: linear-gradient(180deg, #0119B9 0%, #000B53 100%);
    /* Normal state: 6px stroke weight */
    transform: translateY(6px);
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Button front surface (#0119B9 background with Chillax font & #F6E2C0 text) */
.btn-body-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 26px;
    background: #0119B9;
    color: #F6E2C0;
    font-family: 'Chillax', sans-serif;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    letter-spacing: 0.5px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25);
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), text-shadow 0.22s ease;
}

/* HOVER STATE: 9px stroke weight + soft beige drop shadow on text */
.custom-action-btn:hover .btn-stroke-bottom {
    transform: translateY(9px);
}

.custom-action-btn:hover .btn-body-surface {
    transform: translateY(-2px);
    text-shadow: 
        0 0 12px rgba(246, 226, 192, 0.6),
        0 0 24px rgba(246, 226, 192, 0.35);
}

/* PRESS / ACTIVE STATE: 3px stroke weight */
.custom-action-btn:active .btn-stroke-bottom {
    transform: translateY(3px);
}

.custom-action-btn:active .btn-body-surface {
    transform: translateY(3px);
    text-shadow: 0 0 4px rgba(246, 226, 192, 0.3);
}

/* Fullscreen Onboarding Intro Overlay */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(1, 25, 185, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1), transform 0.35s ease;
    padding: 16px;
}

.intro-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.03);
}

.intro-modal {
    background: linear-gradient(135deg, var(--sand-light) 0%, var(--sand-medium) 100%);
    border: 4px solid #ffffff;
    width: 100%;
    max-width: 360px;
    max-height: 88vh;
    border-radius: 32px;
    padding: 24px 20px 16px 20px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.intro-header {
    text-align: center;
    margin-bottom: 14px;
}

.intro-logo {
    max-width: 80px;
    height: auto;
    margin: 0 auto 6px auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.intro-title {
    font-family: 'Chillax', sans-serif;
    color: var(--ocean-navy);
    font-size: 20px;
    font-weight: 600; /* Chillax SemiBold */
    margin-bottom: 4px;
}

.intro-subtitle {
    font-family: 'Chillax', sans-serif;
    font-size: 12px;
    font-weight: 400; /* Chillax Regular */
    color: #4a5d6e;
    line-height: 1.35;
}

.intro-cards-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom Scrollbar for rules list */
.intro-cards-list::-webkit-scrollbar {
    width: 4px;
}
.intro-cards-list::-webkit-scrollbar-thumb {
    background: rgba(1, 25, 185, 0.25);
    border-radius: 10px;
}

.intro-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 8px 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}



.intro-card-thumb {
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.intro-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.intro-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.intro-card-title {
    font-family: 'Chillax', sans-serif;
    font-weight: 600; /* Chillax SemiBold */
    font-size: 14px;
    color: var(--ocean-navy);
}

.intro-card-title.rasbord {
    color: var(--action-red);
}

.intro-card-badge {
    font-family: 'Chillax', sans-serif;
    font-weight: 600; /* Chillax SemiBold */
    font-size: 13px;
    color: var(--ocean-navy);
}

.intro-card-badge.rasbord {
    color: var(--action-red);
}

.intro-card-penalty {
    font-family: 'Chillax', sans-serif;
    font-size: 11px;
    font-weight: 600; /* Chillax SemiBold */
    background: rgba(1, 25, 185, 0.1);
    color: var(--ocean-navy);
    padding: 2px 7px;
    border-radius: 10px;
}

.intro-card-penalty.danger {
    background: rgba(255, 59, 48, 0.15);
    color: var(--action-red-active);
}

.intro-card-desc {
    font-family: 'Chillax', sans-serif;
    font-size: 12px;
    font-weight: 400; /* Chillax Regular */
    color: #2c3e50;
    line-height: 1.35;
}

.intro-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 4px;
}

.intro-btn {
    width: 100% !important;
    height: 48px !important;
    aspect-ratio: auto !important;
}

.intro-btn .btn-body-surface {
    font-size: 18px !important;
    border-radius: 20px !important;
}

.intro-btn .btn-stroke-bottom {
    border-radius: 20px !important;
}

.close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(1, 25, 185, 0.1);
    border: none;
    color: var(--ocean-navy);
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(1, 25, 185, 0.25);
}

.modal h2 {
    font-family: var(--font-display);
    color: var(--ocean-navy);
    font-size: 20px;
    margin-bottom: 16px;
    border-bottom: 2px solid rgba(1, 25, 185, 0.15);
    padding-bottom: 8px;
}

.rules-body ul {
    list-style: none;
    margin: 16px 0;
}

.rules-body li {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
}

.rules-body li::before {
    content: "";
    flex-shrink: 0;
}

.modal-tip {
    font-size: 12px;
    color: #556775;
    background: rgba(255, 255, 255, 0.4);
    padding: 8px 12px;
    border-radius: 12px;
    border-left: 3px solid var(--ocean-navy);
}
