/* Экран входа КЛАНСКИ (05.10.2026). Стиль — dark cinematic: тёмная база,
   красно-оранжевые акценты, дым и свет (мастер-ТЗ разд. 8–9). Не зависит от
   style.css — страница самодостаточна, чтобы тёмная тема игры и светлые
   страницы кабинета не влияли друг на друга. */

:root {
  --a-bg: #0b0705;
  --a-panel: rgba(20, 13, 9, 0.68);
  --a-line: rgba(255, 150, 60, 0.24);
  --a-text: #efe3d3;
  --a-muted: #a8927c;
  --a-ember: #ff6a1f;
  --a-gold: #ffb347;
  --a-crimson: #b3170f;
  --a-font: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--a-bg);
  color: var(--a-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  position: relative;
}

/* ---------- Фон ---------- */
.auth-bg { position: fixed; inset: 0; z-index: 0; }
.auth-bg-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 28% 62%, rgba(255, 90, 24, 0.28), transparent 60%),
    radial-gradient(ellipse 45% 55% at 80% 20%, rgba(179, 23, 15, 0.22), transparent 65%),
    linear-gradient(180deg, #120b07 0%, #0b0705 55%, #060403 100%);
  animation: authGlow 9s ease-in-out infinite alternate;
}
.auth-bg-floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38%;
  background: linear-gradient(180deg, transparent, rgba(255, 90, 24, 0.07) 60%, rgba(0, 0, 0, 0.65));
}
@keyframes authGlow {
  from { filter: brightness(0.92); }
  to   { filter: brightness(1.12); }
}

.auth-stage { position: fixed; inset: 0; z-index: 1; }
.auth-stage canvas { display: block; width: 100%; height: 100%; }

.auth-fallback-hero {
  display: none; position: fixed; z-index: 1; left: 14%; top: 50%; transform: translateY(-50%);
}
.auth-fallback-hero img {
  width: min(32vw, 360px); filter: drop-shadow(0 0 40px rgba(255, 90, 24, 0.55));
  animation: authFloat 5s ease-in-out infinite alternate;
}
.no3d .auth-fallback-hero { display: block; }
.no3d .auth-hero-caption { display: none; }
@keyframes authFloat { from { transform: translateY(-6px); } to { transform: translateY(8px); } }

.auth-vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.72) 100%);
}
.auth-grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Раскладка ---------- */
.auth-layout {
  position: relative; z-index: 3; min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 480px);
  align-items: center; gap: 0;
}
.auth-hero-caption {
  align-self: end; justify-self: start; margin: 0 0 7vh 12vw;
  display: flex; align-items: center; gap: 12px;
  font-family: var(--a-font); letter-spacing: 0.32em; text-transform: uppercase;
  font-size: 0.72rem; color: var(--a-muted);
}
.auth-caption-line { width: 46px; height: 1px; background: linear-gradient(90deg, var(--a-ember), transparent); }

.auth-panel { padding: 24px clamp(16px, 5vw, 64px) 24px 0; display: flex; justify-content: center; }

.auth-card {
  width: 100%; max-width: 420px; position: relative;
  background: var(--a-panel);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid var(--a-line);
  border-radius: 6px;
  padding: 26px 26px 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 90, 24, 0.08), inset 0 1px 0 rgba(255, 200, 140, 0.08);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  animation: authCardIn 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-card::before {
  content: ""; position: absolute; left: 16px; right: 16px; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--a-ember), var(--a-gold), var(--a-ember), transparent);
  filter: drop-shadow(0 0 6px rgba(255, 106, 31, 0.8));
}
@keyframes authCardIn { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }

/* ---------- Бренд в карточке ---------- */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand-mark { height: 64px; width: auto; filter: drop-shadow(0 0 18px rgba(255, 90, 24, 0.45)); }
.auth-brand-word { width: min(100%, 300px); height: auto; }

/* ---------- Вкладки ---------- */
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.auth-tab {
  font-family: var(--a-font); font-size: 0.95rem; letter-spacing: 0.14em; text-transform: uppercase;
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--a-muted); padding: 10px 6px; cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.auth-tab:hover { color: var(--a-text); }
.auth-tab.active { color: var(--a-gold); border-bottom-color: var(--a-ember); text-shadow: 0 0 14px rgba(255, 106, 31, 0.5); }
.auth-tab:focus-visible { outline: 2px solid var(--a-gold); outline-offset: 2px; }

/* ---------- Формы ---------- */
.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; animation: authFade 0.35s ease both; }
@keyframes authFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > span { font-family: var(--a-font); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--a-muted); }
.auth-field input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--a-text);
  background: rgba(8, 5, 3, 0.72); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 4px;
  padding: 12px 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field input::placeholder { color: #6e5d4d; }
.auth-field input:focus { border-color: var(--a-ember); box-shadow: 0 0 0 3px rgba(255, 106, 31, 0.22); }
.auth-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--a-text); box-shadow: 0 0 0 1000px #17100b inset; caret-color: var(--a-text);
}
.auth-pass { position: relative; }
.auth-pass input { padding-right: 88px; }
.auth-pass-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--a-muted); font: inherit; font-size: 0.78rem;
  letter-spacing: 0.06em; padding: 6px 8px; cursor: pointer; border-radius: 4px;
}
.auth-pass-toggle:hover { color: var(--a-gold); }

.auth-submit {
  font-family: var(--a-font); font-size: 1.02rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700;
  color: #fff; border: 0; cursor: pointer; padding: 14px 18px; margin-top: 4px;
  background: linear-gradient(180deg, #ff7a2e 0%, #d8381a 55%, #a31510 100%);
  clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
  box-shadow: 0 8px 28px rgba(255, 90, 24, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: filter 0.2s, transform 0.15s;
}
.auth-submit:hover { filter: brightness(1.12); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { filter: grayscale(0.6) brightness(0.8); cursor: progress; }
.auth-submit:focus-visible { outline: 2px solid var(--a-gold); outline-offset: 3px; }

.auth-error { min-height: 1.2em; margin: 0; font-size: 0.86rem; color: #ff7b6b; }
.auth-hint { margin: -4px 0 0; font-size: 0.82rem; color: var(--a-muted); text-align: center; }
.auth-foot { margin: 16px 0 0; text-align: center; font-size: 0.72rem; letter-spacing: 0.12em; color: #6e5d4d; }

/* ---------- Переход героя в хаб ---------- */
.auth-enter-overlay {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, #3a1606 0%, #0b0705 70%);
  transition: opacity 0.7s ease;
}
.auth-enter-overlay.on { opacity: 1; }

/* ---------- Тост (shared.js использует #toast) ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: #1b110b; color: var(--a-text); border: 1px solid var(--a-line);
  padding: 10px 18px; border-radius: 8px; font-size: 0.9rem;
}
.toast.hidden { display: none; }

/* ---------- Планшеты/телефоны: герой сверху, форма снизу ---------- */
@media (max-width: 860px) {
  .auth-body { overflow-y: auto; }
  .auth-layout { grid-template-columns: 1fr; align-items: end; }
  .auth-hero-caption { display: none; }
  .auth-panel { padding: 0 14px calc(14px + env(safe-area-inset-bottom, 0px)); margin-top: 34vh; }
  .auth-card { max-width: 460px; padding: 20px 18px 14px; }
  .auth-brand { flex-direction: row; justify-content: center; margin-bottom: 14px; }
  .auth-brand-mark { height: 46px; }
  .auth-brand-word { width: 190px; }
  .auth-fallback-hero { left: 50%; top: 17%; transform: translate(-50%, -50%); }
  .auth-fallback-hero img { width: 120px; }
}
@media (max-height: 640px) and (max-width: 860px) {
  .auth-panel { margin-top: 24vh; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-form.active, .auth-bg-glow, .auth-fallback-hero img { animation: none; }
  .auth-enter-overlay { transition-duration: 0.2s; }
}
