/* PizzaCream Tetris Game — Frontend Styles */

/* =====================
   Floating Button
   ===================== */

.pct-toggle-btn {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.pct-toggle-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.7);
}

.pct-toggle-btn:active {
    transform: translateY(0) scale(0.97);
}

.pct-icon-game {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.pct-btn-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =====================
   Overlay / Modal
   ===================== */

.pct-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 8, 20, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pct-overlay.pct-open {
    opacity: 1;
    pointer-events: all;
}

.pct-modal {
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 0;
    width: 480px;
    max-width: 98vw;
    box-shadow:
        0 30px 80px rgba(0,0,0,0.7),
        0 0 0 1px rgba(255,255,255,0.04),
        inset 0 1px 0 rgba(255,255,255,0.08);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
    overflow: hidden;
}

.pct-overlay.pct-open .pct-modal {
    transform: scale(1) translateY(0);
}

/* =====================
   Header
   ===================== */

.pct-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(90deg, rgba(102,126,234,0.3) 0%, rgba(118,75,162,0.3) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.pct-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(102,126,234,0.8);
}

.pct-close-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.pct-close-btn:hover {
    background: rgba(255,80,80,0.25);
    color: #ff6b6b;
    border-color: rgba(255,80,80,0.4);
}

/* =====================
   Game Area
   ===================== */

.pct-game-area {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    padding: 16px 16px 10px;
}

/* =====================
   Panels (left/right)
   ===================== */

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

.pct-panel-left { padding-right: 10px; }
.pct-panel-right { padding-left: 10px; }

.pct-stat-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.pct-stat-label {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.pct-stat-value {
    font-family: 'Courier New', monospace;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 12px rgba(102,126,234,0.8);
    line-height: 1.1;
    word-break: break-all;
}

/* Next piece canvas */
#pct-next {
    display: block;
    margin: 6px auto 0;
}

/* Controls card */
.pct-controls {
    padding: 8px 6px;
}

.pct-key-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin: 6px 0 4px;
}

.pct-key-row {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.pct-key {
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: rgba(255,255,255,0.7);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pct-key-wide {
    width: 50px;
    font-size: 8px;
    letter-spacing: 0.5px;
}

.pct-key-labels {
    font-size: 8px;
    color: rgba(255,255,255,0.35);
    line-height: 1.7;
}

.pct-btn-pause {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    border-radius: 8px;
    padding: 7px 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: background 0.2s, color 0.2s;
    width: 100%;
}

.pct-btn-pause:hover {
    background: rgba(102,126,234,0.2);
    color: #a5b4fc;
}

/* =====================
   Board canvas wrapper
   ===================== */

.pct-canvas-wrap {
    position: relative;
    flex-shrink: 0;
}

#pct-board {
    display: block;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.08);
    box-shadow:
        0 0 40px rgba(102,126,234,0.2),
        inset 0 0 60px rgba(0,0,0,0.4);
    background: #0a0a1a;
}

/* =====================
   Game Over Screen
   ===================== */

.pct-gameover {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 20, 0.92);
    backdrop-filter: blur(4px);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pct-fadein 0.4s ease;
}

.pct-hidden {
    display: none !important;
}

.pct-gameover-content {
    text-align: center;
    color: #fff;
}

.pct-gameover-title {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255,80,80,0.7);
    margin-bottom: 10px;
}

.pct-gameover-score {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 20px;
}

.pct-gameover-score span {
    color: #a5b4fc;
    font-weight: 700;
    font-size: 18px;
}

/* =====================
   Start Screen
   ===================== */

.pct-startscreen {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(10,8,20,0.97) 0%, rgba(15,52,96,0.97) 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pct-startscreen-content {
    text-align: center;
    color: #fff;
    padding: 10px;
}

.pct-start-title {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 6px;
    background: linear-gradient(135deg, #667eea, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    text-shadow: none;
}

.pct-start-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.pct-controls-hint {
    margin-top: 18px;
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    line-height: 2;
}

/* =====================
   Buttons
   ===================== */

.pct-btn-restart,
.pct-btn-start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 32px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102,126,234,0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}

.pct-btn-restart:hover,
.pct-btn-start:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 30px rgba(102,126,234,0.7);
}

/* =====================
   Mobile Controls
   ===================== */

.pct-mobile-controls {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px 16px;
}

.pct-mob-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.pct-mob-btn {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    color: rgba(255,255,255,0.8);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.pct-mob-btn:active {
    background: rgba(102,126,234,0.3);
}

.pct-mob-drop {
    font-size: 13px;
}

.pct-mob-down {
    width: 52px;
    height: 52px;
}

/* =====================
   Animations
   ===================== */

@keyframes pct-fadein {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pct-lineclear {
    0%   { opacity: 1; }
    50%  { opacity: 0.2; background: #fff; }
    100% { opacity: 0; }
}

/* =====================
   Responsive
   ===================== */

@media (max-width: 520px) {
    .pct-modal {
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
    }

    .pct-overlay {
        align-items: flex-end;
    }

    .pct-game-area {
        gap: 0;
        padding: 12px 8px 6px;
    }

    .pct-panel {
        width: 72px;
    }

    .pct-panel-left { padding-right: 6px; }
    .pct-panel-right { padding-left: 6px; }

    .pct-stat-value {
        font-size: 17px;
    }

    .pct-mobile-controls {
        display: flex;
    }

    .pct-controls {
        display: none;
    }
}

@media (max-width: 380px) {
    #pct-board {
        width: 160px !important;
        height: 320px !important;
    }

    .pct-panel {
        width: 62px;
    }
}
