/* ===== Light theme (default) ===== */
:root {
    --bg: #faf6ef;
    --bg-spot: #fff9f0;
    /* <— light “radial spot” */
    --panel: #ffffff;
    --ink: #232f39;
    --muted: #6b7a86;
    --border: #e9e3da;
    --brand: #2aa97b;
    /* matcha */
    --accent: #ef8354;
    /* warm torii/orange */
    --teal: #0f766e;
    --shadow: 0 12px 30px rgba(20, 24, 32, .08);
    --radius: 18px;

    --chip-bg: #f6f3ee;
    --track-bg: #f2ece3;
    --progress: linear-gradient(90deg, #ffe0cc, #ef8354);
    --forecast: linear-gradient(90deg, #c6f0e0, #2aa97b);

    /* …existing vars… */
    --ghost-border: #ffd9c2;
    --ghost-ink: #7a3d1d;
    --focus-ring: #ffbf99;

    --mm-toolbar-border: #c7cfd7;

    /* Lesson onboarding arrow */
    --arrow-green: #22c55e;
    --arrow-border: #6b7280;


    /* Theme-aware menu tokens for the font picker */
    --menu-bg: var(--panel);
    --menu-border: var(--border);
    --menu-hover: var(--chip-bg);
    --menu-selected: var(--chip-bg);
    --menu-shadow: var(--shadow);
    --menu-focus-ring: var(--focus-ring);
    --menu-ink: var(--ink);
}

/* ===== Dark theme overrides ===== */
:root[data-theme="dark"],
html[data-theme="dark"],
html.theme-dark,
body[data-theme="dark"],
body.theme-dark {
    --bg: #0b1116;
    --bg-spot: rgba(255, 255, 255, .04);
    /* <— subtle, dark-safe spot (or use transparent) */
    --panel: #0f1720;
    --ink: #e7eef5;
    --muted: #9ab0c0;
    --border: #1f2b36;
    --brand: #22c59b;
    --accent: #ff905a;
    --teal: #27c3b4;
    --shadow: 0 14px 28px rgba(0, 0, 0, .45);

    --chip-bg: #121d26;
    /* Font menu highlights in dark mode */
    --menu-hover: rgba(255, 255, 255, .06);
    --menu-selected: rgba(255, 255, 255, .10);

    --track-bg: #1a2631;
    --progress: linear-gradient(90deg, #ffb693, #ff7e4f);
    --forecast: linear-gradient(90deg, #2dc7b0, #0ea5a4);

    --ghost-border: #4b2b1b;
    --ghost-ink: #ffb28f;
    --focus-ring: rgba(255, 255, 255, .32);

    --mm-toolbar-border: #3a4651;

}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    color: var(--ink);
    background: radial-gradient(1200px 600px at 12% -10%, var(--bg-spot), transparent), var(--bg);
}

html[data-i18n-pending] body {
    visibility: hidden;
}

:where(.is-hidden) {
    display: none !important;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    gap: 16px;
}

.left {
    display: flex;
    align-items: center;
    gap: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-weight: 800;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #ff7b1a, #d84315 60%, #a12a0d);
    box-shadow: 0 10px 25px rgba(216, 67, 21, 0.35), 0 0 0 1px rgba(255, 123, 26, 0.35);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.brand-name {
    font-weight: 800;
    letter-spacing: .2px;
    line-height: 1;
}

.nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.nav-link:hover {
    background: var(--chip-bg);
}

@media (min-width: 1100px) {
    .site-header {
        --header-item-height: 60px;
    }

    .site-header .brand {
        display: flex;
        align-items: center;
        height: var(--header-item-height);
    }

    .site-header .nav {
        align-items: center;
    }

    .site-header .nav>.nav-link {
        display: flex;
        align-items: center;
        height: var(--header-item-height);
        padding-block: 0;
    }

    .site-header .nav .nav-item {
        display: flex;
        align-items: center;
        height: var(--header-item-height);
    }

    .site-header .nav .nav-item>.nav-link {
        display: flex;
        align-items: center;
        height: 100%;
        padding-block: 0;
    }
}

.pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: #0b513f;
    background: linear-gradient(180deg, #e7f7ef, #c9f0e0);
    border: 1px solid #a6e3cc;
}

.pill--accent {
    color: #692d00;
    background: linear-gradient(180deg, #ffe8d8, #ffd9c2);
    border-color: #ffbf99;
}

body.theme-dark .pill--accent {
    color: #2b1305;
}

.has-dropdown .chev {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 2
}

.dropdown {
    position: absolute;
    left: 0;
    top: 46px;
    min-width: 190px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px;
    box-shadow: var(--shadow);
    display: none;
}

.dropdown a,
.dropdown button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    background: none;
    border: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.dropdown-back {
    display: none;
}

.dropdown a:hover,
.dropdown button:hover,
.dropdown button:focus {
    background: var(--chip-bg);
}

.right {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.right-actions {
    display: flex;
    align-items: center;
    gap: 0;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 12px;
    cursor: pointer;
}

.site-header[data-menu-open="true"] .menu-toggle {
    background: var(--chip-bg);
}

.menu-toggle__bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle__bar+.menu-toggle__bar {
    margin-top: 5px;
}

.menu-label {
    display: none;
    font-weight: 600;
}

.site-header .right-actions .action-item--theme {
    order: 10;
}

.site-header .right-actions .action-item--search {
    order: 20;
}

.site-header .right-actions .action-item--feedback {
    order: 30;
}

.site-header .right-actions .action-item--language {
    /* Keep language globe to the left of the feedback button */
    order: 25;
}

.site-header .right-actions .action-item--settings {
    order: 40;
}

.site-header .right-actions .action-item--contact {
    order: 50;
}

.site-header .right-actions .action-item--guide {
    order: 60;
}

.site-header .right-actions .action-item--profile {
    order: 70;
}

.icon-btn,
.toggle-btn {
    height: 40px;
    border-radius: 14px;
    border: 1px solid var(--border);
    border-color: rgba(255, 255, 255, 0.24) !important;
    background: var(--panel);
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--ink);
    padding: 0 12px;
}

.icon-btn {
    width: 40px;
    padding: 0;
}

.icon-btn:hover,
.toggle-btn:hover {
    background: var(--chip-bg);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2;
    opacity: .85
}


.language-menu {
    position: relative;
}

.language-menu.is-open .dropdown {
    display: block;
}

.language-toggle-btn {
    position: relative;
}

.language-toggle-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
}

.icon-btn.language-toggle-btn {
    border: none;
    background: none;
    box-shadow: none;
    padding: 0;
}

.icon-btn.language-toggle-btn:hover,
.icon-btn.language-toggle-btn:focus,
.icon-btn.language-toggle-btn:active,
.icon-btn.language-toggle-btn:focus-visible {
    background: none;
}

.icon-btn.language-toggle-btn[aria-expanded="true"] {
    background: none;
}

.language-menu .dropdown {
    left: auto;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    max-width: calc(100vw - 32px);
}

.language-menu .dropdown .dropdown-item {
    position: relative;
    padding-left: 36px;
}

.language-menu .dropdown .dropdown-item::before {
    content: '✓';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .75rem;
    font-weight: 800;
    color: var(--teal);
    opacity: 0;
    transition: opacity .2s ease;
}

.language-menu .dropdown .dropdown-item.is-active {
    background: var(--chip-bg);
}

.language-menu .dropdown .dropdown-item.is-active::before {
    opacity: 1;
}

.language-switcher {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.language-switcher select {
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 10px 14px;
    font-weight: 600;
    background: var(--panel);
    color: var(--ink);
    width: 100%;
}

html.theme-dark .language-switcher select {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .18);
    color: var(--ink);
}

.site-header .right-actions .action-item--feedback,
.site-header .right-actions .action-item--feedback:hover,
.site-header .right-actions .action-item--feedback:active,
.site-header .right-actions .action-item--feedback:focus,
.site-header .right-actions .action-item--feedback:focus-visible {
    background: none;
    border: none;
}

@media (min-width: 1100px) {

    .site-header .right-actions {
        /* Tighter spacing between header utility buttons (theme → guide) */
        gap: 0;
        --header-icon-hit: 56px;
        --header-icon-size: 26px;
    }

    .site-header .right-actions .action-item:not(:first-child) {
        margin-left: -10px;
        margin-right: -10px;
    }

    .site-header .right-actions .action-item--guide {
        margin-left: 5px;
        margin-right: 10px;
    }

    /* Keep the Guide link neutral on hover (no panel-style background) */
    .site-header .right-actions .action-item--guide .nav-link:hover {
        background: none;
    }

    .site-header .right-actions .action-item--profile {
        margin-left: 0;
        margin-right: 0;
    }

    .site-header .right-actions .icon-btn,
    .site-header .right-actions .toggle-btn,
    .site-header .right-actions .language-toggle-btn {
        width: var(--header-icon-hit);
        height: var(--header-icon-hit);
        border-radius: 999px;
        border: none;
        background: none;
        padding: 0;
        display: inline-grid;
        place-items: center;
        color: inherit;
    }

    #themeToggle {
        padding: 0;
    }

    .site-header .right-actions .action-item--language {
        width: auto;
        height: auto;
    }

    .site-header .right-actions .action-item--language .language-toggle-btn {
        width: var(--header-icon-hit);
        height: var(--header-icon-hit);
        border-radius: 999px;
        border: none;
        background: none;
        padding: 0;
        display: inline-grid;
        place-items: center;
        color: inherit;
    }

    .site-header .right-actions .action-item svg,
    .site-header .right-actions .action-item .emoji-icon,
    .site-header .right-actions .action-item .label-light,
    .site-header .right-actions .action-item .label-dark,
    .site-header .right-actions .action-item .language-globe-icon {
        width: var(--header-icon-size);
        height: var(--header-icon-size);
        font-size: var(--header-icon-size);
        line-height: 1;
    }

    /* Center the theme toggle glyph within its hit area on desktop */
    #themeToggle .label-light,
    #themeToggle .label-dark {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .site-header .right-actions .action-item svg {
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
    }
}

.text-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 10px;
}

.mobile-primary-actions {
    display: none;
}

.mobile-primary-actions__item {
    width: 100%;
}

.site-header[data-menu-open="true"] .menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-header[data-menu-open="true"] .menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.site-header[data-menu-open="true"] .menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1099px) {
    .site-header {
        align-items: center;
    }

    .site-header .right {
        gap: 12px;
    }

    .site-header .left .nav {
        display: none;
    }

    .site-header .menu-toggle {
        display: inline-flex;
    }

    .site-header .right-actions {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        right: 0;
        width: min(320px, calc(100vw - 32px));
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
        border-radius: 18px;
        border: 1px solid var(--border);
        background: var(--panel);
        box-shadow: var(--shadow);
        z-index: 60;
    }

    .site-header[data-menu-open="true"] .right-actions {
        display: flex;
    }

    .site-header .right-actions .menu-label {
        display: inline-flex;
        margin-left: 12px;
        color: var(--ink);
    }

    .site-header .right-actions .action-item {
        width: 100%;
    }

    .site-header .right-actions .icon-btn,
    .site-header .right-actions .toggle-btn {
        width: 100%;
        height: auto;
        padding: 12px 16px;
        justify-content: flex-start;
        gap: 12px;
        display: inline-flex;
    }

    .site-header .right-actions .icon-btn svg {
        width: 24px;
        height: 24px;
    }

    .site-header .right-actions .toggle-btn .label-light,
    .site-header .right-actions .toggle-btn .label-dark {
        font-size: 1.2rem;
    }

    .site-header .right-actions .nav {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-header .right-actions .nav-item {
        width: 100%;
    }

    .site-header .right-actions .nav-link {
        width: 100%;
        justify-content: space-between;
    }

    .site-header .right-actions .nav-link.text-link {
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 12px 16px;
    }

    .site-header .right-actions .dropdown {
        position: static;
        inset: auto;
        width: max-content;
        min-width: max-content;
        max-width: 100%;
        align-self: flex-start;
        margin-top: 8px;
        box-shadow: none;
    }

    .site-header .right-actions .dropdown a {
        padding: 10px 12px;
    }

    .site-header .right-actions .profile-menu {
        width: 100%;
    }

    .site-header .right-actions .profile-btn {
        width: 100%;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 16px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: var(--panel);
    }

    .site-header .right-actions .profile-btn img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

    .site-header .right-actions .profile-menu .dropdown {
        position: static;
        margin-top: 8px;
        width: 100%;
    }

    .site-header .right-actions .action-item--search {
        order: 10;
    }

    .site-header .right-actions .action-item--guide {
        order: 20;
    }

    .site-header .right-actions .action-item--settings {
        order: 30;
    }

    .site-header .right-actions .action-item--theme {
        order: 40;
    }

    .site-header .right-actions .action-item--profile {
        order: 50;
    }

    .site-header .right-actions .action-item--contact {
        order: 60;
    }

    .mobile-primary-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 12px;
        padding: 0 22px 12px;
    }

    .mobile-primary-actions .nav-item {
        width: 100%;
    }

    .mobile-primary-actions .nav-link {
        width: 100%;
        justify-content: left;
    }

    .mobile-primary-actions .dropdown {
        position: absolute;
        inset: auto;
        top: calc(100% + 8px);
        left: 0;
        width: max-content;
        max-width: calc(100vw - 44px);
    }

    .mobile-primary-actions .dropdown a,
    .mobile-primary-actions .dropdown button {
        display: flex;
        /* block-level flex so each stays on its own row */
        width: auto;
        /* don't force 100% of the header column */
        align-items: center;
        gap: 10px;
        justify-content: space-between;
        text-align: left;
    }

    .mobile-primary-actions .dropdown .dropdown-item {
        display: flex;
        width: auto;
        /* let dropdown width follow the content width */
        align-items: center;
        gap: 10px;
        justify-content: space-between;
        text-align: left;
    }

    .mobile-primary-actions .dropdown .dropdown-item .item-title {
        flex: 1 1 auto;
        text-align: left;
    }
}

.text-link:hover {
    background: var(--chip-bg);
    color: var(--ink)
}

.profile-btn {
    width: 44px;
    /* a touch larger helps clarity */
    height: 44px;
    padding: 2px;
    /* breathing room so the image never “touches” the edge */
    border-radius: 999px;
    /* perfect circle */
    overflow: hidden;
    /* keep it circular */
    display: grid;
    place-items: center;
}

.profile-btn img {
    width: 100%;
    height: 100%;
    display: block;
    /* removes inline-gap artifacts */
    border-radius: 999px;
    /* keep the image itself circular */
    object-fit: cover;
    /* shows the entire pic—even if not a perfect square */
    background: var(--panel);
    /* fills any letterbox with the panel color */
}

/* ===== Hero ===== */
.hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    padding: 34px 22px 8px;
}

.hero-left h1 {
    font-size: 38px;
    margin: 6px 0 8px
}

.hero-left p {
    color: var(--muted);
    max-width: 60ch
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px
}

.cta {
    background: linear-gradient(135deg, var(--accent), #ff9a6a);
    color: white;
    font-weight: 800;
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
    text-decoration: none;
}

.cta.small {
    padding: 10px 14px
}

.ghost {
    background: transparent;
    border: 2px solid var(--ghost-border);
    border-color: rgba(255, 255, 255, 0.24) !important;
    color: #ffb28f !important;
    font-weight: 800;
    border-radius: 14px;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
}

/* Accessible, theme-aware focus ring for all main buttons */
.ghost:focus-visible,
.cta:focus-visible,
.toggle-btn:focus-visible,
.icon-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.hero-right {
    position: relative;
    height: 220px;

    display: flex;
    /* center the image inside this box */
    align-items: center;
    /* vertical center inside the 220px box */
    justify-content: flex-end;
    /* keep it right-justified */

    align-self: center;
    /* <-- THIS centers the 220px box within the grid row */
}

.mascot {
    position: relative;
    bottom: 0;
    right: 0;
    height: 200px;
    filter: drop-shadow(0 18px 24px rgba(20, 24, 32, .15));
    border-radius: 5px
}

.mascot.secondary {
    right: 140px;
    bottom: 0;
    height: 150px;
    opacity: .9
}

/* ===== Grid & Cards ===== */
.page-shell {
    max-width: 1100px;
    margin: 16px auto 48px;
    padding: 0 18px;
    display: grid;
    gap: 18px;
}

.page-intro h1 {
    margin: 0 0 8px;
}

.page-intro p {
    margin: 0;
    color: var(--muted);
}

.grid {
    padding: 8px 22px 28px;
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(12, 1fr);
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    grid-column: span 6;
}

.card.wide {
    grid-column: span 12;
}

.status-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.status-list__item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
}

.status-list__icon {
    font-size: 20px;
    line-height: 1.2;
}

.card-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), rgba(0, 0, 0, 0.02))
}

body.theme-dark .card-head {
    background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.02));
}

.card-head h2 {
    margin: 0;
    font-size: 18px
}

.card-head--with-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-head__home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: inherit;
    text-decoration: none;
}

.card-head__home-link:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.card-head--with-actions h2 {
    flex: 1;
}

.card-head__actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.report-problem-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 10px;
    cursor: pointer;
    color: inherit;
    transition: background 0.2s ease, transform 0.2s ease;
}

.report-problem-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.report-problem-btn:active {
    transform: translateY(1px);
}

.report-problem-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.report-problem-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

body.theme-dark .report-problem-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.card-body {
    padding: 18px
}

/* Review forecast */
.forecast {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.bar {
    display: flex;
    align-items: center;
    gap: 14px
}

.bar span {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: var(--forecast);
    width: 40%
}

.bar em {
    font-style: normal;
    color: var(--muted);
    font-weight: 600
}

/* Mistakes */
.mistakes {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.mistakes .jp {
    font-weight: 800;
    font-size: 18px;
    margin-right: 6px
}

/* Progress */
.progress-grid {
    display: grid;
    gap: 12px
}

.progress-row {
    display: grid;
    grid-template-columns: 40px 1fr 48px;
    gap: 12px;
    align-items: center
}

.progress-row .label {
    font-weight: 800;
    color: var(--teal)
}

.track {
    height: 10px;
    background: var(--track-bg);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border)
}

.track span {
    display: block;
    height: 100%;
    background: var(--progress)
}

.value {
    font-weight: 800
}

/* Calculator */
.calc {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end
}

.calc label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 700;
    color: var(--muted)
}

.calc input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    width: 140px;
    background: var(--panel);
    color: var(--ink)
}

.calc-output {
    margin-top: 10px
}

/* Professor callout */
.card.professor .professor-inner {
    display: flex;
    align-items: center;
    gap: 16px
}

.card.professor img {
    width: 84px;
    height: 84px;
    object-fit: cover
}

/* Footer */
.site-footer {
    padding: 20px 22px;
    color: var(--muted);
    text-align: center;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), transparent);
}

/* Responsive */
@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero-right {
        order: -1;
        height: 170px
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .card,
    .card.wide {
        grid-column: 1 / -1;
    }
}


/* ==== KANJI LESSONS PAGE (scoped) ==== */
.lesson-wrap {
    padding: 18px 22px 28px;
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 22px;
}

@media (max-width: 640px) {
    .lesson-wrap {
        padding: 0 0 22px;
        grid-template-columns: 1fr;
        gap: 0;
    }

    .lesson-wrap>.card {
        border-radius: 0;
    }
}

.lesson-main .lesson-body {
    display: grid;
    gap: 16px;
}

.kanji-big {
    font-size: clamp(100px, 12vw, 140px);
    line-height: 1;
    text-align: center;
    font-weight: 800;
    letter-spacing: .02em;
    padding-top: 69px;
    padding-bottom: 69px;
    min-height: calc(clamp(100px, 12vw, 140px) + 138px);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), rgba(0, 0, 0, 0.02));
    box-shadow: var(--shadow);
}

.attempt-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.attempt-input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: var(--panel);
    color: var(--ink);
}

.lesson-controls {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.left-controls,
.right-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.lesson-controls--review.lesson-controls--syllabary {
    align-items: stretch;
}

.lesson-controls--review.lesson-controls--syllabary .right-controls {
    flex: 1 1 0%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lesson-controls--review.lesson-controls--syllabary .right-controls>button {
    flex: 1 1 160px;
    min-width: min(160px, 100%);
}

.lesson-controls--kanji {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 12px;
    width: 100%;
}

.lesson-controls--kanji>button {
    width: 100%;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.lesson-controls__label--desktop {
    display: inline;
}

.lesson-controls__label--mobile {
    display: none;
}

/* Keep Kanji lesson desktop labels on a single line */
.lesson-controls--kanji .lesson-controls__label--desktop {
    white-space: nowrap !important;
}


@media (max-width: 640px) {

    .lesson-controls--kanji {
        gap: 2px;
    }

    .lesson-controls--kanji>button {
        font-size: 1rem;
        padding: 12px;
    }
}

.danger {
    background: transparent;
    border: 2px solid var(--mm-toolbar-border);
    border-color: var(--mm-toolbar-border) !important;
    color: #a53a30;
    font-weight: 800;
    border-radius: 14px;
    padding: 10px 16px;
    cursor: pointer;
}

:root[data-theme="dark"] .danger,
html[data-theme="dark"] .danger,
body[data-theme="dark"] .danger,
html.theme-dark .danger,
body.theme-dark .danger {
    border-color: rgba(255, 255, 255, 0.24) !important;
}

/* Side panel blocks */
.lesson-side .side-body {
    display: grid;
    gap: 16px;
}

.block {
    display: grid;
    gap: 8px;
}

.block-title {
    font-weight: 800;
    color: var(--teal);
}

.radical-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    font-weight: 700;
}

.chip--removable {
    padding-left: 6px;
    padding-right: 10px;
}

.chip-label {
    display: inline-block;
}

.chip-remove {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.chip-remove:hover,
.chip-remove:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.chip-remove:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.chip-jp {
    font-size: 18px;
    padding: 6px 12px;
}

.mnemonic {
    margin: 0;
    color: var(--ink);
}

.readings summary.block-title {
    cursor: pointer;
}

.readings .readings-body {
    padding-top: 6px;
    display: grid;
    gap: 6px;
}

/* Modal (custom meanings) */
.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 100;
    transition: .2s ease opacity, .2s ease visibility;
    opacity: 1;
    visibility: visible;
}

.modal[aria-hidden="true"] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .25);
}

.modal__card {
    position: relative;
    width: min(560px, 92vw);
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal__head,
.modal__foot {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), rgba(0, 0, 0, .02));
}

.modal__foot {
    border-bottom: 0;
    border-top: 1px solid var(--border);
}

.modal__body {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.add-meaning {
    display: grid;
    gap: 6px;
}

.add-meaning input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    background: var(--panel);
    color: var(--ink);
}

/* Dark theme niceties for modal */
body.theme-dark .modal__head,
body.theme-dark .modal__foot {
    background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, .02));
}



/* ==== VOCAB LESSONS PAGE (scoped) ==== */
.vocab-wrap {
    padding: 18px 22px 28px;
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 22px;
}

.vocab-main .vocab-body {
    display: grid;
    gap: 16px;
}

.vocab-big {
    font-size: clamp(100px, 12vw, 140px);
    line-height: 1;
    text-align: center;
    font-weight: 800;
    letter-spacing: .02em;
    padding-top: 69px;
    padding-bottom: 69px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), rgba(0, 0, 0, 0.02));
    box-shadow: var(--shadow);
}

.vocab-big.kana-shrink {
    font-size: clamp(50px, 6vw, 70px);
    padding-top: 90px;
    padding-bottom: 90px;
}

.inp-label {
    font-weight: 800;
    color: var(--teal);
    margin-top: 4px;
}

.attempt-col {
    display: grid;
    gap: 10px;
}

.attempt-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.attempt-input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: var(--panel);
    color: var(--ink);
}

/* Side panel */
.vocab-side .side-body {
    display: grid;
    gap: 16px;
}

.kanjis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kanji-chip {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
}

.kanji-char {
    font-size: 20px;
    font-weight: 800;
}

.kanji-meaning {
    color: var(--muted);
    font-weight: 700;
}

/* Readings + parts of speech */
.reading {
    font-weight: 800;
    font-size: 1.1rem;
}

.pos-list .chip {
    font-weight: 800;
}

/* Responsive */
@media (max-width: 980px) {
    .vocab-wrap {
        grid-template-columns: 1fr;
    }
}




/* ==== VOCAB — Example Sentences ==== */
.sentences-card {
    margin: 0 22px 28px;
}

.sentences-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sentences-tools .small {
    padding: 8px 10px;
    font-weight: 800;
    border-radius: 12px
}

.sentences-body {
    display: grid;
    gap: 12px;
}

.sentence-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    column-gap: 12px;
    row-gap: 0;
}


@media (max-width: 640px) {
    body.lesson-kana #kanaSentencesList {
        padding: 0;
        gap: 5px;
    }

    body.lesson-kana #kanaSentencesList .sentence-row {
        border-radius: 12px;
    }
}

.jp-sentence {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.9;
    letter-spacing: .01em;
}

/* Furigana control — render ABOVE the base text properly */
#sentencesSection .jp-sentence ruby {
    ruby-position: over;
    /* put <rt> above */
    ruby-align: center;
    /* center-align the annotation */
}

#sentencesSection ruby rt {
    display: none;
    /* hidden by default */
}

#sentencesSection.show-furi ruby rt {
    display: ruby-text;
    /* correct display for annotations */
    font-size: .7em;
    line-height: 1;
    color: var(--muted);
}

/* Actions */
.sentence-actions {
    display: flex;
    gap: 8px;
}

.ghost.small {
    padding: 6px 10px;
    border-radius: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
}

/* Dark theme polish */
body.theme-dark #sentencesSection .sentence-row {
    background: var(--panel);
    border-color: var(--border);
}

/* Furigana ALWAYS on inside the help modal title */
#sentenceHelpModal ruby {
    ruby-position: over;
    ruby-align: center;
}

#sentenceHelpModal ruby rt {
    display: ruby-text;
    /* always show in the modal */
    font-size: .7em;
    line-height: 1;
    color: var(--muted);
}


body.show-furi-modal #sentenceHelpModal ruby rt {
    display: ruby-text;
    font-size: .7em;
    line-height: 1;
    color: var(--muted);
}

/* Tools (play + close) inside modal header */
.modal-head-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 980px) {
    .details-wrap {
        grid-template-columns: 1fr;
    }
}

/* Ensure anything with the HTML 'hidden' attribute is actually hidden */
[hidden] {
    display: none !important;
}

/* ==== SHARED TOAST (Undo bubble) ==== */
.toast {
    position: absolute;
    /* coordinates set by JS */
    z-index: 9999;
    min-width: 120px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow);

    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;

    transform: translateY(8px);
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    user-select: none;
}

.toast--show {
    opacity: 1;
    transform: translateY(0);
}

.toast__undo {
    margin-left: 6px;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
    /* use accent color subtly, matches your palette */
    color: var(--accent);
}

/* Add spacing between synonym chips */
.meaning-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    /* adjust as needed */
}

.meaning-list .chip {
    margin: 0;
    /* ensure no conflicting margin */
}

/* Make bold inside mnemonics stronger and match ink color */
.mnemonic strong,
.mnemonic b {
    font-weight: 800;
    /* heavier than normal text */
    color: var(--ink);
    /* use main text color, not muted */
}

/* Make lesson control buttons 50% bigger (kanji + vocab) */
.lesson-controls button,
.vocab-main .lesson-controls button {
    font-size: 1.2rem;
    /* bigger text */
    padding: 16px 24px;
    /* bigger click area */
    border-radius: 18px;
    /* scale up radius so it still looks balanced */
}

@media (max-width: 640px) {

    .lesson-controls button,
    .vocab-main .lesson-controls button {
        border-radius: 10px;
    }
}


/* ==== Bigger Details Sections ==== */

/* Kanji lesson side details */
.lesson-side {
    font-size: 1.5rem;
    /* scale up base text */
}

.lesson-side .block-title {
    font-size: 1.6rem;
    /* bigger headers */
}

.lesson-side .meaning-list,
.lesson-side .chip,
.lesson-side .radical-row,
.lesson-side .mnemonic {
    font-size: 1.3rem;
    /* subcontent bigger */
}

.lesson-side .meaning-list {
    font-size: 1.3rem;
    /* match explanation font size for meaning text */
}

@media (max-width: 640px) {
    .vocab-show .lesson-side {
        font-size: 1.35rem;
        /* 10% smaller than desktop */
    }

    .vocab-show .lesson-side .chip,
    .vocab-show .lesson-side .radical-row,
    .vocab-show .lesson-side .mnemonic {
        font-size: 1.17rem;
        /* match 10% reduction for subcontent */
    }
}

/* Vocab lesson side details */
.vocab-side {
    font-size: 1.5rem;
}

.vocab-side .block-title {
    font-size: 1.6rem;
}

.vocab-side .kanji-chip,
.vocab-side .kanji-char,
.vocab-side .kanji-meaning {
    font-size: 1.3rem;
}

/* Example sentences */
.sentences-card {
    font-size: 1.5rem;
}

.sentences-card .sentences-head h3,
.sentences-card .block-title {
    font-size: 1.6rem;
}

.sentences-card .jp-sentence {
    font-size: 1.55rem;
    /* was ~1.05rem */
    line-height: 2.2;
    /* keep readability */
}

/* ==== Bigger Kanji & Vocab Details ==== */

/* Double size for card headers (Kanji Details, Details, Example Sentences) */
.lesson-side .card-head h2,
.vocab-side .card-head h2,
.sentences-card .card-head h2 {
    font-size: 2rem;
    /* was ~1rem, doubled */
}

/* Double size for radicals inside Kanji Details */
.lesson-side .radical-row .chip {
    font-size: 1.6rem;
    /* double from ~0.8rem */
    padding: 10px 14px;
    /* scale padding to match */
}

/* Double size for vocab readings (content under Reading header) */
.vocab-side .reading {
    font-size: 2.2rem;
    /* was ~1.1rem */
    font-weight: 800;
}

/* Double size for vocab component Kanji */
.vocab-side .kanji-char {
    font-size: 40px;
    /* was ~20px */
    font-weight: 800;
}

.vocab-side .kanji-meaning {
    font-size: 1.6rem;
    /* was ~0.8rem */
    font-weight: 700;
}

#vocabReading {
    margin-bottom: 0px;
    margin-top: 0px;
}

#kanaDetailsReading {
    margin: 0;
    font-size: 1.5rem;
}

/* Double size for top lesson headers */
.lesson-main .card-head h2,
.vocab-main .card-head h2 {
    font-size: 1.5rem;
    /* doubled */
}

/* Example sentences controls/buttons 50% bigger */
.sentences-tools .small,
.sentences-tools .icon-btn,
.sentences-tools .ghost.small {
    font-size: 1.2rem;
    padding: 12px 14px;
    /* was ~8–10px */
    height: 48px;
    /* was ~40px */
}

/* Sentence Help modal content 50% bigger */
#sentenceHelpModal {
    font-size: 1.5rem;
    /* bump all text */
}

#sentenceHelpModal .jp-sentence {
    font-size: 1.6rem;
    line-height: 2.2;
}

#sentenceHelpModal .block-title {
    font-size: 1.7rem;
}

#sentenceHelpModal .modal__head,
#sentenceHelpModal .modal__foot {
    font-size: 1.4rem;
}

#sentenceHelpModal .icon-btn,
#sentenceHelpModal .ghost.small {
    font-size: 1.2rem;
    padding: 12px 14px;
    height: 48px;
}

#sentenceHelpModal .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* reset padding so icon stays centered */
    width: 48px;
    /* square button */
    height: 48px;
}

#sentenceHelpModal .modal__card {
    width: min(700px, 92vw);
    /* was 560px → +25% */
    padding: 20px;
    /* more breathing room inside */
}


/* Example sentences toolbar buttons 50% bigger */
.sentences-tools .icon-btn {
    width: 48px;
    /* was 40px */
    height: 48px;
    /* was 40px */
}

.sentences-tools .ghost.small {
    font-size: 1.2rem;
    padding: 10px 14px;
    /* was 6px 10px */
    border-radius: 12px;
}

/* Scale up Help + Audio buttons in Example Sentences */
.biggify {
    transform: scale(1.1);
    transform-origin: center;
    margin-left: 4px;
    margin-right: 4px;
}


/* Enlarge and center the Show Furigana button */
#toggleFuri {
    font-size: 1.5rem;
    /* 50% bigger text */
    padding: 14px 20px;
    /* bigger button area */
    height: auto;
    /* let height adjust naturally */
    width: auto;
    /* override fixed 40px */
    display: inline-flex;
    /* inline so it sizes to content */
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    /* keep proportions nice at bigger size */
    border-width: 2px;
    border-color: var(--border) !important;
    color: #ffb28f;
}

:root[data-theme="dark"] #toggleFuri,
html[data-theme="dark"] #toggleFuri,
html.theme-dark #toggleFuri,
body[data-theme="dark"] #toggleFuri,
body.theme-dark #toggleFuri {
    border-color: rgba(255, 255, 255, 0.24) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), var(--btn-shadow, none);
    outline-color: rgba(255, 255, 255, 0.24) !important;
}

/* ==== VOCAB: component kanji layout & sizing ==== */
/* Lay out chips left-justified, wrapping, with natural width */
.vocab-side .kanjis-grid {
    display: flex;
    /* override the 2-col grid */
    flex-wrap: wrap;
    gap: 12px;
    /* space between chips */
    justify-content: flex-start;
}

/* Make each chip vertical (kanji over name) and only as wide as needed */
.vocab-side .kanji-chip {
    display: flex;
    /* override the grid on the chip */
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: auto;
    /* no stretching */
    min-width: 0;
    /* prevent odd flex stretching */
}

.vocab-side {
    padding: 8px 10px;
    /* keep your existing look, just tidier */
}


/* ~50% bigger kanji glyph (20px → 30px baseline) */
.vocab-side .kanji-char {
    font-size: 100px;
    line-height: 1;
    font-weight: 800;
}

/* Name under the kanji, centered and bumped a bit */
.vocab-side .kanji-meaning {
    font-size: 1.2rem;
    /* ~50% over the small label baseline */
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    /* prevents awkward wraps on short labels */
}

.kanji-chip {
    margin-top: 10px;
    padding-top: 15px;
    padding-bottom: 15px;
}

/* ==== Top site header scale-up (75% bigger) ==== */
.site-header {
    padding: 24px 32px;
    /* was 14px 22px */
    gap: 24px;
    /* a little more breathing room */
}

.brand-mark {
    width: 60px;
    /* was 34px */
    height: 60px;
    font-size: 2.5rem;
    /* bump text inside */
}

.brand-name {
    font-size: 1.6rem;
    /* bigger site name */
}

.nav-link {
    font-size: 1.2rem;
    /* bigger click/tap area */
    border-radius: 16px;
}

.toggle-btn,
.icon-btn {
    width: 56px;
    /* was 40px */
    height: 56px;
    font-size: 1.4rem;
    border-radius: 18px;
}

.toggle-btn {
    padding: 0 18px;
    /* room for 🌙 / 🌞 text */
}

.profile-btn {
    width: 60px;
    /* was 44px */
    height: 60px;
}

.pill {
    font-size: 16px;
    /* was 12px */
    padding: 4px 12px;
    /* match scale */
}


.brand-mark {
    display: grid;
    /* already in your CSS */
    place-items: center;
    /* already in your CSS */
    line-height: 1;
    /* add this */
    text-align: center;
    /* add this (belt & suspenders) */
}

/* Scale and center the theme toggle button */
#themeToggle {
    display: inline-flex;
    /* override grid to be safe */
    align-items: center;
    justify-content: center;
    line-height: 1;
    /* center text vertically */
}

#themeToggle .label-light,
#themeToggle .label-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

#themeToggle .label-dark {
    display: none;
}

html.theme-dark #themeToggle .label-light {
    display: none;
}

html.theme-dark #themeToggle .label-dark {
    display: inline-flex;
}

/* ===== Enlarge specific dashboard header controls ===== */

/* Search + Settings icon buttons */
.site-header .icon-btn {
    width: 60px;
    /* was 40px */
    height: 60px;
    border-radius: 18px;
}

.site-header .icon-btn svg {
    width: 28px;
    /* bump icon size */
    height: 28px;
}

.site-header .icon-btn .emoji-icon {
    display: inline-block;
    font-size: 28px;
    line-height: 1;
}

/* About, Contact, Guide text links */
.site-header .text-link {
    font-size: 1.25rem;
    border-radius: 14px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Shared font picker styles (safe to use across pages) */
.font-picker {
    position: relative;
    margin-right: .5rem;
}

.font-picker #fontPickerBtn {
    min-width: 7.5rem;
}

.font-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 16rem;
    max-height: 18rem;
    overflow: auto;
    background-color: var(--panel);
    color: var(--ink);
    border: 1px solid var(--menu-border);
    border-radius: 12px;
    padding: .25rem;
    box-shadow: var(--menu-shadow);
    z-index: 50;
    color: inherit;
}

.font-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem .75rem;
    border-radius: .5rem;
    cursor: pointer;
}

.font-option:hover {
    background-color: var(--menu-hover);
}

.font-option[aria-selected="true"] {
    background-color: var(--menu-selected);
}

.font-sample {
    opacity: .9;
    margin-left: .75rem;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make sure the menu has its own stacking context and scrolls cleanly */
.font-menu {
    will-change: transform;
}

/* hints to the browser for smoother positioning */

/* Make absolutely sure hidden menus never intercept clicks */
[hidden] {
    display: none !important;
}


/* Make keyboard focus visible when navigating the menu */
.font-option:focus {
    outline: 2px solid var(--menu-focus-ring);
    background: var(--menu-hover);
}

.prompt-frame {
    height: 220px;
    /* pick what fits your UI */
    display: grid;
    place-items: center;
    /* perfect centering */
}

.big-prompt {
    line-height: 1;
}

#customMeaningModal .meaning-list {
    display: grid;
    gap: 8px;
}

#customMeaningModal .chip {
    display: block;
    width: 100%;
    margin: 0;
    text-align: left;
}


/* Kanji glyph in details card: use Yu Mincho */
.kanji-char {
    font-family: "Yu Mincho", "MS Mincho", "Hiragino Mincho ProN", serif;
    font-size: 2.2rem;
    line-height: 1.2;
    font-weight: 400;
}

.nav-link.disabled {
    pointer-events: none;
    color: gray !important;
}

/* Disabled state for the Reviews nav-link */
.nav-link.is-disabled {
    opacity: 0.5;
    pointer-events: none;
    /* unclickable */
    cursor: default;
    filter: grayscale(20%);
}

/* Undo-X for wrong attempts on review-new */
.attempt-row {
    position: relative;
}

.undo-x {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: var(--chip-bg, #31363a);
    color: var(--fg, #e8ecef);
    cursor: pointer;
    display: none;
    /* shown only on mistake */
    line-height: 28px;
    text-align: center;
    font-size: 16px;
}

/* Review inputs: inline undo button */

.attempt-row {
    --undo-btn-width: 69px;
    --undo-btn-gap: 2px;
    display: flex;
    align-items: stretch;
    gap: var(--undo-btn-gap);
    position: relative;
}

/* Let the input take the remaining width */
.attempt-row .attempt-input {
    flex: 1 1 auto;
    min-height: var(--inp-h, 44px);
    /* falls back if your input height changes elsewhere */
}

/* Inline undo as a CTA, hidden by default */
.undo-btn {
    display: none;
    /* shown only when there was a mistake */
    flex: 0 0 var(--undo-btn-width);
    width: var(--undo-btn-width);
    padding: 0;
    /* tap target */
    min-height: var(--inp-h, 44px);
    line-height: 1;
    border-radius: 12px;
    /* match your rounded buttons */
    z-index: 1;
}

/* Show when row has a mistake */
.attempt-row.has-undo .undo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.undo-btn__icon {
    width: 32px;
    height: 32px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
}

/* Nested dropdown container under Lessons > Counters */
#countersMenu,
[data-counters-menu] {
    list-style: none;
    margin: 0;
    padding: 0;
}

#countersMenu>.nav-link,
[data-counters-menu]>.nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--ink);
}

#countersMenu>.nav-link .nav-label,
[data-counters-menu]>.nav-link .nav-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

#countersMenu>.nav-link .chev,
[data-counters-menu]>.nav-link .chev {
    display: block;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: transform 0.2s ease;
}

#countersMenu>.nav-link[aria-expanded="true"],
[data-counters-menu]>.nav-link[aria-expanded="true"] {
    background: var(--chip-bg);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

#countersMenu>.nav-link[aria-expanded="true"] .chev,
[data-counters-menu]>.nav-link[aria-expanded="true"] .chev {
    transform: rotate(0deg);
}

#countersMenu .dropdown.sub,
[data-counters-menu] .dropdown.sub {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 8px 0;
    border-radius: 14px;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 1000;
    overflow: hidden;
}

/* Items */
#countersMenu .dropdown-item,
[data-counters-menu] .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Count pill for unlocked */
#countersMenu .pill,
[data-counters-menu] .pill {
    display: inline-block;
    min-width: 1.75em;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.85em;
    line-height: 1.6;
    text-align: center;
    background: var(--pill-bg, #3b82f6);
    /* Tailor to your theme */
    color: var(--pill-fg, #fff);
}

/* Locked look */
#countersMenu .is-locked,
[data-counters-menu] .is-locked {
    opacity: 0.6;
    cursor: not-allowed;
}

#countersMenu .is-locked .lock,
[data-counters-menu] .is-locked .lock {
    margin-right: 8px;
}

#countersMenu .is-locked .pill,
[data-counters-menu] .is-locked .pill {
    display: none;
}

/* Optional: keyboard focus ring */
#countersMenu .dropdown-item:focus,
[data-counters-menu] .dropdown-item:focus {
    outline: 2px solid var(--focus, #60a5fa);
    outline-offset: -2px;
}

/* Kill stray bullets/separators in nested menus */
#countersMenu,
#countersMenu .dropdown,
#countersMenu .dropdown.sub,
[data-counters-menu],
[data-counters-menu] .dropdown,
[data-counters-menu] .dropdown.sub {
    list-style: none;
}

#countersMenu *::marker,
[data-counters-menu] *::marker {
    content: none;
}

/* If your theme adds dividers via borders, override here */
#countersMenu .dropdown-item,
[data-counters-menu] .dropdown-item {
    border: none;
}

/* Ensure the parent is a positioning context */
#countersMenu,
[data-counters-menu] {
    position: relative;
}

/* Blend submenu with the Counters trigger when open */
#countersMenu>.nav-link[aria-expanded="true"]+.dropdown.sub,
[data-counters-menu]>.nav-link[aria-expanded="true"]+.dropdown.sub {
    border-top: none;
    border-radius: 0 0 14px 14px;
}

/* Normalize button look so it matches links */
#countersMenu .dropdown-item.is-locked,
[data-counters-menu] .dropdown-item.is-locked {
    background: transparent;
    /* kill grey fill */
    color: inherit;
    /* keep the menu’s text color */
    opacity: 0.6;
    /* keep your “greyed out” look */
    cursor: not-allowed;
}

/* Don’t change background on hover/focus for locked items */
#countersMenu .dropdown-item.is-locked:hover,
#countersMenu .dropdown-item.is-locked:focus,
[data-counters-menu] .dropdown-item.is-locked:hover,
[data-counters-menu] .dropdown-item.is-locked:focus {
    background: transparent;
}

/* Remove native button styling that causes grey background */
#countersMenu .dropdown-item.is-locked[disabled],
#countersMenu .dropdown-item.is-locked,
[data-counters-menu] .dropdown-item.is-locked[disabled],
[data-counters-menu] .dropdown-item.is-locked {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    box-shadow: none;
    text-align: left;
    width: 100%;
    padding: 10px 14px;
    /* keep spacing aligned with links */
}

/* Ensure locked item content hugs the left */
#countersMenu .dropdown-item.is-locked,
[data-counters-menu] .dropdown-item.is-locked {
    justify-content: flex-start;
    /* force left alignment */
    text-align: left;
    /* in case of multiline */
    gap: 8px;
    /* keep a small gap between lock icon and text */
}

/* Disabled (all done) — match locked look, but keep the pill visible */
#countersMenu .dropdown-item.is-disabled,
[data-counters-menu] .dropdown-item.is-disabled,
#lessonsMenu .dropdown-item.is-disabled,
[data-lessons-menu] .dropdown-item.is-disabled {
    opacity: 0.6;
    /* same fade as locked */
    cursor: not-allowed;
    background: transparent;
    /* no grey fill */
}

/* Keep hover/focus from changing background */
#countersMenu .dropdown-item.is-disabled:hover,
#countersMenu .dropdown-item.is-disabled:focus,
[data-counters-menu] .dropdown-item.is-disabled:hover,
[data-counters-menu] .dropdown-item.is-disabled:focus,
#lessonsMenu .dropdown-item.is-disabled:hover,
#lessonsMenu .dropdown-item.is-disabled:focus,
[data-lessons-menu] .dropdown-item.is-disabled:hover,
[data-lessons-menu] .dropdown-item.is-disabled:focus {
    background: transparent;
}

/* Grey out the pill too (same color as text) */
#countersMenu .dropdown-item.is-disabled .pill,
[data-counters-menu] .dropdown-item.is-disabled .pill,
#lessonsMenu .dropdown-item.is-disabled .pill,
[data-lessons-menu] .dropdown-item.is-disabled .pill {
    background: transparent;
    /* remove the blue */
    color: inherit;
    /* match faded text color */
    border: 1px solid currentColor;
    /* subtle outline so the 0 is readable */
}

.dropdown a.is-disabled .pill {
    opacity: 0.5;
}

/* Dashboard only */
#vocabLink,
[data-vocab-link] {
    display: flex;
    align-items: center;
}

#vocabCount,
[data-vocab-count] {
    margin-left: auto;
}

/* Lessons > Vocab pill — match Counters styling exactly */
#countersMenu .pill,
#lessonsMenu #vocabLink .pill,
[data-counters-menu] .pill,
[data-lessons-menu] [data-vocab-link] .pill {
    display: inline-block;
    min-width: 1.75em;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.85em;
    line-height: 1.6;
    text-align: center;
    background: var(--pill-bg, #3b82f6);
    color: var(--pill-fg, #fff);
}

/* Disabled look (same as Counters “all done”) */
#countersMenu .dropdown-item.is-disabled .pill,
#lessonsMenu #vocabLink.is-disabled .pill,
[data-counters-menu] .dropdown-item.is-disabled .pill,
[data-lessons-menu] [data-vocab-link].is-disabled .pill {
    background: transparent;
    color: inherit;
    border: 1px solid currentColor;
}

/* ==== Kanji lesson radical cards refined ==== */

.lesson-side .radical-row {
    --rad-card-scale: 1;
    display: flex;
    flex-wrap: wrap;
    gap: calc(12px * var(--rad-card-scale, 1));
    align-items: flex-start;
}

.rad-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: calc(14px * var(--rad-card-scale, 1)) calc(12px * var(--rad-card-scale, 1));
    border-radius: calc(12px * var(--rad-card-scale, 1));
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #141e26;
    /* updated background */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);

    flex: 0 0 auto;
    min-width: calc(90px * var(--rad-card-scale, 1));
    min-height: calc(110px * var(--rad-card-scale, 1));
}

/* Radical glyph: 50% bigger than your last version */
.rad-char {
    font-size: calc(5.4rem * var(--rad-card-scale, 1));
    /* was 3.6rem → now 1.5× */
    line-height: 1;
    margin-bottom: calc(6px * var(--rad-card-scale, 1));
    font-family: "Yu Mincho", serif;
    /* requested font */
}

/* Radical name label */
.rad-name {
    font-size: calc(0.95rem * var(--rad-card-scale, 1));
    line-height: 1.1;
    text-align: center;
    color: #9ab0c0;
    /* requested color */
    opacity: 1;
}


/* Yu Mincho default for all big kanji displays */
.kanji-big,
.vocab-big {
    font-family: "Yu Mincho", serif;
}

.profile-menu {
    position: relative;
}

.profile-menu .dropdown {
    position: absolute;
    right: 0;
    left: auto;
    top: calc(100% + 8px);
    min-width: 0;
    width: -moz-fit-content;
    width: fit-content;
    max-width: calc(100vw - 32px);
    z-index: 1000;
}

.profile-menu .dropdown .dropdown-item,
.profile-menu .dropdown .dropdown-identity {
    display: block;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

.profile-menu .dropdown .dropdown-identity {
    cursor: default;
    opacity: .9;
    padding: 10px 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-menu .dropdown .dropdown-identity span {
    display: block;
    width: 100%;
}

/* Profile dropdown positioning */
.profile-menu {
    position: relative;
}

.profile-menu .dropdown {
    position: absolute;
    right: 0;
    left: auto;
    top: calc(100% + 8px);
    min-width: 0;
    width: -moz-fit-content;
    width: fit-content;
    max-width: calc(100vw - 32px);
    z-index: 1000;
    /* let JS control visibility with display */
    display: none;
}

.profile-menu .dropdown .dropdown-item,
.profile-menu .dropdown .dropdown-identity {
    display: block;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

.profile-menu .dropdown .dropdown-identity {
    cursor: default;
    opacity: .9;
    padding: 10px 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-menu .dropdown .dropdown-identity span {
    display: block;
    width: 100%;
}

.rad-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: calc(14px * var(--rad-card-scale, 1)) calc(12px * var(--rad-card-scale, 1));
    border-radius: calc(12px * var(--rad-card-scale, 1));
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: var(--rad-card-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);

    flex: 0 0 auto;
    min-width: calc(90px * var(--rad-card-scale, 1));
    min-height: calc(110px * var(--rad-card-scale, 1));
}

/* Theme variables */
:root {
    --rad-card-bg: #f6f3ee;
    /* light mode */
}

:root[data-theme="dark"],
body.theme-dark {
    --rad-card-bg: #141e26;
    /* dark mode */
}

.reading {
    font-weight: normal !important;
}

#submitMnemonicBtn {
    font-size: inherit;
    display: inline-block;
}

/* Scope everything to the submit-mnemonic modal */
#submitMnemonicModal .modal__card {
    width: min(800px, 92vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Make body grow so the textarea can fill */
#submitMnemonicModal .modal__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    /* contain editor; footer won’t be pushed */
}

/* WYSIWYG editor fills remaining space and scrolls instead of pushing the footer */
.mm-editor {
    flex: 1 1 auto;
    min-height: 12rem;
    overflow: auto;
    overflow-y: auto;
    max-height: 45vh;
    /* scroll when content exceeds available space */
}

/* Label wrapper should stretch */
#submitMnemonicModal .add-meaning {
    flex: 1;
    display: flex;
    /* <-- needs to be flex, not block */
    flex-direction: column;
    margin: 0;
    min-height: 0;
    /* allow child growth */
}

/* Editor typography: restore normal size */
#submitMnemonicModal .mm-editor {
    font-size: 1rem;
    /* inherit/normal */
    line-height: 1.4;
}

/* Make “Subject” and “Mnemonic for …” 2× bigger */
#submitMnemonicModal .block-title,
#submitMnemonicModal .subject-extra {
    font-size: 200%;
    line-height: 1.2;
}

#submitMnemonicModal .block-title {
    color: var(--ink);
}

/* Counter: right-aligned, subtle */
.mm-counter {
    margin-left: auto;
    /* push to the right within the toolbar row */
    font-size: 0.9rem;
    opacity: 0.75;
    text-align: right;
}

#submitMnemonicModal .editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

#submitMnemonicModal .editor-toolbar .ghost,
#submitMnemonicModal .modal__foot .ghost {
    border-color: var(--mm-toolbar-border) !important;
}

styles #submitMnemonicModal .modal__foot .ghost,
#submitMnemonicModal .modal__foot .cta {
    font-size: 100%;
    padding: 12px 16px;
    border-radius: 14px;
}

#submitMnemonicModal .block .block-title {
    display: inline-block;
    /* was block → forces a line break */
    margin-right: 0.5em;
    /* spacing before the italic bit */
    font-size: 200%;
    /* keep your 2× size */
    line-height: 1.2;
}

#submitMnemonicModal .block .subject-extra {
    display: inline;
    /* ensure it sits on the same line */
    font-style: italic;
    color: inherit;
    /* stays in the normal card text color (e.g., white) */
    font-size: 200%;
    /* 2× size to match Subject: */
    line-height: 1.2;
}

/* Only the first block in the submit-mnemonic modal = the subject line */
#submitMnemonicModal .modal__body>.block:first-child {
    display: flex;
    /* override site-wide .block { display: grid } */
    align-items: baseline;
    gap: 0.5em;
}

/* Keep your 2× sizes and colors per earlier rules */
#submitMnemonicModal .block:first-child .block-title {
    font-size: 200%;
    line-height: 1.2;
    margin: 0;
}

#submitMnemonicModal .block:first-child .subject-extra {
    font-size: 200%;
    line-height: 1.2;
    font-style: italic;
    color: inherit;
    /* normal card text color */
}


#mnemonicBodyInput {
    padding: 8px;
}

.jp-sentence {
    margin: 0;
}

.en-sentence {
    margin: 0;
}

.sentence-actions {
    margin: 0;
}

#sentencesList.show-furi rt {
    display: ruby-text;
}

/* Make meaning/pos lists render inline text, not pills */
.meaning-list,
.pos-list {
    display: block;
}

.meaning-list .chip,
.pos-list .chip {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Shared vocab audio play buttons */
#playVocabAudioBtns {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

#playVocabFemaleBtn[disabled],
#playVocabMaleBtn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Container: keep both buttons side-by-side */
#playVocabAudioBtns {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

/* Make these look like your primary buttons */
.audio-btn {
    /* reuse your primary button look:
     - If your primary uses .cta, we keep .cta on the element (already added above)
     - These adjustments just ensure icon/text layout behaves nicely */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    line-height: 1;
    text-align: center;
}

/* Tidy vertical alignment so nothing stacks */
.audio-btn .audio-sex,
.audio-btn .audio-icon {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* Optional: tiny nudge so the emoji baseline feels centered */
.audio-btn .audio-icon {
    transform: translateY(0.5px);
}

/* Disabled state parity */
#playVocabFemaleBtn[disabled],
#playVocabMaleBtn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Audio buttons styled like ghost buttons, but taller */
.audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    font-weight: 800;
    box-sizing: border-box;
}

.audio-btn .audio-sex,
.audio-btn .audio-icon {
    line-height: 1;
    vertical-align: middle;
}

#playVocabFemaleBtn[disabled],
#playVocabMaleBtn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Keep each audio button consistent with other controls in the row */
.audio-btn-wrap {
    display: inline-block;
    margin-right: .5rem;
    /* same spacing convention as .font-picker */
}

/* Inline layout only; do NOT set padding/height here so the global
   .lesson-controls button sizing applies uniformly */
.audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}

.audio-btn .audio-sex,
.audio-btn .audio-icon {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

.audio-btn .audio-icon {
    transform: translateY(0.5px);
    /* tiny optical tweak */
}

/* Disabled parity */
#playVocabFemaleBtn[disabled],
#playVocabMaleBtn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Align dropdown trigger with neighboring nav links */
.nav>.nav-item {
    display: flex;
    align-items: center;
}

/* Align the Guide dropdown trigger perfectly with About and Contact */
.site-header .right .nav #guideMenu>.nav-link {
    padding-top: 14px;
    padding-bottom: 14px;
    display: flex;
    align-items: center;
}

#nextReviewRow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* space between label and value */
    margin-top: 4px;
    /* optional, for spacing below % bar */
}

#nextReviewRow .label {
    white-space: nowrap;
    /* keep “Next review time:” on one line */
    flex-shrink: 0;
}

#nextReviewValue {
    white-space: nowrap;
    /* prevents long date wrapping */
    font-weight: 500;
    /* optional styling */
}

#srsLevelRow,
#nextReviewRow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 4px;
}

#srsLevelRow .label,
#nextReviewRow .label {
    white-space: nowrap;
    flex-shrink: 0;
}

#srsLevelValue,
#nextReviewValue {
    white-space: nowrap;
    font-weight: 500;
}

#pctRow {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin-top: 6px;
}

#pctRow .label {
    white-space: nowrap;
    font-weight: 500;
}

#pctRow .track-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
}

#pctRow .track {
    flex: 1;
    height: 8px;
    background-color: var(--track-bg, #ddd);
    border-radius: 4px;
    overflow: hidden;
}

#pctRow .track span {
    display: block;
    height: 100%;
    background-color: var(--accent-color, #4caf50);
    transition: width 0.3s ease;
}

#pctRow .value {
    white-space: nowrap;
    font-weight: 500;
}

/* Center audio button between JP+EN lines */
.sentence-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.sentence-texts {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* centers the pair vertically */
}

.sentence-actions {
    display: flex;
    align-items: center;
}

.biggify {
    transform: scale(1.4);
    margin-right: 14px;
}




/* Scope to this page so other pages are unaffected */
#sentencesSection .sentence-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* centers the button */
    gap: 0.75rem;
}

#sentencesSection .sentence-texts {
    display: flex;
    flex-direction: column;
    /* JP above EN */
    justify-content: center;
    /* centers the pair vs. the button */
}

#sentencesSection .sentence-actions {
    display: flex;
    align-items: center;
}

.site-search {
    display: flex;
    gap: .5rem;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    background: #fff;
}

.site-search input {
    flex: 1;
    font-size: 1rem;
    padding: .6rem .75rem;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: .5rem;
    background: #fff;
    color: #111;
    outline: none;
}

.site-search input:focus {
    box-shadow: 0 0 0 3px rgba(0, 120, 255, .2);
    border-color: rgba(0, 120, 255, .5);
}

.search-btn {
    position: relative;
    padding: .65rem .9rem;
    border-radius: .6rem;
    border: 1px solid rgba(0, 0, 0, .2);
    background: #f6f7f8;
    cursor: pointer;
    font-weight: 600;
    transition: transform .06s ease, filter .2s ease;
}

.search-btn:active {
    transform: scale(.98);
}

.search-btn.is-burst {
    filter: brightness(1.08);
}

.search-btn .pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: .7rem;
    border: 0 solid rgba(0, 120, 255, .25);
    pointer-events: none;
}

.search-btn.is-burst .pulse-ring {
    animation: pulse-ring .45s ease-out;
}

@keyframes pulse-ring {
    0% {
        border-width: 0;
        opacity: .9;
    }

    100% {
        border-width: 6px;
        opacity: 0;
    }
}

/* Dark theme alignment */
html.theme-dark .site-search {
    background: #0f1113 !important;
    border-bottom-color: rgba(255, 255, 255, .08);
}

html.theme-dark .site-search input {
    background: #15181a !important;
    color: #e8ecef !important;
    border-color: rgba(255, 255, 255, .12) !important;
}

html.theme-dark .search-btn {
    background: #1b1f22 !important;
    color: #e8ecef !important;
    border-color: rgba(255, 255, 255, .12) !important;
}

/* a11y helper */
.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
    clip-path: inset(50%);
}

/* Match border color to the review forecast bar */
.site-search {
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
    background-origin: border-box;
    position: relative;
    margin-top: 10px;
    border: 2px solid transparent;
    border-radius: 8px;
    background-clip: padding-box;
}

.site-search::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    padding: 2px;
    background: var(--search-border-bg, #7b61ff);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Disabled state for both sides of the controls row */
.lesson-main .left-controls button:disabled,
.lesson-main .right-controls button:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Prevent ghost hover/focus chrome from fighting disabled visuals */
.lesson-main .left-controls button:disabled.ghost,
.lesson-main .right-controls button:disabled.ghost {
    box-shadow: none;
}

/* Subtle border in dark mode when disabled (optional but clearer) */
html.theme-dark .lesson-main .left-controls button:disabled.ghost,
html.theme-dark .lesson-main .right-controls button:disabled.ghost {
    border-color: rgba(255, 255, 255, 0.18) !important;
}

/* Allow tooltip on disabled Learn/Reset without re-enabling clicks */
#learnResetBtn:disabled {
    pointer-events: auto;
    /* keep hover so title shows */
    cursor: not-allowed;
    /* still looks disabled */
}

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.banner__content {
    font-weight: 600
}

.banner__actions {
    display: flex;
    gap: 8px;
    align-items: center
}

@media (max-width: 640px) {
    .banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .banner__content {
        width: 100%;
    }

    .banner__actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        row-gap: 8px;
    }
}

@media (max-width: 640px) {
    .banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .banner__content {
        width: 100%;
    }

    .banner__actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        row-gap: 8px;
    }
}

.banner .small {
    font-size: .9rem;
    padding: .35rem .6rem;
    border-radius: 10px
}

#dismissGuestBanner {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

#dismissGuestBanner:hover,
#dismissGuestBanner:focus-visible {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    color: var(--accent-strong);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
}

#dismissGuestBanner:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 24, 40, 0.16);
}

#dismissGuestBanner .icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* === Change Password panel: inputs + spacing + button sizing (scoped) === */
#pwPanel .field:not(:last-child) {
    /* space inputs farther apart */
    margin-bottom: 16px;
}

/* Prettify password inputs to match selects/overall UI */
#pwPanel input[type="password"] {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    line-height: 1.2;
    box-shadow: var(--shadow);
}

#pwPanel input[type="password"]:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Make Save + Email reset link the same visual size (height/width) */
#pwPanel .inline .cta.small,
#pwPanel .inline .ghost.small {
    padding: 10px 14px;
    /* same interior sizing */
    font-weight: 800;
    line-height: 1;
    border-radius: 10px;
    min-width: 220px;
    /* equal visual width */
    text-align: center;
}

/* 2) Add breathing room between each field title and its input */
#pwPanel .field .title {
    margin-bottom: 6px;
    display: block;
}

/* Reset modal: prettify the YES input to match #pwPanel inputs */
#modalReset #resetConfirmText {
    display: block;
    width: 100%;
    max-width: 420px;
    /* same cap as password inputs */
    padding: 10px 12px;
    /* same padding */
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    line-height: 1.2;
    box-shadow: var(--shadow);
}

#modalReset #resetConfirmText:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Reset modal input styling */
#modalReset #resetConfirmText {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    line-height: 1.2;
    box-shadow: var(--shadow);
}

#modalReset #resetConfirmText:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Delete modal input styling */
#modalDelete #deleteConfirmText {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    line-height: 1.2;
    box-shadow: var(--shadow);
}

#modalDelete #deleteConfirmText:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Danger variant for the primary action if you want it red */
.cta.danger {
    background: var(--danger);
    border-color: var(--danger);
}

/* Delete modal: keep helper sentence on a single line */
#modalDelete .one-line {
    white-space: nowrap;
}

/* Play buttons should *look* disabled */
.audio-btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Review Mistakes button: force the same orange CTA in dark mode */
html[data-theme="dark"] #reviewMistakesBtn.cta,
:root[data-theme="dark"] #reviewMistakesBtn.cta,
body.theme-dark #reviewMistakesBtn.cta,
html.theme-dark #reviewMistakesBtn.cta {
    background: linear-gradient(135deg, var(--accent), #ff9a6a) !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: var(--shadow) !important;
}

/* Visually-disabled state (both themes) */
#reviewMistakesBtn:disabled {
    opacity: .5;
    cursor: not-allowed;
    filter: grayscale(15%);
    /* keep layout identical; just mute it */
}

/* Slightly lower opacity in dark to read better on dark header */
body.theme-dark #reviewMistakesBtn:disabled,
html[data-theme="dark"] #reviewMistakesBtn:disabled {
    opacity: .45;
}

/* Community based mnemonics */
.cmn-item {
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.cmn-item:first-child {
    border-top: 0;
}

.cmn-meta {
    opacity: .7;
    font-size: .9em;
    margin-top: 4px;
}

.cmn-footer {
    margin-top: 10px;
}

.cmn-empty {
    opacity: .85;
    padding: 4px 0;
}

/* CM actions */
#communityMnemonicsCard .cmn-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

#communityMnemonicsCard .cmn-actions .cmn-flex-spacer {
    flex: 1
}

#communityMnemonicsCard .cmn-btn {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--ink);
    border-radius: 10px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    cursor: pointer;
}

#communityMnemonicsCard .cmn-btn.is-solid {
    /* visual “filled” state */
    background: linear-gradient(135deg, var(--accent), #ff9a6a);
    color: #fff;
    border-color: transparent;
}

#communityMnemonicsCard .cmn-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    filter: grayscale(.2);
}

#communityMnemonicsCard .cmn-score {
    min-width: 2ch;
    text-align: center;
    font-weight: 800;
}

/* Lightweight report dialog */
.cmn-report-pop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
}

.cmn-report-card {
    width: min(520px, 92vw);
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.cmn-report-title {
    font-weight: 800;
    margin-bottom: 8px;
}

.cmn-report-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    margin: 8px 0;
    border: 0;
    padding: 0;
}

.cmn-report-note {
    width: 100%;
    min-height: 72px;
    max-height: 160px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: var(--panel);
    color: var(--ink);
}

.cmn-report-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.cmn-report-actions {
    display: flex;
    gap: 8px;
}

/* Community Mnemonics header button: proper disabled look + keep tooltip */
#cmnHeaderAddBtn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    filter: grayscale(15%);
    pointer-events: auto;
    /* keep title tooltip working while disabled */
}

.mm-editor {
    min-height: 8rem;
    line-height: 1.4;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
}

.mm-editor:empty:before {
    content: attr(data-placeholder);
    opacity: .5;
}

/* --- Community Mnemonics card tweaks --- */
#communityMnemonicsCard .card-head .block-title {
    font-size: 1.35em;
    line-height: 1.2;
}

#communityMnemonicsCard #cmnHeaderAddBtn,
#communityMnemonicsCard #cmnHeaderToggleBtn {
    font-size: 1.135em;
    /* ~35% area increase with padding tweak below */
    padding: 0.55rem 0.9rem;
}

#communityMnemonicsCard #cmnHeaderAddBtn:disabled,
.ghost:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.2);
}

/* List + empty state basics */
#communityMnemonicsCard .cmn-list {
    display: grid;
    gap: 10px;
}

#communityMnemonicsCard .cmn-item {
    display: grid;
    gap: 6px;
}

#communityMnemonicsCard .cmn-body {
    line-height: 1.45;
}

#communityMnemonicsCard .cmn-meta {
    font-size: .9em;
    opacity: .7;
}

#communityMnemonicsCard .cmn-empty {
    opacity: .8;
}

/* Community mnemonics: disabled buttons should look disabled */
.cmn-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Solid state accent (used for liked + reported) */
.cmn-btn.is-solid .ico,
.cmn-btn.is-solid .ico-flag {
    filter: none;
    opacity: 1;
    font-weight: 700;
}

/* Keep icons compact and aligned */
.cmn-actions .cmn-btn .ico,
.cmn-actions .cmn-btn .ico-flag {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* Remove red flag look (we’re using monochrome glyphs ⚐ / ⚑) */
.cmn-btn.cmn-flag {
    color: inherit;
}

/* VOCAB Community Mnemonics sizing */
#communityMnemonicsWrapVocab .card-head .block-title {
    font-size: 1.25em;
    /* +25% */
}

#communityMnemonicsWrapVocab .card-head .ghost.small {
    transform: scale(1.25);
    /* +25% */
    transform-origin: center;
}

/* Empty state in list (the JS renders .cmn-empty) */
#communityMnemonicsCardVocab .cmn-empty {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--card-bg, rgba(255, 255, 255, 0.06));
    color: var(--muted-fg, #bbb);
    font-size: 0.95em;
}

/* Keep title + buttons on one line, buttons at far-right, buttons adjacent */
#communityMnemonicsWrapVocab .card-head {
    display: flex;
    align-items: center;
}

#communityMnemonicsWrapVocab .card-head .spacer {
    flex: 1;
}

#communityMnemonicsWrapVocab .card-head .cmn-head-actions {
    display: inline-flex;
    gap: 8px;
}

/* VOCAB CM: shrink global .sentences-card bump by ~25% and normalize header/buttons */
#communityMnemonicsWrapVocab {
    font-size: 1.125rem;
}

/* 1.5rem × 0.75 */
#communityMnemonicsWrapVocab .card-head .block-title {
    font-size: 1.0em;
}

/* remove extra 1.25× */
#communityMnemonicsWrapVocab .card-head .ghost.small {
    font-size: 1.0rem;
    padding: 0.5rem 0.8rem;
    transform: none;
    /* cancel previous scale */
}

/* Visible disabled look for the Vocab Add button (tooltip still works) */
#cmnVocabAddBtn[disabled] {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(20%);
    pointer-events: auto;
    /* keep title tooltip */
}

/* Empty state look inside the VOCAB list */
#communityMnemonicsCardVocab .cmn-empty {
    opacity: .85;
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(127, 127, 127, .08);
}


.ghost {
    border-color: var(--mm-toolbar-border) !important;
}

.icon-btn {
    border-color: var(--mm-toolbar-border) !important;
}

.report-problem-dialog {
    border: none;
    border-radius: 18px;
    padding: 0;
    max-width: 480px;
    width: min(92vw, 480px);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.report-problem-dialog::backdrop {
    background: rgba(12, 19, 27, 0.55);
    backdrop-filter: blur(1px);
}

.report-problem-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 26px 28px 24px;
}

.report-problem__title {
    margin: 0;
    font-size: 1.2rem;
}

.report-problem__meta,
.report-problem__subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

label.report-problem__subtitle {
    display: block;
    margin-bottom: 5px;
}

.report-problem__fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.report-problem__legend {
    font-weight: 600;
    margin-bottom: 8px;
}

.report-problem__choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-problem__choice {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.report-problem__textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    font: inherit;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 12px;
    background: var(--panel);
    color: inherit;
}

.report-problem__textarea:focus-visible {
    outline: none;
    box-shadow: none;
    border-color: var(--border);
}

body.theme-dark .report-problem__textarea {
    background: rgba(255, 255, 255, 0.04);
}

.report-problem__counter {
    margin: 0;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: right;
}

.report-problem__status {
    min-height: 1.2em;
    font-size: 0.95rem;
    margin: 0;
}

.report-problem__status--error {
    color: #c24040;
}

.report-problem__status--success {
    color: var(--brand);
}

.report-problem__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

.report-problem__optional {
    color: var(--muted);
    font-size: 0.85rem;
}

#reportProblemDetails {
    margin-top: 5px;
}

/* Hide desktop utility row on narrow screens (visual-only; we won't open it on mobile in JS) */
@media (max-width: 1099px) {
    #headerUtilityMenu {
        display: none !important;
    }
}

/* Mobile panel baseline */
.mobile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    padding: 8px 12px;
    background: var(--menu-bg, #fff);
    border-top: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
    z-index: 999;
}

html.theme-dark .mobile-menu {
    --menu-bg: #0b0d0e;
    border-top-color: rgba(255, 255, 255, .08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.mobile-menu[aria-hidden="false"] {
    display: block;
}

.mobile-menu__list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    display: grid;
    grid-auto-rows: minmax(40px, auto);
    gap: 4px;
}

.mm-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid transparent;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.mm-item:hover,
.mm-item:focus-visible {
    background: rgba(0, 0, 0, .04);
    outline: none;
}

html.theme-dark .mm-item:hover,
html.theme-dark .mm-item:focus-visible {
    background: rgba(255, 255, 255, .06);
}

/* Icon-only items (Search, Theme toggle) */
.mm-icon {
    justify-content: center;
}

.mm-icon svg {
    width: 30.8px;
    height: 30.8px;
    stroke: currentColor;
    fill: none;
}

.mm-icon .emoji-icon {
    display: inline-block;
    font-size: 30.8px;
    line-height: 1;
}

#themeToggleMobile .label-light,
#themeToggleMobile .label-dark {
    font-size: 1.4rem;
}

/* Hamburger (3 bars) → X when open */
#headerMenuToggle {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    width: 36px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: none;
}

#headerMenuToggle .menu-toggle__bar {
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}

.site-header[data-mobile-open="true"] #headerMenuToggle .menu-toggle__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.site-header[data-mobile-open="true"] #headerMenuToggle .menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.site-header[data-mobile-open="true"] #headerMenuToggle .menu-toggle__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Only show the mobile panel on narrow screens */
@media (min-width: 1100px) {
    #mobileMenuPanel {
        display: none !important;
    }
}

/* — Hamburger style #4: short center, centered bars — */
#headerMenuToggle .menu-toggle__bar:nth-child(1),
#headerMenuToggle .menu-toggle__bar:nth-child(3) {
    width: 14px;
}

#headerMenuToggle .menu-toggle__bar:nth-child(2) {
    width: 10px;
}

/* keep bars centered inside the button */
#headerMenuToggle {
    align-items: center;
    justify-content: center;
}

/* Replace the block that styles .mobile-menu positioning with this */
.mobile-menu {
    position: absolute;
    top: calc(100% + 12px);
    /* a little gap below header */
    right: 0;
    left: auto;
    /* don't stretch to the left container edge */
    width: min(320px, calc(100vw - 24px));
    /* never overflow viewport */
    display: none;
    padding: 12px;
    /* a bit more interior padding */
    background: var(--menu-bg, #fff);
    /* OPAQUE + full border so it reads as a card */
    border: 1px solid var(--menu-border, var(--border));
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
    z-index: 999;
}

html.theme-dark .mobile-menu {
    --menu-bg: #0b0d0e;
    border-color: rgba(255, 255, 255, .08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

/* Mobile theme toggle should show only the relevant glyph */
#themeToggleMobile .label-dark {
    display: none;
}

html.theme-dark #themeToggleMobile .label-light {
    display: none;
}

html.theme-dark #themeToggleMobile .label-dark {
    display: inline;
}

.mobile-menu {
    background-color: var(--menu-bg, #fff) !important;
}

/* Ensure the hamburger bars are ALWAYS visible in both themes */
#headerMenuToggle {
    color: var(--ink);
}

html.theme-dark #headerMenuToggle {
    color: #e8ecef;
}

/* Bars take the button color (not transparent) */
#headerMenuToggle .menu-toggle__bar {
    background: currentColor !important;
    opacity: 1;
}

/* #4 variant: shorter middle bar */
#headerMenuToggle .menu-toggle__bar:nth-child(1),
#headerMenuToggle .menu-toggle__bar:nth-child(3) {
    width: 14px !important;
}

#headerMenuToggle .menu-toggle__bar:nth-child(2) {
    width: 10px !important;
}

/* Center bars inside the button */
#headerMenuToggle {
    align-items: center;
    justify-content: center;
}

.mobile-menu {
    /* …existing position/top/right/left… */
    width: max-content;
    /* shrink to content */
    max-width: calc(100vw - 24px);
    /* safety cap to avoid overflow */
}

.mm-item {
    white-space: nowrap;
    padding: 8px 10px;
}

/* Center icons and text inside each mobile menu row */
#mobileMenuPanel .mm-item {
    justify-content: center;
    text-align: center;
}

/* compact row height */
.mobile-menu__list {
    gap: 6px;
}

/* slightly tighter stack */

.site-header .right {
    margin-left: auto;
    justify-content: flex-end;
}

/* 1) Force a visible drawing color for the bars in both themes */
.site-header #headerMenuToggle {
    color: var(--ink) !important;
}

html.theme-dark .site-header #headerMenuToggle {
    color: #e8ecef !important;
}

/* 2) Bars must actually paint in that color, no fades */
.site-header #headerMenuToggle .menu-toggle__bar {
    background: currentColor !important;
    opacity: 1 !important;
}

/* 3) Keep the toggle above any mobile panel layers */
.site-header #headerMenuToggle {
    z-index: 61 !important;
}

/* Force a visible drawing color in both themes */
#headerMenuToggle {
    color: var(--ink) !important;
}

html.theme-dark #headerMenuToggle {
    color: #e8ecef !important;
}

/* Render the chosen icon (#4) crisply and visibly */
#headerMenuToggle svg {
    width: 24px;
    height: 24px;
    display: block;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    fill: none;
}

/* Retire the old span-based bars entirely (no duplicate mechanism) */
#headerMenuToggle .menu-toggle__bar {
    display: none !important;
}

/* === Make hamburger icon normal-sized to match other header icons === */
#headerMenuToggle {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#headerMenuToggle svg#hamburgerIcon {
    width: 32px;
    /* larger stroke area like other icons */
    height: 32px;
    stroke-width: 2.8;
}

/* Show + size the hamburger ONLY on small screens */
@media (max-width: 1099px) {
    #headerMenuToggle {
        display: inline-flex;
        /* visible only ≤1099px */
        width: 60px;
        height: 60px;
        padding: 0;
        border-radius: 18px;
        align-items: center;
        justify-content: center;
    }

    #headerMenuToggle svg#hamburgerIcon {
        width: 32px;
        height: 32px;
        stroke-width: 2.8;
    }
}

/* Hide the hamburger entirely on wider layouts */
@media (min-width: 1100px) {
    #headerMenuToggle {
        display: none !important;
    }
}

/* === Mobile primary actions: one row, spaced between two units === */
@media (max-width: 1099px) {
    .mobile-primary-actions {
        display: flex;
        flex-direction: row;
        /* keep items pinned to the top of the row even when the Lessons item grows */
        align-items: flex-start;
        justify-content: space-around;
        /* the requirement */
        gap: 12px;
        margin-top: 12px;
        padding: 0 22px 12px;
    }

    /* Each unit = one item (kept intact: Lessons group, Reviews link) */
    .mobile-primary-actions__item {
        width: auto;
        /* was 100% */
        flex: 0 1 auto;
        display: flex;
        /* pin each item’s content to the top edge of the row */
        align-items: flex-start;
        align-self: flex-start;
    }

    /* Inside each unit, keep the trigger compact (not full-width) */
    .mobile-primary-actions .nav-item {
        width: auto;
        /* was 100% in some cases */
    }

    .mobile-primary-actions .nav-link {
        width: auto;
        /* was 100% */
        justify-content: center;
        /* keep label + pill together */
        white-space: nowrap;
        /* avoid wrapping "Reviews 23" */
    }

    /* Ensure the Reviews anchor behaves like the Lessons button */
    .mobile-primary-actions a.nav-link {
        display: inline-flex;
        align-items: center;
        gap: 10px;
    }

    /* Keep the dropdown compact and floating so it doesn't push neighbors */
    .mobile-primary-actions .dropdown {
        position: absolute;
        inset: auto;
        top: calc(100% + 8px);
        left: 0;
        width: max-content;
        min-width: 0;
        /* allow it to shrink on very small screens */
        max-width: calc(100vw - 44px);
        box-shadow: var(--shadow);
        /* keep the dropdown above cards like the forecast graph */
        z-index: 12;
    }


    /* Dropdown items remain full width for tap targets */
    .mobile-primary-actions .dropdown a,
    .mobile-primary-actions .dropdown button {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 100%;
        /* keep the entire row clickable while still aligning content neatly */
        justify-content: space-between;
        white-space: nowrap;
        text-align: left;
    }

    /* "Counters" trigger should be left-justified (not centered) */
    .mobile-primary-actions .dropdown .nav-link {
        justify-content: flex-start;
    }

    /* Keep the Counters sub-menu flowing directly beneath its trigger */
    .mobile-primary-actions #countersMenu,
    .mobile-primary-actions [data-counters-menu] {
        width: auto;
        align-self: flex-start;
        position: relative;
    }

    .mobile-primary-actions #countersMenu>.nav-link,
    .mobile-primary-actions [data-counters-menu]>.nav-link {
        justify-content: space-between;
    }

    .mobile-primary-actions #countersMenu .dropdown.sub,
    .mobile-primary-actions [data-counters-menu] .dropdown.sub {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        transform: none;
        width: max-content;
        max-width: calc(100vw - 44px);
        margin-top: 0;
        border-top: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--shadow);
        z-index: 5;
    }

    /* Mouse users need a hover bridge between the trigger and submenu */
    @media (any-hover: hover) {
        .mobile-primary-actions [data-counters-menu]::after {
            content: none;
        }

        .mobile-primary-actions [data-counters-menu].is-open::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            width: clamp(220px, 100%, calc(100vw - 44px));
            height: 14px;
        }
    }
}

#vocabLinkMobile {
    display: flex;
    align-items: center;
}

/* Kanji lessons: keep labels compact on small screens */
@media (max-width: 640px) {

    .lesson-controls--kanji .lesson-controls__label--mobile {
        display: inline-block;
    }
}

/* If your labels are split into desktop/mobile spans, keep both single-line */
.lesson-controls--kanji .lesson-controls__label--desktop,
.lesson-controls--kanji .lesson-controls__label--mobile {
    white-space: nowrap !important;
}

/* Kanji controls: use short labels below 1200px */
@media (max-width: 1200px) {
    .lesson-controls__label--desktop {
        display: none !important;
    }

    .lesson-controls__label--mobile {
        display: inline !important;
    }
}

/* Kanji controls: always center the two left buttons' labels */
.lesson-controls--kanji #removeFromDeck,
.lesson-controls--kanji #openCustomMeaning {
    display: inline-flex;
    /* stable, cross-engine centering */
    align-items: center;
    justify-content: center;
    text-align: center;
    /* belt-and-suspenders */
}

/* When furigana is shown, give JP lines a bit more room for ruby annotations */
#sentencesSection.show-furi .jp-sentence {
    line-height: 1.8;
    /* was 1.5 in vocab CSS when off */
}

/* === Header — consistent desktop alignment (anchors vs buttons) === */
@media (min-width: 1100px) {

    /* Make the nav column share the exact row height */
    .site-header .nav {
        height: var(--header-item-height);
        align-items: center;
        /* belt-and-suspenders with existing rule */
    }

    /* Normalize the <button> nav-link ("Lessons") to match <a> exactly */
    .site-header .nav button.nav-link {
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background: none;
        border: 0;
        font: inherit;
        line-height: 1;
        height: var(--header-item-height);
        padding-block: 0;
        display: inline-flex;
        align-items: center;
    }
}

/* --- Optional: header alignment debug overlay (toggle via data-debug-header) --- */
.site-header[data-debug-header="true"]::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px dashed rgba(255, 0, 0, .6);
    pointer-events: none;
}

.site-header[data-debug-header="true"] .brand,
.site-header[data-debug-header="true"] .nav .nav-link {
    outline: 1px dashed rgba(0, 128, 255, .6);
}

/* === Header: normalize nav-link metrics and kill inline baseline drift (desktop) === */
@media (min-width: 1100px) {

    /* 1) Make the <button> version of .nav-link inherit the same font
        metrics as <a>, then re-assert size/weight used for nav links */
    .site-header .nav button.nav-link {
        font: inherit;
        /* normalize UA button font rules */
        font-size: 1.2rem;
        /* match .nav-link scaling */
        font-weight: 700;
        /* keep the intended weight */
    }

    /* 2) Remove extra ascent/descent space that can shift perceived center */
    .site-header .nav .nav-link {
        line-height: 1;
        /* collapse to content box */
    }

    /* 3) Inline SVGs carry an intrinsic baseline; make them block-level */
    .site-header .nav .nav-link .chev {
        display: block;
        /* avoids baseline raising the row */
    }

    /* 4) Keep the pill from altering line box & cross-axis centering */
    .site-header .nav .nav-link .pill {
        display: inline-flex;
        /* vertically center the digits */
        align-items: center;
        line-height: 1;
        /* do not inflate the row */
    }
}

/* === Optional dev overlay: turn on by setting data-dbg="header" on .site-header === */
.site-header[data-dbg="header"]::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 0;
    border-top: 1px dashed #e91e63;
    /* midline through the header */
    pointer-events: none;
}

.site-header[data-dbg="header"] .brand,
.site-header[data-dbg="header"] .nav>.nav-link,
.site-header[data-dbg="header"] .nav .nav-item>.nav-link {
    outline: 1px solid rgba(233, 30, 99, .55);
}

/* ===== Landing page ===== */
.landing-page .site-header .right {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.landing-page .site-header .header-icons {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.landing-page .site-header .auth-btn {
    min-width: 96px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1099px) {

    .landing-page .site-header .header-icons,
    .landing-page .site-header .auth-btn {
        display: none;
    }

    .landing-page #mobileMenuPanel {
        right: 12px;
    }

    .landing-page #mobileMenuPanel .mm-language {
        padding: 10px 12px;
        gap: 10px;
    }

    .landing-page #mobileMenuPanel .mm-language select {
        position: static;
        width: 100%;
        height: auto;
        opacity: 1;
        color: inherit;
        background: none;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 6px 8px;
        font: inherit;
        cursor: pointer;
    }

    .landing-page #mobileMenuPanel .mm-language .globe-icon {
        flex-shrink: 0;
    }
}

@media (min-width: 1100px) {
    .landing-page #mobileMenuPanel {
        display: none !important;
    }
}

.language-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: none;
    color: var(--ink);
    border: none;
    font-weight: 600;
    position: relative;
    cursor: pointer;
}

.language-picker select {
    border: none;
    background: transparent;
    font: inherit;
    color: transparent;
    outline: none;
    appearance: none;
    padding: 0;
    cursor: pointer;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
}

.language-picker svg {
    pointer-events: none;
}

.language-picker select:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    border-radius: 10px;
}

.language-picker select option {
    color: var(--ink);
    background-color: var(--panel);
    font-size: 15px;
    font-weight: 600;
}

.globe-icon {
    width: 22px;
    height: 22px;
}

.landing-page .site-header .toggle-btn {
    border: none;
    background: none;
    box-shadow: none;
    padding: 0;
}

.landing-page .site-header .toggle-btn:hover {
    background: none;
}

.landing-page .site-header .toggle-btn:focus-visible {
    outline: 2px solid var(--teal);
}

.landing-hero {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 25px 8vw 40px;
}

.landing-hero__top {
    display: grid;
    gap: 28px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
    width: 100%;
}

.landing-hero__content h1 {
    font-size: clamp(28px, 3.2vw, 42px);
    margin: 14px 0 12px;
}

.landing-hero__content .lead {
    font-size: 18px;
    line-height: 1.7;
    color: var(--muted);
}

.landing-hero__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
}

.cta {
    background: linear-gradient(120deg, var(--accent), #ffb37c);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 800;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(239, 131, 84, .35);
}

.text-link.muted {
    color: var(--muted);
}

.landing-hero__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.landing-hero__radicals {
    margin-top: 12px;
    gap: 12px;
    --rad-card-scale: 0.85;
}

.landing-hero__radicals .rad-card {
    border-color: var(--border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.stat {
    padding: 14px;
    border-radius: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat__value {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.stat__label {
    color: var(--muted);
    font-size: 14px;
}

.landing-hero__visual .card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
}

.landing-hero__visual {
    align-self: start;
}

.card__top {
    display: flex;
    gap: 8px;
}

.chip {
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .2px;
    background: var(--chip-bg);
}

.chip--brand {
    color: var(--brand);
    background: rgba(42, 169, 123, .12);
}

.chip--accent {
    color: var(--accent);
    background: rgba(239, 131, 84, .12);
}

.kanji-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(42, 169, 123, .08), rgba(239, 131, 84, .08));
}

.kanji {
    font-size: 54px;
    font-weight: 800;
    text-align: center;
    padding: 4px 10px;
    width: fit-content;
}

.kanji-meaning {
    font-weight: 800;
    font-size: 20px;
}

.kanji-reading {
    color: var(--muted);
    margin: 4px 0 8px;
}

.mini-copy {
    margin: 0;
    color: var(--muted);
}

.card__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    padding: 12px 8vw 60px;
}

.feature {
    padding: 18px;
    border-radius: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.icon-circle {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(42, 169, 123, .12);
    color: var(--brand);
    font-size: 20px;
    margin-bottom: 10px;
}

.feature h3 {
    margin: 0 0 8px;
}

.feature p {
    color: var(--muted);
    margin: 0;
}

.cta-section {
    padding: 0 8vw 80px;
}

.cta-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(42, 169, 123, .1), rgba(239, 131, 84, .12));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.landing-page .pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(42, 169, 123, .12);
    color: var(--brand);
    font-weight: 700;
    letter-spacing: .2px;
}

.landing-page .pill--ghost {
    background: rgba(239, 131, 84, .12);
    color: var(--accent);
}

.ghost-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.landing-hero__actions .ghost-btn {
    padding: 14px 20px;
    border-radius: 14px;
    font-weight: 800;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 200;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(1px);
}

.modal__content {
    position: relative;
    width: min(720px, 92vw);
    background: var(--panel);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .16);
    padding: 20px 22px;
    z-index: 1;
}

.modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.modal__footer {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.modal__footer-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.goal-options {
    display: grid;
    gap: 12px;
    margin-top: 10px;
}

.goal {
    display: flex;
    gap: 14px;
    align-items: center;
    width: 100%;
    padding: 14px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    cursor: pointer;
    text-align: left;
}

.goal:hover {
    border-color: var(--accent);
}

.goal__icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(239, 131, 84, .12);
    color: var(--accent);
    font-weight: 800;
    font-size: 22px;
}

.goal__title {
    font-weight: 800;
    margin-bottom: 4px;
}

.goal__copy {
    margin: 0;
    color: var(--muted);
}

.icon-btn {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

@media (max-width: 700px) {
    .landing-hero {
        padding-top: 28px;
    }

    .site-header {
        position: sticky;
    }

    .modal__footer {
        align-items: stretch;
    }
}

/* ===== Lessons onboarding arrows ===== */
.lesson-onboarding-arrow {
    position: absolute;
    width: 126px;
    height: 126px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lesson-arrow-pulse 1.6s ease-in-out infinite;
    will-change: transform;
    pointer-events: none;
    z-index: 4000;
}

.lesson-arrow-svg {
    display: block;
    width: 99px;
    height: 99px;
    transform: rotate(157.5deg);
    transform-origin: 50% 50%;
    overflow: visible;
}

.lesson-arrow-shape {
    fill: var(--arrow-green);
    stroke: var(--arrow-border);
    stroke-width: 1.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    filter: none;
}

body.debug-arrows .lesson-onboarding-arrow {
    outline: 1px dashed rgba(59, 130, 246, 0.7);
}

.lesson-onboarding-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 4500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.lesson-onboarding-dialog {
    position: relative;
    max-width: 520px;
    width: min(520px, 100%);
    background: #0e1421;
    color: #eef2ff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.75rem 2rem 1.25rem;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
    line-height: 1.6;
}

.lesson-onboarding-dialog__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.lesson-onboarding-dialog__close:hover,
.lesson-onboarding-dialog__close:focus {
    background: rgba(255, 255, 255, 0.16);
    outline: none;
}

.lesson-onboarding-dialog__body {
    font-size: 1.05rem;
    font-weight: 600;
}

@keyframes lesson-arrow-pulse {

    0%,
    100% {
        transform: scale(1) translate(0, 0);
    }

    40% {
        transform: scale(1.09) translate(-3px, 3px);
    }

    65% {
        transform: scale(1.025) translate(-1px, 1px);
    }
}

#guidebutton {
    margin-left: 5px;
    margin-right: 10px;
}

/* Lessons > Counters submenu: keep width snug on mobile so it doesn't look oversized */
@media (max-width: 1099px) {

    .mobile-primary-actions #countersMenu .dropdown.sub,
    .mobile-primary-actions [data-counters-menu] .dropdown.sub {
        min-width: 0;
        width: max-content;
        max-width: calc(100vw - 44px);
    }
}