/* TGM Auth UI */
.auth-user-btn{
  display:flex;align-items:center;gap:10px;padding:6px 14px 6px 6px;
  border-radius:30px;background:var(--surface-2);border:1px solid var(--border-strong);
  transition:border-color .3s,box-shadow .3s;cursor:pointer;
}
.auth-user-btn:hover{border-color:var(--violet);box-shadow:0 0 20px var(--glow-v);}
.auth-avatar{
  width:32px;height:32px;border-radius:50%;object-fit:cover;
  background:linear-gradient(135deg,var(--violet),var(--cyan));
  display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:700;color:#fff;overflow:hidden;flex-shrink:0;
}
.auth-avatar img{width:100%;height:100%;object-fit:cover;}
.auth-user-name{font-size:13px;font-weight:600;max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.auth-nav-btns{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}

.auth-overlay{
  position:fixed;inset:0;z-index:8000;background:rgba(0,0,0,.72);
  backdrop-filter:blur(10px);
  display:flex;align-items:flex-start;justify-content:center;
  padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom));
  overflow-y:auto;-webkit-overflow-scrolling:touch;
  opacity:0;visibility:hidden;transition:opacity .35s,visibility .35s;
}
.auth-overlay.open{opacity:1;visibility:visible;}

.auth-panel{
  width:100%;
  max-width:min(520px,calc(100vw - 32px));
  margin:auto 0;
  flex-shrink:0;
}
.auth-panel.auth-panel-profile{max-width:min(760px,calc(100vw - 24px));}

.auth-modal{
  width:100%;
  background:var(--surface);
  border:1px solid var(--border-strong);
  border-radius:24px;
  padding:clamp(20px,4vw,36px);
  box-shadow:var(--shadow);
  transform:translateY(20px) scale(.98);
  transition:transform .4s cubic-bezier(.65,0,.35,1);
  max-height:none;
}
.auth-overlay.open .auth-modal{transform:translateY(0) scale(1);}

.auth-modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:clamp(18px,3vw,28px);}
.auth-modal-head h2{font-size:clamp(20px,4vw,24px);font-weight:800;}
.auth-close{
  width:40px;height:40px;border-radius:50%;background:var(--surface-2);
  border:1px solid var(--border);font-size:20px;display:flex;align-items:center;justify-content:center;
  transition:background .3s;flex-shrink:0;
}
.auth-close:hover{background:var(--border-strong);}

.auth-tabs{display:flex;gap:8px;margin-bottom:24px;background:var(--surface-2);padding:4px;border-radius:14px;}
.auth-tab{
  flex:1;padding:11px 8px;border-radius:10px;font-size:14px;font-weight:600;
  color:var(--text-dim);transition:all .3s;min-width:0;
}
.auth-tab.active{background:linear-gradient(135deg,var(--violet),var(--cyan));color:#fff;box-shadow:0 4px 16px var(--glow-v);}

.auth-field{margin-bottom:16px;}
.auth-field label{display:block;font-size:13px;color:var(--text-dim);margin-bottom:6px;}
.auth-field input,.auth-field textarea{
  width:100%;padding:13px 16px;border-radius:12px;
  background:var(--bg-soft);border:1px solid var(--border-strong);
  color:var(--text);font-family:inherit;font-size:16px;
  transition:border-color .3s,box-shadow .3s;
}
.auth-field input:focus,.auth-field textarea:focus{
  outline:none;border-color:var(--violet);box-shadow:0 0 0 3px var(--glow-v);
}
.auth-field textarea{resize:vertical;min-height:88px;}
.auth-hint{font-size:12px;color:var(--text-faint);margin-top:4px;line-height:1.5;}

.auth-submit{
  width:100%;padding:14px 18px;border-radius:14px;font-size:15px;font-weight:700;
  background:linear-gradient(135deg,var(--violet),var(--cyan));color:#fff;
  box-shadow:0 6px 24px var(--glow-v);margin-top:8px;
  transition:transform .3s,box-shadow .3s;
}
.auth-submit:hover{transform:translateY(-2px);box-shadow:0 10px 30px var(--glow-c);}
.auth-submit:disabled{opacity:.6;cursor:not-allowed;transform:none;}

.auth-error,.auth-success{margin-bottom:16px;}
.auth-error{
  padding:12px 14px;border-radius:10px;background:rgba(244,63,94,.12);
  border:1px solid rgba(244,63,94,.3);color:#fb7185;font-size:13px;display:none;
}
.auth-error.show{display:block;}
.auth-success{
  padding:12px 14px;border-radius:10px;background:rgba(34,211,238,.1);
  border:1px solid rgba(34,211,238,.25);color:var(--cyan);font-size:13px;display:none;
}
.auth-success.show{display:block;}

.auth-profile-layout{
  display:grid;gap:clamp(20px,4vw,28px);
}
@media(min-width:640px){
  .auth-profile-layout{
    grid-template-columns:minmax(200px,240px) minmax(0,1fr);
    align-items:start;
  }
}

.auth-profile-side{
  display:flex;flex-direction:column;align-items:center;gap:14px;
  padding:20px;border-radius:18px;background:var(--surface-2);border:1px solid var(--border);
  text-align:center;
}
.auth-profile-main{min-width:0;}

.auth-profile-avatar{
  width:clamp(88px,20vw,112px);height:clamp(88px,20vw,112px);border-radius:50%;position:relative;
  background:linear-gradient(135deg,var(--violet),var(--cyan));
  display:flex;align-items:center;justify-content:center;
  font-size:clamp(28px,6vw,40px);font-weight:800;color:#fff;overflow:hidden;
  box-shadow:0 0 40px var(--glow-v);
}
.auth-profile-avatar img{width:100%;height:100%;object-fit:cover;}
.auth-avatar-edit{
  position:absolute;bottom:0;left:0;right:0;padding:8px;
  background:rgba(0,0,0,.65);font-size:11px;text-align:center;cursor:pointer;
  opacity:0;transition:opacity .3s;
}
.auth-profile-avatar:hover .auth-avatar-edit,.auth-profile-avatar:focus-within .auth-avatar-edit{opacity:1;}
.auth-profile-name{font-size:clamp(18px,4vw,22px);font-weight:800;word-break:break-word;}
.auth-profile-meta{font-size:12.5px;color:var(--text-dim);direction:ltr;word-break:break-all;line-height:1.5;}

.auth-info-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin-bottom:20px;}
.auth-info-item{
  padding:14px 16px;border-radius:12px;background:var(--surface-2);border:1px solid var(--border);
}
.auth-info-item span{display:block;font-size:12px;color:var(--text-faint);margin-bottom:4px;}
.auth-info-item strong{font-size:14px;font-weight:600;}

.auth-section-title{font-size:14px;font-weight:700;color:var(--text-dim);margin:20px 0 12px;padding-bottom:8px;border-bottom:1px solid var(--border);}
.auth-section-title:first-child{margin-top:0;}

.auth-logout{
  width:100%;padding:13px;border-radius:12px;font-size:14px;font-weight:600;
  background:transparent;border:1px solid rgba(244,63,94,.4);color:#fb7185;
  margin-top:20px;transition:background .3s;
}
.auth-logout:hover{background:rgba(244,63,94,.1);}

.auth-toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;}
.auth-toggle-row span{font-size:14px;}
.auth-switch{
  width:48px;height:26px;border-radius:20px;background:var(--surface-2);
  border:1px solid var(--border-strong);position:relative;cursor:pointer;flex-shrink:0;
}
.auth-switch.on{background:linear-gradient(135deg,var(--violet),var(--cyan));}
.auth-switch::after{
  content:'';position:absolute;top:3px;right:3px;width:18px;height:18px;
  border-radius:50%;background:#fff;transition:transform .3s;
}
.auth-switch.on::after{transform:translateX(-22px);}

.auth-divider{display:flex;align-items:center;gap:14px;margin:20px 0;color:var(--text-faint);font-size:12px;}
.auth-divider::before,.auth-divider::after{content:'';flex:1;height:1px;background:var(--border-strong);}

.auth-oauth-stack{display:flex;flex-direction:column;gap:10px;margin-bottom:4px;}
.auth-oauth-btn{
  width:100%;display:flex;align-items:center;justify-content:center;gap:12px;
  padding:13px 16px;border-radius:12px;font-size:14px;font-weight:600;
  border:1px solid var(--border-strong);background:var(--surface-2);
  transition:transform .25s,box-shadow .25s,border-color .25s,background .25s;
}
.auth-oauth-btn:hover{transform:translateY(-1px);box-shadow:0 8px 24px rgba(0,0,0,.15);}
.auth-oauth-btn svg{width:20px;height:20px;flex-shrink:0;}
.auth-oauth-google:hover{border-color:rgba(66,133,244,.5);background:rgba(66,133,244,.08);}
.auth-oauth-discord:hover{border-color:rgba(88,101,242,.55);background:rgba(88,101,242,.1);}
.auth-oauth-note{font-size:11.5px;color:var(--text-faint);text-align:center;margin-top:12px;line-height:1.6;}

.auth-linked-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px;}
.auth-linked-item{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 14px;border-radius:12px;background:var(--surface-2);border:1px solid var(--border);
}
.auth-linked-item .provider-name{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:600;}
.auth-linked-item .badge{
  font-size:11px;padding:4px 10px;border-radius:20px;
  background:rgba(34,211,238,.12);color:var(--cyan);border:1px solid rgba(34,211,238,.25);
}
.auth-link-btns{display:flex;flex-direction:column;gap:8px;margin-top:8px;}

@media(max-width:768px){
  .auth-user-name{display:none;}
  .auth-nav-btns .nav-cta{padding:9px 16px;font-size:13px;}
  .auth-overlay{align-items:flex-end;padding:0;}
  .auth-panel{max-width:100%;margin:0;}
  .auth-panel.auth-panel-profile{max-width:100%;}
  .auth-modal{
    border-radius:24px 24px 0 0;
    max-height:92vh;
    overflow-y:auto;
    padding-bottom:max(24px,env(safe-area-inset-bottom));
  }
  .auth-profile-side{padding:16px;}
}

@media(min-width:769px){
  .auth-overlay{align-items:center;}
}

@media(min-width:900px){
  .auth-panel{max-width:540px;}
  .auth-panel.auth-panel-profile{max-width:820px;}
}
