:root {
    --kx-blue: #5f7f45;
    --kx-blue-dark: #3f5d32;
    --kx-sky: #edf5e8;
    --kx-green: #177245;
    --kx-green-soft: #e7f7ee;
    --kx-red: #b42318;
    --kx-red-soft: #fff0ee;
    --kx-border: #d8e1ea;
    --kx-text: #182433;
}

.kx-header {
    align-items: center;
    background: linear-gradient(135deg, var(--kx-blue-dark), var(--kx-blue));
    border-radius: 8px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 0;
    padding: 1.5rem 1.75rem;
}

.kx-header p { font-size: .78rem; font-weight: 700; letter-spacing: .14em; margin: 0 0 .3rem; opacity: .8; }
.kx-header h1 { color: #fff; font-size: clamp(1.6rem, 4vw, 2.5rem); margin: 0; }
.kx-language { background: #fff; border-radius: 999px; color: var(--kx-blue-dark); font-weight: 700; padding: .6rem .9rem; text-decoration: none; }
.kx-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 1.5rem 0; }
.kx-card { background: #fff; border: 1px solid var(--kx-border); border-radius: 8px; box-shadow: 0 8px 22px rgba(8, 54, 95, .08); color: var(--kx-text); display: flex; flex-direction: column; font: inherit; padding: 1.25rem; text-align: left; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.kx-card:hover { box-shadow: 0 12px 28px rgba(8, 54, 95, .14); transform: translateY(-2px); }
.kx-card span { font-size: 1.15rem; font-weight: 700; }
.kx-card small { color: #5b6b7c; margin-top: .35rem; }
.kx-card.kx-disabled { background: #f5f7fa; box-shadow: none; opacity: .65; }
.kx-panel, .kx-question, .kx-score { background: #fff; border: 1px solid var(--kx-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(18, 52, 77, .07); margin: 1rem 0; padding: 1.4rem; }
.kx-panel li { margin: .6rem 0; }
.kx-exam-nav { align-items: center; display: flex; flex-wrap: wrap; justify-content: space-between; margin-bottom: .75rem; }
.kx-button { background: var(--kx-blue); border: 0; border-radius: 10px; color: #fff; cursor: pointer; display: inline-block; font-weight: 700; margin: .5rem .5rem .5rem 0; padding: .8rem 1.05rem; text-decoration: none; }
.kx-button:hover { background: var(--kx-blue-dark); color: #fff; }
.kx-button:disabled { cursor: not-allowed; opacity: .45; }
.kx-secondary { background: #e8eef5; color: var(--kx-blue-dark); }
.kx-question { border-left: 5px solid var(--kx-blue); scroll-margin-top: 180px; }
.kx-question legend, .kx-result-question h3 { color: var(--kx-text); font-size: 1.08rem; font-weight: 700; line-height: 1.45; padding: 0 .4rem; }
.kx-question legend span, .kx-result-question h3 span { background: var(--kx-blue); border-radius: 999px; color: #fff; display: inline-grid; margin-right: .55rem; min-height: 1.8rem; min-width: 1.8rem; place-items: center; }
.kx-question-image { border-radius: 12px; display: block; margin: 1rem auto; max-height: 390px; max-width: min(100%, 650px); object-fit: contain; }
.kx-answer { align-items: flex-start; background: #f7f9fc; border: 1px solid var(--kx-border); border-radius: 10px; display: flex; gap: .65rem; margin: .65rem 0; padding: .8rem .9rem; }
.kx-answer:has(input:checked) { background: var(--kx-sky); border-color: var(--kx-blue); }
.kx-submit { display: block; font-size: 1rem; margin: 1.5rem auto; }
.kx-progress { align-items: center; display: grid; gap: .45rem .75rem; grid-template-columns: 1fr auto; margin: 1rem 0; }
.kx-progress > div { background: #e4eadf; border-radius: 999px; grid-column: 1 / -1; height: .55rem; overflow: hidden; }
.kx-progress i { background: var(--kx-blue); display: block; height: 100%; transition: width .2s ease; width: 5%; }
.kx-progress [data-kx-timer] { font-weight: 800; text-align: right; }
.kx-timer-warning { color: var(--kx-red); }
.kx-step-actions { display: flex; justify-content: space-between; margin: 1rem 0 1.5rem; }
.kx-question-step[hidden], .kx-step-actions [hidden] { display: none !important; }
.kx-score { text-align: center; }
.kx-score strong { display: block; font-size: 3.1rem; line-height: 1; }
.kx-score span { display: block; margin-top: .5rem; }
.kx-pass { background: var(--kx-green-soft); border-color: #86d6aa; color: var(--kx-green); }
.kx-fail { background: var(--kx-red-soft); border-color: #f2aaa2; color: var(--kx-red); }
.kx-result-answer { display: block; }
.kx-correct-answer { background: #f0fbf5; border-color: #72c49a; }
.kx-selected-correct { background: var(--kx-green-soft); border: 2px solid var(--kx-green); font-weight: 700; }
.kx-selected-wrong { background: var(--kx-red-soft); border: 2px solid var(--kx-red); font-weight: 700; }
.kx-explanation { background: #f6f8fb; border-radius: 12px; margin-top: 1rem; padding: 1rem; }
.kx-explanation > strong { color: var(--kx-blue-dark); display: block; font-size: 1.05rem; margin-bottom: .5rem; }
.kx-actions { margin: 1.5rem 0; }
.kx-link { display: inline-block; margin-top: 1rem; }
.kx-notice { background: #fff8db; border: 1px solid #e4c95c; border-radius: 10px; padding: 1rem; }
.kx-inline-form { align-items: center; display: flex; flex-wrap: wrap; justify-content: space-between; }
.kx-inline-form form { margin: 0; }
.kx-history table { border-collapse: collapse; width: 100%; }
.kx-history th, .kx-history td { border-bottom: 1px solid var(--kx-border); padding: .8rem; text-align: left; }
.kx-history th { background: #f6f8fb; }

@media (max-width: 640px) {
    .kx-header { align-items: flex-start; flex-direction: column; gap: 1rem; padding: 1.15rem; }
    .kx-panel, .kx-question, .kx-score { padding: 1rem; }
    .kx-exam-nav { align-items: stretch; flex-direction: column; }
    .kx-exam-nav .kx-button, .kx-exam-nav .kx-link { text-align: center; }
    .kx-step-actions { gap: .65rem; }
    .kx-step-actions .kx-button { flex: 1; margin-right: 0; }
    .kx-question legend { font-size: 1rem; }
}
