:root{
    --overlay:rgba(0,0,0,.66);
    --cardTop:#1a1a1a;
    --cardBottom:#121212;
    --line:rgba(255,255,255,.08);
    --text:#fff;
    --muted:rgba(255,255,255,.60);
    --inputBg:#0e0e0e;
    --inputBorder:rgba(255,255,255,.14);
    --danger:#ff6b6b;

    --topbarWhite:#fff;
    --topbarDark:#242424;
    --ghostHover:rgba(255,255,255,.06);

    --h:68px;
    --padX:clamp(14px,2.2vw,26px);
  }

  *{
    box-sizing:border-box;
  }

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

  body{
    margin:0;
    font-family:'Montserrat',ui-sans-serif,-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,Arial,sans-serif;
    color:var(--text);
    background:#000;
  }

  button,
  input,
  a{
    font-family:'Montserrat',ui-sans-serif,-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,Arial,sans-serif;
  }

  .pageBackground{
    position:fixed;
    inset:0;
    z-index:-1;
    background:
      linear-gradient(var(--overlay),var(--overlay)),
      url('https://cdn.midwesternroleplay.com/images/background-1.png') center / cover no-repeat;
  }

  a{
    color:inherit;
    text-decoration:none;
  }

  .loginWrap{
    min-height:calc(100vh - var(--h));
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px var(--padX) 54px;
  }

  .authShell{
    width:100%;
    max-width:760px;
    display:flex;
    border-radius:22px;
    overflow:hidden;
    border:1px solid var(--line);
    background:linear-gradient(180deg,var(--cardTop),var(--cardBottom));
    backdrop-filter:blur(6px);
    box-shadow:0 18px 60px rgba(0,0,0,.35);
  }

  body.oauthChecking .authShell{
    visibility:hidden;
  }

  .oauthPageLoader{
    display:none;
    position:fixed;
    inset:0;
    z-index:20;
    place-items:center;
    pointer-events:none;
  }

  body.oauthChecking .oauthPageLoader{display:grid}

  .oauthPageLoaderSpinner{
    width:30px;
    height:30px;
    border:3px solid rgba(255,255,255,.22);
    border-top-color:#fff;
    border-radius:50%;
    animation:oauthPageLoaderSpin .75s linear infinite;
  }

  @keyframes oauthPageLoaderSpin{to{transform:rotate(360deg)}}

  .authShell.authErrorShake{
    animation:authErrorShake .42s ease-in-out;
  }

  @keyframes authErrorShake{
    0%,100%{transform:translateX(0)}
    20%,60%{transform:translateX(-8px)}
    40%,80%{transform:translateX(8px)}
  }

  .authCard{
    width:450px;
    min-width:450px;
    padding:26px 22px 24px;
    border-right:1px solid rgba(255,255,255,.06);
  }

  .qrPanel{
    width:310px;
    min-width:310px;
    padding:20px 16px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
    background:linear-gradient(180deg,rgba(255,255,255,.02),rgba(255,255,255,.01));
  }

  .authTitle{
    margin:0 0 20px;
    font-size:20px;
    font-weight:900;
    color:#fff;
    text-align:center;
  }

  .authSub{
    margin-bottom:18px;
    font-size:12px;
    color:var(--muted);
    text-align:left;
    font-weight:600;
  }

  .formRow{
    margin-top:12px;
  }

  .formRow:first-child{
    margin-top:0;
  }

  #passwordFormRow{
    display:grid;
    grid-template-rows:1fr;
    opacity:1;
    transition:grid-template-rows .26s ease,margin-top .26s ease,opacity .18s ease;
  }

  .passwordFieldContent{
    min-height:0;
    overflow:visible;
  }

  #passwordFormRow.isCollapsed{
    grid-template-rows:0fr;
    margin-top:0;
    opacity:0;
    pointer-events:none;
  }

  .socialLoginRow{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
  }

  .socialLoginRow[hidden],
  .socialSsoBtn[hidden],
  .loginDivider[hidden],
  .btnGhost[hidden],
  .formRow[hidden]{
    display:none !important;
  }

  .socialLoginBtn{
    position:relative;
    width:100%;
    height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    padding:0 12px;
    border:1px solid rgba(0,0,0,.16);
    border-radius:8px;
    background:var(--topbarWhite);
    color:var(--topbarDark);
    font-size:12px;
    font-weight:900;
    cursor:pointer;
    overflow:visible;
  }

  .socialLoginBtn::after{
    content:"";
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.12);
    border-radius:inherit;
    opacity:0;
    pointer-events:none;
    transition:opacity .16s ease;
  }

  .socialLoginBtn:hover::after{
    opacity:1;
  }

  .socialLoginBtn[data-last-used="true"]::before,
  .socialSsoBtn[data-last-used="true"]::before{
    content:"Last used";
    position:absolute;
    top:-10px;
    right:-8px;
    min-height:21px;
    display:flex;
    align-items:center;
    padding:0 9px;
    border:0;
    border-radius:999px;
    background:#eaf3ff;
    color:#2467c8;
    font-size:10px;
    font-weight:700;
    letter-spacing:0;
    line-height:1;
    pointer-events:none;
    z-index:2;
  }

  .socialButtonLoader{
    position:absolute;
    width:18px;
    height:18px;
    border:2px solid rgba(0,0,0,.2);
    border-top-color:var(--topbarDark);
    border-radius:999px;
    opacity:0;
    transform:scale(.8);
    transition:opacity .16s ease,transform .16s ease;
    z-index:1;
  }

  .socialLoginBtn.isLoading{
    pointer-events:none;
  }

  .socialLoginBtn.isLoading > .socialLoginIcon,
  .socialLoginBtn.isLoading > span:not(.socialButtonLoader){
    opacity:0;
  }

  .socialLoginBtn.isLoading .socialButtonLoader{
    opacity:1;
    transform:scale(1);
    animation:formButtonSpinLoader .75s linear infinite;
  }

  .socialLoginIcon{
    width:20px;
    height:20px;
    flex:0 0 auto;
  }

  .socialLoginAppleIcon{
    fill:currentColor;
  }

  .socialSsoBtn{
    position:relative;
    width:100%;
    height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    margin-top:8px;
    padding:0 12px;
    border:1px solid rgba(0,0,0,.16);
    border-radius:8px;
    background:var(--topbarWhite);
    color:var(--topbarDark);
    font-size:12px;
    font-weight:900;
    cursor:pointer;
    overflow:visible;
  }

  .socialSsoBtn::after{
    content:"";
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.12);
    opacity:0;
    pointer-events:none;
    transition:opacity .16s ease;
  }

  .socialSsoBtn:hover::after{
    opacity:1;
  }

  .socialSsoIcon{
    width:20px;
    height:20px;
    flex:0 0 auto;
    fill:currentColor;
  }

  .loginDivider{
    display:flex;
    align-items:center;
    gap:14px;
    margin:18px 0 16px;
    color:rgba(255,255,255,.48);
  }

  .loginDivider span{
    height:1px;
    flex:1 1 auto;
    background:var(--line);
  }

  .loginDivider strong{
    color:inherit;
    font-size:10px;
    font-weight:900;
    letter-spacing:.1em;
    line-height:1;
  }

  body.googleSignupMode .authShell{
    max-width:420px;
  }

  body.googleSignupMode .authCard{
    width:100%;
    min-width:0;
    border-right:0;
  }

  body.googleSignupMode .qrPanel,
  body.googleSignupMode .registerRow,
  body.googleSignupMode .socialLoginRow,
  body.googleSignupMode .socialSsoBtn,
  body.googleSignupMode .loginDivider,
  body.googleSignupMode .btnGhost,
  body.googleSignupMode #passwordFormRow{
    display:none !important;
  }


  .formLabel{
    display:block;
    margin-bottom:5px;
    font-size:11px;
    font-weight:800;
  }

  input{
    width:100%;
    height:42px;
    padding:0 12px;
    border-radius:8px;
    border:1px solid var(--inputBorder);
    background:var(--inputBg);
    color:#fff;
    font-size:13px;
    font-weight:650;
    outline:none;
    transition:border-color .15s ease,background .15s ease;
  }

  input::placeholder{
    color:rgba(255,255,255,.35);
  }

  input:focus{
    border-color:rgba(255,255,255,.36);
    box-shadow:none;
  }

  .fieldErr{
    visibility:hidden;
    opacity:0;
    margin-top:6px;
    min-height:14px;
    font-size:11px;
    color:var(--danger);
    transition:opacity .15s ease;
  }

  .fieldErr.show{
    visibility:visible;
    opacity:1;
  }

  .buttonStack{
    margin-top:16px;
    display:flex;
    flex-direction:column;
    gap:11px;
  }

  .btn{
    position:relative;
    width:100%;
    height:44px;
    border-radius:8px;
    border:1px solid var(--topbarWhite);
    background:var(--topbarWhite);
    color:var(--topbarDark);
    font-weight:900;
    font-size:13px;
    letter-spacing:.005em;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    overflow:hidden;
    transition:transform .16s ease,filter .16s ease;
  }

  .btn.isLoading{
    pointer-events:none;
    background:#ffffff;
  }

  .formButtonLabel{
    display:flex;
    align-items:center;
    justify-content:center;
    opacity:1;
    transform:translateY(0);
    transition:opacity .22s ease,transform .22s ease;
  }

  .btn.isLoading .formButtonLabel{
    opacity:0;
    transform:translateY(-6px);
  }

  .formButtonLoader{
    position:absolute;
    width:24px;
    height:24px;
    border:3px solid rgba(0,0,0,0.16);
    border-top-color:#111;
    border-radius:999px;
    opacity:0;
    transform:scale(.8);
    transition:opacity .22s ease,transform .22s ease;
  }

  .btn.isLoading .formButtonLoader{
    opacity:1;
    transform:scale(1);
    animation:formButtonSpinLoader .75s linear infinite;
  }

  @keyframes formButtonSpinLoader{
    to{transform:scale(1) rotate(360deg);}
  }

  .btn:hover{
    transform:translateY(-1px);
    filter:brightness(.96);
  }

  .btn:active{
    transform:translateY(0);
  }

  .btnGhost{
    width:100%;
    height:40px;
    border-radius:8px;
    border:0;
    outline:0;
    background:transparent;
    color:rgba(255,255,255,.85);
    font-weight:850;
    font-size:13px;
    letter-spacing:.005em;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    transition:background .18s ease,color .18s ease,transform .12s ease;
  }

  .btnGhost:hover,
  .btnGhost:focus,
  .btnGhost:focus-visible{
    border:0;
    outline:0;
    box-shadow:none;
    background:var(--ghostHover);
    color:#fff;
  }

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

  .registerRow{
    margin-top:13px;
    text-align:center;
  }

  .createAccountLink{
    width:100%;
    min-height:38px;
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:rgba(255,255,255,.85);
    background:transparent;
    font-size:13px;
    font-weight:850;
    letter-spacing:.005em;
    transition:background .18s ease,color .18s ease,transform .12s ease;
  }

  .createAccountLink span{
    color:var(--muted);
    font-weight:650;
  }

  .createAccountLink strong{
    color:#fff;
    font-weight:900;
    margin-left:5px;
  }

  .createAccountLink:hover,
  .createAccountLink:focus,
  .createAccountLink:focus-visible{
    outline:0;
    box-shadow:none;
    background:var(--ghostHover);
    color:#fff;
    transform:translateY(-1px);
  }

  .qrTitle{
    font-size:18px;
    font-weight:900;
    line-height:1.2;
    margin:0 0 6px;
  }

  .qrSub{
    font-size:11px;
    color:var(--muted);
    line-height:1.45;
    font-weight:600;
    margin:0 0 12px;
    max-width:180px;
  }

  .qrBox{
    width:145px;
    height:145px;
    background:#fff;
    border-radius:14px;
    padding:6px;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 10px 30px rgba(0,0,0,.25);
    margin-bottom:10px;
  }

  #qr{
    width:100%;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
  }

  #qr canvas,
  #qr img,
  #qr svg{
    width:100% !important;
    height:100% !important;
    display:block;
    border-radius:8px;
  }

  .qrStatus{
    min-height:14px;
    font-size:10px;
    color:var(--muted);
    line-height:1.4;
    max-width:180px;
  }

  @media(max-width:900px){
    .loginWrap{
      min-height:calc(100svh - var(--h));
      align-items:center;
      padding:18px 14px 34px;
    }

    .authShell{
      max-width:450px;
      width:100%;
      display:block;
      border-radius:18px;
    }

    .authCard{
      width:100%;
      min-width:0;
      padding:24px 20px 22px;
      border-right:none;
      border-bottom:none;
    }

    .qrPanel{
      display:none;
    }

    .authTitle{
      font-size:20px;
    }

    .authSub{
      margin-bottom:17px;
    }

    input{
      height:44px;
      font-size:14px;
    }

    .btn{
      height:45px;
    }

    .btnGhost,
    .createAccountLink{
      min-height:41px;
    }
  }

  @media(max-width:480px){
    .loginWrap{
      align-items:flex-start;
      padding-top:18px;
      padding-left:12px;
      padding-right:12px;
    }

    .authShell{
      max-width:none;
      border-radius:16px;
    }

    .authCard{
      padding:22px 18px 20px;
    }

    .authTitle{
      font-size:20px;
    }

    .authSub{
      font-size:12px;
      line-height:1.45;
    }

    .formLabel{
      font-size:11px;
    }

    .buttonStack{
      gap:10px;
    }

    .createAccountLink{
      flex-wrap:wrap;
      gap:3px;
      padding:0 8px;
      line-height:1.35;
    }

    .createAccountLink strong{
      margin-left:0;
    }
  }

  @media(max-width:360px){
    .loginWrap{
      padding-left:10px;
      padding-right:10px;
    }

    .authCard{
      padding:20px 14px 18px;
    }

    .authTitle{
      font-size:19px;
    }

    input,
    .btn{
      height:43px;
    }

    .btnGhost,
    .createAccountLink{
      font-size:12px;
    }
  }
