:root{
  --bg: #070709;
  --panel: rgba(255,255,255,0.05);
  --glass: rgba(255,255,255,0.08);
  --gold: #f5d36c;
  --gold-2: #d9a92f;
  --text: #ececf0;
  --muted: #b9b9bf;
}

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

body.auth-body{
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans";
  min-height: 100vh;
  overflow: auto;
  display: grid;
  place-items: center;
  padding-block: clamp(16px, 5vh, 48px);
}

@supports (height: 100svh) {
  body.auth-body{
    min-height: 100svh;
  }
}

.bg-wrap{
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.bg-wrap canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.aurora{
  position: absolute;
  inset: -20% -10% -10% -10%;
  filter: blur(28px);
  opacity: .9;
  mix-blend-mode: screen;
  background:
    radial-gradient(40% 40% at 15% 30%, rgba(245,211,108,.18), transparent 60%),
    radial-gradient(45% 45% at 80% 25%, rgba(122,108,255,.22), transparent 65%),
    radial-gradient(55% 55% at 60% 80%, rgba(39,184,255,.18), transparent 60%);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora{
  0%{ transform: translate3d(0,0,0) scale(1) }
  100%{ transform: translate3d(-4%,2%,0) scale(1.06) }
}

.auth-container{
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
}


.auth-card{
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

.auth-title{
  color: var(--gold);
  font-size: 1.9rem;
  text-align: center;
  margin: 6px 0 22px;
  letter-spacing: .3px;
}

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

.auth-input{
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: #111115;
  color: #fff;
  font-size: 1rem;
  transition: box-shadow .25s ease, border-color .25s ease, transform .08s ease;
}
.auth-input:focus{
  outline: none;
  border-color: rgba(245,211,108,.55);
  box-shadow: 0 0 0 3px rgba(245,211,108,.20);
}

.auth-button{
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  color: #1c1500;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
  border: none;
  transition: transform .12s ease, filter .25s ease, box-shadow .25s ease;
  box-shadow: 0 10px 30px rgba(245,211,108,.22);
}
.auth-button:hover{ filter: saturate(110%) }
.auth-button:active{ transform: translateY(1px) }

.auth-footer{
  margin-top: 16px;
  text-align: center;
  font-size: .95rem;
  color: var(--muted);
}
.auth-footer a{
  color: var(--gold);
  text-decoration: none;
  font-weight: 800;
}
.auth-footer a:hover{ text-decoration: underline }

.auth-error, .auth-message, .field-error{
  margin-top: 10px;
  padding: 10px;
  background: #b91c1c;
  color: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 520px){
  .auth-card{ padding: 28px; }
  .auth-button{ font-size: 1rem; }
}

.bg-wrap { pointer-events: none; }          
.bg-wrap canvas, .bg-wrap .aurora { pointer-events: none; }

.auth-back{
  position: fixed; top: 20px; left: 20px; z-index: 3;   
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 700;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px) saturate(140%);
  transition: transform .15s ease, box-shadow .25s ease, background .25s ease;
}
.auth-back:hover{
  background: rgba(255,255,255,0.10);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.auth-back:active{ transform: translateY(1px); }

.auth-back__icon{ width: 22px; height: 22px; }
.auth-back__label{ letter-spacing: .2px; }

.auth-form .auth-input,
.auth-form .auth-button{
  width: 100%;
  display: block;
}
.auth-button:disabled,
.auth-button[disabled] {
  background: #8f8f8f !important;    
  border-color: rgba(0,0,0,0.15) !important;
  color: rgba(255,255,255,0.85) !important;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;        
  filter: grayscale(12%);
  opacity: 0.92;
}
.rules{
  color: #f5d36c;
}

html, body.auth-body, .auth-container, .auth-card {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, [contenteditable="true"], .selectable {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

.password-field{ position: relative; }
.password-field .auth-input{
  padding-right: 56px;             
}
.toggle-pass{
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease, transform .08s ease;
  z-index: 1;
}
.toggle-pass:hover{
  background: rgba(255,255,255,0.10);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.toggle-pass:active{ transform: translateY(-50%) translateY(1px); }
.toggle-pass svg{
  width: 22px; height: 22px; display: block;
  stroke: currentColor; color: #e9e9ef; fill: none; stroke-width: 2;
  opacity: .95;
}
.toggle-pass[data-state="visible"] .icon-eye{ display:none }
.toggle-pass[data-state="hidden"]  .icon-eye-off{ display:none }

@media (max-width: 520px){
  .toggle-pass{ width: 44px; height: 44px; border-radius: 14px; }
  .password-field .auth-input{ padding-right: 62px; }
}


.password-field{
  position: relative;
  display: grid;             
  align-items: center;
}
.password-field .auth-input{
  grid-area: 1 / 1;         
  padding-right: 50px;        
}

.toggle-pass{
  grid-area: 1 / 1;      
  justify-self: end;
  align-self: center;
  margin-right: -10px;
  margin-bottom: 5px;        
  position: relative;         
  width: 40px; height: 40px;   
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease, transform .08s ease;
}
.toggle-pass:hover{
  background: rgba(255,255,255,0.10);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.toggle-pass svg{
  width: 22px; height: 22px; display: block;
  stroke: currentColor; color: #e9e9ef; fill: none; stroke-width: 2;
  opacity: .95;
}
.toggle-pass[data-state="visible"] .icon-eye{ display:none }
.toggle-pass[data-state="hidden"]  .icon-eye-off{ display:none }

@media (max-width: 520px){
  .toggle-pass{ width: 44px; height: 44px; border-radius: 14px; }
  .password-field .auth-input{ padding-right: 56px; }
}

.modal-backdrop{
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-backdrop.is-visible{ display: flex; }

.modal{
  width: min(520px, 92vw);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  backdrop-filter: blur(10px) saturate(140%);
}
.modal-title{
  margin: 0 0 8px; color: var(--gold); font-size: 1.25rem; font-weight: 800;
}
.modal-desc{ margin: 0 0 12px; color: var(--muted); }

.modal-actions{
  margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap;
}
.link-like{
  background: transparent; border: none; padding: 0; cursor: pointer;
  color: var(--gold); font-weight: 800; text-decoration: underline;
}
.hidden{ display: none !important; }
.auth-button, .toggle-pass, .link-like {
  touch-action: manipulation;
}