/* Di Nulla — обучение команды
   ---------------------------------------------------------------------
   Направление: механика современного обучающего приложения (видимый путь,
   тактильные элементы, моменты завершения), выраженная фирменным языком
   Di Nulla — красный баннер со скруглённым низом и вордмарком "di NULLA"
   с банкетного листа, серифный Fraunces, тёплая бумага. Не яркая
   «леденцовая» палитра обучающих приложений, а ресторанная.

   Акцент тратится в одном месте на экран. Цвет разделов взят из предмета:
   медь сковороды, оливковая ботаника бара, бордо вина — и живёт только в
   бейдже иконки и полосе прогресса, не в тексте. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,700;1,9..144,500;1,9..144,600&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  /* бренд */
  --red-600: #d03017;   /* с банкетного листа */
  --red-700: #a8260f;   /* наведение */
  --red-800: #8a1e0c;   /* нижняя грань тактильных кнопок */
  --red-50:  #fdece8;

  /* основа */
  --paper:     #fbfaf7;
  --surface:   #ffffff;
  --ink:       #26201b;
  --ink-muted: #6f6259;  /* 5.64:1 на бумаге — проходит WCAG AA */
  --line:      #e9e3da;
  --line-soft: #f2ede5;

  /* разделы */
  --kitchen:    #b0622c;  --kitchen-bg: #f8eee5;
  --bar:        #4f6f4a;  --bar-bg:     #ecf1ea;
  --wine:       #7b2540;  --wine-bg:    #f6e9ed;

  /* смысловые — отдельно от акцента бренда.
     Оттенки подобраны так, чтобы текст проходил 4.5:1 на своей подложке:
     успех 5.19:1, предупреждение 5.04:1. */
  --ok:      #387043;  --ok-bg:   #eaf3ea;
  --warn:    #95591a;  --warn-bg: #faf1e3;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --banner-radius: 30px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(38, 32, 27, 0.06), 0 4px 12px -6px rgba(38, 32, 27, 0.10);
  --shadow-md: 0 2px 4px rgba(38, 32, 27, 0.07), 0 12px 28px -12px rgba(38, 32, 27, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--red-600);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ------------------------------------------------------------------ бренд */

.brand-banner {
  background: var(--red-600);
  color: #fff;
  border-radius: 0 0 var(--banner-radius) var(--banner-radius);
  padding: 22px 20px 26px;
  text-align: center;
  flex-shrink: 0;
}
.brand-banner .wordmark {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
}
.brand-banner .wordmark .di { font-style: italic; font-weight: 500; }
.brand-banner .wordmark .nulla { font-weight: 700; letter-spacing: 0.02em; margin-left: 0.15em; }
.brand-banner .sub {
  margin-top: 6px;
  font-size: 11px;
  color: #fbdcd4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand-banner.slim {
  border-radius: 0;
  padding: 14px 20px;
  text-align: left;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-banner.slim .wordmark { font-size: 19px; }
.brand-banner.slim .sub { margin-top: 0; }

.screen {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0px));
}

/* ------------------------------------------------------------- типографика */

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 12px;
  text-wrap: balance;
}
h1 { font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 21px; font-weight: 600; line-height: 1.2; }
p  { margin: 0 0 14px; }

/* Метка-надзаголовок. Ставится только там, где несёт информацию:
   в каком разделе находишься, какой это шаг, что это за экран. */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.lede { font-size: 17px; line-height: 1.55; }
.muted { color: var(--ink-muted); }
.num { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- структура */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 4px; }
.grow { flex: 1; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.topbar a { color: var(--red-600); text-decoration: none; font-size: 14px; font-weight: 500; }
.topbar .where { font-size: 13px; color: var(--ink-muted); }

/* ---------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.06s ease, box-shadow 0.06s ease, background-color 0.12s ease;
}

/* Тактильность: у кнопки есть «толщина» снизу, которая проваливается
   при нажатии. Ощущение физической клавиши — то, чем приложение
   отличается от веб-страницы. */
.btn-primary {
  background: var(--red-600);
  color: #fff;
  box-shadow: 0 4px 0 var(--red-800);
}
.btn-primary:hover { background: var(--red-700); }
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--red-800);
}
.btn-primary:disabled {
  background: var(--line);
  color: var(--ink-muted);
  cursor: not-allowed;
  box-shadow: 0 4px 0 #ddd5c9;
}

.btn-ghost {
  background: var(--surface);
  color: var(--red-600);
  border: 1px solid var(--red-600);
  box-shadow: 0 3px 0 rgba(208, 48, 23, 0.22);
}
.btn-ghost:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(208, 48, 23, 0.22); }

.btn-quiet {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 3px 0 var(--line);
}
.btn-quiet:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 8px; box-shadow: none; }
.btn-sm:active { transform: none; }
.btn-danger { background: var(--surface); color: var(--red-600); border: 1px solid var(--line); }
.btn-danger:hover { border-color: var(--red-600); }

/* --------------------------------------------------------------- PIN-пад */

.pin-display { display: flex; gap: 12px; justify-content: center; margin: 4px 0 28px; }
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--red-600);
  background: transparent;
  transition: background 0.15s, transform 0.15s;
}
.pin-dot.filled { background: var(--red-600); transform: scale(1.1); }

#pin-form { width: 100%; }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.pin-key {
  width: 100%;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  padding: 18px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: transform 0.06s ease, box-shadow 0.06s ease, background-color 0.12s ease;
}
.pin-key:active {
  background: var(--red-50);
  border-color: var(--red-600);
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--line);
}
.pin-key.wide {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-muted);
  box-shadow: none;
}
.pin-key.wide:active { transform: translateY(1px); }

/* -------------------------------------------------------------- прогресс */

.progress-bar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--red-600);
  border-radius: 6px;
  transition: width 0.4s ease-out;
}
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.progress-row .label { font-weight: 600; font-size: 15px; }
.progress-row .pct { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Кольцо общего прогресса — итог до деталей */
.summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.ring { width: 62px; height: 62px; flex-shrink: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .ring-track { stroke: var(--line); }
.ring .ring-fill { stroke: var(--red-600); transition: stroke-dashoffset 0.6s ease-out; }
.ring-label {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.ring-wrap { position: relative; display: grid; place-items: center; flex-shrink: 0; }
.summary-text .headline { font-family: var(--font-display); font-size: 18px; font-weight: 600; line-height: 1.2; }
.summary-text .detail { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }

/* ------------------------------------------------------------ иконки/бейдж */

.icon-badge {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.icon-badge svg { width: 23px; height: 23px; }
.t-kitchen .icon-badge { background: var(--kitchen-bg); color: var(--kitchen); }
.t-bar     .icon-badge { background: var(--bar-bg);     color: var(--bar); }
.t-wine    .icon-badge { background: var(--wine-bg);    color: var(--wine); }
.t-kitchen .progress-bar > span { background: var(--kitchen); }
.t-bar     .progress-bar > span { background: var(--bar); }
.t-wine    .progress-bar > span { background: var(--wine); }

/* ------------------------------------------------------------ карточки разделов */

.track-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.06s ease, box-shadow 0.12s ease;
}
.track-card:active { transform: scale(0.99); }
.track-head { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.track-head .title { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.1; }
.track-head .status { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; }
.track-head .chev { margin-left: auto; color: var(--ink-muted); display: grid; place-items: center; }
.track-head .chev svg { width: 18px; height: 18px; }
.track-card.done { background: var(--red-50); border-color: #f3c8bd; }
.track-card.done .track-head .status { color: var(--red-700); font-weight: 500; }

/* ------------------------------------------------------------------- путь */

.path { list-style: none; margin: 0; padding: 0; }
.path-item {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding-bottom: 18px;
}
/* соединительная линия: пройденный отрезок пути — в цвете, будущий — серый */
.path-item::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.path-item:last-child { padding-bottom: 0; }
.path-item:last-child::before { display: none; }
.path-item.done::before { background: var(--red-600); }

.path-node {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  z-index: 1;
}
.path-node svg { width: 17px; height: 17px; }
.path-item.done .path-node { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.path-item.current .path-node {
  border-color: var(--red-600);
  color: var(--red-600);
  box-shadow: 0 0 0 4px var(--red-50);
}

.path-body { padding-top: 7px; }
.path-title { font-weight: 600; font-size: 16px; }
.path-meta { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.path-item.locked .path-title { color: var(--ink-muted); }
.path-item.current .path-body {
  padding: 16px;
  margin-top: -6px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.path-item.current .path-body .btn { margin-top: 14px; }

/* ------------------------------------------------------------- слайды/чтение */

.slide-progress-wrap { margin-bottom: 22px; }
.slide-progress { display: flex; gap: 6px; }
.slide-progress > span {
  flex: 1; height: 4px;
  border-radius: 4px;
  background: var(--line);
  transition: background 0.3s ease;
}
.slide-progress > span.done { background: var(--red-600); }
.slide-progress-count {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.slide-body { flex: 1; }
.slide-body p { font-size: 16.5px; line-height: 1.6; }
.slide-nav { display: flex; gap: 10px; margin-top: 24px; }

/* ------------------------------------------------------------------- тест */

.quiz-q { margin-bottom: 26px; }
.quiz-q .qtext { font-weight: 600; font-size: 16px; margin-bottom: 11px; line-height: 1.35; }
.option {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-bottom: 9px;
  background: var(--surface);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--line-soft);
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.06s ease, box-shadow 0.06s ease;
}
.option:active { transform: translateY(2px); box-shadow: 0 0 0 var(--line-soft); }
.option input { margin: 0; accent-color: var(--red-600); width: 18px; height: 18px; flex-shrink: 0; }
.option:has(input:checked) {
  border-color: var(--red-600);
  background: var(--red-50);
  box-shadow: 0 2px 0 rgba(208, 48, 23, 0.2);
}
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.incorrect { border-color: var(--warn); background: var(--warn-bg); }

/* ------------------------------------------------------- момент завершения */

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 34px 20px 30px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.result.pass { background: var(--ok-bg); }
.result.fail { background: var(--warn-bg); }
.result .mark {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.result .mark svg { width: 30px; height: 30px; }
.result.pass .mark { background: var(--ok); color: #fff; }
.result.fail .mark { background: var(--warn); color: #fff; }
.result .score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 46px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result.pass .score { color: var(--ok); }
.result.fail .score { color: var(--warn); }
.result .headline { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-top: 10px; }
.result .sub { font-size: 14px; margin-top: 6px; opacity: 0.85; }

/* «что открылось дальше» — награда за пройденный тест */
.unlocked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.unlocked .icon { color: var(--red-600); display: grid; place-items: center; flex-shrink: 0; }
.unlocked .icon svg { width: 22px; height: 22px; }
.unlocked .label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); font-weight: 600; }
.unlocked .what { font-weight: 600; font-size: 15px; margin-top: 2px; }

/* --------------------------------------------------------- поиск/повторение */

.search-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.12s ease;
}
.search-input:focus { border-color: var(--red-600); }
.search-count { font-size: 12.5px; color: var(--ink-muted); margin: 12px 0 4px; }

.item-card { border-bottom: 1px solid var(--line); padding: 15px 2px; }
.item-card:last-child { border-bottom: none; }
.item-card .name { font-weight: 600; font-size: 15.5px; }
.item-card .meta { font-size: 13.5px; color: var(--ink-muted); margin-top: 3px; line-height: 1.5; }
.tags { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; }
.slide-body .tags { margin-top: 18px; }
.tag {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--line-soft);
  border-radius: 5px;
  padding: 3px 8px;
}

/* ----------------------------------------------------------- пустое состояние */

.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--ink-muted);
}
.empty .icon { color: var(--line); display: grid; place-items: center; margin-bottom: 12px; }
.empty .icon svg { width: 40px; height: 40px; }
.empty .title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.empty .hint { font-size: 13.5px; }

/* ----------------------------------------------------------------- админка */

table.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); }
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table th {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pin-badge {
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--ink);
  color: #fbdcd4;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mini-bar { display: flex; align-items: center; gap: 8px; min-width: 96px; }
.mini-bar .track { flex: 1; height: 5px; border-radius: 4px; background: var(--line); overflow: hidden; }
.mini-bar .track > span { display: block; height: 100%; background: var(--red-600); border-radius: 4px; }
.mini-bar .val { font-size: 12.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ плашки */

.banner-error { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.banner-info  { background: var(--red-50); color: var(--red-700); padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
