:root {
  --bg: #0b1119;
  --glass: rgba(14, 21, 31, 0.62);
  --glass-hover: rgba(20, 29, 42, 0.78);
  --line: rgba(255, 255, 255, 0.14);
  --stroke: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --muted: #8d97a7;
  --accent: #ec7f2c;
  --accent-2: #f8b73c;
  --accent-grad: linear-gradient(90deg, #f39a2a 0%, #e9752a 100%);
  --error: #ff6b6b;
  --radius: 6px;
  --pad-x: 66px;
}

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

html, body { min-height: 100%; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

/* ---------- Фон как на экране загрузки ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/img/bg.webp?v=2") center / cover no-repeat;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 12, 19, 0.82) 0%, rgba(8, 12, 19, 0.35) 45%, rgba(8, 12, 19, 0.1) 100%),
    linear-gradient(180deg, rgba(8, 12, 19, 0) 65%, rgba(8, 12, 19, 0.7) 100%);
}

/* ---------- Каркас экрана ---------- */
.screen {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 52px var(--pad-x) 52px;
}

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

.screen__main {
  display: flex;
  align-items: center;
  padding: 48px 0;
}

.screen__bottom-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 18px;
}

/* Линия снизу с оранжевым отрезком, как прогресс загрузки */
.progress-line {
  position: relative;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}

.progress-line::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 2px;
  margin-top: -0.5px;
  background: var(--accent);
}

.is-loading .progress-line::after {
  animation: run 1.1s ease-in-out infinite;
}

@keyframes run {
  from { right: 100%; width: 60px; }
  50%  { width: 180px; }
  to   { right: -180px; width: 60px; }
}

@media (max-width: 640px) {
  :root { --pad-x: 16px; }
  .screen { padding-top: 28px; padding-bottom: 28px; }
}

/* ---------- Логотип ---------- */
.brand-logo {
  position: relative;
  display: inline-block;
  width: 150px;
  height: 53px;
  color: var(--text);
  text-decoration: none;
  user-select: none;
}

.brand-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.brand-logo__text {
  position: absolute;
  left: 40px;
  bottom: 5px;
  font-size: 17px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-logo__text b { font-weight: 800; }

/* ---------- Форма входа ---------- */
.login {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login__head { margin-bottom: 14px; }
.login__title { font-size: 30px; font-weight: 800; line-height: 1.15; }
.login__sub { margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }

.field {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .15s, background .15s;
}

.field:hover { background: var(--glass-hover); }
.field:focus-within { border-color: var(--accent); background: var(--glass-hover); }
.field.is-invalid { border-color: var(--error); }

.field__icon {
  width: 15px;
  height: 15px;
  margin: 0 12px 0 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.field:focus-within .field__icon { color: var(--accent); }

.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  font-size: 14px;
  font-weight: 500;
}

.field input::placeholder { color: var(--muted); }

.field__toggle {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
}

.field__toggle:hover,
.field__toggle.is-on { color: var(--text); }
.field__toggle svg { width: 16px; height: 16px; }

.form-error {
  min-height: 17px;
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
}

.btn {
  height: 50px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-grad);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(236, 127, 44, 0.25);
  transition: filter .15s, box-shadow .15s, opacity .15s;
}

.btn:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 10px 30px rgba(236, 127, 44, 0.38); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn:disabled { opacity: .65; cursor: progress; }

/* ---------- Страница выбора ---------- */
.section-head { margin-bottom: 28px; }
.section-head h1 { font-size: 30px; font-weight: 800; }
.section-head p { margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }

.select-wrap { width: 100%; }

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
  gap: 16px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 24px 28px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
}

.choice--link {
  text-decoration: none;
  transition: background .2s, border-color .2s, transform .2s;
}

.choice--link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: width .3s ease;
}

.choice--link:hover,
.choice--link:focus-visible {
  background: var(--glass-hover);
  border-color: rgba(236, 127, 44, 0.35);
  transform: translateY(-2px);
  outline: none;
}

.choice--link:hover::after,
.choice--link:focus-visible::after { width: 100%; }

.choice__title {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.choice__title::after {
  content: "→";
  color: var(--accent);
  font-weight: 600;
  transition: transform .2s;
}

.choice--link:hover .choice__title::after { transform: translateX(4px); }

.top-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.logout {
  background: none;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s, color .15s;
}
.logout:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 640px) {
  .top-user span { display: none; }
  .choices { grid-template-columns: 1fr; }
}

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