:root {
  color-scheme: dark;
  --page-bg: #0f141a;
  --page-glow: rgba(52, 130, 185, 0.16);
  --card-bg: rgba(24, 32, 40, 0.92);
  --text-main: #edf3f7;
  --text-muted: #9aabb7;
  --border: rgba(154, 171, 183, 0.18);
  --input-bg: #141b22;
  --accent: #3d8ed0;
  --accent-hover: #56a2df;
  --secondary-bg: #212c36;
  --secondary-hover: #2a3742;
  --error: #ff8f8f;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --telegram: #2aabee;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page-bg: #eef3f7;
  --page-glow: rgba(61, 142, 208, 0.14);
  --card-bg: rgba(255, 255, 255, 0.94);
  --text-main: #25313a;
  --text-muted: #667681;
  --border: rgba(37, 49, 58, 0.12);
  --input-bg: #ffffff;
  --accent: #2f77b3;
  --accent-hover: #256292;
  --secondary-bg: #e4ebf0;
  --secondary-hover: #d8e1e8;
  --error: #c44d4d;
  --shadow: 0 18px 40px rgba(36, 49, 58, 0.12);
}

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

html,
body {
  margin: 0;
  min-height: 100vh;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, var(--page-glow), transparent 28%),
    radial-gradient(circle at bottom right, rgba(42, 171, 238, 0.12), transparent 22%),
    var(--page-bg);
}

.page {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-main);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.2s ease, opacity 0.2s ease;
}

.theme-toggle__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.theme-toggle__track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--secondary-bg);
}

.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

:root[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(18px);
}

:root:not([data-theme="light"]) .theme-toggle__icon--moon {
  color: var(--text-main);
}

:root[data-theme="light"] .theme-toggle__icon--sun {
  color: var(--text-main);
}

.login-card {
  width: min(100%, 360px);
  display: grid;
  gap: 14px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.login-card__title {
  margin: 0 0 4px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
}

.input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text-main);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
  color: #71818d;
}

.input:focus {
  outline: none;
  border-color: rgba(86, 162, 223, 0.6);
  box-shadow: 0 0 0 3px rgba(61, 142, 208, 0.16);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.button {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--accent);
  color: #fff;
}

.button--primary:hover {
  background: var(--accent-hover);
}

.button--secondary {
  background: var(--secondary-bg);
  color: var(--text-main);
}

.button--secondary:hover {
  background: var(--secondary-hover);
}

.button:focus-visible,
.theme-toggle:focus-visible,
.telegram-button:focus-visible {
  outline: 2px solid rgba(86, 162, 223, 0.45);
  outline-offset: 3px;
}

.message {
  margin: 0;
  color: var(--text-muted);
  min-height: 20px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.4;
}

.message--error {
  color: var(--error);
}

.telegram-button {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--telegram);
  color: #fff;
  box-shadow: 0 10px 24px rgba(42, 171, 238, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.telegram-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(42, 171, 238, 0.35);
}

.telegram-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.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;
}

@media (max-width: 480px) {
  .page {
    padding: 16px;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    padding: 8px 10px;
  }

  .login-card {
    width: min(100%, 100%);
    padding: 22px;
  }
}
