:root {
    --green: #16653f;
    --gold: #c9974f;
    --ink: #1c2025;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f5f6f4;
    --font: "Cairo", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-header {
    background: #fff;
    border-bottom: 3px solid var(--gold);
    padding: 18px 16px;
    display: flex;
    justify-content: center;
}

.site-header .logo {
    height: 78px;
    width: auto;
}

.wrap {
    flex: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 28px 16px;
}

.card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 26px 22px;
    box-shadow: 0 6px 24px rgba(16, 24, 40, .06);
}

.gate-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
    font-size: 15px;
}

.gate-overlay p { margin: 0; }

.card.done { text-align: center; padding: 40px 22px; }
.card.done .muted { margin: 0; }

.done-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #e8f5ee;
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 {
    margin: 6px 0 10px;
    font-size: 22px;
    color: var(--green);
}

.muted { color: var(--muted); line-height: 1.9; margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

label {
    display: block;
    margin: 16px 0 6px;
    font-weight: 600;
    font-size: 14px;
}

input:not([type="checkbox"]) {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}

input:not([type="checkbox"]):focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 101, 63, .12);
}

input.is-invalid:not([type="checkbox"]),
input[aria-invalid="true"]:not([type="checkbox"]) {
    border: 2px solid #c62828;
    background: #fff6f6;
}

input.is-invalid:not([type="checkbox"]):focus,
input[aria-invalid="true"]:not([type="checkbox"]):focus {
    border-color: #c62828;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, .16);
}

input[type="checkbox"].is-invalid,
input[type="checkbox"][aria-invalid="true"] {
    outline: 2px solid #c62828;
    outline-offset: 2px;
}

.err[hidden] { display: none; }

.consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0 6px;
    font-weight: 500;
    line-height: 1.7;
    cursor: pointer;
}

.consent input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--green);
}

.consent .link {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    color: var(--green);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.consent .link:focus-visible,
.modal-close:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, .45);
}

.modal-box {
    position: relative;
    width: min(760px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    padding: 28px 28px 22px;
    box-shadow: 0 16px 40px rgba(16, 24, 40, .18);
}

@media (max-width: 560px) {
    .modal { padding: 12px; }
    .modal-box { max-height: 92vh; padding: 22px 18px 18px; }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.modal-head h2 {
    margin: 0;
    font-size: 21px;
    color: var(--green);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: #f3f4f3;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    color: var(--ink);
    font-size: 15.5px;
    line-height: 2;
}

.modal-body p { margin: 0 0 10px; }
.modal-body ol { margin: 0; padding-inline-start: 20px; }
.modal-body li { margin: 0 0 8px; }

.modal-box .btn { margin-top: 16px; }

.btn {
    width: 100%;
    margin-top: 22px;
    padding: 13px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--green);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn:hover:not(:disabled) { background: #115234; }
.btn:disabled { opacity: .7; cursor: default; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.spinner.dark {
    width: 26px;
    height: 26px;
    border-color: rgba(22, 101, 63, .2);
    border-top-color: var(--green);
}

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

.alert, .status {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    border: 1px solid transparent;
}

.alert.ok, .status.ok { background: #e8f5ee; border-color: #b7e0c9; color: #12613c; }
.alert.error, .status.error { background: #fdecec; border-color: #f5c2c2; color: #a02020; }
.alert.warn { background: #fdf6e7; border-color: #f0dcae; color: #8a6414; }

.err { display: block; margin-top: 6px; color: #a02020; font-size: 13px; }

.hp {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    opacity: 0;
    pointer-events: none;
}

.cf-turnstile { margin-top: 18px; }

.diag-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.diag-row span { color: var(--muted); }

pre {
    background: #f6f7f6;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    overflow-x: auto;
    font-size: 13px;
    margin: 10px 0 0;
}

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