/* Merkwort — интерфейс под iPhone (Safari / экран «Домой») */
:root {
  --bg: #F2F2F7;
  --bg2: #FFFFFF;
  --bg3: #E9E9EF;
  --fill: rgba(120,120,128,.12);
  --text: #0B0B0F;
  --text2: #6C6C72;
  --text3: #A1A1A8;
  --sep: rgba(60,60,67,.14);
  --accent: #5E5CE6;
  --accent2: #8E6CFF;
  --green: #22B357;
  --red: #FF3B30;
  --orange: #FF9500;
  --blue: #0A84FF;
  --der: #0A84FF;
  --die: #FF2D55;
  --das: #1FB85A;
  --glass: rgba(255,255,255,.72);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(20,20,40,.08);
  --shadow-card: 0 2px 6px rgba(0,0,0,.05), 0 18px 48px rgba(30,30,80,.14);
  --r: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg2: #16161A;
    --bg3: #232328;
    --fill: rgba(120,120,128,.24);
    --text: #F5F5F7;
    --text2: #9A9AA2;
    --text3: #5E5E66;
    --sep: rgba(84,84,88,.5);
    --accent: #7D7AFF;
    --accent2: #A58BFF;
    --green: #32D74B;
    --red: #FF453A;
    --orange: #FF9F0A;
    --blue: #409CFF;
    --der: #409CFF;
    --die: #FF5C7A;
    --das: #32D74B;
    --glass: rgba(30,30,34,.66);
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-card: 0 18px 48px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 17px; color: var(--text); }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.tab { max-width: 600px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 110px); }
.tab.enter { animation: fadeUp .28s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.head { display: flex; align-items: flex-end; justify-content: space-between; margin: 8px 4px 16px; }
.head h1 { font-size: 34px; line-height: 1.1; letter-spacing: -.02em; margin: 0; font-weight: 800; }
.head .sub { color: var(--text2); font-size: 15px; margin-top: 4px; font-weight: 500; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--text); flex: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { transform: scale(.92); }

.tabbar {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 10px); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 8px 30px rgba(0,0,0,.14), inset 0 0 0 .5px rgba(255,255,255,.35); z-index: 20;
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 104px; padding: 7px 0 6px; border-radius: 999px; color: var(--text2); font-size: 11px; font-weight: 600; transition: background .2s, color .2s; }
.tabbar svg { width: 25px; height: 25px; }
.tabbar button.on { color: var(--accent); background: var(--fill); }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text2); margin: 26px 8px 8px; font-weight: 600; }
.group { background: var(--bg2); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 52px; width: 100%; text-align: left; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.row:active { background: var(--fill); }
.row .grow { flex: 1; min-width: 0; }
.row .hint { color: var(--text2); font-size: 15px; }
.row .chev { color: var(--text3); width: 18px; height: 18px; flex: none; }
.row .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.row .ic svg { width: 18px; height: 18px; }
.row.danger { color: var(--red); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 56px; border-radius: 18px; font-weight: 700; font-size: 18px; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 24px -8px var(--accent); }
.btn.soft { background: var(--fill); color: var(--accent); }
.btn.plain { background: var(--bg2); color: var(--text); box-shadow: var(--shadow); }
.btn.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 22px; height: 22px; }

/* ---------- вкладка «Колоды» ---------- */
.drop {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 20px; border-radius: var(--r);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--bg2)), var(--bg2));
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); text-align: left;
}
.drop:active { transform: scale(.985); }
.drop .big-ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); flex: none; box-shadow: 0 8px 20px -8px var(--accent); }
.drop .big-ic svg { width: 28px; height: 28px; }
.drop b { display: block; font-size: 19px; }
.drop span { color: var(--text2); font-size: 14px; }
.formats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.formats i { font-style: normal; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--fill); color: var(--text2); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; background: color-mix(in srgb, var(--orange) 14%, var(--bg2)); margin-top: 12px; font-size: 15px; }
.banner svg { width: 22px; height: 22px; flex: none; color: var(--orange); margin-top: 1px; }
.banner b { display: block; }

.deck { display: block; width: 100%; text-align: left; padding: 16px; background: var(--bg2); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 10px; }
.deck:active { transform: scale(.985); }
.deck .top { display: flex; align-items: center; gap: 10px; }
.deck .name { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck .due { font-size: 14px; font-weight: 700; color: #fff; background: var(--accent); padding: 3px 10px; border-radius: 99px; }
.deck .due.zero { background: var(--fill); color: var(--text2); }
.deck .meta { color: var(--text2); font-size: 14px; margin: 4px 0 12px; }
.bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--fill); gap: 2px; }
.bar i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text2); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--c); vertical-align: 0; }

.empty { text-align: center; padding: 40px 20px; color: var(--text2); }
.empty .em { font-size: 56px; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 20px; margin-bottom: 6px; }

/* ---------- вкладка «Учить» ---------- */
.pills { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; padding: 8px 14px; border-radius: 99px; background: var(--bg2); box-shadow: var(--shadow); font-size: 15px; font-weight: 600; color: var(--text2); white-space: nowrap; max-width: 75vw; overflow: hidden; text-overflow: ellipsis; }
.pill.on { background: var(--text); color: var(--bg2); }

.hero { background: var(--bg2); border-radius: 28px; box-shadow: var(--shadow); padding: 22px 20px 20px; }
.hero-top { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.ring .bgc { stroke: var(--fill); }
.ring .fgc { stroke: url(#ringGrad); transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .num b { font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring .num span { font-size: 12px; color: var(--text2); margin-top: 4px; font-weight: 600; }
.qcounts { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.qc { display: flex; align-items: center; justify-content: space-between; font-size: 15px; color: var(--text2); font-weight: 500; }
.qc b { font-size: 20px; color: var(--c); font-variant-numeric: tabular-nums; }
.qc::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 8px; }
.qc span { flex: 1; }
.hero .btn { margin-top: 20px; }
.hero .done-note { text-align: center; margin-top: 16px; color: var(--text2); font-size: 15px; }
.hero .done-note b { color: var(--text); display: block; font-size: 19px; margin-bottom: 2px; }
.hero .more { margin-top: 10px; }

.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--bg2); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 12px; }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 12px; line-height: 1.25; color: var(--text2); font-weight: 600; margin-top: 2px; }
.stat.fire b { color: var(--orange); }

.heat { background: var(--bg2); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; }
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heat-grid i { aspect-ratio: 1; border-radius: 3px; background: var(--fill); }
.heat-grid i.l1 { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.heat-grid i.l2 { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.heat-grid i.l3 { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.heat-grid i.l4 { background: var(--accent); }
.heat-grid i.today { outline: 1.5px solid var(--text); outline-offset: 1px; }
.heat-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 8px; }

/* ---------- сессия ---------- */
.session { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 12px); animation: fadeUp .25s ease both; }
.s-top { display: flex; align-items: center; gap: 10px; height: 44px; }
.s-top .icon-btn { width: 38px; height: 38px; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.s-counts { display: flex; justify-content: center; gap: 18px; margin: 6px 0 10px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; }
.s-counts span { color: var(--c); opacity: .55; padding-bottom: 2px; border-bottom: 2px solid transparent; }
.s-counts span.cur { opacity: 1; border-color: var(--c); }

.stage { flex: 1; position: relative; perspective: 1400px; min-height: 0; }
.card-wrap { position: absolute; inset: 0; touch-action: none; will-change: transform; }
.card-wrap.fly { transition: transform .32s cubic-bezier(.3,.6,.4,1), opacity .32s; }
.card-wrap.back { transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.card-wrap.appear { animation: cardIn .34s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }
.card { position: absolute; inset: 0; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .5s cubic-bezier(.25,.9,.3,1); }
.card.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: 30px; background: var(--bg2); box-shadow: var(--shadow-card);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; padding: 22px 22px 18px; overflow: hidden; user-select: none; -webkit-user-select: none;
}
.face.b { transform: rotateY(180deg); }
.face .scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: flex-start; text-align: center; gap: 10px; min-height: 0; }
.face .tagline { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text3); font-weight: 600; min-height: 22px; }
.face .tap-hint { text-align: center; color: var(--text3); font-size: 13px; font-weight: 500; }
.stamp { position: absolute; top: 26px; padding: 6px 14px; border-radius: 12px; font-weight: 800; font-size: 20px; border: 3px solid; opacity: 0; transform: rotate(-12deg); pointer-events: none; z-index: 2; }
.stamp.yes { left: 22px; color: var(--green); }
.stamp.no { right: 22px; color: var(--red); transform: rotate(12deg); }

.w-pos { font-size: 14px; color: var(--text2); font-weight: 600; }
.w-word { font-size: 38px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.w-word.long { font-size: 28px; }
.w-word.xlong { font-size: 22px; line-height: 1.25; font-weight: 700; }
.art { font-weight: 800; }
.art.der { color: var(--der); } .art.die { color: var(--die); } .art.das { color: var(--das); }
.g-der { --g: var(--der); } .g-die { --g: var(--die); } .g-das { --g: var(--das); }
.face.gendered::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--g); }
.w-plural { font-size: 17px; color: var(--text2); font-weight: 500; }
.w-plural .art { font-weight: 700; }
.w-phon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 17px; color: var(--text2); }
.w-phon .ipa { font-family: "SF Pro Text", "Charis SIL", "Doulos SIL", "Gentium", "Noto Sans", sans-serif; }
.w-phon .ru { color: var(--text); font-weight: 600; }
.speak { width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); margin: 2px auto 0; }
.speak svg { width: 24px; height: 24px; }
.speak.sm { width: 32px; height: 32px; margin: 0; }
.speak.sm svg { width: 18px; height: 18px; }
.speak.on { animation: pulse 1s ease infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }
.w-ex { font-size: 18px; line-height: 1.4; margin-top: 4px; padding: 12px 14px; border-radius: 16px; background: var(--fill); text-align: left; display: flex; gap: 10px; align-items: center; }
.w-ex .t { flex: 1; }
.w-ex mark { background: none; color: var(--accent); font-weight: 700; }
.w-ex .tl { display: block; color: var(--text2); font-size: 15px; margin-top: 4px; }
.w-tl { font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.w-tl.long { font-size: 24px; } .w-tl.xlong { font-size: 20px; font-weight: 700; }
.w-extra { font-size: 15px; color: var(--text2); white-space: pre-line; }
.w-mini { padding-bottom: 12px; border-bottom: .5px solid var(--sep); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.w-mini .w-word { font-size: 24px; }
.w-mini .w-word.long, .w-mini .w-word.xlong { font-size: 19px; }

.answer { display: grid; gap: 10px; margin-top: 14px; min-height: 76px; }
.answer.two { grid-template-columns: 1fr 1fr; }
.answer.four { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ans { height: 76px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: 19px; color: #fff; transition: transform .1s; }
.ans small { font-size: 13px; font-weight: 600; opacity: .85; }
.ans:active { transform: scale(.95); }
.four .ans { font-size: 15px; height: 70px; border-radius: 18px; }
.ans.again { background: var(--red); } .ans.hard { background: var(--orange); } .ans.good { background: var(--green); } .ans.easy { background: var(--blue); }
.reveal { height: 76px; margin-top: 14px; border-radius: 22px; }

.finish { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 10px; }
.finish .badge { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; background: linear-gradient(135deg, var(--green), #6EE7A0); color: #fff; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; box-shadow: 0 16px 40px -14px var(--green); }
.finish .badge svg { width: 56px; height: 56px; stroke-width: 2.6; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.finish h2 { font-size: 30px; margin: 4px 0 0; letter-spacing: -.02em; }
.finish p { color: var(--text2); margin: 0 0 12px; }
.finish .stats3 { margin: 6px 0 18px; text-align: left; }
.finish .btn + .btn { margin-top: 10px; }

/* ---------- листы (bottom sheet) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.36); z-index: 40; opacity: 0; transition: opacity .25s; }
.sheet-bg.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: calc(100dvh - var(--safe-t) - 18px);
  background: var(--bg); border-radius: 26px 26px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .34s cubic-bezier(.2,.9,.3,1); box-shadow: 0 -10px 40px rgba(0,0,0,.18);
}
.sheet.show { transform: none; }
.sheet .grab { padding: 8px 0 2px; display: grid; place-items: center; touch-action: none; }
.sheet .grab::before { content: ""; width: 38px; height: 5px; border-radius: 9px; background: var(--text3); opacity: .6; }
.sheet .sh-head { display: flex; align-items: center; gap: 10px; padding: 4px 16px 10px; }
.sheet .sh-head h2 { flex: 1; font-size: 22px; margin: 0; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .sh-body { overflow-y: auto; padding: 0 16px calc(var(--safe-b) + 20px); -webkit-overflow-scrolling: touch; }
.sheet .sh-foot { padding: 10px 16px calc(var(--safe-b) + 12px); border-top: .5px solid var(--sep); background: var(--bg); }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--text2); font-weight: 600; margin: 0 6px 6px; }
.input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 0; background: var(--bg2); box-shadow: var(--shadow); outline: none; }
.input:focus { box-shadow: 0 0 0 2px var(--accent); }
textarea.input { resize: vertical; min-height: 52px; line-height: 1.35; }
.search { position: sticky; top: 0; background: var(--bg); padding: 2px 0 10px; z-index: 2; }

.map-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.map-row + .map-row { border-top: .5px solid var(--sep); }
.map-row .col { flex: 1; min-width: 0; }
.map-row .col b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row .col span { display: block; font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row select { appearance: none; -webkit-appearance: none; border: 0; border-radius: 10px; padding: 7px 26px 7px 10px; font-size: 15px; font-weight: 600; background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 6px center / 16px; color: var(--accent); max-width: 52%; }
.map-row select.skip { color: var(--text3); }

.preview { position: relative; height: 330px; perspective: 1200px; margin: 4px 0 8px; }
.preview .face { box-shadow: var(--shadow); }
.pv-nav { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--text2); font-size: 14px; font-weight: 600; }
.pv-nav .icon-btn { width: 34px; height: 34px; }

.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text2); }
.seg button.on { background: var(--bg2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 36px; height: 32px; border-radius: 9px; background: var(--fill); font-size: 20px; font-weight: 600; color: var(--accent); }
.stepper b { min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 99px; background: var(--fill); position: relative; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.set-block { padding: 14px 16px; }
.set-block + .set-block { border-top: .5px solid var(--sep); }
.set-block .lbl { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.set-block .lbl + .seg { margin-top: 10px; }
.set-block small { display: block; color: var(--text2); font-size: 13px; margin-top: 6px; }

.word-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; width: 100%; text-align: left; }
.word-row + .word-row { border-top: .5px solid var(--sep); }
.word-row:active { background: var(--fill); }
.word-row .grow { flex: 1; min-width: 0; }
.word-row b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-row span.tl { display: block; font-size: 14px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.kpi div { background: var(--bg2); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; color: var(--c, var(--text)); }
.kpi span { font-size: 11px; color: var(--text2); font-weight: 600; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.actions .btn { height: 50px; font-size: 16px; border-radius: 16px; }
.note { font-size: 13px; color: var(--text2); margin: 8px 6px 0; line-height: 1.4; }
.foot-note { text-align: center; font-size: 12px; color: var(--text3); margin-top: 26px; }

.toast { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; top: calc(var(--safe-t) + 10px); transform: translateY(-160%); z-index: 60; padding: 12px 18px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 15px; font-weight: 600; max-width: calc(100% - 32px); transition: transform .35s cubic-bezier(.2,1.2,.4,1); text-align: center; }
.toast.show { transform: none; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- статистика ---------- */
.stat-seg { margin-bottom: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stats-grid .stat b small { font-size: 15px; color: var(--text2); font-weight: 600; }
.stat em { display: block; font-style: normal; font-size: 12px; color: var(--text3); margin-top: 4px; font-weight: 500; }
.chart-card { background: var(--bg2); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 14px 8px; margin-top: 10px; }
.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart svg * { stroke: none; }
.chart text { font-size: 10px; fill: var(--text2); font-weight: 500; }
.chart svg .base { stroke: var(--sep); stroke-width: 1; }
.chart rect.on { fill: var(--fill); }
.chart-max { position: absolute; right: 0; top: -22px; font-size: 11px; color: var(--text3); font-variant-numeric: tabular-nums; }
.tip { position: absolute; top: -6px; transform: translateY(-100%); padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--bg2); font-size: 13px; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 3; }
.dtable { margin-top: 10px; }
.dt-row { display: grid; grid-template-columns: 1fr 64px 64px 78px; gap: 6px; padding: 10px 14px; font-size: 14px; font-variant-numeric: tabular-nums; align-items: center; }
.dt-row span:not(.nm) { text-align: right; color: var(--text2); }
.dt-row + .dt-row { border-top: .5px solid var(--sep); }
.dt-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dt-head { font-size: 12px; color: var(--text2); font-weight: 600; }

/* ---------- сборка и медиа ---------- */
.drop.build { margin-top: 10px; background: linear-gradient(135deg, color-mix(in srgb, var(--green) 14%, var(--bg2)), var(--bg2)); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.drop.build .big-ic { background: linear-gradient(135deg, #22B357, #5BD68A); box-shadow: 0 8px 20px -8px var(--green); }
.w-imgs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.w-imgs img { max-width: 100%; max-height: 180px; border-radius: 14px; object-fit: contain; }
.face .scroll > :first-child { margin-top: auto; }
.face .scroll > :last-child { margin-bottom: auto; }

/* ---------- трудные слова ---------- */
button.qc { width: 100%; text-align: left; padding: 0; }
.hard-tag { color: var(--red); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }

/* ---------- сбой запуска ---------- */
.boot-fail { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 24px 20px calc(var(--safe-b) + 24px); text-align: center; }
.boot-fail .em { font-size: 52px; }
.boot-fail b { font-size: 22px; }
.boot-fail p { color: var(--text2); margin: 0 0 8px; }

/* ---------- главная: колода целиком + остаток на сегодня ---------- */
.qc-sum { text-align: right; font-size: 12px; color: var(--text3); font-weight: 600; margin-top: -2px; }
.today-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 16px; padding: 10px 12px; border-radius: 14px; background: var(--fill); font-size: 14px; color: var(--text2); }
.today-line .lbl { font-weight: 700; color: var(--text); }
.today-line b { color: var(--c); font-variant-numeric: tabular-nums; }
.today-done { margin-top: 8px; font-size: 14px; color: var(--text2); text-align: center; }
.today-done b { color: var(--text); }
