/* =====================================================================
   style.css — Карета Мобилити | Брендбук 2025
   Шрифт: Onest (Google Fonts) — подключается через <link> в index.html,
          чтобы не блокировать первый рендер на iOS.
   Палитра: #fff100 yellow, #000000 black, #757575 grey,
            #eaeaea light-grey, #ffffff white, #0d6eff blue, #ebf9e1 green-light
   ===================================================================== */

:root {
    --yellow:      #fff100;
    --yellow-dark: #d4ca00;
    --black:       #000000;
    --grey:        #757575;
    --light-grey:  #eaeaea;
    --white:       #ffffff;
    --blue:        #0d6eff;
    --blue-dark:   #0a58d4;
    --green-light: #ebf9e1;
    --green:       #2ecc71;
    --red:         #e74c3c;
    --orange:      #f39c12;
    --bg:          #f5f5f5;
    --text:        #000000;
    --radius-sm:   10px;
    --radius-md:   16px;
    --radius-lg:   24px;
    --shadow-sm:   0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:   0 6px 20px rgba(0,0,0,0.08);
    --shadow-lg:   0 12px 32px rgba(0,0,0,0.10);
}

/* ── BASE ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: 'Onest', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 15px;
    margin: 0;
    text-align: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── ЛОГОТИП ──────────────────────────────────────────────────────────── */
.logo-main {
    width: 110px;
    height: auto;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* ── АНИМАЦИИ ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.25s ease forwards; }

/* ── РОУТЕР (выбор роли) ──────────────────────────────────────────────── */
#app-router {
    margin-top: 15vh;
    animation: fadeIn 0.5s;
}
#app-router h2 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}
#app-router p {
    color: var(--grey);
    font-size: 15px;
    margin-bottom: 28px;
}

.role-btn {
    background: var(--white);
    border: 3px solid var(--yellow);
    padding: 22px 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    font-size: 17px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    color: var(--black);
}
.role-btn:active { transform: scale(0.97); box-shadow: none; }
.role-btn span { font-size: 26px; margin-right: 14px; }

/* ── АВТОРИЗАЦИЯ ТМ ───────────────────────────────────────────────────── */
#app-tm-auth {
    animation: fadeIn 0.5s;
    margin-top: 10vh;
}
#app-tm-auth h2 {
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}
#app-tm-auth p { color: var(--grey); font-size: 15px; margin-bottom: 20px; }

#app-tm-auth .auth-card {
    background: var(--white);
    padding: 32px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
#app-tm-auth .auth-icon { font-size: 56px; margin-bottom: 12px; }
#tm-auth-status { font-size: 15px; font-weight: 700; margin-top: 14px; min-height: 22px; }

/* ── СКАУТ: общее ─────────────────────────────────────────────────────── */
#app-scout { background: var(--white); }
#app-scout .screen {
    display: none;
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-top: 10px;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.35s;
}
#app-scout .screen.active { display: block; }

#app-scout h2 {
    text-transform: uppercase;
    font-size: 21px;
    margin-bottom: 10px;
    font-weight: 900;
    letter-spacing: 0.3px;
}
#app-scout p { color: var(--grey); font-size: 15px; line-height: 1.5; margin-bottom: 18px; }

#app-scout input[type="text"],
#app-scout input[type="tel"],
#app-scout input[type="password"] {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    border: 2.5px solid var(--light-grey);
    border-radius: var(--radius-md);
    font-size: 17px;
    font-family: 'Onest', sans-serif;
    text-align: center;
    font-weight: 700;
    outline: none;
    background: #fafafa;
    transition: border-color 0.2s;
}
#app-scout input:focus { border-color: var(--yellow); background: var(--white); }

#app-scout button {
    background: var(--yellow);
    color: var(--black);
    border: none;
    padding: 17px;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-family: 'Onest', sans-serif;
    font-weight: 800;
    width: 100%;
    margin-top: 18px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    box-shadow: 0 5px 0 var(--yellow-dark);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}
#app-scout button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--yellow-dark); }
#app-scout button:disabled {
    background: var(--light-grey) !important;
    color: var(--grey) !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

.input-error { border-color: var(--red) !important; }
.input-hint { font-size: 12px; color: var(--grey); margin-top: 4px; text-align: left; padding-left: 4px; }

/* ── РОАДМАП ──────────────────────────────────────────────────────────── */
.level-header {
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--grey);
    margin: 22px 0 8px 0;
    text-align: left;
    padding-left: 4px;
    letter-spacing: 1.2px;
}
.step-card {
    background: var(--white);
    border: 2.5px solid var(--light-grey);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    text-align: left;
    display: flex;
    align-items: center;
    transition: transform 0.15s;
}
.active-step {
    border-color: var(--yellow);
    box-shadow: 0 4px 16px rgba(255,241,0,0.25);
    cursor: pointer;
}
.active-step:active { transform: scale(0.98); }
.locked-step { opacity: 0.45; background: #fafafa; filter: grayscale(1); cursor: not-allowed; }
.completed-step { border-color: var(--green); background: var(--green-light); cursor: pointer; }
.step-icon { font-size: 28px; margin-right: 14px; width: 38px; text-align: center; }
.step-info h4 { margin: 0 0 3px 0; font-size: 15px; font-weight: 800; color: #111; }
.step-info p  { margin: 0; font-size: 12px; color: var(--grey); font-weight: 600; line-height: 1.2; }

/* ── СТАТУС-БАР ───────────────────────────────────────────────────────── */
.scout-status-bar {
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    font-size: 13px;
    background: var(--yellow);
    padding: 11px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    box-shadow: 0 4px 0 var(--yellow-dark);
    letter-spacing: 0.3px;
}

/* ── КНОПКА СБРОСА ────────────────────────────────────────────────────── */
.reset-btn {
    background: transparent !important;
    color: var(--grey) !important;
    border: none;
    box-shadow: none !important;
    margin-top: 22px !important;
    font-size: 14px !important;
    font-family: 'Onest', sans-serif;
    text-decoration: underline;
    width: 100%;
    text-transform: none !important;
    cursor: pointer;
}

/* ── КВИЗ: варианты ───────────────────────────────────────────────────── */
.option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f8f8;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    border: 2px solid var(--light-grey);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
    transition: border-color 0.15s, background 0.15s;
}
.option.correct { background: var(--green-light); border-color: var(--green); color: #1a6b3a; }
.option.wrong   { background: #fee2e2;             border-color: var(--red);   color: #991b1b; }

/* ── ЧЕКЛИСТ ──────────────────────────────────────────────────────────── */
.checklist-item {
    display: flex;
    align-items: flex-start;
    text-align: left;
    background: #f8f8f8;
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
}
.checklist-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0 14px 0 0;
    accent-color: var(--green);
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

/* ── СИМУЛЯТОР ────────────────────────────────────────────────────────── */
#screen-game { padding: 0 !important; background: transparent !important; box-shadow: none !important; }

.game-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.game-stats {
    background: var(--yellow);
    padding: 13px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    border-bottom: none;
}
.game-stats span { font-weight: 900; color: var(--black); }
.game-content { padding: 22px; text-align: left; }
.game-title { font-size: 20px; font-weight: 900; margin-bottom: 10px; color: var(--black); letter-spacing: -0.2px; }
.game-text  { font-size: 15px; color: #444; line-height: 1.5; white-space: pre-line; margin-bottom: 22px; }
.game-choices { display: flex; flex-direction: column; gap: 10px; }

.game-btn {
    background: var(--black) !important;
    color: var(--white) !important;
    border: none !important;
    padding: 16px !important;
    border-radius: var(--radius-md) !important;
    font-size: 15px !important;
    font-family: 'Onest', sans-serif !important;
    font-weight: 700 !important;
    text-align: left !important;
    text-transform: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    line-height: 1.3 !important;
    margin-top: 0 !important;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s;
}
.game-btn:active { transform: scale(0.97) !important; box-shadow: none !important; }

/* ── ПОПАП ОБРАТНОЙ СВЯЗИ (игра) ──────────────────────────────────────── */
#game-feedback-popup {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    width: 100%;
    max-width: 500px;
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    text-align: left;
       max-height: 80vh;
       overflow-y: auto;
}

#game-feedback-popup.show { transform: translateY(0); }
    

#gf-title { font-size: 21px; font-weight: 900; margin: 0 0 8px 0; }
#gf-text  { font-size: 15px; color: #444; line-height: 1.4; margin-bottom: 18px; }
#gf-stats { display: flex; justify-content: center; gap: 18px; margin-bottom: 18px; font-size: 17px; font-weight: bold; }

/* ── ДАШБОРД ТМ ───────────────────────────────────────────────────────── */
.tm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--black);
    color: var(--white);
    padding: 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    box-shadow: var(--shadow-md);
    text-align: left;
}
.tm-header h1 { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: 0.2px; }
.tm-header p  { margin: 4px 0 0 0; font-size: 13px; color: #aaa; }

.location-badge {
    background: var(--yellow);
    color: var(--black);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stats-container {
    background: var(--white);
    padding: 18px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}
.chart-box {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: conic-gradient(var(--green) 0% 30%, var(--orange) 30% 60%, var(--red) 60% 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
.chart-inner {
    width: 72px;
    height: 72px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.chart-inner span  { font-size: 20px; font-weight: 900; color: var(--black); }
.chart-inner small { font-size: 11px; color: var(--grey); font-weight: 600; }

.stats-legend { flex-grow: 1; padding-left: 18px; text-align: left; }
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 700;
    color: #444;
}
.legend-dot { width: 10px; height: 10px; border-radius: 4px; margin-right: 9px; flex-shrink: 0; }

.section-title {
    font-size: 17px;
    font-weight: 900;
    margin: 0 0 14px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--black);
    text-align: left;
}

/* ── КАРТОЧКИ СТАЖЁРОВ ────────────────────────────────────────────────── */
.user-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--light-grey);
    text-align: left;
    transition: transform 0.15s;
}
.status-ready   { border-left-color: var(--green);  background: var(--green-light); }
.status-waiting { border-left-color: var(--orange); background: #fffcf0; }
.status-learning{ border-left-color: var(--red);    opacity: 0.85; }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.user-name   { font-size: 15px; font-weight: 900; margin: 0; color: var(--black); }
.user-role   { font-size: 11px; color: var(--grey); font-weight: 700; background: var(--light-grey); padding: 3px 8px; border-radius: 6px; }
.card-body   { font-size: 13px; color: var(--grey); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* ── КНОПКИ ДЕЙСТВИЙ (ТМ) ─────────────────────────────────────────────── */
.action-btn {
    background: var(--black);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Onest', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    display: inline-block;
    transition: opacity 0.15s;
}
.action-btn:active { opacity: 0.8; }
.btn-green  { background: var(--green);  color: var(--white); }
.btn-orange { background: var(--yellow); color: var(--black); }

/* ── ОВЕРЛЕЙ И ПОПАПЫ ─────────────────────────────────────────────────── */
.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 999;
    display: none;
}
.popup {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0;
    width: 90%;
    max-width: 380px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    z-index: 1000;
    display: none;
    text-align: center;
    animation: popIn 0.25s forwards;
}
.popup h3 { margin-top: 8px; font-size: 21px; font-weight: 900; }
.popup p  { font-size: 15px; font-weight: 500; color: #444; margin-bottom: 14px; line-height: 1.5; text-align: left; }
.popup button {
    background: var(--yellow);
    border: none;
    padding: 15px;
    border-radius: var(--radius-md);
    font-family: 'Onest', sans-serif;
    font-weight: 800;
    width: 100%;
    font-size: 16px;
    margin-top: 10px;
    color: var(--black);
    cursor: pointer;
    letter-spacing: 0.3px;
}
.popup .close-btn { background: var(--light-grey); color: #333; }

.pin-display {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 10px;
    color: var(--black);
    background: #f5f5f5;
    padding: 14px;
    border-radius: var(--radius-md);
    margin: 18px 0;
    text-align: center;
}

/* ── ЛОАДЕР ───────────────────────────────────────────────────────────── */
.loader { text-align: center; padding: 28px; font-weight: 700; color: var(--grey); font-size: 15px; }

/* ── DESKTOP: IPHONE MOCKUP ────────────────────────────────────────── */
@media (min-width: 768px) {
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }
    
    body::before {
        content: '';
        position: absolute;
        width: 393px;
        height: 852px;
        background: #000;
        border-radius: 50px;
        box-shadow: 
            0 50px 100px rgba(0,0,0,0.5),
            inset 0 0 0 3px #1a1a1a,
            inset 0 0 0 8px #000;
        z-index: 0;
    }
    
    body::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, calc(-50% - 406px));
        width: 130px;
        height: 32px;
        background: #000;
        border-radius: 0 0 18px 18px;
        z-index: 2;
    }
    
    body > *:not(script) {
        position: absolute;
                       overflow-y: auto;
        overflow-x: hidden;
        border-radius: 50px;
        background: var(--bg);
        z-index: 1;
        -webkit-overflow-scrolling: touch;
    }
    
    #game-feedback-popup {
        position: fixed !important;
        width: 393px !important;
        max-width: 393px !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(100%) !important;
        border-radius: 24px 24px 0 0 !important;
    }
    
    #game-feedback-popup.show {
        transform: translateX(-50%) translateY(0) !important;
    }
}

/* Фикс перекрытия текста в роадмапе - UX аудит */
#screen-roadmap h2 {
  margin-top: 50px !important;
}

#screen-roadmap > p {
  margin-top: 0 !important;
  padding-top: 5px;
}

/* Анимация кнопки Play для симулятора */
.play-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Фикс: скрыть экран лидерборда по умолчанию */
#screen-leaderboard:not(.active) {
    display: none !important;
}
