:root {
    --mud-palette-primary: #5d6cb0 !important;
    --mud-typography-body1-size: 1rem !important;
    --mud-typography-button-size: 1rem !important;
    --awl-menu-strong: #801313;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--awl-menu-strong) !important;
}

.mud-input-text {
    font-size: 1.2rem !important;
}

.mud-button-label {
    text-transform: none;
}

.mud-nav-link-text {
    font-size: 1rem !important;
}

/* Browse list rows (old BrowseView cells). The To line is indented, as the old app's spacer did. */
.awl-row {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 4px 8px 6px 8px;
    margin: 1px 0;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.awl-row:hover, .awl-row:focus {
    background: rgba(93, 108, 176, 0.08);
    outline: none;
}

.awl-row > div + div {
    padding-inline-start: 1rem;
}

/* Recycle bin rows: a restore switch above the pair; the second div is not indented (it is the first word). */
.awl-bin-row {
    cursor: default;
}

.awl-bin-row > div + div {
    padding-inline-start: 0;
}

.awl-bin-row > div + div + div {
    padding-inline-start: 1rem;
}

#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: 2000;
}

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

/* FocusOnNavigate moves focus to the page's h1 (for screen readers); it is not a control, so it shows no focus box. */
h1:focus, h1:focus-visible { outline: none; }

/* Website language links in the menu (LanguageLinks). */
.awl-langlinks {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    justify-content: center;
    padding: 4px 12px 8px 12px;
    font-size: 0.9rem;
}

.awl-langlinks a {
    color: inherit;
    text-decoration: none;
    opacity: 0.75;
}

.awl-langlinks a:hover {
    text-decoration: underline;
}

.awl-langlinks a.current {
    font-weight: 700;
    opacity: 1;
}

/* "How to use" group in the menu (MainNavMenu): a native <details>, so it works on static pages too. The summary looks like a
   menu link with a small arrow; the links inside are indented. */
.awl-navgroup > summary { list-style: none; cursor: pointer; position: relative; padding-inline-start: 28px; }
.awl-navgroup > summary::-webkit-details-marker { display: none; }
.awl-navgroup > summary::after {
    content: "";
    position: absolute;
    inset-inline-end: 16px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
    opacity: 0.6;
}
.awl-navgroup[open] > summary::after { transform: translateY(-30%) rotate(225deg); }
.awl-navgroup > .mud-nav-item { padding-inline-start: 12px; }
.awl-navgroup > .mud-nav-item .mud-nav-link { font-size: 0.95em; }

/* The help pages (Components/Pages/Help): readable text width, lists and the previous/next links. */
.awl-help ul, .awl-help ol { margin: 0; padding-inline-start: 1.4rem; font-size: 1rem; line-height: 1.5; letter-spacing: 0.00938em; }
.awl-help li { margin: 0.25rem 0; }
.awl-help-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.awl-help-index { list-style: none; padding: 0; }
.awl-help-index li { margin: 0.9rem 0; }

/* Reconnecting to the server (Blazor's #components-reconnect-modal in App.razor). While the connection is down it is a thin
   wavy line across the top of the page, position fixed so that no text moves. After the retries fail, or when the session was
   paused, a small note with a button appears under it. Blazor sets one of the components-reconnect-* classes on the element. */
#components-reconnect-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5000;
    pointer-events: none;
    /* Hidden by fading out (visibility waits for the fade), not by display, so that it can fade both ways. */
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.5s ease, visibility 0s linear 1.5s;
}

/* Shown: fades in after a short pause, so a connection that comes straight back barely shows at all. */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-resume-failed,
#components-reconnect-modal.components-reconnect-paused {
    opacity: 1;
    visibility: visible;
    transition: opacity 1.2s ease 0.25s, visibility 0s linear 0s;
}

/* The wave is a mask (any colour of stroke) over a fill in the theme's primary colour, the blue used for button and link text,
   at half opacity, so it follows the theme (light or dark). */
.awl-reconnect-wave {
    height: 6px;
    background-color: var(--mud-palette-primary, #594ae2);
    opacity: 0.55;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='6' viewBox='0 0 24 6'%3E%3Cpath d='M0 3 Q6 0 12 3 T24 3' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 24px 6px;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='6' viewBox='0 0 24 6'%3E%3Cpath d='M0 3 Q6 0 12 3 T24 3' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 24px 6px;
    animation: awl-wave 0.9s linear infinite paused;
}

@keyframes awl-wave {
    to { -webkit-mask-position: 24px 0; mask-position: 24px 0; }
}

/* Gave up (failed) or paused: the line stops and turns red. */
#components-reconnect-modal.components-reconnect-failed .awl-reconnect-wave,
#components-reconnect-modal.components-reconnect-resume-failed .awl-reconnect-wave,
#components-reconnect-modal.components-reconnect-paused .awl-reconnect-wave {
    animation: none;
    background-color: var(--mud-palette-error, #d32f2f);
}

@media (prefers-reduced-motion: reduce) {
    .awl-reconnect-wave { animation: none; }
}

.awl-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.awl-reconnect-note {
    display: none;
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    gap: 0.75rem;
    padding: 4px 14px;
    border: 1px solid var(--mud-palette-lines-default, #ccc);
    border-radius: 4px;
    background: var(--mud-palette-surface, #fff);
    color: var(--mud-palette-text-primary, #222);
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

#components-reconnect-modal.components-reconnect-failed .awl-note-failed,
#components-reconnect-modal.components-reconnect-resume-failed .awl-note-failed,
#components-reconnect-modal.components-reconnect-paused .awl-note-paused {
    display: flex;
}

.awl-reconnect-note button,
.awl-reconnect-note a {
    font: inherit;
    color: var(--mud-palette-primary, #1565c0);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

/* MudBlazor ships its own styles for this id (an opaque background, padded uppercase buttons): undo them here. */
#components-reconnect-modal {
    background-color: transparent !important;
}

#components-reconnect-modal .awl-reconnect-note button,
#components-reconnect-modal .awl-reconnect-note button:hover {
    text-transform: none;
    letter-spacing: normal;
    font-size: inherit;
    font-weight: inherit;
    padding: 0;
    min-width: 0;
    background: none;
    box-shadow: none;
    border: 0;
    color: var(--mud-palette-primary, #1565c0);
}

/* The wave only moves while the reconnect is in progress (not while it is faded out); the notes fade in when they appear. */
#components-reconnect-modal.components-reconnect-show .awl-reconnect-wave,
#components-reconnect-modal.components-reconnect-retrying .awl-reconnect-wave {
    animation-play-state: running;
}

@keyframes awl-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.awl-reconnect-note {
    animation: awl-fade-in 0.8s ease;
}

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal,
    #components-reconnect-modal.components-reconnect-show,
    #components-reconnect-modal.components-reconnect-retrying,
    #components-reconnect-modal.components-reconnect-failed,
    #components-reconnect-modal.components-reconnect-resume-failed,
    #components-reconnect-modal.components-reconnect-paused { transition: none; }
    .awl-reconnect-note { animation: none; }
}

/* Notice about browser translation on the home page (Index.razor, App.razor): hidden until the script adds .awl-tw-on to <html>. */
.awl-tw { display: none; padding: 0.75rem 1rem; border-radius: 4px; background: var(--mud-palette-info); color: var(--mud-palette-info-text); }
html.awl-tw-on .awl-tw { display: block; }
.awl-tw p { margin: 0 0 0.5rem; }
.awl-tw-switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.awl-tw-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.awl-tw-slider { position: relative; width: 2.5rem; height: 1.25rem; border-radius: 1rem; background: rgba(0,0,0,.35); transition: background .15s; flex: none; }
.awl-tw-slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.25rem - 4px); height: calc(1.25rem - 4px); border-radius: 50%; background: #fff; transition: transform .15s; }
html[dir="rtl"] .awl-tw-slider::after, [dir="rtl"] .awl-tw-slider::after { left: auto; right: 2px; }
.awl-tw-switch input:checked + .awl-tw-slider { background: rgba(0,0,0,.7); }
.awl-tw-switch input:checked + .awl-tw-slider::after { transform: translateX(1.25rem); }
[dir="rtl"] .awl-tw-switch input:checked + .awl-tw-slider::after { transform: translateX(-1.25rem); }
.awl-tw-switch input:focus-visible + .awl-tw-slider { outline: 2px solid currentColor; outline-offset: 2px; }

/* The demo banner's message fills the banner, so the (normally hidden) Turnstile check can sit at its right edge. */
.awl-demo-alert .mud-alert-message { flex: 1 1 auto; }

/* Show/hide button added to password boxes by the script in App.razor: sits inside the box, over the right end of the
   input, so the box keeps one unbroken underline. */
.mud-input:has(.awl-reveal) { position: relative; }
.mud-input:has(.awl-reveal) input[type] { padding-right: 36px; }
.awl-reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 2px; cursor: pointer; color: var(--mud-palette-text-disabled); display: inline-flex; align-items: center; opacity: .7; }
.awl-reveal:hover, .awl-reveal:focus-visible { color: var(--mud-palette-text-secondary); opacity: 1; }
.awl-reveal-on { color: var(--mud-palette-text-secondary); opacity: 1; }
.awl-reveal svg { width: 20px; height: 20px; }

/* Browse filter shortcut dropdowns: packed together, text the size of the Test / Filter / Add buttons. */
.awl-shortcuts { gap: 4px !important; }
.awl-shortcuts > .mud-select { flex: 0 0 auto; }
.awl-shortcuts .mud-input > input, .awl-shortcuts .mud-select-input, .awl-shortcuts .mud-input-slot { font-size: .8125rem; }
.awl-shortcut-pop .mud-list-item, .awl-shortcut-pop .mud-list-item-text { font-size: .8125rem; }
.awl-shortcuts .mud-input-outlined .mud-select-input { padding-left: 8px; padding-right: 0; }
.awl-shortcuts .mud-select-input ~ .mud-input-adornment, .awl-shortcuts .mud-input-adornment-end { margin-inline: 0 !important; }
.awl-shortcuts .mud-select .mud-input-adornment .mud-icon-root { margin-inline-start: -4px; }
.awl-pair { flex: 1 1 auto; min-width: 0; }
.awl-pair .mud-input > input, .awl-pair .mud-select-input, .awl-pair .mud-input-slot { font-size: .8125rem; }

/* Browse controls: two rows (language pair + Add; shortcut dropdowns + Test/Filter), optionally mirrored and pinned to the bottom. */
.awl-ctl-row1 { flex-wrap: nowrap; }
.awl-dds { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.awl-ctl-btns { margin-inline-start: auto; }
.awl-flip .awl-ctl-row1, .awl-flip .awl-ctl-row2 { flex-direction: row-reverse !important; }
.awl-flip .awl-ctl-btns { margin-inline-start: 0; }
.awl-flip .awl-dds { margin-inline-start: auto; }
.awl-controls-bottom { position: sticky; bottom: 0; z-index: 5; padding: 6px 0; background: var(--mud-palette-background, #fff); border-top: 1px solid var(--mud-palette-lines-default, #ddd); }
.awl-flip-bar { flex-direction: row-reverse !important; }
.awl-sel-sm .mud-input > input, .awl-sel-sm .mud-select-input, .awl-sel-sm .mud-input-slot { font-size: .8125rem; }

/* "You need to confirm Cookies & Privacy" notice: the backdrop is opaque so the page is not shown until it is closed. */
.awl-ack-dialog { margin: auto; inset: 0; height: fit-content; max-width: min(28rem, calc(100vw - 2rem)); border: 1px solid var(--mud-palette-lines-default, #ccc); border-radius: 8px; padding: 1.25rem 1.5rem; background: var(--mud-palette-surface, #fff); color: var(--mud-palette-text-primary, #222); }
.awl-ack-dialog::backdrop { background: var(--mud-palette-background, #fff); }
.awl-ack-dialog h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.awl-ack-dialog p { margin: 0 0 1rem; }
.awl-ack-ok { background: var(--mud-palette-primary, #801313); color: #fff; border: 0; border-radius: 4px; padding: .45rem 1.4rem; font: inherit; cursor: pointer; float: inline-end; }
.awl-ack-ok:focus-visible { outline: 2px solid var(--mud-palette-primary, #801313); outline-offset: 2px; }

/* Word page: From-word completion (script in App.razor, awlClient-free, delegated). The ghost text sits over the input;
   its typed part is invisible so only the rest of the suggested word shows, in grey. */
.awl-complete { position: relative; flex: 1 1 auto; min-width: 0; }
.awl-ghost { position: absolute; display: flex; align-items: center; pointer-events: none; white-space: pre; overflow: hidden; box-sizing: border-box; color: var(--mud-palette-text-disabled); }
.awl-ghost[hidden], .awl-complete-list[hidden] { display: none; }
.awl-ghost .awl-typed { visibility: hidden; }
.awl-complete-list { position: absolute; left: 0; right: 0; z-index: 1400; max-height: 14rem; overflow: auto; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); border: 1px solid var(--mud-palette-lines-default); border-radius: 4px; box-shadow: var(--mud-elevation-4); }
.awl-complete-list div { padding: 6px 12px; cursor: pointer; }
.awl-complete-list div:hover, .awl-complete-list div.active { background: var(--mud-palette-action-default-hover); }
