.tetris-body {
    min-height: 100dvh;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #0f172a;
    color: #e2e8f0;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.tetris-app {
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
}

.tetris-top {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.tetris-back {
    align-self: flex-start;
    margin: 0;
}

.tetris-hint {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(30, 41, 59, .9);
    border: 1px solid rgba(148, 163, 184, .25);
    font-size: .75rem;
    line-height: 1.6;
    text-align: right;
}

.tetris-hint strong {
    color: #fbbf24;
}

.tetris-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.tetris-stat {
    background: rgba(30, 41, 59, .85);
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 10px;
    padding: 6px 8px;
    text-align: center;
}

.tetris-stat span {
    display: block;
    font-size: .625rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.tetris-stat strong {
    font-size: 1rem;
    color: #fbbf24;
}

.tetris-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tetris-play {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: min(72dvh, calc(100dvh - 200px));
}

.tetris-board-wrap {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tetris-canvas {
    display: block;
    border: 3px solid #334155;
    border-radius: 8px;
    background: #020617;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
    max-width: 100%;
    max-height: 100%;
    touch-action: none;
}

.tetris-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, .78);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.tetris-overlay[hidden] {
    display: none;
}

.tetris-overlay h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    color: #fbbf24;
}

.tetris-overlay p {
    margin: 0 0 14px;
    font-size: .875rem;
    line-height: 1.7;
    color: #cbd5e1;
}

.tetris-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 700;
    cursor: pointer;
    background: #fbbf24;
    color: #0f172a;
    touch-action: manipulation;
}

.tetris-btn--ghost {
    background: rgba(148, 163, 184, .2);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, .35);
}

.tetris-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.tetris-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 88px;
}

.tetris-controls-desktop {
    display: none;
    font-size: .75rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.6;
    margin-top: 4px;
}

.tetris-controls-mobile {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 44px);
    gap: 6px;
    width: 100%;
}

.tetris-control-btn {
    min-height: 0;
    height: 100%;
    border: none;
    border-radius: 12px;
    background: rgba(51, 65, 85, .95);
    color: #f8fafc;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tetris-control-btn:active {
    background: #fbbf24;
    color: #0f172a;
}

.tetris-control-btn--wide {
    grid-column: 1 / -1;
    min-height: 42px;
}

.tetris-control-btn--rotate {
    font-size: 1.25rem;
}

@media (min-width: 768px) {
    .tetris-app {
        max-width: 480px;
        margin: 0 auto;
        padding-inline: 16px;
    }

    .tetris-hint {
        font-size: .8125rem;
        padding: 10px 12px;
    }

    .tetris-stat {
        padding: 8px 10px;
    }

    .tetris-stat span {
        font-size: .6875rem;
    }

    .tetris-stat strong {
        font-size: 1.125rem;
    }

    .tetris-play {
        flex-direction: column;
        align-items: center;
        min-height: min(78dvh, calc(100dvh - 180px));
    }

    .tetris-controls {
        width: 100%;
        max-width: 360px;
    }

    .tetris-controls-desktop {
        display: block;
    }

    .tetris-controls-mobile {
        display: none;
    }
}
