/* Vizuální jazyk převzatý z /kombinatorika/ (tam je všechno inline, globální CSS web nemá).
   Modrá je o dva odstíny tmavší kvůli kontrastu bílého textu na tlačítkách (5,3 : 1). */
:root {
    --blue: #2471a3;
    --blue-dark: #1f6391;
    --blue-light: #e8f4f8;
    --ink: #2c3e50;
    --text: #333;
    --muted: #595959;
    --line: #ddd;
    --good: #1e8449;
    --good-bg: #eafaf1;
    --bad: #b03a2e;
    --bad-bg: #fdedec;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    background-color: #f9f9f9;
    color: var(--text);
    line-height: 1.5;
}
h1 { color: var(--ink); margin: 0; font-size: 1.9rem; line-height: 1.2; }
h2 { font-size: 1.25rem; margin-top: 0; color: var(--ink); border-bottom: 2px solid #eee; padding-bottom: 0.5rem; }
h3 { font-size: 1.05rem; color: var(--ink); margin: 1.4rem 0 0.4rem; }
.header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.intro { color: #444; margin-top: 0.4rem; }
a { color: var(--blue); }

button {
    background-color: var(--blue); color: #fff; border: none; padding: 0.55rem 1rem;
    border-radius: 4px; cursor: pointer; font-weight: bold; transition: background 0.15s;
    font-size: 0.95rem; font-family: inherit; min-height: 44px;
}
button:hover { background-color: var(--blue-dark); }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #f1c40f; outline-offset: 2px; }
button.secondary { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
button.secondary:hover { background: var(--blue-light); }
button.reset-btn { background-color: #c0392b; padding: 0.5rem 0.9rem; font-size: 0.9rem; white-space: nowrap; }
button.reset-btn:hover { background-color: #a93226; }

.card {
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
    padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ---- záložky (stejně jako sekce 2 v kombinatorice) ---- */
.tabs { display: flex; gap: 0; margin: 1rem 0 1.25rem; border-bottom: 2px solid #eee; overflow-x: auto; }
button.tab {
    background: none; color: var(--muted); border: none; padding: 0.6rem 1rem;
    border-bottom: 3px solid transparent; font-weight: 600; margin-bottom: -2px;
    font-size: 1rem; border-radius: 0; white-space: nowrap; transition: color 0.15s, border-color 0.15s;
}
button.tab:hover { background: none; color: var(--text); }
button.tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }

/* ---- přepínače (segmenty, znaky, čipy) ---- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.seg button, .sym button, .chips button {
    background: #fff; color: var(--ink); border: 2px solid #ccc; font-weight: 600;
}
.seg button:hover, .sym button:hover, .chips button:hover { background: #f2f7fb; border-color: var(--blue); }
.seg button[aria-pressed="true"], .sym button[aria-pressed="true"], .chips button[aria-pressed="true"] {
    background: var(--blue); color: #fff; border-color: var(--blue);
}
.sym { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sym button { min-width: 52px; min-height: 52px; font-size: 1.6rem; padding: 0 0.6rem; line-height: 1; }
.ctl { margin-bottom: 1rem; }
.ctl-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--ink); }
.two-signs { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.slider { display: flex; align-items: center; gap: 0.5rem; }
.slider input[type="range"] { flex: 1; min-width: 0; height: 44px; accent-color: var(--blue); margin: 0; }
.slider button { width: 44px; padding: 0; font-size: 1.3rem; flex: none; }
.slider output { min-width: 2.2ch; font-size: 1.4rem; font-weight: 700; color: var(--ink); text-align: right; }

/* ---- zápis nerovnice, věta, odpověď ---- */
.formula {
    font-size: 2.4rem; font-weight: 700; color: var(--ink); text-align: center;
    margin: 0.2rem 0 1rem; letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}
.sentence { margin: 0.5rem 0 0.75rem; font-size: 1.05rem; }
.result {
    padding: 0.8rem 1rem; background-color: var(--blue-light);
    border-left: 4px solid var(--blue); border-radius: 4px; font-size: 1.05rem;
}
.result strong { font-size: 1.25rem; color: var(--ink); }

/* ---- číselná osa ---- */
.axis { width: 100%; margin: 0.5rem 0; }
.axis svg { display: block; width: 100%; height: auto; overflow: visible; }
.ax-line { stroke: #555; stroke-width: 2; }
.ax-arrow { fill: #555; }
.ax-arrow.on { fill: var(--blue); }
.ax-dots { fill: var(--blue); font-size: 22px; font-weight: 700; text-anchor: middle; }
.ax-tick { stroke: #777; stroke-width: 1.5; }
.ax-lbl { fill: #444; font-size: 13px; text-anchor: middle; }
.ax-lbl.b { fill: var(--ink); font-weight: 700; font-size: 14px; }
.dot.full { fill: var(--blue); stroke: var(--blue); stroke-width: 2; }
.dot.empty { fill: #fff; stroke: var(--blue); stroke-width: 2.5; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips button { font-size: 1.05rem; padding: 0.4rem 0.8rem; }
.chips-label { font-size: 0.9rem; color: var(--muted); margin: 1.25rem 0 0.5rem; }

.rule {
    background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue);
    border-radius: 4px; padding: 0.9rem 1.1rem; margin: 1rem 0;
}
.rule ul { margin: 0; padding-left: 1.2rem; }
.rule li { margin-bottom: 0.3rem; }

/* ---- procvičování ---- */
.score { font-size: 0.95rem; color: var(--muted); margin-bottom: 0.75rem; }
.score strong { color: var(--ink); }
.task { font-size: 1.1rem; margin: 0.5rem 0 1rem; }
.task-q { display: block; font-size: 2rem; color: var(--ink); margin-top: 0.3rem; }
label.field-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
input[type="text"] {
    width: 100%; padding: 0.6rem 0.75rem; border: 2px solid #bbb; border-radius: 6px;
    font-size: 1.25rem; font-family: inherit; min-height: 48px;
}
input[type="text"]:focus { border-color: var(--blue); }
.hint { font-size: 0.9rem; color: var(--muted); margin: 0.4rem 0 0.9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.feedback:not(:empty) { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 4px; border-left: 4px solid #999; background: #f4f4f4; }
.feedback p { margin: 0.2rem 0; }
.feedback.good { border-left-color: var(--good); background: var(--good-bg); }
.feedback.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.feedback .ans { font-size: 1.15rem; }
.muted { color: var(--muted); font-size: 0.92rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- jak na to ---- */
.vyklad p, .vyklad li { line-height: 1.65; }
.vyklad ol, .vyklad ul { padding-left: 1.3rem; }
table.znaky { border-collapse: collapse; width: 100%; margin: 0.5rem 0 1rem; }
table.znaky th, table.znaky td { border-bottom: 1px solid #eee; padding: 0.45rem 0.4rem; text-align: left; vertical-align: middle; }
table.znaky th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
table.znaky td.z { font-size: 1.5rem; font-weight: 700; color: var(--ink); width: 2.5rem; text-align: center; }
table.znaky svg { vertical-align: middle; }
.priklad { background: #fdf6e3; border-left: 4px solid #e67e22; border-radius: 4px; padding: 0.9rem 1.1rem; margin: 1rem 0; }
.priklad ol { margin: 0.4rem 0; }

/* ---- přepínač jazyka: pilulka s posuvným podkladem ---- */
.topbar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.langswitch {
    position: relative; display: grid; grid-template-columns: 1fr 1fr;
    background: #e9eef2; border-radius: 999px; padding: 4px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}
.langswitch::before {
    content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
    background: #fff; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: transform 0.18s ease;
}
.langswitch[data-active="es"]::before { transform: translateX(100%); }
.langswitch button {
    position: relative; z-index: 1; background: none; color: var(--muted); border: none;
    border-radius: 999px; padding: 0.35rem 0.95rem; min-height: 40px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
}
.langswitch button:hover { background: none; color: var(--ink); }
.langswitch button[aria-pressed="true"] { color: var(--ink); }
.langswitch .flag {
    font-size: 0.68rem; letter-spacing: 0.04em; padding: 0.12rem 0.32rem; border-radius: 4px;
    background: #cfd8df; color: #3a4a57;
}
.langswitch button[aria-pressed="true"] .flag { background: var(--blue); color: #fff; }
.langswitch button[data-lang="es"][aria-pressed="true"] .flag { background: #b03a2e; }
table.slovnik td:first-child { width: 50%; }

footer { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--muted); }

@media (max-width: 480px) {
    body { margin-top: 1rem; }
    h1 { font-size: 1.5rem; }
    .card { padding: 1rem; }
    .formula { font-size: 2rem; }
    button.tab { padding: 0.6rem 0.7rem; font-size: 0.95rem; }
    .task-q { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
