/* Кто в трубке: базовая тема. Тёмная, кинематографичная, тёплый акцент. */

:root {
  --bg-0: #070a0f;
  --bg-1: #0d1219;
  --panel: rgba(13, 18, 26, 0.78);
  --panel-solid: #10161f;
  --panel-2: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.07);
  --ink: #eef1f6;
  --ink-dim: #a4b0c2;
  --ink-mute: #6f7c90;
  --accent: #ff8a3d;
  --accent-soft: #ffb877;
  --accent-deep: #c85a17;
  --good: #6ee7a8;
  --warn: #ffc46b;
  --bad: #ff7a7a;
  --lcd-bg: #9aa87e;
  --lcd-ink: #1c2418;
  --lcd-dim: #4a5a3c;

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --font: "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-soft); }

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.art {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg-0);
}
.art-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  animation: art-in 1.2s ease both;
}
.art-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.art-svg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes art-in {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: none; }
}

/* Кадрирование под текст. */
.art[data-scene="cover"] .art-photo { object-position: center 42%; }
.art[data-scene="friend"] .art-photo { object-position: center 34%; }
.art[data-scene="desk"] .art-photo { object-position: center 62%; }
.art[data-scene="dawn"] .art-photo { object-position: center 40%; }

/* Затемнение под текст: своё для каждой сцены. */
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 6, 10, 0.94) 0%, rgba(4, 6, 10, 0.78) 34%, rgba(4, 6, 10, 0.18) 66%, rgba(4, 6, 10, 0.42) 100%);
}
.art[data-scene="friend"]::after {
  background: linear-gradient(180deg, rgba(4, 6, 10, 0.35) 0%, rgba(4, 6, 10, 0.05) 32%, rgba(4, 6, 10, 0.55) 72%, rgba(4, 6, 10, 0.88) 100%);
}
.art[data-scene="desk"]::after {
  background: radial-gradient(120% 90% at 50% 40%, rgba(4, 6, 10, 0.1) 0%, rgba(4, 6, 10, 0.7) 78%),
    linear-gradient(180deg, rgba(4, 6, 10, 0.5) 0%, rgba(4, 6, 10, 0.25) 40%, rgba(4, 6, 10, 0.8) 100%);
}
.art[data-scene="dawn"]::after {
  background: linear-gradient(90deg, rgba(4, 6, 10, 0.88) 0%, rgba(4, 6, 10, 0.5) 42%, rgba(4, 6, 10, 0.2) 100%);
}
.art[data-scene="chat"]::after {
  background: radial-gradient(120% 100% at 50% 50%, rgba(4, 6, 10, 0.55) 0%, rgba(4, 6, 10, 0.85) 100%);
}

/* Справочные экраны: текста много, картинка должна отойти на второй план. */
.art.is-doc .art-photo { filter: blur(3px) saturate(0.75) brightness(0.75); }
.art.is-doc::after {
  background: linear-gradient(90deg, rgba(4, 6, 10, 0.96) 0%, rgba(4, 6, 10, 0.9) 46%, rgba(4, 6, 10, 0.78) 100%);
}

.scene {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(44px, 6.4vw, 92px); line-height: 0.98; }
h2 { font-size: clamp(26px, 3vw, 40px); line-height: 1.08; }
h3 { font-size: 19px; }
p { margin: 0 0 14px; }
.lead { font-size: 17px; color: var(--ink-dim); max-width: 62ch; }
.dim { color: var(--ink-dim); }
.mute { color: var(--ink-mute); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 13px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-color: rgba(255, 180, 120, 0.5);
  color: #1a0d03;
  box-shadow: 0 12px 34px rgba(200, 90, 23, 0.32);
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%); }

.btn-ghost { background: transparent; border-color: var(--line-soft); color: var(--ink-dim); }
.btn-ghost:hover { color: var(--ink); }

.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; border-radius: 10px; }
.btn-danger { border-color: rgba(255, 122, 122, 0.4); color: var(--bad); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- Поля ---------- */

.field { margin-bottom: 22px; }
.field > label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.input, .textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: rgba(255, 138, 61, 0.65);
  background: rgba(255, 255, 255, 0.07);
}
.textarea { resize: vertical; min-height: 96px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink-dim);
  font-size: 14px;
  transition: all 0.14s ease;
}
.chip:hover { border-color: rgba(255, 255, 255, 0.26); color: var(--ink); }
.chip[aria-pressed="true"], .chip.active {
  background: rgba(255, 138, 61, 0.16);
  border-color: rgba(255, 138, 61, 0.55);
  color: var(--accent-soft);
}

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

.card {
  padding: 24px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.panel-note {
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  color: var(--ink-dim);
}

.divider { height: 1px; background: var(--line-soft); margin: 20px 0; border: 0; }

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

/* ---------- Экранные слои ---------- */

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.45s ease both;
}
.screen-pad {
  padding: clamp(28px, 5vw, 76px);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Оверлей (телефон / чат) ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  background: rgba(3, 5, 8, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-in 0.28s ease both;
}
.overlay[hidden] { display: none; }

/* ---------- Тост ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(620px, 92vw);
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #131a24;
  box-shadow: var(--shadow);
  font-size: 14.5px;
  animation: rise 0.25s ease both;
}
.toast[hidden] { display: none; }
.toast.is-bad { border-color: rgba(255, 122, 122, 0.5); }
.toast.is-good { border-color: rgba(110, 231, 168, 0.45); }

/* ---------- Прочее ---------- */

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-0);
  color: var(--ink);
  padding: 40px;
  text-align: center;
  z-index: 999;
}

.kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: var(--ink-dim);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sound-toggle {
  position: fixed;
  right: 18px;
  top: 16px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 14, 20, 0.7);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: all 0.15s ease;
}
.sound-toggle:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.28); }

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

/* Мягкий пульс главной кнопки: куда нажать с первой секунды. */
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.45); }
  60% { box-shadow: 0 0 0 12px rgba(255, 138, 61, 0); }
}
.btn-primary.is-pulse { animation: btn-pulse 2.2s ease-out infinite; }

/* Бегущая подсветка выбранной строки: видно, что она живая. */
@keyframes edge-wash {
  0% { background-position: -160% 0; }
  100% { background-position: 260% 0; }
}
.lcd-row.is-on { position: relative; }
.lcd-row.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: edge-wash 1.8s linear infinite;
}
