:root {
    color-scheme: light;
    --bg: #edf2f7;
    --card: #ffffff;
    --panel: #f5f8fc;
    --line: #c9d6e4;
    --ink: #152338;
    --mut: #465c73;
    --p: #145485;
    --p2: #1b679d;
    --accent: #327eb0;
    --accent-soft: #ddeefa;
    --focus: #276ea5;
    --console: #111f32;
    --console-text: #f3f8ff;
    --console-muted: #bfcee0;
    --signal: #f4ba74;
    --radius: 12px;
}
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1523;
    --card: #132236;
    --panel: #192c43;
    --line: #3b536d;
    --ink: #edf5fe;
    --mut: #b8c9da;
    --p: #9ed6ff;
    --p2: #bfdfff;
    --accent: #78bfed;
    --accent-soft: #244569;
    --focus: #8cd1ff;
}
body { font: 16px/1.6 system-ui, "Segoe UI", sans-serif; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.top, html[data-theme="dark"] .top {
    background: var(--console);
    border: 0;
    border-bottom: 1px solid #45607c;
    box-shadow: none;
    backdrop-filter: none;
}
.top .wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    min-height: 64px;
    height: auto;
    padding-block: 9px;
}
.top .logo span, html[data-theme="dark"] .top .logo span {
    color: var(--console-text);
    background: none;
    letter-spacing: -.035em;
}
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo::before {
    content: "";
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border: 3px solid #8bd3fa;
    border-right-color: var(--signal);
    border-radius: 50%;
    transform: rotate(-35deg);
}
.top :focus-visible { outline-color: #8bd3fa; }
.top .main-nav { display: flex; justify-content: end; gap: 12px !important; }
.main-nav ul { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; }
.main-nav ul + ul { border-left: 1px solid #405571; padding-left: 12px; }
.top .main-nav a {
    display: block;
    margin: 0;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    text-shadow: none;
    color: var(--console-muted) !important;
    white-space: nowrap;
}
.top .main-nav a:hover { background: #243c59; color: var(--console-text) !important; }
.top .main-nav a[aria-current] {
    background: #243c59;
    border-color: #45607c;
    color: var(--console-text) !important;
    box-shadow: inset 0 -2px var(--signal);
}
.top :is(#menu-toggle, #theme-toggle) {
    min-height: 40px;
    min-width: 40px;
    padding: 4px 10px;
    margin: 0;
    background: #203551;
    color: var(--console-text);
    border: 1px solid #4b6482;
    text-shadow: none;
    box-shadow: none;
}
#theme-toggle { grid-column: -2; }
.hero, html[data-theme="dark"] .hero {
    max-width: 1280px;
    margin: 20px auto 0;
    padding: clamp(18px, 3vw, 34px) 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    color: var(--ink);
    box-shadow: none;
}
.hero h1 { font-size: clamp(1.7rem, 3vw, 2.6rem); line-height: 1.13; letter-spacing: -.04em; }
.hero .lead, html[data-theme="dark"] .hero .lead { color: var(--mut); font-size: 1rem; }
.hero .lead a { color: var(--p); }
.hero .badge { display: none; }
.card, .card:hover { box-shadow: none; border-radius: var(--radius); }
.card { padding: clamp(14px, 2vw, 24px); }
.card > h2:first-child, .tool-title {
    padding: 0;
    color: var(--ink);
    background: none;
    border: 0;
    font-size: 1.15rem;
    text-shadow: none;
    line-height: 1.3;
}
:where(.card, .language-content) :is(h2, h3) { overflow-wrap: anywhere; }
.tool :is(select, textarea), main :is(select, textarea, input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])),
html[data-theme="dark"] .tool :is(select, textarea) {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    box-shadow: none;
}
.tool textarea { min-height: 112px; }
.tool button, button, .btn, button.ghost, .tool .ghost {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--p);
    box-shadow: none;
    text-shadow: none;
}
.tool #btnTr { background: #9ed6fa; color: #10233b; border-color: #79b8de; }
.quiz-options button { background: var(--panel); color: var(--ink); }
.quiz-options .correct { background: #d5f5df; color: #14532d; }
.quiz-options .incorrect { background: #fee2e2; color: #991b1b; }
.msg { color: #174633; }
.err { color: #791c29; }
.visual-card, .word-card, .language-grid a, .feature-grid a, .acard,
html[data-theme="dark"] :is(.visual-card, .word-card, .language-grid a, .feature-grid a, .acard) {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.acard .tag { background: var(--accent-soft); color: var(--p); }
.foot { background: var(--console); color: var(--console-muted); }
.foot a { color: var(--console-text); }
.language-layout { grid-template-columns: clamp(210px, 23vw, 260px) minmax(0, 1fr); gap: 20px; }
.language-sidebar { position: sticky; top: 78px; max-height: calc(100dvh - 90px); overflow: auto; }
.language-nav {
    margin: 12px 0 0;
    padding: 0;
    border-radius: var(--radius);
    overflow: clip;
}
.language-nav > summary {
    padding: 11px 13px;
    background: var(--panel);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}
.language-nav-panel { padding: 7px; }
.language-nav-panel a { margin: 2px 0; padding: 7px 9px; border-radius: 7px; overflow-wrap: anywhere; }
.language-nav-panel a:hover { background: var(--panel); text-decoration: underline; }
.language-nav-panel a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--ink);
    box-shadow: inset 3px 0 var(--accent);
    font-weight: 700;
}
.language-current { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }
.language-topics { margin: 3px 0; padding: 3px 0; }
.language-topics summary { padding: 6px 9px; color: var(--ink); }
.language-topics > div { border-left: 1px solid var(--line); margin-left: 10px; padding-left: 5px; }
.language-topics a { margin-left: 0; }
@media (max-width: 1320px) { .hero, html[data-theme="dark"] .hero { margin-inline: 20px; } }
@media (max-width: 960px) {
    .top { position: static; }
    .top .wrap { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; min-height: 58px; }
    .top .main-nav { grid-column: 1 / -1; grid-row: 2; display: grid; justify-content: stretch; padding-bottom: 4px; }
    .main-nav ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main-nav ul + ul { border-left: 0; border-top: 1px solid #405571; padding: 8px 0 0; }
    .top .main-nav a { min-height: 42px; }
    .top .logo { overflow-wrap: anywhere; line-height: 1.18; }
    .hero, html[data-theme="dark"] .hero { margin: 12px 12px 0; }
    .language-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .language-sidebar { position: static; max-height: none; overflow: visible; }
    .language-layout aside .language-nav-panel { max-height: min(56vh, 430px); overflow: auto; }
    #menu-toggle { grid-column: 2; grid-row: 1; }
    #theme-toggle { grid-column: 3; grid-row: 1; }
}
@media print { .language-sidebar { display: none; } .language-layout { display: block; } }

main input[type="search"] { min-height: 42px; padding: 8px 12px; font: inherit; width: 100%; }
#theme-toggle { font-size: 1.2rem; line-height: 1; }

.assessment-question { margin: 12px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; }
.assessment-question legend { padding: 0 6px; font-weight: 650; }
.assessment-question label { margin-top: 4px; font-weight: normal; }
.assessment-feedback:empty { display: none; }

.speech-rate { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 8px 6px 0; }
.speech-rate select { width: auto; margin: 0; padding: 5px 8px; }

.word-card .word-photo { object-fit: contain; background: var(--card); border: 1px solid var(--line); }
.color-sample { display: block; height: 42px; border: 1px solid var(--line); border-radius: 6px; }

/* Small, keyboard-accessible playback controls beside language examples. */
.art :is(td, p) button.example-speech {
    display: inline-block;
    margin: 4px 0;
    padding: 4px 7px;
    font-size: .8rem;
    white-space: nowrap;
}

.section-menu { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.section-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--p);
    font-weight: 650;
    text-decoration: none;
}
.section-menu a:hover { text-decoration: underline; }
.section-menu a[aria-current] {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--accent);
    box-shadow: inset 0 -2px var(--accent);
}
.diaspora-navigation { max-width: 780px; margin-inline: auto; }
.diaspora-navigation .section-menu + .section-menu { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.diaspora-languages a { flex: 1; justify-content: center; min-width: 0; text-align: center; }
.diaspora-sections a { font-size: .875rem; }
.diaspora-guides th[scope="row"] {
    background: #e9f3fa !important;
    color: #183a50 !important;
    overflow-wrap: anywhere;
}
.situation-tip { display: block; margin-top: 4px; }
.dictionary-other-topics .section-menu { margin-top: 10px; }
main :is(#predlosci, #administrativni-rjecnik, #prakticni-vodici, #lazni-prijatelji, #tematski-rjecnik, #lekcije-jezika, #kartice) {
    scroll-margin-top: 90px;
}
main :is(#administrativni-rjecnik, #prakticni-vodici, #lazni-prijatelji) td { overflow-wrap: anywhere; }
@media (max-width: 480px) {
    .diaspora-languages a { padding-inline: 6px; font-size: .9rem; }
}

.language-profile .profile-guide { margin-top: 24px; }
.language-profile .profile-facts div { overflow-wrap: anywhere; }
.profile-guide table { table-layout: fixed; width: 100%; }
.profile-guide th, .profile-guide td { overflow-wrap: anywhere; }
@media (max-width: 480px) {
    .profile-guide th, .profile-guide td { padding: 6px; }
}
.profile-guide details { margin-block: 12px; }
.profile-guide summary { min-height: 40px; }
