:root {
    --bg-main: #0b0c10;
    --bg-panel: #16161e;
    --bg-input: #1f1f2e;
    --text-main: #ffffff;
    --text-muted: #888893;
    --f1-red: #e10600;
    --danger: #ef4444;
    --neon-blue: #38bdf8;
    --neon-green: #10b981;
    --ovr-orange: #f59e0b; 
    --ovr-orange-dark: #d97706;
    --border-color: #262633;
    
    --font-main: 'Titillium Web', sans-serif;
    --font-tech: 'Orbitron', sans-serif;
    --font-serif: 'Instrument Serif', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg-main); color: var(--text-main); font-family: var(--font-main); -webkit-font-smoothing: antialiased; }

.font-tech { font-family: var(--font-tech); text-transform: uppercase; }
.font-serif { font-family: var(--font-serif); }
.font-main { font-family: var(--font-main); }
.italic-num { font-style: italic; font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger) !important; font-weight: 700; }
.text-neon { color: var(--neon-blue) !important; font-weight: 700; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background-color: var(--bg-main); display: flex; flex-direction: column; overflow-x: hidden; position: relative; }
.screen { display: none; flex: 1; flex-direction: column; padding-bottom: 80px; }
.screen.active { display: flex; }
.step { display: none; flex-direction: column; padding: 20px; }
.step.active { display: flex; }

/* HEADER GLOBAL */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; background: #1a1a1a; }
.app-logo-mini { background-color: var(--text-main); -webkit-mask: url('assets/F1-Logo.svg') no-repeat center / contain; mask: url('assets/F1-Logo.svg') no-repeat center / contain; width: 20px; height: 18px; display: inline-block; }
.app-title { font-size: 1.2rem; font-weight: 700; letter-spacing: 2px; flex: 1; text-align: center; }
.app-user-icon { font-size: 1.2rem; }

/* ETAPAS COMUNS */
.step-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 10px; }
.progress-bar { height: 6px; background-color: var(--bg-panel); border-radius: 3px; overflow: hidden; margin-bottom: 20px; }
.progress-bar .fill { height: 100%; background-color: var(--f1-red); transition: width 0.3s ease; }
.subtitle-text { font-size: 0.9rem; margin-bottom: 20px; }

/* STEP 1 */
.search-box { display: flex; align-items: center; background-color: var(--bg-input); border-radius: 8px; padding: 10px 15px; margin-bottom: 15px; }
.search-icon { margin-right: 10px; opacity: 0.5; }
.search-box input { background: transparent; border: none; color: white; width: 100%; outline: none; font-size: 1rem; }
.country-list { display: flex; flex-direction: column; gap: 2px; border-radius: 12px; overflow: hidden; background-color: var(--bg-panel); border: 1px solid var(--border-color); }
.country-item { display: flex; align-items: center; padding: 15px; gap: 15px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: 0.2s; }
.country-item.selected { border-left: 3px solid var(--neon-green); padding-left: 12px; background-color: rgba(255,255,255,0.05); }
.country-flag { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; }

/* STEP 2 */
.identity-display { text-align: center; margin: 40px 0; }
#live-number { font-size: 6rem; font-weight: 900; line-height: 1; font-style: italic; color: #fbbf24; text-shadow: 0 5px 25px rgba(251, 191, 36, 0.4); }
#live-name { font-size: 1.5rem; letter-spacing: 4px; font-weight: 700; text-transform: uppercase; margin-top: 10px; color: white; }
.identity-inputs { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }
.input-row { display: flex; align-items: center; justify-content: space-between; background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 8px; padding: 12px 15px; }
.input-row label { font-size: 0.75rem; color: var(--text-muted); }
.input-row input { flex: 1; background: transparent; border: none; color: white; text-align: right; font-size: 1.1rem; outline: none; width: 100%; }

/* STEP 3 */
.personality-list { display: flex; flex-direction: column; gap: 12px; }
.style-card { background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; padding: 18px; cursor: pointer; transition: 0.2s; }
.style-card.selected { border-color: var(--neon-blue); background-color: rgba(56, 189, 248, 0.1); }
.style-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* NAVEGAÇÃO BOTTOM */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background-color: var(--bg-main); display: flex; gap: 15px; padding: 15px 20px; border-top: 1px solid var(--border-color); z-index: 50; }
.btn-outline, .btn-solid { flex: 1; padding: 10px 16px; border-radius: 24px; font-size: 1rem; font-family: var(--font-tech); font-weight: 400; cursor: pointer; text-align: center; border: 1px solid white; transition: 0.2s; }
.btn-outline { background: transparent; color: white; }
.btn-solid { background: white; color: black; }
.btn-solid:disabled { background: #444; border-color: #444; color: #888; cursor: not-allowed; }
.btn-solid:active { transform: scale(0.98); }

/* ========================================================= */
/* DASHBOARD & STICKY HEADER                                 */
/* ========================================================= */
.sticky-top-area {
    position: sticky; top: 0; z-index: 100;
    background-color: var(--bg-main);
    padding: 15px 15px 10px 15px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.hero-card-copero {
    display: flex; background: linear-gradient(135deg, #1c1c24, #121218);
    border-radius: 12px; padding: 15px; border: 1px solid var(--border-color);
    position: relative; overflow: hidden; gap: 12px;
}
.hero-ovr {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--ovr-orange), var(--ovr-orange-dark));
    border-radius: 10px; width: 70px; height: 80px; color: white; box-shadow: 0 4px 10px rgba(217, 119, 6, 0.4);
}
.hero-ovr .ovr-label { font-size: 0.65rem; margin-bottom: -2px; }
.hero-ovr .ovr-value { font-size: 2rem; font-weight: 900; line-height: 1; }

.hero-details { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hero-top-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.hero-flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; }
.hero-country { font-size: 0.75rem; color: white; }
.hero-tag { background: #333; color: white; font-size: 0.6rem; padding: 2px 6px; border-radius: 4px; margin-left: 5px; }

.hero-mid-row { display: flex; align-items: center; margin-bottom: 4px; }
.title-serif { font-size: 1.8rem; font-style: italic; font-weight: 400; line-height: 1; letter-spacing: 0.5px; }

.hero-bot-row { display: flex; align-items: center; font-size: 0.8rem; }
.team-color-indicator { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: #555; margin-right: 6px; }
.pilot-number { margin-left: 6px; }

.hero-stats-right { display: flex; flex-direction: column; justify-content: space-between; text-align: right; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 10px; }
.stat-group { display: flex; flex-direction: column; }
.stat-lbl { font-size: 0.55rem; color: var(--text-muted); }
.stat-val { font-size: 1rem; color: white; font-weight: 700; }

.dashboard-content { padding: 0 15px 15px 15px; }

/* TABELA DE HISTÓRICO */
.history-section { margin-bottom: 20px; margin-top: 15px; }
.history-table { display: flex; flex-direction: column; }
.table-header { display: flex; padding: 6px 10px; font-size: 0.55rem; color: var(--text-muted); border-bottom: 1px solid rgba(255,255,255,0.1); }
#history-rows { max-height: 140px; overflow-y: auto; scrollbar-width: none; }
#history-rows::-webkit-scrollbar { display: none; }
.table-row { display: flex; align-items: center; padding: 4px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.table-row.current-year { background-color: rgba(255,255,255,0.03); border-radius: 8px; }

.age-badge { background-color: #e10600; color: white; border-radius: 6px; padding: 2px 4px; font-size: 0.7rem; font-weight: 700; width: 24px; text-align: center; margin-right: 12px; }
.current-year .age-badge { background-color: #333; }
.row-team-info { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.team-color-dot { width: 12px; height: 12px; border-radius: 3px; background-color: #555; display: inline-block; flex-shrink: 0; }
.col-eq { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ddd; }

.col-st { width: 14%; text-align: center; font-size: 0.7rem; color: #bbb; }
.col-age { width: 40px; text-align: center; }
.flex-2 { flex: 1; }

.milestone-row { background-color: transparent !important; padding: 10px 0; justify-content: center; }
.milestone-text { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; border: 1px solid var(--border-color); padding: 4px 12px; border-radius: 12px; text-align: center;}

/* TIMELINE ANIMADA */
.season-timeline-container { margin-top: 15px; padding: 15px 10px; background-color: #1a1a1a; border-radius: 8px; border: none !important; }
.timeline-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.75rem; color: #888; letter-spacing: 1px; }
.season-timeline { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.season-timeline::-webkit-scrollbar { display: none; }

.race-badge {
    min-width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700; color: white; background-color: #2a2a35; border: 2px solid transparent; /* default border transparent so goals can override */
    flex-shrink: 0; font-family: var(--font-tech); opacity: 1;
}
.race-badge.new-badge { animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.race-badge.p1 { background-color: #fbbf24; color: #000; font-size: 1rem; }
.race-badge.p2 { background-color: #94a3b8; color: #000; font-size: 0.8rem; }
.race-badge.p3 { background-color: #b45309; font-size: 0.8rem; color: #fff; }
.race-badge.pts { background-color: var(--neon-blue); color: #fff; }
.race-badge.dnf { background-color: transparent; border: 2px solid var(--danger); color: var(--danger); font-size: 0.6rem; }
.race-badge.inj { background-color: transparent; border: 2px dashed var(--ovr-orange); color: var(--ovr-orange); font-size: 0.6rem; }

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* INLINE EVENTS & ACTIONS */
.action-area { padding-bottom: 40px; }
.simulating-state {
    text-align: center; padding: 20px; color: var(--neon-blue); font-size: 1.1rem;
    background-color: rgba(56, 189, 248, 0.05); border: none; border-radius: 8px;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.inline-event { background-color: #1a1a1a; border-radius: 8px; padding: 12px; text-align: left; margin-top: 15px; animation: popIn 0.3s ease; }
.event-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.inline-event-icon { font-size: 1.2rem; }
.inline-event-title { font-size: 0.85rem; margin: 0; }
.inline-event-desc { font-size: 0.75rem; color: #ccc; margin-bottom: 12px; line-height: 1.4; }
.inline-event-actions { display: flex; flex-direction: row; gap: 8px; }
.btn-event { flex: 1; padding: 10px 5px; font-size: 0.65rem; border-radius: 6px; font-weight: bold; border: none; cursor: pointer; transition: 0.2s; text-align: center; }
.btn-event.safe { background-color: var(--bg-input); color: white; border: none; }
.btn-event.risk { background-color: rgba(225, 6, 0, 0.1); color: var(--f1-red); border: none; }
.btn-event:active { transform: scale(0.97); }

.contract-alert {
    padding: 12px; border-radius: 8px; margin-bottom: 15px;
    font-size: 0.85rem; text-align: center; border: 1px solid transparent;
    animation: popIn 0.3s ease; line-height: 1.4;
}
.contract-alert.success { background-color: rgba(16, 185, 129, 0.1); color: var(--neon-green); border-color: rgba(16, 185, 129, 0.3); }
.contract-alert.danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }

/* TIMELINE SUMMARY */
.timeline-summary { margin-top: 15px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.05); text-align: center; font-size: 0.85rem; color: #ccc; line-height: 1.6; animation: fadeIn 0.5s ease; }
.timeline-summary b { margin-left: 5px; }

/* OFERTAS (Cards Sem Borda Colorida, Com Detalhes) */
.offers-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.offers-grid::-webkit-scrollbar { display: none; }
.offer-card {
    min-width: 140px; background-color: var(--bg-panel); border: none;
    border-radius: 12px; padding: 15px; padding-bottom: 30px; cursor: pointer; transition: 0.2s; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.offer-card:hover { background-color: #1a1a1a; transform: translateY(-3px); }
.offer-card-logo { height: 40px; margin-bottom: 15px; object-fit: contain; }
.offer-team { font-size: 0.9rem; text-align: center; margin-bottom: 12px; color: white; white-space: nowrap; }

.cat-logo { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); height: 12px; opacity: 0.5; }
.current-team-offer { background-color: rgba(16, 185, 129, 0.15) !important; }

.offer-details { width: 100%; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.offer-detail-item { display: flex; flex-direction: column; align-items: center; text-align: center; }
.offer-detail-item .lbl { font-size: 0.6rem; color: #888; text-transform: uppercase; margin-bottom: 2px;}
.offer-detail-item b { font-size: 0.75rem; color: #ddd; }

.action-buttons { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 15px; }
.btn-simulate {
    padding: 16px; width: 100%; background: var(--f1-red);
    color: white; border: none; border-radius: 8px; font-size: 1rem;
    font-weight: 700; cursor: pointer; transition: 0.2s; text-transform: uppercase;
    letter-spacing: 1px;
}
.btn-simulate.btn-green { background: var(--neon-green); color: white; }
.btn-simulate:active { transform: scale(0.97); }

/* TELA DE APOSENTADORIA */
.retirement-screen { background-color: #111; width: 100%; display:flex; flex-direction:column; align-items:center; animation: popIn 0.5s ease; padding: 20px 10px; }
.ret-hero { display: flex; gap: 15px; width: 100%; max-width: 400px; margin-bottom: 30px; align-items: center; justify-content: center; }
.ret-ovr-box { background: linear-gradient(135deg, #facc15, #ca8a04); color: #111; padding: 10px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 70px; }
.ret-ovr-box span { font-size: 0.6rem; font-weight: 900; }
.ret-ovr-box strong { font-size: 2.2rem; font-weight: 900; line-height: 1; margin-top:-2px; }
.ret-hero-info { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ret-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ret-flag { width: 22px; border-radius: 4px; }
.ret-tag { background-color: #222; padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; color: #ccc; font-weight: 700; border: 1px solid #333; }
.ret-stats-row { display: flex; gap: 8px; background-color: #1a1a1a; padding: 10px; border-radius: 10px; justify-content: space-around; }
.rs-box { display: flex; flex-direction: column; align-items: center; }
.rs-box span { font-size: 0.5rem; color: #888; letter-spacing: 1px; margin-bottom: 2px;}
.rs-box strong { font-size: 1.1rem; color: white; }
.ret-section { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; margin-bottom: 30px; }
.ret-sec-title { font-size: 0.7rem; color: #888; letter-spacing: 2px; margin-bottom: 15px; text-transform: uppercase; }
.ret-logos-container { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; align-items: center; }
.ret-team-logo { height: 35px; object-fit: contain; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); }
.ret-team-text { background-color: #222; padding: 5px 10px; border-radius: 6px; font-size: 0.7rem; border: 1px solid #333;}
.ret-trophies-container { display: flex; align-items: center; justify-content: center; position: relative; filter: drop-shadow(0 5px 15px rgba(255, 215, 0, 0.2)); margin-top: 10px; }
.ret-badge { position: absolute; bottom: -5px; right: -15px; background-color: #111; color: white; border: 1px solid #333; padding: 2px 6px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; }


/* MODAL DE CONTRATO */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}
.contract-box {
    background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px;
    padding: 24px; width: 90%; max-width: 400px;
    text-align: left;
}
.c-detail { margin-bottom: 12px; font-size: 1.1rem; }
.c-detail span { color: #888; font-size: 0.75rem; display: block; margin-bottom: 2px; }

/* INDICADORES DE META DA CORRIDA */
.race-badge.goal-hit {
    border-color: var(--neon-green) !important;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.2);
}
.race-badge.goal-miss {
    border-color: var(--danger) !important;
    box-shadow: 0 0 6px rgba(225, 6, 0, 0.2);
}

/* COMPACT HEADER */
.compact-hero {
    display: flex; gap: 15px; padding: 12px 15px; background: #111; 
    border-bottom: 1px solid #222; align-items: center;
}
.compact-ovr {
    width: 42px; height: 42px; flex-shrink: 0; background: var(--ovr-orange); color: black; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 4px;
}
.compact-ovr .ovr-label { font-size: 0.5rem; font-weight: 700; line-height: 1; }
.compact-ovr .ovr-value { font-size: 1.1rem; font-weight: 900; line-height: 1; }
.compact-details { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.compact-line1, .compact-line2, .compact-line3 { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.hero-flag-small { width: 16px; height: 11px; border-radius: 2px; object-fit: cover; }

/* MILESTONE BADGES DISGUISED */
.milestone-row {
    padding: 2px 0 !important; border: none !important; background: transparent !important; margin: 0 !important;
}
.milestone-text {
    font-size: 11px !important; color: #a0a0a0; padding: 0 !important; 
    font-style: italic !important; border: none !important; background: transparent !important; 
    display: block; text-align: center; width: 100%; font-weight: normal !important;
}

/* GENERAL GAPS */
.dashboard-content { padding: 10px 10px 40px 10px; }
.history-section { margin-top: 10px; margin-bottom: 10px; }
