:root {
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-dark: #0f172a;
    --text: #172033;
    --muted: #627086;
    --line: #d8e0ea;
    --primary: #c79f00;
    --primary-strong: #a88400;
    --primary-soft: #fff7d1;
    --navy: #0f172a;
    --blue: #2563eb;
    --success: #137a50;
    --success-soft: #ecfdf5;
    --danger: #b42318;
    --danger-soft: #fff1f0;
    --warning: #a15c00;
    --shadow: 0 22px 55px rgba(15, 23, 42, .09);
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, .07);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 11px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 10% 0%, rgba(242, 200, 17, .12), transparent 28%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.55;
}

body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--navy), #334155 55%, #f2c811);
    z-index: 1000;
}

a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #edf2f7; padding: 3px 7px; border-radius: 7px; }

.page {
    width: min(1120px, calc(100% - 34px));
    margin: 0 auto;
    padding: 42px 0 64px;
}

.page-center {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.hero-card,
.result-card,
.feedback-card,
.intro-panel,
.table-card,
.question-card,
.submit-panel {
    background: rgba(255, 255, 255, .98);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-card,
.result-card {
    width: min(900px, 100%);
    padding: 38px;
}

.small-card { width: min(560px, 100%); }

.brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 54px;
    margin-bottom: 24px;
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 128px;
    max-height: 56px;
    object-fit: contain;
}

.product-label,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.product-label {
    color: #fff;
    background: var(--navy);
    text-align: center;
}

.badge {
    background: var(--primary-soft);
    color: #765f00;
    letter-spacing: .03em;
}

h1, h2, h3 {
    margin-top: 0;
    line-height: 1.18;
    letter-spacing: -.02em;
}

h1 { font-size: clamp(31px, 5vw, 48px); margin-bottom: 15px; }
h2 { font-size: 21px; margin-bottom: 18px; }
h3 { font-size: 17px; margin-bottom: 8px; }

.lead {
    max-width: 780px;
    margin: 0;
    color: var(--muted);
    font-size: 17px;
}

.muted { color: var(--muted); }

.rules-grid,
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 27px 0;
}

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

.rules-grid > div,
.summary-grid article {
    position: relative;
    min-height: 124px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
}

.rules-grid > div::after,
.summary-grid article::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -46px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(242, 200, 17, .11);
}

.rules-grid strong,
.summary-grid strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-bottom: 7px;
    font-size: 21px;
}

.rules-grid span,
.summary-grid span {
    position: relative;
    z-index: 1;
    color: var(--muted);
}

.rules-grid small { color: #7c8798; }

.level-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 8px;
    border-radius: 999px;
}
.basic-dot { background: #64748b; }
.intermediate-dot { background: var(--primary); }

.info-box,
.error-box {
    margin: 22px 0;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
}

.info-box {
    border: 1px solid #ead67a;
    background: #fffbea;
    color: #5f4c00;
}

.error-box {
    border: 1px solid #f0b7b1;
    background: var(--danger-soft);
    color: var(--danger);
}

.test-instructions { margin-top: 0; }

.student-form { margin-top: 22px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

label > span:first-child {
    display: block;
    margin-bottom: 7px;
    font-weight: 760;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    padding: 14px 15px;
    color: var(--text);
    background: #fff;
    font: inherit;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

input:focus {
    border-color: var(--primary-strong);
    box-shadow: 0 0 0 4px rgba(199, 159, 0, .14);
}

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

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 20px;
    padding: 13px 21px;
    border: 0;
    border-radius: 13px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform .14s ease, background .14s ease, box-shadow .14s ease;
}

.btn-primary {
    color: #111827;
    background: linear-gradient(180deg, #f6d437, #e6ba00);
    box-shadow: 0 8px 18px rgba(168, 132, 0, .24);
}

.btn-primary:hover:not(:disabled) {
    text-decoration: none;
    transform: translateY(-1px);
    background: linear-gradient(180deg, #ffdf4a, #dcae00);
}

.btn-primary:disabled {
    color: #8791a1;
    background: #dfe5ec;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    color: var(--text);
    background: #eef2f6;
}

.btn-secondary:hover {
    text-decoration: none;
    background: #e2e8f0;
}

.actions-row {
    display: flex;
    gap: 13px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 18px;
}
.actions-row.left { justify-content: flex-start; }

.site-credit {
    margin: 28px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}
.site-credit strong { color: #7a6200; }
.page-credit { margin-bottom: 7px; }

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 22px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow-soft);
}

.test-title-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

.test-title-area h1 { margin: 10px 0 6px; font-size: clamp(28px, 4vw, 40px); }
.test-title-area p { margin: 3px 0; }

.test-logo {
    width: auto;
    max-width: 110px;
    max-height: 52px;
    object-fit: contain;
}

.progress-card {
    min-width: 144px;
    padding: 18px 20px;
    border: 1px solid #ead67a;
    border-radius: 18px;
    background: #fffbea;
    text-align: center;
}
.progress-card strong { font-size: 35px; color: var(--navy); }
.progress-card small { display: block; color: var(--muted); }

.question-card {
    position: relative;
    margin-bottom: 20px;
    padding: 26px;
    border-left: 5px solid transparent;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.question-card.answered { border-left-color: var(--success); }
.question-card.unanswered {
    border-color: #e9877e;
    box-shadow: 0 0 0 4px rgba(180, 35, 24, .08);
}

.question-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 13px;
}

.question-number {
    color: #665300;
    font-size: 14px;
    font-weight: 850;
}
.question-number small { color: var(--muted); font-weight: 650; }

.difficulty,
.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}
.difficulty.basico { color: #475569; background: #eef2f6; }
.difficulty.intermedio { color: #725b00; background: var(--primary-soft); }
.pill { color: #5f4c00; background: var(--primary-soft); }

.question-image {
    width: fit-content;
    max-width: 100%;
    margin: 14px auto 21px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-soft);
}

.question-image img {
    display: block;
    width: min(460px, 100%);
    height: auto;
    border-radius: 10px;
}

.options {
    display: grid;
    gap: 10px;
}

.option {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.option:hover {
    border-color: #c9ac2d;
    background: #fffdf3;
    transform: translateY(-1px);
}

.option:has(input:checked) {
    border-color: var(--primary-strong);
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px rgba(168,132,0,.2);
}

.option-unknown { background: #f8fafc; }
.option-unknown:has(input:checked) { background: #eef2f6; border-color: #64748b; }

.option input { margin-top: 0; accent-color: var(--primary-strong); }

.option-key {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    margin: 0 !important;
    border-radius: 8px;
    color: #fff;
    background: var(--navy);
    font-size: 13px;
    font-weight: 850;
}

.submit-panel {
    padding: 25px;
    text-align: center;
    background: linear-gradient(145deg, #ffffff, #fffbea);
}
.submit-panel p { max-width: 780px; margin: 0 auto 10px; color: var(--muted); }
.required-status { font-weight: 800; color: var(--warning) !important; }
.required-status.complete { color: var(--success) !important; }

.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 50;
    padding: 12px 15px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 999px;
    color: #fff;
    background: var(--navy);
    box-shadow: 0 14px 34px rgba(15,23,42,.25);
    font-weight: 800;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.result-brand { margin-bottom: 12px; }

.score-circle {
    display: grid;
    width: 190px;
    height: 190px;
    place-items: center;
    align-content: center;
    gap: 4px;
    margin: 30px auto 24px;
    border: 10px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--line), var(--shadow-soft);
}
.score-circle strong { font-size: 39px; }
.score-circle span { color: var(--muted); font-size: 13px; }
.score-circle.basico { border-color: #94a3b8; }
.score-circle.intermedio { border-color: #e8bd09; }

.result-level-label { margin: 0 auto 12px; max-width: 650px; text-align: center; color: var(--muted); }

.level-box {
    width: min(460px, 100%);
    margin: 0 auto;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    text-align: center;
}
.level-box span { display: block; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.level-box strong { display: block; font-size: 31px; }
.level-box.basico { background: #eef2f6; border: 1px solid #cbd5e1; }
.level-box.intermedio { background: var(--primary-soft); border: 1px solid #e4c43f; }

.level-description { max-width: 700px; margin: 20px auto; color: var(--muted); text-align: center; }

.result-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 18px;
    margin: 24px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}
.result-meta p { margin: 0; }

.intro-panel,
.feedback-card,
.table-card { margin-bottom: 20px; padding: 28px; }

.feedback-item {
    margin: 14px 0;
    padding: 17px;
    border-left: 5px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}
.feedback-item.correct { border-left-color: var(--success); }
.feedback-item.wrong { border-left-color: var(--danger); }
.feedback-item p { margin: 7px 0; }
.feedback-item small { color: var(--muted); }

.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #fff; background: var(--navy); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #fffdf3; }

.check {
    padding: 13px 15px;
    border-radius: 11px;
    font-weight: 700;
}
.check.ok { color: var(--success); background: var(--success-soft); }
.check.bad { color: var(--danger); background: var(--danger-soft); }

@media (max-width: 760px) {
    .page { width: min(100% - 20px, 1120px); padding-top: 26px; }
    .hero-card, .result-card { padding: 24px 19px; }
    .brand-row { align-items: flex-start; flex-direction: column; }
    .brand-logo { max-width: 112px; max-height: 48px; }
    .rules-grid, .summary-grid, .rules-grid.two-levels, .summary-grid.two-levels, .form-grid, .result-meta { grid-template-columns: 1fr; }
    .test-header { align-items: flex-start; flex-direction: column; padding: 20px; }
    .test-title-area { align-items: flex-start; flex-direction: column; }
    .progress-card { width: 100%; }
    .question-card { padding: 20px 17px; }
    .question-top { align-items: flex-start; flex-direction: column; }
    .option { grid-template-columns: auto auto 1fr; padding: 13px 11px; }
    .question-image img { width: min(100%, 420px); }
    .back-to-top { right: 12px; bottom: 12px; }
}
