/* Studiosus test web client. Same palette as the Android app (ui/theme/Theme.kt). */

:root {
    --navy: #0B3D78;
    --navy-deep: #062650;
    --sea: #00A3B4;
    --sea-light: #7FE3EC;
    --sand: #FFC857;
    --like: #1FB57A;
    --pass: #E5484D;

    --bg: #F4F7FB;
    --surface: #FFFFFF;
    --surface-2: #E8EDF4;
    --text: #0F1B2D;
    --muted: #4A5566;
    --border: #D3DCE8;
    --primary: #0B3D78;
    --on-primary: #FFFFFF;
    --secondary: #00A3B4;
    --on-secondary: #FFFFFF;
    --sup-bg: #FFE9B8;
    --sup-fg: #5A3B00;
    --stu-bg: #CDF4F7;
    --stu-fg: #00363D;
    --com-bg: #DCE6FF;
    --com-fg: #0B3D78;
    --error: #C62828;
    --ok: #0F7B5F;
    --shadow: 0 10px 30px rgba(6, 38, 80, .14);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0C1320;
        --surface: #131C2B;
        --surface-2: #1E2A3C;
        --text: #E6ECF5;
        --muted: #B8C3D4;
        --border: #2A3A52;
        --primary: #A9C7FF;
        --on-primary: #002E62;
        --secondary: #7FE3EC;
        --on-secondary: #00363D;
        --sup-bg: #5C4100;
        --sup-fg: #FFE9B8;
        --stu-bg: #004F58;
        --stu-fg: #CDF4F7;
        --com-bg: #22395E;
        --com-fg: #DCE6FF;
        --error: #FF8A80;
        --ok: #7ED9A8;
        --shadow: 0 10px 30px rgba(0, 0, 0, .45);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
    margin: 0;
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 520px at 12% -10%, rgba(0, 163, 180, .28), transparent 60%),
        linear-gradient(160deg, var(--navy-deep), var(--navy) 55%, #0E6C92);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ---------- shell: the app sits in a phone-sized frame on wide screens ---------- */

.shell {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 16px;
}

.caption {
    margin: 0;
    max-width: 440px;
    text-align: center;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}

.caption strong { color: #fff; }

.frame {
    position: relative;
    width: min(440px, 100%);
    height: min(880px, calc(100dvh - 90px));
    min-height: 560px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

@media (max-width: 520px) {
    .shell { padding: 0; gap: 0; }
    .caption { display: none; }
    .frame { width: 100%; height: 100dvh; min-height: 0; border-radius: 0; box-shadow: none; }
}

#screen, .screen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 12px 6px 20px;
}

.bar h1 {
    flex: 1;
    margin: 0;
    font-size: 26px;
    letter-spacing: -.3px;
}

.tabs {
    display: flex;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    border-radius: 16px;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.tab-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 30px;
    border-radius: 15px;
    transition: background .2s;
}

.tab-badge {
    position: absolute;
    top: -4px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--pass);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.tab.active { color: var(--text); }
.tab.active .tab-icon { background: var(--stu-bg); color: var(--stu-fg); }
.tab:hover .tab-icon { background: var(--surface-2); }
.tab.active:hover .tab-icon { background: var(--stu-bg); }

:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

/* ---------- controls ---------- */

button { font: inherit; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 16px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: filter .15s, transform .1s, background .15s;
}

a.btn { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-small { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { filter: brightness(.95); }
.btn-ghost-light { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .55); }
.btn-ghost-light:hover:not(:disabled) { background: rgba(255, 255, 255, .1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-danger { background: var(--pass); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); }
.btn-text { height: 40px; padding: 0 12px; background: transparent; color: var(--primary); }
.btn-text:hover:not(:disabled) { background: var(--surface-2); }

.icon-btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.send { background: var(--primary); color: var(--on-primary); }
.icon-btn.send:hover:not(:disabled) { background: var(--primary); filter: brightness(1.12); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--muted); }

input[type="text"], input[type="email"], textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--secondary) 25%, transparent);
}

input:disabled { opacity: .6; }
textarea { min-height: 110px; resize: vertical; }
.help { font-size: 12px; color: var(--muted); }
.muted { margin: 0; color: var(--muted); }
.error { margin: 0; color: var(--error); font-size: 14px; }

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--surface-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.btn .spinner { width: 20px; height: 20px; border-width: 2px; border-color: rgba(255, 255, 255, .35); border-top-color: currentColor; }
.loading { flex: 1; display: grid; place-items: center; min-height: 200px; }

.empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    text-align: center;
}

.empty .emoji { font-size: 56px; line-height: 1; }
.empty h2 { margin: 0; font-size: 20px; }
.empty p { margin: 0; color: var(--muted); }

.avatar {
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    letter-spacing: .5px;
    user-select: none;
}

.avatar.ring { border: 4px solid rgba(255, 255, 255, .9); }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge.sup { background: var(--sup-bg); color: var(--sup-fg); }
.badge.stu { background: var(--stu-bg); color: var(--stu-fg); }
.badge.com { background: var(--com-bg); color: var(--com-fg); }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.chip.shared { background: var(--secondary); color: var(--on-secondary); }
.chip.removable { background: var(--stu-bg); color: var(--stu-fg); padding-right: 6px; }

.chip button {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.chip button:hover { background: rgba(0, 0, 0, .1); }

/* ---------- login ---------- */

.login {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 44px 20px 24px;
    text-align: center;
    color: #fff;
    background: linear-gradient(160deg, var(--navy-deep), var(--navy) 55%, #0E6C92);
}

.logo { position: relative; flex: none; width: 96px; height: 96px; margin-bottom: 14px; }
.logo i { position: absolute; top: 22px; width: 56px; height: 56px; border-radius: 50%; }
.logo i:nth-child(1) { left: 0; background: #fff; }
.logo i:nth-child(2) { right: 0; background: rgba(127, 227, 236, .85); }
.logo b { position: absolute; top: -6px; left: 0; right: 0; color: var(--sand); font-size: 28px; }

.login h1 { margin: 0; font-size: 32px; letter-spacing: -.5px; }
.tagline { margin: 8px 0 28px; color: rgba(255, 255, 255, .82); font-size: 16px; }

.login-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    text-align: left;
    color: var(--text);
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.login-card h2 { margin: 0; font-size: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.code-input { text-align: center; font-size: 28px !important; font-weight: 700; letter-spacing: 12px; }
.row-between { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
/* The captcha (0.19): four birds, two by two. */
.captcha { margin-top: 16px; padding: 16px; border-radius: 18px; background: var(--surface-2); }
.captcha h3 { margin: 0 0 4px; }
.captcha-task { margin: 0 0 12px; font-weight: 600; }
.captcha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.captcha-bird { padding: 0; border: 2px solid transparent; border-radius: 14px; overflow: hidden; cursor: pointer; background: none; aspect-ratio: 1; }
.captcha-bird:hover, .captcha-bird:focus-visible { border-color: var(--primary); }
.captcha-bird img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bubble.deleted { font-style: italic; opacity: .7; }

.test-login {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.test-login h3 { margin: 0; font-size: 14px; }
.test-login .row { display: flex; gap: 8px; }
.test-login .row .btn { flex: 1; height: 44px; }
.footnote { margin: 22px 0 0; color: rgba(255, 255, 255, .62); font-size: 12px; }

/* ---------- discover ---------- */

.discover {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 4px 16px 12px;
}

.stack { position: relative; flex: 1; min-height: 380px; margin: 8px 0 18px; }

.card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow);
    touch-action: pan-y;
    user-select: none;
    cursor: grab;
    transition: transform .35s cubic-bezier(.3, 1.4, .5, 1);
    will-change: transform;
}

.card.behind { transform: scale(.94); pointer-events: none; }
.card.dragging { transition: none; cursor: grabbing; }
.card.flying { transition: transform .28s ease-in; }

.card-hero {
    flex: none;
    display: grid;
    place-items: center;
    height: 170px;
    background: linear-gradient(180deg, var(--navy), var(--sea));
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    overflow-y: auto;
    padding: 20px;
}

.card-name { margin: 0; font-size: 26px; line-height: 1.2; }
.card-headline { margin: 0; color: var(--primary); font-size: 16px; font-weight: 600; }
.card-school { margin: 0; color: var(--muted); font-size: 14px; }
.card-shared { margin: 0; color: var(--secondary); font-size: 14px; font-weight: 700; }
.card-bio { margin: 4px 0 0; font-size: 15.5px; }

.stamp {
    position: absolute;
    top: 24px;
    padding: 6px 12px;
    border: 3px solid;
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    opacity: 0;
    pointer-events: none;
}

.stamp.like { left: 24px; color: var(--like); border-color: var(--like); transform: rotate(-14deg); }
.stamp.pass { right: 24px; color: var(--pass); border-color: var(--pass); transform: rotate(14deg); }

.actions { display: flex; justify-content: center; gap: 32px; }

.round {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .12s;
}

.round:hover { transform: scale(1.06); }
.round:active { transform: scale(.95); }
.round.like { color: var(--like); }
.round.pass { color: var(--pass); }
.hint { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- matches ---------- */

.matches { flex: 1; display: flex; flex-direction: column; }
.match-list { margin: 0; padding: 0; list-style: none; }

.match-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.match-row:hover { background: var(--surface-2); }
.match-text { flex: 1; min-width: 0; }
.match-top { display: flex; align-items: baseline; gap: 8px; }
.match-name { flex: 1; overflow: hidden; font-size: 16px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.match-top time { color: var(--muted); font-size: 12px; }

.match-last, .match-headline {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.match-last.new { color: var(--secondary); font-weight: 600; }
.match-headline { font-size: 12px; }

/* ---------- chat ---------- */

.chat-bar {
    position: relative;
    gap: 10px;
    padding: 10px 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-title strong, .chat-title span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-title span { color: var(--muted); font-size: 12px; }

.messages {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding: 12px;
}

.chat-empty { margin: auto 24px; text-align: center; color: var(--muted); }

.bubble {
    align-self: flex-start;
    max-width: 78%;
    padding: 8px 14px;
    background: var(--surface);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bubble.mine {
    align-self: flex-end;
    color: var(--on-primary);
    background: var(--primary);
    border-radius: 18px 18px 4px 18px;
}

.bubble time { display: block; margin-top: 2px; text-align: right; font-size: 11px; opacity: .7; }

/* Photos and videos (0.12): the picture is the bubble, the time over it. */
.bubble.media {
    position: relative;
    width: min(260px, 70%);
    max-height: 380px;
    padding: 0;
    overflow: hidden;
    border: 0;
    cursor: pointer;
    background: var(--border);
    font: inherit;
}
.bubble.media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bubble.media.gone::after { content: 'Файл недоступен'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted, #667); }
.bubble.media time { position: absolute; right: 8px; bottom: 8px; margin: 0; padding: 1px 7px; border-radius: 10px; color: #fff; background: rgba(0, 0, 0, .45); opacity: 1; }
.media-play {
    position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
    display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .5);
}
.media-length { position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 10px; font-size: 11px; color: #fff; background: rgba(0, 0, 0, .45); }

.bubble.voice { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; min-width: 220px; }
.bubble.voice audio { grid-column: 1 / -1; width: 100%; max-width: 280px; }
.bubble.voice time { grid-column: 2; }
.voice-play {
    grid-row: span 2; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%;
    color: var(--on-primary); background: var(--primary); cursor: pointer;
}
.bubble.mine .voice-play { color: var(--primary); background: var(--on-primary); }
.wave { display: flex; align-items: center; gap: 2px; height: 26px; }
.wave i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .55; }
.voice-length { grid-column: 2; font-size: 11px; opacity: .8; }
.bubble.voice .voice-length + time { margin-top: -16px; }

.bubble.call { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bubble.call time { margin: 0 0 0 auto; }
.bubble.call.missed svg { color: var(--error); }
.bubble.pending { display: flex; align-items: center; gap: 8px; opacity: .8; }

.composer .attach { align-self: center; }

.lightbox {
    position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
    background: rgba(0, 0, 0, .92);
}
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox-close { position: absolute; top: 12px; right: 12px; color: #fff; background: rgba(255, 255, 255, .16); }
.chat-error { margin: 0; padding: 4px 16px; color: var(--error); font-size: 13px; }

.composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.composer textarea { min-height: 44px; max-height: 140px; padding: 10px 16px; border-radius: 22px; resize: none; }

.menu {
    position: absolute;
    top: 56px;
    right: 8px;
    z-index: 5;
    min-width: 210px;
    padding: 6px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.menu button:hover { background: var(--surface-2); }

/* ---------- profile ---------- */

.profile { display: flex; flex-direction: column; gap: 14px; padding: 16px 20px 24px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h1 { margin: 0 0 6px; font-size: 24px; }
.profile-head .email { margin: 6px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.add-row { display: flex; align-items: stretch; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }
/* «Добавить»: a real button with a word, as tall as the field, easy to hit with a thumb. */
.add-btn { flex: none; height: auto; min-height: 48px; padding: 0 16px; gap: 6px; }
.btn-tonal { background: var(--stu-bg); color: var(--stu-fg); }
.btn-tonal:hover:not(:disabled) { filter: brightness(.96); }
.age-input { max-width: 160px; }

/* The expeditions question: three answers side by side. */
.choices { display: flex; gap: 8px; }
.choice { flex: 1; position: relative; display: flex; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
    flex: 1; display: grid; place-items: center; min-height: 48px; padding: 8px; text-align: center;
    font-weight: 600; font-size: 14px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer;
}
.choice input:checked + span { border: 2px solid var(--secondary); background: var(--stu-bg); color: var(--stu-fg); }
.choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* The guide: Lastik under a student's form, stuck to the bottom of the screen while the form is in view. */
.guide {
    position: sticky; bottom: 0; z-index: 2; display: flex; gap: 10px; align-items: flex-start;
    margin-top: 4px; padding: 12px 14px; background: var(--surface-2);
    border-radius: 22px; box-shadow: 0 6px 22px rgba(6, 38, 80, .18);
}
.guide .pup { flex: none; }
.guide-bubble {
    flex: 1; min-width: 0; max-height: 38vh; overflow-y: auto;
    padding: 8px 12px 4px; background: var(--surface); border-radius: 4px 18px 18px 18px;
}
.guide-bubble p { margin: 2px 0 6px; font-size: 14px; line-height: 1.4; }
.guide-bubble .row { display: flex; flex-wrap: wrap; gap: 4px; }
.guide-bubble .btn-text { height: 34px; padding: 0 8px; }
.guide-head { display: flex; align-items: center; justify-content: space-between; }
.guide-head strong { color: var(--secondary); }
.guide-example { font-style: italic; color: var(--muted); }
.guide-folded { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.guide-folded span { flex: 1; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row div { flex: 1; }
.switch-row strong { display: block; }
.switch-row small { color: var(--muted); }

.switch {
    appearance: none;
    position: relative;
    flex: none;
    width: 52px;
    height: 32px;
    margin: 0;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.switch::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: var(--muted);
    border-radius: 50%;
    transition: transform .2s, background .2s;
}

.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::after { transform: translateX(20px); background: var(--on-primary); }
.msg { margin: 0; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--error); }

/* ---------- overlays ---------- */

#overlay { position: absolute; inset: 0; z-index: 10; pointer-events: none; }

.backdrop {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 12, 24, .55);
    pointer-events: auto;
    animation: fade .15s ease-out;
}

.dialog {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    color: var(--text);
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow);
    animation: pop .18s ease-out;
}

.dialog-icon { font-size: 40px; line-height: 1; text-align: center; }
.dialog h2 { margin: 0; font-size: 22px; }
.dialog p { margin: 0; color: var(--muted); }
.dialog textarea { min-height: 90px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-actions .btn { height: 44px; }

.toast {
    position: absolute;
    left: 50%;
    bottom: 88px;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    color: #fff;
    background: #1B2536;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 14px;
    opacity: 0;
    transform: translate(-50%, 16px);
    transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- welcome & registration ---------- */

.welcome-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.error.light { margin-top: 12px; color: #FFB4AB; }

.welcome-tests {
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    text-align: left;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 20px;
}

.welcome-tests h3 { margin: 0 0 4px; font-size: 14px; }
.welcome-tests p { margin: 0 0 12px; color: rgba(255, 255, 255, .75); font-size: 13px; }
.welcome-tests .row { display: flex; gap: 8px; }
.welcome-tests .row .btn { flex: 1; height: 44px; }

.flow-bar { padding: 10px 16px 10px 8px; gap: 6px; border-bottom: 1px solid var(--border); background: var(--surface); }
.flow-bar h1 { font-size: 20px; }
.flow { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.flow > h2 { margin: 0; font-size: 22px; }
.code-form, .code-form form { display: flex; flex-direction: column; gap: 14px; }
.steps { display: flex; gap: 4px; width: 72px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.steps i.on { background: var(--secondary); }

.role-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 18px;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
}

.role-option:hover { border-color: var(--secondary); }
.role-option:active { transform: scale(.99); }
.role-option.selected { border-color: var(--primary); }
.role-option .emoji { font-size: 32px; line-height: 1; }
.role-option strong { display: block; margin-bottom: 4px; font-size: 17px; }
.role-option span span { color: var(--muted); font-size: 14px; }

/* ---------- profile form ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-grid > :first-child { grid-column: 1 / -1; }

.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-picker { display: flex; align-items: center; gap: 16px; }
.avatar-button { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }

.avatar-edit {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: var(--on-primary);
    background: var(--primary);
    border: 3px solid var(--bg);
    border-radius: 50%;
}

.avatar-side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.avatar-side .help { margin: 0; }

.ready-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.ready-form h3 { margin: 0; font-size: 16px; }
.ready-form .help { margin: -6px 0 0; }
.slider { display: flex; flex-direction: column; gap: 4px; }
.slider-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.slider-top span { color: var(--muted); }
.slider-top strong { text-align: right; }
input[type="range"] { width: 100%; margin: 4px 0; accent-color: var(--secondary); cursor: pointer; }

/* ---------- readiness on cards ---------- */

.readiness {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: 16px;
}

.ready-title { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.ready-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; }
.ready-emoji { font-size: 16px; }
.ready-text { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.ready-text span { color: var(--muted); }
.meter { height: 5px; margin-top: 4px; overflow: hidden; background: var(--bg); border-radius: 3px; }
.meter i { display: block; height: 100%; background: var(--secondary); border-radius: 3px; }

.empty-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 280px; }

/* ---------- the supervisors' questionnaire and portrait ---------- */

.questions { display: flex; flex-direction: column; gap: 12px; }

.question {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 6px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.question.missing { border: 2px solid var(--error); }
.q-title { display: flex; align-items: flex-start; gap: 12px; padding: 0 10px 6px; font-size: 15px; font-weight: 600; }

.q-number {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 50%;
}

.question.done .q-number { color: var(--on-secondary); background: var(--secondary); }

.option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    font-size: 14px;
    border-radius: 12px;
    cursor: pointer;
}

.option:hover { background: var(--surface-2); }
.option input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }

.portrait {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: 16px;
}

.portrait p { margin: 0; }
.portrait-name { font-size: 16px; font-weight: 600; }
.portrait-text, .scale > span:first-child { font-size: 13px; color: var(--muted); }
.portrait-line { font-size: 13px; }
.scale { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.segments { display: flex; gap: 3px; }
.segments i { width: 16px; height: 6px; background: var(--bg); border-radius: 3px; }
.segments i.on { background: var(--secondary); }

.notice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
    color: var(--sup-fg);
    background: var(--sup-bg);
    border-radius: 16px;
}

.notice p { margin: 0; font-size: 14px; }
.notice.calm { color: var(--stu-fg); background: var(--stu-bg); }
.softness { font-size: 14px; font-weight: 600; color: var(--primary); }

.fit { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 14px; border-radius: 16px; border: 1px solid; }
.fit p { margin: 0; }
.fit-level { font-size: 15px; font-weight: 600; }
.fit-note { font-size: 13px; color: var(--muted); }
.fit-good { background: rgba(31, 181, 122, .1); border-color: rgba(31, 181, 122, .5); }
.fit-stretch { background: rgba(185, 121, 26, .1); border-color: rgba(185, 121, 26, .5); }
.fit-hard { background: rgba(229, 72, 77, .1); border-color: rgba(229, 72, 77, .5); }
.warn { margin: 0; font-size: 14px; color: #B9791A; }

/* ---------- waiting list ---------- */

.likes { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.like-section h2 { display: flex; align-items: center; gap: 8px; margin: 12px 4px 10px; font-size: 16px; }

.count {
    min-width: 24px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--stu-bg);
    color: var(--stu-fg);
    font-size: 13px;
    text-align: center;
}

.like-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.like-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.like-person {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0;
    color: inherit;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
}

.like-text { display: flex; flex-direction: column; min-width: 0; }
.like-text strong { font-size: 16px; }
.like-text span { overflow: hidden; color: var(--muted); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.like-text .like-meta { color: var(--secondary); font-weight: 600; }
.like-actions { display: flex; gap: 8px; }
.like-actions .btn { flex: 1; }
.muted.small { margin: 0 4px; font-size: 14px; }

.details { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-height: 60vh; overflow-y: auto; }
.chat-who { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; padding: 0; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }

/* ---------- job offers ---------- */

.jobs { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }

.filter {
    flex: none;
    height: 34px;
    padding: 0 12px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
}

.filter.on { color: var(--stu-fg); background: var(--stu-bg); border-color: transparent; }

.offer-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }

.offer-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.offer-card h3 { margin: 0; font-size: 17px; }

.offer-text {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.offer-foot { display: flex; align-items: center; gap: 8px; }
.offer-foot .btn-text { margin-left: auto; }
.company-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.company-line div { display: flex; flex-direction: column; min-width: 0; }
.company-line strong { font-size: 15px; }
.company-line span { color: var(--muted); font-size: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    border-radius: 999px;
}

.pill.kind { color: var(--com-fg); background: var(--com-bg); }
.pill.school { color: var(--stu-fg); background: var(--stu-bg); }
.pill.closed { color: var(--pass); background: rgba(229, 72, 77, .15); }
.pill.status-sent { color: var(--stu-fg); background: var(--stu-bg); }
.pill.status-invited { color: var(--ok); background: rgba(31, 181, 122, .16); }
.new-badge { padding: 2px 8px; color: #fff; font-size: 12px; font-weight: 700; background: var(--pass); border-radius: 999px; }
.letter { margin: 0; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; background: var(--surface-2); border-radius: 14px; }
.section-title { margin: 6px 0 0; font-size: 16px; }
.bar-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.danger-text { color: var(--pass) !important; }
.btn-like { color: #fff; background: var(--like); }
.application-head { display: flex; align-items: flex-start; gap: 8px; }
.application-head .like-person { flex: 1; min-width: 0; }
.choices.wrap { flex-wrap: wrap; }
.choices.wrap .choice { flex: 1 1 auto; }

/* 0.12: languages in the profile form, the jobs tab's switch, an event's date. */
.choices.languages { flex-wrap: wrap; }
.jobs-switch { padding: 8px 16px 0; }
.event-date { margin: 4px 0; font-weight: 600; color: var(--primary); }

/* Registration's ticks (0.18.1): the terms and, apart from them, the consent to the processing of personal data. */
.tick { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 14px; line-height: 1.45; cursor: pointer; }
.tick input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); }
.tick a, .legal a { color: var(--primary); }
/* The service's documents and who runs it, under the welcome page and the profile. */
.legal { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.legal p { margin: 4px 0; }
.legal .apps { font-size: 14px; margin-bottom: 10px; }
.legal.light, .legal.light a { color: rgba(255, 255, 255, .72); }
.btn.danger { color: var(--error); }
