/* =========================================================
   Kutchi Marathon – registration UI
   Mobile-first, no framework. Brand colours from the event banner.
   ========================================================= */

:root {
    --brand:        #d6177a;   /* magenta from banner */
    --brand-600:    #b8106a;
    --brand-50:     #fdeef6;
    --accent:       #f39200;   /* runner orange */
    --navy:         #1d2b4f;
    --ink:          #1f2433;
    --ink-2:        #5b6275;
    --line:         #e4e6ee;
    --bg:           #f6f5fa;
    --card:         #ffffff;
    --ok:           #17864b;
    --ok-50:        #e7f6ee;
    --warn:         #a35b00;
    --warn-50:      #fff3e0;
    --danger:       #c62828;
    --danger-50:    #fdecec;

    --radius:       14px;
    --radius-sm:    10px;
    --shadow:       0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .06);
    --focus:        0 0 0 3px rgba(214, 23, 122, .25);
    --font:         system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 16px/1.5 var(--font);
    color: var(--ink);
    background: var(--bg);
    padding-bottom: 72px;            /* room for mockup nav */
}
img { max-width: 100%; display: block; }
a { color: var(--brand); }
h1, h2 { line-height: 1.25; margin: 0 0 .5rem; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.mt { margin-top: 1rem; }

/* ---------- Header ---------- */
.hero__banner { width: 100%; aspect-ratio: 1906 / 774; object-fit: cover; }
.hero__strip { background: var(--navy); color: #fff; }
.hero__meta {
    display: grid; grid-template-columns: 1fr; gap: 8px;
    padding-top: 12px; padding-bottom: 12px;
}
.meta { display: flex; align-items: center; gap: 10px; }
.meta__icon { font-size: 1.1rem; }
.meta b { display: block; font-size: .95rem; }
.meta small { display: block; opacity: .7; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 639px) {
    .hero__meta { gap: 4px; padding-top: 10px; padding-bottom: 10px; }
    .meta small { display: none; }
    .meta b { font-weight: 600; font-size: .875rem; }
}
@media (min-width: 640px) { .hero__meta { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Stepper ---------- */
.stepper {
    list-style: none; margin: 20px 0 16px; padding: 0;
    display: grid; grid-template-columns: repeat(4, 1fr);
    counter-reset: s;
}
.stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.stepper li::before {               /* connector line */
    content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px;
    background: var(--line); z-index: 0;
}
.stepper li:first-child::before { display: none; }
.stepper__dot {
    position: relative; z-index: 1;
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700; font-size: .875rem;
    background: #fff; border: 2px solid var(--line); color: var(--ink-2);
}
.stepper__label { font-size: .75rem; color: var(--ink-2); font-weight: 600; }
.stepper li.is-active .stepper__dot { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: var(--focus); }
.stepper li.is-active .stepper__label { color: var(--brand); }
.stepper li.is-done .stepper__dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.stepper li.is-done::before, .stepper li.is-active::before { background: var(--ok); }
@media (min-width: 640px) { .stepper__label { font-size: .85rem; } }

/* ---------- Screens ---------- */
.screen { display: none; animation: fade .25s ease; }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 16px;
}
@media (min-width: 640px) { .card { padding: 28px; } }
.card--narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card--center { text-align: center; max-width: 560px; margin-left: auto; margin-right: auto; }
.card__title { font-size: 1.5rem; color: var(--navy); }
.card__title--sm { font-size: 1.1rem; }
.card--declare { border-left: 4px solid var(--brand); }

.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; color: var(--navy); margin-bottom: 16px; }
.section-title__no {
    width: 26px; height: 26px; border-radius: 8px; flex: none;
    display: grid; place-items: center; font-size: .8rem;
    background: var(--brand-50); color: var(--brand);
}

/* ---------- Grid ---------- */
.grid { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
    .grid--2 { grid-template-columns: 1fr 1fr; }
    .grid--3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field__label { font-weight: 600; font-size: .9rem; }
.field__hint { font-size: .8rem; color: var(--ink-2); }
.field__error { font-size: .8rem; color: var(--danger); min-height: 0; }
.field__error:empty { display: none; }

input:not([type=checkbox]):not([type=radio]):not([type=file]), select {
    width: 100%; min-height: 48px;
    padding: 10px 14px;
    font: inherit; color: inherit;
    background: #fff;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6275' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
/* Must match the base input selector's specificity, otherwise text boxes never turn red */
input.is-invalid:not([type=checkbox]):not([type=radio]):not([type=file]),
select.is-invalid { border-color: var(--danger); background-color: var(--danger-50); }
.input-group:has(input.is-invalid) .input-group__prefix { border-color: var(--danger); background: var(--danger-50); color: var(--danger); }
.field:has(> input.is-invalid, > select.is-invalid, > .input-group > input.is-invalid) > .field__hint { color: var(--danger); }
input[readonly] { background: var(--bg); }

.input-group { display: flex; }
.input-group__prefix {
    display: grid; place-items: center; padding: 0 12px;
    border: 1.5px solid var(--line); border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--bg); font-weight: 600; color: var(--ink-2);
}
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }

/* Checkbox confirmations */
.check {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; margin-top: 8px;
    border-radius: var(--radius-sm); background: var(--bg);
    font-size: .9rem; cursor: pointer;
}
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check:has(input:checked) { background: var(--ok-50); }
.check.is-invalid { background: var(--danger-50); outline: 1.5px solid var(--danger); }

/* Segmented radio (gender) */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: grid; place-items: center; min-height: 48px;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font-weight: 600; cursor: pointer; background: #fff;
}
.segmented input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }
.segmented.is-invalid span { border-color: var(--danger); }

/* OTP */
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp input { text-align: center; font-size: 1.4rem; font-weight: 700; padding: 0 !important; min-height: 56px !important; }
.otp-sent { background: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; }
.resend { text-align: center; font-size: .9rem; margin: 14px 0 0; }

/* Dropzone */
.dropzone {
    position: relative; display: block;
    border: 2px dashed var(--line); border-radius: var(--radius);
    padding: 20px; text-align: center; cursor: pointer; background: #fcfcfe;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: var(--brand-50); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-2); }
.dropzone__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 1.2rem; }
.dropzone__file { display: flex; align-items: center; gap: 12px; text-align: left; position: relative; z-index: 1; }
.dropzone__file small { display: block; color: var(--ink-2); }
.dropzone__file .link { margin-left: auto; }
.dropzone__thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--bg) center/cover; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--ink-2); flex: none; }
.dropzone.has-file { border-style: solid; border-color: var(--ok); background: #fff; }
.dropzone.is-invalid { border-color: var(--danger); background: var(--danger-50); }

/* Category cards */
.cats { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 480px) { .cats { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .cats { grid-template-columns: repeat(5, 1fr); } }
.cat { position: relative; cursor: pointer; }
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.cat__body {
    display: flex; flex-direction: column; gap: 2px; height: 100%;
    padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius);
    background: #fff; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.cat:hover .cat__body { border-color: var(--brand); }
.cat__dist { font-size: 1.35rem; font-weight: 800; color: var(--navy); }
.cat__name { font-size: .85rem; color: var(--ink-2); }
.cat__price { margin-top: 6px; font-weight: 700; color: var(--brand); }
/* Phones: compact one-line rows instead of tall tiles */
@media (max-width: 479px) {
    .cat__body {
        display: grid; grid-template-columns: 72px 1fr auto; align-items: center;
        column-gap: 10px; padding: 12px 14px;
    }
    .cat__dist { font-size: 1.15rem; }
    .cat__price { margin: 0; grid-column: 3; grid-row: 1; }
    .cat__why { grid-column: 2 / 4; }
}
.cat__price--free { color: var(--ok); }
.cat__why { font-size: .75rem; color: var(--danger); }
.cat__why:empty { display: none; }
.cat input:checked + .cat__body { border-color: var(--brand); background: var(--brand-50); box-shadow: var(--focus); }
.cat input:focus-visible + .cat__body { box-shadow: var(--focus); }
.cat input:disabled + .cat__body { opacity: .5; cursor: not-allowed; background: var(--bg); }
.cats.is-invalid .cat__body { border-color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 22px;
    font: 600 1rem var(--font); border-radius: var(--radius-sm);
    border: 1.5px solid transparent; cursor: pointer;
    transition: background .15s, transform .05s, box-shadow .15s;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-600); }
.btn--ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--navy); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--lg { min-height: 56px; font-size: 1.1rem; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading::after {
    content: ""; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }

.link {
    background: none; border: 0; padding: 0; font: inherit; color: var(--brand);
    font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
    align-self: flex-start;
}
.link:disabled { color: var(--ink-2); text-decoration: none; cursor: default; font-weight: 400; }

/* ---------- Badges & notes ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge--success { background: var(--ok-50); color: var(--ok); }
.badge--warn { background: var(--warn-50); color: var(--warn); }

.verified-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    padding: 12px 16px; margin-bottom: 16px;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); font-size: .95rem;
}
.verified-bar .link { margin-left: auto; font-size: .875rem; }

/* One-runner rule (verify screen) and past-entry prefill note (details screen) */
.rule, .prefill-note {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem;
}
.rule { background: var(--brand-50); color: var(--ink); margin: 4px 0 16px; }
.prefill-note { background: #fffbe6; border: 1px solid #f1d872; margin-bottom: 16px; }
.prefill-note .link { align-self: auto; }

/* ---------- Sticky action bar ---------- */
.actionbar {
    position: sticky; bottom: 56px; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; margin: 0 -4px 16px;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
    border-radius: var(--radius); box-shadow: 0 -2px 20px rgba(20, 24, 40, .12);
}
.actionbar__total small { display: block; font-size: .75rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.actionbar__total b { font-size: 1.35rem; color: var(--navy); }

/* ---------- Summary ---------- */
.summary { display: grid; grid-template-columns: 1fr; gap: 0; margin: 16px 0; }
@media (min-width: 640px) { .summary { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
.summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--ink-2); font-size: .9rem; }
.summary dd { margin: 0; font-weight: 600; text-align: right; }
.summary--compact { grid-template-columns: 1fr !important; text-align: left; }

.pay-card__row { display: flex; justify-content: space-between; padding: 6px 0; }
.pay-card__total { border-top: 1px solid var(--line); margin: 6px 0 16px; padding-top: 12px; font-size: 1.15rem; }
.secure { text-align: center; margin: 12px 0 0; }

/* ---------- Result screens ---------- */
.result-icon {
    width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
    display: grid; place-items: center; font-size: 2rem; font-weight: 800;
    background: var(--bg); color: var(--ink-2);
}
.result-icon--ok { background: var(--ok-50); color: var(--ok); }
.result-icon--fail { background: var(--danger-50); color: var(--danger); }
.result-icon--warn { background: var(--warn-50); color: var(--warn); }
.urn {
    display: inline-flex; flex-direction: column; margin: 12px auto 4px;
    padding: 12px 28px; border-radius: var(--radius);
    background: var(--brand-50); border: 1.5px dashed var(--brand);
}
.urn small { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.urn b { font-size: 1.8rem; letter-spacing: .04em; color: var(--brand); }
.notice { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--ok-50); padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem; overflow-wrap: anywhere; }
.summary dd { overflow-wrap: anywhere; }

/* ---------- Modal, toast, table ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(15, 18, 32, .55); }
.modal__box { width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.rzp-head { display: flex; justify-content: space-between; align-items: center; padding: 14px; margin: -20px -20px 14px; background: #0c2451; color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .9rem; }
.table th, .table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }

.toast {
    position: fixed; left: 50%; bottom: 80px; z-index: 60; transform: translate(-50%, 20px);
    max-width: calc(100% - 32px); padding: 12px 18px; border-radius: var(--radius-sm);
    background: var(--ink); color: #fff; font-size: .9rem; box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--danger); }

.foot { text-align: center; padding: 24px 0 8px; }

/* ---------- Mockup-only helpers ---------- */
.mock-hint { margin: 14px 0 0; padding: 8px 12px; border-radius: 8px; background: #fffbe6; border: 1px dashed #e0c200; font-size: .8rem; text-align: center; }
.mocknav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; gap: 6px; align-items: center; overflow-x: auto;
    padding: 10px 12px; background: #20232d; color: #fff; font-size: .8rem;
}
.mocknav b { white-space: nowrap; margin-right: 4px; color: #ffd54f; }
.mocknav button { flex: none; background: #3a3f50; color: #fff; border: 0; border-radius: 6px; padding: 6px 10px; font: inherit; cursor: pointer; }
.mocknav button.is-active { background: var(--brand); }

@media print {
    .hero, .stepper, .mocknav, .btn-row, .foot { display: none !important; }
    body { background: #fff; padding: 0; }
    .card { box-shadow: none; }
}

/* ---------- Category notes, 21 km certificate ---------- */
.cat-rules { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.cat-rules span { padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-weight: 600; font-size: .78rem; }
.cat__tag { font-size: .75rem; color: var(--accent); font-weight: 600; }
@media (max-width: 479px) { .cat__tag { grid-column: 2 / 4; } }
.info-box { padding: 10px 12px; border-radius: var(--radius-sm); background: #eef4ff; border: 1px solid #c9dafc; color: var(--ink); }

/* ---------- Rules & Regulations ---------- */
.rules {
    max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
    padding: 4px 16px 8px; margin-bottom: 4px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fcfcfe;
    font-size: .9rem;
}
.rules:focus-visible { outline: none; box-shadow: var(--focus); }
.rules h3 { font-size: .95rem; color: var(--navy); margin: 14px 0 6px; }
.rules ul { margin: 0; padding-left: 18px; }
.rules li { margin-bottom: 6px; }
.rules li::marker { color: var(--brand); }
#rules-modal .rules { max-height: 60vh; }
.modal__box--wide { max-width: 640px; }

/* Stacked notices on the success screen */
.notice + .notice { margin-top: 10px; }
.notice--info { background: #eef4ff; }

/* ---------- Live page (no mockup navigator at the bottom) ---------- */
body.live { padding-bottom: 16px; }
body.live .actionbar { bottom: 12px; }
body.live .toast { bottom: 24px; }
