:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --ink: #1d2430;
    --muted: #64748b;
    --line: #e2e8f0;
    --brand: #1f5fa9;
    --brand-dark: #17457b;
    --ok: #2f9e44;
    --ok-soft: #e7f6ea;
    --bad: #d33;
    --bad-soft: #fdeaea;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- hlavička ------------------------------------------------------------ */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--brand);
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #fff;
    color: var(--brand);
    font-weight: 800;
}

.topbar-note { font-size: 13px; opacity: .8; }

/* --- rozvržení ----------------------------------------------------------- */

.layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.sidebar h2 {
    margin: 0 0 12px;
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.area-list { list-style: none; margin: 0; padding: 0; }

.area-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
}

.area-link:hover { background: #eef3fa; }

.area-link.is-active {
    background: var(--brand);
    color: #fff;
}

.area-count {
    flex: none;
    min-width: 34px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.area-link.is-active .area-count { background: rgba(255, 255, 255, .25); color: #fff; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 28px 28px;
}

h1 { margin: 0 0 6px; font-size: 22px; }
.lead { color: var(--muted); max-width: 70ch; }

/* --- rozcestník ---------------------------------------------------------- */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
    transition: border-color .15s, transform .15s;
}

.tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.tile-count { font-size: 26px; font-weight: 700; color: var(--brand); }
.tile-title { font-size: 14px; }

/* --- procvičování -------------------------------------------------------- */

.practice-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.counter { margin: 0; color: var(--muted); font-size: 14px; }

.score { text-align: right; line-height: 1.1; }
.score-ok { font-size: 26px; font-weight: 700; color: var(--ok); }
.score-sep, .score-total { font-size: 20px; color: var(--muted); }
.score small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; }

.progress {
    height: 6px;
    margin: 16px 0 14px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .25s; }

.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.btn {
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) { background: var(--brand-dark); color: #fff; }

.switch { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }

.question { margin: 22px 0; min-height: 180px; }
.question.is-loading { opacity: .4; }

.question-code { font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.question-text { margin: 6px 0 14px; font-size: 19px; font-weight: 600; }
.question-note { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--brand); background: #f2f6fb; color: var(--muted); font-size: 14px; }

.question-media { margin-bottom: 18px; }
.media { max-width: 100%; max-height: 460px; border-radius: 8px; background: #000; }
img.media { background: transparent; }

.answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.answer {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}

.answer:hover:not(:disabled) { border-color: var(--brand); background: #f7fafe; }
.answer:disabled { cursor: default; }

.answer-letter {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eef2f7;
    font-weight: 700;
    font-size: 14px;
}

.answer-body { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.answer-image { max-height: 110px; border-radius: 6px; }

.answer.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.answer.is-correct .answer-letter { background: var(--ok); color: #fff; }
.answer.is-wrong { border-color: #f0c9c9; background: var(--bad-soft); color: #7a2a2a; }
.answer.is-chosen { box-shadow: 0 0 0 2px #fc8b29 inset; }

.verdict { margin: 16px 0 0; padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.verdict-ok { background: var(--ok-soft); color: #1d6b28; }
.verdict-bad { background: var(--bad-soft); color: #97231f; }

.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }

kbd {
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #f8fafc;
    font-size: 12px;
}

.error { color: var(--bad); }

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}
