:root {
    --raspberry: #E27386;
    --pastel-pink: #E9A8B2;
    --petal-pink: #FFD1E5;
    --leaf-green: #60D971;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2f2a2a;
    background: linear-gradient(135deg, var(--petal-pink) 0%, var(--pastel-pink) 50%, var(--raspberry) 100%);
}

a {
    color: inherit;
}

header.app-header {
    width: 100%;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

header .logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 800;
    color: var(--raspberry);
    letter-spacing: 0.04em;
}

header .logo span {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: var(--petal-pink);
    color: #c03b5a;
    border-radius: 14px;
    font-size: 1.1rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.page-shell {
    display: grid;
    place-items: center;
    padding: 0 1rem 2rem;
}

.card {
    background: rgba(255, 255, 255, 0.92);
    width: min(720px, 94vw);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

h1, h2, h3 {
    margin-top: 0;
    color: var(--raspberry);
    letter-spacing: 0.04em;
}

p.subtitle {
    margin-top: -0.5rem;
    color: #5a4c4c;
}

form.grid-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: #3c3434;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--pastel-pink);
    border-radius: 14px;
    background: #fff;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--raspberry);
    box-shadow: 0 0 0 4px rgba(226, 115, 134, 0.2);
}

.button-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

button {
    border: none;
    cursor: pointer;
    padding: 0.9rem 1.6rem;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.3s ease;
}

button.primary {
    background: var(--leaf-green);
    color: #0f2f15;
    box-shadow: 0 10px 24px rgba(96, 217, 113, 0.35);
}

button.secondary {
    background: var(--pastel-pink);
    color: #4a2a31;
    box-shadow: 0 10px 24px rgba(233, 168, 178, 0.35);
}

button:hover { transform: translateY(-2px); }
button:active { transform: translateY(0); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 209, 229, 0.55);
    color: #50353b;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.95rem;
    margin-top: 1.5rem;
}

.badge span.marker {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    color: var(--raspberry);
    font-weight: 800;
}

footer.site-footer {
    margin-top: 1.75rem;
    text-align: center;
    color: #5e4e52;
    font-size: 0.95rem;
}

.board-wrapper {
    background: #fff;
    border-radius: 26px;
    padding: 1.25rem;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.12);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
}

@media (max-width: 820px) {
    .board-wrapper { grid-template-columns: 1fr; }
}

.scorecard {
    background: linear-gradient(135deg, rgba(226, 115, 134, 0.85), rgba(233, 168, 178, 0.9));
    color: #fff;
    padding: 1.25rem;
    border-radius: 18px;
    display: grid;
    gap: 0.9rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.scorecard h2 { margin: 0; letter-spacing: 0.03em; }

.player-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
}

.player-line strong {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.player-line span.marker {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: #fff;
    color: var(--raspberry);
    font-weight: 800;
}

.score {
    background: #fff;
    color: #2f2a2a;
    padding: 0.4rem 0.65rem;
    border-radius: 10px;
    min-width: 32px;
    text-align: center;
    font-weight: 800;
}

.status {
    background: #fff7fb;
    color: #3a2b2f;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 2px solid var(--petal-pink);
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(255, 209, 229, 0.35);
}

.current-player {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--pastel-pink);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}

.current-player .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background: var(--raspberry);
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: var(--pastel-pink);
    padding: 0.5rem;
    border-radius: 18px;
    box-shadow: inset 0 0 0 2px rgba(226, 115, 134, 0.35);
}

.cell {
    background: #fff;
    min-height: 120px;
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    border-radius: 14px;
    color: #3a2b2f;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.3s ease;
    border: none;
}

.cell:hover { transform: translateY(-2px); }
.cell:disabled { cursor: not-allowed; opacity: 0.65; transform: none; }
.cell.x { color: var(--raspberry); }
.cell.o { color: var(--leaf-green); }
.cell.win { background: #e9f9ec; box-shadow: inset 0 0 0 3px var(--leaf-green); }

.controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.controls button {
    color: #0f2f15;
    background: var(--leaf-green);
    box-shadow: 0 12px 26px rgba(96, 217, 113, 0.35);
}

.hint {
    font-size: 0.95rem;
    color: #4b3d42;
    background: #fff;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--petal-pink);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.06);
}

footer.game-footer {
    text-align: center;
    padding: 1rem 1.5rem 1.5rem;
    color: #5e4e52;
}