/* Pips - Mobile & Touch Styles */

/* ========== SETUP SCREEN ========== */

.setup-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 32px;
}

.setup-container .logo {
    font-size: 48px;
}

.setup-prompt {
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
}

.user-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.user-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--accent);
    padding: 20px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.user-btn:hover {
    background: var(--accent);
}

.user-btn:active {
    transform: scale(0.98);
}

/* ========== HOME SCREEN ========== */

.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 24px;
    overflow-y: auto;
}

.history-section {
    flex: 1;
}

.history-section h2 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.history-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.history-item:active {
    transform: scale(0.98);
}

.history-thumbnail {
    margin-bottom: 8px;
}

.history-info {
    text-align: center;
}

.history-time {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--success);
}

.history-status {
    font-size: 12px;
    color: var(--warning);
}

.no-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.new-puzzle-btn {
    width: 100%;
    max-width: 300px;
    align-self: center;
}

/* ========== DRAGGING STATE ========== */

/* Prevent all scrolling and selection during drag */
.dragging-active {
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overflow: hidden;
}

.dragging-active * {
    user-select: none;
    -webkit-user-select: none;
}

/* Prevent tray scrolling during drag */
.dragging-active .domino-tray {
    overflow: hidden;
    pointer-events: none;
}

/* ========== TOUCH FEEDBACK ========== */

@media (hover: none) {
    .user-btn:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .action-btn:hover:not(:disabled),
    .back-btn:hover,
    .history-item:hover {
        background: inherit;
        transform: none;
        box-shadow: none;
    }

    .user-btn:active,
    .btn-primary:active,
    .history-item:active {
        transform: scale(0.98);
    }
}

/* ========== SAFE AREA INSETS ========== */

@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }

    .action-bar {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .setup-container {
        padding-top: calc(24px + env(safe-area-inset-top));
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* ========== LANDSCAPE ========== */

@media (orientation: landscape) and (max-height: 500px) {
    .game-content {
        flex-direction: row;
    }

    .board-container {
        flex: 2;
    }

    .tray-container {
        flex: 1;
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    .domino-tray {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        height: 100%;
    }

    .action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
}

/* ========== SMALL SCREENS ========== */

@media (max-width: 360px) {
    .domino.in-tray {
        width: 64px;
        height: 32px;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .constraint-label {
        font-size: 8px;
        padding: 0 2px;
    }
}
