:root {
    --map-primary: #2563eb;
    --map-primary-dark: #1d4ed8;
    --map-navy: #0f172a;
    --map-text: #172033;
    --map-muted: #64748b;
    --map-border: #dbe3ef;
    --map-background: #f3f6fb;
    --map-card: #ffffff;
    --map-success: #16a34a;
    --map-danger: #dc2626;
    --map-warning-bg: #fff8df;
    --map-warning-border: #f2cf66;
    --map-radius: 20px;
    --map-shadow: 0 22px 55px rgba(15, 23, 42, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.map-public-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--map-text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 34%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.10), transparent 30%),
        var(--map-background);
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.map-public-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.map-public-header {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.map-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
}

.map-brand img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 12px;
    background: #ffffff;
    padding: 5px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.map-brand-text {
    display: flex;
    flex-direction: column;
}

.map-brand-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--map-navy);
}

.map-brand-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--map-muted);
}

.map-public-main {
    width: min(1180px, calc(100% - 40px));
    margin: auto;
    padding: 24px 0 54px;
}

.map-page-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(219, 227, 239, 0.95);
    border-radius: var(--map-radius);
    box-shadow: var(--map-shadow);
    overflow: hidden;
    animation: mapCardEnter 0.55s ease both;
}

.map-page-card-inner {
    padding: 38px;
}

.map-hero {
    min-height: 420px;
    max-width: 940px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
}

/* Scoped to the home.php hero only — does not affect .map-page-title
   on other screens (admin dashboards etc. also use that class). */
.map-hero .map-page-title {
    font-size: clamp(23px, 2.9vw, 36px);
    letter-spacing: -0.8px;
}

.map-hero-content {
    padding: 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.map-hero-content .map-eyebrow {
    align-self: flex-start;
}

.map-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eaf2ff;
    color: var(--map-primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.map-page-title {
    margin: 0;
    color: var(--map-navy);
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.08;
    letter-spacing: -1.5px;
}

.map-section-title {
    margin: 0 0 10px;
    color: var(--map-navy);
    font-size: 30px;
    line-height: 1.2;
}

.map-section-subtitle {
    margin: 0;
    color: var(--map-muted);
    font-size: 16px;
    line-height: 1.7;
}

.map-hero-description {
    max-width: 520px;
    margin: 16px 0 24px;
    color: var(--map-muted);
    font-size: 14px;
    line-height: 1.65;
}

.map-hero-visual {
    padding: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.92));
    color: #ffffff;
}

.map-visual-panel {
    width: 100%;
    max-width: 360px;
}

.map-visual-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.13);
    font-size: 25px;
    backdrop-filter: blur(10px);
}

.map-visual-title {
    margin: 0 0 6px;
    font-size: 20px;
    line-height: 1.2;
}

.map-visual-copy {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.55;
    font-size: 13px;
}

.map-portal-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.map-portal-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.map-portal-list li:first-child {
    border-top: none;
}

.map-portal-icon {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.13);
    display: grid;
    place-items: center;
}

.map-portal-icon svg {
    width: 15px;
    height: 15px;
    stroke: #ffffff;
}

.map-button {
    min-height: 48px;
    padding: 12px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 750;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease,
        opacity 0.2s ease;
}

.map-button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.map-button-primary {
    background: linear-gradient(135deg, var(--map-primary), #3b82f6);
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.25);
}

.map-button-primary:hover:not(:disabled) {
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.32);
}

.map-button-dark {
    background: var(--map-navy);
    color: #ffffff;
}

.map-button-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(22, 163, 74, 0.22);
}

.map-button:disabled {
    cursor: not-allowed;
    color: #ffffff;
    background: #a7b0bf;
    box-shadow: none;
    opacity: 0.72;
}

.map-button-block {
    width: 100%;
}

.map-form-card {
    width: min(560px, 100%);
    margin: 20px auto;
}

.map-form-header {
    margin-bottom: 28px;
    text-align: center;
}

.map-form-group {
    margin-bottom: 20px;
}

.map-label {
    margin-bottom: 9px;
    display: block;
    color: var(--map-navy);
    font-size: 14px;
    font-weight: 750;
}

.map-input-wrap {
    position: relative;
}

.map-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid var(--map-border);
    border-radius: 12px;
    outline: none;
    background: #fbfdff;
    color: var(--map-text);
    font-size: 17px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.map-input:focus {
    border-color: var(--map-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

.map-help-text {
    margin: 9px 0 0;
    color: var(--map-muted);
    font-size: 13px;
    line-height: 1.6;
}

.map-alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    line-height: 1.5;
    animation: mapShake 0.35s ease both;
}

.map-alert-danger {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.map-alert-success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.map-records-header {
    margin-bottom: 22px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.map-record-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 22px;
}

.map-record-card {
    position: relative;
    padding: 26px;
    border: 1px solid var(--map-border);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

.map-record-card:hover {
    transform: translateY(-4px);
    border-color: #b8cdf6;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.10);
}

.map-record-badge {
    margin-bottom: 18px;
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eaf2ff;
    color: var(--map-primary-dark);
    font-size: 12px;
    font-weight: 800;
}

.map-record-title {
    margin: 0 0 20px;
    color: var(--map-navy);
    font-size: 21px;
    line-height: 1.35;
}

.map-detail-list {
    margin: 0 0 24px;
    display: grid;
    gap: 12px;
}

.map-detail-row {
    display: grid;
    grid-template-columns: 145px 1fr;
    gap: 14px;
    align-items: start;
}

.map-detail-label {
    color: var(--map-muted);
    font-size: 13px;
    font-weight: 700;
}

.map-detail-value {
    color: var(--map-text);
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.map-back-link {
    margin-top: 24px;
    display: inline-flex;
    gap: 8px;
    color: var(--map-primary-dark);
    text-decoration: none;
    font-weight: 700;
}

.map-instructions-card {
    width: min(1060px, 100%);
    margin: 0 auto;
}

.map-instructions-header {
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--map-border);
}

.map-summary-grid {
    margin: 24px 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.map-summary-item {
    padding: 18px;
    border: 1px solid var(--map-border);
    border-radius: 14px;
    background: #f8fbff;
}

.map-summary-label {
    display: block;
    color: var(--map-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-summary-value {
    margin-top: 7px;
    display: block;
    color: var(--map-navy);
    font-size: 19px;
    font-weight: 800;
}

.map-section {
    margin-top: 28px;
}

.map-section-heading {
    margin: 0 0 15px;
    color: var(--map-navy);
    font-size: 20px;
}

.map-instruction-list {
    margin: 0;
    padding-left: 22px;
    color: var(--map-text);
    line-height: 1.75;
}

.map-instruction-list li {
    margin-bottom: 10px;
    padding-left: 5px;
}

.map-security-notice {
    margin-top: 26px;
    padding: 19px;
    display: flex;
    gap: 15px;
    border: 1px solid var(--map-warning-border);
    border-radius: 14px;
    background: var(--map-warning-bg);
}

.map-security-icon {
    flex: 0 0 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #ffedb5;
    font-size: 22px;
}

.map-declaration {
    margin-top: 26px;
    padding: 20px;
    border: 1px solid var(--map-border);
    border-radius: 14px;
    background: #f8fafc;
}

.map-checkbox-label {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    line-height: 1.65;
    cursor: pointer;
}

.map-checkbox-label input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--map-primary);
    flex: 0 0 auto;
}

.map-start-area {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#startButton {
    min-width: 225px;
    min-height: 54px;
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    font-size: 16px;
}

#startButton::after {
    content: "→";
    font-size: 20px;
    transition: transform 0.2s ease;
}

#startButton:not(:disabled):hover::after {
    transform: translateX(4px);
}

.map-public-footer {
    padding: 20px;
    color: var(--map-muted);
    text-align: center;
    font-size: 13px;
}

.map-loading {
    pointer-events: none;
    opacity: 0.8;
}

.map-loading::before {
    content: "";
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: mapSpin 0.75s linear infinite;
}

@keyframes mapCardEnter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mapShake {
    0%,
    100% {
        transform: translateX(0);
    }

    35% {
        transform: translateX(-5px);
    }

    70% {
        transform: translateX(5px);
    }
}

@keyframes mapSpin {
    to {
        transform: rotate(360deg);
    }
}


.assessment-fullscreen-guard {
    position: fixed;
    inset: 0;
    z-index: 99999;
    padding: 24px;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
}

.assessment-fullscreen-guard[hidden] {
    display: none;
}

.assessment-fullscreen-dialog {
    width: min(460px, 100%);
    padding: 34px;
    border-radius: 20px;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    animation: mapCardEnter 0.3s ease both;
}

.assessment-fullscreen-dialog h2 {
    margin: 16px 0 10px;
    color: #0f172a;
}

.assessment-fullscreen-dialog p {
    margin: 0 0 24px;
    color: #64748b;
    line-height: 1.65;
}

.assessment-fullscreen-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #fef3c7;
    color: #92400e;
    font-size: 28px;
    font-weight: 900;
}


.assessment-session-shell {
    position: fixed;
    inset: 0;
    z-index: 90000;
    width: 100%;
    height: 100%;
    background: #f3f4f6;
}

.assessment-session-shell[hidden] {
    display: none;
}

.assessment-session-shell iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #f3f4f6;
}

.assessment-shell-guard {
    position: absolute;
    inset: 0;
    z-index: 91000;
    padding: 24px;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(10px);
}

.assessment-shell-guard[hidden] {
    display: none;
}

.assessment-shell-guard-card {
    width: min(470px, 100%);
    padding: 36px;
    border-radius: 22px;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.38);
    animation: mapCardEnter 0.3s ease both;
}

.assessment-shell-guard-card h2 {
    margin: 18px 0 10px;
    color: #0f172a;
}

.assessment-shell-guard-card p {
    margin: 0 0 26px;
    color: #64748b;
    line-height: 1.65;
}

.assessment-shell-guard-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #fef3c7;
    color: #92400e;
    font-size: 30px;
    font-weight: 900;
}

@media (max-width: 850px) {
    .map-hero {
        grid-template-columns: 1fr;
    }

    .map-hero-content,
    .map-hero-visual {
        padding: 38px 28px;
    }

    .map-hero-visual {
        min-height: auto;
    }

    .map-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .map-records-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .map-public-header,
    .map-public-main {
        width: min(100% - 24px, 1180px);
    }

    .map-public-header {
        padding: 14px 0;
    }

    .map-brand-title {
        font-size: 16px;
    }

    .map-brand-subtitle {
        display: none;
    }

    .map-page-card-inner {
        padding: 23px 18px;
    }

    .map-hero-content,
    .map-hero-visual {
        padding: 32px 22px;
    }

    .map-page-title {
        font-size: 36px;
    }

    .map-section-title {
        font-size: 26px;
    }

    .map-record-grid {
        grid-template-columns: 1fr;
    }

    .map-detail-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .map-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .map-start-area {
        justify-content: stretch;
    }

    #startButton {
        width: 100%;
    }
}