/* ============================================================
   English • тренажёр глаголов — дизайн-система «Моста»
   (автономная копия: тёплая бумага, два цвета — два человека)
   ============================================================ */
:root {
  --him: #5B6CF0;
  --her: #EE5D83;
  --us: linear-gradient(135deg, #5B6CF0 0%, #A664BF 55%, #EE5D83 100%);
  --him-soft: rgba(91, 108, 240, .12);
  --her-soft: rgba(238, 93, 131, .12);
  --gold: #C99A3F;
  --gold-soft: rgba(201, 154, 63, .12);

  --bg: #FAF6EF;
  --surface: #FFFDFA;
  --surface-2: #F1EBDF;
  --text: #2A2733;
  --muted: #837f8c;
  --border: #EBE4D6;
  --shadow: 0 6px 22px rgba(74, 56, 30, .08);
  --shadow-lift: 0 14px 44px rgba(74, 56, 30, .16);

  --ok: #3EC58A;
  --danger: #E25555;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Lora", Georgia, "Times New Roman", serif;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151F;
    --surface: #1D1E2C;
    --surface-2: #262838;
    --text: #EDEDF4;
    --muted: #9c9aae;
    --border: #2D2F42;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 12px 40px rgba(0, 0, 0, .5);
    --him-soft: rgba(91, 108, 240, .2);
    --her-soft: rgba(238, 93, 131, .2);
    --gold: #E0B968;
    --gold-soft: rgba(224, 185, 104, .16);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--him); }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-family: var(--font-head); font-size: 19px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.topbar .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; font-family: var(--font-body); }
.topbar a.about { font-size: 13px; font-weight: 700; text-decoration: none; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; }

.page { padding: 16px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 760px) { .page { max-width: 680px; width: 100%; margin: 0 auto; } .topbar { padding-left: calc(50vw - 340px); padding-right: calc(50vw - 340px); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; }
.lbl { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-weight: 700; font-size: 14.5px;
  background: var(--surface-2);
  transition: transform .08s, opacity .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--us); color: #fff; box-shadow: 0 6px 18px rgba(166, 100, 191, .35); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; }

.seg { display: flex; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 8px; border-radius: 10px; font-weight: 700; font-size: 13.5px; color: var(--muted); transition: all .15s; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
  color: var(--text);
}
.input:focus { border-color: var(--him); background: var(--surface); }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: -4px; }
.section-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 2px -6px; }
.date-head {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 8px 2px -6px;
  display: flex; align-items: center; gap: 8px;
}
.streak-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--us); color: #fff; border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 800;
}
.speak-btn { border: none; background: none; font-size: 17px; padding: 2px 4px; cursor: pointer; }

/* ---------- нижнее окно (sheet) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(15, 14, 22, .45);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(22px + var(--safe-b));
  max-height: 88dvh; overflow-y: auto;
  box-shadow: var(--shadow-lift);
  animation: slideUp .24s cubic-bezier(.3, 1.1, .4, 1);
}
@media (min-width: 760px) { .sheet { max-width: 560px; margin: 0 auto; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 2px auto 14px; }
.sheet h2 { font-size: 18px; font-weight: 800; margin-bottom: 12px; letter-spacing: -.01em; }
@keyframes slideUp { from { transform: translateY(60%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- игра ---------- */
.game-word { font-size: 30px; font-weight: 800; text-align: center; margin: 14px 0 4px; letter-spacing: -.01em; }
.game-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.game-opts { display: flex; flex-direction: column; gap: 9px; }
.game-opts button {
  padding: 13px 16px; border-radius: var(--r-md); font-size: 15px; font-weight: 600;
  background: var(--surface-2); border: 1.5px solid transparent; text-align: left;
  transition: all .12s;
}
.game-opts button.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface-2)); }
.game-opts button.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface-2)); }
.game-type-input { margin-top: 12px; text-align: center; font-size: 17px; font-weight: 700; }
.game-type-input.type-right { border-color: var(--ok); }
.game-type-input.type-wrong { border-color: var(--danger); }

.vh-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.vh-row:last-child { border-bottom: none; }
.vh-word { flex: 1; min-width: 0; font-size: 14.5px; }
.vh-chip { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.vh-chip.mastered { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.vh-chip.review { background: var(--gold-soft); color: var(--gold); }
.vh-chip.learning { background: var(--surface-2); color: var(--muted); }
.vh-chip.new { background: var(--him-soft); color: var(--him); }

/* ============================================================
   тренажёр глаголов: таблица «3 времени × 3 формы» и игры
   ============================================================ */
.vt-table { display: grid; grid-template-columns: 22px repeat(3, 1fr); gap: 5px; align-items: stretch; }
.vt-h { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; align-self: end; padding-bottom: 2px; }
.vt-rowlbl {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); text-align: center; justify-self: center;
}
.vt-cell {
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 5px; min-height: 62px; font-size: 12.5px; line-height: 1.45; color: var(--text);
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  font-family: var(--font-body); cursor: pointer; text-align: center; word-break: break-word;
}
.vt-cell:active { transform: scale(.98); }
.vt-cell.veiled { font-size: 20px; }
.vt-veil { opacity: .5; }
.vt-line.one { font-size: 15px; font-weight: 600; }
.vt-prons { font-style: normal; font-size: 10.5px; color: var(--muted); display: block; }
.vt-aux { color: var(--him); font-weight: 800; }
.vt-end { color: var(--her); font-weight: 800; }
.vt-irr { color: var(--gold); font-weight: 800; }
.vt-irr-mark { font-size: 11px; }
.vt-verb-btn {
  flex: 1; text-align: left; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 10px; font-size: 15px; color: var(--text); cursor: pointer;
}
.vt-pron-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.vt-pron {
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.vt-pron.active { border-color: var(--him); background: var(--him-soft); color: var(--him); }

.vt-table.heat .vt-cell { min-height: 44px; font-size: 13px; font-weight: 800; cursor: default; }
.vt-lvl { display: block; font-style: normal; font-size: 7px; letter-spacing: 2px; color: var(--muted); }
.vt-table.mini { margin-top: 4px; }
.vt-table.mini .vt-cell { min-height: 46px; }
.vt-cell.pickable { background: var(--surface); }
.vt-cell.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface-2)); }
.vt-cell.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface-2)); }

.vg-target { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 4px; }
.vg-tag {
  font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.vg-tag.tense { background: var(--him-soft); color: var(--him); border-color: transparent; }
.vg-tag.form { background: var(--her-soft); color: var(--her); border-color: transparent; }
.vg-answer {
  min-height: 52px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  border-bottom: 2px dashed var(--border); padding: 8px 2px; margin-bottom: 12px;
}
.vg-answer.right { border-color: var(--ok); }
.vg-answer.wrong { border-color: var(--danger); }
.vg-q { font-size: 18px; font-weight: 800; color: var(--muted); }
.vg-chips, .vg-pairs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.vg-pairs { display: grid; grid-template-columns: 1fr 1fr; }
.vg-chip {
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: var(--r-sm); padding: 9px 14px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.vg-chip:active { transform: scale(.97); }
.vg-chip.used { opacity: .25; pointer-events: none; }
.vg-chip.in { padding: 6px 10px; font-size: 14px; }
.vg-chip.pair { text-align: center; }
.vg-chip.sel { border-color: var(--him); background: var(--him-soft); color: var(--him); }
.vg-chip.done { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface-2)); opacity: .55; pointer-events: none; }
.vg-chip.shake { animation: vgShake .35s; border-color: var(--danger); }
@keyframes vgShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .vg-chip.shake, .sheet, .overlay { animation: none; }
}
