/* === M3 Custom Design System === */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
a { text-decoration: none; color: inherit; }
@font-face {
    font-family: 'Google Sans Flex';
    font-style: normal;
    font-weight: 100 900;
    src: local('Google Sans Flex'), local('Google Sans');
}

:root {
    --m3-background: #141218;
    --m3-on-background: #e6e0e9;
    --m3-primary: #b0c6ff;
    --m3-on-primary: #152e60;
    --m3-primary-container: #2e4578;
    --m3-on-primary-container: #d9e2ff;
    --m3-secondary-container: #404659;
    --m3-on-secondary-container: #dce2f9;
    --m3-surface-variant: #49454f;
    --m3-on-surface-variant: #c5c6d0;
    --m3-error: #FF5A5F;
    --m3-success: #00C853;

    --font-main: "Google Sans Flex", "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --border-radius-card: 1.75rem;
    --border-radius-btn: 6.25rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
    scrollbar-width: thin;
    scrollbar-color: #404659 transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: transparent;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #404659;
    border-radius: 10px;
}

body {
    font-family: var(--font-main);
    background-color: var(--m3-background);
    color: var(--m3-on-background);
    overflow: hidden;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 26rem;
    margin: 0 auto;
}

.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    width: 100%;
}
.screen.active {
    display: flex;
}

/* === HEADER (App Bar) === */
.app-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0.2rem;
    height: 3rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.btn-icon {
    background: transparent;
    border: none;
    width: 2rem;
    height: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #e6e0e9;
}

.app-title {
    font-size: 1.375rem;
    font-weight: 400;
    flex: 1;
    text-align: center;
}

.app-avatar {
    width: 3rem;
    height: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
}
.app-avatar-fallback {
    font-size: 28px;
    color: var(--m3-on-background);
    opacity: 0.85;
}

/* === ESTATÍSTICAS / STATUS === */
.game-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.stat-live {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--m3-primary);
    font-size: 1rem;
    font-weight: 500;
}

.stat-live .material-symbols-rounded {
    font-size: 1.5rem;
}

/* === POINTS EARNED === */
.points-earned {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    flex-wrap: wrap;
}

.points-text {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    color: #1d192b;
}

.points-badge {
    background-color: #baaefe;
    border-radius: 0.3125rem;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    color: #1d192b;
}

.points-badge .material-symbols-rounded {
    font-size: 1.125rem;
}

.points-value {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

/* === RANKING CTA === */
.ranking-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(90deg, #ffdeb0 0%, #fba6a4 100%);
    border-radius: var(--border-radius-btn);
    border: none;
    color: #152e60;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
    touch-action: manipulation;
}

.ranking-cta:active {
    transform: scale(0.98);
}

.ranking-cta[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.ranking-cta .material-symbols-rounded {
    font-size: 1.25rem;
}

/* === COMPONENTES GERAIS === */
.progress-container {
    width: 100%;
    padding: 0 1rem;
    margin-bottom: 0.4rem;
}

.m3-linear-progress {
    height: 8px;
    width: 100%;
    background-color: var(--m3-secondary-container);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin: 0.5rem 0;
}

.m3-linear-progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--m3-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* === SELECTION SCREEN === */
.selection-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.selection-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--m3-primary);
    text-align: center;
    line-height: 1.5rem;
    letter-spacing: 0;
}

.btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.btn-pill {
    border: 1px solid var(--m3-on-secondary-container);
    background: transparent;
    color: var(--m3-on-secondary-container);
    border-radius: var(--border-radius-btn);
    padding: 1rem 0.75rem;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.15px;
    line-height: 1.5rem;
    min-height: 3.5rem;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
    touch-action: manipulation;
}

.btn-pill:active { transform: scale(0.96); }

.btn-pill.selected {
    background-color: #D8E3F8;
    color: #3C4759;
    border-color: transparent;
}

/* === FOOTER CTA === */
.footer-m3 {
    padding: clamp(0.5rem, 2vh, 1rem) 1rem;
    padding-bottom: calc(clamp(0.5rem, 2vh, 1rem) + env(safe-area-inset-bottom));
    width: 100%;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.btn-action-m3 {
    width: 100%;
    height: clamp(2.75rem, 7vh, 3.5rem);
    border-radius: var(--border-radius-btn);
    background-color: var(--m3-primary);
    color: var(--m3-on-primary);
    border: none;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, opacity 0.2s;
    touch-action: manipulation;
}

.btn-action-m3 .material-symbols-rounded { font-size: 1.25rem; }
.btn-action-m3:active:not(:disabled) { transform: scale(0.98); }

.btn-action-m3:disabled {
    background-color: #293042;
    color: #404659;
    cursor: not-allowed;
}

.btn-action-m3:disabled .material-symbols-rounded { color: #404659; }

.btn-action-m3.btn-secondary {
    background-color: var(--m3-secondary-container);
    color: var(--m3-on-secondary-container);
}

.btn-text-ghost {
    background: transparent;
    border: none;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    color: var(--m3-on-surface-variant);
    cursor: pointer;
    padding: 0.5rem;
    touch-action: manipulation;
    transition: opacity 0.2s;
}

.btn-text-ghost:active { opacity: 0.6; }
