:root{--ink:#22231f;--muted:#77786f;--paper:#f5f2ec;--panel:#fffefa;--line:#e8e3d9;--olive:#59644b;--olive-dark:#394333;--sage:#e8ecdf;--peach:#f1dfd2;--gold:#e8bc72;--shadow:0 14px 36px rgba(49,44,33,.06);font-family:'Segoe UI','Malgun Gothic','Noto Sans KR',Arial,sans-serif;color:var(--ink);background:var(--paper)}
*{box-sizing:border-box}body{margin:0;min-width:320px;background:var(--paper)}button,input,textarea{font:inherit}button{cursor:pointer}.app-shell{max-width:1180px;margin:0 auto;padding:0 34px 104px}.topbar{height:82px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:12px;color:var(--ink);text-decoration:none}.brand-mark{width:39px;height:39px;border-radius:13px;background:var(--olive-dark);color:#fff;display:grid;place-items:center;font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif;font-size:23px}.brand strong{display:block;font-family:'Segoe UI',Arial,sans-serif;font-size:14px;letter-spacing:-.3px}.brand small{display:block;color:var(--muted);font-size:11px;margin-top:2px}.local-pill{font-size:11px;color:var(--muted);border:1px solid var(--line);background:#faf8f3;padding:8px 11px;border-radius:30px}.status-dot{display:inline-block;width:7px;height:7px;background:#80926c;border-radius:50%;margin-right:6px}.page{display:none;padding-top:40px}.page.active{display:block}.hero{display:flex;justify-content:space-between;align-items:center;padding:28px 0 32px}.eyebrow{font-size:10px;letter-spacing:1.7px;color:var(--olive);font-weight:700;margin:0 0 10px}.hero h1,.page-heading h1{font-family:'Segoe UI',Arial,sans-serif;font-size:clamp(34px,5vw,51px);line-height:1.11;letter-spacing:-2.3px;margin:0;font-weight:700}.hero h1 em{font-style:normal;color:var(--olive)}.hero-copy{color:var(--muted);font-size:14px;line-height:1.7;max-width:510px;margin:17px 0 0}.hero-stamp{width:166px;height:145px;background:var(--peach);border-radius:44% 56% 48% 52% / 53% 40% 60% 47%;display:flex;flex-direction:column;align-items:center;justify-content:center;transform:rotate(5deg);color:#765c49;flex-shrink:0;margin-right:30px}.hero-stamp span{font-family:'Malgun Gothic','Noto Sans KR',sans-serif;font-weight:700;font-size:14px}.hero-stamp b{font-family:'Segoe UI',Arial,sans-serif;font-size:20px;text-align:center;line-height:1.1;margin:5px}.hero-stamp small{font-size:9px;letter-spacing:.2px}.stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}.stat-card{background:var(--panel);border:1px solid var(--line);border-radius:17px;padding:19px 21px;min-height:126px;box-shadow:0 4px 15px rgba(49,44,33,.025)}.stat-primary{background:var(--olive-dark);border-color:var(--olive-dark);color:white}.stat-label,.stat-foot{display:block;font-size:11px;color:var(--muted)}.stat-primary .stat-label,.stat-primary .stat-foot{color:#d7dfcd}.stat-card strong{display:block;font-family:'Segoe UI',Arial,sans-serif;font-size:34px;line-height:1.2;margin:9px 0 4px}.home-grid{display:grid;grid-template-columns:1.12fr .88fr;gap:18px}.panel{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:24px;box-shadow:0 4px 15px rgba(49,44,33,.025)}.panel-heading{display:flex;align-items:center;justify-content:space-between}.panel h2{font-family:'Segoe UI',Arial,sans-serif;font-size:20px;letter-spacing:-.6px;margin:0}.line-icon{font-size:25px;color:var(--olive)}.muted{color:var(--muted);font-size:13px;line-height:1.65}.start-panel>.muted{margin:10px 0 18px}.direction-picker{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:16px}.radio-card{display:flex;border:1px solid var(--line);border-radius:12px;padding:12px;gap:8px;align-items:flex-start;cursor:pointer}.radio-card:has(input:checked){border-color:#8b987c;background:#f1f3eb}.radio-card input{accent-color:var(--olive);margin:3px 0 0}.radio-card b,.radio-card small{display:block}.radio-card b{font-size:12px}.radio-card small{font-size:10px;color:var(--muted);margin-top:4px}.button{border:0;border-radius:10px;padding:11px 16px;font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:13px;transition:transform .15s,background .15s}.button:hover{transform:translateY(-1px)}.button-dark{background:var(--olive-dark);color:#fff}.button-dark:hover{background:#4c5942}.button-large{width:100%;padding:15px 18px;font-size:13px}.button-outline{background:transparent;border:1px solid #cfcfc2;color:var(--ink)}.tiny-note{font-size:10px;color:var(--muted);text-align:center;margin:11px 0 0}.action-row{width:100%;border:0;border-bottom:1px solid var(--line);background:transparent;display:flex;align-items:center;gap:12px;padding:15px 0;text-align:left;color:var(--ink)}.action-icon{height:35px;width:35px;display:grid;place-items:center;background:var(--sage);color:var(--olive-dark);border-radius:10px;font-size:18px}.action-row b,.action-row small{display:block}.action-row b{font-size:12px}.action-row small{font-size:10px;color:var(--muted);margin-top:4px}.action-arrow{margin-left:auto;color:var(--muted)}.tip-box{display:flex;gap:10px;align-items:flex-start;background:#f7f3ea;border-radius:11px;padding:12px 13px;margin-top:16px}.tip-box>span{color:#b88743}.tip-box p{font-size:10px;line-height:1.55;color:var(--muted);margin:0}.tip-box b{color:var(--ink)}.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:25px}.page-heading h1{font-size:39px}.page-heading .muted{margin:8px 0 0}.toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;gap:12px}.search-wrap{display:flex;align-items:center;gap:9px;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:0 12px;width:min(440px,100%);height:42px;color:var(--muted)}.search-wrap input{border:0;outline:0;background:transparent;width:100%;font-size:12px;color:var(--ink)}.count-label{font-size:11px;color:var(--muted);white-space:nowrap}.cards-list{display:grid;gap:10px}.word-card{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:15px 17px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center}.word-main{min-width:0}.word-ko{font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif;font-size:19px;font-weight:600;margin-bottom:3px}.word-ru{font-size:12px;color:var(--olive-dark);font-weight:600}.word-example{font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif;font-size:11px;color:var(--muted);margin-top:7px;overflow-wrap:anywhere}.word-meta{font-size:10px;color:#98988f;margin-top:6px}.word-actions{display:flex;gap:6px}.mini-button{border:1px solid var(--line);border-radius:8px;background:transparent;color:var(--muted);padding:7px 9px;font-size:10px}.mini-button:hover{background:#f3f1ea;color:var(--ink)}.empty-state{text-align:center;padding:62px 20px;background:var(--panel);border:1px dashed #d8d4c9;border-radius:16px}.empty-state>span{font-size:29px;color:var(--olive)}.empty-state h3{font-family:Manrope;margin:12px 0 5px}.empty-state p{font-size:12px;color:var(--muted);margin:0 0 16px}.hidden{display:none!important}.settings-layout{display:grid;grid-template-columns:1.2fr .8fr;gap:17px;align-items:start}.settings-panel h2,.backup-panel h2{margin:0 0 8px}.settings-panel>.muted,.backup-panel>.muted{margin:0 0 20px}.field-label{display:block;font-size:11px;font-weight:700;margin:16px 0 7px}.field-label span{color:#b36c50}.field-label small{font-weight:400;color:var(--muted);margin-left:4px}.text-input{display:block;width:100%;border:1px solid #dedbd1;background:#fff;border-radius:9px;padding:11px 12px;font-size:13px;color:var(--ink);outline:none}.text-input:focus{border-color:#8a987b;box-shadow:0 0 0 3px rgba(108,126,91,.1)}.korean-input{font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif}.narrow-input{max-width:160px}.field-help{color:var(--muted);font-size:10px;line-height:1.6;margin:7px 0 0}.settings-note{padding:14px;background:#f3f4ed;border-radius:11px;margin:19px 0}.settings-note b{font-size:11px}.settings-note p{font-size:10px;line-height:1.65;color:var(--muted);margin:7px 0 0}.settings-panel>.button{margin-top:3px}.success-message{font-size:11px;color:var(--olive);margin-left:10px}.full-width{width:100%;margin:7px 0}.import-label{cursor:pointer}.version-label{font-size:10px;color:#a1a095;border-top:1px solid var(--line);margin-top:19px;padding-top:14px}.study-topline{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.text-button{border:0;background:transparent;color:var(--muted);padding:7px 0;font-size:12px}.study-area{max-width:690px;margin:25px auto}.study-card{background:var(--panel);border:1px solid var(--line);border-radius:23px;min-height:330px;padding:38px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;box-shadow:var(--shadow);position:relative}.study-direction{position:absolute;top:22px;left:24px;font-size:10px;color:var(--muted);letter-spacing:.8px}.study-counter{position:absolute;top:22px;right:24px;font-size:10px;color:var(--muted)}.study-prompt{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:1px;margin-bottom:17px}.study-word{font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif;font-size:clamp(34px,8vw,54px);font-weight:600;line-height:1.3;overflow-wrap:anywhere}.study-word.russian{font-family:'Segoe UI',Arial,sans-serif;font-size:clamp(27px,6vw,40px)}.study-answer{font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif;font-size:25px;color:var(--olive);margin-top:13px}.study-example{font-family:'Malgun Gothic','Noto Sans KR','Segoe UI',sans-serif;font-size:13px;line-height:1.7;color:var(--muted);margin-top:22px;max-width:500px}.study-example-translation{font-size:11px;color:#9a9a90;margin-top:5px}.show-answer{margin-top:28px;min-width:185px}.rating-wrap{width:100%;margin-top:28px}.rating-title{text-align:center;color:var(--muted);font-size:10px;margin-bottom:10px}.rating-buttons{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.rating-button{border:1px solid var(--line);background:#fffefa;border-radius:10px;padding:11px 5px;color:var(--ink);font-size:11px;font-weight:700}.rating-button span{display:block;font-size:9px;font-weight:400;color:var(--muted);margin-top:4px}.rating-button.again{border-color:#e5c6b7}.rating-button.easy{border-color:#cbd5be}.study-complete{text-align:center;background:var(--panel);border:1px solid var(--line);border-radius:22px;padding:50px 25px;box-shadow:var(--shadow)}.complete-mark{width:58px;height:58px;border-radius:50%;background:var(--sage);color:var(--olive);display:grid;place-items:center;font-size:27px;margin:0 auto 17px}.study-complete h2{font-family:Manrope;font-size:25px;margin:0 0 8px}.study-complete p{color:var(--muted);font-size:12px;line-height:1.6}.study-complete .button{margin-top:15px}.next-due{font-size:11px!important;color:#9b998e!important;margin-top:16px}.bottom-nav{position:fixed;bottom:0;left:0;right:0;z-index:4;display:flex;justify-content:center;gap:40px;background:rgba(250,248,243,.95);backdrop-filter:blur(12px);border-top:1px solid var(--line);padding:10px 20px max(10px,env(safe-area-inset-bottom))}.nav-button{border:0;background:transparent;color:#99988f;display:flex;flex-direction:column;align-items:center;gap:3px;min-width:68px;font-size:9px}.nav-button span{font-size:19px;line-height:1.2}.nav-button.active{color:var(--olive-dark);font-weight:700}.card-dialog{border:1px solid var(--line);border-radius:18px;padding:25px;width:min(500px,calc(100% - 28px));max-height:90vh;overflow:auto;background:var(--panel);color:var(--ink);box-shadow:0 24px 80px rgba(20,20,15,.2)}.card-dialog::backdrop{background:rgba(31,33,27,.45);backdrop-filter:blur(3px)}.dialog-heading{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:20px}.dialog-heading h2{font-family:Manrope;margin:0;font-size:22px}.close-button{border:0;background:transparent;font-size:26px;color:var(--muted);line-height:1}.textarea-input{resize:vertical;min-height:65px}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:23px}.toast{position:fixed;bottom:88px;left:50%;transform:translate(-50%,15px);background:#30372d;color:white;border-radius:30px;padding:10px 16px;font-size:11px;opacity:0;pointer-events:none;transition:.2s;z-index:10;max-width:calc(100% - 30px);text-align:center}.toast.show{opacity:1;transform:translate(-50%,0)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:760px){.app-shell{padding:0 18px 98px}.topbar{height:70px}.local-pill{font-size:0;padding:8px}.local-pill .status-dot{margin:0}.page{padding-top:25px}.hero{padding:23px 0 25px}.hero-stamp{width:108px;height:108px;margin-right:0}.hero-stamp b{font-size:15px}.hero-stamp small{font-size:7px}.hero h1{font-size:36px;letter-spacing:-1.6px}.hero-copy{font-size:12px;max-width:410px}.stats-grid{gap:8px}.stat-card{padding:14px 12px;min-height:105px;border-radius:13px}.stat-label,.stat-foot{font-size:9px}.stat-card strong{font-size:28px}.home-grid,.settings-layout{grid-template-columns:1fr}.panel{padding:19px}.panel h2{font-size:18px}.page-heading{align-items:flex-start;flex-direction:column}.page-heading .button{width:100%}.page-heading h1{font-size:34px}.toolbar{align-items:flex-start;flex-direction:column}.search-wrap{width:100%}.word-card{padding:13px}.word-actions{flex-direction:column}.word-ko{font-size:17px}.study-area{margin:14px auto}.study-card{padding:30px 18px;min-height:310px}.study-direction{left:17px;top:17px}.study-counter{right:17px;top:17px}.rating-buttons{gap:5px}.rating-button{font-size:10px;padding:10px 2px}.rating-button span{font-size:8px}.bottom-nav{gap:25px}.direction-picker{gap:6px}.radio-card{padding:10px 7px}.radio-card b{font-size:10px}.radio-card small{font-size:9px}}
@media(max-width:390px){.hero-stamp{display:none}.stats-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.stat-label{min-height:24px}.stat-foot{line-height:1.3}.rating-button{font-size:9px}}

/* Версия 0.2: более мягкий ритм, крупная типографика и две цветовые темы. */
:root {
  color-scheme: light;
  --ink: #292b26;
  --muted: #73786f;
  --paper: #f3f1eb;
  --panel: #fffefa;
  --line: #e5e2d9;
  --olive: #68765a;
  --olive-dark: #3f4b39;
  --sage: #e7ecdf;
  --peach: #f4e4d9;
  --gold: #e8c58a;
  --shadow: 0 16px 42px rgba(45, 51, 39, .07);
  scroll-behavior: smooth;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf0e9;
  --muted: #a5ada1;
  --paper: #171c19;
  --panel: #202722;
  --line: #354139;
  --olive: #b7c6a7;
  --olive-dark: #829476;
  --sage: #303b31;
  --peach: #48362d;
  --gold: #d6b778;
  --shadow: 0 18px 46px rgba(0, 0, 0, .22);
}
body, .app-shell, .panel, .stat-card, .word-card, .study-card, .study-complete,
.card-dialog, .bottom-nav, .local-pill, .search-wrap, .text-input, .rating-button,
.radio-card, .tip-box, .settings-note, .empty-state, .mini-button, .button-outline {
  transition: background-color .28s ease, color .28s ease, border-color .28s ease, box-shadow .28s ease;
}
body { font-size: 15px; font-weight: 500; line-height: 1.55; }
button, input, textarea { font-size: inherit; }
.topbar { gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 16px; font-weight: 800; }
.brand small { font-size: 12px; font-weight: 600; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 13px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); color: var(--ink);
  font-size: 13px; font-weight: 750; transition: transform .2s ease, background .25s ease, border-color .25s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle span:first-child { font-size: 17px; line-height: 1; }
.local-pill { background: var(--panel); font-weight: 650; }
.hero h1 { font-weight: 850; }
.hero-copy, .muted { font-size: 14px; font-weight: 550; }
.eyebrow { font-size: 11px; font-weight: 850; letter-spacing: 1.35px; }
.stat-card { border-radius: 18px; padding: 21px 22px; }
.stat-label, .stat-foot { font-size: 12px; font-weight: 650; }
.stat-card strong { font-size: 38px; font-weight: 850; }
.panel { border-radius: 22px; padding: 27px; }
.panel h2 { font-size: 22px; font-weight: 800; }
.action-row { gap: 14px; padding: 17px 0; }
.action-row b { font-size: 14px; font-weight: 800; }
.action-row small { font-size: 12px; font-weight: 550; }
.tip-box { background: color-mix(in srgb, var(--gold) 13%, var(--panel)); border: 1px solid var(--line); border-radius: 15px; padding: 15px; }
.tip-box p { font-size: 12px; font-weight: 550; }
.page-heading h1 { font-weight: 850; }
.page-heading .muted { font-size: 14px; }
.button { min-height: 43px; border-radius: 13px; font-size: 14px; font-weight: 800; padding: 12px 18px; transition: transform .22s ease, background .25s ease, box-shadow .25s ease; }
.button:hover { transform: translateY(-2px); }
.button:active, .theme-toggle:active, .mini-button:active { transform: scale(.98); }
.button-dark { background: var(--olive-dark); color: #fff; box-shadow: 0 7px 16px rgba(53, 68, 46, .14); }
.button-dark:hover { background: color-mix(in srgb, var(--olive-dark) 88%, white); }
.button-outline { border-color: var(--line); }
.radio-card { border-radius: 15px; padding: 14px; }
.radio-card:has(input:checked) { border-color: var(--olive); background: color-mix(in srgb, var(--sage) 65%, var(--panel)); }
.radio-card b { font-size: 13px; font-weight: 800; }
.radio-card small { font-size: 11px; font-weight: 600; }
.toolbar { margin-bottom: 18px; }
.search-wrap { height: 48px; border-radius: 14px; background: var(--panel); }
.search-wrap input { font-size: 14px; font-weight: 600; }
.count-label { font-size: 13px; font-weight: 700; }
.word-card { border-radius: 18px; padding: 19px 21px; box-shadow: 0 5px 18px rgba(44, 50, 39, .025); }
.word-ko { font-size: 23px; font-weight: 800; }
.word-ru { font-size: 15px; font-weight: 750; color: var(--olive); }
.word-example { font-size: 13px; font-weight: 550; }
.word-meta { font-size: 12px; font-weight: 600; }
.mini-button { border-radius: 10px; padding: 9px 12px; color: var(--muted); font-size: 12px; font-weight: 750; }
.field-label { font-size: 13px; font-weight: 800; }
.text-input { border-color: var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 13px 14px; font-size: 15px; font-weight: 600; }
.field-help { font-size: 12px; font-weight: 550; }
.settings-note { background: color-mix(in srgb, var(--sage) 55%, var(--panel)); border: 1px solid var(--line); border-radius: 15px; }
.settings-note b { font-size: 13px; font-weight: 850; }
.settings-note p { font-size: 12px; font-weight: 550; }
.study-card { border-radius: 28px; padding: 45px 40px; }
.study-direction, .study-counter { font-size: 12px; font-weight: 750; }
.study-prompt { font-size: 13px; font-weight: 750; }
.study-word { font-size: clamp(40px, 8vw, 62px); font-weight: 800; }
.study-answer { font-size: 30px; font-weight: 800; }
.study-example { font-size: 15px; font-weight: 550; }
.study-example-translation { font-size: 13px; font-weight: 550; }
.rating-title { font-size: 13px; font-weight: 700; }
.rating-button { background: var(--panel); border-radius: 14px; padding: 14px 7px; font-size: 13px; font-weight: 850; }
.rating-button span { font-size: 11px; font-weight: 600; }
.study-complete { border-radius: 26px; }
.study-complete h2 { font-size: 28px; font-weight: 850; }
.study-complete p { font-size: 14px; font-weight: 550; }
.bottom-nav { background: color-mix(in srgb, var(--panel) 93%, transparent); border-color: var(--line); }
.nav-button { color: var(--muted); font-size: 11px; font-weight: 700; }
.nav-button.active { color: var(--olive); }
.card-dialog { border-radius: 24px; padding: 28px; }
.dialog-heading h2 { font-size: 25px; font-weight: 850; }
.audio-upload-section { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: color-mix(in srgb, var(--sage) 35%, var(--panel)); }
.audio-upload-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.audio-upload-heading b, .audio-upload-heading small { display: block; }
.audio-upload-heading b { font-size: 14px; font-weight: 850; }
.audio-upload-heading small { color: var(--muted); font-size: 12px; font-weight: 550; margin-top: 2px; }
.audio-upload-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; background: var(--sage); color: var(--olive); font-size: 23px; font-weight: 850; }
.audio-choose { width: 100%; }
.audio-file-status { color: var(--muted); font-size: 12px; font-weight: 650; margin: 11px 0 0; overflow-wrap: anywhere; }
.audio-preview { display: block; width: 100%; height: 40px; margin-top: 12px; }
.remove-audio-row { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: var(--muted); font-size: 12px; font-weight: 650; }
.remove-audio-row input { accent-color: var(--olive); width: 16px; height: 16px; }
.audio-play { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--sage); color: var(--ink); padding: 9px 14px; font-size: 13px; font-weight: 800; transition: transform .2s ease, background .2s ease; }
.audio-play:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--sage) 75%, var(--panel)); }
.audio-play-small { margin-top: 10px; padding: 7px 12px; font-size: 12px; }
.audio-play-study { margin-top: 16px; }
.toast { font-size: 13px; font-weight: 700; border-radius: 15px; padding: 13px 18px; }

:root[data-theme="dark"] body,
:root[data-theme="dark"] .app-shell { background: var(--paper); color: var(--ink); }
:root[data-theme="dark"] .stat-card:not(.stat-primary) { background: var(--panel); border-color: var(--line); }
:root[data-theme="dark"] .stat-primary { background: var(--accent-panel); border-color: var(--accent-border); }
:root[data-theme="dark"] .stat-primary .stat-label,
:root[data-theme="dark"] .stat-primary .stat-foot { color: var(--accent-muted); }
:root[data-theme="dark"] .local-pill { background: var(--panel); border-color: var(--line); }
:root[data-theme="dark"] .brand-mark { background: var(--accent-action); color: var(--accent-action-text); }
:root[data-theme="dark"] .button-dark { background: var(--accent-action); color: var(--accent-action-text); }
:root[data-theme="dark"] .button-dark:hover { background: var(--accent-hover); }
:root[data-theme="dark"] .button-outline { border-color: var(--line); color: var(--ink); background: transparent; }
:root[data-theme="dark"] .word-ru { color: var(--olive); }
:root[data-theme="dark"] .mini-button:hover { background: var(--accent-selected); color: var(--ink); }
:root[data-theme="dark"] .text-input { background: #1a211d; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .text-input::placeholder,
:root[data-theme="dark"] .search-wrap input::placeholder { color: #7f8a80; }
:root[data-theme="dark"] .search-wrap { background: var(--panel); border-color: var(--line); }
:root[data-theme="dark"] .search-wrap input { color: var(--ink); }
:root[data-theme="dark"] .settings-note,
:root[data-theme="dark"] .audio-upload-section { background: var(--accent-selected); border-color: var(--line); }
:root[data-theme="dark"] .tip-box { background: var(--accent-selected); border-color: var(--line); }
:root[data-theme="dark"] .tip-box b { color: var(--ink); }
:root[data-theme="dark"] .radio-card:has(input:checked) { background: var(--accent-selected); border-color: var(--olive); }
:root[data-theme="dark"] .rating-button { background: #252e28; color: var(--ink); }
:root[data-theme="dark"] .rating-button.again { border-color: #76574b; }
:root[data-theme="dark"] .rating-button.easy { border-color: #617557; }
:root[data-theme="dark"] .complete-mark { background: var(--accent-selected); color: var(--olive); }
:root[data-theme="dark"] .bottom-nav { background: rgba(30, 38, 33, .94); }
:root[data-theme="dark"] .card-dialog { background: var(--panel); color: var(--ink); }
:root[data-theme="dark"] .card-dialog::backdrop { background: rgba(0, 0, 0, .68); }
:root[data-theme="dark"] .study-answer { color: var(--olive); }
:root[data-theme="dark"] .success-message { color: var(--olive); }
:root[data-theme="dark"] .version-label { border-color: var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media(max-width:760px) {
  .topbar-right { gap: 7px; }
  .theme-toggle { width: 42px; min-width: 42px; padding: 8px; }
  .theme-toggle #theme-label { display: none; }
  .local-pill { padding: 8px; }
  .word-ko { font-size: 21px; }
  .word-ru { font-size: 14px; }
  .panel { padding: 21px; }
  .study-card { padding: 38px 18px; }
  .rating-button { padding: 12px 3px; }
  .audio-upload-section { padding: 15px; }
}

/* Version 0.3: multimodal study modes and personal finish cards */
.study-mode-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:20px 0 17px}
.mode-card{display:flex;align-items:center;gap:12px;min-height:82px;padding:14px;border:1px solid var(--line);border-radius:16px;background:var(--panel);cursor:pointer;transition:transform .2s ease,border-color .2s ease,background .2s ease,box-shadow .2s ease}
.mode-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.mode-card input{position:absolute;opacity:0;pointer-events:none}
.mode-card:has(input:checked){border-color:var(--olive);background:color-mix(in srgb,var(--sage) 64%,var(--panel));box-shadow:0 0 0 2px color-mix(in srgb,var(--olive) 16%,transparent)}
.mode-card:focus-within{outline:2px solid var(--olive);outline-offset:3px}
.mode-icon{flex:0 0 40px;width:40px;height:40px;display:grid;place-items:center;border-radius:13px;background:var(--sage);color:var(--olive);font-size:22px;font-weight:850}
.mode-card b,.mode-card small{display:block}
.mode-card b{font-size:13px;font-weight:850;line-height:1.35}
.mode-card small{font-size:11px;color:var(--muted);font-weight:600;margin-top:4px;line-height:1.35}
.image-upload-section{margin-top:18px;padding:18px;border:1px solid var(--line);border-radius:17px;background:color-mix(in srgb,var(--peach) 28%,var(--panel))}
.image-preview{display:block;max-width:100%;max-height:220px;object-fit:contain;margin-top:12px;border-radius:13px;border:1px solid var(--line);background:var(--paper)}
.card-image-thumb{width:84px;height:84px;object-fit:cover;border-radius:13px;border:1px solid var(--line);background:var(--sage)}
.word-card:has(.card-image-thumb){grid-template-columns:90px minmax(0,1fr) auto}
.word-card .word-main{grid-column:auto}
.study-prompt-image{display:block;width:min(100%,360px);max-height:300px;object-fit:contain;border-radius:18px;margin:5px auto 15px;border:1px solid var(--line);background:var(--paper)}
.study-input-wrap{width:min(100%,470px);margin:18px auto 0;text-align:left}
.study-input-wrap .text-input{font-size:20px;font-weight:750;text-align:center;min-height:58px}
.study-input-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:9px;margin-top:13px}
.study-input-actions .button{min-width:155px}
.study-feedback{padding:12px 15px;border-radius:13px;margin:14px auto 0;max-width:470px;font-size:13px;font-weight:700;line-height:1.5}
.study-feedback.correct{background:color-mix(in srgb,var(--sage) 80%,var(--panel));color:var(--olive-dark)}
.study-feedback.incorrect{background:color-mix(in srgb,var(--peach) 68%,var(--panel));color:#8d5746}
.study-feedback.neutral{background:color-mix(in srgb,var(--sage) 35%,var(--panel));color:var(--muted)}
.study-answer{overflow-wrap:anywhere}
.motivation-list{display:grid;gap:13px;margin-top:18px}
.motivation-editor{display:grid;grid-template-columns:112px minmax(0,1fr);gap:12px;padding:14px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--sage) 20%,var(--panel))}
.motivation-preview{width:112px;height:112px;border-radius:13px;display:grid;place-items:center;overflow:hidden;background:var(--sage);color:var(--olive);font-size:26px;font-weight:850}
.motivation-preview img{width:100%;height:100%;object-fit:cover}
.motivation-fields{min-width:0}
.motivation-fields textarea{min-height:76px;resize:vertical}
.motivation-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:9px}
.motivation-upload{display:inline-flex;align-items:center;justify-content:center;min-height:35px;padding:7px 10px;border:1px solid var(--line);border-radius:10px;color:var(--muted);font-size:11px;font-weight:750;cursor:pointer}
.motivation-upload input{position:absolute;opacity:0;width:1px;height:1px}
.motivation-delete{border:0;background:transparent;color:#a56b58;font-size:11px;font-weight:750;padding:8px;cursor:pointer}
.motivation-limit{font-size:12px;color:var(--muted);font-weight:650}
.study-complete-message{max-width:520px;margin:20px auto 0;padding:0;overflow:hidden;border-radius:18px;border:1px solid var(--line);background:color-mix(in srgb,var(--sage) 22%,var(--panel));text-align:left}
.study-complete-message img{display:block;width:100%;max-height:250px;object-fit:cover}
.study-complete-message p{padding:17px 20px;margin:0;color:var(--ink);font-size:16px;font-weight:750;white-space:pre-wrap}
:root[data-theme="dark"] .mode-card:has(input:checked){background:var(--accent-selected);border-color:var(--olive)}
:root[data-theme="dark"] .image-upload-section,:root[data-theme="dark"] .motivation-editor{background:var(--accent-selected);border-color:var(--line)}
:root[data-theme="dark"] .motivation-preview{background:var(--accent-selected);color:var(--olive)}
:root[data-theme="dark"] .study-feedback.correct{background:var(--accent-selected);color:var(--accent-muted)}
:root[data-theme="dark"] .study-feedback.incorrect{background:#48362d;color:#f0cbbb}
:root[data-theme="dark"] .study-complete-message{background:var(--accent-selected);border-color:var(--line)}
@media(max-width:760px){
  .study-mode-grid{grid-template-columns:1fr}
  .mode-card{min-height:72px;padding:12px}
  .word-card:has(.card-image-thumb){grid-template-columns:68px minmax(0,1fr)}
  .word-card:has(.card-image-thumb) .word-actions{grid-column:2;flex-direction:row}
  .card-image-thumb{width:68px;height:68px;grid-row:1 / span 2}
  .motivation-editor{grid-template-columns:76px minmax(0,1fr);gap:10px;padding:10px}
  .motivation-preview{width:76px;height:76px}
  .study-prompt-image{max-height:230px}
}


/* v0.4: дневные лимиты, цветовые палитры и фразы главной страницы */
.home-inspiration{display:flex;align-items:center;gap:15px;padding:16px 19px;margin:0 0 19px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--sage) 48%,var(--panel));box-shadow:0 5px 18px rgba(49,44,33,.025)}
.home-inspiration-mark{flex:0 0 38px;width:38px;height:38px;display:grid;place-items:center;border-radius:12px;background:var(--sage);color:var(--olive);font-size:20px}
.home-inspiration .eyebrow{margin:0 0 4px;font-size:9px}
.home-phrase-text{margin:0;color:var(--ink);font-size:15px;font-weight:800;line-height:1.45;white-space:pre-wrap}
.daily-cap-summary{margin-top:13px;padding:10px 12px;border-radius:11px;background:var(--sage);color:var(--olive-dark);font-size:11px;font-weight:750;line-height:1.5;text-align:center}
.limit-input-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:17px}
.limit-field{display:block;padding:14px;border:1px solid var(--line);border-radius:13px;background:color-mix(in srgb,var(--sage) 22%,var(--panel))}
.limit-field>span{display:block;font-size:12px;font-weight:800;margin-bottom:9px}
.limit-field .text-input{font-size:20px;font-weight:850;max-width:100%}
.limit-field small{display:block;margin-top:7px;color:var(--muted);font-size:10px;line-height:1.4}
.accent-palette{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:16px}
.accent-swatch{display:flex;align-items:center;gap:10px;min-height:48px;padding:8px 10px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink);text-align:left;transition:border-color .2s,background .2s,transform .2s}
.accent-swatch:hover{transform:translateY(-1px)}
.accent-swatch.active{border-color:var(--olive);background:var(--sage);box-shadow:0 0 0 2px color-mix(in srgb,var(--olive) 16%,transparent)}
.accent-swatch-dot{width:25px;height:25px;flex:0 0 25px;border-radius:9px;background:var(--swatch);box-shadow:inset 0 0 0 1px rgba(0,0,0,.08)}
.accent-swatch-label{font-size:11px;font-weight:800;line-height:1.25}
.home-phrases-list{display:grid;gap:10px}
.home-phrase-editor{padding:12px;border:1px solid var(--line);border-radius:13px;background:color-mix(in srgb,var(--sage) 18%,var(--panel))}
.home-phrase-editor .field-label{margin:0 0 7px}
.home-phrase-editor textarea{min-height:62px;resize:vertical;font-weight:650}
.home-phrase-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:4px}
.home-phrase-actions .field-help{margin:0}
:root[data-theme="dark"] .home-inspiration{background:var(--accent-selected);border-color:var(--line)}
:root[data-theme="dark"] .daily-cap-summary{background:var(--accent-selected);color:var(--olive)}
:root[data-theme="dark"] .limit-field,:root[data-theme="dark"] .home-phrase-editor{background:var(--accent-selected);border-color:var(--line)}
:root[data-theme="dark"] .accent-swatch.active{background:var(--accent-selected);border-color:var(--olive)}
@media(max-width:760px){.limit-input-grid{grid-template-columns:1fr 1fr}.accent-palette{grid-template-columns:1fr 1fr}.home-phrase-text{font-size:14px}}
@media(max-width:390px){.limit-input-grid{grid-template-columns:1fr}.accent-palette{grid-template-columns:1fr}}

/* Облачная синхронизация v0.5 */
.cloud-sync-panel{grid-column:1/-1}
.cloud-panel-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:8px}
.cloud-panel-heading h2{margin:0}
.cloud-sync-badge{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:30px;padding:7px 11px;font-size:10px;color:var(--muted);white-space:nowrap;background:var(--panel)}
.cloud-sync-badge[data-kind="success"]{color:#3c7b52;border-color:#b7d2bd;background:#eef7ef}
.cloud-sync-badge[data-kind="pending"]{color:#946d2f;border-color:#e6d4ad;background:#fbf5e8}
.cloud-sync-badge[data-kind="warning"]{color:#a15c35;border-color:#e8c6b3;background:#fbf0e9}
.cloud-hint{margin:17px 0;padding:15px 16px;background:var(--sage);border:1px solid var(--line);border-radius:12px}
.cloud-hint b{font-size:12px}
.cloud-hint p,.cloud-conflict-actions p{font-size:11px;line-height:1.65;color:var(--muted);margin:6px 0 0}
.cloud-hint code{font-family:Consolas,monospace;font-size:10px}
.cloud-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:14px}
.cloud-account-line{font-size:12px;color:var(--muted);overflow-wrap:anywhere}
.cloud-account-line strong{color:var(--ink)}
.cloud-conflict-actions{display:flex;gap:9px;flex-wrap:wrap;padding:15px;margin-top:15px;border:1px solid #e5c6a9;background:#fcf5eb;border-radius:12px}
.cloud-conflict-actions p{width:100%;margin:0 0 4px}
.cloud-sync-status{font-size:11px;color:var(--muted);padding:10px 12px;background:var(--paper);border-radius:9px;margin:15px 0 0;line-height:1.55;overflow-wrap:anywhere}
.cloud-sync-status[data-kind="success"]{color:#39764d}
.cloud-sync-status[data-kind="warning"],.cloud-sync-status[data-kind="error"]{color:#a15c35}
.cloud-sync-status[data-kind="pending"]{color:#946d2f}
@media(max-width:600px){.cloud-panel-heading{flex-direction:column}.cloud-actions{flex-direction:column}.cloud-actions .button,.cloud-conflict-actions .button{width:100%}}
:root[data-theme="dark"] .cloud-sync-badge[data-kind="success"]{color:#b8dfc1;background:#213629;border-color:#3d644a}
:root[data-theme="dark"] .cloud-sync-badge[data-kind="pending"]{color:#e2c58e;background:#3c3321;border-color:#75603a}
:root[data-theme="dark"] .cloud-sync-badge[data-kind="warning"]{color:#efc0a3;background:#3e2d25;border-color:#78513c}
:root[data-theme="dark"] .cloud-conflict-actions{background:#382d24;border-color:#75513b}
:root[data-theme="dark"] .cloud-sync-status{background:var(--dark-panel, #242b27)}


/* v0.7: thematic free practice and vocabulary classification */
.practice-divider{height:1px;background:var(--line);margin:23px 0 19px}
.free-practice{padding:17px;border:1px solid var(--line);border-radius:15px;background:color-mix(in srgb,var(--sage) 20%,var(--panel))}
.practice-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}
.practice-heading h3{margin:0;font-family:'Segoe UI',Arial,sans-serif;font-size:18px;letter-spacing:-.3px}
.practice-heading .eyebrow{margin:0 0 5px}
.practice-icon{width:34px;height:34px;display:grid;place-items:center;border-radius:11px;background:var(--sage);color:var(--olive);font-size:17px}
.free-practice>.muted{margin:8px 0 13px;font-size:11px}
.practice-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.practice-field{display:block;min-width:0}
.practice-field>span{display:block;font-size:10px;font-weight:800;margin:0 0 6px;color:var(--muted)}
.practice-field .text-input{min-height:40px;padding:9px 10px;font-size:11px;font-weight:700}
.practice-available{margin:12px 0 8px;text-align:center;color:var(--muted);font-size:10px;font-weight:750}
.free-practice>.button{margin-top:3px}
.practice-footnote{font-size:9px;line-height:1.5;text-align:center;color:var(--muted);margin:9px 2px 0}
.card-classification-grid{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-top:2px}
.card-classification-grid label{min-width:0}
.card-classification-grid .field-label{margin-bottom:7px}
.card-classification-grid .text-input{font-size:11px;font-weight:700}
.classification-help{margin-top:7px}
.word-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.word-tag{display:inline-flex;align-items:center;padding:4px 8px;border-radius:20px;background:var(--sage);color:var(--olive-dark);font-size:9px;font-weight:800}
.word-tag-topik{background:color-mix(in srgb,var(--peach) 55%,var(--panel));color:#875b43}
.practice-safety-note,.practice-advance-note{max-width:460px;border-radius:11px;padding:9px 12px;background:var(--accent-selected);color:var(--accent-muted);font-size:10px;font-weight:750;line-height:1.5;text-align:center;margin:0 auto 16px}
.practice-advance-note{margin:18px auto 10px}
.practice-next-button{margin:8px auto 0;min-width:190px}
.practice-study-card .study-direction{color:var(--olive)}
:root[data-theme="dark"] .free-practice{background:var(--accent-selected);border-color:var(--line)}
:root[data-theme="dark"] .practice-icon{background:var(--accent-selected);color:var(--olive)}
:root[data-theme="dark"] .word-tag{background:var(--accent-selected);color:var(--olive)}
:root[data-theme="dark"] .word-tag-topik{background:#49372e;color:#e4c2ad}
@media(max-width:760px){
  .free-practice{padding:14px}
  .practice-fields{grid-template-columns:1fr 1fr}
  .card-classification-grid{grid-template-columns:1fr}
}
@media(max-width:430px){.practice-fields{grid-template-columns:1fr 1fr}.practice-field .text-input{font-size:10px;padding:8px 7px}}


/* v0.8 PWA and mobile finishing */
html { min-height: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: contain; }
button, input, select, textarea { touch-action: manipulation; }
.app-shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
.topbar { gap: 12px; }
.topbar-right { display:flex; align-items:center; justify-content:flex-end; flex-wrap:nowrap; }
.local-pill { display:inline-flex; align-items:center; gap:6px; max-width:190px; }
.pwa-install-button { min-height:40px; display:inline-flex; align-items:center; justify-content:center; gap:7px; padding:8px 12px; border:1px solid var(--line); border-radius:12px; background:var(--panel); color:var(--ink); font-size:11px; font-weight:800; }
.pwa-install-button:hover { border-color:var(--olive); }
.pwa-install-button span:first-child { font-size:16px; }
.pwa-offline-banner { position:sticky; top:0; z-index:5; padding:10px 14px; margin:10px 0 0; border:1px solid #c79b65; border-radius:12px; background:#fff5e5; color:#78562d; font-size:12px; font-weight:700; line-height:1.45; }
.pwa-install-panel { grid-column:1/-1; }
.pwa-install-help { margin-top:14px; padding:13px 15px; border:1px solid var(--line); border-radius:12px; background:var(--accent-selected); color:var(--ink); font-size:12px; line-height:1.65; }
.pwa-install-help strong { font-weight:850; }
#pwa-cache-status { margin-top:10px; }
:root[data-theme="dark"] .pwa-install-help { background:var(--accent-selected); border-color:var(--line); }
:root[data-theme="dark"] .pwa-offline-banner { background:#3c3321; border-color:#75603a; color:#f0d4a0; }

@media(max-width:760px) {
  .app-shell { padding-left:16px; padding-right:16px; padding-bottom:calc(118px + env(safe-area-inset-bottom)); }
  .topbar { min-height:66px; height:auto; padding:9px 0; }
  .brand { gap:8px; min-width:0; }
  .brand-mark { width:36px; height:36px; flex:0 0 36px; }
  .brand strong { font-size:13px; }
  .brand small { font-size:10px; }
  .topbar-right { gap:6px; }
  .local-pill { width:28px; height:28px; justify-content:center; padding:0; flex:0 0 28px; overflow:hidden; }
  .local-pill #storage-mode-label { display:none; }
  .status-dot { margin:0; }
  .pwa-install-button { width:38px; min-width:38px; height:38px; padding:7px; border-radius:11px; }
  .pwa-install-label { display:none; }
  .theme-toggle { width:38px; min-width:38px; height:38px; }
  .page { padding-top:20px; }
  .panel { padding:17px; border-radius:16px; }
  .hero { gap:10px; padding:17px 0 20px; }
  .hero h1 { font-size:clamp(29px,8.4vw,36px); }
  .hero-copy { font-size:12px; line-height:1.55; margin-top:10px; }
  .stats-grid { gap:7px; }
  .stat-card { min-width:0; padding:12px 9px; }
  .stat-card strong { font-size:26px; }
  .stat-label, .stat-foot { font-size:9px; }
  .mode-card { min-height:74px; padding:11px 9px; gap:8px; }
  .mode-icon { width:34px; height:34px; flex-basis:34px; }
  .mode-card b { font-size:11px; }
  .mode-card small { font-size:9px; }
  .button, .mini-button, .nav-button { min-height:42px; }
  .bottom-nav { justify-content:space-around; gap:8px; padding:9px 12px calc(8px + env(safe-area-inset-bottom)); }
  .nav-button { min-width:76px; font-size:10px; }
  .nav-button span { font-size:20px; }
  .study-card { min-height:300px; padding:48px 16px 24px; border-radius:20px; }
  .study-direction { max-width:62%; font-size:9px; line-height:1.35; }
  .study-counter { font-size:10px; }
  .study-input-wrap .text-input { font-size:18px; }
  .rating-buttons { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .rating-button { min-height:58px; font-size:12px; }
  .rating-button span { font-size:10px; }
  .card-dialog { width:calc(100vw - 18px); max-width:560px; max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 18px); padding:20px 16px; border-radius:20px; }
  .dialog-actions { position:sticky; bottom:-20px; padding:12px 0 max(4px,env(safe-area-inset-bottom)); background:var(--panel); }
  .dialog-actions .button { flex:1; }
  .motivation-editor { grid-template-columns:68px minmax(0,1fr); }
  .motivation-preview { width:68px; height:68px; }
  .cloud-actions .button { min-height:46px; }
  .pwa-install-panel .button { min-height:46px; }
}

@media(max-width:360px) {
  .app-shell { padding-left:12px; padding-right:12px; }
  .brand small { display:none; }
  .hero h1 { font-size:29px; }
  .stats-grid { gap:5px; }
  .stat-card { padding:10px 7px; }
  .stat-card strong { font-size:23px; }
  .panel { padding:14px; }
  .rating-buttons { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (display-mode: standalone) {
  .app-shell { padding-top: env(safe-area-inset-top); }
  .bottom-nav { padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
}
