@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:      #0a0a0c;
  --panel:   #131316;
  --surface: #1b1b1f;
  --text:    #f2f2f4;
  --text-2:  #a7a7ae;
  --muted:   #63636a;
  --accent:  #4ea6ff;
  --border:  rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --danger:  #ff5d5d;
  --radius-lg: 28px;
  --radius-md: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter","Segoe UI",Arial,sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Не используем height:100% — ломает мобильные браузеры с адресной строкой */
  min-height: 100%;
  overflow-x: hidden;
}

/* ─── LOGIN WRAP ─────────────────────────────────────────── */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* dvh убирает прыжок при появлении/скрытии адресной строки */
  min-height: 100dvh;
  /* Fallback для браузеров без dvh */
  min-height: 100svh;
  min-height: 100vh;
  padding: 20px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: var(--bg);
}

/* ─── LOGIN CARD ─────────────────────────────────────────── */
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 360px;
}

/* ─── TITLE ──────────────────────────────────────────────── */
.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 4px;
  text-align: center;
}

/* ─── SUBTITLE ───────────────────────────────────────────── */
.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 26px;
  font-weight: 400;
  text-align: center;
}

/* ─── FORM GROUP ─────────────────────────────────────────── */
.form-group {
  width: 100%;
  margin-bottom: 12px;
}

/* ─── SR-ONLY (метка есть для скринридеров, но не показывается) ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── INPUT ──────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  /* min 48px tap target */
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder {
  color: var(--muted);
  font-size: 14px;
}
.input:focus {
  border-color: var(--border-strong);
  outline: none;
}

/* ─── ERROR ──────────────────────────────────────────────── */
.error-msg {
  color: var(--danger);
  font-size: 11px;
  font-weight: 500;
  margin: 8px 0 0 2px;
  min-height: 0;
  text-align: left;
}
.error-msg:empty { margin: 0; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  border-radius: var(--radius-md);
  /* min 48px tap target */
  padding: 14px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
  box-sizing: border-box;
  margin-top: 16px;
  font-weight: 600;
  border: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn.primary {
  background: var(--accent);
  color: #06121f;
}
.btn.primary:hover {
  background: #6bb5ff;
}
.btn.primary:active {
  opacity: 0.85;
}
.btn.primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.secondary {
  margin-top: 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: transparent;
}
.btn.secondary:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.btn.secondary:active {
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .btn.primary, .input { transition: none; }
}

/* ─── DESKTOP ────────────────────────────────────────────── */
@media (min-width: 480px) {
  .login-card {
    padding: 36px 32px;
  }
}
