/* family.css — единый семейный хром всех игр zharkevich.ru.
   ИСТОЧНИК: ~/work/family/family.css → ~/work/tools/bump-css.sh синхронизирует
   копии в static исходники папок. Править ТОЛЬКО здесь, не трогать в игровых. */

:root {
  --accent: #1f8a70;
  --accent-ink: #ffffff;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #22262b;
  --ink-soft: #6b7280;
  --line: #d9dce0;
  --line-strong: #22262b;
  --cell-bg: #ffffff;
  --cell: #f2ede4;
  --cell-given: #22262b;
  --cell-ink: #2f6f5f;
  --cell-sel: #d8efe8;
  --cell-peer: #eef4f2;
  --cell-same: #bfe3d9;
  --cell-error: #c0392b;
  --cell-error-bg: #f9e5e2;
  --clue-active-bg: #d8efe8;
  --clue-active-ink: #1f8a70;
  --notes-ink: #7b8494;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181c;
    --panel: #1c2229;
    --ink: #e8eaed;
    --ink-soft: #9aa3ad;
    --line: #38414b;
    --line-strong: #e8eaed;
    --cell-bg: #1c2229;
    --cell: #343a40;
    --cell-given: #e8eaed;
    --cell-ink: #7fd4bb;
    --cell-sel: #1f4a3e;
    --cell-peer: #232b33;
    --cell-same: #29584a;
    --cell-error: #e4736a;
    --cell-error-bg: #43211e;
    --clue-active-bg: #1f4a3e;
    --clue-active-ink: #7fd4bb;
    --notes-ink: #8a94a8;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #14181c;
  --panel: #1c2229;
  --ink: #e8eaed;
  --ink-soft: #9aa3ad;
  --line: #38414b;
  --line-strong: #e8eaed;
  --cell-bg: #1c2229;
  --cell: #343a40;
  --cell-given: #e8eaed;
  --cell-ink: #7fd4bb;
  --cell-sel: #1f4a3e;
  --cell-peer: #232b33;
  --cell-same: #29584a;
  --cell-error: #e4736a;
  --cell-error-bg: #43211e;
  --clue-active-bg: #1f4a3e;
  --clue-active-ink: #7fd4bb;
  --notes-ink: #8a94a8;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px clamp(12px, 3vw, 32px);
}

/* ---------- навигационный хром ---------- */

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0 16px;
}

.hud__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
}

.hud__logo-link { display: block; line-height: 0; }

.hud__logo { display: block; width: 32px; height: 32px; border-radius: 8px; }

.hud__nav {
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
}

.hud__nav:hover { color: var(--accent); }

.hud__sep { color: var(--ink-soft); font-weight: 400; }

.hud__word { font-weight: 700; }

/* переключатель игр (без JS: focus-within) */
.switcher { position: relative; }

.switcher__btn {
  font: inherit;
  font-weight: 700;
  font-size: inherit;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.switcher__menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: -8px;
  min-width: 190px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.switcher:focus-within .switcher__menu { display: block; }

.switcher__menu a {
  display: block;
  padding: 8px 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
  border-radius: 6px;
}

.switcher__menu a:hover { background: var(--cell-peer); }

.switcher__here {
  display: block;
  padding: 8px 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

/* ---------- профиль/сессия ---------- */

.hud__profile {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-left: 0;
}

@media (min-width: 520px) {
  .hud__profile {
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid var(--line);
  }
}

.hud__name {
  background: none;
  border: none;
  padding: 4px 2px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px dashed var(--ink-soft);
  max-width: 30vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud__name:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hud__input {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 3px 8px;
  width: 12ch;
}

.hud__points {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  margin-left: 24px;
}

.hud__day, .hud__best, .hud__meta {
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.hud__session {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud__clock {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.hud__btn, .pad__btn {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.hud__btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.hud__btn:focus-visible, .pad__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hud__btn:disabled, .pad__btn:disabled { opacity: 0.4; cursor: default; }

.hud__btn[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hud__btn--day-practice { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 13px; border: none; }

/* ---------- общий стенд поля/вуали ---------- */

.board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

.board-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg);
  text-align: center;
  padding: 10px;
  overflow-y: auto;
  z-index: 5;
}

.board-veil[hidden] { display: none; }

.board-veil__text { font-size: 22px; color: var(--ink); letter-spacing: 0.06em; margin: 0; }

.board-veil__lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.35;
}

.board-veil__lines p { margin: 0; }

.board-veil__lines .board-veil__total {
  color: var(--accent);
  font-weight: 700;
  font-size: 19px;
}

.board-veil__actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 480px) {
  .board-veil__text { font-size: 18px; }
  .board-veil__lines { font-size: 14px; }
  .board-veil__lines .board-veil__total { font-size: 16px; }
}

/* ---------- ввод и формы ---------- */

.pad__control { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pad__tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 12px; color: var(--ink-soft); }
.field__select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
  touch-action: manipulation;
}

.pad__btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.hud__day { font-size: 13px; }

/* ---------- настройки и правила ---------- */

.settings {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--panel);
  max-width: 640px;
}

.settings summary { cursor: pointer; color: var(--ink-soft); font-size: 14px; }
.settings__grid { margin-top: 12px; display: grid; gap: 10px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.settings__hint { font-size: 12px; color: var(--ink-soft); margin: 4px 0 0 26px; }
.settings__row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.settings__row .pad__btn { min-height: 40px; }

.rules { font-size: 14px; }
.rules__head { font-size: 15px; margin: 0 0 6px; }
.rules p { margin: 0 0 8px; }
.rules ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.rules kbd {
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--panel);
}

/* ---------- фут ---------- */

.app__foot { padding: 16px 0 4px; }
.app__foot-note { font-size: 12px; color: var(--ink-soft); }

.app__foot-link {
  margin-left: 24px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.app__foot-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
