:root {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color:#241a37; background:#f4f1f9;
  --surface:#fffdfd; --ink:#241a37; --muted:#655b75; --pale:#efe8f9;
  --purple:#583bc9; --purple-dark:#4328a8; --line:#eae3f1;
}
*,*::before,*::after{box-sizing:border-box}
body{margin:0}
h1,h2,h3,p{margin:0}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
button:disabled{cursor:default;opacity:.5}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid #7558e1;outline-offset:3px}
.canvas svg:not([width]){display:block;width:19px;height:19px;flex:none}
@media (max-width: 1023px) {
  .site-menu svg{display:block;width:19px;height:19px;flex:none}
  .site-menu{position:sticky;top:0;height:100vh;overflow:auto;padding:24px 12px;background:linear-gradient(145deg,#181632,#231e48);color:white}
  .kv-brand{display:flex;align-items:center;gap:9px;margin:0 4px 29px;text-decoration:none;color:white}
  .kv-brand-mark{font-size:42px;font-weight:900;font-style:italic;line-height:1;color:#af7fff}
  .kv-brand span strong,.kv-brand span small{display:block}
  .kv-brand span strong{font-size:19px;line-height:1.13}
  .kv-brand span small{color:#dfd6ef;font-size:11px;margin-top:3px}
  .kv-nav-group{display:grid;gap:6px}
  .kv-nav-group+.kv-nav-group{border-top:1px solid #60547b;margin-top:15px;padding-top:14px}
  .kv-nav-group h2{font-size:12px;color:#c7b9e6;margin:0 5px 2px}
  .kv-nav-group a{min-height:43px;display:flex;align-items:center;gap:8px;border-radius:10px;padding:5px 6px;text-decoration:none;color:white;font-size:13px;font-weight:720;white-space:nowrap}
  .kv-nav-group a[aria-current]{background:#5842d0;box-shadow:inset 0 0 0 1px #826bec}
  .kv-nav-icon{background:#423b64;display:grid;place-items:center;border-radius:8px;width:29px;height:29px}
  .kv-nav-group a[aria-current] .kv-nav-icon{background:transparent}
}
.topbar{display:none;justify-content:space-between;align-items:center;background:#fbf9fd;border-bottom:1px solid #e8e0f0}
.topbar-trail{font-size:13px;color:var(--muted)}
.topbar-trail strong{color:#37284b}
.words-desktop-header [data-kum-nav-crumb] h1{letter-spacing:normal}
.words-desktop-header [data-kum-approved-back] svg{width:15px;height:15px}
.words-desktop-header [data-kum-approved-finish]{white-space:nowrap}
.words-desktop-header [data-kum-approved-finish]:hover{background:#e1d8f4}
.words-desktop-header details:not([open]) > nav{display:none}
@media (min-width:1024px){
  .study-top h1{display:none}
}
.avatar{width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#eee7f8;color:#604c7b}
.canvas{min-width:0}
.workspace{width:min(100%,1420px);margin:auto;padding:28px 31px 25px}
.page-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:17px}
h1{font-size:36px;line-height:1.11;letter-spacing:-.043em;font-weight:820}
.page-head p{font-size:14px;color:var(--muted);margin-top:6px}
.tabs{display:flex;gap:24px;border-bottom:1px solid #e3dced;margin-bottom:20px}
.tab{position:relative;display:flex;align-items:center;gap:7px;padding:0 1px 11px;min-height:39px;border:0;background:none;color:#635472;font-size:13px;font-weight:730}
.tab svg{width:17px;height:17px}
.tab.current{color:#5230b8}
.tab.current::after{content:"";position:absolute;bottom:-1px;left:0;right:0;height:3px;background:#6848d9;border-radius:3px 3px 0 0}
.btn,.icon-btn{display:inline-flex;justify-content:center;align-items:center;gap:7px;min-height:41px;border:0;border-radius:9px;padding:0 13px;background:#efe8f8;color:#533a80;font-size:13px;font-weight:760;white-space:nowrap}
.btn svg,.icon-btn svg{width:17px;height:17px}
.btn:hover,.icon-btn:hover{background:#e8ddf5}
.btn.primary{color:white;background:#5639c7;box-shadow:0 3px 6px #5133b51a}
.btn.primary:hover{background:#4a2eb4}
.btn.white{background:#fffcff;color:#4b2c83}
.btn.white:hover{background:#f2e8ff}
.btn.ghost,.icon-btn{background:none;color:#5a437a}
.btn.ghost:hover,.icon-btn:hover{background:#f0e8f8}
.icon-btn{width:36px;min-height:36px;padding:0}
.panel{min-width:0;border-radius:16px;background:var(--surface);border:1px solid var(--line);box-shadow:0 7px 23px #29194b06}
.personal-grid{display:grid;gap:18px;grid-template-columns:226px minmax(0,1fr);align-items:start}
.personal-menu{padding:14px 12px 12px}
.personal-menu h2{font-size:14px;margin:2px 5px 12px}
.tree-folder,.tree-deck{display:flex;align-items:center;gap:7px;width:100%;min-height:39px;border:0;background:none;border-radius:9px;text-align:left;padding:7px;color:#4e376d;font-size:12px;font-weight:720}
.tree-folder.selected,.tree-deck.selected,.tree-folder:hover,.tree-deck:hover{background:#f0e7fa}
.tree-folder svg,.tree-deck svg{width:15px;height:15px}
.tree-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tree-count{color:#786789;font-size:11px}
.personal-branch{margin:1px 0 8px 13px;padding-left:5px;border-left:1px solid #e6dbef}
.tree-deck{min-height:35px}
.intro-content{min-width:0}
.welcome{display:flex;align-items:center;justify-content:space-between;gap:18px;min-height:128px;padding:23px 24px;background:#ede5fa;border-color:#e3d7f3;box-shadow:none}
.welcome h2{font-size:26px;line-height:1.14;letter-spacing:-.035em}
.welcome p{color:#645373;font-size:13px;line-height:1.45;margin:7px 0 0;max-width:390px}
.hero-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.welcome .btn:not(.primary){background:#e5daf4}
.welcome .btn:not(.primary):hover{background:#dbcaee}
.section-head{display:flex;justify-content:space-between;align-items:center;gap:9px;margin:17px 0 9px}
.section-head h2{font-size:20px;letter-spacing:-.026em}
.section-head span{color:#776986;font-size:12px;font-weight:600}
.topics-board{margin-top:16px;padding:4px 18px 9px}
.topics-board .section-head{margin:12px 3px 8px}
.theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:24px}
.theme-tile{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 5px;min-height:64px;min-width:0;text-align:left;background:none;border:0;border-top:1px solid #eee6f1;color:var(--ink)}
.theme-tile:hover{background:#f7f0fb}
.theme-tile strong,.theme-tile small{display:block}
.theme-tile strong{font-size:14px;line-height:1.2;overflow-wrap:anywhere}
.theme-tile small{margin-top:5px;font-size:12px;color:#6d5c82}
.theme-count{display:flex;align-items:center;gap:6px;flex:none;white-space:nowrap;color:#706080;font-size:12px}
.theme-count svg{width:15px;height:15px;color:#8167a6}
.browser{display:grid;grid-template-columns:211px minmax(0,1fr);gap:14px;align-items:start}
.topic-menu{padding:7px 9px 10px}
.topic-menu h2{font-size:13px;padding:7px 7px 6px;color:#746487}
.topic-link{display:flex;align-items:center;gap:8px;width:100%;min-height:38px;padding:5px 9px;background:none;border:0;border-radius:7px;text-align:left;color:#473953;font-size:12px;font-weight:660}
.topic-link:hover,.topic-link.active{background:#eee5f9;color:#513096}
.topic-link .label{flex:1;min-width:0}
.topic-link small{font-size:11px;color:#77678a;font-variant-numeric:tabular-nums}
.word-pane{min-width:0;overflow:clip}
.word-head{padding:17px 19px 10px}
.word-head h2{font-size:27px;letter-spacing:-.033em}
.word-head p{font-size:13px;color:var(--muted);margin-top:3px}
.word-heading{display:flex;align-items:center;justify-content:space-between;gap:9px;margin-bottom:13px}
.catalog-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap}
.catalog-actions .icon-btn{min-height:41px;width:41px;border:1px solid #e9e0f0;background:#fbf7fd}
.search-wrap{display:flex;align-items:center;gap:8px;padding:0 10px;min-height:38px;background:#f3edf8;border-radius:8px;color:#776489}
.search-wrap input{min-width:0;width:100%;padding:0;border:0;background:none;color:var(--ink);font-size:13px;outline:none}
.search-wrap:focus-within{outline:2px solid #9075dc}
.search-wrap svg{width:16px;height:16px}
.rows-scroll{min-height:244px;max-height:486px;overflow:auto;scrollbar-width:thin;scrollbar-color:#d4c2eb #f7f2fb}
.words-table{border-collapse:separate;border-spacing:0;table-layout:fixed;width:100%}
.words-table th{padding:8px 0;font-size:11px;letter-spacing:.01em;color:#6b5c7c;text-align:left;background:#fffdfd;position:sticky;top:0;z-index:1}
.words-table th:first-child{width:46px;padding-left:17px}
.catalog-table th:nth-child(2){width:23%}
.catalog-table th:nth-child(3){width:24%}
.example-cell{line-height:1.3;color:#665670}
.example-cell strong{color:#503779;font-weight:690}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.words-table th:last-child{width:49px}
.words-table td{height:44px;border-top:1px solid #f0eaf4;padding:3px 7px 3px 0;font-size:13px;overflow-wrap:anywhere}
.words-table td:first-child{padding-left:17px}
.words-table .picked{background:#f2eaf9}
.words-table td strong{font-weight:760}
.words-table input[type=checkbox]{width:15px;height:15px;margin:0;accent-color:#6645d6;vertical-align:middle}

.in-deck{font-size:10px;font-weight:680;color:#47695c;white-space:normal;display:block;margin-top:2px}

.word-tags{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}
.word-tags li{padding:4px 8px;border-radius:5px;background:#f0e9f8;color:#533e6f;font-size:12px;font-weight:650;line-height:1.35;overflow-wrap:anywhere;max-width:100%}
.word-tags .more-words{color:#6f5c81;background:#f6f2f9}
.dialog .word-tags{padding:2px 0 6px}
.pickbar{display:flex;align-items:center;justify-content:space-between;gap:9px;padding:10px 15px;background:#f4edfb;border-top:1px solid #e7daf2;min-height:59px}
.pickbar strong,.pickbar small{display:block}
.pickbar strong{font-size:13px;color:#37215d}
.pickbar small{font-size:11px;color:#6b577e;margin-top:3px}
.pick-actions{display:flex;align-items:center;gap:5px}
.pickbar .btn{min-height:37px}
.pickbar.is-empty{color:#675477;font-size:12px;background:#f8f4fb}
.unfound{display:grid;min-height:220px;place-content:center;text-align:center;padding:16px;color:var(--muted);font-size:14px;gap:5px}
.unfound strong{color:#443253;font-size:17px}
.deck{overflow:hidden}
.deck-hero{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:117px;padding:16px 21px;background:#eee6f8;border-bottom:1px solid #e8ddf2;color:#302046}
.deck-meta{min-width:0}
.deck-hero .trail{color:#655178;font-size:12px;display:flex;align-items:center;gap:5px}
.deck-hero .trail svg{width:14px;height:14px}
.deck-hero h2{font-size:31px;line-height:1.12;letter-spacing:-.037em;margin:4px 0 5px}
.deck-hero p{font-size:12px;color:#665477}
.deck-hero .hero-actions{justify-content:flex-end}
.deck-hero .hero-actions .btn{min-height:39px}
.deck-body{padding:13px 18px 16px}
.deck-body>.section-head{margin:1px 0 11px}
.deck-body .rows-scroll{min-height:0}
.deck-body .words-table th:first-child,.deck-body .words-table td:first-child{width:34%;padding-left:1px}
.deck-body .words-table th:nth-child(2){width:35%}
.deck-body .words-table th:nth-child(3){width:auto}
.deck-body .words-table th:last-child{width:74px}
.deck-body .words-table th{position:static}
.deck-body .words-table .icon-btn{width:33px}
.deck-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.status{font-size:11px;color:#694f88;background:#f0e9f7;padding:4px 7px;border-radius:12px;white-space:nowrap}
.empty-deck{min-height:196px;display:grid;place-items:center;text-align:center}
.empty-deck h3{font-size:22px;letter-spacing:-.03em}
.empty-deck p{font-size:13px;color:var(--muted);margin:6px 0 12px}
.empty-deck .deck-tools{justify-content:center}
.chooser-overlay{position:fixed;inset:0;background:#23163972;display:grid;place-items:center;padding:18px;z-index:4}
.dialog{width:min(100%,497px);border-radius:17px;box-shadow:0 20px 80px #20113459;background:#fffcff;padding:19px 21px;max-height:90vh;overflow:auto}
.dialog header{display:flex;justify-content:space-between;gap:10px;align-items:start;margin-bottom:12px}
.dialog h2{font-size:24px;letter-spacing:-.03em}
.dialog header p{font-size:13px;color:var(--muted);margin-top:4px;line-height:1.36}
.dialog form{display:grid;gap:13px}
.modal-buttons{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:7px;margin-top:3px}
.field{display:grid;gap:5px;color:#574372;font-size:12px;font-weight:700}
.field input,.field select,.field textarea{width:100%;min-height:41px;border:1px solid #e6ddef;border-radius:8px;padding:8px 10px;background:#f8f3fb;color:var(--ink);font-size:14px;font-weight:500}
.field textarea{min-height:64px;resize:vertical}
.field input[type=file]{font-size:12px}
.dialog .options{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.dialog .options label{border:1px solid #e8ddef;border-radius:8px;display:flex;align-items:center;gap:6px;padding:10px 8px;font-size:12px;color:#574372;font-weight:650}
.dialog input[type=radio],.dialog input[type=checkbox]{accent-color:#6847d3}
.dialog .options label:has(input:checked){background:#f1e9fa;border-color:#d6c3ec;color:#4d327c}
.study-options{padding:0;border:0;margin:0}
.study-options legend{font-weight:720;font-size:12px;color:#644e7d;margin-bottom:7px}
.picture-option{display:flex;align-items:center;gap:10px;border-radius:9px;background:#f6f0fa;padding:9px;color:#4d3767;font-size:13px}
.picture-option small{display:block;margin-top:3px;font-size:11px;color:#6d5a82}

.notice{display:flex;align-items:center;justify-content:space-between;gap:9px;border-radius:10px;padding:8px 9px 8px 12px;margin-bottom:11px;background:#eeebfb;color:#49327c;font-size:13px;font-weight:700}
.notice .btn{min-height:34px}
.form-error{color:#913a5c;font-size:12px}
.study-wrap{width:min(668px,100%);margin:auto}
.study-top{display:flex;gap:16px;justify-content:space-between;align-items:center;margin-bottom:13px}
.study-source,.result .study-source{color:#6b557e;font-size:12px;font-weight:740;margin:0 0 4px}
.study-top h1{font-size:34px}
.progress-meta{display:flex;justify-content:space-between;gap:10px;color:#645476;font-size:12px;margin-bottom:7px}
.study-track{height:5px;background:#e7dcf4;border-radius:8px;margin-bottom:17px;overflow:hidden}
.study-track span{height:100%;display:block;background:#7d5ade;border-radius:8px}
.flashcard{overflow:hidden;border-radius:19px;background:#34234d;color:#fff8ff;box-shadow:0 15px 31px #28163820;text-align:center}
.flash-media{position:relative;isolation:isolate;margin:0;display:grid;place-items:center;height:262px;padding:14px;overflow:hidden;background:radial-gradient(ellipse at 50% 41%,#a184bd 0%,#614679 58%,#3c2a53 100%)}
.flash-image{position:relative;display:block;max-width:100%;height:234px;object-fit:contain;border-radius:11px;box-shadow:0 7px 20px #45305b24}
.flash-media[data-image-loading] .flash-image{visibility:hidden}
.hint-leaving{display:none}
.flash-media[data-image-loading] .hint-leaving{display:inline-flex}
.flash-media .hint-leaving{position:absolute;inset:auto;background:#fffafd;color:#593a83;opacity:1;pointer-events:none}
.image-unavailable{font-size:13px;color:#fff3ff}
.flashcard .btn[aria-busy="true"]{cursor:progress}
@media (prefers-reduced-motion:no-preference){
  .flash-image.image-revealed{animation:words-image-reveal 510ms cubic-bezier(.16,1,.3,1) both}
  .flash-media[data-with-answer] .flash-image.image-revealed{
    animation:words-image-with-answer 230ms cubic-bezier(.16,1,.3,1) both
  }
  .flash-media:has(.image-revealed)::before{
    content:"";position:absolute;inset:0;pointer-events:none;
    background:radial-gradient(ellipse at 50% 52%,#e6cafa96,transparent 66%);
    animation:words-image-light 570ms ease-out both
  }
  .flash-media:not([data-image-loading]) .hint-leaving{
    display:inline-flex;animation:words-hint-leave 165ms ease-in both
  }
  .flash-media[data-with-answer]:has(.image-revealed)::before{animation-duration:260ms}
  @keyframes words-image-reveal{
    from{opacity:0;transform:translateY(12px) scale(.97);filter:blur(5px)}
    56%{filter:blur(.45px)}
    to{opacity:1;transform:none;filter:none}
  }
  @keyframes words-image-with-answer{
    from{transform:translateY(3px) scale(.988)}
    to{transform:none}
  }
  @keyframes words-image-light{
    from,to{opacity:0;transform:scale(.96)}
    38%{opacity:.54;transform:scale(1)}
  }
  @keyframes words-hint-leave{
    to{opacity:0;transform:scale(.95);visibility:hidden}
  }
}
.flash-hint .btn{background:#fffafd;color:#593a83}
.flash-hint .btn:hover{background:#f6eefc}
.flashcard.text-only .flash-text{min-height:310px;justify-content:center}
.flash-text{min-height:198px;padding:14px 19px 10px;display:flex;flex-direction:column;align-items:center;gap:4px;overflow-wrap:anywhere}
.flash-word,.answer-line{display:flex;justify-content:center;align-items:center;gap:9px;max-width:100%}
.flash-text h2{font-size:clamp(30px,5vw,48px);letter-spacing:-.044em;line-height:1.08}
.flash-text .translation{font-size:24px;color:#f0dffc;font-weight:760}
.flash-text .flash-side{color:#e0ccee;font-size:12px;font-weight:710}
.flash-text .icon-btn{background:#fcf0ff18;color:#f1e1fb;width:34px;min-height:34px}
.flash-text .icon-btn:hover{background:#fcf0ff31}
.answer-details{display:grid;gap:8px;width:100%;margin-top:1px}
.lesson-example{font-size:14px;color:#e9dcf4;max-width:520px;margin:0 auto;border-top:1px solid #f3e7ff34;padding-top:7px;width:100%}
.lesson-example span{display:block;font-size:10px;color:#d9c4ea;margin-bottom:2px;font-weight:740}
.lesson-example p{font-size:15px;line-height:1.35}
.lesson-example strong{color:white;font-weight:790}
.example-line{display:flex;align-items:center;justify-content:center;gap:7px}
.example-line .icon-btn{flex:none}
.catalog-example{display:flex;align-items:center;gap:4px}
.catalog-example .icon-btn{flex:none}
.study-actions{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;gap:8px;max-width:410px;padding:0 17px 16px;margin:auto}
.study-actions .btn{min-height:43px;font-size:13px}
.study-actions .primary{background:#7551e0}
.study-actions .primary:hover{background:#805cec}
.study-actions .good{background:#dff0e6;color:#2b674b}
.study-actions .good:hover{background:#cbe8d8}
.study-actions .again{background:#5d4777;color:#f8eeff}
.study-actions .again:hover{background:#6d548a}
.result{padding:27px 28px;background:#fcf8fe}
.result h1{font-size:34px}
.result p{margin:7px 0 14px;color:var(--muted);font-size:13px}
.result-grid{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-bottom:14px}
.result-stat{border-radius:10px;background:#efe8f9;padding:12px;color:#5a3d83}
.result-stat:first-child{background:#e1efe6;color:#2e664e}
.result-stat b{display:block;font-size:24px}
.result-stat small{font-weight:650}
@media(max-width:1260px){
  .workspace{padding-inline:19px}
  .browser{grid-template-columns:175px minmax(0,1fr);gap:9px}
  .personal-grid{grid-template-columns:176px minmax(0,1fr)}
}
@media(max-width:1024px){
  .browser{grid-template-columns:150px minmax(0,1fr)}
  .welcome{align-items:flex-start;flex-direction:column}
}
@media(max-width:740px){
  .shell{display:block}
  .site-menu{display:none}
  .workspace{padding:16px 12px}
  .page-head h1{font-size:28px}
  .personal-grid,.browser{grid-template-columns:minmax(0,1fr)}
  .topic-menu{display:flex;overflow:auto;gap:5px}
  .topic-menu h2{display:none}
  .topic-link{width:auto;white-space:nowrap}
  .topic-link small{display:none}
  .theme-grid{grid-template-columns:1fr}
  .notice,.pickbar,.deck-hero{flex-wrap:wrap}
  .flash-media{height:215px;padding:12px}
  .flash-image{height:191px}
  .flash-text{padding:12px}
  .word-heading{align-items:flex-start}
  .catalog-actions .btn{font-size:11px;white-space:normal}
  .example-cell,.catalog-table th:nth-child(4){display:none}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important}}
[hidden]{display:none!important}
.destination-fields{display:grid;gap:9px}
.theme-tile{overflow:hidden}
.study-top h1,.deck-hero h2{overflow-wrap:anywhere}
@media(max-height:850px) and (min-width:741px){
  .workspace{padding-top:20px}
  .browser .rows-scroll{max-height:calc(100vh - 405px)}
}
/* Load after design.css. The desktop composition is defined there. */
.topbar .site-toggle,
.site-scrim {
  display: none;
}

.personal-menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin: 0 0 5px;
}

.personal-menu-title h2 {
  margin: 0 5px;
}

.manage {
  position: relative;
  flex: none;
}

.manage-toggle[aria-expanded="true"] {
  background: #eee4fa;
}

.manage-popover {
  position: absolute;
  z-index: 4;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  width: max-content;
  max-width: min(228px, calc(100vw - 28px));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffcff;
  box-shadow: 0 8px 22px #29194b20;
}

.manage-popover .btn {
  justify-content: flex-start;
  min-height: 36px;
  padding-inline: 9px;
  white-space: normal;
  text-align: left;
}

.deck:has(.manage-popover),
.personal-menu:has(.manage-popover) {
  position: relative;
  z-index: 3;
  overflow: visible;
}

.deck:has(.manage-popover) .deck-hero {
  border-radius: 15px 15px 0 0;
}

.card-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.btn[data-do^="delete-"] {
  color: #8b3151;
}

.btn.danger {
  color: white;
  background: #9b3659;
}

.btn.danger:hover {
  background: #812748;
}

.storage-warning,
.audio-status {
  position: fixed;
  z-index: 3;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  max-width: min(420px, calc(100vw - 28px));
  padding: 9px 12px;
  border: 1px solid #e9d6c7;
  border-radius: 10px;
  color: #50352d;
  background: #fff2e7;
  box-shadow: 0 5px 17px #311a261a;
  font-size: 13px;
  line-height: 1.4;
}

.audio-status:has(+ .storage-warning) {
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1023px) {
  .shell {
    --words-header-height: calc(59px + env(safe-area-inset-top, 0px));
    display: block;
    min-height: 100dvh;
  }

  .topbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
    height: var(--words-header-height);
    gap: 8px;
    padding: env(safe-area-inset-top, 0px) 12px 0;
  }

  .shell .words-desktop-header {
    display: none;
  }

  .topbar-trail,
  .topbar-actions {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
  }

  .topbar-actions {
    flex: none;
  }

  .topbar-trail > :is(span, svg) {
    display: none;
  }

  .topbar-trail > strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-trail:has(> .btn) > strong {
    display: none;
  }

  .topbar .site-toggle {
    display: inline-flex;
  }

  .topbar :is(.site-toggle, .avatar) {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
  }

  .topbar .btn {
    min-height: 44px;
    padding-inline: 7px;
  }

  .site-menu {
    position: fixed;
    z-index: 4;
    inset: var(--words-header-height) auto 0 0;
    width: min(280px, calc(100vw - 40px));
    height: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    display: none;
  }

  .site-menu .kv-nav-group a {
    font-size: 13px;
    min-height: 44px;
  }

  [data-menu-open] .site-menu,
  [data-menu-open] .site-scrim {
    display: block;
  }

  .site-scrim {
    position: fixed;
    z-index: 3;
    inset: var(--words-header-height) 0 0;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #261b4199;
  }

}

@media (max-width: 820px) {
  .workspace {
    padding: 15px 14px calc(23px + env(safe-area-inset-bottom, 0px));
  }

  .tab,
  .tree-folder,
  .tree-deck,
  .topic-link,
  .deck-tools .btn,
  .hero-actions .btn,
  .page-head .btn,
  .catalog-actions > :is(.btn, .icon-btn) {
    min-height: 44px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-head h1 {
    font-size: clamp(27px, 5.5vw, 34px);
  }

  .page-head p {
    line-height: 1.35;
  }

  .personal-grid,
  .browser {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .personal-menu {
    max-height: 224px;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 7px 9px;
  }

  .personal-menu h2 {
    margin-bottom: 4px;
  }

  .personal-menu-title h2 {
    margin-bottom: 0;
  }

  .personal-menu:has(> .personal-tree) {
    max-height: none;
    overflow: visible;
  }

  .personal-tree {
    max-height: 176px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .manage-popover .btn,
  .manage-toggle {
    min-height: 44px;
  }

  .manage-toggle {
    width: 44px;
  }

  .topic-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 4px;
    scrollbar-width: thin;
  }

  .topic-menu h2 {
    display: none;
  }

  .topic-link {
    width: auto;
    flex: 0 0 auto;
    gap: 6px;
    padding-inline: 8px;
    white-space: nowrap;
  }

  .topic-link small {
    display: block;
  }

  .word-head {
    padding: 13px 11px 9px;
  }

  .word-heading {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .word-heading > div:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .catalog-actions {
    justify-content: flex-start;
  }

  .catalog-actions .btn {
    font-size: 12px;
    white-space: normal;
    line-height: 1.2;
  }

  .catalog-actions .icon-btn {
    width: 44px;
  }

  .search-wrap {
    min-height: 44px;
  }

  .search-wrap input,
  .field :is(input, select, textarea) {
    font-size: 16px;
  }

  .rows-scroll {
    min-height: min(220px, 30dvh);
    max-height: min(480px, 43dvh);
    overflow: auto;
    overscroll-behavior: contain;
  }

  .pickbar {
    position: sticky;
    z-index: 2;
    bottom: 0;
    padding: 8px 10px;
  }

  .pickbar .btn {
    min-height: 44px;
  }

  .chooser-overlay {
    position: fixed;
    inset: var(--words-viewport-top, 0px) 0 auto;
    z-index: 8;
    min-height: 0;
    height: 100vh;
    height: var(--words-viewport-height, 100dvh);
    place-items: end center;
    padding: max(10px, env(safe-area-inset-top, 0px)) 8px 0;
  }

  .dialog {
    width: min(100%, 497px);
    max-height: 100%;
    overscroll-behavior: contain;
    border-radius: 17px 17px 0 0;
    padding: 16px 14px 0;
  }

  .dialog form,
  .dialog .options {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog h2 {
    font-size: clamp(20px, 5vw, 24px);
    overflow-wrap: anywhere;
  }

  .dialog header .icon-btn {
    flex: 0 0 44px;
  }

  .dialog :is(.btn, .icon-btn),
  .dialog .field :is(input, select, textarea),
  .dialog .options label,
  .dialog .picture-option {
    min-height: 44px;
  }

  .dialog :is(input, select, textarea) {
    scroll-margin-bottom: max(58px, calc(52px + env(safe-area-inset-bottom, 0px)));
  }

  .dialog .field input[type=file] {
    font-size: 16px;
  }

  .dialog .field input::file-selector-button {
    max-width: 100%;
    font-size: 14px;
  }

  .modal-buttons {
    position: sticky;
    z-index: 1;
    bottom: 0;
    padding: 8px 0 max(10px, env(safe-area-inset-bottom, 0px));
    background: #fffcff;
  }

  .lesson-example,
  .notice span {
    overflow-wrap: anywhere;
  }

  .study-actions .btn {
    min-height: 44px;
  }
}

/* Keep the original table at tablet widths long enough for all columns. */
@media (min-width: 651px) and (max-width: 740px) {
  .catalog-table :is(.example-cell, th:nth-child(4)) {
    display: table-cell;
  }
}

@media (max-width: 650px) {
  .tabs {
    gap: 16px;
    margin-bottom: 13px;
  }

  .page-head {
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  .page-head .btn {
    padding-inline: 9px;
    font-size: 12px;
  }

  .welcome {
    padding: 15px 13px;
  }

  .welcome h2 {
    font-size: 22px;
  }

  .topics-board {
    margin-top: 10px;
    padding-inline: 12px;
  }

  .theme-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .word-heading {
    margin-bottom: 9px;
    gap: 8px;
  }

  .word-heading h2,
  .deck-hero h2 {
    font-size: 24px;
  }

  .catalog-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 5px;
  }

  .catalog-actions:has(> .btn + .btn) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  }

  .catalog-actions > .btn {
    min-width: 0;
    padding: 4px 6px;
  }

  .catalog-actions svg {
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
  }

  .catalog-table,
  .deck-body .words-table,
  .catalog-table tbody,
  .deck-body .words-table tbody {
    display: block;
  }

  .catalog-table thead,
  .deck-body .words-table thead {
    display: block;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .catalog-table tr,
  .deck-body .words-table tr {
    display: grid;
    min-width: 0;
    align-items: center;
  }

  .catalog-table tr {
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 44px;
    grid-template-areas:
      "pick english russian sound"
      "pick example example sound";
    border-top: 1px solid #f0eaf4;
  }

  .catalog-table thead tr,
  .deck-body .words-table thead tr {
    background: #fffdfd;
    border: 0;
  }

  .catalog-table :is(th, td),
  .deck-body .words-table :is(th, td) {
    width: auto !important;
    min-width: 0;
    height: auto;
    padding: 3px 5px;
    border: 0;
    overflow-wrap: anywhere;
  }

  .catalog-table :is(th, td):nth-child(1) { grid-area: pick; }
  .catalog-table :is(th, td):nth-child(2) { grid-area: english; }
  .catalog-table :is(th, td):nth-child(3) { grid-area: russian; }
  .catalog-table td:nth-child(4) { grid-area: example; }
  .catalog-table :is(th, td):nth-child(5) { grid-area: sound; }

  .catalog-table tbody .example-cell {
    display: block;
    padding-top: 0;
    padding-bottom: 6px;
    font-size: 11px;
    line-height: 1.3;
  }

  .catalog-table th:nth-child(4) {
    display: none;
  }

  .catalog-table :is(th, td):first-child,
  .catalog-table :is(th, td):last-child {
    display: grid;
    place-items: center;
    align-self: stretch;
    min-height: 44px;
    padding: 0;
  }

  .catalog-table input[type=checkbox] {
    box-sizing: content-box;
    cursor: pointer;
  }

  .catalog-table :is(th, td):first-child > label {
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 44px;
    cursor: pointer;
  }

  .catalog-table td .icon-btn,
  .deck-body .words-table td .icon-btn {
    width: 44px;
    min-height: 44px;
  }

  .pickbar,
  .pickbar.is-empty {
    min-height: 78px;
  }

  .pickbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 7px;
  }

  .pick-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 5px;
  }

  .pick-actions .btn {
    font-size: 12px;
    padding-inline: 8px;
  }

  .deck-hero {
    min-height: auto;
    padding: 12px;
  }

  .deck-hero .hero-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .deck-hero .hero-actions .btn {
    min-height: 44px;
  }

  .deck-hero .hero-actions > .manage {
    margin-left: auto;
  }

  .deck-body {
    padding: 10px;
  }

  .deck-body > .section-head {
    flex-wrap: wrap;
  }

  .deck-body .words-table tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 88px;
    grid-template-areas:
      "english russian controls"
      "status status controls";
    border-top: 1px solid #f0eaf4;
  }

  .deck-body .words-table :is(th, td):nth-child(1) { grid-area: english; }
  .deck-body .words-table :is(th, td):nth-child(2) { grid-area: russian; }
  .deck-body .words-table td:nth-child(3) { grid-area: status; }
  .deck-body .words-table :is(th, td):nth-child(4) { grid-area: controls; }

  .deck-body .words-table th:nth-child(3) {
    display: none;
  }

  .deck-body .words-table td:first-child {
    padding-left: 5px;
  }

  .deck-body .words-table td:last-child {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    padding: 0;
  }

  .deck-body .status {
    display: inline-block;
    white-space: normal;
  }

  .study-top {
    align-items: flex-start;
    gap: 8px;
  }

  .study-top > div {
    min-width: 0;
  }

  .study-top h1,
  .result h1 {
    font-size: 26px;
    line-height: 1.15;
  }

  .study-top .btn {
    min-height: 44px;
    padding-inline: 7px;
    font-size: 11px;
    white-space: normal;
  }

  .study-track {
    margin-bottom: 12px;
  }

  .flash-media {
    --words-media-height: clamp(150px, 45vw, 210px);
    grid-template-rows: minmax(0, 1fr);
    height: var(--words-media-height);
    padding: 9px;
    overflow: hidden;
  }

  .flash-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(var(--words-media-height) - 18px);
  }

  .flash-text {
    min-height: 172px;
    padding: 12px 13px 8px;
  }

  .flashcard.text-only .flash-text {
    min-height: 234px;
  }

  .flash-text .translation {
    font-size: clamp(20px, 6vw, 24px);
    line-height: 1.15;
  }

  .flash-text .icon-btn {
    width: 44px;
    min-height: 44px;
  }

  .flash-word h2,
  .answer-line > p {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .study-actions {
    max-width: 100%;
    padding: 0 10px 10px;
    gap: 5px;
  }

  .study-actions .btn {
    padding-inline: 5px;
    font-size: 12px;
  }

  .result {
    padding: 15px 12px;
  }

  .result .hero-actions {
    gap: 5px;
  }

  .result .hero-actions .btn {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
  }
}

/* On phones the catalog scrolls inside its pane. The selection controls
   stay at the pane's foot, outside the scrolling rows. */
@media (max-width: 650px) and (min-height: 480px) {
  .workspace:has(> .browser) {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: calc(100dvh - var(--words-header-height));
    padding-top: 10px;
    padding-bottom: max(9px, env(safe-area-inset-bottom, 0px));
  }

  .browser {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .word-pane {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-self: stretch;
    min-height: 0;
  }

  .word-pane .rows-scroll {
    min-height: 0;
    max-height: none;
  }

  .pickbar {
    position: static;
  }
}

@media (max-width: 650px) and (max-height: 660px) {
  .workspace:has(> .browser) .page-head p {
    display: none;
  }

  .workspace:has(> .browser) .tabs {
    margin-bottom: 9px;
  }

  .browser {
    gap: 7px;
  }

  .word-head {
    padding-block: 9px 5px;
  }

  .catalog-table thead,
  .deck-body .words-table thead {
    height: 1px;
    width: 1px;
    overflow: hidden;
    position: absolute;
    clip-path: inset(50%);
  }

  .catalog-table thead:has([data-all]) {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    clip-path: none;
  }

  .catalog-table thead tr {
    grid-template-areas: "pick english russian sound";
  }
}

@media (max-width: 380px) and (min-height: 480px) and (max-height: 660px) {
  .workspace:has(> .browser) {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .workspace:has(> .browser) .page-head {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
}

@media (max-width: 359px) {
  .topbar:has([data-action="exitStudy"]) .topbar-trail strong {
    display: none;
  }
}

/* Каталог на ПК */
@media (min-width: 821px) {
  .topic-menu {
    padding-top: 10px;
  }

  .topic-menu h2 {
    color: #544664;
  }

  .topic-link.active {
    box-shadow: inset 3px 0 #7753c5;
  }

  .topic-link.active small {
    padding: 2px 6px;
    border-radius: 5px;
    color: #553887;
    background: #e2d6f4;
  }

  .word-heading {
    margin-bottom: 12px;
  }

  .catalog-actions {
    gap: 8px;
  }

  .catalog-resume {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    padding: 0 6px 0 0;
    color: #634f7c;
    font-size: 11px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .catalog-resume progress {
    appearance: none;
    width: 91px;
    height: 4px;
    border: 0;
    border-radius: 5px;
    background: #ebe2f6;
  }

  .catalog-resume progress::-webkit-progress-bar {
    border-radius: 5px;
    background: #ebe2f6;
  }

  .catalog-resume progress::-webkit-progress-value {
    border-radius: 5px;
    background: #6b45c6;
  }

  .catalog-resume progress::-moz-progress-bar {
    border-radius: 5px;
    background: #6b45c6;
  }

  .word-head .search-wrap {
    min-height: 38px;
    border: 1px solid #eae0f3;
    background: #f5f0fa;
  }

  .catalog-tools {
    display: grid;
    grid-template-columns: minmax(155px, 1fr) auto;
    align-items: stretch;
    gap: 10px;
  }

  .catalog-toggles {
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding-inline: 5px;
    border: 1px solid #eae1f2;
    border-radius: 8px;
    background: #fbf8fd;
  }

  .catalog-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #5c486e;
    font-size: 11.5px;
    font-weight: 650;
    white-space: nowrap;
  }

  .catalog-toggle:hover,
  .catalog-toggle[aria-checked="true"] {
    background: #f1e8f9;
    color: #4e2d87;
  }

  .toggle-track {
    position: relative;
    flex: 0 0 23px;
    height: 13px;
    border-radius: 9px;
    background: #ded4e8;
  }

  .toggle-track::before {
    position: absolute;
    inset: 2px auto 2px 2px;
    width: 9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px #49306529;
    content: "";
  }

  .catalog-toggle[aria-checked="true"] .toggle-track {
    background: #6844c2;
  }

  .catalog-toggle[aria-checked="true"] .toggle-track::before {
    inset-inline-start: 12px;
  }

  .translation-reveal {
    min-height: 30px;
    max-width: 100%;
    padding: 0 6px;
    border: 0;
    border-radius: 5px;
    color: #63459a;
    background: #f4edf9;
    font-size: 12px;
    font-weight: 650;
  }

  .translation-reveal:hover,
  .translation-reveal.translation-open {
    background: #eae0f6;
    color: #45286e;
  }

  .search-wrap input::-webkit-search-cancel-button {
    display: none;
  }

  .search-wrap .clear-search {
    width: 27px;
    min-height: 27px;
    flex: 0 0 27px;
    color: #654c83;
  }

  .search-wrap .clear-search svg {
    width: 15px;
    height: 15px;
  }

  .browser .rows-scroll {
    min-height: 200px;
    max-height: min(477px, max(200px, calc(100dvh - 429px)));
    scrollbar-color: #bfaad9 transparent;
  }

  .catalog-table th {
    height: 35px;
    padding-block: 0;
    border-block: 1px solid #eee6f4;
    background: #f6f1f9;
    color: #58486c;
  }

  .catalog-table th:nth-child(2) { width: 23%; }
  .catalog-table th:nth-child(3) { width: 24%; }
  .catalog-table th:last-child { width: 105px; }

  .word-play-heading {
    display: block;
    text-align: center;
    white-space: nowrap;
  }

  .catalog-table :is(th, td):first-child {
    padding-inline: 0;
  }

  .catalog-table :is(th, td):first-child label {
    display: grid;
    width: 100%;
    min-height: 35px;
    place-items: center;
    cursor: pointer;
  }

  .catalog-table :is(th, td):first-child label:has(input:disabled) {
    cursor: default;
  }

  .catalog-table input[type=checkbox] {
    appearance: none;
    display: grid;
    place-content: center;
    width: 15px;
    height: 15px;
    border: 1px solid #8f7da2;
    border-radius: 4px;
    background: #fff;
    color: #fff;
  }

  .catalog-table input[type=checkbox]:checked {
    border-color: #603cc6;
    background: #603cc6;
  }

  .catalog-table input[type=checkbox]:disabled {
    border-color: #a6bcad;
    background: #edf4ef;
    color: #456b56;
  }

  .catalog-table input[type=checkbox]:is(:checked, :disabled)::after {
    content: "";
    width: 7px;
    height: 4px;
    border: solid currentColor;
    border-width: 0 0 1.5px 1.5px;
    transform: translateY(-1px) rotate(-45deg);
  }

  .catalog-table input[type=checkbox]:indeterminate::after {
    content: "";
    width: 7px;
    height: 1.5px;
    border-radius: 1px;
    background: #6a49b6;
  }

  .catalog-table tbody tr:has(input:not(:disabled)) > td {
    cursor: pointer;
  }

  .catalog-table tbody tr:not(.picked):has(input:not(:disabled)):hover > td {
    background: #f9f5fc;
  }

  .catalog-table tbody tr.picked > td {
    background: #f1eafa;
  }

  .catalog-table tbody tr.picked > td:first-child {
    box-shadow: inset 3px 0 #835bc8;
  }

  .catalog-table td:last-child {
    text-align: center;
    padding-inline: 0;
  }

  .catalog-table td:last-child .icon-btn {
    width: 30px;
    min-height: 30px;
    border-radius: 7px;
    background: #efe8f8;
    color: #583981;
  }

  .catalog-table .catalog-example .icon-btn {
    width: 27px;
    min-height: 27px;
    border: 1px solid #e9def2;
    border-radius: 50%;
    color: #655082;
  }

  .catalog-table .catalog-example .icon-btn svg {
    width: 12px;
    height: 12px;
  }

  .pickbar {
    min-height: 59px;
    padding: 8px 15px;
    background: #f3ecfa;
  }

  .pickbar.is-empty {
    background: #f8f4fb;
  }

  .pick-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
  }

  .pick-summary > strong {
    margin-inline-end: 5px;
  }

  .pick-word,
  .pick-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 25px;
    padding: 3px 7px;
    border: 0;
    border-radius: 5px;
    background: #e7dcf4;
    color: #513579;
    font-size: 11.5px;
    font-weight: 700;
  }

  .pick-word:hover {
    background: #ded0f1;
  }

  .pick-word svg {
    width: 12px;
    height: 12px;
  }
}

/* Каталог на телефоне */
.phone-topic,
.phone-filters,
.phone-clear,
.phone-add,
.catalog-actions [data-do="catalog-options"],
.mobile-topics-back {
  display: none;
}

@media (max-width: 650px) {
  [data-words-view="catalog"] .workspace {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - var(--words-header-height));
    min-height: 0;
    padding: 4px 12px max(8px, env(safe-area-inset-bottom, 0px));
  }

  [data-words-view="catalog"] .page-head {
    display: none;
  }

  [data-words-view="catalog"] .tabs {
    gap: 17px;
    margin-bottom: 8px;
  }

  [data-words-view="catalog"] .tab {
    justify-content: center;
    padding-bottom: 5px;
  }

  .browser {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .browser > .topic-menu,
  .browser .catalog-tools .catalog-toggles,
  .browser .word-heading > div:first-child,
  .browser .desktop-clear,
  .browser .desktop-add,
  .browser .pickbar.is-empty {
    display: none;
  }

  .browser > .phone-topic {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    padding: 5px 10px;
    text-align: left;
    border: 1px solid #e8dff0;
    border-radius: 11px;
    color: #4c3668;
    background: #fffdfd;
  }

  .phone-topic-icon {
    display: grid;
    place-items: center;
    flex: 0 0 29px;
    height: 29px;
    border-radius: 7px;
    color: #6547a4;
    background: #efe6f8;
  }

  .phone-topic-icon svg,
  .phone-topic > svg {
    width: 15px;
    height: 15px;
  }

  .phone-topic-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .phone-topic-count {
    flex: none;
    color: #766387;
    font-size: 11.5px;
  }

  .browser .word-pane {
    grid-template-columns: minmax(0, 1fr);
    border-radius: 13px;
  }

  .browser .word-head {
    padding: 9px 10px 8px;
  }

  .browser .word-heading {
    margin-bottom: 7px;
  }

  .browser .catalog-actions {
    display: flex;
    position: relative;
    gap: 6px;
  }

  .browser .catalog-actions [data-do="catalog-options"] {
    display: inline-flex;
    width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
  }

  .browser .catalog-actions [data-do="catalog-train"] {
    flex: 1 1 0;
    min-height: 44px;
  }

  .browser .catalog-actions :is([data-do="whole"], [data-do="catalog-settings"]) {
    display: none;
  }

  .browser .catalog-resume {
    position: absolute;
    left: 0;
    right: 50px;
    bottom: 4px;
    display: flex;
    justify-content: center;
    font-size: 10px;
    line-height: 1.1;
    color: #f4edff;
    pointer-events: none;
  }

  .browser .catalog-resume progress {
    display: none;
  }

  .browser .catalog-actions:has(.catalog-resume) .primary {
    align-items: flex-start;
    padding: 5px 3px 13px;
  }

  .browser .catalog-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .browser .catalog-tools .search-wrap {
    min-height: 44px;
    padding-inline: 8px;
  }

  .browser .catalog-tools .search-wrap input {
    font-size: 16px;
  }

  .browser .catalog-tools .clear-search {
    flex: 0 0 34px;
    width: 34px;
    min-height: 44px;
  }

  .browser .catalog-tools .clear-search[hidden] {
    display: none;
  }

  .browser .phone-filters,
  .browser .phone-add,
  .browser .phone-clear {
    display: inline-flex;
  }

  .browser .phone-filters {
    min-height: 44px;
    padding-inline: 8px;
    border: 1px solid #e7dcf0;
    color: #563985;
    background: #f6effa;
    font-size: 11.5px;
  }

  .browser .phone-filters svg {
    width: 15px;
    height: 15px;
  }

  .phone-filter-count {
    display: grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    padding-inline: 3px;
    border-radius: 5px;
    color: #fff;
    background: #6645c8;
    font-size: 9px;
  }

  .browser .word-pane .rows-scroll {
    overscroll-behavior: contain;
  }

  .catalog-table thead tr {
    min-height: 44px;
    grid-template-areas: "pick english russian sound";
    background: #f5eff9;
  }

  .catalog-table thead th {
    background: transparent;
  }

  .catalog-table .word-play-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .catalog-table tbody tr {
    min-height: 50px;
    grid-template-areas: "pick english russian sound";
  }

  [data-phone-examples] .catalog-table tbody tr {
    grid-template-areas:
      "pick english russian sound"
      "pick example example sound";
  }

  [data-words-view="catalog"]:not([data-phone-examples]) .catalog-table .example-cell {
    display: none;
  }

  .catalog-table tbody tr.picked {
    background: #f1eafa;
  }

  .catalog-table td:nth-child(3) {
    color: #5b4c6b;
  }

  .catalog-table td:last-child .icon-btn {
    position: relative;
    color: #583981;
  }

  .catalog-table td:last-child .icon-btn::before {
    position: absolute;
    inset: 7px;
    border-radius: 8px;
    background: #efe8f8;
    content: "";
  }

  .catalog-table td:last-child .icon-btn svg {
    position: relative;
    width: 16px;
    height: 16px;
  }

  .catalog-table .catalog-example .icon-btn {
    flex: 0 0 44px;
    margin-block: -7px;
    color: #655082;
  }

  .catalog-table .translation-reveal {
    min-height: 44px;
    padding: 3px 5px;
    border: 0;
    border-radius: 6px;
    color: #63459a;
    background: #f4edf9;
    font-size: 12px;
    font-weight: 650;
  }

  .catalog-table .translation-reveal.translation-open {
    background: #eae0f6;
    color: #45286e;
  }

  .browser .pickbar:not(.is-empty) {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 5px;
    min-height: 55px;
    padding: 5px 7px max(5px,env(safe-area-inset-bottom,0px)) 10px;
    background: #f3ecfa;
  }

  .browser .pick-summary > strong {
    color: #48315f;
    font-size: 12px;
    line-height: 1.25;
  }

  .browser .pick-summary :is(.pick-word,.pick-more) {
    display: none;
  }

  .browser .pick-actions {
    width: auto;
    gap: 4px;
  }

  .browser .pick-actions .phone-clear {
    width: 44px;
    min-height: 44px;
  }

  .browser .pick-actions .phone-add {
    min-height: 44px;
    padding-inline: 10px;
  }

  .catalog-sheet .phone-topic-list {
    display: grid;
    gap: 3px;
    padding-bottom: max(9px, env(safe-area-inset-bottom, 0px));
  }

  .catalog-sheet .phone-topic-list .topic-link {
    width: 100%;
    white-space: normal;
    padding-inline: 10px;
    border-bottom: 1px solid #f0e9f5;
  }

  .catalog-sheet .catalog-sheet-action {
    min-height: 48px;
    padding-inline: 9px;
    justify-content: flex-start;
    background: transparent;
    color: #46355e;
    text-align: left;
  }

  .catalog-sheet .catalog-sheet-action + .catalog-sheet-action {
    border-top: 1px solid #eee6f4;
  }

  .phone-filter-list {
    padding-bottom: 8px;
  }

  .phone-filter-list .catalog-toggle {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    width: 100%;
    min-height: 52px;
    padding: 6px 8px;
    border: 0;
    border-bottom: 1px solid #eee6f4;
    background: none;
    color: #46355e;
    font-size: 13px;
    font-weight: 670;
    text-align: left;
  }

  .phone-filter-list .toggle-track {
    position: relative;
    flex: 0 0 31px;
    height: 18px;
    border-radius: 10px;
    background: #ded5e9;
  }

  .phone-filter-list .toggle-track::before {
    position: absolute;
    inset: 2px auto 2px 2px;
    width: 14px;
    border-radius: 50%;
    background: #fff;
    content: "";
  }

  .phone-filter-list [aria-checked="true"] .toggle-track {
    background: #6745c8;
  }

  .phone-filter-list [aria-checked="true"] .toggle-track::before {
    inset-inline-start: 15px;
  }

  .catalog-filter-sheet .modal-buttons .primary {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .browser .catalog-tools .search-wrap input {
    font-size: 16px;
  }

  .browser .phone-filters {
    min-width: 77px;
    gap: 3px;
    padding-inline: 4px;
  }
}

/* Личные карточки и тренажёр на телефоне */
.mobile-topics-back {
  display: none;
}

@media (max-width: 650px) {
  .words-workspace[data-words-view="personal"] > .workspace {
    display: grid;
    gap: 10px;
    padding: 8px 14px max(14px, env(safe-area-inset-bottom, 0px));
  }

  .words-workspace[data-words-view="personal"] .tabs {
    grid-row: 1;
    margin: 0;
  }

  .words-workspace[data-words-view="personal"] .page-head {
    justify-content: flex-end;
    margin: 0;
  }

  .words-workspace[data-words-view="personal"] .page-head > div {
    display: none;
  }

  .words-workspace[data-words-view="personal"] .page-head .btn {
    min-height: 44px;
    padding: 0 12px;
    font-size: 13px;
  }

  .words-workspace[data-words-view="personal"] .personal-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .personal-grid:has(> .deck):not(.mobile-deck) .personal-branch {
    display: none;
  }

  .words-workspace[data-words-view="personal"] .personal-menu {
    padding: 6px 9px 8px;
    box-shadow: none;
  }

  .words-workspace[data-words-view="personal"] .personal-menu-title {
    margin: 0 1px 3px;
  }

  .words-workspace[data-words-view="personal"] .personal-tree {
    max-height: 192px;
  }

  .words-workspace[data-words-view="personal"] :is(.tree-folder,.tree-deck) {
    padding-inline: 9px;
    min-height: 44px;
    font-size: 13px;
  }

  .words-workspace[data-words-view="personal"] .workspace:has(.mobile-deck) > :is(.page-head,.tabs),
  .personal-grid.mobile-deck > .personal-menu,
  .personal-grid.mobile-deck .deck-meta > .trail {
    display: none;
  }

  .personal-grid.mobile-deck > .mobile-topics-back {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    min-height: 44px;
    padding: 0 9px;
    background: transparent;
    color: #583a8a;
    font-size: 13px;
  }

  .personal-grid.mobile-deck > .mobile-topics-back:hover {
    background: #efe6f7;
  }

  .words-workspace[data-words-view="personal"] .welcome {
    min-height: 0;
    gap: 12px;
    padding: 14px;
    border-color: #e8ddf0;
    background: #f4eefb;
  }

  .words-workspace[data-words-view="personal"] .welcome h2 {
    font-size: 21px;
  }

  .words-workspace[data-words-view="personal"] .welcome p {
    max-width: 32ch;
    margin-top: 5px;
  }

  .words-workspace[data-words-view="personal"] .welcome .hero-actions {
    gap: 6px;
  }

  .words-workspace[data-words-view="personal"] .welcome .hero-actions .btn {
    padding-inline: 9px;
    white-space: normal;
  }

  .words-workspace[data-words-view="personal"] .topics-board {
    padding-inline: 11px;
    box-shadow: none;
  }

  .words-workspace[data-words-view="personal"] .topics-board .section-head {
    margin: 10px 3px 7px;
  }

  .words-workspace[data-words-view="personal"] .theme-tile {
    min-height: 52px;
    padding: 8px 5px;
  }

  .words-workspace[data-words-view="personal"] .theme-count {
    color: #6b5b7d;
    font-size: 11.5px;
  }

  .words-workspace[data-words-view="personal"] .deck {
    box-shadow: none;
  }

  .words-workspace[data-words-view="personal"] .deck-hero {
    position: relative;
    min-height: 0;
    gap: 9px;
    padding: 13px 12px 10px;
    border-color: #e8def1;
    background: #f3edf9;
  }

  .mobile-deck .deck-meta {
    padding-inline-end: 45px;
  }

  .words-workspace[data-words-view="personal"] .mobile-deck .deck-hero .hero-actions > .manage {
    position: absolute;
    inset: 9px 8px auto auto;
    width: auto;
  }

  .words-workspace[data-words-view="personal"] .deck-meta h2 {
    margin: 0 0 4px;
    color: #2d2045;
    font-size: clamp(21px, 6vw, 25px);
  }

  .words-workspace[data-words-view="personal"] .deck-hero .hero-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .words-workspace[data-words-view="personal"] .deck-hero .hero-actions .btn {
    min-height: 44px;
    padding-inline: 9px;
    font-size: 12px;
    white-space: normal;
  }

  .words-workspace[data-words-view="personal"] .deck-hero .hero-actions .primary {
    flex: 1 1 auto;
  }

  .words-workspace[data-words-view="personal"] .deck-body {
    padding: 10px 11px 12px;
  }

  .words-workspace[data-words-view="personal"] .deck-body > .section-head {
    gap: 4px 9px;
    margin: 0 0 6px;
  }

  .words-workspace[data-words-view="personal"] .deck-body > .section-head h2 {
    font-size: 17px;
  }

  .words-workspace[data-words-view="personal"] .deck-body .deck-tools {
    gap: 5px;
  }

  .words-workspace[data-words-view="personal"] .deck-body .deck-tools > .btn {
    min-height: 44px;
    padding-inline: 7px;
    font-size: 12px;
    white-space: normal;
  }

  .words-workspace[data-words-view="personal"] .deck-body .words-table thead tr {
    min-height: 30px;
    grid-template-areas: "english russian controls";
    border-radius: 6px;
    background: #f6f1fa;
  }

  .words-workspace[data-words-view="personal"] .deck-body .words-table th {
    background: transparent;
  }

  .words-workspace[data-words-view="personal"] .deck-body .words-table tbody tr {
    min-height: 49px;
    padding-block: 4px 2px;
  }

  .words-workspace[data-words-view="personal"] .deck-body .status {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f4eef8;
    color: #694f88;
    font-size: 10.5px;
  }

  .words-workspace[data-words-view="personal"] .empty-deck {
    min-height: 140px;
    padding: 8px 0;
  }

  .words-workspace[data-words-view="personal"] .empty-deck h3 {
    font-size: 17px;
  }

  .words-workspace[data-words-view="personal"] .empty-deck p {
    max-width: 29ch;
    margin: 5px auto 10px;
    font-size: 12px;
  }

  .words-workspace[data-words-view="personal"] .notice {
    display: grid;
    gap: 5px;
    padding: 8px 9px;
    background: #efe8f9;
  }

  .chooser-overlay:has(.dialog > form) {
    padding-inline: 0;
  }

  .dialog:has(> form) {
    width: min(100%, 497px);
    border-radius: 20px 20px 0 0;
    padding: 13px 15px 0;
    box-shadow: 0 -5px 44px #20113445;
  }

  .dialog:has(> form) > header {
    align-items: center;
    gap: 7px;
    margin: 0 0 11px;
  }

  .dialog:has(> form) > header h2 {
    color: #2d2045;
    font-size: clamp(20px, 6vw, 23px);
    line-height: 1.14;
  }

  .dialog:has(> form) > header p {
    margin-top: 4px;
    font-size: 12px;
  }

  .dialog:has(> form) > header .icon-btn {
    width: 44px;
    flex: 0 0 44px;
    border-radius: 10px;
    background: #f2ecf8;
  }

  .dialog > form {
    gap: 11px;
  }

  .dialog > form .field {
    min-width: 0;
  }

  .dialog > form .field :is(input, select, textarea) {
    min-height: 44px;
    background: #faf7fd;
    border-color: #e8ddf1;
  }

  .dialog > form .field textarea {
    min-height: 52px;
    resize: vertical;
  }

  .dialog > form .field input[type="file"] {
    padding-inline: 7px;
    font-size: 13px;
  }

  .dialog > form .field input[type="file"]::file-selector-button {
    max-width: 100%;
    margin-inline-end: 6px;
    font-size: 13px;
  }

  .dialog > form .card-manage {
    flex-wrap: wrap;
    gap: 6px;
  }

  .dialog > form .modal-buttons {
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    margin: 0 -15px;
    padding: 7px 15px max(9px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eee6f3;
  }

  .dialog > form .modal-buttons .btn {
    min-width: 0;
    min-height: 44px;
    padding-inline: 7px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .dialog > form .options label,
  .dialog > form .picture-option {
    padding: 6px 9px;
  }

  .words-workspace[data-words-view="study"] > .workspace,
  .words-workspace[data-words-view="result"] > .workspace {
    padding: 12px 14px max(14px, env(safe-area-inset-bottom,0px));
  }

  .words-workspace[data-words-view="study"] .study-top {
    margin-bottom: 9px;
  }

  .words-workspace[data-words-view="study"] .study-top h1 {
    font-size: 25px;
  }

  .words-workspace[data-words-view="study"] .study-source {
    margin-bottom: 3px;
    font-size: 11px;
  }

  .words-workspace[data-words-view="study"] .progress-meta {
    margin-bottom: 5px;
    font-size: 11.5px;
  }

  .words-workspace[data-words-view="study"] .study-track {
    margin-bottom: 10px;
  }

  .words-workspace[data-words-view="study"] .flash-media {
    --words-media-height: clamp(116px, 36.5vw, 146px);
    padding: 8px;
  }

  .words-workspace[data-words-view="study"] .flash-media.flash-hint {
    background: radial-gradient(ellipse at 50% 45%, #77558c 0%, #634779 51%, #4b365f 100%);
  }

  .words-workspace[data-words-view="study"] .flash-image {
    max-height: calc(var(--words-media-height) - 16px);
  }

  .words-workspace[data-words-view="study"] .flash-hint button,
  .words-workspace[data-words-view="study"] .hint-leaving {
    min-height: 44px;
  }

  .words-workspace[data-words-view="study"] .flash-text {
    justify-content: flex-start;
    min-height: 167px;
    padding: 10px 11px 8px;
  }

  .words-workspace[data-words-view="study"] .flashcard.text-only .flash-text {
    justify-content: center;
    min-height: 224px;
  }

  .words-workspace[data-words-view="study"] .flash-word h2 {
    font-size: clamp(25px, 8vw, 36px);
  }

  .words-workspace[data-words-view="study"] .lesson-example {
    padding-top: 7px;
  }

  .words-workspace[data-words-view="study"] .lesson-example .example-line {
    gap: 4px;
  }

  .words-workspace[data-words-view="study"] .study-actions {
    padding-inline: 10px;
  }

  .words-workspace[data-words-view="study"] .study-actions .btn {
    min-height: 44px;
    min-width: 0;
    padding-inline: 5px;
    line-height: 1.2;
    white-space: normal;
  }

  .words-workspace[data-words-view="result"] .result {
    padding: 15px 13px 12px;
    background: #fffafd;
  }

  .words-workspace[data-words-view="result"] .result h1 {
    font-size: clamp(24px, 7vw, 29px);
  }

  .words-workspace[data-words-view="result"] .result-grid {
    gap: 7px;
    margin-bottom: 11px;
  }

  .words-workspace[data-words-view="result"] .result-stat {
    padding: 10px;
  }

  .words-workspace[data-words-view="result"] .result .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .words-workspace[data-words-view="result"] .result .hero-actions .btn {
    width: 100%;
  }
}

@media (max-width: 380px) and (max-height: 660px) {
  .words-workspace:is([data-words-view="study"],[data-words-view="result"]) > .workspace {
    padding: 8px 10px max(9px, env(safe-area-inset-bottom, 0px));
  }

  .words-workspace[data-words-view="study"] .study-top h1 {
    font-size: 22px;
  }

  .words-workspace[data-words-view="study"] .study-top {
    margin-bottom: 7px;
  }
}

/* Vocabulary catalog pagination */

.catalog-page-nav {
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:42px;
  gap:8px;
  padding-inline:10px;
  border-top:1px solid #eee7f6;
  color:#605071;
  font-size:12px;
}
.catalog-page-nav .btn { min-height:38px; padding-block:0; }
@media (max-width:650px) {
  .word-pane:has(> #catalog-pager) { grid-template-rows:auto auto minmax(0,1fr) auto; }
  .catalog-page-nav { min-height:46px; padding-inline:5px; }
  .catalog-page-nav .btn { min-height:44px; }
}
