/* ==== B2: публичная часть TestPoint (mobile-first) ====
   Подключается после app.css только в base_public.html.
   База рассчитана на 360 px; шире — через min-width.
   Селекторы .public-body / .tp-* не пересекаются с кабинетом преподавателя. */

.public-body { --gutter: 16px; --pub-max: 640px; background: var(--canvas, #f5f7fb); }

/* --- Шапка --- */
.public-body .public-header {
    height: auto;
    min-height: 56px;
    gap: 12px;
    padding:
        calc(8px + env(safe-area-inset-top, 0px))
        max(var(--gutter), env(safe-area-inset-right, 0px))
        8px
        max(var(--gutter), env(safe-area-inset-left, 0px));
}
.public-body .brand-public { gap: 10px; }
.public-body .brand-public .brand-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 11px; }
.public-body .brand-public .brand-mark svg { width: 26px; height: 26px; }
.public-body .brand-public .brand-copy small { display: none; }
.public-body .public-header-note { display: none; }

/* --- Футер --- */
.public-body .public-footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    text-align: center;
    padding:
        16px
        max(var(--gutter), env(safe-area-inset-right, 0px))
        calc(16px + env(safe-area-inset-bottom, 0px))
        max(var(--gutter), env(safe-area-inset-left, 0px));
}
.public-body .public-footer span:last-child { max-width: none; text-align: center; }

/* --- Страница приглашения --- */
.tp-student {
    width: 100%;
    max-width: var(--pub-max);
    margin: 0 auto;
    padding: 12px max(var(--gutter), env(safe-area-inset-right, 0px)) 24px max(var(--gutter), env(safe-area-inset-left, 0px));
}
.tp-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line, #e9edf4);
    border-radius: 18px;
    box-shadow: var(--shadow, 0 12px 32px rgba(25, 45, 82, .055));
}
.tp-card-head { padding: 20px 18px 18px; background: linear-gradient(180deg, #f4f7fe 0%, #fff 100%); }
.tp-card-topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.tp-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--kicker, #4f6a9c); }
.tp-secure { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; color: #1f6b52; background: #e8f6f0; font-size: 12px; font-weight: 650; }
.tp-secure svg { width: 14px; height: 14px; }
.tp-subject { display: flex; flex-direction: column; gap: 2px; margin: 18px 0 0; min-width: 0; }
.tp-subject span { font-size: 12px; font-weight: 650; color: var(--muted, #5b6980); }
.tp-subject strong { font-size: 15px; font-weight: 650; line-height: 1.4; color: var(--navy-800, #233b60); overflow-wrap: anywhere; }
.tp-card h1 {
    margin: 10px 0 8px;
    font-size: 24px;
    font-weight: 740;
    line-height: 1.25;
    letter-spacing: -.4px;
    color: #1d2e49;
    overflow-wrap: anywhere;
}
.tp-description { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted, #5b6980); overflow-wrap: anywhere; }

/* Параметры теста: три компактные колонки */
.tp-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
    background: #fafbfd;
    border-block: 1px solid var(--line, #e9edf4);
}
.tp-facts li { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 10px 14px 12px; border-left: 1px solid var(--line, #e9edf4); }
.tp-facts li:first-child { border-left: 0; }
.tp-fact-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; color: #3f64b8; background: #e9f0ff; border-radius: 9px; }
.tp-fact-icon svg { width: 18px; height: 18px; }
.tp-fact-text { display: block; min-width: 0; }
.tp-fact-text strong { display: block; font-size: 15px; font-weight: 720; line-height: 1.2; color: #2c3d58; overflow-wrap: anywhere; }
.tp-fact-text small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.3; color: var(--muted, #5b6980); }

/* Форма студента */
.tp-form-section { padding: 20px 18px 22px; }
.tp-form-section h2 { margin: 0; font-size: 18px; font-weight: 700; color: #243650; }
.tp-form-intro { margin: 4px 0 18px; font-size: 14px; line-height: 1.5; color: var(--muted, #5b6980); }
.tp-form { display: grid; gap: 16px; }
.tp-field label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 650; color: #33445f; }
.tp-input {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    font: inherit;
    font-size: 16px;
    color: #1d2e49;
    background: #fff;
    border: 1.5px solid #c5d0e2;
    border-radius: 12px;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.tp-input::placeholder { color: #66748a; opacity: 1; }
.tp-input:focus { outline: 2px solid transparent; border-color: #3f70df; box-shadow: 0 0 0 4px rgba(63, 112, 223, .18); }
.tp-input:disabled { color: #4a5870; -webkit-text-fill-color: #4a5870; background: #f1f4f9; border-color: #d8e0ee; opacity: 1; cursor: not-allowed; }
.tp-field.has-error .tp-input { border-color: #c0505a; }
.tp-hint { margin: 6px 0 0; font-size: 13px; color: var(--muted, #5b6980); }
.tp-error { margin: 6px 0 0; font-size: 13px; color: #a8434d; }
.tp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    margin-top: 4px;
    padding: 0 20px;
    font: inherit;
    font-size: 16px;
    font-weight: 680;
    color: #fff;
    background: linear-gradient(100deg, #4779e2, #3967cf);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 7px 15px rgba(58, 103, 207, .18);
}
.tp-button:disabled { color: #52617a; background: #e3e9f4; box-shadow: none; cursor: not-allowed; }
.tp-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.5; color: var(--muted, #5b6980); background: #f3f6fc; border-radius: 12px; }
.tp-note-icon { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; font-size: 12px; font-weight: 700; color: #4f6a9c; border: 1.5px solid #8ea3c9; border-radius: 50%; }
.tp-support { margin: 16px 8px 0; font-size: 13px; line-height: 1.5; text-align: center; color: var(--muted, #5b6980); }

/* --- Недоступность и ошибки (единый компонент) --- */
.tp-state-wrap { display: flex; align-items: center; flex: 1; width: 100%; padding: 20px max(var(--gutter), env(safe-area-inset-right, 0px)) 28px max(var(--gutter), env(safe-area-inset-left, 0px)); }
.tp-state {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 28px 20px 24px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line, #e9edf4);
    border-radius: 18px;
    box-shadow: var(--shadow, 0 12px 32px rgba(25, 45, 82, .055));
}
.tp-state-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 16px; color: #7892c4; background: #f0f4fb; border-radius: 20px; }
.tp-state-icon svg { width: 54px; height: 54px; }
.tp-state-code { margin-bottom: 8px; font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -2px; color: #9db2d8; }
.tp-state-kicker { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--kicker, #4f6a9c); }
.tp-state h1 { margin: 0 0 10px; font-size: 22px; font-weight: 730; line-height: 1.3; letter-spacing: -.3px; color: #20314d; overflow-wrap: anywhere; }
.tp-state p { margin: 0 auto; max-width: 420px; font-size: 15px; line-height: 1.6; color: var(--muted, #5b6980); }
.tp-state-hint { display: grid; gap: 4px; margin: 18px 0 0; padding: 12px 14px; text-align: left; background: #f5f7fb; border-radius: 12px; }
.tp-state-hint strong { font-size: 14px; color: #3f5170; }
.tp-state-hint span { font-size: 14px; line-height: 1.5; color: var(--muted, #5b6980); }
.tp-state-actions { display: grid; gap: 10px; margin-top: 22px; }
.tp-state-actions form { margin: 0; }
.tp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 20px;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    text-align: center;
    color: #3f5170;
    background: #fff;
    border: 1.5px solid #c5d0e2;
    border-radius: 12px;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.tp-btn:hover { color: #274eac; border-color: #9db5e6; background: #f7faff; }
.tp-btn-primary { color: #fff; background: #3f70dc; border-color: #3f70dc; }
.tp-btn-primary:hover { color: #fff; background: #315fc7; border-color: #315fc7; }

/* --- ≥ 480 px --- */
@media (min-width: 480px) {
    .public-body .brand-public .brand-copy small { display: block; }
    .tp-state-actions { display: flex; justify-content: center; }
    .tp-btn { width: auto; min-width: 200px; }
}

/* --- ≥ 640 px: планшет --- */
@media (min-width: 640px) {
    .public-body { --gutter: 24px; }
    .public-body .public-header { padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: 12px; }
    .public-body .public-header-note { display: inline-flex; }
    .public-body .public-footer { justify-content: space-between; text-align: left; }
    .tp-student { padding-top: 24px; padding-bottom: 40px; }
    .tp-card { border-radius: 20px; }
    .tp-card-head { padding: 30px 32px 26px; }
    .tp-card h1 { font-size: 30px; letter-spacing: -.7px; }
    .tp-description { font-size: 16px; }
    .tp-facts li { flex-direction: row; align-items: center; gap: 12px; padding: 16px 16px 16px 20px; }
    .tp-facts li:first-child { padding-left: 32px; }
    .tp-fact-text strong { font-size: 16px; }
    .tp-form-section { padding: 28px 32px 32px; }
    .tp-form { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px 16px; }
    .tp-button { grid-column: 1 / -1; }
    .tp-state { padding: 40px 36px 34px; }
    .tp-state h1 { font-size: 26px; }
}

/* --- ≥ 1024 px: ноутбук и монитор --- */
@media (min-width: 1024px) {
    .public-body { --gutter: 32px; }
    .public-body .public-header,
    .public-body .public-footer {
        padding-left: max(var(--gutter), calc((100vw - 1120px) / 2));
        padding-right: max(var(--gutter), calc((100vw - 1120px) / 2));
    }
    .tp-student { padding-top: 40px; }
    .tp-state-wrap { padding-block: 40px 56px; }
}



/* ==== C1: регистрация попытки и просмотр содержимого ==== */
.tp-input:is(select) {
    appearance: auto;
    -webkit-appearance: menulist;
    padding-right: 12px;
}
.tp-form-errors {
    grid-column: 1 / -1;
    padding: 12px 14px;
    color: #963d48;
    background: #fff0f1;
    border: 1px solid #f1cbd0;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.tp-error { line-height: 1.45; }
.tp-attempt-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
    background: #fafbfd;
    border-bottom: 1px solid var(--line, #e9edf4);
}
.tp-attempt-details > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.tp-attempt-details span {
    color: var(--muted, #5b6980);
    font-size: 12px;
}
.tp-attempt-details strong {
    color: #2c3d58;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.tp-question-preview-section { padding: 20px 18px 22px; }
.tp-section-heading h2 {
    margin: 0;
    color: #243650;
    font-size: 18px;
    font-weight: 700;
}
.tp-section-heading p {
    margin: 4px 0 16px;
    color: var(--muted, #5b6980);
    font-size: 14px;
    line-height: 1.5;
}
.tp-question-preview-list { display: grid; gap: 12px; }
.tp-question-preview {
    min-width: 0;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line, #e9edf4);
    border-radius: 14px;
}
.tp-question-number {
    margin-bottom: 8px;
    color: var(--kicker, #4f6a9c);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.tp-question-preview h3 {
    margin: 0 0 12px;
    color: #253752;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.tp-question-preview ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.tp-question-preview li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    color: #40516d;
    background: #f6f8fc;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.tp-question-preview li span {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    color: #4b6698;
    background: #e8eef9;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}
.tp-empty-questions {
    margin: 0;
    padding: 16px;
    color: var(--muted, #5b6980);
    background: #f6f8fc;
    border-radius: 12px;
    font-size: 14px;
}
.tp-stage-note {
    display: grid;
    gap: 4px;
    margin-top: 18px;
    padding: 13px 14px;
    color: #52617a;
    background: #f1f5fc;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}
.tp-stage-note strong { color: #344a70; }
.tp-attempt-footer {
    display: flex;
    justify-content: center;
    padding: 0 18px 22px;
}
@media (min-width: 640px) {
    .tp-attempt-details { padding: 20px 32px; }
    .tp-attempt-details strong { font-size: 15px; }
    .tp-question-preview-section { padding: 26px 32px 30px; }
    .tp-question-preview { padding: 18px 20px; }
    .tp-attempt-footer { padding: 0 32px 30px; }
}

.tp-started {
    width: 100%;
    max-width: 704px;
    margin: 0 auto;
    padding: 12px max(var(--gutter), env(safe-area-inset-right, 0px)) 28px max(var(--gutter), env(safe-area-inset-left, 0px));
}
@media (min-width: 640px) {
    .tp-started { padding-top: 24px; padding-bottom: 40px; }
}
@media (min-width: 1024px) {
    .tp-started { padding-top: 40px; }
}
