*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: var(--font-md);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;

    /* Cheerful gradient background with polka dots */
    background-color: #d6eeff;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(255, 220, 100, 0.35) 0%, transparent 40%),
        radial-gradient(circle at 85% 15%, rgba(255, 160, 200, 0.30) 0%, transparent 35%),
        radial-gradient(circle at 70% 85%, rgba(120, 210, 255, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 30% 80%, rgba(160, 240, 160, 0.25) 0%, transparent 35%),
        radial-gradient(circle, rgba(255,255,255,0.55) 2px, transparent 2px),
        radial-gradient(circle, rgba(255,200,220,0.45) 2px, transparent 2px);
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 56px 56px, 80px 80px;
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 28px 40px;
    background-attachment: fixed;
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: var(--font-xxl); }
h2 { font-size: var(--font-xl); }
h3 { font-size: var(--font-lg); }

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    -webkit-tap-highlight-color: transparent;
}

.page {
    padding: var(--space-md);
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    min-height: 80vh;
}

.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }

.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: var(--space-lg);
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-size: var(--font-xl);
    color: var(--color-primary);
}

/* Page loading indicator */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border, #e0e0e0);
    border-top-color: var(--color-primary, #4A90D9);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-bar-safe-area {
    display: none;
}

#blazor-error-ui {
    background: var(--color-warning-light);
    bottom: 0;
    display: none;
    left: 0;
    padding: var(--space-md);
    position: fixed;
    width: 100%;
    z-index: 1000;
    text-align: center;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--space-md);
    top: var(--space-sm);
}
