/* Tic-Tac-Toe — Game Anything shell */

@media screen and (max-height: 640px) {
    .container.container-single {
        padding-top: 3px !important;
    }
}

#gamebox {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-sizing: border-box;
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        'Segoe UI',
        Roboto,
        'Helvetica Neue',
        Arial,
        sans-serif;
    font-size: 15px;
    font-variant: tabular-nums;
    line-height: 1.45;
    font-feature-settings: 'tnum';
    color: #e2e8f0;
    text-align: center;
    background: linear-gradient(165deg, #0f1419 0%, #0a0d10 55%, #080a0c 100%);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 24px 48px rgba(0, 0, 0, 0.45);
}

#gamebox .header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 6px;
    padding: 14px 12px 16px;
    background: rgba(0, 0, 0, 0.22);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#gamebox .header .player {
    float: none;
    width: auto;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 10px 6px 8px;
    border-radius: 12px;
    transition:
        background 0.2s ease,
        box-shadow 0.2s ease;
}

#gamebox .header .player__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

#gamebox .header .player__avatar img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#gamebox .header .player__label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.95);
    line-height: 1.2;
}

#gamebox .header .player__score {
    display: block;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

#gamebox .header .player.protected {
    color: #f87171;
}

#gamebox .header .player.protected .player__label {
    color: rgba(248, 113, 113, 0.85);
}

#gamebox .header .player.protected .player__score {
    color: #fca5a5;
}

#gamebox .header .player.private {
    color: #38bdf8;
}

#gamebox .header .player.private .player__score {
    color: #7dd3fc;
}

#gamebox .header .player.private .player__label {
    display: none;
}

#gamebox .header .player.active {
    background: rgba(255, 255, 255, 0.04);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 20px rgba(56, 189, 248, 0.06);
}

#gamebox .header .player.protected.active {
    box-shadow:
        inset 0 0 0 1px rgba(248, 113, 113, 0.35),
        0 0 24px rgba(248, 113, 113, 0.12);
    background: rgba(248, 113, 113, 0.06);
}

#gamebox .header .player.private.active {
    box-shadow:
        inset 0 0 0 1px rgba(56, 189, 248, 0.35),
        0 0 24px rgba(56, 189, 248, 0.1);
    background: rgba(56, 189, 248, 0.06);
}

#gamebox .header .player.active .player__avatar {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

#gamebox .header .player.protected.active .player__avatar {
    border-color: rgba(248, 113, 113, 0.4);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.2);
}

#gamebox .header .player.private.active .player__avatar {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
}

#gamebox .header .player select,
#gamebox .header .player .player__select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    max-width: 118px;
    margin: 0;
    padding: 7px 26px 7px 10px;
    font-size: 9px;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    text-align-last: center;
    color: #bae6fd;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    background-color: rgba(15, 23, 42, 0.75);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237dd3fc' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 11px;
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease;
}

#gamebox .header .player select:hover:not(:disabled),
#gamebox .header .player .player__select:hover:not(:disabled) {
    border-color: rgba(125, 211, 252, 0.55);
    background-color: rgba(30, 41, 59, 0.9);
}

#gamebox .header .player select:focus,
#gamebox .header .player .player__select:focus {
    outline: none;
    border-color: rgba(125, 211, 252, 0.75);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

#gamebox .header .player select:disabled,
#gamebox .header .player .player__select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#gamebox .board {
    position: relative;
    width: 100%;
    max-width: 372px;
    margin: 0 auto;
    padding: 18px 16px 22px;
    box-sizing: border-box;
}

#gamebox .board .row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 8px;
}

#gamebox .board .row:last-of-type {
    margin-bottom: 0;
}

#gamebox .board .cell {
    display: flex;
    width: clamp(84px, 23vw, 104px);
    height: clamp(84px, 23vw, 104px);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(148, 163, 184, 0.35);
    background: linear-gradient(180deg, rgba(51, 65, 85, 0.65) 0%, rgba(30, 41, 59, 0.9) 100%);
    border: 1px solid rgba(100, 116, 139, 0.35);
    border-radius: 12px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition:
        transform 0.15s ease,
        background 0.2s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

#gamebox .board .cell:not(.private):not(.protected):hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, rgba(71, 85, 105, 0.75) 0%, rgba(51, 65, 85, 0.95) 100%);
    border-color: rgba(34, 211, 238, 0.28);
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(34, 211, 238, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#gamebox .board .cell.private {
    color: #fff;
    background: linear-gradient(145deg, #0ea5e9 0%, #0369a1 100%);
    border-color: rgba(14, 165, 233, 0.45);
    box-shadow:
        0 2px 8px rgba(14, 165, 233, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

#gamebox .board .cell.protected {
    color: #fff;
    background: linear-gradient(145deg, #f87171 0%, #dc2626 100%);
    border-color: rgba(248, 113, 113, 0.45);
    box-shadow:
        0 2px 8px rgba(239, 68, 68, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

#gamebox .board .cell img {
    opacity: 0.98;
    width: 60%;
    height: 60%;
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

#gamebox .board .alert {
    position: absolute;
    z-index: 2;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    color: #f8fafc;
    display: none;
    background: rgba(8, 10, 12, 0.92);
    backdrop-filter: blur(6px);
    border-radius: 4px;
}

#gamebox .board .alert.WIN,
#gamebox .board .alert.LOSS,
#gamebox .board .alert.TIE {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

#gamebox .board .alert .message {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -0.01em;
    padding: 0 16px;
    max-width: 260px;
}

#gamebox .board .alert .action {
    margin-top: 0;
    padding: 10px 22px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    color: #0f172a;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition:
        transform 0.12s ease,
        filter 0.12s ease;
}

#gamebox .board .alert .action:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

#gamebox .board .alert .action:active {
    transform: translateY(0);
}

@media (min-width: 400px) {
    #gamebox {
        max-width: 430px;
    }

    #gamebox .board .cell {
        width: 108px;
        height: 108px;
    }

    #gamebox .board .cell img {
        max-width: 68px;
        max-height: 68px;
    }
}

@media (min-width: 520px) {
    #gamebox .board .cell {
        width: 116px;
        height: 116px;
    }

    #gamebox .board .cell img {
        max-width: 74px;
        max-height: 74px;
    }
}

/* Game Worlds: same play column height as sky-shooter.css #gamebox */
.game-worlds-play-shell {
    background:
        radial-gradient(ellipse 130% 90% at 50% 45%, rgba(0, 242, 255, 0.045) 0%, transparent 52%),
        radial-gradient(ellipse 85% 100% at 0% 50%, rgba(8, 12, 20, 0.92) 0%, transparent 58%),
        radial-gradient(ellipse 85% 100% at 100% 50%, rgba(8, 12, 20, 0.92) 0%, transparent 58%),
        linear-gradient(165deg, #05070c 0%, #0c1118 42%, #080b10 100%);
}

.game-worlds-play-shell #gamebox {
    flex: 0 0 auto;
    height: calc(768px * 5 / 7);
    max-height: calc(768px * 5 / 7);
    min-height: 0;
    max-width: min(430px, 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-worlds-play-shell #gamebox #app {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-worlds-play-shell #gamebox .board {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 12px 14px 14px;
    justify-content: center;
}

.game-worlds-play-shell #gamebox .board .row {
    gap: 8px;
    margin-bottom: 8px;
}

.game-worlds-play-shell #gamebox .board .row:last-of-type {
    margin-bottom: 0;
}

.game-worlds-play-shell #gamebox .board .cell {
    width: 104px;
    height: 104px;
}

.game-worlds-play-shell #gamebox .board .cell img {
    max-width: 64px;
    max-height: 64px;
}
