:root {
  color-scheme: dark;
  --bg: #0a080c;
  --surface: #16131a;
  --text: #f7f4f5;
  --muted: #9c9098;
  --accent: #f22e52;
  --border: rgba(255, 255, 255, 0.1);
  --field: #16131a;
  --grad: linear-gradient(135deg, #f22e52 0%, #ff7a45 100%);
  --glow: 0 8px 28px rgba(242, 46, 82, 0.42);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 92px;
  --auth-pad-x: 20px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(242, 46, 82, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html.has-tabbar body {
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: max(24px, calc(20px + var(--safe-t))) var(--auth-pad-x)
    max(28px, calc(24px + var(--safe-b)));
}

.auth-page > .app-brand {
  margin: 0 0 22px;
  text-align: center;
  font-size: 20px;
}

.auth-title {
  margin: 0 0 22px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  letter-spacing: -0.02em;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  min-height: 42px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.auth-tab.is-on {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 4px 16px rgba(242, 46, 82, 0.4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: -4px;
}

.auth-phone-row {
  display: flex;
  gap: 8px;
}

.auth-dial {
  flex: 0 0 108px;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  font-size: 15px;
  padding: 0 8px;
}

.auth-phone,
.auth-password {
  flex: 1;
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  font-size: 16px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.auth-dial:focus,
.auth-phone:focus,
.auth-password:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 46, 82, 0.18);
}

.auth-btn {
  margin-top: 10px;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.05s;
}

.auth-btn:active {
  transform: scale(0.99);
}

.auth-btn--primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow);
}

.auth-btn:disabled {
  opacity: 0.5;
}

.auth-legal {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.auth-legal a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.auth-msg {
  margin: 16px 0 0;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  background: rgba(242, 46, 82, 0.14);
  color: #d7c8ff;
}

.auth-msg.is-ok {
  background: rgba(46, 200, 120, 0.12);
  color: #7dffb0;
}

@media (min-height: 700px) {
  .auth-page {
    padding-top: max(32px, calc(24px + var(--safe-t)));
    padding-bottom: max(36px, calc(28px + var(--safe-b)));
  }
}
