/* Дизайн-язык VASTUBASE: кремовая база, терракотовый акцент,
   скругления почти нулевые — бренд геометричный. */

:root {
  --cream: #e7dbcf;
  --cream-40: #f5f1ec;
  --cream-20: #faf8f5;
  --terracotta: #a75132;
  --terracotta-deep: #8e4329;
  --terracotta-60: #ca9784;
  --ink: #1d1d1b;

  --bg: var(--cream-20);
  --bg-raised: #fff;
  --text: var(--ink);
  --text-muted: color-mix(in srgb, var(--ink) 62%, transparent);
  --accent: var(--terracotta);
  --accent-text: var(--terracotta-deep);
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --bad: #96301c;

  --radius: 2px;
  --font: "Avenir Next Cyr", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-raised: #211c16;
    --text: var(--cream);
    --text-muted: color-mix(in srgb, var(--cream) 60%, transparent);
    --accent: var(--terracotta-60);
    --accent-text: var(--terracotta-60);
    --line: color-mix(in srgb, var(--cream) 20%, transparent);
    --bad: #e0806b;
  }
}

* { box-sizing: border-box; }

/* Скрытие должно побеждать раскладку: правило браузера слабее любого класса
   с display, и без этого все экраны показывались бы разом. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* --- вход --- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gate__card {
  width: min(26rem, 100%);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
}

.gate__title { margin: 0 0 0.35rem; font-size: 1.4rem; }
.gate__lead { margin: 0 0 1.5rem; color: var(--text-muted); font-size: 0.92rem; }

/* --- шапка --- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.top__right { display: flex; align-items: center; gap: 0.5rem; }

.tab {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }

.linkish {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 0.5rem;
}

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

/* --- раскладка --- */

.wrap { max-width: 46rem; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.view { display: flex; flex-direction: column; gap: 1rem; }

.title { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.meta, .hint { margin: 0; font-size: 0.86rem; color: var(--text-muted); }
.step { margin: 0; font-size: 0.95rem; color: var(--accent-text); }

/* --- поля --- */

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field span { font-size: 0.82rem; color: var(--text-muted); }
.field--wide { width: 100%; }

.field input, .search {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  width: 100%;
}

.field input:focus, .search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

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

.btn {
  font: inherit;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background var(--ease) 0.16s, border-color var(--ease) 0.16s;
}

.btn--primary { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--terracotta-deep); border-color: var(--terracotta-deep); }
.btn--ghost { border: 1px solid var(--line); background: transparent; color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.btn--small { padding: 0.35rem 0.6rem; font-size: 0.84rem; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* --- зона ссылки и файла --- */

.drop {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.drop.is-over { border-color: var(--accent); border-style: solid; }
.drop__hint { margin: 0; font-size: 0.82rem; color: var(--text-muted); }

.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.row__or { font-size: 0.85rem; color: var(--text-muted); }

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

.track { height: 3px; background: var(--line); border-radius: var(--radius); overflow: hidden; }

/* Полоса растёт через transform, а не width: масштабирование не трогает
   раскладку страницы, поэтому кадры не дёргаются. */
.track__fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--ease) 0.3s;
}

/* --- сообщения --- */

.msg {
  margin: 0;
  font-size: 0.88rem;
  border-left: 2px solid var(--line);
  padding-left: 0.65rem;
  color: var(--text-muted);
}

.msg--bad { color: var(--bad); border-left-color: var(--bad); }

/* --- справка --- */

.help { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.help summary { cursor: pointer; font-size: 0.9rem; color: var(--accent-text); }
.help__list { margin: 0.9rem 0; font-size: 0.88rem; }
.help__list dt { font-weight: 600; margin-top: 0.7rem; }
.help__list dd { margin: 0.15rem 0 0; color: var(--text-muted); }

/* --- инструменты результата --- */

.tools { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.tools .search { flex: 1 1 12rem; width: auto; }
.search__count { font-size: 0.8rem; color: var(--text-muted); min-width: 2.5ch; }

/* --- лента реплик --- */

.lines { list-style: none; margin: 0; padding: 0; }

.line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
}

.line:hover { background: var(--bg-raised); }
.line.is-hit { background: color-mix(in srgb, var(--accent) 10%, transparent); }

.line__time {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--accent-text);
  padding-top: 0.12rem;
}

.line__who { display: block; font-size: 0.78rem; color: var(--text-muted); }
.line__text { margin: 0; overflow-wrap: anywhere; }
.line__text mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; }

/* --- история --- */

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }

.history__item {
  width: 100%;
  text-align: left;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.history__item:hover { border-color: var(--accent); }
.history__meta { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
