/* Reset Mobile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    background: #f5f7fa;
    color: #333;
    line-height: 1.5;
    height: 100%;
    overflow-x: hidden;
}

/* Container Principal como App */
.app-form-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Header do Formulário */
.form-header-app {
    background: linear-gradient(135deg, #209869 0%, #1a7a56 100%);
    color: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(32, 152, 105, 0.2);
    margin-bottom: 5px;
}

.form-header-app h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-header-app .subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* Abas de Navegação */
.form-tabs-app {
    display: flex;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 15px;
}

.tab-app {
    flex: 1;
    padding: 15px 10px;
    text-align: center;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.tab-app.active {
    color: #209869;
}

.tab-app.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: #209869;
    border-radius: 3px 3px 0 0;
}

/* Cards de Formulário */
.form-card-app {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 15px;
    animation: fadeInUp 0.4s ease-out;
}

.form-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #209869;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.form-card-title .icon {
    width: 24px;
    height: 24px;
    background: #209869;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

/* Grupos de Formulário */
.form-group-app {
    margin-bottom: 20px;
}

.form-label-app {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding-left: 5px;
}

.form-input-app {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    transition: all 0.3s;
}

.form-input-app:focus {
    outline: none;
    border-color: #209869;
    box-shadow: 0 0 0 3px rgba(32, 152, 105, 0.1);
}

.form-select-app {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 16px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center;
    background-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Botões */
.btn-app {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    margin-bottom: 10px;
}

.btn-app-primary {
    background: linear-gradient(135deg, #209869 0%, #1a7a56 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(32, 152, 105, 0.3);
}

.btn-app-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(32, 152, 105, 0.3);
}

.btn-app-secondary {
    background: #6c757d;
    color: white;
}

.btn-app-danger {
    background: #dc3545;
    color: white;
}

.btn-app-success {
    background: #28a745;
    color: white;
}

/* Botões Pequenos (inline) */
.btn-small-app {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    gap: 6px;
}

.btn-small-primary {
    background: #209869;
    color: white;
}

.form-row-app {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.form-input-grow {
    flex: 1;
    min-width: 0;
}

/* Grid de Números Mobile */
.numero-grid-mobile {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 15px 0;
}

@media (max-width: 360px) {
    .numero-grid-mobile {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
}

.numero-item-mobile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.numero-item-mobile.numero-item-disabled {
    cursor: not-allowed;
    opacity: 0.45;
    filter: grayscale(0.4);
}

.numero-checkbox-mobile {
    display: none;
}

.numero-label-mobile {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    background: #e8e8e8;
    color: #333;
    border-radius: 50%;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.numero-checkbox-mobile:disabled+.numero-label-mobile {
    background: #f2f2f2;
    color: #999;
    border-color: #ddd;
    box-shadow: none;
    transform: none;
}

.numero-checkbox-mobile:checked+.numero-label-mobile {
    background: #209869;
    color: white;
    border-color: #209869;
    box-shadow: 0 4px 8px rgba(32, 152, 105, 0.3);
    transform: scale(1.1);
}

.numero-checkbox-mobile:checked.fixo+.numero-label-mobile {
    background: #dc3545;
    border-color: #dc3545;
}

.fixo-indicator-mobile {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s;
}

.numero-checkbox-mobile.fixo:checked+.numero-label-mobile+.fixo-indicator-mobile {
    opacity: 1;
    transform: scale(1);
}

/* Contadores e Estatísticas */
.stats-grid-app {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.stat-card-app {
    background: white;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.stat-value-app {
    font-size: 24px;
    font-weight: 700;
    color: #209869;
    margin: 5px 0;
}

.stat-label-app {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-sub-app {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* Barra de Progresso */
.progress-container-app {
    margin: 15px 0;
}

.progress-bar-app {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill-app {
    height: 100%;
    background: linear-gradient(90deg, #209869 0%, #1a7a56 100%);
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-info-app {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
}

/* Modal Mobile */
.modal-overlay-app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay-app.active {
    opacity: 1;
    visibility: visible;
}

.modal-content-app {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay-app.active .modal-content-app {
    transform: translateY(0);
}

.modal-header-app {
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 16px 16px 0 0;
}

.modal-title-app {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.modal-body-app {
    padding: 20px;
}

.modal-footer-app {
    padding: 20px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
}

.modal-close-app {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* Quick Actions */
.quick-actions-app {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}

.quick-btn-app {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.quick-btn-app:active {
    background: #e9ecef;
    transform: scale(0.98);
}

/* Input com Slider */
.input-with-slider-app {
    position: relative;
    width: 100%;
}

.range-slider-app {
    width: 100%;
    height: 6px;
    margin: 15px 0;
    -webkit-appearance: none;
    appearance: none;
    background: #e8e8e8;
    border-radius: 3px;
    outline: none;
}

.range-slider-app::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #209869;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.range-slider-app::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #209869;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Status Text */
.status-text-app {
    text-align: center;
    font-size: 14px;
    color: #666;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 15px 0;
}

/* Animações */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.pulse-animation {
    animation: pulse 0.3s ease-in-out;
}

/* Ajustes para tablets (mantém visual “app”) */
@media (min-width: 768px) and (max-width: 899px) {
    body {
        background: linear-gradient(135deg, #f8f9fa 0%, #e8e8e8 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        padding: 20px;
    }

    .app-form-container {
        max-width: 400px;
        background: #f5f7fa;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        padding: 20px;
    }
}

/* Desktop: grade consistente, mais respiro e melhor leitura */
@media (min-width: 900px) {
    body {
        background: linear-gradient(135deg, #f8f9fa 0%, #e8e8e8 100%);
        display: block;
        min-height: 100vh;
        padding: 24px;
    }

    .app-form-container {
        max-width: 980px;
        margin: 0 auto;
        padding: 0;
        gap: 18px;
    }

    .form-header-app {
        padding: 18px 20px;
        border-radius: 14px;
    }

    .form-header-app h1 {
        font-size: 24px;
    }

    .form-tabs-app {
        margin-bottom: 8px;
    }

    /* 2 colunas: Configurações (esquerda) + Números (direita) */
    #form-jogos-mobile {
        display: grid;
        grid-template-columns: minmax(360px, 420px) 1fr;
        gap: 18px;
    }

    #form-jogos-mobile>.form-card-app {
        margin-bottom: 0;
    }

    .form-card-app {
        padding: 22px;
        border-radius: 14px;
    }

    .form-card-title {
        font-size: 19px;
        margin-bottom: 16px;
    }

    .form-group-app {
        margin-bottom: 18px;
    }

    .form-label-app {
        font-size: 14px;
    }

    .form-input-app,
    .form-select-app {
        padding: 12px 14px;
        font-size: 15px;
    }

    .numero-grid-mobile {
        grid-template-columns: repeat(10, 1fr);
        gap: 10px;
        margin: 12px 0;
    }

    .numero-label-mobile {
        font-size: 14px;
    }

    .numero-checkbox-mobile:checked+.numero-label-mobile {
        transform: scale(1.05);
    }

    .quick-btn-app {
        min-width: 0;
    }
}

/* Estados de interação (desktop): hover/focus claros */
@media (hover: hover) {
    .tab-app:hover {
        background: #f8f9fa;
        color: #333;
    }

    .btn-app:hover {
        filter: brightness(1.03);
        transform: translateY(-1px);
    }

    .btn-small-app:hover {
        filter: brightness(1.03);
    }

    .quick-btn-app:hover {
        background: #eef2f7;
    }

    .numero-item-mobile:hover .numero-label-mobile {
        border-color: rgba(32, 152, 105, 0.35);
    }
}

:where(button, a, input, select, textarea, .tab-app, .btn-app, .quick-btn-app, .btn-small-app):focus-visible {
    outline: 3px solid rgba(32, 152, 105, 0.45);
    outline-offset: 2px;
}

/* Estados de Erro */
.error-app {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.input-error-app {
    border-color: #dc3545 !important;
    background: #fff5f5;
}

/* Loading State */
.loading-app {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading-app::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #209869;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Suporte a PWA */
@media (display-mode: standalone) {
    .app-form-container {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}