* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Vibrant, playful colors for kindergarten */
    --primary-pink: #FF6B9D;
    --primary-purple: #9B59B6;
    --primary-blue: #3498DB;
    --primary-yellow: #F1C40F;
    --primary-green: #2ECC71;
    --primary-orange: #E67E22;

    /* Gradients */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --card-gradient: linear-gradient(145deg, #ffffff 0%, #f8f9ff 100%);
    --slot-bg: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --lever-gradient: linear-gradient(135deg, #ff6b9d 0%, #fbbf24 50%, #ff6b9d 100%);
    --lever-hover: linear-gradient(135deg, #ff85b1 0%, #fcd34d 50%, #ff85b1 100%);

    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(102, 126, 234, 0.25);
    --shadow-strong: 0 8px 40px rgba(102, 126, 234, 0.35);
    --shadow-glow: 0 0 30px rgba(167, 139, 250, 0.4);

    /* Slot specific - increased for 3 Chinese characters */
    --slot-width: min(180px, 30vw);
    --slot-font-size: clamp(1.75rem, 5vw, 2.25rem);

    /* Chinese Medium Gothic Font */
    --font-chinese: 'Noto Sans TC', '微軟正黑體', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
}

body {
    font-family: var(--font-chinese);
    font-weight: 500;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-x: hidden;
}

/* Floating particles animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 30%);
    pointer-events: none;
    z-index: 0;
}

/* Main Container */
.container {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Game Card - Glassmorphism */
.game-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 2rem;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b9d, #fbbf24, #2ecc71, #3498db, #9b59b6);
}

/* Title */
.game-title {
    text-align: center;
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.game-title .emoji {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
    -webkit-text-fill-color: initial;
}

/* Slot Machine Container */
.slot-machine {
    background: var(--slot-bg);
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow:
        var(--shadow-glow),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    position: relative;
}

.slot-machine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: 24px;
    pointer-events: none;
}

/* Slots Container - Horizontal layout */
.slots-container {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Individual Slot - Fixed width for 3 characters */
.slot {
    background: white;
    border-radius: 16px;
    width: var(--slot-width);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    padding: 0.75rem 0.5rem;
    transition: transform 0.2s ease;
}

.slot:hover {
    transform: translateY(-2px);
}

.slot-label {
    font-size: clamp(0.6rem, 2vw, 0.75rem);
    font-weight: 600;
    color: #8b5cf6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    white-space: nowrap;
}

/* Slot Value - 3 characters max, no wrap */
.slot-value {
    font-size: var(--slot-font-size);
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 4px;
}

/* Spinning Animation */
.slot.spinning .slot-value {
    animation: slotSpin 0.08s linear infinite;
}

@keyframes slotSpin {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    50% {
        transform: translateY(-8px);
        opacity: 0.3;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Result Animation */
.slot.result .slot-value {
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Lever Button */
.lever-container {
    text-align: center;
    position: relative;
    z-index: 1;
}

.lever-button {
    background: var(--lever-gradient);
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2.5rem;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 700;
    font-family: var(--font-chinese);
    cursor: pointer;
    box-shadow:
        0 6px 20px rgba(255, 107, 157, 0.4),
        0 2px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 180px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lever-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.lever-button:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    box-shadow:
        0 12px 32px rgba(255, 107, 157, 0.5),
        0 4px 0 rgba(0, 0, 0, 0.1);
    background: var(--lever-hover);
}

.lever-button:hover:not(:disabled)::before {
    left: 100%;
}

.lever-button:active:not(:disabled) {
    transform: translateY(2px) scale(0.98);
    box-shadow:
        0 2px 8px rgba(255, 107, 157, 0.4),
        0 1px 0 rgba(0, 0, 0, 0.1);
}

.lever-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.5;
    }
}

/* Admin Link */
.admin-link-container {
    text-align: center;
    margin-top: 1.5rem;
}

.admin-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.admin-link:hover {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

/* Bounce Animation */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-6px) rotate(-5deg);
    }

    75% {
        transform: translateY(-3px) rotate(5deg);
    }
}

/* ===== LOGIN PAGE STYLES ===== */
.login-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 2rem;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-width: 400px;
    width: 100%;
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #9b59b6, #ff6b9d);
    border-radius: 32px 32px 0 0;
}

.login-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3498db 0%, #9b59b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: var(--font-chinese);
    transition: all 0.3s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.submit-button {
    width: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-chinese);
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.submit-button:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.submit-button:active {
    transform: translateY(0);
}

.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    padding: 0.875rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
    border: 1px solid #fecaca;
}

.success-message {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
    padding: 0.875rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
    border: 1px solid #bbf7d0;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: #8b5cf6;
}

/* ===== ADMIN PANEL STYLES ===== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-title {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logout-button {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-chinese);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-button:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
}

.edit-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.section-hint {
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.form-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.875rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: var(--font-chinese);
    resize: vertical;
    transition: all 0.3s;
    background: white;
}

.form-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
    :root {
        --slot-width: min(100px, 26vw);
        --slot-font-size: clamp(1.25rem, 4.5vw, 1.75rem);
    }

    .game-card,
    .login-card {
        padding: 1.25rem;
        border-radius: 24px;
    }

    .slot-machine {
        padding: 1rem;
        border-radius: 20px;
    }

    .slots-container {
        gap: 0.5rem;
    }

    .slot {
        min-height: 80px;
        padding: 0.5rem 0.25rem;
        border-radius: 12px;
    }

    .lever-button {
        padding: 0.875rem 1.5rem;
        min-width: 150px;
        font-size: 1.1rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --slot-width: min(120px, 27vw);
    }
}

/* Touch optimizations */
@media (hover: none) and (pointer: coarse) {

    .lever-button,
    .submit-button,
    .logout-button {
        min-height: 56px;
    }

    .form-input,
    .form-textarea {
        font-size: 16px;
    }

    .slot {
        min-height: 90px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}