* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

@font-face {
    font-family: "expoArabic";
    src: url("../fonts/4bf6a2fb87e89fa6-s.p.ttf") format("truetype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "expoArabic";
    src: url("../fonts/12cc825a4ea1cb9f-s.p.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "expoArabic";
    src: url("../fonts/a8d6a1bcd63b5612-s.p.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "expoArabic";
    src: url("../fonts/37d836b25de4ac93-s.p.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #170233;
    --primary-soft: #2a0a4d;
    --accent: #ffa300;
    --ink: #241b33;
    --muted: #6f6885;
    --faint: #9b94ad;
    --line: #e8e4f0;
    --surface: #f6f4fa;
    --surface-strong: #efecf6;
    --paper: #ffffff;
    --danger: #d92d20;
    --success: #12805c;
    --shadow-card: 0 24px 60px rgba(23, 2, 51, 0.1);
    --focus-ring: 0 0 0 4px rgba(23, 2, 51, 0.1);
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

html.modal-open,
body.modal-open {
    overflow: hidden;
}

body {
    min-height: 100svh;
    color: var(--ink);
    background: #faf9fc;
    font-family: "expoArabic", Tahoma, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.signup-shell {
    display: grid;
    direction: ltr;
    grid-template-columns: minmax(380px, 46%) 1fr;
    width: 100%;
    height: 100svh;
    overflow: hidden;
}

/* ---------------------------------- hero ---------------------------------- */

.chalkboard {
    position: relative;
    z-index: 2;
    direction: rtl;
    display: grid;
    place-items: center;
    height: 100svh;
    min-height: 0;
    overflow: visible;
    color: #fff;
    background:
        radial-gradient(120% 90% at 80% 0%, rgba(255, 255, 255, 0.06) 0%, transparent 55%),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.07) 0,
            rgba(255, 255, 255, 0.07) 1px,
            transparent 1px,
            transparent 64px
        ),
        var(--primary);
}

.chalk-mark {
    position: absolute;
    color: rgba(255, 255, 255, 0.09);
    font-weight: 700;
    pointer-events: none;
    user-select: none;
    transform: rotate(-8deg);
}

.mark-a {
    top: 9%;
    right: 14%;
    font-size: clamp(48px, 5vw, 80px);
}

.mark-b {
    top: 16%;
    left: 12%;
    font-size: clamp(22px, 2.2vw, 34px);
    transform: rotate(6deg);
}

.mark-c {
    bottom: 12%;
    right: 16%;
    font-size: clamp(24px, 2.4vw, 38px);
}

.hero-content {
    display: grid;
    justify-items: center;
    gap: clamp(28px, 4.5vh, 44px);
    max-width: 560px;
    padding: 0 clamp(24px, 4vw, 56px);
}

.headline-block {
    text-align: center;
}

.headline-block p,
.headline-block strong {
    display: block;
    margin: 0;
    color: var(--accent);
    font-size: clamp(24px, 2.5vw, 38px);
    font-weight: 700;
    line-height: 1.2;
}

.headline-block h1 {
    display: inline-block;
    margin: 8px 0 10px;
    padding-bottom: 6px;
    color: #fff;
    border-bottom: clamp(5px, 0.55vw, 8px) solid var(--accent);
    font-size: clamp(38px, 3.9vw, 62px);
    font-weight: 700;
    line-height: 1.05;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: clamp(13px, 1vw, 15px);
    font-weight: 500;
    white-space: nowrap;
}

.mini-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    color: var(--accent);
    font-size: 15px;
}

.brand-badge {
    position: absolute;
    left: 100%;
    top: 50%;
    z-index: 20;
    display: grid;
    place-items: center;
    width: clamp(110px, 9.5vw, 148px);
    height: clamp(110px, 9.5vw, 148px);
    transform: translate(-50%, -50%);
}

.brand-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(23, 2, 51, 0.28));
}

.hero-footnote {
    position: absolute;
    bottom: 18px;
    left: 0;
    right: 0;
    margin: 0;
    color: rgba(255, 255, 255, 0.4);
    direction: ltr;
    text-align: center;
    font-size: 11.5px;
    font-weight: 400;
    letter-spacing: 0.04em;
}

/* -------------------------------- form side ------------------------------- */

.form-stage {
    position: relative;
    z-index: 1;
    direction: rtl;
    display: grid;
    place-items: center;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
    padding: clamp(20px, 3.5vh, 40px) clamp(24px, 5vw, 80px);
    background: #faf9fc;
}

.notebook-card {
    position: relative;
    display: flex;
    width: min(600px, 100%);
    max-height: min(760px, calc(100svh - 48px));
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-card);
}

.notebook-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    content: "";
    background: linear-gradient(90deg, var(--accent), #ffc95c);
}

.form-content {
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(28px, 4.5vh, 40px) clamp(28px, 3.2vw, 48px) clamp(24px, 3.5vh, 36px);
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 2, 51, 0.18) transparent;
}

.form-content::-webkit-scrollbar {
    width: 5px;
}

.form-content::-webkit-scrollbar-thumb {
    background: rgba(23, 2, 51, 0.18);
    border-radius: 999px;
}

.form-heading {
    margin-bottom: clamp(18px, 3vh, 26px);
    text-align: center;
}

.tag {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 16px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.form-heading h2 {
    margin: 0;
    color: var(--primary);
    font-size: clamp(24px, 2.2vw, 30px);
    font-weight: 700;
    line-height: 1.2;
}

.form-heading p {
    margin: 8px auto 0;
    max-width: 340px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.6;
}

.notice {
    margin-bottom: 18px;
    padding: 13px 16px;
    color: var(--success);
    background: #ecfaf3;
    border: 1px solid #c4ecd8;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.5;
}

form {
    display: grid;
    gap: clamp(14px, 2vh, 18px);
}

/* ------------------------------ choice screen ----------------------------- */

.student-flow {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: clamp(18px, 3vh, 28px);
    min-height: clamp(380px, 56vh, 520px);
    text-align: center;
}

.step-kicker {
    padding: 6px 14px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.student-flow-copy {
    display: grid;
    gap: 8px;
}

.student-flow h3 {
    margin: 0;
    color: var(--primary);
    font-size: clamp(26px, 2.8vw, 36px);
    font-weight: 700;
    line-height: 1.15;
}

.student-flow p {
    margin: 0 auto;
    max-width: 360px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.terms-modal-open {
    overflow: hidden;
}

.terms-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 2, 51, 0.42);
    backdrop-filter: blur(10px);
}

.terms-modal-overlay[hidden] {
    display: none;
}

.terms-modal {
    position: relative;
    display: grid;
    gap: 10px;
    width: min(660px, 100%);
    max-height: calc(100svh - 36px);
    padding: clamp(20px, 3vw, 28px);
    overflow: visible;
    color: var(--primary);
    text-align: center;
    background: var(--paper);
    border: 1px solid rgba(23, 2, 51, 0.08);
    border-top: 5px solid var(--accent);
    border-radius: 24px;
    box-shadow: 0 28px 70px rgba(23, 2, 51, 0.28);
}

.terms-modal-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: var(--accent);
    border: 5px solid var(--paper);
    border-radius: 999px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.terms-modal-head {
    display: grid;
    gap: 6px;
    padding-inline: 42px;
}

.terms-modal-head .tag {
    justify-self: center;
    margin-bottom: 0;
}

.terms-modal h2 {
    margin: 0;
    color: var(--primary);
    font-size: clamp(24px, 2.5vw, 32px);
    font-weight: 700;
    line-height: 1.15;
}

.terms-modal p {
    margin: 0 auto;
    max-width: 380px;
    color: var(--muted);
    font-size: 12.8px;
    line-height: 1.45;
}

.terms-box {
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 12px 16px;
    color: var(--primary);
    text-align: right;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.terms-box:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.terms-box ul {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0 18px 0 0;
}

.terms-box li {
    padding-inline-start: 4px;
    color: #4f5564;
    font-size: 12px;
    line-height: 1.36;
}

.terms-box li::marker {
    color: var(--accent);
}

.terms-agreement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    cursor: pointer;
}

.terms-agreement input {
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    background: #fff;
    border: 2px solid #d8cfdf;
    border-radius: 5px;
    cursor: pointer;
}

.terms-agreement input:checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 3px #fff;
}

.terms-agreement input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 159, 0, 0.22);
}

.terms-error {
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
}

.terms-continue-button {
    min-height: 46px;
    width: min(360px, 100%);
    justify-self: center;
}

.student-type-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
}

.student-type-button,
.existing-result {
    font: inherit;
    cursor: pointer;
}

.student-type-button {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 8px;
    min-height: clamp(120px, 17vh, 150px);
    padding: 20px 16px;
    color: var(--primary);
    text-align: center;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 18px;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.student-type-button strong {
    font-size: clamp(16px, 1.4vw, 19px);
    font-weight: 700;
}

.student-type-button > span {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.55;
}

.student-type-button:hover {
    border-color: var(--primary);
    box-shadow: 0 14px 30px rgba(23, 2, 51, 0.1);
    transform: translateY(-2px);
}

.student-type-button:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.student-type-button.is-active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.student-type-button.is-active > span {
    color: rgba(255, 255, 255, 0.78);
}

.registration-form[hidden],
.student-flow[hidden] {
    display: none;
}

/* ------------------------------- step wizard ------------------------------ */

.wizard-steps {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
}

.wizard-steps::before,
.wizard-steps::after {
    position: absolute;
    top: 16px;
    right: var(--wizard-edge, 25%);
    left: var(--wizard-edge, 25%);
    height: 3px;
    content: "";
    border-radius: 999px;
}

.wizard-steps::before {
    background: var(--surface-strong);
}

.wizard-steps::after {
    background: var(--primary);
    transform: scaleX(var(--wizard-progress, 0));
    transform-origin: right center;
    transition: transform 220ms ease;
}

.wizard-step {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 7px;
    flex: 1 1 0;
    min-width: 0;
    color: var(--faint);
    font-size: 12px;
    font-weight: 700;
}

.wizard-step[hidden] {
    display: none;
}

.wizard-step span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--faint);
    background: var(--paper);
    border: 2px solid var(--surface-strong);
    border-radius: 50%;
    box-shadow: 0 0 0 5px var(--paper);
    font-size: 14px;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.wizard-step strong {
    max-width: 100%;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wizard-step.is-active,
.wizard-step.is-complete {
    color: var(--primary);
}

.wizard-step.is-active span,
.wizard-step.is-complete span {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.form-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
}

.form-step-header .step-kicker {
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 12px;
}

.back-step-button {
    min-height: 32px;
    padding: 0 4px;
    color: var(--muted);
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 160ms ease;
}

.back-step-button:hover {
    color: var(--primary);
}

/* ------------------------------- form screens ----------------------------- */

.form-screen {
    display: grid;
    gap: clamp(14px, 2vh, 18px);
}

.form-screen[hidden] {
    display: none;
}

.screen-heading {
    display: grid;
    gap: 5px;
}

.screen-heading h3 {
    margin: 0;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
}

.screen-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.wizard-actions {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.final-actions {
    grid-template-columns: auto 1fr 1.3fr;
}

.submit-button.pay-later-button {
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: none;
}

.submit-button.pay-later-button:hover {
    background: var(--surface-strong);
    box-shadow: none;
    transform: translateY(-1px);
}

.registered-flag {
    color: var(--success);
    font-weight: 700;
}

.pay-later-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 2, 51, 0.55);
    backdrop-filter: blur(3px);
}

.pay-later-modal[hidden] {
    display: none;
}

.pay-later-dialog {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(440px, 100%);
    padding: 30px 26px 24px;
    text-align: center;
    background: var(--paper);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(23, 2, 51, 0.35);
    animation: pay-later-pop 200ms ease;
}

@keyframes pay-later-pop {
    from { transform: translateY(12px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.pay-later-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    color: #fff;
    background: var(--accent);
    border-radius: 50%;
    font-size: 30px;
    font-weight: 800;
}

.pay-later-dialog h3 {
    margin: 0;
    color: var(--primary);
    font-size: 21px;
    font-weight: 700;
}

.pay-later-dialog p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.pay-later-dialog p strong {
    color: var(--primary);
}

.pay-later-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
}

.pay-later-actions .submit-button,
.pay-later-actions .secondary-step-button {
    min-height: 48px;
    box-shadow: none;
}

.already-registered {
    display: grid;
    gap: 6px;
    padding: 20px 16px;
    text-align: center;
    background: #ecfaf3;
    border: 1px solid #c4ecd8;
    border-radius: 18px;
}

.already-registered strong {
    color: var(--primary);
    font-size: 16px;
    font-weight: 700;
}

.already-registered p {
    margin: 0;
    color: var(--success);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

.already-registered span {
    color: #2c7a5b;
    font-size: 12.5px;
    line-height: 1.6;
}

.already-registered-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: center;
    padding: 6px 16px;
    margin-top: 2px;
    color: var(--primary);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: #fff;
    border: 1.5px dashed var(--accent);
    border-radius: 12px;
}

.already-registered-code small {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
}

.app-cta {
    display: grid;
    gap: 10px;
    padding: 18px 16px;
    text-align: center;
    background: var(--surface);
    border-radius: 18px;
}

.app-cta h4 {
    margin: 0;
    color: var(--primary);
    font-size: 14.5px;
}

.app-cta p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.75;
}

.app-cta ol {
    margin: 0;
    padding-inline-start: 18px;
    color: var(--ink);
    font-size: 12.5px;
    line-height: 1.9;
    text-align: right;
}

.app-cta-stores {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.store-badge {
    display: inline-flex;
    line-height: 0;
}

.store-badge img {
    display: block;
    height: 46px;
    width: auto;
}

.wizard-actions .next-step-button {
    width: 100%;
}

.secondary-step-button {
    min-height: 48px;
    padding: 0 20px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}

.secondary-step-button:hover {
    background: var(--surface-strong);
    border-color: #d9d2e6;
}

.secondary-step-button:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* --------------------------------- fields --------------------------------- */

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.birthdate-field {
    grid-column: 1 / -1;
}

.birthdate-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    direction: rtl;
}

.birthdate-inputs input {
    text-align: center;
}

.field span,
.choice-panel legend {
    color: #4d445f;
    font-size: 13px;
    font-weight: 600;
}

.field input,
.select-wrap select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid transparent;
    border-radius: 13px;
    outline: 0;
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder {
    color: var(--faint);
    opacity: 1;
    font-weight: 300;
}

.email-field input {
    direction: rtl;
    text-align: right;
}

.select-wrap select:invalid {
    color: var(--faint);
}

.field input:hover,
.select-wrap select:hover {
    border-color: #ddd6e8;
}

.field input:focus,
.select-wrap select:focus {
    background: var(--paper);
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.field.has-client-error input,
.choice-panel.has-client-error select,
.phone-grid.has-client-error input[aria-invalid="true"] {
    border-color: var(--danger);
    background: #fff8f7;
}

.phone-field,
.institution-field,
.email-field,
.address-field,
.photo-field {
    grid-column: 1 / -1;
}

.autocomplete-control {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 190px;
    overflow-y: auto;
    padding: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 14px 34px rgba(23, 2, 51, 0.16);
}

.autocomplete-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    color: var(--ink);
    text-align: right;
    background: transparent;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
    color: var(--primary);
    background: var(--surface);
}

/* ------------------------------- photo upload ----------------------------- */

.photo-field input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.photo-upload-box {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1.5px dashed #d3c9e2;
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.photo-upload-box:hover {
    background: #fbfaff;
    border-color: var(--primary);
}

.photo-preview {
    position: relative;
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    overflow: hidden;
    background: var(--primary);
    background-position: center;
    background-size: cover;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(23, 2, 51, 0.14);
}

.photo-preview.has-image {
    background-color: #fff;
}

.photo-preview.has-image .photo-placeholder-icon {
    display: none;
}

.photo-placeholder-icon {
    position: relative;
    width: 26px;
    height: 26px;
    color: rgba(255, 255, 255, 0.85);
}

.photo-placeholder-icon::before {
    position: absolute;
    top: 0;
    left: 6.5px;
    width: 13px;
    height: 13px;
    content: "";
    border: 2px solid currentColor;
    border-radius: 50%;
}

.photo-placeholder-icon::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 26px;
    height: 14px;
    content: "";
    border: 2px solid currentColor;
    border-bottom: 0;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.photo-upload-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.photo-upload-copy strong {
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
}

.photo-upload-copy small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
}

.photo-upload-action {
    padding: 9px 16px;
    color: var(--primary);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

/* --------------------------------- selects -------------------------------- */

.select-wrap {
    position: relative;
}

.select-wrap::after {
    position: absolute;
    top: 50%;
    left: 17px;
    width: 8px;
    height: 8px;
    content: "";
    border-left: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint);
    pointer-events: none;
    transform: translateY(-65%) rotate(-45deg);
}

.select-wrap select {
    padding: 0 14px;
    padding-left: 42px;
    appearance: none;
    cursor: pointer;
}

.choice-panel {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.choice-panel legend {
    display: block;
    margin-bottom: 6px;
    padding: 0;
}

/* ---------------------------------- phones -------------------------------- */

.phone-grid {
    grid-column: 1 / -1;
}

.phone-grid input {
    direction: ltr;
    text-align: right;
}

.phone-grid .field span em {
    color: var(--faint);
    font-size: 11px;
    font-style: normal;
    font-weight: 400;
}

.phone-note {
    color: #7a5410;
    background: #fff7e8;
    border: 1px solid #fbe3b5;
    border-radius: 9px;
    padding: 7px 10px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.5;
}

.phone-errors {
    grid-column: 1 / -1;
}

.welcome-back {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    color: var(--success);
    background: #ecfaf3;
    border: 1px solid #c4ecd8;
    border-radius: 14px;
    text-align: center;
}

.welcome-back strong {
    font-size: 15.5px;
    font-weight: 700;
}

.welcome-back span {
    color: #2c7a5b;
    font-size: 12.5px;
    line-height: 1.5;
}

/* --------------------------- existing student flow ------------------------ */

.existing-student-panel {
    display: grid;
    gap: 12px;
}

.existing-student-panel[hidden] {
    display: none;
}

.search-status {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.search-status:empty {
    display: none;
}

.existing-results {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow: auto;
    scrollbar-width: thin;
}

.existing-results.is-confirmation {
    max-height: none;
    overflow: visible;
}

.existing-result {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
    width: 100%;
    padding: 12px 14px;
    color: var(--ink);
    text-align: right;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    transition: border-color 160ms ease, background 160ms ease;
}

.existing-result:hover {
    border-color: var(--primary);
}

.existing-result strong {
    min-width: 0;
    overflow: hidden;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.existing-result span,
.existing-result small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.existing-result small {
    grid-column: 1 / -1;
}

.existing-result.is-selected {
    background: var(--surface);
    border-color: var(--primary);
}

.existing-confirmation {
    display: grid;
    gap: 6px;
    padding: 20px 16px;
    color: var(--ink);
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.existing-confirmation > span {
    justify-self: center;
    padding: 5px 14px;
    color: var(--primary);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.existing-confirmation p {
    margin: 8px 0 0;
    color: var(--primary);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}

.existing-confirmation strong {
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.existing-confirmation small {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 400;
}

.confirmation-actions {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.confirm-existing-button,
.reject-existing-button,
.continue-new-button {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 13px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.confirm-existing-button {
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
}

.confirm-existing-button:hover {
    background: var(--primary-soft);
}

.reject-existing-button {
    color: var(--primary);
    background: var(--paper);
    border: 1px solid #d9d2e6;
}

.reject-existing-button:hover {
    border-color: var(--primary);
}

.continue-new-button {
    color: var(--primary);
    background: var(--paper);
    border: 1.5px dashed #d3c9e2;
}

.continue-new-button:hover {
    border-color: var(--primary);
}

/* --------------------------------- subjects ------------------------------- */

.subject-picker {
    display: grid;
    gap: 8px;
}

.selected-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-subjects:empty {
    display: none;
}

.subject-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 7px 12px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.subject-chip button {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    padding: 0;
    color: var(--primary);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease;
}

.subject-chip button:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* ------------------------------ errors & notes ---------------------------- */

small {
    display: block;
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

small:empty {
    display: none;
}

.payment-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    color: #7a5410;
    background: #fff7e8;
    border: 1px solid #fbe3b5;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.5;
}

.payment-note span {
    min-width: 0;
}

.payment-note strong {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 15px;
    font-weight: 700;
}

/* --------------------------------- buttons -------------------------------- */

.submit-button {
    display: inline-grid;
    place-items: center;
    width: 100%;
    min-height: 50px;
    color: #fff;
    background: var(--primary);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(23, 2, 51, 0.22);
    font: inherit;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.submit-button:hover {
    background: var(--primary-soft);
    box-shadow: 0 16px 30px rgba(23, 2, 51, 0.28);
    transform: translateY(-1px);
}

.submit-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), 0 12px 26px rgba(23, 2, 51, 0.22);
}

.pay-button {
    position: relative;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 0 16px;
}

.pay-button img {
    display: block;
    width: 46px;
    height: 25px;
    object-fit: contain;
    padding: 2px 5px;
    background: #fff;
    border-radius: 7px;
}

.pay-button span {
    justify-self: center;
}

.button-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-spin 800ms linear infinite;
}

.pay-button.is-loading {
    grid-template-columns: auto 1fr auto;
    opacity: 0.92;
    cursor: wait;
}

.pay-button.is-loading .button-spinner {
    display: block;
}

.pay-button:disabled {
    transform: none;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

/* -------------------------------- responsive ------------------------------ */

@media (max-width: 1100px) {
    .signup-shell {
        grid-template-columns: minmax(340px, 42%) 1fr;
    }

    .form-stage {
        padding-inline: clamp(20px, 3vw, 40px);
    }
}

@media (max-width: 940px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .signup-shell {
        display: block;
        height: auto;
        min-height: 100svh;
        overflow: visible;
        direction: rtl;
    }

    .chalkboard {
        height: auto;
        min-height: 0;
        padding: 28px 20px 58px;
        overflow: visible;
    }

    .hero-content {
        gap: 16px;
        padding: 0;
    }

    .headline-block p,
    .headline-block strong {
        font-size: clamp(18px, 5.2vw, 24px);
    }

    .headline-block h1 {
        margin: 4px 0 6px;
        padding-bottom: 4px;
        border-bottom-width: 4px;
        font-size: clamp(28px, 8vw, 38px);
    }

    .chalk-mark {
        display: none;
    }

    .feature-list {
        grid-template-columns: repeat(2, minmax(0, auto));
        justify-content: center;
        gap: 8px;
        max-width: none;
        width: auto;
    }

    .feature-list li {
        padding: 8px 14px;
        font-size: 12.5px;
    }

    .mini-icon {
        width: 18px;
        height: 18px;
        font-size: 13px;
    }

    .brand-badge {
        left: 50%;
        top: auto;
        bottom: 0;
        width: 92px;
        height: 92px;
        transform: translate(-50%, 50%);
    }

    .hero-footnote {
        position: static;
        margin-top: 14px;
        font-size: 10.5px;
    }

    .form-stage {
        display: block;
        height: auto;
        min-height: 0;
        overflow: visible;
        padding: 68px 16px 32px;
    }

    .notebook-card {
        width: min(600px, 100%);
        max-height: none;
        margin-inline: auto;
        overflow: visible;
        border-radius: 24px;
    }

    .form-content {
        overflow: visible;
        padding: 28px 22px 26px;
    }

    .student-flow {
        min-height: 0;
        padding: 8px 0;
    }

    .terms-modal-overlay {
        align-items: end;
        padding: 14px;
    }

    .terms-modal {
        max-height: calc(100svh - 28px);
        border-radius: 22px;
        overflow: auto;
    }

    .terms-modal-head {
        padding-inline: 34px;
    }
}

@media (max-width: 560px) {
    .chalkboard {
        padding: 30px 16px 58px;
    }

    .feature-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .feature-list li {
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
    }

    .form-stage {
        padding: 62px 12px 28px;
    }

    .form-content {
        padding: 26px 18px 24px;
    }

    .form-heading h2 {
        font-size: 23px;
    }

    .student-type-buttons {
        grid-template-columns: 1fr;
    }

    .student-type-button {
        min-height: 0;
        padding: 18px 16px;
    }

    .terms-box {
        padding: 12px 12px;
        max-height: none;
    }

    .terms-box li {
        font-size: 11.4px;
        line-height: 1.32;
    }

    .terms-agreement {
        align-items: flex-start;
        text-align: right;
    }

    .terms-modal {
        gap: 9px;
        padding: 20px 16px 18px;
    }

    .terms-modal-icon {
        top: 18px;
        right: 14px;
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .terms-modal h2 {
        font-size: 24px;
    }

    .terms-modal p {
        font-size: 12px;
    }

    .terms-agreement {
        font-size: 12.4px;
    }

    .terms-continue-button {
        min-height: 44px;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .wizard-step span {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .wizard-step {
        font-size: 11px;
    }

    .form-step-header {
        flex-wrap: wrap;
    }

    .wizard-actions,
    .final-actions {
        grid-template-columns: 1fr;
    }

    .wizard-actions .secondary-step-button {
        order: 2;
    }

    .photo-upload-box {
        grid-template-columns: 56px 1fr;
    }

    .photo-preview {
        width: 56px;
        height: 56px;
    }

    .photo-upload-action {
        display: none;
    }

    .payment-note {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}
