:root {
    color-scheme: light;
    --primary-color: #2563eb;
    --primary-strong: #1d4ed8;
    --secondary-color: #10b981;
    --secondary-strong: #059669;
    --text-color: #172033;
    --muted-color: #64748b;
    --highlight-color: #f97316;
    --danger-color: #ef4444;
    --surface-color: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --background-color: #f7fbff;
    --grid-border-color: #0f172a;
    --tile-color: #f97316;
    --tile-text-color: #ffffff;
    --feedback-black: #1f2937;
    --feedback-white: #e5e7eb;
    --dent-color: #cbd5e1;
    --shadow-soft: 0 24px 80px rgba(37, 99, 235, 0.16);
    --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.14);
    --radius-lg: 28px;
    --radius-md: 18px;
    --animation-speed: 28s;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--background-color);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--text-color);
    font-family: var(--font-family, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    line-height: 1.55;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    background:
        radial-gradient(circle at 15% 12%, rgba(96, 165, 250, 0.34), transparent 28rem),
        radial-gradient(circle at 88% 8%, rgba(16, 185, 129, 0.22), transparent 24rem),
        radial-gradient(circle at 70% 86%, rgba(249, 115, 22, 0.16), transparent 24rem),
        linear-gradient(135deg, #f8fbff 0%, #edf6ff 48%, #f7fff8 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.055) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 80%);
}

h1 {
    color: var(--text-color);
    font-size: clamp(1.55rem, 4vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
    margin: 0 0 0.45rem;
}

button,
select,
input {
    font: inherit;
}

button,
select,
.btn {
    border: 0;
    border-radius: 999px;
    min-height: 44px;
    padding: 0.72rem 1rem;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
    touch-action: manipulation;
}

select {
    appearance: none;
    padding-right: 2.35rem;
    background-image:
        linear-gradient(135deg, var(--primary-color), var(--primary-strong)),
        linear-gradient(45deg, transparent 50%, white 50%),
        linear-gradient(135deg, white 50%, transparent 50%);
    background-position: 0 0, calc(100% - 1.1rem) 50%, calc(100% - 0.8rem) 50%;
    background-size: 100% 100%, 0.38rem 0.38rem, 0.38rem 0.38rem;
    background-repeat: no-repeat;
}

button:hover,
select:hover,
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
    filter: saturate(1.05);
}

button:active,
.btn:active {
    transform: translateY(0) scale(0.98);
}

button:focus-visible,
select:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(249, 115, 22, 0.75);
    outline-offset: 3px;
}

.language-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem;
    margin-bottom: 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22);
    backdrop-filter: blur(16px);
}

.language-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 34px;
    padding: 0.3rem 0.55rem;
    color: var(--muted-color);
    background: transparent;
    box-shadow: none;
    border: none;
    cursor: pointer;
    font-size: 0.92rem;
    opacity: 0.78;
}

.language-btn:hover,
.language-btn.active {
    color: var(--primary-strong);
    opacity: 1;
    transform: translateY(-1px);
    text-shadow: none;
    background: rgba(37, 99, 235, 0.08);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.game-toolbar {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    width: min(100%, 900px);
    margin: 0 auto 0.9rem;
    padding: 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(18px);
}

.game-toolbar__home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    color: var(--primary-strong);
    text-decoration: none;
    font-weight: 800;
    background: rgba(37, 99, 235, 0.08);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.game-toolbar__home:hover {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
}

.game-toolbar__select {
    min-height: 40px;
    max-width: min(270px, 100%);
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: 0.92rem;
}

.game-toolbar__select--language {
    max-width: min(210px, 100%);
}

.release-tag {
    position: fixed;
    bottom: max(10px, env(safe-area-inset-bottom));
    right: max(10px, env(safe-area-inset-right));
    z-index: 1000;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--muted-color);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.release-notes {
    display: none;
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 42px);
    z-index: 1000;
    max-width: min(340px, calc(100vw - 24px));
    padding: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: var(--radius-md);
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(18px);
    font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 520px) {
    body {
        justify-content: flex-start;
        padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    }

    .release-tag {
        display: none;
    }

    .game-toolbar {
        position: static;
        align-items: stretch;
        width: 100%;
        margin-bottom: 0.55rem;
        padding: 0.45rem;
        border-radius: 22px;
        gap: 0.4rem;
    }

    .game-toolbar__home,
    .game-toolbar__select {
        flex: 1 1 100%;
        width: 100%;
    }
}
