/* Memonatra Studio. Presentation only; existing state and game classes stay intact. */
:root, body.dark {
    color-scheme: dark;
    --primary-color: #9c9bff; --accent: #9c9bff; --accent-rgb: 156,155,255;
    --bg-premium: #090d18; --card-bg-premium: #121827; --card-bg: #121827;
    --glass-bg: #151d30; --glass-border: #ffffff12; --border-color: #ffffff1c;
    --text-color: #eaf0ff; --text-primary: #eaf0ff; --text-secondary: #9ba9c2;
    --studio-blue: #81bdff; --studio-mint: #8ee4c5;
}
html.dark { background: #090d18; }
body.memonatra-studio {
    margin: 0; padding: 0 0 112px; color: var(--text-primary);
    font-family: 'Segoe UI', 'Noto Sans Georgian', system-ui, sans-serif;
    background: radial-gradient(ellipse at 82% 0%, #35337724, transparent 45%),
                radial-gradient(ellipse at 0% 35%, #13526415, transparent 40%), #090d18;
    background-attachment: fixed; line-height: 1.5;
}
.memonatra-studio *, .memonatra-studio *::before, .memonatra-studio *::after { box-sizing: border-box; }
.memonatra-studio button:not([class*="fa-"]), .memonatra-studio input, .memonatra-studio select, .memonatra-studio textarea { font-family: inherit; }
.memonatra-studio .fas, .memonatra-studio .fa-solid { font-family: "Font Awesome 6 Free" !important; font-weight: 900 !important; }
.memonatra-studio .far, .memonatra-studio .fa-regular { font-family: "Font Awesome 6 Free" !important; font-weight: 400 !important; }
.memonatra-studio .fab, .memonatra-studio .fa-brands { font-family: "Font Awesome 6 Brands" !important; font-weight: 400 !important; }
.memonatra-studio button { cursor: pointer; transition: background .2s, border-color .2s, box-shadow .2s, transform .2s; }
.memonatra-studio button:active:not(:disabled) { transform: scale(.96); }
.memonatra-studio button:disabled { opacity: .45; cursor: not-allowed; }
.memonatra-studio :focus-visible { outline: 2px solid #a9b9ff !important; outline-offset: 4px; }
.memonatra-studio [hidden] { display: none !important; }
.memonatra-studio ::selection { background: #9c9bff44; color: white; }
.memonatra-studio ::-webkit-scrollbar { width: 6px; height: 6px; }
.memonatra-studio ::-webkit-scrollbar-thumb { background: #35415a; border-radius: 8px; }

/* A calm, persistent command bar. */
body.memonatra-studio .header-wrapper {
    top: 12px; width: calc(100% - 40px) !important; max-width: 1600px;
    margin: 12px auto 0 !important; padding: 0 !important; gap: 0; border: 1px solid #ffffff14 !important;
    border-radius: 20px; background: #101623ed !important;
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 12px 48px #0003 !important;
}
body.memonatra-studio .top, body.memonatra-studio .top-bar, body.memonatra-studio .card-toolbar {
    background: transparent !important; box-shadow: none !important; backdrop-filter: none;
}
body.memonatra-studio .top-bar { padding: 14px 22px !important; gap: 16px; }
.memonatra-studio .app-logo { font-family: 'Outfit', system-ui, sans-serif; font-size: 24px; letter-spacing: -.8px; color: #f1f5ff !important; background: none !important; -webkit-text-fill-color: currentColor !important; white-space: nowrap; flex-shrink: 0; }
/* "Memo" stands out in the name, in the Add Word button's colors, so the memory idea reads first. */
.memo-name b { font-weight: inherit; background: linear-gradient(120deg, #b1a5ff, #86bfff); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent !important; }
.memonatra-studio .memonatra-brand-icon { border-radius: 11px; box-shadow: 0 4px 20px #8982ff30; }
body.memonatra-studio .card-toolbar { padding: 12px 22px !important; border-top: 1px solid #ffffff0b !important; }
body.memonatra-studio .top-bar button, body.memonatra-studio .toolbar-btn,
body.memonatra-studio .toolbar-select, body.memonatra-studio .premium-library-btn {
    background: #ffffff05 !important; border: 1px solid #ffffff13 !important;
    border-radius: 11px !important; color: #b9c6de !important; box-shadow: none !important; min-height: 40px;
}
body.memonatra-studio .top-bar button:hover, body.memonatra-studio .toolbar-btn:hover { background: #ffffff0d !important; color: #fff !important; border-color: #9c9bff55 !important; }
.memonatra-studio #userEmailDisplay { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px !important; }
body.memonatra-studio .modern-search-input { height: 44px !important; background: #090e19 !important; border: 1px solid #ffffff14 !important; border-radius: 12px !important; color: #eaf0ff !important; box-shadow: none !important; }
.memonatra-studio input::placeholder, .memonatra-studio textarea::placeholder { color: #7f8ba3; opacity: 1; }
body.memonatra-studio #trainingBtn, body.memonatra-studio .primary-add-btn,
.memonatra-studio .studio-empty button, body.memonatra-studio .global-start-btn {
    background: linear-gradient(120deg, #b1a5ff, #86bfff) !important; color: #11152c !important;
    border: 1px solid #c1c5ff80 !important; font-weight: 750; box-shadow: 0 4px 20px #8982ff20 !important; border-radius: 12px !important;
}
body.memonatra-studio #trainingBtn:hover, body.memonatra-studio .primary-add-btn:hover { box-shadow: 0 4px 26px #8982ff45 !important; }
.memonatra-studio .studio-welcome, .memonatra-studio .studio-collection-heading, body.memonatra-studio .card-container, .memonatra-studio .studio-empty { width: calc(100% - 64px); max-width: 1480px; margin-left: auto; margin-right: auto; }
.studio-welcome { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding: 48px 0 36px; }
.studio-eyebrow { display: flex; align-items: center; gap: 9px; color: #a4b3d0; font-size: 10px; font-weight: 700; letter-spacing: 2.4px; margin: 0 0 12px; }
.studio-eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: #8ee4c5; box-shadow: 0 0 12px #8ee4c566; }
.studio-welcome h2 { margin: 0; font: 700 clamp(27px, 3vw, 42px)/1.2 'Outfit', system-ui, sans-serif; letter-spacing: -1px; }
.studio-welcome h2 span { color: #a9a9f8; }
.studio-welcome > div > p:last-child { color: #9ba9c2; margin: 12px 0 0; font-size: 14px; }
.studio-summary { display: flex; gap: 32px; flex-shrink: 0; }
.studio-summary > div { display: flex; flex-direction: column; padding-left: 24px; border-left: 1px solid #ffffff13; }
.studio-summary strong { font: 500 32px/1.2 'Outfit', sans-serif; color: #dae3ff; }
.studio-summary span { font-size: 11px; color: #9ba9c2; margin-top: 7px; }
.studio-collection-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #ffffff0c; }
.studio-collection-heading h2 { font-size: 14px; font-weight: 600; margin: 0; }
.studio-collection-heading > span { color: #9ba9c2; font-size: 12px; }
body.memonatra-studio .card-container:not(.list-view) { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 18px; padding: 24px 0; }
body.memonatra-studio .card {
    width: auto; margin: 0; padding: 24px; border: 1px solid #ffffff12;
    border-radius: 18px; background: linear-gradient(145deg, #161e30, #101622);
    backdrop-filter: none; box-shadow: 0 5px 16px #00000014;
    transition: transform .25s, border-color .25s, box-shadow .25s;
    animation: studio-reveal .35s both;
}
body.memonatra-studio .card:hover { transform: translateY(-3px); border-color: #969bff55; box-shadow: 0 12px 28px #0003; }
body.memonatra-studio .card.selected { background: #242641 !important; box-shadow: 0 0 0 2px #9c9bff !important; }
.memonatra-studio .card h2.word { color: #edf2ff; font-size: 23px; letter-spacing: -.5px; font-weight: 650; }
body.memonatra-studio .card .translation { font-size: 15px; color: #b9c7e0; line-height: 1.7; margin: 20px 0; }
body.memonatra-studio .translation .extra { color: #8594ae; }
.memonatra-studio .card-actions { opacity: .65; transition: opacity .2s; }
.memonatra-studio .card:hover .card-actions, .memonatra-studio .card:focus-within .card-actions { opacity: 1; }
body.memonatra-studio .tags span { background: #9c9bff10; color: #abb5dc; border: 1px solid #9c9bff18; border-radius: 6px; font-size: 11px; }
body.memonatra-studio .speak-btn { color: #9fb9f7 !important; background: #9aafff12 !important; border: 1px solid #9aafff18 !important; border-radius: 10px !important; }
body.memonatra-studio .progress-bar-container { background: #ffffff08; border-radius: 8px; overflow: hidden; }
.memonatra-studio .progress-label { color: #b4c1d9; font-size: 10px; }
.memonatra-studio .studio-empty { text-align: center; padding: 64px 20px; color: #9ba9c2; }
.studio-empty > i { font-size: 32px; color: #8ee4c5; padding: 20px; background: #8ee4c50b; border-radius: 24px; }
.studio-empty h3 { color: #eaf0ff; font-size: 22px; }
.studio-empty p { font-size: 14px; }
.studio-empty button { padding: 13px 20px; margin-top: 12px; }

/* Every secondary surface shares the same hierarchy and material. */
body.memonatra-studio .modal-overlay { background: #030611b8; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
body.memonatra-studio .modal, body.memonatra-studio .training-modal-content {
    background: #121827 !important; color: #eaf0ff; border: 1px solid #ffffff18 !important;
    border-radius: 24px; box-shadow: 0 28px 100px #0008; animation: studio-reveal .25s ease-out both; backdrop-filter: none;
    opacity: 1 !important;
}
body.memonatra-studio .preview-modal {
    opacity: 1 !important;
    transform: none !important;
    animation: studio-reveal .25s ease-out both !important;
}
body.memonatra-studio .nav-btn {
    background: #151d30f0 !important;
    color: #eaf0ff !important;
    border: 1px solid #ffffff1c !important;
    box-shadow: 0 8px 32px #0008 !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.15rem;
    padding: 0 !important;
    transition: background .2s, border-color .2s, transform .2s, color .2s !important;
}
body.memonatra-studio .nav-btn:hover {
    background: #1e2942 !important;
    border-color: #9c9bff77 !important;
    color: #9c9bff !important;
    transform: translateY(-50%) scale(1.08) !important;
}
body.memonatra-studio .nav-btn:disabled {
    background: #12182766 !important;
    color: #4a5670 !important;
    border-color: #ffffff08 !important;
    cursor: not-allowed;
    transform: translateY(-50%) !important;
}
body.memonatra-studio .modal-header { border-bottom: 1px solid #ffffff0d; padding-bottom: 18px; }
.memonatra-studio .modal-header h2 { font-size: 21px; letter-spacing: -.4px; }
body.memonatra-studio .modal-footer { border-top: 1px solid #ffffff0d; padding-top: 18px; }
body.memonatra-studio .close-button { background: #ffffff07; color: #aebbd2; border-radius: 10px; min-width: 34px; min-height: 34px; }
body.memonatra-studio .form-control, body.memonatra-studio .material-input > input,
body.memonatra-studio .material-input > textarea, body.memonatra-studio select,
body.memonatra-studio .tagify, body.memonatra-studio .training-modal input {
    background: #0c1220 !important; color: #dce5fa !important; border: 1px solid #ffffff1c !important; border-radius: 10px;
}
body.memonatra-studio .material-input > span { color: #9eacc7; }
body.memonatra-studio .material-input > input:focus, body.memonatra-studio .material-input > textarea:focus { border-color: #9c9bff !important; }
body.memonatra-studio .sidebar, body.memonatra-studio .toolbar-dropdown-content { background: #121a2b !important; border: 1px solid #ffffff18 !important; box-shadow: 0 18px 60px #0005; }
body.memonatra-studio .sidebar-tag-item { border-radius: 10px; color: #b8c6de; }
body.memonatra-studio .sidebar-tag-item.active, body.memonatra-studio .library-item.active { background: #9c9bff14 !important; border-color: #9c9bff60 !important; color: #d0cfff; }
body.memonatra-studio .library-item, body.memonatra-studio .stat-card, body.memonatra-studio .notification-entry { background: #ffffff04; border: 1px solid #ffffff0f; border-radius: 14px; }
body.memonatra-studio .stat-value { color: #b2b1ff; }
body.memonatra-studio .auth-container { background: radial-gradient(ellipse at 25% 20%, #45409330, transparent 60%), #090d18; padding: 24px; }
/* Sign-in screen: Memonatra's heading above the site's shared account panel (assets/account/zk-account.css) */
body.memonatra-studio .auth-container { flex-direction: column; gap: 22px; }
.memonatra-studio .auth-brand { width: 400px; max-width: 100%; text-align: center; }
.memonatra-studio .auth-brand > h2 { margin: 0; font-family: 'Outfit', sans-serif; font-size: 32px; color: #b7b7ff; letter-spacing: -1px; }
.memonatra-studio .auth-brand h3 { font-size: 27px; line-height: 1.25; letter-spacing: -.7px; margin: 18px 0 10px; color: #eef2ff; }
.memonatra-studio .auth-brand p { margin: 0; color: #9ba9c2; }
.memonatra-studio .auth-brand .auth-eyebrow { margin-top: 6px; font-size: 9px; letter-spacing: 2px; }
.memonatra-studio .auth-account { width: 400px; max-width: 100%; display: flex; justify-content: center; }
body.memonatra-studio .auth-skip { width: 400px; max-width: 100%; padding: 10px 24px; background: var(--glass-bg); color: var(--text-color); border: 1px solid var(--glass-border); border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 500; }
/* Account button in the top bar: Google photo or initial, and the first name */
body.memonatra-studio .memonatra-account-btn { display: inline-flex; align-items: center; gap: 8px; }
body.memonatra-studio .memonatra-account-btn .zk-acc-avatar { width: 26px; height: 26px; font-size: 12px; }

/* Practice and listening, without changing game state or answer colors. */
body.memonatra-studio .training-tabs { background: #0c1220; border-bottom: 1px solid #ffffff12; padding: 12px; gap: 6px; }
body.memonatra-studio .training-tab { background: transparent; color: #9ba9c2; border-radius: 9px; padding: 12px 16px; border: 1px solid transparent; font-size: 11px; letter-spacing: 1px; }
body.memonatra-studio .training-tab.active { background: #9c9bff1c; color: #ceceff; border-color: #9c9bff35; box-shadow: none; }
body.memonatra-studio #globalTrainingSettings { background: #ffffff03; border-bottom: 1px solid #ffffff0c; padding: 16px 20px; gap: 16px; }
body.memonatra-studio .quiz-option:not(.correct):not(.wrong):not(.incorrect), body.memonatra-studio .mix-item:not(.matched):not(.correct):not(.wrong):not(.incorrect) { background: #192237; border: 1px solid #ffffff18; color: #dce5fa; border-radius: 14px; }
body.memonatra-studio .quiz-option:hover:not(:disabled) { border-color: #9c9bff; }
body.memonatra-studio .beautiful-results { background: transparent; color: #eaf0ff; }
body.dark.memonatra-studio .training-tabs { background: #0c1220 !important; padding: 12px !important; }
body.dark.memonatra-studio .training-tabs .training-tab { border-radius: 10px !important; padding: 12px 16px !important; background: transparent !important; color: #a5b4ce !important; box-shadow: none !important; }
body.dark.memonatra-studio .training-tabs .training-tab.active { background: #9c9bff20 !important; color: #d1d0ff !important; border-color: #9c9bff50 !important; }
body.dark.memonatra-studio #globalQuestionCount { width: 80px !important; min-width: 72px; padding: 10px !important; }
body.dark.memonatra-studio .training-tab-content .game-empty-state .placeholder-start-btn,
body.dark.memonatra-studio .training-tab-content .beautiful-results .play-again-btn { background: linear-gradient(120deg, #b1a5ff, #86bfff) !important; color: #11152c !important; box-shadow: 0 4px 18px #8982ff18 !important; }
body.memonatra-studio .game-empty-state { border: 1px solid #ffffff0e !important; background: radial-gradient(ellipse at 50% 0, #9c9bff0d, transparent 70%) !important; box-shadow: none !important; padding: 44px 24px !important; }
body.memonatra-studio .game-empty-state > i { font-size: 38px !important; padding: 22px; border-radius: 22px; background: #ffffff05; }
body.memonatra-studio .placeholder-start-btn, body.memonatra-studio .play-again-btn,
body.memonatra-studio #saveCardBtn, body.memonatra-studio #saveVoiceBtn, body.memonatra-studio #saveProgressSettingsBtn,
body.memonatra-studio #tiCheck, body.memonatra-studio .primary-btn {
    background: linear-gradient(120deg, #b1a5ff, #86bfff) !important; color: #11152c !important;
    border: 0; border-radius: 12px; font-weight: 700; box-shadow: 0 4px 18px #8982ff18;
}
body.memonatra-studio #cancelBtn, body.memonatra-studio .action-btn-secondary { background: #ffffff08 !important; border: 1px solid #ffffff18; color: #b9c7e0 !important; border-radius: 10px; }
body.memonatra-studio .card-container.list-view { padding: 24px 0; }
body.memonatra-studio .card-container.list-view .card { padding: 15px 20px; }
body.memonatra-studio .player { background: #151d30ed !important; border: 1px solid #ffffff1c !important; border-radius: 22px !important; box-shadow: 0 12px 48px #0008 !important; margin-bottom: 14px !important; }
body.memonatra-studio #playToggleBtn { background: linear-gradient(120deg, #b1a5ff, #86bfff) !important; color: #13192b !important; box-shadow: 0 0 22px #9c9bff20; }
/* The player's wrapper lets clicks pass through it; the collapsed word must catch them itself. */
body.memonatra-studio .player-minimized-display { pointer-events: auto; background: #151d30; color: #cbd8ef; border: 1px solid #ffffff1c; border-radius: 18px; transition: background .18s, border-color .18s, box-shadow .18s, transform .18s; }
body.memonatra-studio .player-minimized-display:hover { background: #1b2540; border-color: #b1a5ff99; box-shadow: 0 6px 24px #8982ff40; transform: translateX(-50%) translateY(-2px); }
body.memonatra-studio .player-minimized-display:active { transform: translateX(-50%) scale(.98); }
.memonatra-studio #soundEffectsBtn[aria-pressed="true"] { color: #8ee4c5 !important; border-color: #8ee4c555 !important; }
.memonatra-studio #globalLoadingScreen { background: #090d18; }
.memonatra-studio .memonatra-spinner { border-color: #9c9bff20; border-top-color: #aaa6ff; }
@keyframes studio-reveal { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1150px) {
    .memonatra-studio .top-center { flex: 1; }
    .memonatra-studio .top-center .search-input-wrapper { width: auto !important; min-width: 160px; flex: 1 !important; }
    .memonatra-studio #userEmailDisplay { display: none; }
    .studio-welcome { gap: 20px; }
    .studio-summary { gap: 16px; }
}
@media (max-width: 768px) {
    body.memonatra-studio .header-wrapper { width: calc(100% - 20px) !important; top: 8px; margin-top: 8px !important; border-radius: 16px; }
    body.memonatra-studio .mobile-header { background: transparent !important; padding: 12px 16px; }
    body.memonatra-studio .top-bar { padding: 12px !important; }
    .memonatra-studio .top-left, .memonatra-studio .top-center { width: 100%; flex-wrap: wrap; gap: 10px !important; }
    body.memonatra-studio .card-toolbar { padding: 12px 14px !important; gap: 8px !important; }
    .memonatra-studio .toolbar-right { gap: 8px !important; }
    .memonatra-studio .toolbar-divider { display: none; }
    body.memonatra-studio .toolbar-select { font-size: 12px !important; padding: 0 28px 0 10px !important; height: 38px !important; max-width: 140px !important; }
    body.memonatra-studio .card-toolbar .toolbar-btn, body.memonatra-studio .card-toolbar .primary-add-btn { min-width: 36px; min-height: 38px; height: 38px; padding: 0 10px !important; }
    .memonatra-studio .studio-welcome, .memonatra-studio .studio-collection-heading, body.memonatra-studio .card-container, .memonatra-studio .studio-empty { width: calc(100% - 32px); }
    .studio-welcome { flex-direction: column; align-items: flex-start; padding: 28px 0; gap: 24px; }
    .studio-welcome h2 span { display: block; }
    .studio-summary { width: 100%; gap: 28px; }
    .studio-summary > div { padding-left: 12px; }
    .studio-summary strong { font-size: 24px; }
    body.memonatra-studio .card-container:not(.list-view) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; padding-top: 18px; }
    body.memonatra-studio .card { padding: 20px; }
    body.memonatra-studio .modal { border-radius: 18px; max-width: calc(100vw - 24px); }
    body.memonatra-studio .training-tabs { overflow-x: auto; flex-wrap: nowrap; padding: 8px; }
    body.memonatra-studio .training-tab { flex-shrink: 0; padding: 10px 12px; }
    body.memonatra-studio .training-close { position: sticky; right: 0; background: #121827; }
    body.memonatra-studio .player { margin-bottom: max(8px, env(safe-area-inset-bottom)) !important; }
}
@media (max-width: 440px) {
    .memonatra-studio .toolbar-right { gap: 6px !important; }
    body.memonatra-studio .card-toolbar { padding: 10px 8px !important; }
    body.memonatra-studio #sortSelect { max-width: 120px !important; }
    body.memonatra-studio #mainProgressSelect { max-width: 110px !important; }
}
/* Task-first command layout: the same real controls at every breakpoint. */
body.dark.memonatra-studio .studio-command .mobile-header,
body.dark.memonatra-studio .studio-command .toolbar-dropdown,
body.dark.memonatra-studio .mobile-sidebar-btn,
body.dark.memonatra-studio .mobile-logo { display: none !important; }
body.dark.memonatra-studio .studio-command .top-bar {
    display: grid !important; grid-template-columns: auto minmax(160px,220px) minmax(180px,1fr) auto auto auto;
    align-items: center !important; gap: 14px !important; padding: 16px !important; margin: 0 !important; width: 100% !important;
    position: static !important; max-height: none !important; overflow: visible !important; opacity: 1 !important; transform: none !important;
}
body.dark.memonatra-studio .studio-command .top { width: 100% !important; max-width: none !important; max-height: none !important; margin: 0 !important; overflow: visible !important; }
body.dark.memonatra-studio .studio-command .top-bar > * { min-width: 0 !important; }
body.dark.memonatra-studio .studio-command .app-logo { display: flex !important; align-items: center; padding: 0 !important; font-size: 22px !important; }
body.dark.memonatra-studio .studio-command .search-input-wrapper { width: 100% !important; min-width: 0 !important; }
body.dark.memonatra-studio .studio-command #libraryManagerBtn { width: 100% !important; min-width: 0; padding: 9px 12px !important; gap: 12px !important; display: flex !important; }
body.dark.memonatra-studio #currentLibraryName { min-width: 0; max-width: none; flex: 1; font-size: 13px; }
body.dark.memonatra-studio .chevron-wrapper { flex: 0 0 24px; width: 24px; height: 24px; margin-left: 4px; }
body.dark.memonatra-studio .studio-command #trainingBtn,
body.dark.memonatra-studio .studio-command #addCardBtn { width: auto !important; height: auto !important; min-height: 44px; padding: 10px 16px !important; white-space: nowrap; font-size: 13px; }
body.dark.memonatra-studio .studio-command #addCardBtn { background: linear-gradient(120deg,#b1a5ff,#86bfff) !important; color: #11152c !important; border-radius: 12px !important; }
body.dark.memonatra-studio .studio-command #trainingBtn { background: #9c9bff14 !important; color: #cac9ff !important; border: 1px solid #9c9bff44 !important; }
.studio-account { position: relative; }
.studio-account > summary { cursor: pointer; list-style: none; padding: 11px 14px; border: 1px solid #ffffff1c; border-radius: 11px; color: #b9c7e0; font-size: 13px; }
.studio-account > summary::after { content: '⌄'; padding-left: 10px; }
.studio-account > summary::-webkit-details-marker { display: none; }
.studio-account[open] > summary { background: #9c9bff18; color: #eaf0ff; }
.studio-account > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; transition: background .2s, border-color .2s; }
.studio-account > summary::after { padding-left: 0; margin-left: 2px; }
.studio-account > summary:hover, .studio-account > summary:focus-visible { background: #9c9bff14; border-color: #9c9bff66; }
.studio-account-menu { position: absolute; top: calc(100% + 12px); right: 0; width: 240px; padding: 10px; border-radius: 16px; background: #182033; border: 1px solid #ffffff22; box-shadow: 0 20px 60px #0009; z-index: 20; display: grid; gap: 5px; }
body.dark.memonatra-studio .studio-account-menu button,
body.dark.memonatra-studio .studio-account-menu a { display: flex !important; align-items: center; gap: 12px; width: 100% !important; text-align: left; justify-content: flex-start !important; padding: 10px 12px !important; margin: 0 !important; font-size: 13px; }
.studio-account-menu i { width: 18px; text-align: center; }
body.dark.memonatra-studio .studio-account-menu #userEmailDisplay { display: block; max-width: 100%; padding: 8px 12px; }
.studio-account-menu { width: min(280px,calc(100vw - 32px)); max-height: calc(100dvh - 140px); overflow-y: auto; }
body.dark.memonatra-studio .studio-account-menu button { min-height: 42px; border-radius: 10px; }
body.dark.memonatra-studio > #memonatraInstall,
body.dark.memonatra-studio .studio-account-menu #memonatraInstall[hidden] { display: none !important; }
body.dark.memonatra-studio .studio-account-menu #memonatraInstall { position: static !important; inset: auto !important; z-index: auto; border-radius: 10px; background: #9c9bff12; color: #c6c4ff; box-shadow: none; font: inherit; font-size: 13px; }
body.dark.memonatra-studio .studio-account-menu button:hover { background: #9c9bff18 !important; }
.studio-project-section { border-top: 1px solid #ffffff12; border-bottom: 1px solid #ffffff12; padding: 12px 0; margin: 6px 0; }
.studio-project-heading { display: block; color: #91a1bd; font-size: 10px; letter-spacing: .7px; text-transform: uppercase; padding: 0 10px 8px; }
body.dark.memonatra-studio .studio-account-menu .studio-project-link { background: linear-gradient(120deg,#70dcca15,#81bdff0c) !important; border: 1px solid #70dcca30 !important; border-radius: 12px; color: #a9e6d7 !important; text-decoration: none; min-height: 62px; }
.studio-project-copy { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.studio-project-copy strong { font-size: 14px; color: #c2f1e5; }
.studio-project-copy small { font-size: 11px; color: #9aafbd; font-weight: 400; }
body.dark.memonatra-studio .studio-account-menu .studio-project-link:hover { background: #70dcca20 !important; border-color: #70dcca70 !important; }
.studio-project-arrow { transition: transform .2s; }
.studio-project-link:hover .studio-project-arrow { transform: translateX(3px); }
body.dark.memonatra-studio .studio-command .card-toolbar {
    margin: 0 !important;
    padding: 16px 28px !important;
    min-height: 72px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-sizing: border-box !important;
}

/* Zone 1: Left (Tags) */
body.dark.memonatra-studio .studio-command .toolbar-left {
    flex: 1 1 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}
body.dark.memonatra-studio #toggleSidebarBtn {
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 16px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #e2eaf8 !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
body.dark.memonatra-studio #toggleSidebarBtn:hover {
    background: rgba(156, 155, 255, 0.15) !important;
    border-color: rgba(156, 155, 255, 0.4) !important;
    color: #ffffff !important;
}
body.dark.memonatra-studio #toggleSidebarBtn i {
    color: #9c9bff !important;
    font-size: 13px !important;
}

/* Zone 2: Center (Sorting & Progress Filter) */
body.dark.memonatra-studio .studio-command .toolbar-center {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
}
body.dark.memonatra-studio .studio-command .sorting {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    height: 40px !important;
    border-radius: 12px !important;
    background: #111726 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    overflow: hidden !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}
body.dark.memonatra-studio .studio-command .sorting:hover {
    border-color: rgba(156, 155, 255, 0.4) !important;
    background-color: #151d30 !important;
}
body.dark.memonatra-studio .studio-command .sorting:focus-within {
    border-color: #9c9bff !important;
    box-shadow: 0 0 0 3px rgba(156, 155, 255, 0.2) !important;
}
body.dark.memonatra-studio #sortDirectionIcon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 40px !important;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #9c9bff !important;
    font-size: 13px !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}
body.dark.memonatra-studio #sortDirectionIcon:hover {
    background: rgba(156, 155, 255, 0.15) !important;
    color: #ffffff !important;
    transform: none !important;
}
body.dark.memonatra-studio .studio-command .sorting #sortSelect {
    height: 40px !important;
    min-height: 40px !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239c9bff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat calc(100% - 12px) center !important;
    box-shadow: none !important;
    padding: 0 34px 0 12px !important;
    color: #dbe4f8 !important;
    font-size: 13.5px !important;
    font-weight: 550 !important;
    cursor: pointer !important;
    outline: none !important;
}
body.dark.memonatra-studio .studio-command .sorting #sortSelect:hover {
    color: #ffffff !important;
    background-color: transparent !important;
}
body.dark.memonatra-studio .studio-command .sorting #sortSelect:focus {
    box-shadow: none !important;
    border: none !important;
}
body.dark.memonatra-studio .studio-command .toolbar-select {
    height: 40px !important;
    min-height: 40px !important;
    max-width: none !important;
    padding: 0 34px 0 14px !important;
    border-radius: 12px !important;
    background: #111726 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239c9bff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat calc(100% - 12px) center !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #dbe4f8 !important;
    font-size: 13.5px !important;
    font-weight: 550 !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
}
body.dark.memonatra-studio .studio-command .toolbar-select:hover {
    background-color: #162035 !important;
    border-color: rgba(156, 155, 255, 0.4) !important;
    color: #ffffff !important;
}
body.dark.memonatra-studio .studio-command .toolbar-select:focus {
    outline: none !important;
    border-color: #9c9bff !important;
    box-shadow: 0 0 0 3px rgba(156, 155, 255, 0.2) !important;
}
body.dark.memonatra-studio .studio-command .toolbar-select option {
    background: #111726 !important;
    color: #e2eaf8 !important;
    padding: 10px 14px !important;
}

/* Zone 3: Right (View Toggle) */
body.dark.memonatra-studio .studio-command .toolbar-right {
    flex: 1 1 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin: 0 !important;
    gap: 12px !important;
}
body.dark.memonatra-studio .studio-command .view-toggle-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    margin-left: 0 !important;
}
body.dark.memonatra-studio .studio-command #viewToggleBtn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #dbe4f8 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
body.dark.memonatra-studio .studio-command #viewToggleBtn:hover {
    background: rgba(156, 155, 255, 0.15) !important;
    border-color: rgba(156, 155, 255, 0.4) !important;
    color: #ffffff !important;
}
.studio-command .toolbar-divider { display: none !important; }
.studio-mobile-toggle { display: none !important; }
@media (min-width: 821px) {
    body.dark.memonatra-studio .studio-command #studioMobileToggle { display: none !important; }
}

/* Responsive: mobile layout for card-toolbar and command bar */
@media (max-width: 820px) {
    /* Hide collapsible controls by default on mobile */
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) .search-input-wrapper,
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) #trainingBtn,
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) #addCardBtn,
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) .studio-account,
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) .card-toolbar {
        display: none !important;
    }

    body.dark.memonatra-studio .studio-mobile-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        grid-column: 3 !important;
        grid-row: 1 !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: #9c9bff !important;
        font-size: 13px !important;
        cursor: pointer !important;
        transition: all 0.25s ease !important;
    }
    body.dark.memonatra-studio .studio-mobile-toggle:hover {
        background: rgba(156, 155, 255, 0.15) !important;
        color: #ffffff !important;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-mobile-toggle i {
        transform: rotate(180deg);
    }

    body.dark.memonatra-studio .studio-command.mobile-expanded .search-input-wrapper {
        display: block !important;
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        margin-top: 4px !important;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded #trainingBtn {
        display: inline-flex !important;
        grid-column: 1 !important;
        grid-row: 3 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 40px !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 7px !important;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn {
        display: inline-flex !important;
        grid-column: 2 / 4 !important;
        grid-row: 3 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 40px !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 7px !important;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account {
        display: block !important;
        grid-column: 1 / -1 !important;
        grid-row: 4 !important;
        width: 100% !important;
        margin-top: 2px !important;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account > summary {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 9px 12px !important;
        font-size: 12.5px !important;
        font-weight: 550 !important;
        border-radius: 10px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: #b9c7e0 !important;
        cursor: pointer !important;
        text-align: center !important;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account-menu {
        position: static !important;
        width: 100% !important;
        margin-top: 8px !important;
        box-shadow: none !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px !important;
    }

    body.dark.memonatra-studio .studio-command .card-toolbar {
        padding: 12px 14px !important;
        margin: 0 !important;
        min-height: auto !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
    
    /* Row 1: Left = Tags */
    body.dark.memonatra-studio .studio-command .toolbar-left {
        order: 1 !important;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
    }
    body.dark.memonatra-studio #toggleSidebarBtn {
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 14px !important;
        border-radius: 10px !important;
        font-size: 13px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 7px !important;
    }
    
    /* Row 1: Right = View Toggle */
    body.dark.memonatra-studio .studio-command .toolbar-right {
        order: 2 !important;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        margin-left: auto !important;
        gap: 8px !important;
    }
    body.dark.memonatra-studio .studio-command .view-toggle-wrapper {
        margin: 0 !important;
    }
    body.dark.memonatra-studio .studio-command #viewToggleBtn {
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Row 2: Full width 50% / 50% grid for Sort and Filter */
    body.dark.memonatra-studio .studio-command .toolbar-center {
        order: 3 !important;
        width: 100% !important;
        flex: 1 1 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        margin: 0 !important;
    }
    
    /* Left 50% cell: Unified Connected Sort Control */
    body.dark.memonatra-studio .studio-command .sorting {
        width: 100% !important;
        height: 38px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        overflow: hidden !important;
        background: #111726 !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        gap: 0 !important;
    }
    body.dark.memonatra-studio #sortDirectionIcon {
        width: 32px !important;
        height: 38px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    body.dark.memonatra-studio .studio-command .sorting #sortSelect {
        width: calc(100% - 32px) !important;
        flex: 1 !important;
        height: 38px !important;
        min-height: 38px !important;
        max-width: none !important;
        padding: 0 20px 0 8px !important;
        font-size: 12px !important;
        font-weight: 550 !important;
        background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239c9bff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat calc(100% - 6px) center !important;
        color: #dbe4f8 !important;
        border: none !important;
        outline: none !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    /* Right 50% cell: Progress Filter Dropdown */
    body.dark.memonatra-studio .studio-command .hide-mastered-wrapper {
        width: 100% !important;
        display: flex !important;
    }
    body.dark.memonatra-studio .studio-command #mainProgressSelect {
        width: 100% !important;
        height: 38px !important;
        min-height: 38px !important;
        max-width: none !important;
        padding: 0 22px 0 10px !important;
        font-size: 12px !important;
        font-weight: 550 !important;
        border-radius: 10px !important;
        background: #111726 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239c9bff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat calc(100% - 6px) center !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: #dbe4f8 !important;
        outline: none !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* Bounded dialogs with persistent actions and progressive disclosure. */
body.memonatra-studio.studio-dialog-open .fixed-player-wrapper { visibility: hidden; pointer-events: none !important; }
body.dark.memonatra-studio .studio-compact > .modal { width: min(620px,calc(100vw - 24px)) !important; max-width: 620px !important; height: auto !important; max-height: min(720px,calc(100dvh - 40px)) !important; padding: 24px !important; display: flex; flex-direction: column; overflow: hidden; }
body.dark.memonatra-studio .studio-compact .modal-header { margin: 0 0 16px !important; flex-shrink: 0; }
body.dark.memonatra-studio .studio-compact .modal-body { min-height: 0; padding: 0 4px 0 0 !important; overflow-y: auto; flex: 1 1 auto; }
body.dark.memonatra-studio .studio-compact .modal-footer { flex-shrink: 0; margin: 16px 0 0 !important; padding: 14px 0 0 !important; display: flex; justify-content: flex-end; gap: 10px; }
body.dark.memonatra-studio .studio-compact .modal-footer button { min-width: 96px; padding: 11px 18px; }
.studio-tabs { display: flex; flex-shrink: 0; gap: 5px; padding: 5px; margin-bottom: 18px; border: 1px solid #ffffff0e; border-radius: 13px; background: #090e1a; }
.studio-tabs button { flex: 1; padding: 11px 8px; font-size: 12px; border: 0; border-radius: 9px; color: #98a9c7; background: transparent; }
.studio-tabs button[aria-selected="true"] { background: #9c9bff23; color: #d7d5ff; box-shadow: inset 0 0 0 1px #9c9bff32; }
.studio-next-step { margin-right: auto; background: #9c9bff18; color: #c5c2ff; border: 1px solid #9c9bff35; border-radius: 10px; }
.studio-panel { animation: studio-reveal .2s ease-out; }
.studio-progress-section { margin-bottom: 8px; border: 1px solid #ffffff12; border-radius: 10px; padding: 10px 12px; }
.studio-progress-section > summary { cursor: pointer; color: #c6c3ff; font-size: 13px; font-weight: 600; }
.studio-progress-section[open] > summary { margin-bottom: 12px; }
body.dark.memonatra-studio .studio-panel .input-container { margin-top: 0 !important; margin-bottom: 14px !important; }
body.dark.memonatra-studio .studio-compact .material-input { margin-top: 0 !important; padding-top: 0 !important; }
body.dark.memonatra-studio .studio-panel textarea { min-height: 80px; max-height: 160px; resize: vertical; }
body.dark.memonatra-studio #settingsModal .studio-panel > div { margin-bottom: 14px; }
body.dark.memonatra-studio #settingsModal .material-input { margin-bottom: 0; }
body.dark.memonatra-studio #settingsModal select { font-size: 14px; padding: 12px; min-height: 44px; }
.studio-composer-status { --completion: 0%; position: relative; flex-shrink: 0; overflow: hidden; padding: 13px 16px 18px; margin: 0 0 20px; border-radius: 12px; background: #9c9bff09; color: #b4bee0; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.studio-composer-status::after { content: ''; position: absolute; bottom: 0; left: 0; height: 3px; width: var(--completion); background: linear-gradient(90deg,#a49aff,#70dcca); transition: width .35s ease; }
body.dark.memonatra-studio .studio-panel .tags-display span { padding: 6px 10px; border-radius: 9px; animation: studio-reveal .2s ease-out; }
body.dark.memonatra-studio #settingsModal .button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body.dark.memonatra-studio #settingsModal .button-row > * { width: 100% !important; margin: 0 !important; padding: 12px !important; border-radius: 11px; font-size: 13px; text-align: center; background: #9c9bff18 !important; color: #d5d7ff !important; border: 1px solid #9c9bff22; }
body.dark.memonatra-studio #settingsModal .button-row > input { display: none !important; }
body.dark.memonatra-studio #settingsModal .button-row:first-of-type { grid-template-columns: 1fr; }

/* Soft pastel groups with a distinct selection cue. */
body.dark.memonatra-studio .card .tags .card-tag,
body.dark.memonatra-studio #previewTags > span,
body.dark.memonatra-studio #tagList > .tag { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 28px; line-height: 1 !important; vertical-align: middle; color: var(--tag-color, #b9b2d9) !important; background-color: color-mix(in srgb,var(--tag-color, #b9b2d9) 18%,transparent) !important; opacity: 1 !important; filter: none !important; font-weight: 650; border: 1px solid color-mix(in srgb,var(--tag-color, #b9b2d9) 20%,transparent); padding: 0 9px !important; border-radius: 7px; font-size: 11px; }
body.dark.memonatra-studio .card .tags .card-tag.filtered { background-color: color-mix(in srgb,var(--tag-color, #b9b2d9) 30%,transparent) !important; color: var(--tag-color, #b9b2d9) !important; opacity: 1 !important; outline: 1px solid var(--tag-color, #b9b2d9); outline-offset: 2px; box-shadow: 0 0 12px color-mix(in srgb,var(--tag-color, #b9b2d9) 20%,transparent); }
body.dark.memonatra-studio .card .tags .card-tag,
body.dark.memonatra-studio #previewTags > span,
body.dark.memonatra-studio #tagList > .tag { height: 28px; line-height: 26px !important; }
body.dark.memonatra-studio .card .tags .card-tag.filtered::before { content: '✓ '; font-weight: 800; }
body.dark.memonatra-studio .card .tags { gap: 7px; display: flex; flex-wrap: wrap; }
body.dark.memonatra-studio .card .card-tag-more { background: #ffffff09 !important; color: #b8c7e8 !important; opacity: 1; min-height: 28px; line-height: 28px; padding: 0 9px !important; vertical-align: middle; }
body.dark.memonatra-studio .card-container:not(.list-view) .card { padding-bottom: 64px; }
body.dark.memonatra-studio .card-container:not(.list-view) .progress-bar-container { position: absolute; left: 24px !important; right: 24px !important; bottom: 18px !important; width: auto !important; height: 6px; overflow: visible; transform: none !important; margin: 0 !important; }
body.dark.memonatra-studio .card-container:not(.list-view) .progress-bar { height: 6px; border-radius: 6px; background-image: linear-gradient(90deg,#9594fa88,#79e1c4aa); box-shadow: 0 0 12px #82dcb51a; transition: width .45s ease; }
body.dark.memonatra-studio .card-container:not(.list-view) .progress-label { display: block !important; position: absolute; right: 0; left: auto; top: -23px; bottom: auto; transform: none; color: #98b5d2; font-size: 10px; }
.studio-progress-caption { position: absolute; left: 24px; bottom: 32px; color: #95a9c5; font-size: 10px; letter-spacing: .3px; }
.card[data-mastery="complete"] .studio-progress-caption { color: #70dcca; }
.card-container.list-view .studio-progress-caption { display: none; }

/* Word detail: aligned speech control and compact, paired examples. */
body.dark.memonatra-studio #cardPreviewModal { --preview-width: min(920px,calc(100vw - 144px)); padding: 24px 0 100px; }
body.dark.memonatra-studio #cardPreviewModal .preview-modal { width: var(--preview-width); max-height: min(800px,calc(100dvh - 124px)); height: auto !important; padding: 24px !important; overflow-y: auto; }
body.dark.memonatra-studio #cardPreviewModal .inside-nav { position: absolute; top: calc(50% - 38px); bottom: auto; transform: translateY(-50%); }
body.dark.memonatra-studio #cardPreviewModal .left-nav { left: calc((100% - var(--preview-width)) / 2 - 56px); right: auto; }
body.dark.memonatra-studio #cardPreviewModal .right-nav { right: calc((100% - var(--preview-width)) / 2 - 56px); left: auto; }
body.dark.memonatra-studio #previewTranslation { display: flex !important; gap: 16px; align-items: flex-start; width: 100% !important; margin: 18px 0 !important; padding: 0 !important; }
.studio-translation-copy { flex: 1; min-width: 0; line-height: 1.7; }
body.dark.memonatra-studio #previewTranslation .extra { display: block; margin-top: 6px; font-size: 14px; color: #91a1bc; }
body.dark.memonatra-studio #previewTranslation .speak-btn { position: static !important; transform: none !important; margin: 0 !important; flex: 0 0 36px; }
body.dark.memonatra-studio .preview-sticky hr { border: 0; border-top: 1px solid #ffffff12; }
body.dark.memonatra-studio .preview-sticky { padding: 0 !important; margin: 0 !important; }
body.dark.memonatra-studio #previewMnemonic { background: #a49aff0b; border: 1px solid #a49aff22; border-left: 3px solid #a49aff; border-radius: 12px; padding: 14px 16px; color: #b7c4de; font-style: normal; line-height: 1.7; font-size: 13px; }
body.dark.memonatra-studio #previewTags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
body.dark.memonatra-studio #cardPreviewModal .sentence-preview { margin-top: 18px !important; padding: 16px 4px 0 0 !important; border-top: 1px solid #ffffff0d; min-height: 110px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #9c9bff55 transparent; -webkit-mask-image: none; mask-image: none; }
body.dark.memonatra-studio .sentence-preview h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: #94a6c7; }
body.dark.memonatra-studio #previewCombinedSentences { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
body.dark.memonatra-studio #previewCombinedSentences > p { grid-column: 1 / -1; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair { position: relative; min-width: 0; margin: 0 !important; padding: 14px 14px 14px 46px; border-radius: 14px; background: linear-gradient(135deg,#9c9bff09,#ffffff02); border: 1px solid #ffffff0c; transition: border-color .2s,background .2s; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair:hover { border-color: #9c9bff40; background: #9c9bff0d; }
body.dark.memonatra-studio #cardPreviewModal .example-number { position: absolute; left: 12px; top: 15px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #9c9bff18; color: #b9b5ff; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair p { margin: 0 !important; padding: 0 !important; line-height: 1.6; border: 0; border-radius: 0; background: transparent; overflow-wrap: anywhere; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair .en-sentence { align-items: flex-start !important; gap: 10px !important; color: #eaf0ff; font-size: 14px; font-weight: 500; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair .ge-sentence { margin-top: 10px !important; padding-top: 10px !important; border-top: 1px solid #ffffff08; color: #9ba9c2; font-size: 13px; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair .speak-btn { position: static !important; transform: none !important; margin: 0 !important; width: 30px; height: 30px; min-width: 30px; padding: 0 !important; display: grid; place-items: center; border: 1px solid #9c9bff25; border-radius: 9px; background: #9c9bff12; color: #b5c7ff; }
body.dark.memonatra-studio #cardPreviewModal .sentence-pair .speak-btn:hover { background: #9c9bff2a; border-color: #9c9bff66; }
@media (max-width: 700px) {
    body.dark.memonatra-studio #cardPreviewModal { --preview-width: calc(100vw - 32px); padding-bottom: 160px; }
    body.dark.memonatra-studio #cardPreviewModal .preview-modal { width: calc(100vw - 32px); }
    body.dark.memonatra-studio #cardPreviewModal .inside-nav { top: auto; bottom: 104px; transform: none !important; }
    body.dark.memonatra-studio #cardPreviewModal .left-nav { left: 16px; }
    body.dark.memonatra-studio #cardPreviewModal .right-nav { right: 16px; }
    body.dark.memonatra-studio #previewCombinedSentences { grid-template-columns: minmax(0,1fr); }
}

/* The tag drawer separates filtering from maintenance. */
body.dark.memonatra-studio #sidebar { width: min(350px,calc(100vw - 24px)) !important; padding: 20px !important; height: calc(100dvh - 32px) !important; top: 16px !important; bottom: auto !important; border-radius: 18px !important; left: 0 !important; transform: translateX(calc(-100% - 20px)); visibility: hidden; transition: transform .25s ease, visibility .25s; }
body.dark.memonatra-studio #sidebar.active, body.dark.memonatra-studio #sidebar.show { transform: translateX(12px); visibility: visible; }
.studio-tag-tools { flex-shrink: 0; display: grid; grid-template-columns: 1fr; gap: 8px; margin: 12px 0; }
.studio-tag-search { width: 100%; padding: 12px; border: 1px solid #ffffff22; border-radius: 10px; background: #0c1220; color: #eaf0ff; }
.studio-tag-tools button { padding: 8px; color: #bdbaff; background: #9c9bff12; border: 1px solid #9c9bff25; border-radius: 8px; }
.studio-tag-status { font-size: 11px; color: #91a3bf; margin: 0; }
body.dark.memonatra-studio #sidebar:not(.studio-manage-tags) .tag-add-container,
body.dark.memonatra-studio #sidebar:not(.studio-manage-tags) .sidebar-tag-item > button { display: none !important; }
body.dark.memonatra-studio #sidebar .sidebar-tag-item { padding: 10px 12px !important; gap: 8px; margin-bottom: 5px; background: #ffffff03 !important; border: 1px solid #ffffff09; border-left: 3px solid var(--tag-color); min-height: 44px; }
body.dark.memonatra-studio #sidebar .sidebar-tag-item > span:first-child { color: var(--tag-color); font-size: 13px; overflow-wrap: anywhere; }
body.dark.memonatra-studio #sidebar .sidebar-tag-item.active { background: color-mix(in srgb,var(--tag-color, #b9b2d9) 14%,#121827) !important; border-color: color-mix(in srgb,var(--tag-color, #b9b2d9) 55%,transparent) !important; box-shadow: inset 0 0 0 1px #ffffff05 !important; transform: none !important; }
body.dark.memonatra-studio #sidebar .sidebar-tag-item.active > span:first-child::before { content: '✓ '; }
body.dark.memonatra-studio #sidebar .tag-count-badge { background: #ffffff08 !important; color: #b9c9e0 !important; }
body.dark.memonatra-studio .library-item { padding: 14px 16px; gap: 16px; min-height: 60px; }
body.dark.memonatra-studio .library-item-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
body.dark.memonatra-studio .library-actions { flex-shrink: 0; gap: 10px; }
body.dark.memonatra-studio .library-modal { width: min(580px,calc(100vw - 24px)) !important; max-height: calc(100dvh - 40px); overflow-y: auto; }
@media (max-width: 1100px) and (min-width: 701px) {
    body.dark.memonatra-studio .studio-command .top-bar { grid-template-columns: auto minmax(150px,1fr) auto auto auto; }
    body.dark.memonatra-studio .studio-command .search-input-wrapper { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 700px) {
    body.dark.memonatra-studio .studio-command .top-bar { grid-template-columns: minmax(0,1fr) auto auto; padding: 12px !important; gap: 10px !important; }
    body.dark.memonatra-studio .studio-command .app-logo { font-size: 19px !important; grid-column: 1; grid-row: 1; }
    body.dark.memonatra-studio .studio-command .app-logo img { width: 28px; height: 28px; }
    body.dark.memonatra-studio .studio-command .library-selector-wrapper { grid-column: 2; grid-row: 1; max-width: 145px; }
    body.dark.memonatra-studio .studio-command #libraryManagerBtn { gap: 6px !important; padding: 7px 8px !important; }
    body.dark.memonatra-studio .studio-command .library-icon { display: none !important; }
    body.dark.memonatra-studio .studio-command .chevron-wrapper { margin: 0; width: 18px; flex-basis: 18px; }
    body.dark.memonatra-studio .studio-command .add-btn-text { display: inline !important; }
    .studio-welcome { padding: 20px 0; }
    .studio-welcome > div:first-child { display: none; }
    .studio-welcome .studio-summary { gap: 24px; }
    .studio-welcome .studio-summary > div { flex-direction: row; align-items: center; gap: 8px; }
    .studio-welcome .studio-summary span { margin: 0; font-size: 10px; }
    .studio-welcome h2 { font-size: 25px; }
    body.dark.memonatra-studio .studio-compact > .modal { padding: 18px !important; max-height: calc(100dvh - 24px) !important; }
    .studio-tabs button { font-size: 11px; padding: 10px 6px; }
    body.dark.memonatra-studio #cardPreviewModal .preview-modal { padding: 20px !important; max-height: calc(100dvh - 184px); }
    body.dark.memonatra-studio #settingsModal .button-row { grid-template-columns: 1fr; }
}
.studio-chip-field { margin-bottom: 16px; }
.studio-chip-field > label { display: block; color: #a6b4cd; font-size: 12px; font-weight: 600; margin-bottom: 7px; }
.studio-chip-field > label small { color: #7386a4; font-size: 10px; font-weight: 400; margin-left: 6px; }
.studio-chip-box { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-height: 54px; padding: 9px; border-radius: 12px; border: 1px solid #ffffff1c; background: #0c1220; cursor: text; transition: border-color .2s,box-shadow .2s; }
.studio-chip-box:focus-within { border-color: #9c9bff99; box-shadow: 0 0 0 3px #9c9bff0d; }
body.dark.memonatra-studio .studio-chip-box .tags-display { display: contents; }
body.dark.memonatra-studio .studio-chip-box .tags-display > span { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 30px; margin: 0; padding: 5px 9px; border: 1px solid #9c9bff30; border-radius: 8px; background: #9c9bff18 !important; color: #d2ceef !important; opacity: 1 !important; filter: none !important; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
body.dark.memonatra-studio .studio-chip-box input { flex: 1 1 130px; min-width: 90px; width: auto; height: 32px; margin: 0; padding: 3px 5px; background: transparent !important; border: 0 !important; box-shadow: none !important; outline: none; color: #eaf0ff; font-size: 13px; }
.studio-chip-box input::placeholder { color: #637691; }
body.dark.memonatra-studio .studio-chip-box button { flex-shrink: 0; width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid #9c9bff30; background: #9c9bff16; color: #c5bfff; font-size: 18px; }
.studio-chip-box button:hover { background: #9c9bff30; }
.studio-chip-box .tags-display i { cursor: pointer; color: #ada4d4; }
body.dark.memonatra-studio .studio-chip-box .studio-chip-edit { width: auto; height: auto; min-width: 0; flex-shrink: 1; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; overflow-wrap: anywhere; }
body.dark.memonatra-studio .studio-chip-box .tags-display > span.is-editing { border-color: #c4baff; background: #9c9bff30 !important; }
.studio-chip-edit:hover { text-decoration: underline; text-underline-offset: 3px; }
.studio-chip-hint { display: block; margin-top: 7px; color: #7386a4; font-size: 10px; }

/* Real card buttons and a keyboard-accessible deletion confirmation. */
body.dark.memonatra-studio .card-actions { opacity: 1; gap: 6px !important; }
body.dark.memonatra-studio .card-actions .card-action-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #ffffff0e; border-radius: 9px; background: #ffffff03; color: #8f9db5; transition: color .2s,background .2s,border-color .2s,box-shadow .2s; }
body.dark.memonatra-studio .card-actions .card-action-btn i { margin: 0; padding: 0; font-size: 13px; color: inherit; pointer-events: none; }
body.dark.memonatra-studio .card-actions .card-edit-btn:hover,
body.dark.memonatra-studio .card-actions .card-edit-btn:focus-visible { color: #cec9ff; background: #9c9bff20; border-color: #9c9bff60; box-shadow: 0 3px 12px #9c9bff18; }
body.dark.memonatra-studio .card-actions .card-delete-btn:hover,
body.dark.memonatra-studio .card-actions .card-delete-btn:focus-visible { color: #f4b4c6; background: #e785a71a; border-color: #e785a755; box-shadow: 0 3px 12px #e785a715; }
.studio-delete-dialog { width: min(440px,calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 26px; overflow-y: auto; background: #121827; color: #eaf0ff; border: 1px solid #ffffff1c; border-radius: 22px; box-shadow: 0 28px 100px #0009; }
.studio-delete-dialog[open] { animation: studio-reveal .2s ease-out; }
.studio-delete-dialog::backdrop { background: #030611c9; backdrop-filter: blur(10px); }
.studio-delete-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.studio-delete-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: #e785a71a; border: 1px solid #e785a730; color: #f4b4c6; }
.studio-delete-dialog h2 { margin: 0 0 12px; font-size: 23px; letter-spacing: -.5px; }
.studio-delete-word { margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; background: #ffffff04; border: 1px solid #ffffff0c; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
#cardDeleteDescription { margin: 0; color: #99a9c3; font-size: 13px; line-height: 1.7; }
.studio-delete-actions { display: flex; gap: 10px; margin-top: 24px; }
.studio-delete-actions button { flex: 1; min-height: 44px; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 600; }
#cardDeleteCancel { background: #ffffff06; border: 1px solid #ffffff1c; color: #c6d0e5; }
#cardDeleteConfirm { background: #d97596; border: 1px solid #e795af; color: #1c1020; }
#cardDeleteConfirm:hover { background: #e795af; }
#cardDeleteCancel:hover { background: #ffffff0d; }
.studio-delete-actions button:focus-visible { outline: 2px solid #c7bfff; outline-offset: 3px; }
@media (pointer: coarse) {
    body.dark.memonatra-studio .card-actions .card-action-btn { width: 40px; height: 40px; }
}

/* Reminders: compact schedules and touch-friendly repeat/tag choices. */
body.dark.memonatra-studio #notificationsModal > .modal,
body.dark.memonatra-studio #notifAddModal > .modal { width: calc(100vw - 32px); max-width: 720px !important; max-height: min(740px,calc(100dvh - 40px)); height: auto !important; display: flex; flex-direction: column; padding: 24px !important; overflow: hidden; }
body.dark.memonatra-studio #notifAddModal > .modal { max-width: 580px !important; }
body.dark.memonatra-studio #notificationsModal .modal-header,
body.dark.memonatra-studio #notifAddModal .modal-header { flex-shrink: 0; margin-bottom: 16px; }
body.dark.memonatra-studio #notificationsModal .modal-body,
body.dark.memonatra-studio #notifAddModal .modal-body { min-height: 0; overflow-y: auto; padding: 0 4px 0 0; scrollbar-width: thin; scrollbar-color: #9c9bff50 transparent; }
.notif-intro { margin: 0 0 6px; color: #9ba9c2; font-size: 13px; }
.notif-summary { color: #b9b2d9; font-size: 11px; margin: 0 0 16px; }
#notificationListContainer { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
body.dark.memonatra-studio #notificationListContainer .notif-item { margin: 0; padding: 14px; border: 1px solid #9c9bff22; background: linear-gradient(130deg,#9c9bff0c,#ffffff03); border-radius: 14px; min-width: 0; transition: border-color .2s; }
body.dark.memonatra-studio #notificationListContainer .notif-item:hover { border-color: #9c9bff55; }
body.dark.memonatra-studio #notificationListContainer .notif-item.is-paused { background: #ffffff02; border-style: dashed; }
body.dark.memonatra-studio .notif-item-header { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 8px; align-items: center; }
body.dark.memonatra-studio .notif-time { color: #d3d0ff; font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }
body.dark.memonatra-studio .is-paused .notif-time { color: #8491a8; }
body.dark.memonatra-studio .notif-days { grid-column: 1 / -1; grid-row: 2; font-size: 12px; color: #a4b1c8; margin: 0; }
body.dark.memonatra-studio .notif-item-details { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
body.dark.memonatra-studio .notif-item-details span { color: #94a6c0; background: #ffffff04; border-radius: 6px; padding: 4px 6px; font-size: 10px; overflow-wrap: anywhere; }
body.dark.memonatra-studio .notif-edit-btn,
body.dark.memonatra-studio .notif-delete-btn { width: 30px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 8px; background: #ffffff04; color: #adb9d2; border: 1px solid #ffffff08; }
body.dark.memonatra-studio .notif-edit-btn:hover { background: #9c9bff20; color: #d3d0ff; }
body.dark.memonatra-studio .notif-delete-btn:hover { background: #f49cc818; color: #f4aabf; }
body.dark.memonatra-studio .notif-toggle { width: 36px; height: 22px; margin: 0; }
body.dark.memonatra-studio .notif-toggle-slider { background: #ffffff1c; }
body.dark.memonatra-studio .notif-toggle-slider::before { width: 16px; height: 16px; left: 3px; bottom: 3px; }
body.dark.memonatra-studio .notif-toggle input:checked + .notif-toggle-slider { background: #8d87d8; }
body.dark.memonatra-studio .notif-toggle input:checked + .notif-toggle-slider::before { transform: translateX(14px); }
.notif-toggle:focus-within { outline: 2px solid #b9b2d9; outline-offset: 3px; border-radius: 20px; }
body.dark.memonatra-studio #notificationsModal .modal-footer { flex-shrink: 0; padding: 16px 0 0; margin-top: 16px !important; }
body.dark.memonatra-studio #openAddNotificationModalBtn,
body.dark.memonatra-studio #notifSaveBtn { background: linear-gradient(120deg,#b1a5ff,#86bfff) !important; color: #11152b !important; font-weight: 650; border-radius: 10px; min-height: 42px; }
body.dark.memonatra-studio #testNotificationBtn,
body.dark.memonatra-studio #notifCancelBtn { background: #ffffff06 !important; border: 1px solid #ffffff15; color: #bac5dc !important; border-radius: 10px; min-height: 42px; }
body.dark.memonatra-studio .notif-add-form { padding: 0; background: transparent; border: 0; }
body.dark.memonatra-studio .notif-form-row { margin-bottom: 14px; }
body.dark.memonatra-studio .notif-form-row > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 600; color: #b6c2d9; }
body.dark.memonatra-studio .notif-form-row input[type="time"],
body.dark.memonatra-studio .notif-form-row select { width: 100%; min-height: 42px; border-radius: 10px; border: 1px solid #ffffff18; background: #0c1220; color: #eaf0ff; padding: 10px 12px; font-family: inherit; }
body.dark.memonatra-studio #notifTimeInput { font-size: 22px; font-weight: 650; color: #d3d0ff; }
body.dark.memonatra-studio #notifTagSelect[hidden] { display: none !important; }
.notif-day-presets { display: flex; gap: 6px; margin-bottom: 8px; }
body.dark.memonatra-studio .notif-day-presets button { flex: 1; background: #ffffff04; color: #96a7c0; border: 1px solid #ffffff0c; padding: 7px 5px; border-radius: 8px; font-size: 11px; }
body.dark.memonatra-studio .notif-weekdays { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 6px; }
body.dark.memonatra-studio .weekday-btn { width: 100%; min-width: 0; min-height: 36px; padding: 7px 2px; border: 1px solid #ffffff15; border-radius: 9px; background: #ffffff04; color: #95a6c0; font-size: 11px; }
body.dark.memonatra-studio .weekday-btn.active,
body.dark.memonatra-studio .notif-day-presets button[aria-pressed="true"] { color: #d8d3ff; background: #9c9bff22; border-color: #9c9bff66; }
.notif-tag-choices { display: flex; flex-wrap: wrap; gap: 7px; max-height: 120px; overflow-y: auto; padding: 3px; scrollbar-width: thin; }
body.dark.memonatra-studio .notif-tag-choices button { background: #ffffff04; color: #94a6c0; border: 1px solid #ffffff12; border-radius: 9px; padding: 8px 10px; font-size: 11px; }
body.dark.memonatra-studio .notif-tag-choices button[aria-pressed="true"] { background: #9cc9be18; color: #bdded5; border-color: #9cc9be60; }
.notif-optional { font-size: 10px; font-weight: 400; color: #7183a1; margin-left: 5px; }
.notif-preview-summary { background: #9c9bff0b; border: 1px solid #9c9bff20; border-radius: 10px; color: #b4bbdb; font-size: 12px; padding: 12px; margin: 10px 0 14px; }
body.dark.memonatra-studio .notif-form-actions { gap: 10px; margin: 0; }
body.dark.memonatra-studio .notif-empty { grid-column: 1 / -1; text-align: center; padding: 35px 16px; color: #9ba9c2; }
.notif-empty > i { display: block; font-size: 28px; color: #b9b2d9; margin-bottom: 16px; }
.notif-empty > strong { color: #d7dcef; }
#notifDebugInfo:empty { display: none; }
@media (max-width: 600px) {
    #notificationListContainer { grid-template-columns: minmax(0,1fr); }
    body.dark.memonatra-studio #notificationsModal > .modal,
    body.dark.memonatra-studio #notifAddModal > .modal { padding: 18px !important; }
}

/* Speech controls use the existing TTS active state for every voice provider. */
body.dark.memonatra-studio .speak-btn,
body.dark.memonatra-studio #cardPreviewModal .speak-btn {
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease !important;
}
body.dark.memonatra-studio .speak-btn:hover,
body.dark.memonatra-studio .speak-btn:focus-visible,
body.dark.memonatra-studio #cardPreviewModal .speak-btn:hover,
body.dark.memonatra-studio #cardPreviewModal .speak-btn:focus-visible {
    background: linear-gradient(135deg,#9c9bff45,#81bdff35) !important;
    border-color: #b6b3ffb0 !important;
    color: #fff !important;
    box-shadow: 0 4px 18px #9c9bff55, inset 0 0 12px #81bdff18 !important;
    transform: translateY(-2px) scale(1.06) !important;
    outline: 2px solid transparent;
}
body.dark.memonatra-studio .speak-btn.active,
body.dark.memonatra-studio #cardPreviewModal .speak-btn.active {
    background: linear-gradient(135deg,#8275e8,#4785b7) !important;
    border-color: #c7bfff !important;
    color: #fff !important;
    transform: none !important;
    animation: studio-speaker-pulse 1.4s ease-out infinite !important;
}
body.dark.memonatra-studio .speak-btn.active > i,
body.dark.memonatra-studio #cardPreviewModal .speak-btn.active > i {
    animation: studio-speaker-beat .7s ease-in-out infinite alternate;
}
@keyframes studio-speaker-pulse {
    0% { box-shadow: 0 0 0 0 #a49aff70, 0 0 18px #81bdff55; }
    75%,100% { box-shadow: 0 0 0 8px #a49aff00, 0 0 24px #81bdff33; }
}
@keyframes studio-speaker-beat {
    from { transform: scale(.94); }
    to { transform: scale(1.14); }
}
@media (prefers-reduced-motion: reduce) {
    body.dark.memonatra-studio .speak-btn.active,
    body.dark.memonatra-studio #cardPreviewModal .speak-btn.active { animation: none !important; box-shadow: 0 0 16px #a49aff66 !important; }
    body.dark.memonatra-studio .speak-btn.active > i { animation: none !important; }
    .memonatra-studio *, .memonatra-studio *::before, .memonatra-studio *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Shared notifications: one quiet surface, above dialogs and the audio player. */
.memonatra-studio #toastContainer {
    position: fixed; inset: auto 24px calc(24px + env(safe-area-inset-bottom)) auto;
    transform: none; z-index: 30000; width: min(390px, calc(100vw - 32px));
    pointer-events: none; display: block;
}
.memonatra-studio #toastContainer .toast {
    --notice-accent: #aaa3ff;
    display: flex; align-items: flex-start; gap: 12px; width: 100%; max-width: none;
    box-sizing: border-box; padding: 18px; border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--notice-accent) 28%, transparent);
    color: #e9edf8; background: linear-gradient(135deg, #20263bf5, #101725fa);
    box-shadow: 0 18px 55px #0007, inset 0 1px 0 #ffffff09;
    backdrop-filter: blur(18px); pointer-events: auto; font-size: 13px;
    animation: memonatra-notice-in .35s cubic-bezier(.2,.8,.2,1) both;
}
.memonatra-studio #toastContainer .toast.success { --notice-accent: #7de0bf; }
.memonatra-studio #toastContainer .toast.error { --notice-accent: #ffa9b5; }
.memonatra-studio #toastContainer .notice-icon {
    display: grid; place-items: center; flex: 0 0 34px; height: 34px;
    border-radius: 11px; font-size: 20px; font-weight: 700;
    background: color-mix(in srgb, var(--notice-accent) 14%, transparent); color: var(--notice-accent);
}
.memonatra-studio #toastContainer .notice-body { flex: 1; min-width: 0; }
.memonatra-studio #toastContainer .notice-body strong { display: block; color: #f4f5ff; font-size: 13px; line-height: 1.5; margin-bottom: 4px; }
.memonatra-studio #toastContainer .notice-body > span { display: block; color: #b7c1d8; line-height: 1.65; overflow-wrap: anywhere; }
.memonatra-studio #toastContainer .notice-close {
    display: grid; place-items: center; flex: 0 0 28px; height: 28px; padding: 0;
    border: 0; border-radius: 8px; background: #ffffff06; color: #aab6ce; font-size: 22px; cursor: pointer;
}
.memonatra-studio #toastContainer .notice-close:hover { color: #fff; background: #ffffff14; }
.memonatra-studio #toastContainer .notice-action {
    margin-top: 10px; padding: 7px 12px; border-radius: 8px; border: 1px solid #ffa9b533;
    background: #ffa9b510; color: #ffd6de; cursor: pointer;
}
.memonatra-studio #toastContainer progress { display: block; width: 100%; height: 6px; margin-top: 12px; border: 0; border-radius: 8px; overflow: hidden; accent-color: var(--notice-accent); }
.memonatra-studio #toastContainer progress::-webkit-progress-bar { background: #ffffff0d; border-radius: 8px; }
.memonatra-studio #toastContainer progress::-webkit-progress-value { background: linear-gradient(90deg, #8d82ef, #8dcced); border-radius: 8px; transition: width .2s; }
.memonatra-studio #toastContainer progress::-moz-progress-bar { background: #aaa3ff; border-radius: 8px; }
.memonatra-studio #toastContainer .toast.is-leaving { animation: memonatra-notice-out .25s ease both !important; }
@keyframes memonatra-notice-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes memonatra-notice-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }
@media (max-width: 600px) { .memonatra-studio #toastContainer { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { .memonatra-studio #toastContainer .toast { animation-duration: .01ms !important; } }
/* Horizontal cards carry their learning progress as a quiet liquid fill. */
body.dark.memonatra-studio .card-container.list-view .card {
    position: relative; isolation: isolate; overflow: hidden;
}
body.dark.memonatra-studio .card-container.list-view .progress-bar-container {
    position: absolute; inset: 0 !important; width: 100% !important; height: 100% !important;
    margin: 0 !important; padding: 0; transform: none !important; border: 0; border-radius: inherit;
    grid-column: auto !important; grid-row: auto !important; display: block;
    background: transparent; overflow: hidden; pointer-events: none; z-index: -1;
}
body.dark.memonatra-studio .card-container.list-view .progress-bar {
    display: block; position: relative; height: 100%; max-width: 100%; min-width: 0;
    border-radius: 0; background-color: transparent !important;
    opacity: .85;
    background-image: linear-gradient(100deg, #9c9bff04, #79cfe91a);
    box-shadow: inset -1px 0 0 #a0e5ef24; transition: width .8s cubic-bezier(.22,.7,.2,1);
}
body.dark.memonatra-studio .card-container.list-view .progress-bar::after {
    content: ''; position: absolute; top: -50%; right: -8px; width: 16px; height: 200%;
    border-radius: 45%; background: #9ddded10; box-shadow: 0 0 18px #90ddeb12;
    animation: studio-liquid-drift 6s ease-in-out infinite alternate;
}
body.dark.memonatra-studio .card-container.list-view .progress-bar[style*="width: 0%"]::after { display: none; }
body.dark.memonatra-studio .card-container.list-view .progress-label {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; background: none;
}
body.dark.memonatra-studio .card-container.list-view .card.mastered .progress-bar {
    background-image: linear-gradient(100deg, #7de0bf08, #7de0bf20);
}
@media (min-width: 901px) {
    body.dark.memonatra-studio .card-container.list-view { grid-template-columns: minmax(100px, max-content) minmax(150px, 1fr) auto max-content; }
    body.dark.memonatra-studio .card-container.list-view .card { grid-template-columns: minmax(150px, max-content) minmax(150px, 1fr) auto max-content; column-gap: 20px; }
    body.dark.memonatra-studio .card-container.list-view .card-actions { grid-column: 4; }
    @supports (grid-template-columns: subgrid) {
        body.dark.memonatra-studio .card-container.list-view .card { grid-template-columns: subgrid; }
    }
}
@keyframes studio-liquid-drift { from { transform: translateX(-3px) rotate(-5deg); } to { transform: translateX(3px) rotate(5deg); } }
@media (prefers-reduced-motion: reduce) {
    body.dark.memonatra-studio .card-container.list-view .progress-bar { transition: none; }
    body.dark.memonatra-studio .card-container.list-view .progress-bar::after { animation: none; }
}
/* Fullscreen mobile word detail: only examples scroll; playback floats above it. */
@media (max-width: 700px) {
    body.dark.memonatra-studio #cardPreviewModal {
        box-sizing: border-box; height: 100dvh; width: 100%; overflow: hidden;
        align-items: stretch !important; padding: 0;
    }
    body.dark.memonatra-studio #cardPreviewModal .preview-modal {
        box-sizing: border-box; width: 100% !important; max-width: 100% !important;
        height: 100dvh !important; max-height: 100dvh !important; margin: 0;
        padding: calc(18px + env(safe-area-inset-top)) 18px 0 !important;
        border-radius: 0 !important; display: flex !important; flex-direction: column;
        overflow: hidden;
    }
    body.dark.memonatra-studio #cardPreviewModal .preview-sticky { flex: 0 0 auto; }
    body.dark.memonatra-studio #cardPreviewModal .sentence-preview {
        box-sizing: border-box; flex: 1 1 0; min-height: 0; max-height: none; height: auto;
        overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
        padding: 16px 0 calc(100px + env(safe-area-inset-bottom)) !important;
        margin-top: 18px !important; scrollbar-width: thin; scrollbar-color: #9c9bff40 transparent;
    }
    body.dark.memonatra-studio #cardPreviewModal #previewWord { font-size: 26px; }
    body.dark.memonatra-studio #cardPreviewModal #previewMnemonic { padding: 12px; }
    body.dark.memonatra-studio #cardPreviewModal .inside-nav { display: none !important; }
}
/* Keep selected tags legible inside the horizontal row's clipped tag area. */
body.dark.memonatra-studio .card-container.list-view .card .tags {
    padding: 3px; margin-left: -3px;
}
body.dark.memonatra-studio .card-container.list-view .card .tags .card-tag.filtered {
    outline: none; opacity: 1 !important; font-weight: 750;
    color: color-mix(in srgb, var(--tag-color, #b9b2d9) 45%, #fff) !important;
    background-color: color-mix(in srgb, var(--tag-color, #b9b2d9) 32%, #151d2b) !important;
    border-color: color-mix(in srgb, var(--tag-color, #b9b2d9) 72%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-color, #b9b2d9) 20%, transparent), 0 0 8px #ffffff08;
}
body.dark.memonatra-studio .card-container.list-view .card .tags .card-tag.filtered::before {
    color: #f0f5ff; font-size: 12px;
}
/* The reminder editor must sit above its parent list on every screen size. */
body.memonatra-studio #notificationsModal { z-index: 10000 !important; }
body.memonatra-studio #notifAddModal { z-index: 10010 !important; }
/* Prevent native text selection/callouts from stealing a card hold on touchscreens. */
@media (pointer: coarse) {
    body.memonatra-studio .card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: pan-y pinch-zoom; }
}
.explanation-language-label { display: block; margin: 12px 0 7px; font-size: 12px; color: #b8c5dd; }
.explanation-hint { font-size: 11px; color: #8594ae; line-height: 1.5; margin: 8px 0 0; }
.explanation-heading { display: block; margin-bottom: 6px; color: #c8c1ef; font-size: 11px; letter-spacing: .5px; }
#previewMnemonic > div { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Tag suggestions stay attached to the unified chip field. */
body.dark.memonatra-studio .studio-tag-chip-field { position: relative; display: block; }
body.dark.memonatra-studio .studio-tag-chip-field #tagDropdown { position: absolute; top: calc(100% - 20px); left: 0; right: 0; width: 100%; box-sizing: border-box; z-index: 10; max-height: 180px; overflow-y: auto; border-radius: 12px; background: #192134; border: 1px solid #9c9bff30; box-shadow: 0 12px 28px #0005; }

/* Learning statistics: calm metrics and a clear switch between volume and accuracy. */
body.memonatra-studio #statsModal .modal { width: min(680px,calc(100vw - 24px)); max-width: 680px !important; border-radius: 24px; }
#statsModal .modal-header h2 { display: flex; align-items: center; gap: 12px; }
#statsModal .modal-header h2 i { color: #a9b9ff; font-size: 20px; }
#statsModal .stats-grid { gap: 12px; margin-bottom: 20px; }
body.memonatra-studio #statsModal .stat-card { padding: 18px; background: linear-gradient(140deg,#ffffff05,#ffffff01); border-color: #ffffff0e; border-radius: 16px; }
#statsModal .stat-card:nth-child(1) .stat-icon,#statsModal #statsMastered { color: #8bd7b6; }
#statsModal .stat-card:nth-child(2) .stat-icon { color: #b5a9ed; }
#statsModal .stat-card:nth-child(3) .stat-icon { color: #97b9ed; }
#statsModal .stat-card:nth-child(4) .stat-icon { color: #e8c292; }
#statsModal .stat-label { color: #91a2bd; font-size: 10px; letter-spacing: 1px; }
#statsModal .stat-value { color: #e0e8fb; font-size: 25px; letter-spacing: -.5px; }
body.memonatra-studio #statsModal .stats-chart-section { padding: 18px; background: #09112066; border: 1px solid #ffffff10; border-radius: 18px; }
#statsModal .chart-controls { width: fit-content; gap: 4px; padding: 4px; margin: 0 auto 20px; border: 1px solid #ffffff0b; border-radius: 12px; background: #ffffff03; }
body.memonatra-studio #statsModal .chart-btn { border-radius: 9px; background: transparent; color: #93a5c0; padding: 8px 20px; }
body.memonatra-studio #statsModal .chart-btn.active { background: #a9b9ff22; color: #d5deff; box-shadow: inset 0 0 0 1px #a9b9ff33; }
#statsModal .stats-view-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; color: #d1dcf0; font-size: 13px; font-weight: 600; }
#statsModal .stats-view-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: #b3c1d8; cursor: pointer; padding: 8px 10px; border-radius: 10px; border: 1px solid #ffffff12; background: #ffffff03; }
#statsModal .stats-view-toggle:has(input:checked) { border-color: #8bd7b655; background: #8bd7b60b; color: #b6e6cf; }
#statsModal .stats-view-toggle input { margin: 0; width: 16px; height: 16px; accent-color: #8bd7b6; }
#statsModal .stats-period-summary { font-size: 11px; line-height: 1.6; color: #8ea1bd; margin: 10px 0 18px; }
#statsModal .chart-container { position: relative; height: 260px; }
#statsModal .stats-chart-note { color: #7286a3; font-size: 10px; line-height: 1.6; margin: 12px 0 0; }
#statsModal #statsCorrectWrong { font-size: 11px !important; line-height: 1.7; }
body.memonatra-studio #statsModal #resetStatsBtn { background: #e39aac0c !important; border: 1px solid #e39aac33 !important; color: #e4a6b6 !important; font-size: 12px; }
@media(max-width:640px) {
    #statsModal .stats-chart-section { padding: 14px !important; }
    #statsModal .stats-view-controls { align-items: flex-start; }
    #statsModal .chart-container { height: 230px; }
    #statsModal .stat-card { padding: 14px !important; }
    #statsModal .stat-value { font-size: 22px; }
}

#statsModal #statsMastered::after { content: none; }

#previewMnemonic > .explanation-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; white-space: normal; }
#previewMnemonic .explanation-heading { margin-bottom: 0; }
body.memonatra-studio #previewMnemonic .explanation-speak-btn { flex: 0 0 auto; width: 36px; height: 32px; margin: 0; }
#previewMnemonic .explanation-speak-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Explanation speech stays a quiet icon, without the standard button treatment. */
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn,
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn:is(:hover,:focus-visible,.active) {
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    color: #8c9ab5 !important; transform: none !important; animation: none !important;
}
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn > i {
    color: inherit !important; margin: 0 !important; font-size: 15px;
    animation: none !important; transform: none !important;
}
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn:hover,
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn.active { color: #b6c4dc !important; }
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn:focus-visible { outline: 1px solid #8c9ab5 !important; outline-offset: 2px; }

/* Example and explanation controls share a quiet icon and a distinct reading state. */
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn,
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn:is(:hover,:focus-visible,.active) {
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    color: #8c9ab5 !important; transform: none !important; animation: none !important;
    width: 36px; min-width: 36px; height: 32px; padding: 0 !important;
}
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn > i {
    color: inherit !important; margin: 0 !important; font-size: 15px;
    animation: none !important; transform: none !important;
}
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn:hover { color: #b6c4dc !important; }
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn:focus-visible { outline: 1px solid #8c9ab5 !important; outline-offset: 2px; }
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn.active,
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn.active { color: #c1dcf2 !important; }
body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn.active > i,
body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn.active > i { animation: studio-quiet-speaking 1.2s ease-in-out infinite !important; }
@keyframes studio-quiet-speaking {
    0%,100% { opacity: .65; transform: scale(.96); filter: drop-shadow(0 0 0 transparent); }
    50% { opacity: 1; transform: scale(1.1); filter: drop-shadow(0 0 5px #9ecaf066); }
}
@media (prefers-reduced-motion: reduce) {
    body.dark.memonatra-studio #cardPreviewModal #previewMnemonic .explanation-speak-btn.active > i,
    body.dark.memonatra-studio #cardPreviewModal #previewCombinedSentences .sentence-pair .speak-btn.active > i { animation: none !important; opacity: 1; }
}

/* Put the word first; keep timestamps quiet at the bottom edge. */
body.dark.memonatra-studio #cardPreviewModal #previewWord { font-size: clamp(38px,4.8vw,64px) !important; line-height: 1.08 !important; letter-spacing: -1.5px; overflow-wrap: anywhere; }
body.dark.memonatra-studio #cardPreviewModal .preview-sticky > hr { margin: 18px 0 12px; }
@media(max-width:700px) {
    body.dark.memonatra-studio #cardPreviewModal #previewWord { font-size: clamp(30px,8vw,44px) !important; letter-spacing: -.8px; }
}

#modalOverlay .word-editor-heading { min-width: 0; flex: 1; }
#modalOverlay #wordEditorTitle { overflow-wrap: break-word; word-break: normal; text-wrap: balance; margin: 0; }
#modalOverlay #wordEditorTitle[data-length="long"] { font-size: .8em; }
#modalOverlay #wordEditorTitle[data-length="xlong"] { font-size: .66em; line-height: 1.25; }
#modalOverlay #wordEditorDate { margin-top: 6px; font-size: 11px; line-height: 1.5; color: #7e8da7; }
#modalOverlay #wordEditorDate[hidden] { display: none; }

@media(max-width:600px) { body.memonatra-studio .auth-container { padding: 16px; overflow-y: auto; align-items: flex-start; } }
/* Account row (shared account button) and Sign out in the More menu */
body.dark.memonatra-studio .studio-account-menu #accountBtn .zk-acc-label { font-weight: 600; }
body.dark.memonatra-studio .studio-account-menu #accountBtn:not(.zk-acc-signed-in) { display: none !important; }
body.dark.memonatra-studio .studio-account-menu .studio-sign-out { margin-top: 6px; color: #f3a7b8 !important; }
/* Skeleton cards while the words load: same grid as the cards, a soft light passing over them */
.memonatra-studio .studio-skeleton { display: none; width: calc(100% - 64px); max-width: 1480px; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 18px; padding: 24px 0; }
body.memonatra-loading .studio-skeleton { display: grid; }
body.memonatra-loading #studioEmpty, body.memonatra-loading #cardContainer { display: none !important; }
.studio-skeleton-card { height: 190px; padding: 24px; border-radius: 18px; background: #ffffff06; border: 1px solid #ffffff0d; position: relative; overflow: hidden; }
.studio-skeleton-card i { display: block; height: 12px; margin-bottom: 14px; border-radius: 6px; background: #ffffff0d; }
.studio-skeleton-card i:nth-child(1) { width: 55%; height: 20px; margin-bottom: 22px; }
.studio-skeleton-card i:nth-child(2) { width: 80%; }
.studio-skeleton-card i:nth-child(3) { width: 65%; }
.studio-skeleton-card i:nth-child(4) { width: 35%; margin-top: 34px; }
.studio-skeleton-card::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(100deg, transparent 20%, #b1a5ff12 50%, transparent 80%); animation: studio-shimmer 1.5s ease-in-out infinite; }
@keyframes studio-shimmer { to { transform: translateX(100%); } }
@media (max-width: 768px) { .memonatra-studio .studio-skeleton { width: calc(100% - 32px); grid-template-columns: 1fr; gap: 12px; } .studio-skeleton-card:nth-child(n+4) { display: none; } }
@media (prefers-reduced-motion: reduce) { .studio-skeleton-card::after { animation: none; } }
/* The skeleton fades away instead of vanishing */
.memonatra-studio .studio-skeleton { animation: studio-reveal .3s ease-out both; }

/* Reader's allowance (200 words, 8 tags): two thin meters beside the word counts. */
.studio-summary > .studio-allowance { min-width: 190px; gap: 7px; justify-content: center; }
.studio-allowance[hidden] { display: none !important; }
.studio-allowance-row { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; }
.studio-summary .studio-allowance-row span { margin: 0; font-size: 11px; color: #9ba9c2; }
.studio-allowance-row i { display: block; height: 5px; border-radius: 3px; background: #ffffff12; overflow: hidden; position: relative; }
.studio-allowance-row i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--w, 0) * 1%); border-radius: inherit; background: linear-gradient(120deg, #b1a5ff, #86bfff); transition: width .5s ease; }
.studio-allowance-row.is-full i::after { background: linear-gradient(120deg, #ff9a8b, #ff6f91); }
.studio-allowance-row b { font: 500 12px/1 'Outfit', sans-serif; color: #dae3ff; font-variant-numeric: tabular-nums; }
.studio-allowance p { margin: 2px 0 0; font-size: 11px; color: #8ee4c5; }
.studio-allowance .studio-allowance-row.is-full ~ p { color: #ffb4a8; }
@media (max-width: 700px) {
    .studio-welcome .studio-summary { flex-wrap: wrap; }
    .studio-welcome .studio-summary > .studio-allowance { flex-direction: column; align-items: stretch; flex-basis: 100%; padding-left: 0; border-left: 0; padding-top: 12px; border-top: 1px solid #ffffff13; }
}
.studio-allowance p.is-full { color: #ffb4a8; }

/* Profile button in place of "More": the reader's photo or initial, with a small caret. */
.studio-account > summary.studio-profile { padding: 4px 10px 4px 4px; gap: 6px; border-radius: 999px; min-height: 44px; }
.studio-profile-face { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; background: linear-gradient(120deg, #b1a5ff, #86bfff); color: #11152c; font: 600 15px/1 'Outfit', sans-serif; box-shadow: 0 0 0 2px #0f1426, 0 0 0 3px #9c9bff55; }
.studio-profile-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.studio-profile-name { display: none; }
.studio-account[open] > summary.studio-profile .studio-profile-face { box-shadow: 0 0 0 2px #0f1426, 0 0 0 3px #b1a5ff; }
body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account > summary.studio-profile { justify-content: flex-start !important; padding: 6px 12px 6px 6px !important; }
body.dark.memonatra-studio .studio-command.mobile-expanded .studio-profile-name { display: inline; flex: 1; text-align: left; }
/* Profile button: one even circle (the caret made it lopsided). */
.studio-account > summary.studio-profile { width: 44px; height: 44px; min-height: 44px; padding: 0; gap: 0; justify-content: center; border-radius: 50%; }
.studio-account > summary.studio-profile::after { content: none; }
.studio-profile-face { width: 36px; height: 36px; box-shadow: none; }
.studio-account[open] > summary.studio-profile { border-color: #b1a5ff; }
.studio-account[open] > summary.studio-profile .studio-profile-face { box-shadow: none; }
body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account > summary.studio-profile { width: 100% !important; height: auto !important; border-radius: 10px !important; gap: 10px !important; }
/* Smoother photo edge: the image is rounded itself, on a dark ring instead of a bordered box. */
.studio-account > summary.studio-profile { border-color: transparent; background: transparent; }
.studio-account > summary.studio-profile:hover, .studio-account > summary.studio-profile:focus-visible { background: #9c9bff14; border-color: transparent; }
.studio-profile-face { width: 38px; height: 38px; background: #0f1426; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16); }
.studio-profile-face:not(:has(img)) { background: linear-gradient(120deg, #b1a5ff, #86bfff); }
.studio-profile-face img { border-radius: 50%; transform: translateZ(0); }
.studio-account[open] > summary.studio-profile { border-color: transparent; background: #9c9bff18; }
.studio-account[open] > summary.studio-profile .studio-profile-face { box-shadow: 0 0 0 2px #b1a5ff; }

/* Phones: the profile sits in the top bar next to the controls toggle, its menu drops below it. */
@media (max-width: 820px) {
    /* Fixed toggle and photo tracks, and an add button that may shrink: a longer label (Georgian)
       in the open panel must not widen the columns and shift the top row. */
    body.dark.memonatra-studio .studio-command .top-bar { grid-template-columns: minmax(0, 1fr) auto 36px 38px !important; }
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn { min-width: 0 !important; contain: inline-size; padding-left: 12px !important; padding-right: 12px !important; }
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn .add-btn-text { white-space: normal !important; line-height: 1.15; text-align: left; font-size: 16px; }
    body.dark.memonatra-studio .studio-command .app-logo { grid-column: 1 !important; grid-row: 1 !important; }
    body.dark.memonatra-studio .studio-command .library-selector-wrapper { grid-column: 2 !important; grid-row: 1 !important; }
    body.dark.memonatra-studio .studio-command .studio-mobile-toggle { grid-column: 3 !important; grid-row: 1 !important; }
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn { grid-column: 2 / -1 !important; }
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) .studio-account,
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account {
        display: block !important; grid-column: 4 !important; grid-row: 1 !important; width: auto !important; margin: 0 !important;
    }
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) .studio-account > summary.studio-profile,
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account > summary.studio-profile {
        width: 38px !important; height: 38px !important; min-height: 38px !important; padding: 0 !important;
        border: 0 !important; border-radius: 50% !important; background: transparent !important; justify-content: center !important;
    }
    body.dark.memonatra-studio .studio-command .studio-profile-face { width: 34px; height: 34px; font-size: 14px; }
    body.dark.memonatra-studio .studio-command .studio-profile-name { display: none !important; }
    body.dark.memonatra-studio .studio-command:not(.mobile-expanded) .studio-account-menu,
    body.dark.memonatra-studio .studio-command.mobile-expanded .studio-account-menu {
        position: absolute !important; top: calc(100% + 12px) !important; right: 0 !important; width: min(290px, calc(100vw - 24px)) !important;
        margin: 0 !important; box-shadow: 0 20px 60px #000a !important; border: 1px solid #ffffff22 !important; border-radius: 16px !important;
    }
}
/* Desktop: photo and first name together in one balanced pill. */
@media (min-width: 821px) {
    .studio-account > summary.studio-profile { width: auto; height: 44px; padding: 0 16px 0 3px; gap: 10px; border-radius: 999px; border: 1px solid #ffffff1c; }
    .studio-account > summary.studio-profile:hover, .studio-account > summary.studio-profile:focus-visible { border-color: #9c9bff66; }
    .studio-account[open] > summary.studio-profile { border-color: #9c9bff66; }
    .studio-profile-name { display: inline; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dae3ff; font-size: 13.5px; font-weight: 500; }
}
/* Desktop profile without an outline: just the photo and name. */
@media (min-width: 821px) {
    .studio-account > summary.studio-profile,
    .studio-account > summary.studio-profile:hover,
    .studio-account > summary.studio-profile:focus-visible,
    .studio-account[open] > summary.studio-profile { border-color: transparent; }
    .studio-account > summary.studio-profile:hover .studio-profile-name,
    .studio-account[open] > summary.studio-profile .studio-profile-name { color: #fff; }
}
/* Phones: the controls drop in with a soft spring wobble, one after another; the profile menu
   pops the same way. Off for people who ask for less motion. */
@keyframes studio-wobble-in {
    0% { opacity: 0; transform: translateY(-10px) scale(.96) rotate(-1deg); }
    55% { opacity: 1; transform: translateY(3px) scale(1.015) rotate(.6deg); }
    75% { transform: translateY(-1px) scale(.998) rotate(-.3deg); }
    100% { opacity: 1; transform: none; }
}
@keyframes studio-menu-pop {
    0% { opacity: 0; transform: translateY(-8px) scale(.92); }
    55% { opacity: 1; transform: translateY(2px) scale(1.02); }
    78% { transform: translateY(-1px) scale(.995); }
    100% { opacity: 1; transform: none; }
}
@media (max-width: 820px) and (prefers-reduced-motion: no-preference) {
    body.dark.memonatra-studio .studio-command.mobile-expanded .search-input-wrapper,
    body.dark.memonatra-studio .studio-command.mobile-expanded #trainingBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded .card-toolbar {
        animation: studio-wobble-in .55s cubic-bezier(.25, .9, .3, 1) both;
        transform-origin: top center;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded #trainingBtn { animation-delay: .05s; }
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn { animation-delay: .09s; }
    body.dark.memonatra-studio .studio-command.mobile-expanded .card-toolbar { animation-delay: .13s; }
    body.dark.memonatra-studio .studio-mobile-toggle i { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
    body.dark.memonatra-studio .studio-command .studio-account[open] .studio-account-menu {
        animation: studio-menu-pop .45s cubic-bezier(.25, .9, .3, 1) both;
        transform-origin: top right;
    }
}
/* The controls slide down together as one sheet with a soft settle, not piece by piece. */
@keyframes studio-sheet-down {
    0% { opacity: 0; transform: translateY(-18px); }
    60% { opacity: 1; transform: translateY(3px); }
    80% { transform: translateY(-1px); }
    100% { opacity: 1; transform: none; }
}
@media (max-width: 820px) and (prefers-reduced-motion: no-preference) {
    body.dark.memonatra-studio .studio-command.mobile-expanded .search-input-wrapper,
    body.dark.memonatra-studio .studio-command.mobile-expanded #trainingBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded .card-toolbar {
        animation: studio-sheet-down .5s cubic-bezier(.22, .9, .3, 1) both;
        animation-delay: 0s;
    }
}@keyframes studio-header-open {
    0% { clip-path: inset(0 0 calc(100% - 64px) 0 round 18px); }
    100% { clip-path: inset(0 0 0 0 round 18px); }
}
@media (max-width: 820px) and (prefers-reduced-motion: no-preference) {
    /* The bar itself grows downward with them, so the whole panel reads as one swipe. */
    body.dark.memonatra-studio .header-wrapper.studio-command.mobile-expanded { animation: studio-header-open .42s cubic-bezier(.22, .9, .3, 1); }
}
/* Open: the bar's shape grows from its one-row height; close: it shrinks back while the controls
   slide up and fade (studio.js keeps them until then). */
@keyframes studio-header-open {
    0% { clip-path: inset(0 0 calc(100% - 66px) 0 round 20px); }
    100% { clip-path: inset(0 0 0 0 round 20px); }
}
@keyframes studio-header-close {
    0% { clip-path: inset(0 0 0 0 round 20px); }
    100% { clip-path: inset(0 0 calc(100% - 66px) 0 round 20px); }
}
@keyframes studio-sheet-up {
    0% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: translateY(-16px); }
}
@media (max-width: 820px) and (prefers-reduced-motion: no-preference) {
    body.dark.memonatra-studio .header-wrapper.studio-command.mobile-expanded { animation: studio-header-open .45s cubic-bezier(.22, .9, .3, 1); }
    body.dark.memonatra-studio .header-wrapper.studio-command.mobile-expanded.studio-collapsing { animation: studio-header-close .32s cubic-bezier(.4, 0, .2, 1) forwards; }
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing .search-input-wrapper,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing #trainingBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing #addCardBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing .card-toolbar {
        animation: studio-sheet-up .26s cubic-bezier(.4, 0, 1, 1) forwards;
    }
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing .studio-mobile-toggle i { transform: none; }
}
/* The bar's height now animates in studio.js; the clip-path shape animation is not needed. */
@media (max-width: 820px) {
    body.dark.memonatra-studio .header-wrapper.studio-command.mobile-expanded,
    body.dark.memonatra-studio .header-wrapper.studio-command.mobile-expanded.studio-collapsing { animation: none; }
}
/* The bar and its controls move as one: no per-control slide or wobble, the growing bar simply
   reveals them (and hides them when closing). */
@media (max-width: 820px) {
    body.dark.memonatra-studio .studio-command.mobile-expanded .search-input-wrapper,
    body.dark.memonatra-studio .studio-command.mobile-expanded #trainingBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded #addCardBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded .card-toolbar,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing .search-input-wrapper,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing #trainingBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing #addCardBtn,
    body.dark.memonatra-studio .studio-command.mobile-expanded.studio-collapsing .card-toolbar { animation: none !important; }
    body.dark.memonatra-studio .studio-mobile-toggle i { transition: transform .38s cubic-bezier(.4, 0, .2, 1) !important; }
}

/* The app's logo text matches the sign-in screen: bold, "Memo" in the gradient, "natry" lilac. */
body.dark.memonatra-studio .app-logo .memo-name { color: #b7b7ff; font-weight: 700; letter-spacing: -1px; -webkit-text-fill-color: currentColor; }

/* Phones: a long list name replaces the logo text so the languages show in full. */
@media (max-width: 700px) {
    body.dark.memonatra-studio .studio-command.studio-long-library .app-logo .memo-name { display: none; }
    body.dark.memonatra-studio .studio-command.studio-long-library .library-selector-wrapper { max-width: none !important; justify-self: start; }
    body.dark.memonatra-studio .studio-command.studio-long-library .top-bar { grid-template-columns: auto minmax(0, 1fr) auto auto !important; }
}
/* While the bar's height animates, its contents stay inside it (the old header rule forces
   overflow: visible with !important, so a class is needed to win). */
body.dark.memonatra-studio .header-wrapper.studio-command.studio-animating { overflow: clip !important; }
/* Generate with AI (owner only for now): one line above Quick Import. */
.memonatra-ai { display: flex; gap: 8px; margin-bottom: 14px; }
.memonatra-ai[hidden] { display: none; }
.memonatra-ai input { flex: 1; min-width: 0; }
.memonatra-ai button { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 42px; border: 0; border-radius: 12px; cursor: pointer; font: 600 13px/1 'Outfit', sans-serif; color: #11152c; background: linear-gradient(120deg, #b1a5ff, #86bfff); transition: opacity .2s, transform .2s; }
.memonatra-ai button:hover { transform: translateY(-1px); }
.memonatra-ai button:disabled { opacity: .6; cursor: progress; transform: none; }
.memonatra-ai button.is-busy i { animation: memonatra-ai-spin 1s linear infinite; }
@keyframes memonatra-ai-spin { to { transform: rotate(360deg); } }
@media (max-width: 520px) { .memonatra-ai button span { display: none; } .memonatra-ai button { padding: 0 14px; } }
.memonatra-ai select { flex: none; min-height: 42px; padding: 0 10px; border-radius: 12px; border: 1px solid #ffffff1c; background: #ffffff08; color: #dae3ff; font: 500 13px/1 'Outfit', sans-serif; cursor: pointer; }
.memonatra-ai select option { background: #182033; color: #dae3ff; }

/* ---- Generate with AI, redesigned: one glowing bar (icon, field, button), model chips for the
   owner, a rainbow "thinking" border, a soft pop when the word arrives. ---- */
@property --ai-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.memonatra-ai { display: block; margin-bottom: 16px; }
.memonatra-ai[hidden] { display: none; }
.memonatra-ai-main {
    display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border-radius: 16px; border: 1px solid transparent;
    background: linear-gradient(#141b2e, #141b2e) padding-box, linear-gradient(120deg, #b1a5ff66, #86bfff44, #8ee4c533) border-box;
    transition: box-shadow .25s ease;
}
.memonatra-ai-main:focus-within {
    background: linear-gradient(#141b2e, #141b2e) padding-box, linear-gradient(120deg, #b1a5ff, #86bfff, #8ee4c5) border-box;
    box-shadow: 0 0 0 4px #9c9bff1c, 0 10px 30px #6f7dff1f;
}
.memonatra-ai-icon { flex: none; color: #b1a5ff; font-size: 15px; }
body.dark.memonatra-studio .memonatra-ai input {
    flex: 1; min-width: 0; height: 40px; margin: 0; padding: 0 !important; border: 0 !important; outline: 0 !important;
    background: transparent !important; box-shadow: none !important; color: #eef2ff; font-size: 14px;
}
body.dark.memonatra-studio .memonatra-ai input::placeholder { color: #7f8cab; }
.memonatra-ai .memonatra-ai-main button {
    flex: none; height: 40px; min-height: 40px; padding: 0 18px; border-radius: 12px; display: inline-flex; align-items: center;
    background: linear-gradient(120deg, #b1a5ff, #86bfff, #b1a5ff); background-size: 200% 100%; color: #11152c;
    font: 600 13.5px/1 'Outfit', sans-serif; letter-spacing: .1px; white-space: nowrap;
    box-shadow: 0 6px 18px #8f8bff33; transition: transform .18s ease, box-shadow .2s ease, background-position .6s ease, opacity .2s;
}
.memonatra-ai .memonatra-ai-main button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px #8f8bff4d; background-position: 100% 0; }
.memonatra-ai .memonatra-ai-main button:active { transform: scale(.97); }
.memonatra-ai .memonatra-ai-main button:disabled { cursor: default; transform: none; }
.memonatra-ai.is-spent .memonatra-ai-main button { background: #ffffff0f; color: #8d97ad; box-shadow: none; }
.memonatra-ai .memonatra-ai-main button span { display: inline !important; }

/* Model chips (owner only) */
.memonatra-ai-models { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 0 4px; }
.memonatra-ai-models[hidden] { display: none; }
.memonatra-ai .memonatra-ai-models button {
    min-height: 0; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid #ffffff1a; background: #ffffff06; color: #9ba9c2;
    font: 500 12px/1 'Outfit', sans-serif; box-shadow: none; transform: none; cursor: pointer; transition: all .2s ease;
}
.memonatra-ai .memonatra-ai-models button:hover { color: #dae3ff; border-color: #9c9bff66; }
.memonatra-ai .memonatra-ai-models button.is-on { color: #f3f5ff; border-color: #9c9bff99; background: linear-gradient(120deg, #b1a5ff2e, #86bfff24); }

/* Thinking: the border turns into a slowly orbiting rainbow, the wand twinkles, the button shimmers. */
@keyframes ai-orbit { to { --ai-angle: 360deg; } }
@keyframes ai-twinkle { from { transform: rotate(-12deg) scale(.9); opacity: .7; } to { transform: rotate(12deg) scale(1.15); opacity: 1; } }
@keyframes ai-shimmer { from { background-position: 0 0; } to { background-position: 200% 0; } }
@keyframes ai-pop { 0% { box-shadow: 0 0 0 0 #8ee4c566; } 40% { transform: scale(1.012); box-shadow: 0 0 0 8px #8ee4c51f; } 100% { transform: none; box-shadow: 0 0 0 14px #8ee4c500; } }
@keyframes ai-nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.memonatra-ai.is-thinking .memonatra-ai-main {
    background: linear-gradient(#141b2e, #141b2e) padding-box, conic-gradient(from var(--ai-angle), #b1a5ff, #86bfff, #8ee4c5, #ffb4d9, #b1a5ff) border-box;
    animation: ai-orbit 1.6s linear infinite; box-shadow: 0 0 0 4px #9c9bff14, 0 10px 34px #86bfff26;
}
.memonatra-ai.is-thinking .memonatra-ai-icon { animation: ai-twinkle .7s ease-in-out infinite alternate; }
.memonatra-ai.is-thinking .memonatra-ai-main button { animation: ai-shimmer 1.2s linear infinite; cursor: progress; }
.memonatra-ai.is-done .memonatra-ai-main { animation: ai-pop .7s ease-out; }
.memonatra-ai.is-nudged .memonatra-ai-main { animation: ai-nudge .35s ease; }
@media (prefers-reduced-motion: reduce) {
    .memonatra-ai.is-thinking .memonatra-ai-main, .memonatra-ai.is-thinking .memonatra-ai-icon, .memonatra-ai.is-thinking .memonatra-ai-main button,
    .memonatra-ai.is-done .memonatra-ai-main, .memonatra-ai.is-nudged .memonatra-ai-main { animation: none; }
}
@media (max-width: 520px) {
    .memonatra-ai .memonatra-ai-main button { padding: 0 14px; }
    body.dark.memonatra-studio .memonatra-ai input { font-size: 16px; } /* no zoom-in on iPhone */
}
/* Interface language: EN | KA, the current one lit; on the sign-in screen it sits top right. */
.mt-lang { display: inline-flex; align-items: center; height: 32px; padding: 3px; border: 1px solid #ffffff1f; border-radius: 999px; flex-shrink: 0; }
.mt-lang a { display: inline-flex; align-items: center; height: 100%; padding: 0 10px; border-radius: 999px; color: #9ba9c2; font: 800 12px/1 'Outfit', system-ui, sans-serif; letter-spacing: .04em; text-decoration: none; transition: color .2s, background .2s; }
.mt-lang a:hover { color: #eef2ff; }
.mt-lang a.is-active { background: #ffffff17; color: #eef2ff; }
body.memonatra-studio .auth-container .mt-lang-auth { position: absolute; top: 18px; right: 18px; }
body.memonatra-studio .top-right .mt-lang-top { margin-right: 4px; }

/* The page's questions under the sign-in panel: quiet, one answer open at a time by choice. */
body.memonatra-studio .auth-container { overflow-y: auto; justify-content: safe center; }
.mt-faq { width: 560px; max-width: 100%; margin: 26px 0 8px; }
.mt-faq h2 { margin: 0 0 10px; color: #eef2ff; font-size: 17px; font-weight: 700; text-align: center; }
.mt-faq-item { border-top: 1px solid #ffffff14; }
.mt-faq-item:last-child { border-bottom: 1px solid #ffffff14; }
.mt-faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 2px; cursor: pointer; list-style: none; color: #dae3ff; font-size: 14.5px; font-weight: 600; }
.mt-faq-item summary::-webkit-details-marker { display: none; }
.mt-faq-item summary::after { content: '+'; flex-shrink: 0; color: #9ba9c2; font-size: 19px; font-weight: 400; line-height: 1; transition: transform .2s ease; }
.mt-faq-item[open] summary::after { transform: rotate(45deg); }
.mt-faq-item p { margin: 0 2px 15px; color: #9ba9c2; font-size: 14px; line-height: 1.6; }
/* Georgian has no capitals: uppercase would turn it into Mtavruli, so it stays as written. */
html[lang^="ka"] body.memonatra-studio * { text-transform: none !important; }
html[lang^="ka"] body.memonatra-studio .auth-eyebrow { letter-spacing: .5px; }

/* Interface language inside the profile menu: the heading on the left, EN | KA on the right. */
.studio-lang-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 10px; margin-top: 6px; border-top: 1px solid #ffffff12; }
.studio-lang-row .studio-project-heading { padding: 0 10px; }
.studio-lang-row .mt-lang { margin-right: 6px; }

/* Mistakes tint a card from its bottom-right corner (variables set by paintWeakness in utils.js):
   a wide, soft rose glow that fades out in steps; one mistake is barely there, ten cover the card. */
body.memonatra-studio .card.was-missed {
    background:
        radial-gradient(ellipse var(--miss-r, 70%) var(--miss-r, 70%) at 100% 100%,
            hsla(var(--miss-h, 346), 82%, 62%, var(--miss-a, .04)) 0%,
            hsla(var(--miss-h, 346), 82%, 62%, calc(var(--miss-a, .04) * .55)) 35%,
            hsla(var(--miss-h, 346), 82%, 62%, calc(var(--miss-a, .04) * .18)) 62%,
            transparent 85%),
        linear-gradient(145deg, #161e30, #101622);
    border-color: hsla(var(--miss-h, 346), 80%, 66%, calc(var(--miss-a, .04) * .5));
}
/* The title's first line sits on the speak button's middle; longer phrases continue below. */
.memonatra-studio .card .card-title-group h2.word { min-height: 36px; display: flex; align-items: center; margin: 0; }
/* The word's mistakes in its preview, beside the speak button. */
.preview-mistakes { display: inline-flex; align-items: center; gap: 12px; padding: 7px 8px 7px 14px; border-radius: 14px; border: 1px solid hsla(var(--miss-h, 30), 85%, 62%, calc(var(--miss-a, .1) + .12)); background: radial-gradient(circle at 100% 100%, hsla(var(--miss-h, 30), 90%, 58%, calc(var(--miss-a, .1) + .06)), transparent 85%), #ffffff06; cursor: default; }
.preview-mistakes[hidden] { display: none; }
.preview-mistakes .pm-text { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.preview-mistakes strong { color: #ffc9d3; font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.preview-mistakes small { color: #a9b4c9; font-size: 11.5px; line-height: 1.2; white-space: nowrap; }
.preview-mistakes small b { color: #ff9fb2; font-weight: 700; }
body.memonatra-studio .card.was-missed:hover { border-color: #969bff55; }

/* Idioms and phrasal verbs: long titles wrap between words (never inside one) and step down in size
   (data-length from phraseLength in script.js). */
body.dark.memonatra-studio #cardPreviewModal #previewWord { overflow-wrap: break-word !important; word-break: normal !important; hyphens: manual; text-wrap: balance; }
body.dark.memonatra-studio #cardPreviewModal #previewWord[data-length="long"] { font-size: clamp(30px, 3.4vw, 46px) !important; letter-spacing: -1px; line-height: 1.12 !important; }
body.dark.memonatra-studio #cardPreviewModal #previewWord[data-length="xlong"] { font-size: clamp(24px, 2.6vw, 34px) !important; letter-spacing: -.5px; line-height: 1.2 !important; }
.memonatra-studio .card h2.word { overflow-wrap: break-word; word-break: normal !important; text-wrap: balance; }
.memonatra-studio .card h2.word[data-length="long"] { font-size: 19px; letter-spacing: -.3px; }
.memonatra-studio .card h2.word[data-length="xlong"] { font-size: 16.5px; letter-spacing: 0; line-height: 1.35 !important; }
.preview-mistakes { max-width: none; }
@media (max-width: 600px) {
    body.dark.memonatra-studio #cardPreviewModal #previewWord[data-length="long"] { font-size: 28px !important; }
    body.dark.memonatra-studio #cardPreviewModal #previewWord[data-length="xlong"] { font-size: 22px !important; }
}.preview-mistakes small.pm-weak { color: #ff9fb2; font-weight: 600; }

/* The mistakes box is a row of icons (mistakes, hints, correct answers to recover) on every screen;
   the full text opens below it on hover or focus, and on a tap (phones). Under the word on phones it
   opens to the right, beside speak and close on desktops to the left. */
.preview-mistakes { position: relative; padding: 7px 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.preview-mistakes .pm-icons { display: inline-flex; align-items: center; gap: 11px; }
.preview-mistakes .pm-icons span { display: inline-flex; align-items: center; gap: 4px; color: #ffc9d3; font: 700 13.5px/1 'Outfit', system-ui, sans-serif; }
.preview-mistakes .pm-icons i { font-size: 11.5px; opacity: .85; }
.preview-mistakes .pm-icons .pm-icon-weak { color: #ff9fb2; }
.preview-mistakes .pm-text { display: none; }
.preview-mistakes.is-open .pm-text, .preview-mistakes:hover .pm-text, .preview-mistakes:focus-visible .pm-text { display: flex; position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: max-content; max-width: min(300px, 80vw); padding: 10px 12px; border-radius: 12px; border: 1px solid #ffffff1f; background: #1a2030; box-shadow: 0 14px 34px #0009; text-align: left; white-space: normal; }
.preview-mistakes .pm-text small { white-space: normal; }
@media (max-width: 600px) {
    .preview-mistakes { padding: 6px 11px; }
    .preview-mistakes .pm-icons span { font-size: 13px; }
    .preview-mistakes.is-open .pm-text, .preview-mistakes:hover .pm-text { right: auto; left: 0; max-width: min(260px, 80vw); }
}
}

/* Phones: the word gets the whole line beside speak and close; the icon row goes under it, so a long
   word or phrase never pushes the buttons off screen. */
@media (max-width: 600px) {
    #cardPreviewModal .preview-head { display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 10px; align-items: start !important; }
    #cardPreviewModal .preview-head-tools { display: contents !important; }
    #cardPreviewModal .preview-head #previewWord { grid-column: 1; grid-row: 1; min-width: 0; padding-right: 0 !important; }
    #cardPreviewModal .preview-head #previewWordSpeakerContainer { grid-column: 2; grid-row: 1; }
    #cardPreviewModal .preview-head #closePreviewBtn { grid-column: 3; grid-row: 1; }
    #cardPreviewModal .preview-head .preview-mistakes { grid-column: 1 / -1; grid-row: 2; justify-self: start; margin-top: 10px; }
}

/* Learned words (100%): an emerald glow from the top-left corner and a small check at the end of the
   bar instead of the percentage. The mistakes tint (was-missed) stays layered in its corner. */
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered {
    border-color: #6ee7b766;
    background:
        radial-gradient(ellipse 130% 95% at 0% 0%, #34d39930 0%, #34d39912 45%, transparent 78%),
        linear-gradient(145deg, #12251f, #0e1a1a);
    box-shadow: 0 0 0 1px #6ee7b71f, 0 10px 30px #10b9811a;
}
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered.was-missed {
    background:
        radial-gradient(ellipse var(--miss-r, 70%) var(--miss-r, 70%) at 100% 100%,
            hsla(var(--miss-h, 346), 82%, 62%, var(--miss-a, .04)) 0%,
            hsla(var(--miss-h, 346), 82%, 62%, calc(var(--miss-a, .04) * .55)) 35%,
            transparent 80%),
        radial-gradient(ellipse 130% 95% at 0% 0%, #34d39930 0%, #34d39912 45%, transparent 78%),
        linear-gradient(145deg, #12251f, #0e1a1a);
}
body.dark.memonatra-studio .card.mastered h2.word { color: #c6f7e0; }
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered .progress-bar {
    width: calc(100% - 28px) !important;
    background: linear-gradient(90deg, #10b981, #6ee7b7, #d1fae5, #6ee7b7, #10b981) !important;
    background-size: 300% 100% !important;
    animation: mastered-shine 6s linear infinite;
    box-shadow: 0 0 10px #34d39966;
}
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered .progress-label { display: none !important; }
/* Marks at the end of the bar: a solid green check for a learned word and, for a word marked
   "I know it", a bare blue brain after it ("it's in my head"). The card shows no label for it. */
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered .progress-bar-container::after,
body.dark.memonatra-studio .card-container:not(.list-view) .card.is-known .progress-bar-container::before {
    content: ''; position: absolute; right: 0; top: 50%; width: 20px; height: 20px; margin-top: -10px;
    border-radius: 50%; box-shadow: 0 2px 6px #0007, inset 0 1px 0 #ffffff40; pointer-events: none;
}
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered .progress-bar-container::after {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.8 12.6l3.4 3.4 7-7.4' fill='none' stroke='%23ffffff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat,
        linear-gradient(160deg, #34d399, #059669);
}
body.dark.memonatra-studio .card-container:not(.list-view) .card.is-known .progress-bar-container::before {
    content: '\f5dc'; font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free'; font-weight: 900; font-size: 16px;
    line-height: 20px; text-align: center; color: #60a5fa; background: none; box-shadow: none; border-radius: 0;
    filter: drop-shadow(0 1px 3px #0008);
}
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered.is-known .progress-bar-container::after { right: 24px; }
body.dark.memonatra-studio .card-container:not(.list-view) .card.mastered.is-known .progress-bar { width: calc(100% - 52px) !important; }
body.dark.memonatra-studio .card-container:not(.list-view) .card.is-known .progress-bar { width: calc(100% - 28px) !important; }
body.dark.memonatra-studio .card-container:not(.list-view) .card.is-known .progress-label { display: none !important; }
@keyframes mastered-shine { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) {
    body.dark.memonatra-studio .card.mastered .progress-bar { animation: none; }
}

/* "I know it": a blue mark and label; the word is out of the games (script.js setCardsKnown). */
body.dark.memonatra-studio .card.is-known { border-color: #93c5fd55; }
.known-tag { display: inline-flex; gap: 6px; align-items: center; margin: -8px 0 12px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; color: #bfdbfe; background: #3b82f61a; border: 1px solid #93c5fd44; }
.card-container.list-view .known-tag { margin: 0; }
.card-container:not(.list-view) .card .known-tag { display: none; }
.toolbar-actions #knownSelectedBtn { visibility: hidden; opacity: 0; transition: opacity .2s ease; background-color: #2563eb; display: inline-flex; align-items: center; gap: 6px; }
.toolbar-actions #knownSelectedBtn.visible-button { visibility: visible; opacity: 1; }
@media (max-width: 600px) {
}
/* The word "⋯" menu (card and preview, script.js openWordMenu): edit, "I know it" and delete. */
.preview-menu { position: relative; }
.preview-menu-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 11px; border: 1px solid #ffffff1a; background: #ffffff06; color: #a9b4c9; cursor: pointer; transition: color .2s, background .2s, border-color .2s; }
.preview-menu-btn:hover, .preview-menu-btn:focus-visible, .preview-menu-btn[aria-expanded="true"] { color: #e8ecff; border-color: #9c9bff55; background: #9c9bff1a; }
.word-menu { position: fixed; z-index: 100000; min-width: 240px; padding: 6px; border-radius: 14px; background: #141b2c; border: 1px solid #ffffff1c; box-shadow: 0 18px 50px #0009; display: flex; flex-direction: column; gap: 2px; }
.word-menu[hidden] { display: none; }
.word-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: #d6ddf0; font-size: 14px; text-align: left; cursor: pointer; }
.word-menu button i { width: 16px; text-align: center; color: #8f9db5; }
.word-menu button:hover, .word-menu button:focus-visible { background: #ffffff0c; outline: none; }
.word-menu button.on i, .word-menu [data-act="known"]:hover i { color: #93c5fd; }
.word-menu button.danger { color: #f4b4c6; }
.word-menu button.danger i { color: #e785a7; }
.word-menu button.danger:hover, .word-menu button.danger:focus-visible { background: #e785a71a; }
@media (max-width: 600px) {
    #cardPreviewModal .preview-head { grid-template-columns: minmax(0, 1fr) auto auto auto !important; }
    #cardPreviewModal .preview-head #previewMenuWrap { grid-column: 3; grid-row: 1; }
    #cardPreviewModal .preview-head #closePreviewBtn { grid-column: 4; }
}
body.dark.memonatra-studio .card-actions .card-menu-btn:hover,
body.dark.memonatra-studio .card-actions .card-menu-btn:focus-visible,
body.dark.memonatra-studio .card-actions .card-menu-btn[aria-expanded="true"] { color: #e8ecff; background: #9c9bff20; border-color: #9c9bff60; }
/* The same "I know it" badge under the word in its preview. */
.known-tag[hidden] { display: none; }
#cardPreviewModal .preview-known-badge { margin: 12px 0 0; }
/* Progress range (progress-range.js): two handles over a 0-100% track, with quick presets. */
.pr-range { width: 100%; max-width: 340px; box-sizing: border-box; }
.pr-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.pr-head span { color: #8f9db5; font-size: 12px; }
.pr-head strong { color: #e8ecff; font-size: 14px; font-variant-numeric: tabular-nums; }
.pr-track { position: relative; height: 6px; margin: 0 9px; border-radius: 6px; background: #ffffff12; }
.pr-fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, #9594fa, #79e1c4); box-shadow: 0 0 10px #82dcb533; }
/* !important: the panels style every input as a dark box; these two must stay see-through. */
body.memonatra-studio .pr-track input[type=range], .pr-track input[type=range] { position: absolute !important; left: -9px !important; top: -8px !important; width: calc(100% + 18px) !important; height: 22px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; outline: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.pr-track input[type=range]::-webkit-slider-runnable-track { background: none; border: 0; }
.pr-track input[type=range]::-moz-range-track { background: none; border: 0; }
.pr-track input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: #e8ecff; border: 3px solid #9594fa; box-shadow: 0 2px 8px #0008; cursor: grab; }
.pr-track input[type=range]::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: #e8ecff; border: 3px solid #9594fa; box-shadow: 0 2px 8px #0008; cursor: grab; }
.pr-track input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid #c7bfff; outline-offset: 2px; }
.pr-ticks { display: flex; justify-content: space-between; margin: 10px 2px 0; color: #5f6c86; font-size: 10px; }
.pr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pr-chips button { padding: 5px 11px; border-radius: 999px; border: 1px solid #ffffff1a; background: #ffffff06; color: #a9b4c9; font-size: 12px; cursor: pointer; }
.pr-chips button:hover { border-color: #9594fa66; color: #e8ecff; }
.pr-chips button.on { color: #e8ecff; border-color: #9594fa88; background: #9594fa22; }
@media (pointer: coarse) {
    .pr-track input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; }
    .pr-track input[type=range] { top: -12px !important; height: 30px !important; }
    .pr-chips button { padding: 8px 13px; }
}
/* Library: a small button with the range; the slider opens under it. */
.pr-popover-wrap { position: relative; display: inline-flex; }
.pr-popover-btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; cursor: pointer; }
.pr-popover-btn i { font-size: 11px; opacity: .7; }
.pr-popover-btn.is-set { border-color: #9594fa88 !important; color: #e8ecff !important; }
/* One steady width, so the toolbar does not shift from "Any" to "99–100%". */
body.memonatra-studio .studio-command .pr-popover-btn.toolbar-select { width: 128px !important; min-width: 128px; justify-content: flex-start; }
/* The group select and the range button sit on one line, centred, not on the text baseline. */
body.memonatra-studio .studio-command .hide-mastered-wrapper { display: flex !important; align-items: center; gap: 10px; }
body.memonatra-studio .studio-command .hide-mastered-wrapper #mainProgressSelect { flex: 1 1 auto; min-width: 0; }
body.memonatra-studio .studio-command .pr-popover-wrap { flex: 0 0 auto; }
.pr-popover-btn span { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.pr-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; width: 320px; max-width: calc(100vw - 32px); padding: 16px 16px 14px; border-radius: 16px; background: #141b2c; border: 1px solid #ffffff1c; box-shadow: 0 18px 50px #0009; }
.pr-popover[hidden] { display: none; }
/* Round settings and reminders: the slider sits open on its own line. */
body.dark.memonatra-studio #trainingModal #globalTrainingSettings .progress-range-filter { grid-column: 1 / -1; order: 10; width: 100%; padding-top: 4px; }
body.dark.memonatra-studio #trainingModal #globalTrainingSettings .pr-range { max-width: 520px; }
#notifAddModal .pr-range { max-width: none; margin-top: 6px; }
/* Wide desktops: the tags panel pinned beside the library (default; script.js applyTagsPin). It takes
   the top bar's glass so the two read as one frame; unpinned it is the slide-in drawer as before.
   From 1400px only: narrower, the top bar would be squeezed next to it. */
.sidebar-pin-btn { display: none; }
@media (min-width: 1400px) {
    body.dark.memonatra-studio .sidebar-pin-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; margin-right: 6px; border-radius: 9px; border: 1px solid #ffffff14; background: #ffffff05; color: #8f9db5; cursor: pointer; transition: color .2s, background .2s, border-color .2s, transform .2s; vertical-align: middle; }
    body.dark.memonatra-studio .sidebar-pin-btn:hover, body.dark.memonatra-studio .sidebar-pin-btn:focus-visible { color: #e8ecff; border-color: #9c9bff66; background: #9c9bff1a; }
    body.dark.memonatra-studio .sidebar-pin-btn[aria-pressed="false"] i { transform: rotate(45deg); }
    body.dark.memonatra-studio .sidebar-pin-btn[aria-pressed="true"] { color: #c4c2ff; border-color: #9c9bff44; background: #9c9bff14; }
    body.memonatra-studio.tags-pinned #mainAppContainer { padding-left: 308px; }
    body.dark.memonatra-studio.tags-pinned #sidebar {
        left: 16px !important; top: 12px !important; width: 280px !important; height: calc(100dvh - 24px) !important;
        transform: none !important; visibility: visible !important; transition: none;
        background: rgba(16, 22, 35, .93) !important; border: 1px solid #ffffff14 !important; border-radius: 20px !important;
        box-shadow: 0 12px 48px #0003 !important; backdrop-filter: blur(20px); padding: 18px 16px !important; z-index: 20;
    }
    body.dark.memonatra-studio.tags-pinned #closeSidebarBtn,
    body.dark.memonatra-studio.tags-pinned #toggleSidebarBtn { display: none !important; }
    body.memonatra-studio.tags-pinned .fixed-player-wrapper { left: calc(50% + 154px) !important; }
    /* Beside the panel the top bar is narrower: the library and search give a little room so no button is cut. */
    body.dark.memonatra-studio.tags-pinned .studio-command .top-bar { grid-template-columns: auto minmax(140px,200px) minmax(130px,1fr) auto auto auto; }
}
/* The tag panel's clear button: a quiet text button, not a red block. */
body.dark.memonatra-studio #sidebar #clearTagFiltersBtn { display: inline-flex !important; align-items: center; gap: 6px; width: auto !important; margin: 10px 0 0 !important; padding: 6px 12px !important; border-radius: 999px !important; border: 1px solid #e785a733 !important; background: #e785a70d !important; color: #f4b4c6 !important; font-size: 12px !important; font-weight: 600; box-shadow: none !important; cursor: pointer; }
body.dark.memonatra-studio #sidebar #clearTagFiltersBtn:hover { background: #e785a71a !important; border-color: #e785a766 !important; }