/* ========================================
   Five Crowns - Mobile Card Game Styles
   Purple & Gold Theme
   ======================================== */

/* CSS Variables - Five Crowns Color Palette */
:root {
    /* Purple Palette */
    --primary-purple: #7B3FF2;
    --deep-purple: #5B2FB2;
    --dark-purple: #4A2976;
    --darker-purple: #2D1950;
    --light-purple: #9D6FFF;

    /* Gold Palette */
    --royal-gold: #FFD700;
    --gold-accent: #F59E0B;
    --gold-light: #FEF3C7;

    /* Card Suits */
    --suit-black: #000000;
    --suit-red: #DC2626;
    --suit-gold: #FFD700;

    /* UI Colors */
    --white: #FFFFFF;
    --light-gray: #F3F4F6;
    --gray: #9CA3AF;
    --dark-gray: #4B5563;
    --error-red: #EF4444;
    --success-green: #10B981;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);
    --glow-gold: 0 0 20px rgba(255, 215, 0, 0.5);
    --glow-purple: 0 0 20px rgba(123, 63, 242, 0.5);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--dark-purple) 0%, var(--darker-purple) 100%);
    color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Container */
.container {
    max-width: 480px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
    box-sizing: border-box;
    padding: 0 10px;
}

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

/* Logo Section */
.logo-section {
    margin-bottom: 60px;
}

.game-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--white);
    text-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.crown-icon {
    display: inline-block;
    font-size: 48px;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--royal-gold));
}

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

.tagline {
    font-size: 16px;
    color: var(--gold-accent);
    font-weight: 500;
    margin-bottom: 20px;
}

.suits-display {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 36px;
    margin-top: 20px;
}

.suit {
    display: inline-block;
    transition: transform 0.3s ease;
    filter: drop-shadow(var(--shadow-md));
}

.suit:hover {
    transform: scale(1.2) rotate(10deg);
}

.suit.spade, .suit.club {
    color: var(--suit-black);
    text-shadow: 0 0 8px var(--white);
}

.suit.heart, .suit.diamond {
    color: var(--suit-red);
    text-shadow: 0 0 8px var(--suit-red);
}

.suit.star {
    color: var(--suit-gold);
    text-shadow: 0 0 12px var(--royal-gold);
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Menu Section */
.menu-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

/* Buttons */
.btn {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 600;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-large {
    width: 100%;
    min-height: 64px;
    font-size: 20px;
}

.btn-primary {
    background: var(--primary-purple);
    color: var(--white);
    border: 2px solid var(--light-purple);
}

.btn-primary:hover {
    background: var(--deep-purple);
    box-shadow: var(--shadow-lg), var(--glow-purple);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--royal-gold);
    color: var(--darker-purple);
    border: 2px solid var(--gold-accent);
}

.btn-secondary:hover {
    background: var(--gold-accent);
    box-shadow: var(--shadow-lg), var(--glow-gold);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 24px;
}

/* Footer Section */
.footer-section {
    margin-top: 20px;
}

.link-text {
    color: var(--light-purple);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 8px 16px;
}

.link-text:hover {
    color: var(--royal-gold);
    text-shadow: var(--glow-gold);
    transform: scale(1.05);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--dark-purple) 0%, var(--darker-purple) 100%);
    border: 3px solid var(--primary-purple);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-xl), var(--glow-purple);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 2px solid var(--primary-purple);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--white);
}

.close-btn {
    background: none;
    border: none;
    color: var(--light-purple);
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--royal-gold);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px 24px;
}

.modal-instruction {
    font-size: 16px;
    color: var(--light-purple);
    margin-bottom: 20px;
    font-weight: 500;
}

.game-code-input {
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 48px;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    border: 3px solid var(--primary-purple);
    border-radius: 12px;
    background: var(--darker-purple);
    color: var(--royal-gold);
    outline: none;
    letter-spacing: 12px;
    transition: all 0.3s ease;
}

.game-code-input:focus {
    border-color: var(--royal-gold);
    box-shadow: var(--glow-gold);
}

.game-code-input::placeholder {
    color: var(--gray);
}

.player-name-input {
    width: 100%;
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding: 16px 20px;
    border: 3px solid var(--primary-purple);
    border-radius: 12px;
    background: var(--darker-purple);
    color: var(--white);
    outline: none;
    transition: all 0.3s ease;
}

.player-name-input:focus {
    border-color: var(--royal-gold);
    box-shadow: var(--glow-gold);
}

.player-name-input::placeholder {
    color: var(--gray);
}

.error-message {
    color: var(--error-red);
    font-size: 14px;
    margin-top: 12px;
    min-height: 20px;
    font-weight: 500;
}

.modal-footer {
    padding: 0 24px 24px 24px;
}

.modal-footer .btn {
    width: 100%;
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 0 8px;
    }

    .game-title {
        font-size: 36px;
    }

    .crown-icon {
        font-size: 36px;
    }

    .suits-display {
        font-size: 28px;
        gap: 12px;
    }

    .btn-large {
        font-size: 18px;
        min-height: 56px;
    }

    .btn {
        padding: 14px 24px;
        font-size: 16px;
    }

    .game-code-input {
        font-size: 40px;
        letter-spacing: 8px;
        padding: 16px;
    }

    .player-name-input {
        font-size: 20px;
        padding: 14px 16px;
    }

    .modal-content {
        width: 95%;
    }
}

@media (max-width: 360px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 0 6px;
    }

    .game-title {
        font-size: 30px;
    }

    .crown-icon {
        font-size: 30px;
    }

    .suits-display {
        font-size: 24px;
        gap: 10px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    .btn-large {
        font-size: 16px;
        min-height: 52px;
    }

    .game-code-input {
        font-size: 36px;
        letter-spacing: 6px;
        padding: 14px;
    }

    .player-name-input {
        font-size: 18px;
        padding: 12px 14px;
    }

    .modal-body {
        padding: 24px 16px;
    }

    .modal-header {
        padding: 16px 18px;
    }

    .modal-header h2 {
        font-size: 20px;
    }
}

@media (max-width: 320px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 0 4px;
    }

    .game-title {
        font-size: 26px;
    }

    .crown-icon {
        font-size: 26px;
    }

    .tagline {
        font-size: 14px;
    }

    .suits-display {
        font-size: 22px;
        gap: 8px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-large {
        font-size: 15px;
        min-height: 48px;
    }

    .game-code-input {
        font-size: 32px;
        letter-spacing: 4px;
        padding: 12px;
    }

    .player-name-input {
        font-size: 16px;
        padding: 10px 12px;
    }

    .modal-content {
        width: 96%;
    }

    .modal-body {
        padding: 20px 12px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h2 {
        font-size: 18px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 56px;
    }

    .link-text {
        padding: 12px 20px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
