@font-face {
  font-family: "Golos Text";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/golos-text-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/golos-text-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212;
}

:root {
  /* Тёмный стол, бумага, четыре цвета пометок на полях */
  --ink: #0f1c1f;
  --ink-raised: #172b2f;
  --line: #27444a;
  --paper: #ece7db;
  --mute: #8fa5a4;
  --missed: #e3a93c;
  --clarify: #74b9dc;
  --deadline: #e685a0;
  --steer: #86c795;
  --rec: #e5584a;

  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", "Noto Sans Arabic", sans-serif;
  --pad: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, ul, ol, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--clarify); outline-offset: 2px; }

/* ---------- страницы ---------- */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) var(--pad) calc(env(safe-area-inset-bottom) + 40px);
}
.page.narrow { max-width: 400px; padding-top: 18vh; }
.page > section, .page > form, #sum-body > section { margin-top: 36px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head-actions { display: flex; gap: 8px; flex: none; }
.wordmark { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.lead { margin-top: 12px; color: var(--mute); max-width: 34ch; }

h1 { font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.page-head + h1 { margin-top: 22px; }
h2 { font-size: 19px; font-weight: 600; line-height: 1.3; margin-bottom: 14px; }
h3 { font-size: 15px; font-weight: 600; color: var(--mute); margin: 18px 0 8px; }
.meta { color: var(--mute); margin-top: 6px; }
.prose { max-width: 62ch; }
.help { color: var(--mute); font-size: 14px; line-height: 1.45; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
label, legend { font-size: 14px; color: var(--mute); }

input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%;
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.4;
}
textarea { resize: vertical; min-height: 120px; }
::placeholder { color: #6f8686; }

button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; background: none; }
button:disabled { opacity: 0.5; cursor: default; }
.primary, .button {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.primary.big { padding: 16px 20px; font-size: 18px; width: 100%; }
.button { background: var(--ink-raised); color: var(--paper); border: 1px solid var(--line); }
.quiet { padding: 8px 12px; border-color: var(--line); color: var(--paper); font-size: 15px; white-space: nowrap; }
.quiet.danger { color: var(--deadline); }

.langs { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.langs legend { margin-bottom: 8px; padding: 0; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mute);
  font-size: 15px;
}
.chip input:checked + span { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--clarify); outline-offset: 2px; }

.notice {
  border: 1px solid var(--missed);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.form-error { color: var(--deadline); }

.key { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.key h2 { margin: 0; }
.key a { color: var(--clarify); }
.key-state { font-size: 14px; color: var(--mute); }
.key-state.set { color: var(--steer); }
.key-input { -webkit-text-security: disc; }
.key-check { font-size: 15px; min-height: 1.4em; }
.key-check.ok { color: var(--steer); }
.key-check.bad { color: var(--deadline); }
.loading { margin-top: 28px; color: var(--mute); }

.past-list li + li { border-top: 1px solid var(--line); }
.past-list button {
  width: 100%;
  text-align: left;
  padding: 14px 0;
  border-radius: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
}
.past-list .t { font-weight: 600; }
.past-list .d, .past-list .s { color: var(--mute); font-size: 14px; }
.past-list .s.live { color: var(--missed); }
.past-list .d { grid-column: 1; }

.plain-list li { padding: 8px 0 8px 18px; position: relative; max-width: 62ch; }
.plain-list li::before { content: ""; position: absolute; left: 0; top: 19px; width: 8px; height: 1px; background: var(--mute); }

.tasks li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  align-items: start;
}
.tasks input[type="checkbox"] { width: 22px; height: 22px; margin-top: 11px; accent-color: var(--steer); }
.tasks .row { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tasks textarea.title { min-height: 0; resize: none; overflow: hidden; font-weight: 600; }
.tasks .who { color: var(--mute); font-size: 14px; }
.tasks .details { color: var(--mute); font-size: 14px; line-height: 1.45; }
.tasks .due { display: flex; align-items: center; gap: 8px; }
.tasks .due input { width: auto; padding: 8px 10px; font-size: 15px; }
.tasks li.sent { opacity: 0.6; }
.tasks .sent-mark { color: var(--steer); font-size: 14px; }
.todoist { margin-top: 20px; }
#sum-extra { margin-top: 36px; display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
details summary { cursor: pointer; color: var(--mute); padding: 6px 0; }

/* ---------- экран встречи ---------- */

.live {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-columns: minmax(0, 1fr);
  padding-top: env(safe-area-inset-top);
}

.live-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--pad);
  border-bottom: 1px solid var(--line);
}
.rec { width: 10px; height: 10px; border-radius: 50%; background: var(--mute); flex: none; }
.rec[data-state="live"] { background: var(--rec); }
.rec[data-state="reconnecting"], .rec[data-state="connecting"] { background: var(--missed); }
.meter { width: 34px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; width: 100%; background: var(--steer); transform: scaleX(0); transform-origin: left; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.live-title { flex: 1; min-width: 0; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 519px) {
  .live-title { visibility: hidden; }
}
.live > .notice { margin: 10px var(--pad) 0; }

.hints { overflow-y: auto; padding: 14px var(--pad) 8px; }
.hints-status { color: var(--mute); font-size: 14px; }
.hints-empty { color: var(--mute); margin-top: 22px; max-width: 30ch; font-size: 19px; line-height: 1.4; }

.hints-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.hint {
  --c: var(--steer);
  position: relative;
  padding: 8px 0 8px 14px;
  border-left: 3px solid var(--c);
  cursor: pointer;
}
.hint[data-type="missed"] { --c: var(--missed); }
.hint[data-type="clarify"] { --c: var(--clarify); }
.hint[data-type="deadline"] { --c: var(--deadline); }
.hint .kind { display: block; color: var(--c); font-size: 14px; font-weight: 600; line-height: 1.3; }
.hint .text { display: block; font-size: 17px; line-height: 1.35; color: var(--paper); }
.hint.done { opacity: 0.4; }
.hint.done .text { text-decoration: line-through; }

/* Свежая подсказка: крупно, как карточка суфлёра. Полоска снизу убывает полторы минуты. */
.hint.fresh { padding: 12px 0 16px 16px; margin-bottom: 10px; border-left-width: 5px; }
.hint.fresh .kind { font-size: 16px; margin-bottom: 4px; }
.hint.fresh .text { font-size: 29px; line-height: 1.18; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.hint.fresh::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 0;
  bottom: 4px;
  height: 2px;
  background: var(--c);
  transform-origin: left;
  animation: fresh 90s linear forwards;
}
.hint.fresh.enter { animation: enter 220ms ease-out; }
@keyframes fresh { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes enter { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.script { border-top: 1px solid var(--line); display: flex; flex-direction: column; height: 30dvh; min-height: 0; }
.script.open { height: 62dvh; }
.script-toggle {
  flex: none;
  text-align: left;
  padding: 8px var(--pad) 0;
  color: var(--mute);
  font-size: 14px;
  border-radius: 0;
  display: flex;
  justify-content: space-between;
}
.script-toggle::after { content: "развернуть"; }
.script.open .script-toggle::after { content: "свернуть"; }
.script-body {
  overflow-y: auto;
  padding: 14px var(--pad) 10px;
  flex: 1;
  min-height: 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}
.script-body.static { padding: 8px 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }

.seg { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 5px 0; align-items: baseline; }
.seg .sp {
  padding: 0;
  color: var(--mute);
  font-size: 13px;
  font-weight: 600;
  min-width: 30px;
  max-width: 96px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
}
.seg .tx { display: block; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.seg[lang="ar"] .tx { font-size: 18px; line-height: 1.7; }
.seg .tail { color: var(--mute); }

.live-foot { padding: 10px var(--pad) calc(env(safe-area-inset-bottom) + 12px); border-top: 1px solid var(--line); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 12px;
  max-width: min(90vw, 420px);
  font-size: 15px;
  z-index: 10;
}

@media (min-width: 900px) {
  .live {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .live-bar, .live > .notice { grid-column: 1 / -1; }
  .hints { grid-column: 1; grid-row: 3; padding: 28px 40px; }
  .hint.fresh .text { font-size: 40px; }
  .script, .script.open { grid-column: 2; grid-row: 3 / 5; height: auto; border-top: 0; border-left: 1px solid var(--line); }
  .script-toggle::after, .script.open .script-toggle::after { content: ""; }
  .live-foot { grid-column: 1; grid-row: 4; padding: 14px 40px 20px; }
  .live-foot .primary.big { max-width: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint.fresh::after, .hint.fresh.enter { animation: none; }
  .hint.fresh::after { display: none; }
}
