/* Triangle Match — viewport-adaptive 3x3 board */

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

#tmPlayShell.game-worlds-play-shell {
    min-height: 0;
    box-sizing: border-box;
    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%);
}

#tmPlayShell.game-worlds-play-shell:not([data-tri-sized]) {
    height: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
}

#tmPlayShell .tri-outer-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.game-worlds-body #tmPlayShell #gamebox.tri-gamebox,
#tmPlayShell #gamebox.tri-gamebox,
#tmPlayShell .tri-gamebox#gamebox {
    --tri-cell: 120px;
    --tri-gap-x: 80px;
    --tri-gap-y: 24px;
    --tri-board-w: calc(var(--tri-cell) * 3 + var(--tri-gap-x) * 2);
    --tri-board-h: calc(var(--tri-cell) * 3 + var(--tri-gap-y) * 2);
    --tri-scale: 1;
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
    background-color: #161c1c;
    border: 2px solid #313131;
}

#tmPlayShell #game-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 16px;
    box-sizing: border-box;
    font-size: 24px;
    color: #fff;
}

#tmPlayShell #score,
#tmPlayShell #time,
#tmPlayShell #timer {
    position: static;
    float: none;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
    text-align: left;
}

#tmPlayShell #scorev,
#tmPlayShell #timer {
    color: red;
    font-weight: bold;
}

#tmPlayShell .tri-playfield {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
}

#tmPlayShell #game-board.grid {
    display: grid;
    grid-template-columns: repeat(3, var(--tri-cell));
    grid-template-rows: repeat(3, var(--tri-cell));
    gap: var(--tri-gap-y) var(--tri-gap-x);
    width: var(--tri-board-w);
    height: var(--tri-board-h);
    margin: 0;
    align-items: center;
    justify-items: center;
}

#tmPlayShell .triangle {
    width: 0;
    height: 0;
    border-style: solid;
    border-left: 27px solid transparent;
    border-right: 63px solid transparent;
    border-bottom: 90px solid cornflowerblue;
    cursor: pointer;
    transform-origin: center;
    transform: scale(var(--tri-scale, 1));
    transition: filter 0.2s ease;
}

#tmPlayShell .highlighted {
    border-color: red;
}

#tmPlayShell #gameover {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(22, 28, 28, 0.95);
    z-index: 2;
}

#tmPlayShell #gameover p.msg {
    font-family: Arial, sans-serif;
    font-size: 36px;
    color: grey;
    margin: min(150px, 18%) auto 0;
    text-align: center;
}

#tmPlayShell #restart {
    display: block;
    margin: 36px auto;
    width: 120px;
    padding: 6px;
    background-color: #00BB00;
    font-family: Arial, sans-serif;
    font-size: 24px;
    color: red;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
}

#tmPlayShell #restart:hover {
    background-color: #9f8b77;
}
