/* ---------- Fonts (self-hosted in wwwroot/fonts, SIL Open Font License) ----------
   Same look on every phone and computer, and no download from Google Fonts (slow or blocked for some learners).
   Comic Neue: the friendly hand-written look of the site, easy to read. Indie Flower: the logo text. Vazirmatn: Persian text (used automatically
   for Persian letters, thanks to unicode-range). */
@font-face { font-family: 'Comic Neue'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/comic-neue-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Comic Neue'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/comic-neue-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Comic Neue'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/comic-neue-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Comic Neue'; font-style: italic; font-weight: 700; font-display: swap; src: url('../fonts/comic-neue-latin-700-italic.woff2') format('woff2'); }
@font-face { font-family: 'Indie Flower'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/indie-flower-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/vazirmatn-arabic-400-normal.woff2') format('woff2');
             unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/vazirmatn-arabic-500-normal.woff2') format('woff2');
             unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/vazirmatn-arabic-700-normal.woff2') format('woff2');
             unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }

.alert-login {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: 'Comic Neue', Vazirmatn, 'Comic Sans MS', sans-serif;
    font-size: 18px;
    background-color: #fcf8e3;
    color: #8a6d3b;
    position: relative;
    box-shadow: 5px 5px 0px #333, -2px -2px 0px #ccc; /* Multiple shadows for depth */
    color: #2b5e2b; /* Marker-like green */
    text-shadow: 0.5px 0.5px 0px #666; /* Subtle text wiggle */
}


 


    .hand-login a {
        color: #487848; /* Slightly lighter green */
        text-decoration: underline wavy #2b5e2b; /* Wavy underline */
        text-underline-offset: 3px; /* Offset for realism */
        font-weight: bold; /* Thicker for emphasis */
    }


    .hand-login a:hover {
        color: #66512c;
        text-decoration: none;
    }

 

    /* Link styling */
 


/* Override Bootstrap alert-warning */
.hand-login {
    background: #fffef0; /* Override default yellow */
    border-color: transparent; /* Remove Bootstrap border */
}


.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ---------- Loaders ----------
   Startup (index.html): the logo bounces over its shadow while a bar fills with the download progress.
   Page change (App.razor, while the sign-in is read): a thin yellow bar at the top, shown only if it takes
   longer than a moment, so fast page changes don't flicker. */
.app-loader {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    background: #fffdf3;
    font-family: 'Comic Neue', Vazirmatn, 'Comic Sans MS', sans-serif;
}

.app-loader-logo {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    animation: app-loader-bounce 1s ease-in-out infinite;
}

.app-loader-shadow {
    width: 64px;
    height: 10px;
    margin-top: -.6rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, .15);
    animation: app-loader-shadow 1s ease-in-out infinite;
}

.app-loader-bar {
    width: min(220px, 60vw);
    height: 8px;
    border: 2px solid #2b2b2b;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
}

    .app-loader-bar span {
        display: block;
        height: 100%;
        width: var(--blazor-load-percentage, 0%);
        background: #ffcc00;
        transition: width .15s ease-out;
    }

.app-loader-text {
    font-weight: bold;
    color: #2b2b2b;
}

    .app-loader-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

@keyframes app-loader-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-18px); }
}

@keyframes app-loader-shadow {
    0%, 100% { transform: scaleX(1); opacity: 1; }
    50% { transform: scaleX(.7); opacity: .6; }
}

.page-loader {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 2000;
    height: 3px;
    overflow: hidden;
    background: rgba(255, 204, 0, .25);
    opacity: 0;
    animation: page-loader-in .2s ease-out .25s forwards;
}

    .page-loader::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 40%;
        background: #ffcc00;
        box-shadow: 0 0 6px rgba(255, 204, 0, .8);
        animation: page-loader-slide 1s ease-in-out infinite;
    }

@keyframes page-loader-in { to { opacity: 1; } }
@keyframes page-loader-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
    .app-loader-logo, .app-loader-shadow, .page-loader::before { animation: none; }
    .page-loader::before { width: 100%; }
}

code {
    color: #c02d76;
}







{
    font-family: 'Comic Neue', Vazirmatn, 'Comic Sans MS', sans-serif;
}

.container {
    background: #fafafa;
    padding: 2rem;
}

/* Sketchy input styles */
.form-control {
    background: white;
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    padding: 1rem;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 #333;
}

    .form-control:focus {
        outline: none;
        box-shadow: 4px 4px 0 #333;
        transform: translate(-2px, -2px);
    }

/* Sketchy button styles */
.btn {
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 #333;
    background: white;
    color: #333;
    position: relative;
    text-decoration: none;
}

    .btn:hover {
        box-shadow: 4px 4px 0 #333;
        transform: translate(-2px, -2px);
    }

    .btn:active {
        box-shadow: none;
        transform: translate(0, 0);
    }

.btn-primary {
    background: #c2e6ff;
}

    .btn-primary:hover {
        background: #a8d8ff;
    }

/* Card styles */
.card {
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    margin-bottom: 1.5rem;
    background: white;
    box-shadow: 3px 3px 0 #333;
}

.card-body {
    padding: 1.5rem;
}

/* Video player styles */
video {
    border: 2px solid #333;
    border-radius: 15px;
    box-shadow: 3px 3px 0 #333;
}

/* List group styles */
.list-group-item {
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    margin-bottom: 0.5rem;
    background: white;
    transition: all 0.3s ease;
}

    .list-group-item:hover {
        transform: translate(-2px, -2px);
        box-shadow: 2px 2px 0 #333;
    }

    .list-group-item.active {
        background: #c2e6ff;
        color: #333;
        border-color: #333;
    }



/* Icon styles */
.fas, .oi {
    position: relative;
    top: 1px;
}

/* Animation for focus states */
@keyframes wiggle {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-1deg);
    }

    75% {
        transform: rotate(1deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

.form-control:focus, .btn:hover {
    animation: wiggle 0.3s ease-in-out;
}


.tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    margin: 0.2rem;
    background: #f0f0f0;
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .tag:hover {
        transform: translate(-1px, -1px);
        box-shadow: 2px 2px 0 #333;
    }


/* Table styles */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    margin-bottom: 2rem;
}

    table th {
        padding: 1rem;
        text-align: left;
        border-bottom: 2px solid #333;
        font-weight: bold;
        color: #333;
    }

    table td {
        padding: 1rem;
        background: white;
        border: 2px solid #333;
        position: relative;
    }

    table tr td:first-child {
        border-radius: 255px 15px 15px 255px/15px 225px 225px 15px;
    }

    table tr td:last-child {
        border-radius: 15px 225px 255px 15px/225px 15px 15px 225px;
    }

    table tbody tr {
        transition: all 0.3s ease;
    }

        table tbody tr:hover td {
            transform: translate(-2px, -2px);
            box-shadow: 3px 3px 0 #333;
        }


/* Clickable term styles (can be applied to any clickable element) */
.clickable-term {
    cursor: pointer;
    color: #0d6efd;
    text-decoration: underline;
    transition: all 0.3s ease;
}

    .clickable-term:hover {
        color: #0a58ca;
        animation: wiggle 0.3s ease-in-out;
    }
/* Panel styles */
.panel {
    padding: 1rem;
    margin: 1rem 0;
    background: white;
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 3px 3px 0 #333;
}


/* Input group styles */
.input-group {
    border: 2px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    overflow: hidden;
}

.input-group-text {
    border: none;
    background: #f8f8f8;
}

.btn-outline-primary {
    background: white;
    color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-danger {
    background: white;
    color: #dc3545;
    border-color: #dc3545;
}

.btn-success {
    background: #198754;
    color: white;
}

/* Empty state styles */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    stroke-width: 2px;
}

/* Loading state styles */
.loading-container {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}
.control-btn {
    background: white;
    border: 2px solid #333;
    border-radius: 60% 40% 50% 30%; /* Imperfect circle for hand-drawn effect */
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0 #333; /* Shadow for depth */
    transition: all 0.3s ease;
    margin-left: 0 !important; /* Add spacing between buttons */
}

    /* Hover Effect */
    .control-btn:hover {
        transform: translate(-2px, -2px);
        box-shadow: 4px 4px 0 #333;
    }

    /* Active State */
    .control-btn:active {
        transform: translate(0, 0);
        box-shadow: 2px 2px 0 #333;
    }
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* Hand-Drawn Button Styling */
.btn-back {
    background: white;
    border: 2px solid #333;
    border-radius: 60% 40% 50% 30%; /* Imperfect circle for hand-drawn effect */
    padding: 0.75rem 1.5rem; /* Padding for comfortable text spacing */
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    box-shadow: 2px 2px 0 #333; /* Shadow for depth */
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem; /* Space between icon and text */
}

    /* Add a "hand-drawn" texture effect */
    .btn-back::before {
        content: "";
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        background: rgba(255, 255, 255, 0.8);
        border: 2px dashed rgba(0, 0, 0, 0.1); /* Dashed border for texture */
        border-radius: inherit;
        z-index: -1;
        filter: blur(2px); /* Soften the edges */
    }

    /* Hover Effect */
    .btn-back:hover {
        transform: translate(-2px, -2px);
        box-shadow: 4px 4px 0 #333;
    }

    /* Active State */
    .btn-back:active {
        transform: translate(0, 0);
        box-shadow: 2px 2px 0 #333;
    }

    /* Icon Styling */
    .btn-back .arrow-icon {
        font-size: 1.2rem;
        font-weight: bold;
    }

/* ---------- Installed app: "Install app" button and the iPhone instructions ---------- */
.install-app { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; margin-top: .3rem; padding: .35rem .75rem; border: 1px solid #c8d4e3; border-radius: 9px; background: #f5f8fc; color: #315d94; font: inherit; font-weight: bold; cursor: pointer; }
.install-app:hover { background: #eaf1fb; }
.install-app:focus-visible { outline: 3px solid #315d94; outline-offset: 2px; }
.install-sheet-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .45); }
.install-sheet {
    position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 2001;
    width: min(420px, calc(100vw - 24px)); transform: translateX(-50%);
    padding: 20px 18px 16px; border: 2px solid #2b2b2b; border-radius: 18px 8px 22px 10px;
    background: #fffdf3; box-shadow: 4px 4px 0 #2b2b2b; text-align: center; color: #2b2b2b;
}
.install-sheet img { border-radius: 14px; }
.install-sheet h2 { font-size: 1.25rem; margin: 8px 0 10px; }
.install-sheet ol { text-align: left; margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; }
.install-sheet p { margin: 0 0 12px; color: #6b6b6b; font-size: .92rem; }
.install-sheet-close { min-height: 44px; width: 100%; border: 2px solid #2b2b2b; border-radius: 10px 4px 10px 4px; background: #2b2b2b; color: #fff; font: inherit; font-weight: bold; }

/* ---------- Running as an app (installed or store app): room for the phone's notch and home bar ---------- */
html.in-app body { padding-bottom: env(safe-area-inset-bottom); }
html.in-app .navbar.sticky-top { padding-top: env(safe-area-inset-top); }

/* ---------- Phones and tablets: bottom tab bar (NavMenu) ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: flex; justify-content: space-around;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: #212529; border-top: 2px solid #ffcc00;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .18);
}
.tabbar .tab {
    flex: 1; min-width: 0; min-height: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: 10px; color: #bfc6cc; text-decoration: none;
    font-size: .72rem; font-weight: 600; letter-spacing: .01em;
}
.tabbar .tab i { font-size: 1.3rem; line-height: 1; }
.tabbar .tab.active { color: #ffcc00; background: rgba(255, 204, 0, .1); }
.tabbar .tab:focus-visible { outline: 2px solid #ffcc00; outline-offset: -2px; }
.tabbar .tab-icon { position: relative; display: inline-flex; }
.tabbar .tab-badge {
    position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 999px;
    background: #e63946; color: #fff; font-size: .65rem; font-weight: 700;
}
@media (max-width: 1199.98px) {
    /* Room for the tab bar, so it never covers the end of a page or the footer. */
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    html.in-app body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* ---------- Grammar tooltip (watch page): hovering a grammar word or chip. Created by watch-player.js. ---------- */
.grammar-tip {
    position: fixed;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    max-height: min(320px, 60vh);
    padding: .65rem .75rem .6rem;
    font-family: 'Comic Neue', Vazirmatn, 'Comic Sans MS', sans-serif;
    color: #2b2b2b;
    background: #fffdf3;
    border: 2px solid #2b2b2b;
    border-radius: 12px 4px 12px 4px;
    box-shadow: 3px 3px 0 #2b2b2b;
    animation: grammar-tip-in .12s ease-out;
}

    .grammar-tip[hidden] { display: none; }

.grammar-tip-head { display: flex; align-items: center; gap: .45rem; margin-bottom: .35rem; }
    .grammar-tip-head strong { font-size: 1rem; line-height: 1.25; }

.grammar-tip-level { flex: 0 0 auto; padding: 0 .45rem; border-radius: 999px; background: #2b2b2b; color: #fff; font-size: .72rem; font-weight: bold; }

/* The explanation scrolls when it's long; the title and the button stay. */
.grammar-tip-body { flex: 1; min-height: 0; overflow-y: auto; padding-right: .25rem; font-size: .92rem; line-height: 1.45; }
    .grammar-tip-body p { margin: 0 0 .45rem; }
    .grammar-tip-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; }
    .grammar-tip-body dt { font-size: .75rem; color: #6b6b6b; text-transform: uppercase; padding-top: .1rem; }
    .grammar-tip-body dd { margin: 0; font-weight: bold; color: #1b5e20; }

.grammar-tip-open {
    align-self: flex-end;
    margin-top: .5rem;
    min-height: 36px;
    padding: .2rem .8rem;
    border: 2px solid #2f9e44;
    border-radius: 999px;
    background: #ebfbee;
    color: #1b5e20;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

    .grammar-tip-open:hover, .grammar-tip-open:focus-visible { background: #d3f9d8; outline: none; }

@keyframes grammar-tip-in { from { opacity: 0; transform: translateY(3px); } }

/* The tooltip of a collocation (blue words): blue accents. */
.grammar-tip.colloc { background: #f8fbff; }
    .grammar-tip.colloc .grammar-tip-level { background: #1864ab; }
    .grammar-tip.colloc .grammar-tip-body dd { color: #1864ab; }
    .grammar-tip.colloc .grammar-tip-open { border-color: #1c7ed6; background: #e7f5ff; color: #1864ab; }

/* ======================================================================================================
   Switches and toggles, everywhere.
   - Choose-one groups (role="radio"): the chosen option is dark and carries a tick, the others are blue
     (the colour of something you can press) and turn yellow when pointed at.
   - On/off buttons (aria-pressed): a small switch at the end shows On or Off.
   - Wrap such a group in .mode-picker with a .mode-label (what it chooses) and a .mode-help (what it does).
   Buttons that already show their own mark (icon-only, .no-tick) are left alone.
   ====================================================================================================== */
.mode-picker { display: grid; gap: .3rem; align-self: flex-start; }
.mode-label { font-size: .85rem; font-weight: bold; color: #555; }
.mode-help { margin: 0; max-width: 34rem; font-size: .88rem; color: #555; }

.mode-switch { display: inline-flex; max-width: 100%; border: 2px solid #2b2b2b; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 2px 2px 0 #2b2b2b; }
.mode-switch button {
    min-height: 44px; padding: 0 1rem; border: 0; background: #fff; color: #0b5ed7; font: inherit; font-weight: bold; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: background .12s;
}
.mode-switch button + button { border-left: 2px solid #2b2b2b; }
.mode-switch button:hover:not(.on):not(.active) { background: #fff1a8; color: #2b2b2b; }
.mode-switch button.on, .mode-switch button.active { background: #2b2b2b; color: #fff; cursor: default; }
.mode-switch button:focus-visible { outline: 3px solid #0d6efd; outline-offset: -3px; }

@media (max-width: 520px) {
    .mode-picker { align-self: stretch; }
    .mode-switch { display: flex; }
    .mode-switch button { flex: 1; padding: 0 .5rem; }
}

/* The tick on the chosen option of a choose-one group. */
button[role="radio"][aria-checked="true"]:not(.no-tick):not(.ls-kind):not(.option)::before,
button[aria-pressed="true"]:not(.tool):not(.sgl-slow):not(.no-tick):not([aria-label]):not(.gp-line):not(.bookmark-word)::before {
    content: "\f26e"; font-family: "bootstrap-icons"; font-weight: 400; font-style: normal; line-height: 1; flex: none; margin-right: .3rem;
}

/* The small On/Off switch at the end of an on/off button. */
.tool[aria-pressed]:not(.mark)::after, .sgl-slow[aria-pressed]::after {
    content: ""; flex: none; box-sizing: border-box; width: 2.1rem; height: 1.15rem; margin-left: .25rem; border: 2px solid currentColor; border-radius: 999px;
    background: radial-gradient(circle at center, currentColor 0 .3rem, transparent .33rem) no-repeat 0 50% / 1.05rem 1.05rem;
    transition: background-position .15s;
}
.tool[aria-pressed="true"]:not(.mark)::after, .sgl-slow[aria-pressed="true"]::after {
    background-position: 100% 50%; background-color: color-mix(in srgb, currentColor 28%, transparent);
}
.sgl-slow { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .9rem; border: 2px solid #2b2b2b; border-radius: 10px 4px 10px 4px; background: #fff; box-shadow: 2px 2px 0 #2b2b2b; color: #2b2b2b; font: inherit; font-weight: bold; cursor: pointer; }
.sgl-slow:hover { background: #fff1a8; }
.sgl-slow.on { background: #2b2b2b; color: #fff; }
.sgl-slow:focus-visible { outline: 3px solid #0d6efd; outline-offset: 2px; }

/* Two big option cards: the clearest way to say "pick one, and the other one is a click away". */
.mode-picker.wide { align-self: stretch; width: 100%; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .6rem; }
.mode-card {
    display: grid; grid-template-columns: auto 1fr; column-gap: .65rem; row-gap: .15rem; align-items: start; text-align: left;
    padding: .7rem .9rem; border: 2px solid #b5b5b5; border-radius: 12px; background: #fff; color: #2b2b2b; font: inherit; cursor: pointer;
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.mode-card strong { display: flex; align-items: center; gap: .4rem; font-size: 1.02rem; }
.mode-card small { grid-column: 2; color: #555; font-size: .86rem; line-height: 1.3; }
.mode-dot { grid-row: 1 / span 2; width: 1.3rem; height: 1.3rem; margin-top: .1rem; border: 2px solid #8a8a8a; border-radius: 50%; background: #fff; }
.mode-card:hover:not(.on) { border-color: #2b2b2b; background: #fff8d6; }
.mode-card:hover:not(.on) .mode-dot { border-color: #2b2b2b; }
.mode-card.on { border-color: #364fc7; background: #eef3ff; box-shadow: inset 0 0 0 1px #364fc7, 2px 2px 0 #364fc7; cursor: default; }
.mode-card.on .mode-dot { border-color: #364fc7; background: radial-gradient(circle, #364fc7 0 .4rem, #fff .43rem); }
.mode-card:focus-visible { outline: 3px solid #0d6efd; outline-offset: 2px; }

/* Phone: the two cards sit side by side and keep only their titles, so the choice takes one short row. */
@media (max-width: 520px) {
    .mode-cards { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .mode-card { grid-template-columns: auto 1fr; padding: .6rem .6rem; column-gap: .45rem; align-items: center; }
    .mode-card small { display: none; }
    .mode-dot { grid-row: auto; width: 1.1rem; height: 1.1rem; margin-top: 0; }
    .mode-card strong { font-size: .95rem; line-height: 1.2; flex-wrap: wrap; gap: .25rem; }
    .mode-switch button { white-space: nowrap; padding: 0 .5rem; }
}

@media (max-width: 520px) { .mode-card strong { flex-wrap: nowrap; align-items: flex-start; } .mode-card strong .bi { margin-top: .12rem; } }
