
:root{
    --bg: #f6f7f8;
    --panel: #ffffff;
    --panel-2: #fbfbfc;
    --border: #e6e8ec;
    --txt: #111827;
    --muted: #5b6472;

    --accent: #2563eb;

    --ok-fill: rgba(6, 118, 71, .45);
    --bad-fill: rgba(180, 35, 24, .40);
    --skip-fill: rgba(148, 163, 184, .75);

    --r-lg: 18px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 30px rgba(15, 23, 42, .06);

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

    color-scheme: light;
    font-family: var(--font);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
    margin:0;
    background:var(--bg);
    color:var(--txt);
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
            env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.wrap{ max-width: 980px; margin: 0 auto; padding: 28px 18px 42px; }

.topline{ display:flex; align-items:baseline; justify-content:space-between; gap:14px; margin-bottom: 14px; }
.brand{ margin:0; font-size:16px; font-weight:650; letter-spacing:.2px; }

.brandImg{ height: 24px; width: auto; display:block; }


.ghostBtn{
    border:1px solid var(--border);
    background:#fff;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13px;
    cursor:pointer;
    min-height: 40px;
    transition: background .12s ease, border-color .12s ease;
}
.ghostBtn:hover{ background:#f8fafc; }

.card{
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow:hidden;
}
.cardBody{ padding: 16px; }

.sub{
    margin: 0;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.6;
    max-width: 70ch;
    text-align: left;
}

.lead{
    color: #0f172a;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: .2px;
}
.muted{ color: var(--muted); }
.mono{ font-family: var(--mono); }

.heroImg{
    width:100%;
    max-width: 680px;
    display:block;
    margin: 0 auto 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background:#fff;
}

#welcomeView .sub + .sub{
    margin-top: 10px;
}

.welcomeIntro{
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
    max-width: 720px;
    margin: 0 auto;
}

.introAccent{
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(37, 99, 235, .65), rgba(37, 99, 235, .12));
}

.introCard{
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff, #fbfbfc);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    display: grid;
    gap: 10px;
}

.prompt{
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: #ffffff;
    padding: 18px 14px;
    min-height: 260px;
    display: grid;
    place-items: center;
    text-align: center;
    position: relative;
}

.titleBig{ margin: 0; font-size: 32px; font-weight: 700; letter-spacing: .2px; }
@media (max-width: 420px){ .titleBig{ font-size: 26px; } }

.hint{ margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.45; min-height: 20px; }
.diagnosis{
    margin: 12px auto 4px;
    border: 1px solid rgba(37, 99, 235, .18);
    background:
      radial-gradient(120% 140% at 10% 0%, rgba(37, 99, 235, .10), transparent 60%),
      linear-gradient(180deg, #ffffff, #fbfbfc);
    border-radius: 16px;
    padding: 12px 14px;
    max-width: 50ch;
    text-align: center;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .08);
}
.diagnosisLabel{
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .6px;
}
.diagnosisMessage{
    margin-top: 6px;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
}
.diagnosisStats{
    margin-top: 10px;
    display: grid;
    gap: 8px;
    justify-items: center;
}
.diagnosisPill{
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: 12.5px;
    color: var(--muted);
}

#cardImage{
    max-height: 220px; max-width: 100%;
    display: none;
    margin: 0 auto 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.btnRow{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top: 12px; }
button{
    cursor: pointer;
    border: 1px solid var(--border);
    background: #ffffff;
    color: #0f172a;
    border-radius: 12px;
    padding: 12px 12px;
    font-size: 14px;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s ease, border-color .12s ease;
}
button:hover{ background: #f8fafc; }
button:disabled{ opacity: .45; cursor: not-allowed; }
button.primary{
    background: var(--accent);
    border-color: rgba(37, 99, 235, .55);
    color: #ffffff;
}
button.primary:hover{ background: #1d4ed8; }

.btnGrid{
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.btnRowAnswers{
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.btnRowGiveUp{
    display: flex;
}
.btnGrid button{
    white-space: nowrap;
}
.btnGrid.single{
    max-width: 320px;
    margin: 14px auto 0;
}
.btnGrid.single button{
    width: 100%;
    justify-content: center;
}
.btnGrid.single .btnRowGiveUp{
    width: 100%;
    justify-content: center;
}
@media (min-width: 760px){ .btnGrid{ grid-template-columns: repeat(4, minmax(0, 1fr)); } }

button.correct{ background: rgba(6, 118, 71, .10); border-color: rgba(6, 118, 71, .25); }
button.wrong{ background: rgba(180, 35, 24, .10); border-color: rgba(180, 35, 24, .22); }
button.reveal{ box-shadow: 0 0 0 2px rgba(6, 118, 71, .18) inset; }

.status{ margin-top: 12px; min-height: 22px; font-size: 13.5px; color: #0f172a; text-align:center; }
.footer{ margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; text-align:center; }

/* Progress + session stats */
.progressShell{ display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; margin: 10px 0 14px; }
.restartTop{ flex: 0 0 auto; }
.progressWrap{ flex: 1 1 auto; }

.segWrap{
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 8px 10px;
}
.segments{
    position: relative;
    width: 100%;
    height: 8px;
    margin: 0 auto;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: visible;
}
.segments::before{
    content: "";
    position: absolute;
    inset: 0;
    width: var(--progress, 0%);
    background: #cbd5e1;
    border-radius: inherit;
}
.segments::after{
    content: "";
    position: absolute;
    top: 50%;
    left: var(--progress, 0%);
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #ffffff;
    border: 2px solid #94a3b8;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .16);
    pointer-events: none;
}

.barLabel{
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--muted);
    display:flex;
    justify-content:space-between;
    gap:10px;
}

.sessionStats{
    margin-top: 10px;
    display:flex;
    justify-content:center;
    gap: 10px;
    flex-wrap:wrap;
    font-size: 12.5px;
    color: var(--muted);
}
.pill{
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    display:flex;
    gap:8px;
    align-items:center;
}
.dot{ width:8px; height:8px; border-radius: 999px; display:inline-block; }
.dot.ok{ background: var(--ok-fill); }
.dot.bad{ background: var(--bad-fill); }
.dot.sk{ background: var(--skip-fill); }

/* Leaderboard table */
.tableWrap{ margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r-lg); overflow:hidden; background:#fff; }
table{ width:100%; border-collapse: collapse; font-size: 13.5px; }
thead th{ text-align:left; font-weight:650; color:#0f172a; background: linear-gradient(180deg, #ffffff, #fbfbfc); border-bottom:1px solid var(--border); padding: 12px 12px; white-space:nowrap; }
tbody td{ padding: 11px 12px; border-bottom: 1px solid var(--border); color:#0f172a; vertical-align: top; }
tbody tr:last-child td{ border-bottom: none; }
tbody tr:hover td{ background:#fafafa; }
.num{ font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; color:#111827; }

.view[hidden]{ display:none !important; }

/* Modal */
.overlay{ position: fixed; inset: 0; background: rgba(2, 6, 23, .45); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 9999; }
.modal{ width: min(600px, 100%); background: #ffffff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 20px 60px rgba(2, 6, 23, .22); overflow: hidden; }
.modalHeader{ padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; background: linear-gradient(180deg, #ffffff, #fbfbfc); }
.modalHeader .t{ font-weight: 650; font-size: 14px; }
.modalBody{ padding: 12px 14px 14px; color: #0f172a; font-size: 14px; line-height: 1.5; }
.field{ display:grid; gap:6px; margin-top: 10px; }
.field label{ font-size: 12px; color: var(--muted); }
input[type="text"]{ border: 1px solid var(--border); background: #ffffff; border-radius: 12px; padding: 10px 10px; font-size: 14px; color: var(--txt); outline: none; }
input[type="text"]:focus{ border-color: rgba(37, 99, 235, .55); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }

.quote{
    margin-top: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff, #fbfbfc);
    border-radius: 14px;
    padding: 12px 12px;
    font-size: 13.5px;
    color: #0f172a;
}

.footer a{
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(17, 24, 39, .35);
}
.footer a:hover{
    text-decoration-color: rgba(17, 24, 39, .7);
}

.drugInfo{
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #fbfbfc);
    text-align: left;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.drugInn{
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 6px;
    font-family: var(--mono);
}

.drugSummary{
    font-size: 14px;
    line-height: 1.45;
    color: #0f172a;
}

.navHint{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    color: #0f172a;
    opacity: .6;
    text-shadow: 0 2px 8px rgba(15, 23, 42, .18);
    pointer-events: none;
    user-select: none;
}
.navHintLeft{ left: 12px; }
.navHintRight{ right: 12px; }

/* компактнее на очень маленьких экранах */
@media (max-width: 420px){
    .drugInfo{
        padding: 10px 12px;
    }
    .drugSummary{
        font-size: 13.5px;
    }
}
