/* Сериалика на телефоне: те же цвета, что в программе на компьютере (app/ui/style.css) */
:root { --bg:#f6f6f3; --panel:#ffffff; --panel-2:#efefeb; --line:#e2e2dc; --text:#1c1d1f; --muted:#6d7075; --accent:#5b5bd6; --accent-soft:#e9e9fb; --on-accent:#fff; --good:#1e8a5a; --good-soft:#dff3e9; --bad:#cf3f4f; --bad-soft:#fbe5e7; --mask:#d9d9d3; }
[data-theme="dark"] { --bg:#111215; --panel:#1a1b20; --panel-2:#24262c; --line:#2c2e35; --text:#eeeef0; --muted:#9598a1; --accent:#8282f5; --accent-soft:#272850; --on-accent:#11121a; --good:#4fc78f; --good-soft:#17352a; --bad:#f0707e; --bad-soft:#3d1d22; --mask:#30323a; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, "Roboto", sans-serif; overscroll-behavior-y: none; }
body.with-nav main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { padding: 12px 16px 32px; max-width: 720px; margin: 0 auto; min-height: 100vh; }
button { font: inherit; color: inherit; }
h1 { font-size: 26px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 22px 0 6px; font-weight: 650; }
h3 { font-size: 14px; margin: 18px 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.screen-title { font-size: 22px; margin: 10px 0 4px; }
.note { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.meta { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-style: normal; }
.center { text-align: center; }
.late { color: var(--bad); }
.error { color: var(--bad); font-size: 14px; white-space: pre-wrap; }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.streak { margin: 2px 0 6px; color: var(--muted); font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; color: var(--muted); max-width: 60%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.bad { color: var(--bad); border-color: var(--bad); }
.chip.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* карточки серий */
.card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; margin: 8px 0; }
.card:active { background: var(--panel-2); }
.card.flat:active { background: var(--panel); }
.card-main { flex: 1; min-width: 0; }
.card .title { font-weight: 600; font-size: 16px; }
.card.mistakes { border-color: var(--bad); background: var(--bad-soft); }
.pill { flex: none; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.pill.accent { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.empty { margin: 40px 8px; text-align: center; color: var(--muted); }

/* кнопки */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 18px; font-weight: 600; min-height: 46px; }
.btn:active { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .45; }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 22px; flex: none; }
.icon-btn:active { background: var(--panel-2); }
.icon-btn.play { color: var(--accent); background: var(--accent-soft); }

/* полоса прогресса в проверке */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; background: var(--bg); padding: 6px 0; margin: -6px 0 0; }
.track { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.fill { height: 100%; background: var(--accent); transition: width .25s; }
.bar .meta { flex: none; min-width: 54px; text-align: right; }

/* строки проверки */
.row { display: grid; grid-template-columns: 1fr auto; gap: 10px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; margin: 10px 0; transition: border-color .2s, background .2s; }
.row.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.row.ok { background: var(--good-soft); border-color: transparent; }
.row.miss { background: var(--bad-soft); border-color: transparent; }
.faces { display: grid; gap: 6px; min-width: 0; }
.side { position: relative; border-radius: 10px; padding: 4px 6px; min-height: 30px; }
.side .en { font-size: 19px; font-weight: 650; margin-right: 8px; }
.ipa { color: var(--muted); font-size: 14px; }
.side .ru { font-size: 16px; }
.syn { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.side.masked { background: var(--mask); color: transparent; }
.side.masked * { visibility: hidden; }
.side.masked::after { content: "· · ·"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); visibility: visible; letter-spacing: .2em; }
.row .play { align-self: start; }
.acts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acts button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px 0; font-weight: 600; min-height: 48px; }
.acts .n.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.acts .y.on { background: var(--good); border-color: var(--good); color: #fff; }
.finish-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }

/* итог */
.done { text-align: center; padding: 48px 8px; display: grid; gap: 14px; justify-items: center; }
.done .num { font-size: 44px; font-weight: 700; }
.done .sub { color: var(--muted); max-width: 440px; margin: 0; }
.done .btn { min-width: 220px; }
.advice { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; max-width: 440px; }
.welcome { padding-top: 22vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--panel-2); border-top-color: var(--accent); animation: spin .9s linear infinite; }

/* изучение */
.learn-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-top: 6px; }
.learn-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.en.big { font-size: 28px; font-weight: 700; }
.big-ru { font-size: 19px; margin-top: 12px; }
.examples { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.learn-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 14px; }

/* слова */
.search { width: 100%; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 12px; padding: 12px 14px; font: inherit; margin: 8px 0 2px; }
.search:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.word { display: grid; gap: 2px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 12px 4px; }
.word:active { background: var(--panel-2); }
.w-en { font-weight: 600; }
.w-en .ipa { font-weight: 400; font-size: 13px; }

/* прогресс */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.tile .num { font-size: 26px; font-weight: 700; }

/* настройки */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px 16px; margin: 12px 0; }
.panel .btn { margin: 6px 6px 0 0; }
.status { font-size: 14px; margin: 6px 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 10px 4px; font-size: 14px; }
.seg button.on { background: var(--panel); font-weight: 600; box-shadow: 0 1px 2px #0002; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 1px 0 0; flex: none; }
.steps { padding-left: 20px; display: grid; gap: 10px; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row .search { flex: 1; min-width: 0; margin: 0; }
.code-row .btn { flex: none; }
.steps .btn { margin-top: 6px; display: block; }

/* окно правки снизу */
.sheet { position: fixed; inset: 0; background: #0009; z-index: 20; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--bg); width: 100%; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.field { display: grid; gap: 4px; margin: 10px 0; font-size: 13px; color: var(--muted); }
.field input, .field textarea { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 11px 12px; font: 16px/1.4 system-ui, sans-serif; resize: vertical; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* нижнее меню */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: none; grid-template-columns: repeat(4, 1fr);
  background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
body.with-nav #nav { display: grid; }
#nav button { border: 0; background: transparent; padding: 16px 2px 18px; font-size: 13px; color: var(--muted); font-weight: 600; }
#nav button.on { color: var(--accent); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 30; background: var(--text); color: var(--bg);
  padding: 12px 16px; border-radius: 12px; font-size: 14px; text-align: center; }
.toast[hidden] { display: none; }
