.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    margin: 20px auto;
    max-width: 520px;
    width: 95%;
}
.nav-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}
.nav-back:hover { color: var(--text-primary); }
.nav-title { font-size: 1.25rem; font-weight: 800; }

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
    padding: 0 20px;
    width: 100%;
}

.game-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.board-wrapper {
    position: relative;
    padding: 12px;
    flex-shrink: 0;
}

#game-canvas {
    display: block;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 110px;
    flex-shrink: 0;
}

.side-box {
    padding: 10px 14px;
    text-align: center;
}

.side-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.side-value {
    font-size: 1.3rem;
    font-weight: 800;
}

#next-canvas {
    display: block;
    margin: 0 auto;
    border-radius: 6px;
}

.control-panel {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-button {
    width: 58px;
    height: 58px;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.control-button:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}
.control-button:active { transform: scale(0.95); }

.key-hints {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 12px;
    text-align: center;
    opacity: 0.7;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 14px;
    text-align: center;
    padding: 24px;
}
.overlay.hidden { display: none; }

@media (max-width: 480px) {
    .game-layout { flex-direction: column; align-items: center; }
    .side-panel { flex-direction: row; width: auto; flex-wrap: wrap; justify-content: center; }
    .side-box { min-width: 70px; }
}
