:root {
    --primary: #c2185b;
    --primary-light: #e91e63;
    --primary-dark: #ad1457;
    --text: #1a1a1a;
    --text-light: #4a4a4a;
    --card: rgba(255, 255, 255, 0.84);
    --line: rgba(194, 24, 91, 0.18);
    --tooth: #ffffff;
    --brush: #ffe8f1;
}

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

body {
    min-height: 100vh;
    font-family: "Inter", sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    padding: 2rem 1rem 3rem;
    overflow-x: hidden;
}

.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(194, 24, 91, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary);
    letter-spacing: 0.5px;
}

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

[data-i18n],
.status {
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

body.language-changing [data-i18n],
body.language-changing .status {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    filter: blur(6px);
}

.bg-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(90px);
    opacity: 0.18;
    pointer-events: none;
    z-index: -1;
}

.bg-shape-1 {
    width: 560px;
    height: 560px;
    right: -220px;
    top: -220px;
    background: radial-gradient(circle, #c2185b 0%, #e91e63 58%, transparent 100%);
    animation: drift 18s ease-in-out infinite;
}

.bg-shape-2 {
    width: 460px;
    height: 460px;
    left: -180px;
    bottom: -160px;
    background: radial-gradient(circle, #ffb3ba 0%, #ffccd5 62%, transparent 100%);
    animation: drift 14s ease-in-out infinite reverse;
}

@keyframes drift {
    0%,
    100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-28px) translateX(18px);
    }
}

.page-shell {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    gap: 1.2rem;
}

.hero-card,
.game-card {
    background: var(--card);
    border: 1px solid rgba(194, 24, 91, 0.1);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(194, 24, 91, 0.12);
}

.hero-card {
    padding: 2rem 1.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lang-switch {
    display: inline-flex;
    align-self: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-family: "Inter", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.28rem 0.56rem;
    border-radius: 999px;
    cursor: pointer;
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
}

.eyebrow {
    color: var(--primary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.73rem;
    margin-bottom: 0.9rem;
}

h1,
h2 {
    font-family: "Cormorant Garamond", serif;
    color: var(--text);
    line-height: 1.08;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.3rem);
    margin-bottom: 0.8rem;
}

.hero-copy {
    color: var(--text-light);
    line-height: 1.7;
    max-width: 34ch;
    font-size: 1.03rem;
}

.game-card {
    padding: 1.3rem;
}

.game-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.game-top > div {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h2 {
    font-size: clamp(1.5rem, 2.8vw, 2rem);
    margin-bottom: 0.2rem;
    text-align: center;
}

.game-subtitle {
    color: var(--text-light);
    font-size: 0.88rem;
    text-align: center;
}

.status {
    margin: 0.95rem 0 0.85rem;
    min-height: 1.4rem;
    color: var(--primary-dark);
    font-weight: 600;
    text-align: center;
}

.board {
    --cell-size: min(5.9vw, 44px);
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size));
    grid-template-rows: repeat(10, var(--cell-size));
    gap: 4px;
    width: fit-content;
    margin-inline: auto;
    padding: 0.45rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 214, 230, 0.78));
    border-radius: 14px;
    border: 1px solid rgba(194, 24, 91, 0.18);
}

.cell {
    border: 1px solid rgba(194, 24, 91, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    font-size: clamp(0.92rem, 2.1vw, 1.16rem);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 150ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.cell:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #fff8fb;
    box-shadow: 0 6px 10px rgba(194, 24, 91, 0.14);
}

.cell:disabled {
    cursor: not-allowed;
    opacity: 1;
    color: inherit;
    -webkit-text-fill-color: currentColor;
}

.cell.player {
    background: #ffffff;
}

.cell.ai {
    background: #ffd6e6;
}

.cell.win {
    background: #ffd6e6;
    border-color: rgba(194, 24, 91, 0.5);
    box-shadow: inset 0 0 0 1px rgba(194, 24, 91, 0.5);
}

.symbol {
    transform: scale(0.5);
    opacity: 0;
    font-size: clamp(1.05rem, 2.5vw, 1.35rem);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
    animation: pop 160ms ease-out forwards;
}

@keyframes pop {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.controls {
    margin-top: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.62rem 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, opacity 140ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
}

@media (max-width: 960px) {
    .page-shell {
        grid-template-columns: 1fr;
    }

    .hero-card {
        padding: 1.4rem;
    }

    .game-card {
        padding: 1rem;
    }

    .board {
        --cell-size: min(8.4vw, 40px);
    }
}

@media (max-width: 450px) {
    body {
        padding: 1rem 0.55rem 1.4rem;
    }

    .board {
        --cell-size: min(8.2vw, 33px);
        gap: 3px;
    }

    .cell {
        border-radius: 8px;
    }
}
