:root {
    --blue: #123c69;
    --yellow: #ffce32;
    --green: #15803d;
    --red: #b91c1c;
    --muted: #64748b;
    --border: #dce3eb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: #eef2f7;
    color: #172033;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}
main {
    max-width: 760px;
    margin: auto;
    padding: 20px 14px;
}
header {
    background: var(--blue);
    color: white;
    padding: 28px 16px;
    border-radius: 20px;
    text-align: center;
    border-bottom: 6px solid var(--yellow);
    margin-bottom: 20px;
}
.flag { font-size: 44px; }
h1 { font-size: clamp(24px, 5vw, 32px); margin: 8px 0; }
h2 { font-size: 22px; margin-top: 0; }
header p { margin: 6px 0; opacity: .85; }
.panel {
    background: white;
    padding: 22px;
    border-radius: 18px;
    box-shadow: 0 4px 20px #123c690d;
}
button {
    font: inherit;
    cursor: pointer;
    border: 0;
    border-radius: 10px;
    padding: 13px 18px;
    background: var(--blue);
    color: white;
    font-weight: 600;
    min-height: 44px;
}
button:hover { filter: brightness(.94); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible {
    outline: 3px solid #e6ac00;
    outline-offset: 2px;
}
.mode {
    display: block;
    text-align: left;
    width: 100%;
    margin-bottom: 10px;
    background: #f3f6fa;
    color: var(--blue);
    border: 1px solid var(--border);
}
.mode strong { display: block; font-size: 17px; }
.mode small {
    display: block;
    font-weight: 400;
    color: #526174;
    margin-top: 3px;
}
.exam { background: #fff5cd; border-color: #e8c651; }
.secondary { background: #e8eef5; color: var(--blue); }
#menu > .secondary { width: 100%; margin-top: 10px; }
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 15px;
}
progress {
    width: 100%;
    height: 12px;
    accent-color: var(--green);
}
#score { text-align: right; color: var(--muted); font-size: 14px; }
#question {
    text-align: center;
    padding: 20px 5px;
}
#question h2 { font-size: 38px; margin: 4px 0; }
#question p { color: var(--muted); margin: 4px 0; }
.field { margin-bottom: 15px; }
label { display: block; font-weight: 600; margin-bottom: 5px; }
input {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font: inherit;
    font-size: 18px;
}
input.correct {
    background: #f0fdf4;
    border-color: var(--green);
}
input.incorrect {
    background: #fef2f2;
    border-color: var(--red);
}
.correction {
    display: block;
    color: var(--green);
    font-weight: 600;
    margin-top: 5px;
}
.characters {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}
.characters button {
    background: #e8eef5;
    color: var(--blue);
    font-size: 21px;
    min-width: 54px;
}
#check, #next, #retry, #result > button {
    width: 100%;
    margin-top: 10px;
}
#feedback {
    text-align: center;
    font-weight: 700;
    padding: 12px 0;
}
.good { color: var(--green); }
.bad { color: var(--red); }
.result-number {
    font-size: 52px;
    font-weight: 800;
    text-align: center;
    color: var(--blue);
}
#statistics {
    background: #f3f6fa;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
th { background: var(--blue); color: white; }
tr:nth-child(even) { background: #f3f6fa; }
footer {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    margin: 25px 0;
}
@media (max-width: 480px) {
    main { padding: 10px; }
    .panel { padding: 16px; }
    header { padding: 20px 10px; }
}
