/* Learn Shona — navigation shell.
 * Desktop bar + Culture mega-menu, the phone app shell (top bar, bottom tabs,
 * Explore sheet) and the search overlay. Markup: views/partials/nav.php.
 * Behaviour: assets/js/shell.js. Loaded after learnshona.css.
 */
:root {
    --ls-tabbar-h: 62px;
    --ls-mbar-h: 56px;
    --ls-safe-b: env(safe-area-inset-bottom, 0px);
    --ls-safe-t: env(safe-area-inset-top, 0px);
    --ls-line: #EADFC8;
    --ls-card: #FFFDF8;
}

/* No page may scroll sideways, whatever a content block does. Real overflows
   are fixed where they happen; this is the net under them. `clip` (unlike
   `hidden`) leaves position: sticky working. */
/* Light-only theme: stops browser auto-dark from inverting it (paired with the color-scheme meta tag). */
:root { color-scheme: light; }
html, body { overflow-x: clip; }
img, video, svg { max-width: 100%; }

/* ======================================================================
   Desktop bar
   ====================================================================== */
.ls-navbar > .container-xl { flex-wrap: nowrap; }
.ls-navbar .navbar-nav { flex-direction: row; }
.ls-navbar .ls-chip-name { max-width: 130px; }
.ls-acct-menu { min-width: 250px; }

.ls-search-btn {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 10px 0 6px; padding: 7px 10px 7px 16px;
    background: #fff; border: 2px solid var(--ls-line); border-radius: 999px;
    color: var(--muted); font: 700 15px var(--font-body); cursor: pointer;
    transition: border-color .15s, color .15s, box-shadow .15s;
}
.ls-search-btn:hover, .ls-search-btn:focus-visible { border-color: var(--sun); color: var(--text); box-shadow: 0 0 0 4px rgba(255, 200, 61, .25); outline: 0; }
.ls-search-btn kbd {
    background: #F4EEDF; color: var(--muted); border-radius: 8px; padding: 1px 8px;
    font: 800 13px var(--font-body); border: 0;
}
@media (max-width: 1199.98px) { .ls-search-btn-text, .ls-search-btn kbd { display: none; } .ls-search-btn { padding: 8px 12px; } }

/* Culture mega-menu: spans the whole bar, three columns */
.ls-navbar .ls-mega-parent { position: static; }
.ls-navbar .ls-mega {
    left: 0; right: 0; top: calc(100% + 8px); margin: 0;
    width: auto; padding: 22px 24px 0;
    border: 2px solid #EFE5D1; border-radius: 28px; background: var(--ls-card);
    box-shadow: 0 18px 44px rgba(46, 42, 58, .16);
    overflow: hidden;
}
.ls-mega-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 28px; }
.ls-mega-title {
    font: 800 12px var(--font-body); letter-spacing: .09em; text-transform: uppercase;
    color: var(--msasa); padding: 0 10px 6px;
}
.ls-mega-link {
    display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px;
    color: var(--text); text-decoration: none; transition: background-color .12s;
}
.ls-mega-link:hover, .ls-mega-link:focus-visible { background: #FFF1C9; color: var(--text); outline: 0; }
.ls-mega-ico {
    flex: 0 0 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
    font-size: 21px; background: #fff; box-shadow: 0 2px 0 rgba(46, 42, 58, .07); overflow: hidden;
}
.ls-mega-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.ls-mega-link b { display: block; font-size: 15px; line-height: 1.15; }
.ls-mega-link small { display: block; color: var(--muted); font-weight: 700; font-size: 12.5px; }
.ls-mega-foot {
    display: block; margin: 16px -24px 0; padding: 13px 24px; text-align: center;
    background: #FFF3CC; color: var(--text); font-weight: 800; text-decoration: none;
}
.ls-mega-foot:hover { background: #FFE899; color: var(--text); }

/* ======================================================================
   Phone shell (< 992px): top bar, bottom tabs, Explore sheet
   ====================================================================== */
.ls-mbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 6px;
    min-height: calc(var(--ls-mbar-h) + var(--ls-safe-t)); padding: var(--ls-safe-t) 12px 0 14px;
    background: rgba(255, 248, 236, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ls-line);
}
.ls-mbar-brand {
    display: inline-flex; align-items: center; gap: 8px; margin-right: auto;
    font: 800 21px var(--font-heading); color: var(--text); text-decoration: none; line-height: 1;
}
.ls-mbar-brand b { color: var(--msasa); }
.ls-mbar-btn {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ls-line); background: #fff;
    display: grid; place-items: center; font-size: 20px; line-height: 1; cursor: pointer; padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.ls-mbar-btn:active { transform: scale(.94); }
.ls-mbar-me { background: var(--sun); border-color: var(--sun); font: 800 18px var(--font-heading); color: var(--text); }

.ls-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 4px 6px calc(4px + var(--ls-safe-b));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--ls-line); box-shadow: 0 -6px 24px rgba(46, 42, 58, .07);
}
.ls-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-height: 54px; border: 0; background: none; border-radius: 16px; padding: 4px 2px;
    color: var(--muted); font: 800 11.5px var(--font-body); text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent; transition: color .12s, background-color .12s;
}
.ls-tab-ico { font-size: 23px; line-height: 1.1; filter: grayscale(.6); opacity: .8; transition: filter .12s, opacity .12s, transform .12s; }
.ls-tab:active .ls-tab-ico { transform: scale(.88); }
.ls-tab.active { color: var(--text); background: #FFF3CC; }
.ls-tab.active .ls-tab-ico { filter: none; opacity: 1; }
.ls-tab-cta .ls-tab-ico { filter: none; opacity: 1; }
.ls-tab-cta { color: #1F7A3C; }
.ls-tab:focus-visible { outline: 3px solid var(--sky); outline-offset: -2px; }

/* Room for the fixed tab bar, and keep floating things clear of it. */
@media (max-width: 991.98px) {
    body:has(.ls-tabbar) { padding-bottom: calc(var(--ls-tabbar-h) + var(--ls-safe-b)); }
    body.ls-has-tabs { padding-bottom: calc(var(--ls-tabbar-h) + var(--ls-safe-b)); }
    .session-timer { bottom: calc(var(--ls-tabbar-h) + var(--ls-safe-b) + 10px); }
    .ls-share-toast { bottom: calc(var(--ls-tabbar-h) + var(--ls-safe-b) + 18px); }
    .ls-pwa-install-banner { bottom: calc(var(--ls-tabbar-h) + var(--ls-safe-b) + 12px); }
    body .ls-storyteller-dock { bottom: calc(var(--ls-tabbar-h) + var(--ls-safe-b) + 10px); }
    .ls-footer { margin-top: 24px; }
}
@media (min-width: 992px) { .ls-mbar, .ls-tabbar, .ls-sheet { display: none !important; } }

/* Explore sheet */
.ls-sheet {
    position: fixed; inset: 0; z-index: 1090; display: flex; flex-direction: column;
    background: var(--bg); animation: ls-sheet-in .22s ease-out;
}
.ls-sheet[hidden] { display: none; }
@keyframes ls-sheet-in { from { transform: translateY(24px); opacity: 0; } }
.ls-sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(var(--ls-safe-t) + 8px) 14px 8px 18px; font: 800 22px var(--font-heading);
}
.ls-sheet-close {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ls-line); background: #fff;
    font-size: 18px; font-weight: 800; color: var(--text); cursor: pointer;
}
.ls-sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px calc(24px + var(--ls-safe-b)); -webkit-overflow-scrolling: touch; }
.ls-sheet-search {
    width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 13px 16px; margin-bottom: 12px; background: #fff; border: 2px solid var(--ls-line); border-radius: 999px;
    color: var(--muted); font: 700 15.5px var(--font-body); cursor: pointer;
}
.ls-acct { background: #fff; border-radius: 22px; padding: 14px; margin-bottom: 12px; box-shadow: var(--ls-shadow); }
.ls-acct-who { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ls-acct-who b { display: block; font-size: 17px; line-height: 1.15; }
.ls-acct-who small { color: var(--muted); font-weight: 700; }
.ls-acct-av { width: 48px; height: 48px; border-radius: 50%; background: #FFF1C9; display: grid; place-items: center; font: 800 24px var(--font-heading); flex: 0 0 48px; }
.ls-acct-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ls-acct-links a, .ls-acct-links button {
    padding: 9px 14px; border-radius: 999px; border: 2px solid var(--ls-line); background: #fff; color: var(--text);
    font: 800 14px var(--font-body); text-decoration: none; cursor: pointer; min-height: 40px;
}
.ls-acct-links .ls-acct-save { background: var(--sun); border-color: var(--sun); }

.ls-acc { display: block; background: #fff; border-radius: 22px; margin-bottom: 10px; box-shadow: var(--ls-shadow); color: var(--text); text-decoration: none; }
.ls-acc summary, .ls-acc-row { list-style: none; display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; min-height: 64px; }
.ls-acc-row { text-decoration: none; }
.ls-acc summary::-webkit-details-marker { display: none; }
.ls-acc-ico { flex: 0 0 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: #FFF3CC; }
.ls-acc-t { flex: 1; min-width: 0; }
.ls-acc-t b { display: block; font: 800 18px var(--font-heading); line-height: 1.1; }
.ls-acc-t small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; line-height: 1.25; margin-top: 2px; }
.ls-acc-chev { color: var(--muted); font-size: 18px; transition: transform .18s; }
.ls-acc[open] .ls-acc-chev { transform: rotate(180deg); }
.ls-acc-row .ls-acc-chev { font-size: 26px; }
.ls-acc-body { padding: 0 12px 14px; }
.ls-acc-all { display: block; padding: 4px 4px 10px; font-weight: 800; font-size: 14px; color: var(--savanna); text-decoration: none; }
.ls-acc-group { font: 800 11.5px var(--font-body); letter-spacing: .09em; text-transform: uppercase; color: var(--msasa); margin: 10px 4px 6px; }
.ls-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 540px) { .ls-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ls-tile {
    display: flex; flex-direction: column; gap: 1px; padding: 11px 12px; min-height: 76px;
    background: var(--ls-card); border: 2px solid #F1E8D4; border-radius: 16px; color: var(--text); text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.ls-tile:active { background: #FFF1C9; }
.ls-tile-img { width: 32px; height: 32px; object-fit: cover; border-radius: 9px; display: inline-block; vertical-align: middle; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.ls-acc-img { width: 32px; height: 32px; object-fit: cover; border-radius: 9px; display: inline-block; vertical-align: middle; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.ls-tile > span { font-size: 24px; line-height: 1.15; }
.ls-tile b { font-size: 14.5px; line-height: 1.15; }
.ls-tile small { color: var(--muted); font-weight: 700; font-size: 12px; }
.ls-grid-quick { margin-bottom: 12px; }
.ls-tile-big { background: #fff; border-color: transparent; box-shadow: var(--ls-shadow); min-height: 92px; }
.ls-tile-big small { line-height: 1.25; }
.ls-grid-quick .ls-tile-big:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ls-acct { margin-top: 4px; }
.ls-sheet-foot { display: flex; justify-content: center; gap: 22px; padding: 14px 0 4px; }
.ls-sheet-foot a { color: var(--muted); font-weight: 800; text-decoration: none; }

/* ======================================================================
   Search overlay (all sizes)
   ====================================================================== */
.ls-search {
    position: fixed; inset: 0; z-index: 1100; display: flex; justify-content: center; align-items: flex-start;
    padding: 9vh 16px 16px; background: rgba(46, 42, 58, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.ls-search[hidden] { display: none; }
.ls-search-panel {
    width: 100%; max-width: 660px; max-height: 80vh; display: flex; flex-direction: column;
    background: var(--ls-card); border-radius: 28px; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); overflow: hidden;
    animation: ls-sheet-in .18s ease-out;
}
.ls-search-top { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 20px; border-bottom: 2px solid #F1E8D4; font-size: 20px; }
.ls-search-top input {
    flex: 1; min-width: 0; border: 0; background: transparent; outline: 0;
    font: 700 19px var(--font-body); color: var(--text); padding: 6px 0;
}
.ls-search-top input::-webkit-search-cancel-button { display: none; }
.ls-search-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #F4EEDF; font-weight: 800; color: var(--text); cursor: pointer; flex: 0 0 40px; }
.ls-search-results { overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 14px; -webkit-overflow-scrolling: touch; }
.ls-s-head { font: 800 11.5px var(--font-body); letter-spacing: .09em; text-transform: uppercase; color: var(--msasa); padding: 12px 12px 4px; }
.ls-s-row {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 16px; min-height: 52px;
    color: var(--text); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.ls-s-row:hover, .ls-s-row.is-sel { background: #FFF1C9; color: var(--text); }
.ls-s-ico { flex: 0 0 38px; height: 38px; display: grid; place-items: center; font-size: 22px; background: #fff; border-radius: 12px; box-shadow: 0 2px 0 rgba(46, 42, 58, .07); overflow: hidden; }
.ls-s-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.ls-s-txt { flex: 1; min-width: 0; }
.ls-s-txt b { display: block; font-size: 15.5px; line-height: 1.2; overflow-wrap: anywhere; }
.ls-s-txt small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-s-tag { flex: 0 0 auto; font: 800 11px var(--font-body); color: var(--muted); background: #F4EEDF; padding: 3px 9px; border-radius: 999px; }
.ls-s-empty { text-align: center; color: var(--muted); font-weight: 700; padding: 26px 16px 16px; }
.ls-s-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 4px 8px 12px; }
.ls-s-chips button { border: 2px solid var(--ls-line); background: #fff; border-radius: 999px; padding: 7px 14px; font: 800 14px var(--font-body); color: var(--text); cursor: pointer; }
.ls-s-chips button:hover { border-color: var(--sun); }
body.ls-lock { overflow: hidden; }

@media (max-width: 575.98px) {
    .ls-search { padding: 0; }
    .ls-search-panel { max-width: none; max-height: none; height: 100%; border-radius: 0; }
    .ls-search-top { padding-top: calc(14px + var(--ls-safe-t)); }
    .ls-search-results { padding-bottom: calc(14px + var(--ls-safe-b)); }
}

/* ======================================================================
   Landing page: search bar, quick tiles, "Explore everything"
   ====================================================================== */
.ls-find {
    display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px; margin: 22px auto 0; text-align: left;
    padding: 15px 22px; background: #fff; border: 3px solid var(--sun); border-radius: 999px; cursor: pointer;
    box-shadow: var(--ls-shadow); color: var(--muted); font: 700 17px var(--font-body);
    transition: transform .12s, box-shadow .12s;
}
.ls-find:hover { transform: translateY(-2px); }
.ls-find span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 992px) { .ls-find { margin-left: 0; } }

.ls-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
@media (max-width: 575.98px) { .ls-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.ls-quick a {
    --c: var(--sun); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 16px 14px;
    background: #fff; border-radius: 24px; border-bottom: 6px solid var(--c); box-shadow: var(--ls-shadow);
    color: var(--text); text-decoration: none; transition: transform .14s;
}
.ls-quick a:hover { transform: translateY(-3px); color: var(--text); }
.ls-quick a > span:first-child { font-size: 34px; line-height: 1.1; }
.ls-quick b { font: 800 20px var(--font-heading); line-height: 1.1; }
.ls-quick small { color: var(--muted); font-weight: 700; font-size: 13px; line-height: 1.25; }

.ls-explore { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; text-align: left; }
.ls-explore-card { background: #fff; border-radius: 24px; padding: 18px 18px 14px; box-shadow: var(--ls-shadow); }
.ls-explore-card h3 { font: 800 20px var(--font-heading); margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.ls-explore-card h3 a { color: var(--text); text-decoration: none; }
.ls-explore-card .ls-explore-sub { color: var(--msasa); font: 800 11.5px var(--font-body); letter-spacing: .08em; text-transform: uppercase; margin: 12px 0 4px; }
.ls-explore-card ul { list-style: none; padding: 0; margin: 0; }
.ls-explore-card li a { display: flex; align-items: center; gap: 10px; padding: 7px 4px; color: var(--text); text-decoration: none; font-weight: 700; border-radius: 10px; min-height: 40px; }
.ls-explore-card li a:hover { background: #FFF1C9; }
.ls-explore-card li small { color: var(--muted); font-weight: 700; margin-left: auto; }

/* ======================================================================
   Responsive fixes for content pages (found by measuring overflow at 375px)
   ====================================================================== */
@media (max-width: 767.98px) {
    /* hero words that were nowrap pushed the page wider than the screen */
    .ls-hero-mini .ls-title span, .ls-reader-page .ls-title span { white-space: normal; }
    .ls-title { font-size: clamp(34px, 10vw, 52px); }
    .ls-kicker { max-width: 100%; white-space: normal; text-align: center; line-height: 1.25; }
    .ls-lead { font-size: 17.5px; }
    .ls-hero { padding: 32px 0 24px; }
    .ls-hero-mini { padding: 28px 0 6px; }
    .ls-btn { font-size: 18px; padding: 12px 22px; }
    .ls-h2 { font-size: clamp(28px, 8vw, 38px); }
    .ls-topics-band { border-radius: 32px; margin: 0 8px; }
    .ls-wotd { padding: 20px; gap: 16px; }
    .ls-wotd-pic { width: 88px; height: 88px; font-size: 56px; }
    .ls-wotd-word { font-size: 40px; }
}
@media (max-width: 575.98px) {
    .container, .container-xl { padding-left: 16px; padding-right: 16px; }
    /* wide tables scroll inside their own box instead of widening the page */
    .table-responsive-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Compact page headers: the search box or list used to start below the
       first screen on a phone, under a tall title, lead and stacked stat pills */
    .ls-hero-mini { padding: 14px 0 0; }
    .ls-hero-mini .ls-kicker { font-size: 12px; padding: 4px 12px; }
    .ls-hero-mini .ls-title { font-size: clamp(28px, 8.5vw, 36px); margin: 10px 0 8px; }
    .ls-hero-mini .ls-title span::after { height: 9px; bottom: 2px; }
    .ls-hero-mini .ls-lead {
        font-size: 15.5px; line-height: 1.45; margin-bottom: 0;
        display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    }
    /* stat pills: one swipeable row of plain labels, not a stack of fake buttons */
    .ls-hero-mini .ls-dict-stats {
        flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
        margin: 10px -16px 0 !important; padding: 2px 16px 4px; gap: 6px;
    }
    .ls-hero-mini .ls-dict-stats::-webkit-scrollbar { display: none; }
    .ls-hero-mini .ls-dict-stat-pill {
        flex: none; white-space: nowrap; padding: 3px 10px; font-size: 12.5px;
        border-width: 1px; box-shadow: none; background: transparent;
    }
    .ls-hero-mini .d-flex.flex-wrap { margin-top: 10px !important; gap: 6px !important; }
    .ls-hero-mini .ls-btn { font-size: 15px !important; padding: 8px 16px !important; }

    /* iOS zooms the page when a control under 16px gets focus */
    #dictPageSize { font-size: 16px; }

    /* Phone-only folds: intro cards collapse to their heading (behaviour in shell.js) */
    [data-ls-fold]:not(.is-open) [data-ls-fold-body] { display: none !important; }
    [data-ls-fold]:not(.is-open) [data-ls-fold-head] { margin-bottom: 0 !important; }
    [data-ls-fold-head] { cursor: pointer; position: relative; padding-right: 42px; }
    [data-ls-fold-head]::after {
        content: '▾'; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
        width: 32px; height: 32px; border-radius: 50%; background: #F4F1EA; color: #555;
        display: flex; align-items: center; justify-content: center; font-size: 15px; transition: transform .2s;
    }
    [data-ls-fold].is-open [data-ls-fold-head]::after { transform: translateY(-50%) rotate(180deg); }

    /* filter chips: one swipeable row instead of three or four wrapped rows,
       and the search box above them */
    .ls-chip-row {
        flex-wrap: nowrap !important; justify-content: flex-start !important; overflow-x: auto;
        scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 2px 16px;
    }
    .ls-chip-row::-webkit-scrollbar { display: none; }
    .ls-chip-row > * { flex: none; white-space: nowrap; }
    .ls-filter-search { order: -1; }

    /* long culture lists: tighter cards and gutters */
    #mitupoGrid, #tsumoGrid, #poemCardsGrid, #riddlesGrid, #zvieraGrid { --bs-gutter-y: .5rem; }

    /* Mitupo: picture, name, recite, praise titles and "View Full" stay; the taboo,
       praise poem, heritage and extra links are all in the View Full sheet */
    .totem-card-cover { height: 140px !important; }
    .totem-card-body { padding: 14px 16px 16px !important; }
    .totem-taboo, .totem-praise, .totem-heritage, .totem-links { display: none !important; }
    .totem-zvidao { margin-bottom: 10px !important; }
    .totem-actions { padding-top: 10px !important; }

    /* Nhetembo: the line preview is on the poem page; synopsis trimmed to two lines */
    .poem-card { padding: 16px !important; }
    .poem-preview { display: none; }
    .poem-actions { flex-wrap: nowrap !important; }
    .poem-actions .ls-btn { font-size: 15px; padding: 8px 14px !important; white-space: nowrap; }
    .poem-synopsis {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        margin-bottom: 10px !important;
    }

    /* Zvirahwe riddle cards */
    .riddle-card { padding: 16px !important; }
    .riddle-card .mb-3 { margin-bottom: .5rem !important; }
    .riddle-card .border-top { padding-top: .6rem !important; }

    /* expandable cards (tsumo, zviera, mwedzi, …): drop the decorative tile and the
       "tap to expand" hint (the chevron says it) and keep the meta on one line */
    .ls-xcard-emoji, .ls-xcard-hint { display: none; }
    .ls-xcard-thumb { width: 52px; height: 52px; }
    .ls-xcard-head { padding: .6rem .75rem; }
    .ls-xcard-title { font-size: 1.05rem !important; }
    .ls-xcard-meta { flex-wrap: nowrap; align-items: center; margin-top: .2rem; }
    .ls-xcard-meta > * { flex: none; }
    /* the long theme label gives way; type badge and Listen keep their size */
    .ls-xcard-meta > span.badge.border { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Touch targets: small buttons, audio chips and bare text links were 16–31px tall */
@media (max-width: 991.98px), (pointer: coarse) {
    .btn-sm, button.badge, .ls-alpha-btn, .ls-step-dot, .ls-dock-btn, .ls-dock-pill, .ls-dock-play-btn {
        min-height: 40px; min-width: 40px;
        display: inline-flex; align-items: center; justify-content: center;
    }
    /* icon-only speakers and toggles */
    .btn-speak-word, .pillar-speak-btn, .btn-lang-mode, .btn-group-sm > .btn { min-width: 44px; min-height: 44px; }
    /* text links keep their look; padding plus a matching negative margin
       grows the tap area without moving anything */
    .ls-footer a, .ls-dict-en a, .riddle-hint-toggle, .breadcrumb-item a, .auth-link {
        display: inline-block; padding: 10px 4px; margin: -10px -4px;
    }
}
/* anything that wraps a table gets its own horizontal scroll */
.ls-home table, .ls-library-page table { max-width: 100%; }

/* Landing: stories shelf and the directory's wide Culture card */
.ls-shelf-band { background: linear-gradient(180deg, #FFFDF8 0%, #FFF8EC 100%); border-top: 1px solid #EFE4CC; border-bottom: 1px solid #EFE4CC; }
.ls-shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ls-shelf-card {
    display: flex; flex-direction: column; gap: 2px; padding: 16px; background: #fff; border-radius: 22px;
    box-shadow: var(--ls-shadow); color: var(--text); text-decoration: none; transition: transform .14s;
}
.ls-shelf-card:hover { transform: translateY(-3px); color: var(--text); }
.ls-shelf-ico { font-size: 36px; line-height: 1.1; }
.ls-shelf-card b { font: 800 18px var(--font-heading); line-height: 1.15; }
.ls-shelf-card small { color: var(--muted); font-weight: 700; }
@media (max-width: 991.98px) {
    /* one swipeable row instead of a tall stack */
    .ls-shelf { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; margin: 0 -16px; padding: 4px 16px 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .ls-shelf::-webkit-scrollbar { display: none; }
    .ls-shelf-card { flex: 0 0 62%; max-width: 250px; scroll-snap-align: start; }
}
.ls-explore-card h3 .ls-explore-sh { margin-left: auto; color: var(--msasa); font: 800 13px var(--font-body); }
.ls-explore-card.is-wide { grid-column: 1 / -1; }
.ls-explore-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 26px; }
.ls-explore-card li a > span:first-child { flex: 0 0 24px; text-align: center; }

/* Culture hub */
.ls-hub-group { --c: var(--msasa); margin-bottom: 30px; }
.ls-hub-title {
    font: 800 13px var(--font-body); letter-spacing: .1em; text-transform: uppercase;
    color: var(--c); margin: 0 0 12px 4px; display: flex; align-items: center; gap: 12px;
}
.ls-hub-title::after { content: ''; flex: 1; height: 2px; background: color-mix(in srgb, var(--c) 25%, transparent); border-radius: 2px; }
.ls-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ls-hub-card {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 84px;
    background: #fff; border-radius: 22px; border-left: 6px solid var(--c);
    box-shadow: var(--ls-shadow); color: var(--text); text-decoration: none; transition: transform .14s;
}
.ls-hub-card:hover { transform: translateY(-3px); color: var(--text); }
.ls-hub-ico { flex: 0 0 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--c) 14%, white); }
.ls-hub-txt { flex: 1; min-width: 0; display: block; }
.ls-hub-txt small { display: block; color: var(--c); font: 800 12px var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.ls-hub-txt b { display: block; font: 800 19px var(--font-heading); line-height: 1.15; }
.ls-hub-txt span { display: block; color: var(--muted); font-weight: 700; font-size: 14px; line-height: 1.3; margin-top: 2px; }
.ls-hub-n { flex: 0 0 auto; align-self: flex-start; background: #F4EEDF; color: var(--muted); font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.ls-hub-n b { color: var(--text); }
@media (max-width: 575.98px) {
    .ls-hub-grid { grid-template-columns: 1fr; gap: 10px; }
    .ls-hub-card { padding: 12px 14px; border-radius: 18px; }
    .ls-hub-n { display: none; }
    .ls-hub-ico { flex-basis: 46px; height: 46px; font-size: 25px; }
}

/* Topic tiles: three across on phones, so fifteen topics are five short rows, not eight tall ones */
@media (max-width: 575.98px) {
    .ls-topics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .ls-topic { border-radius: 20px; padding: 14px 4px 12px; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
    .ls-topic-icon { font-size: 38px; }
    .ls-topic b { font-size: 15.5px; overflow-wrap: anywhere; line-height: 1.1; }
    .ls-topic small { font-size: 11.5px; line-height: 1.2; padding: 0 4px; }
}

/* Bootstrap badges never wrap, so a long label (a category name, a heading chip) pushed pages wider than the screen */
.badge { white-space: normal; text-align: left; max-width: 100%; }
