/* ==========================================================
   Отличник — общий стиль сайта и Linux-версии
   ========================================================== */
:root {
  --font: 'Nunito', 'Segoe UI', 'Noto Sans', 'DejaVu Sans', system-ui, sans-serif;
  --font-hand: 'Caveat', 'Comic Sans MS', 'Segoe Print', cursive;

  --ink: #23264a;
  --ink-2: #5b5f8a;
  --ink-3: #9a9dc0;
  --line: #e6e8f5;
  --bg: #eef3ff;
  --card: #ffffff;

  --coral: #ff5d6c;
  --coral-d: #e2405a;
  --sun: #ffc23d;
  --sun-d: #e9a512;
  --sky: #3d8bff;
  --sky-d: #276fe0;
  --mint: #19c49a;
  --mint-d: #0ea47f;
  --grape: #8b5cf6;
  --grape-d: #6d3fe0;
  --peach: #ff9f5a;
  --peach-d: #ec7f33;

  --ok: #17b67f;
  --bad: #ff4d5e;

  --paper: #ffffff;
  --grid: #c9d8f5;
  --margin: #ff6b6b;
  --cell: 26px;

  --r-sm: 12px;
  --r: 20px;
  --r-lg: 28px;
  --shadow: 0 10px 30px -12px rgba(48, 60, 140, .28);
  --shadow-sm: 0 4px 14px -6px rgba(48, 60, 140, .25);
  --zoom: 1;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffe9f0 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 10%, #e3fff4 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 120%, #e7e4ff 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: calc(16px * var(--zoom));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sky-d); }
.hidden { display: none !important; }
.app { min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(220, 225, 245, .8);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.3em; text-decoration: none; color: var(--ink); }
.brand img { width: 38px; height: 38px; }
.brand small { display: block; font-size: .5em; font-weight: 700; color: var(--ink-3); letter-spacing: .04em; margin-top: -2px; }
.topbar .spacer { flex: 1; }
.chip-user {
  display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; box-shadow: var(--shadow-sm);
  transition: transform .12s, background .12s;
}
.icon-btn:hover { transform: translateY(-1px); background: #f7f8ff; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Кнопки ---------- */
.btn {
  --c: var(--sky); --cd: var(--sky-d);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 16px;
  background: var(--c); color: #fff; font-weight: 800; font-size: 1em;
  box-shadow: 0 5px 0 var(--cd), 0 10px 20px -8px var(--c);
  transition: transform .08s, box-shadow .08s, filter .15s;
  user-select: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.btn.coral { --c: var(--coral); --cd: var(--coral-d); }
.btn.mint { --c: var(--mint); --cd: var(--mint-d); }
.btn.sun { --c: var(--sun); --cd: var(--sun-d); color: #4a3200; }
.btn.grape { --c: var(--grape); --cd: var(--grape-d); }
.btn.peach { --c: var(--peach); --cd: var(--peach-d); }
.btn.ghost { --c: #fff; --cd: #d9dcf0; color: var(--ink); box-shadow: 0 4px 0 #d9dcf0; border: 1px solid var(--line); }
.btn.sm { padding: 8px 14px; border-radius: 12px; font-size: .9em; }
.btn.lg { padding: 16px 30px; font-size: 1.15em; border-radius: 20px; }
.btn.block { width: 100%; }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-weight: 800; font-size: .85em; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
.input:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(61, 139, 255, .15); }
textarea.input { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 6px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--sky); }
input[type=range] { width: 100%; accent-color: var(--coral); }

/* ---------- Раскладка ---------- */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.page.narrow { max-width: 760px; }
.h1 { font-size: 2.1em; font-weight: 900; margin: 0 0 6px; letter-spacing: -.01em; }
.h2 { font-size: 1.4em; font-weight: 900; margin: 28px 0 14px; display: flex; align-items: center; gap: 10px; }
.muted { color: var(--ink-2); }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 22px; border: 1px solid rgba(230, 232, 245, .9); }

/* ---------- Экран учеников ---------- */
.welcome { text-align: center; padding: 40px 20px 10px; }
.welcome .logo-big { width: 96px; height: 96px; filter: drop-shadow(0 12px 18px rgba(255, 70, 100, .35)); animation: bob 3s ease-in-out infinite; }
.welcome h1 { font-size: 2.6em; font-weight: 900; margin: 14px 0 4px; }
.welcome p { color: var(--ink-2); margin: 0; font-size: 1.1em; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }

.students { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; margin-top: 30px; }
.student {
  position: relative; background: #fff; border-radius: var(--r-lg); padding: 22px 14px 18px; text-align: center;
  border: 2px solid transparent; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.student:hover { transform: translateY(-4px) rotate(-.5deg); border-color: var(--sky); }
.student .avatar { margin: 0 auto 10px; }
.student b { display: block; font-size: 1.05em; }
.student small { color: var(--ink-3); font-weight: 700; }
.student .del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 10px; border: 0; background: #fff0f2; color: var(--bad); opacity: 0; transition: opacity .15s; display: grid; place-items: center; }
.student:hover .del { opacity: 1; }
.student.add { border: 2px dashed #c9cdee; background: rgba(255, 255, 255, .6); box-shadow: none; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-2); min-height: 170px; }
.student.add .plus { width: 64px; height: 64px; border-radius: 50%; background: #eef1ff; display: grid; place-items: center; font-size: 2em; color: var(--sky); margin-bottom: 8px; }

.avatar {
  --a: var(--sky);
  width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center;
  background: linear-gradient(140deg, color-mix(in srgb, var(--a) 70%, #fff), var(--a));
  color: #fff; font-weight: 900; font-size: 1.9em; box-shadow: 0 8px 16px -6px var(--a);
}
.avatar svg { width: 70%; height: 70%; }
.avatar.sm { width: 34px; height: 34px; border-radius: 50%; font-size: .95em; box-shadow: none; }
.avatar-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.avatar-pick .avatar { width: 52px; height: 52px; border-radius: 16px; cursor: pointer; border: 3px solid transparent; }
.avatar-pick .avatar.on { border-color: var(--ink); }

/* ---------- Главная: плитки ---------- */
.hello { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.hello .avatar { width: 64px; height: 64px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile {
  --t: var(--sky); --td: var(--sky-d);
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 22px; min-height: 150px;
  color: #fff; border: 0; text-align: left;
  background: linear-gradient(150deg, color-mix(in srgb, var(--t) 80%, #fff) 0%, var(--t) 60%, var(--td) 100%);
  box-shadow: 0 6px 0 var(--td), 0 18px 30px -14px var(--t);
  transition: transform .15s;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.tile:hover { transform: translateY(-4px); }
.tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--td); }
.tile .ico { position: absolute; right: -6px; top: -6px; width: 110px; height: 110px; opacity: .95; transform: rotate(8deg); transition: transform .3s; }
.tile:hover .ico { transform: rotate(-4deg) scale(1.06); }
.tile b { font-size: 1.35em; font-weight: 900; position: relative; text-shadow: 0 2px 0 rgba(0, 0, 0, .08); }
.tile span { position: relative; opacity: .92; font-weight: 700; font-size: .92em; }
.tile.sky { --t: var(--sky); --td: var(--sky-d); }
.tile.mint { --t: var(--mint); --td: var(--mint-d); }
.tile.coral { --t: var(--coral); --td: var(--coral-d); }
.tile.grape { --t: var(--grape); --td: var(--grape-d); }
.tile.sun { --t: var(--sun); --td: var(--sun-d); color: #4a3200; }
.tile.peach { --t: var(--peach); --td: var(--peach-d); }
.tile.small { min-height: 118px; padding: 16px 18px; }
.tile.small .ico { width: 80px; height: 80px; }
.tile.small b { font-size: 1.1em; }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tool {
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm); font-weight: 800; text-align: left; transition: transform .12s;
}
.tool:hover { transform: translateY(-2px); }
.tool i { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.tool i svg { width: 24px; height: 24px; }

/* ---------- Тетрадь ---------- */
.workspace { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 920px) { .workspace { grid-template-columns: 1fr; } }
.notebook {
  position: relative; border-radius: 10px 22px 22px 10px; min-height: 560px; padding: calc(var(--cell) * 1.5) calc(var(--cell) * 1.5) calc(var(--cell) * 2) calc(var(--cell) * 4);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent calc(var(--cell) * 3 - 1px), var(--margin) calc(var(--cell) * 3 - 1px), var(--margin) calc(var(--cell) * 3 + 1px), transparent calc(var(--cell) * 3 + 1px)),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, var(--cell) var(--cell), var(--cell) var(--cell);
  box-shadow: var(--shadow), inset 6px 0 0 rgba(0, 0, 0, .03);
  font-size: calc(var(--cell) * .95);
}
.notebook::before {
  content: ''; position: absolute; left: -12px; top: 30px; bottom: 30px; width: 24px;
  background: radial-gradient(circle at 12px 12px, #d9def0 6px, transparent 7px) 0 0 / 24px 52px repeat-y;
}
.nb-title { font-family: var(--font-hand); font-size: 1.5em; font-weight: 700; color: #2d3aa8; line-height: calc(var(--cell) * 2); margin: 0 0 var(--cell); }
.nb-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; min-height: calc(var(--cell) * 2);
  font-family: var(--font-hand); font-weight: 700; color: #263399; font-size: 1.35em; line-height: 1;
}
.nb-line .num { width: calc(var(--cell) * 1.5); margin-left: calc(var(--cell) * -2.6); color: var(--ink-3); font-size: .7em; font-family: var(--font); text-align: right; padding-right: 10px; }
.nb-line .expr { white-space: pre; letter-spacing: .04em; }
.ans {
  width: calc(var(--cell) * 3.2); height: calc(var(--cell) * 1.5); margin: 0 6px; padding: 0 6px; border: 0; border-bottom: 3px dashed #b9c4ee; background: rgba(61, 139, 255, .06);
  border-radius: 8px 8px 2px 2px; font-family: var(--font-hand); font-weight: 700; font-size: 1em; color: #1f2fb0; text-align: center; outline: none;
}
.ans.wide { width: calc(var(--cell) * 5); }
.ans.letter { width: calc(var(--cell) * 1.4); padding: 0; }
.ans:focus { border-bottom-color: var(--sky); background: rgba(61, 139, 255, .14); }
.ans.ok { border-bottom: 3px solid var(--ok); background: rgba(23, 182, 127, .1); color: #0b8a5c; }
.ans.bad { border-bottom: 3px solid var(--bad); background: rgba(255, 77, 94, .1); color: var(--bad); text-decoration: line-through; }
.mark { margin-left: 10px; font-family: var(--font-hand); font-size: 1.1em; font-weight: 700; }
.mark.ok { color: var(--ok); }
.mark.bad { color: var(--bad); }
.mark .fix { color: var(--ok); text-decoration: none; margin-left: 6px; }
.word-gap { display: inline-flex; align-items: center; }
.word-gap .ans { margin: 0 2px; }

.task-text {
  font-family: var(--font); font-size: .8em; line-height: calc(var(--cell) * 1); color: #22296b; background: rgba(255, 255, 255, .6);
  border-left: 4px solid var(--sun); padding: 6px 12px; border-radius: 0 10px 10px 0; margin: 4px 0 8px; max-width: 760px;
}
.task-block { margin-bottom: var(--cell); }
.solution { font-family: var(--font-hand); color: var(--ok); font-size: 1.05em; margin-top: 4px; }

.sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
.stat-box { background: #fff; border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.stat-box h4 { margin: 0 0 10px; font-size: .85em; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.timer { font-variant-numeric: tabular-nums; font-size: 2em; font-weight: 900; }
.progress { height: 14px; border-radius: 99px; background: #edf0fb; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--sky)); border-radius: 99px; transition: width .3s; }
.counter { display: flex; justify-content: space-between; font-weight: 800; margin-top: 8px; color: var(--ink-2); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { padding: 12px 0; border-radius: 14px; border: 1px solid var(--line); background: #f7f8ff; font-weight: 900; font-size: 1.2em; box-shadow: 0 3px 0 #dfe3f5; }
.keypad button:active { transform: translateY(2px); box-shadow: none; }
.letters { display: flex; flex-wrap: wrap; gap: 8px; }
.letters button { min-width: 48px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-weight: 900; font-size: 1.2em; box-shadow: 0 3px 0 #dfe3f5; }
.letters button:hover { background: #f1f5ff; }

/* ---------- Модальные окна ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(30, 34, 80, .38); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: fade .18s;
}
.modal {
  background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto;
  box-shadow: 0 30px 80px -20px rgba(20, 30, 90, .5); animation: pop .22s cubic-bezier(.2, 1.4, .4, 1);
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 6px; }
.modal-head h3 { margin: 0; font-size: 1.4em; font-weight: 900; flex: 1; }
.modal-body { padding: 12px 24px 18px; }
.modal-foot { display: flex; gap: 12px; justify-content: flex-end; padding: 8px 24px 22px; flex-wrap: wrap; }
.x-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: #f1f3fb; font-size: 1.3em; color: var(--ink-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.9) translateY(20px); opacity: 0; } }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; background: #f1f3fb; padding: 5px; border-radius: 16px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 12px; border-radius: 12px; font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.preview-box { background: linear-gradient(#f4fff9, #eefaff); border: 2px solid #d4f3e6; border-radius: 16px; padding: 14px; min-height: 120px; color: #1f2b9e; font-weight: 600; }

/* ---------- Результат ---------- */
.result { text-align: center; padding: 10px 0 6px; }
.grade {
  width: 150px; height: 150px; margin: 4px auto 12px; border-radius: 50%; display: grid; place-items: center; position: relative;
  font-family: var(--font-hand); font-size: 7em; font-weight: 700; color: #fff;
  background: conic-gradient(from 200deg, var(--g1), var(--g2), var(--g1)); box-shadow: 0 16px 30px -10px var(--g2);
  animation: grade-in .6s cubic-bezier(.2, 1.6, .4, 1);
}
.grade.g5 { --g1: #2bd69a; --g2: #10a874; }
.grade.g4 { --g1: #4aa3ff; --g2: #276fe0; }
.grade.g3 { --g1: #ffcf4d; --g2: #eaa514; }
.grade.g2, .grade.g1 { --g1: #ff7d8a; --g2: #e2405a; }
@keyframes grade-in { from { transform: scale(0) rotate(-40deg); } }
.result h2 { margin: 0; font-size: 1.6em; font-weight: 900; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 10px 0; }
.stars svg { width: 34px; height: 34px; }
.result-stats { display: flex; justify-content: center; gap: 12px; margin: 16px 0 6px; flex-wrap: wrap; }
.result-stats div { background: #f5f7ff; border-radius: 16px; padding: 10px 16px; min-width: 110px; }
.result-stats b { display: block; font-size: 1.5em; }
.result-stats small { color: var(--ink-2); font-weight: 700; }
.rule-box { text-align: left; background: #fffaf0; border: 2px solid #ffe7b0; border-radius: 16px; padding: 14px 16px; margin-top: 14px; line-height: 1.5; }
.rule-box h4 { margin: 0 0 6px; color: #b07200; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ---------- Таблицы и статистика ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95em; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--ink-3); font-size: .8em; text-transform: uppercase; letter-spacing: .05em; }
.table tr:hover td { background: #fafbff; }
.bars { display: flex; align-items: flex-end; gap: 16px; height: 200px; padding: 10px 6px 0; border-bottom: 2px solid var(--line); }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .bar i { display: block; width: 100%; max-width: 64px; border-radius: 12px 12px 4px 4px; transition: height .5s; min-height: 3px; }
.bars .bar b { font-size: .85em; color: var(--ink-2); }
.bars-x { display: flex; gap: 16px; padding: 6px 6px 0; }
.bars-x span { flex: 1; text-align: center; font-weight: 900; font-family: var(--font-hand); font-size: 1.6em; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #f5f7ff; border-radius: 16px; padding: 14px; }
.kpi b { display: block; font-size: 1.7em; font-weight: 900; }
.kpi small { color: var(--ink-2); font-weight: 700; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-weight: 800; font-size: .8em; }
.g-5 { background: #d8f8eb; color: #0b8a5c; }
.g-4 { background: #dfeeff; color: #1e5fcf; }
.g-3 { background: #fff2cf; color: #9c6a00; }
.g-2, .g-1 { background: #ffe1e5; color: #c62840; }

/* ---------- Таблица умножения ---------- */
.mtable { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 560px; margin: 0 auto; }
.mtable div { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: #fff; font-weight: 800; font-size: 1.15em; color: #2a46c9; border: 1px solid var(--line); cursor: default; transition: background .1s, transform .1s; }
.mtable div.h { background: #eef1fb; color: var(--ink-2); }
.mtable div.hl { background: #fff4c8; }
.mtable div.hit { background: var(--sun); color: #4a3200; transform: scale(1.12); box-shadow: var(--shadow-sm); }
.mtable div.learned { background: #d8f8eb; color: #0b8a5c; }
.mtable div.corner { background: var(--sun); color: #4a3200; }

/* ---------- Игры ---------- */
.game-wrap { display: flex; flex-direction: column; gap: 14px; }
.game-stage { position: relative; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: #bfe6ff; }
.game-stage canvas { display: block; width: 100%; height: auto; }
.game-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.player-pad { background: #fff; border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow-sm); border-top: 6px solid var(--pc, var(--sky)); }
.player-pad .who { display: flex; justify-content: space-between; font-weight: 800; color: var(--ink-2); font-size: .9em; }
.player-pad .q { font-family: var(--font-hand); font-weight: 700; font-size: 2.3em; color: #22309d; display: flex; align-items: center; gap: 8px; min-height: 56px; }
.player-pad .q .ans { font-size: 1em; width: 120px; height: 46px; }
.player-pad .hint { font-size: .8em; color: var(--ink-3); font-weight: 700; }
.game-hud { position: absolute; left: 14px; top: 12px; right: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.game-hud span { background: rgba(255, 255, 255, .85); padding: 6px 12px; border-radius: 12px; font-weight: 800; }
.game-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 40, 90, .25); backdrop-filter: blur(2px); }
.game-overlay .card { text-align: center; max-width: 420px; }
.cmds { display: flex; flex-wrap: wrap; gap: 8px; }
.prog { display: flex; flex-wrap: wrap; gap: 6px; min-height: 52px; background: #f5f7ff; border-radius: 16px; padding: 10px; border: 2px dashed #d7dcf3; }
.prog .cmd { background: var(--grape); color: #fff; border-radius: 10px; padding: 6px 10px; font-weight: 800; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.prog .cmd.run { outline: 3px solid var(--sun); }
.prog .cmd.rep { background: var(--peach); }
.stones { display: flex; gap: 18px; justify-content: center; }

/* ---------- Тосты ---------- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); animation: pop .2s; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }

/* ---------- Прочее ---------- */
.empty { text-align: center; padding: 40px; color: var(--ink-3); font-weight: 700; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--ink-2); background: none; border: 0; padding: 6px 0; margin-bottom: 10px; }
.back-link:hover { color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); padding: 5px 12px; border-radius: 99px; font-weight: 800; font-size: .85em; }
.list-pick { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }
.list-pick button { text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 700; }
.list-pick button.on { border-color: var(--sky); background: #f0f6ff; }
.footer { text-align: center; padding: 20px; color: var(--ink-3); font-size: .85em; font-weight: 700; }

@media (max-width: 600px) {
  .page { padding: 18px 14px 40px; }
  .h1 { font-size: 1.6em; }
  .welcome h1 { font-size: 2em; }
  .notebook { padding-left: calc(var(--cell) * 3.4); padding-right: 12px; }
  .topbar { padding: 8px 12px; }
  .brand small { display: none; }
}
.badge svg, .back-link svg { width: 16px; height: 16px; flex: none; }
.btn svg, .tool svg, .icon-btn svg, .chip-user svg { flex: none; }
.hello > div { min-width: 0; }
.tile, .tool { min-width: 0; }
.ans.letter { background: rgba(255, 194, 61, .18); border-bottom-color: var(--sun-d); }
.ans.letter:focus { background: rgba(255, 194, 61, .35); }
.game-bar { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.player-pad .q { white-space: nowrap; font-size: 2.1em; }
.player-pad .q [data-q] { white-space: nowrap; }
/* Блок «Ещё»: кнопки пошире, чтобы текст не обрезался */
.tools { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tool { padding: 14px 16px; gap: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.tool i { width: 40px; height: 40px; }

/* Меню под шестерёнкой */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 230px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 40px -12px rgba(30, 40, 100, .35);
  animation: pop .15s ease-out;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none;
  border-radius: 12px; font-weight: 800; text-align: left; color: var(--ink);
}
.menu button:hover { background: #f1f5ff; }
.menu button svg { width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
