@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --bg: #0a0c10;
    --surface: #141820;
    --surface-2: #1c2230;
    --border: #2a3344;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --orange: #f97316;
    --green: #22c55e;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --focus-ring: #818cf8;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
}

#particles-js {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.25;
    pointer-events: none;
}

.loja-wrap {
    position: relative;
    z-index: 1;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 12px 16px 20px;
}

/* Header — compacto para caber apps na mesma tela */
.loja-header {
    text-align: center;
    margin-bottom: 12px;
}

.loja-header .logo-icon {
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 4px;
}

.loja-header h1 {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 700;
    margin: 0 0 4px;
}

.loja-header p {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.35;
}

/* Barra de tutoriais */
.tutorial-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.tutorial-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: border-color 0.15s, transform 0.15s, background 0.15s;
    text-align: center;
    min-height: 72px;
}

.tutorial-btn i {
    font-size: 1.75rem;
    color: var(--accent);
}

.tutorial-btn small {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.8rem;
}

.tutorial-btn:hover,
.tutorial-btn.tv-focus {
    border-color: var(--focus-ring);
    background: var(--surface-2);
    transform: scale(1.02);
    outline: none;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.35);
}

.tutorial-btn[data-device="android"] i { color: #3ddc84; }
.tutorial-btn[data-device="tvbox"] i { color: var(--orange); }
.tutorial-btn[data-device="firestick"] i { color: #ff9900; }

/* Grid de apps */
.apps-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Até 5 apps na mesma linha (TV 1080p+) */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(var(--app-count, 5), minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.app-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: border-color 0.15s, transform 0.15s;
    min-width: 0;
}

.app-card.tv-focus,
.app-card:focus-within {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.35);
    transform: scale(1.02);
}

/* Ícone grande no topo — principal referência visual */
.app-icon-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 8px;
    padding: 6px;
}

.app-icon-wrap img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.app-meta {
    text-align: center;
    margin-bottom: 8px;
}

.app-meta h2 {
    font-size: clamp(0.75rem, 1.1vw, 0.95rem);
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Avaliação estilo Play Store */
.app-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 4px;
}

.app-rating .rating-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
}

.app-rating .rating-stars {
    color: #fbbf24;
    font-size: 0.62rem;
    letter-spacing: 1px;
}

.app-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--muted);
}

.app-meta .downloads i { color: var(--accent); margin-right: 2px; }

.app-stats .stat-divider {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.6;
}

.app-meta .size-badge {
    font-size: 0.66rem;
    color: var(--muted);
}

.app-meta .age-badge {
    font-size: 0.6rem;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    padding: 1px 6px;
    border-radius: 4px;
}

/* Código Downloader em destaque */
.codigo-destaque {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}

.codigo-destaque .label {
    font-size: 0.65rem;
    color: var(--muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.codigo-destaque .label i { color: var(--orange); }

.codigo-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.codigo-valor {
    flex: 1;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    font-weight: 700;
    letter-spacing: 1px;
    color: #fdba74;
    text-align: center;
    min-width: 0;
    word-break: break-all;
}

.btn-copy-mini {
    flex-shrink: 0;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-copy-mini.orange { background: var(--orange); }

.btn-link-copy {
    background: var(--surface-2) !important;
    border: 1px solid var(--border);
    color: var(--muted) !important;
    padding: 8px !important;
    font-size: 0.72rem !important;
    margin-top: 4px;
}

.btn-action {
    border: none;
    border-radius: 8px;
    padding: 9px 10px;
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    color: #fff;
}

.btn-action.tv-focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.5);
    transform: scale(1.03);
}

.btn-download { background: var(--accent); margin-bottom: 0; }
.btn-download:hover { background: var(--accent-hover); color: #fff; }

/* Sobre este app — estilo listagem oficial */
.about-app {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    text-align: left;
}

.about-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.about-text {
    font-size: 0.66rem;
    line-height: 1.4;
    color: var(--muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Selo Play Protect */
.play-protect {
    margin-top: auto;
    padding-top: 8px;
    font-size: 0.62rem;
    color: #86efac;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.play-protect i { color: #22c55e; }

/* Footer */
.loja-footer {
    text-align: center;
    padding: 12px 0 0;
    margin-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.loja-footer .badge-verified {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Modal tutorial */
.tutorial-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.88);
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.tutorial-modal.open { display: flex; }

.tutorial-panel {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    max-width: 720px;
    width: 100%;
    margin: 20px auto 40px;
    padding: 28px 24px 24px;
    position: relative;
}

.tutorial-panel h2 {
    font-size: 1.35rem;
    margin: 0 48px 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tutorial-panel .subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.tutorial-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 1.25rem;
    cursor: pointer;
}

.tutorial-close.tv-focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.4);
}

.tutorial-steps { min-height: 200px; }

.tutorial-step {
    display: none;
}

.tutorial-step.active { display: block; }

.tutorial-step .step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    font-weight: 700;
    margin-bottom: 12px;
}

.tutorial-step h3 {
    font-size: 1.15rem;
    margin: 0 0 12px;
    color: #c7d2fe;
}

.tutorial-step .step-body {
    font-size: 1rem;
    line-height: 1.7;
    color: #cbd5e1;
}

.tutorial-step .step-body strong { color: #fff; }

.tutorial-step .alert-box {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 10px;
    padding: 14px;
    margin-top: 16px;
    font-size: 0.9rem;
}

.tutorial-step .alert-box.warn {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.4);
}

.tutorial-step .remote-hint {
    margin-top: 16px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--muted);
}

.tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    gap: 12px;
}

.tutorial-nav button {
    background: var(--surface-2);
    border: 2px solid var(--border);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 120px;
}

.tutorial-nav button.primary {
    background: var(--accent);
    border-color: var(--accent);
}

.tutorial-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tutorial-nav button.tv-focus:not(:disabled) {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.4);
}

.step-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex: 1;
}

.step-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}

.step-dots span.active { background: var(--accent); }

.tv-focus-global {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.45) !important;
}

@media (min-width: 1600px) {
    .loja-wrap { padding: 14px 24px 20px; }
}

/* Tablet/celular deitado: no máx. 3 por linha para não espremer demais */
@media (max-width: 900px) {
    .apps-grid {
        grid-template-columns: repeat(min(var(--app-count, 3), 3), minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .tutorial-bar { grid-template-columns: 1fr; }
    .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
    .apps-grid { grid-template-columns: 1fr; }
}
