/* ── Tetris Launch Button ─────────────────────────────── */
#tetris-launch-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99998;
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Segoe UI', Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    letter-spacing: 0.5px;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 7px;
}
#tetris-launch-btn:hover { background: #c1121f; transform: scale(1.05); }
#tetris-launch-btn:active { transform: scale(0.97); }

/* ── Modal Overlay ────────────────────────────────────── */
#tetris-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 10, 20, 0.88);
    align-items: center;
    justify-content: center;
    animation: tetrisFadeIn 0.2s ease;
}
#tetris-overlay.active { display: flex; }

@keyframes tetrisFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Game Container ───────────────────────────────────── */
#tetris-container {
    background: #12122a;
    border-radius: 14px;
    padding: 20px 24px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    max-width: 95vw;
}

/* ── Header ───────────────────────────────────────────── */
#tetris-header {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}
#tetris-title {
    color: #e63946;
    font-size: 22px;
    font-weight: 800;
    font-family: 'Segoe UI', Arial, sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
}
#tetris-close-btn {
    background: none;
    border: 2px solid #444;
    border-radius: 6px;
    color: #aaa;
    font-size: 18px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
    line-height: 1;
}
#tetris-close-btn:hover { border-color: #e63946; color: #e63946; }

/* ── Game Body ────────────────────────────────────────── */
#tetris-body {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

/* ── Canvas ───────────────────────────────────────────── */
#tetris-canvas {
    border: 2px solid #2a2a4a;
    border-radius: 4px;
    display: block;
    background: #0a0a1a;
}

/* ── Side Panel ───────────────────────────────────────── */
#tetris-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 110px;
    color: #ccc;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.tetris-panel-box {
    background: #1a1a30;
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid #2a2a4a;
}
.tetris-panel-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    margin-bottom: 4px;
}
.tetris-panel-value {
    font-size: 22px;
    font-weight: 700;
    color: #e0e0ff;
}
#tetris-next-canvas {
    display: block;
    margin: 0 auto;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    background: #0a0a1a;
}
#tetris-level-val,
#tetris-lines-val {
    font-size: 18px;
    font-weight: 700;
    color: #e0e0ff;
}

/* ── Controls ─────────────────────────────────────────── */
#tetris-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    align-items: center;
}
.tetris-ctrl-row {
    display: flex;
    gap: 6px;
}
.tetris-btn {
    background: #1e1e3a;
    border: 1.5px solid #3a3a6a;
    border-radius: 7px;
    color: #c8c8ff;
    font-size: 18px;
    width: 46px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.tetris-btn:hover  { background: #2a2a55; border-color: #6060cc; }
.tetris-btn:active { background: #e63946; border-color: #e63946; transform: scale(0.93); }
.tetris-btn.wide   { width: 100px; font-size: 13px; font-weight: 600; letter-spacing: 0.5px; }

/* ── Start / Game-over overlay ────────────────────────── */
#tetris-message {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(18,18,42,0.96);
    border: 2px solid #e63946;
    border-radius: 12px;
    padding: 28px 36px;
    text-align: center;
    color: #fff;
    font-family: 'Segoe UI', Arial, sans-serif;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
    z-index: 10;
}
#tetris-message.hidden { opacity: 0; pointer-events: none; }
#tetris-msg-title {
    font-size: 24px;
    font-weight: 800;
    color: #e63946;
    margin-bottom: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
#tetris-msg-sub {
    font-size: 14px;
    color: #aaa;
}
