/* TU TIEN LO - Modern Xianxia Login & Register Styles */
#ttl-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 8, 16, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
  font-family: "GameFont", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  box-sizing: border-box;
  padding: 16px;
  animation: ttlFadeIn 0.3s ease-out;
}

@keyframes ttlFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.ttl-modal {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(9, 14, 26, 0.98) 100%);
  border: 1.5px solid rgba(218, 165, 32, 0.55);
  border-radius: 20px;
  padding: 26px 22px 22px 22px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8),
              0 0 24px rgba(218, 165, 32, 0.25),
              inset 0 1px 0 rgba(255, 235, 150, 0.3);
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.ttl-modal::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(218, 165, 32, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* Header */
.ttl-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.ttl-badge {
  display: inline-block;
  font-size: 24px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.7));
}

.ttl-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0;
  background: linear-gradient(180deg, #fff4b8 0%, #f3c341 50%, #c48b0a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(196, 139, 10, 0.5));
  text-transform: uppercase;
}

.ttl-subtitle {
  font-size: 12px;
  color: #a0aec0;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* Tabs */
.ttl-tabs {
  display: flex;
  background: rgba(10, 15, 28, 0.7);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid rgba(218, 165, 32, 0.2);
}

.ttl-tab-btn {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #a0aec0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.ttl-tab-btn.active {
  background: linear-gradient(180deg, rgba(218, 165, 32, 0.3) 0%, rgba(218, 165, 32, 0.1) 100%);
  color: #ffd700;
  border: 1px solid rgba(218, 165, 32, 0.5);
  box-shadow: 0 2px 10px rgba(218, 165, 32, 0.2);
}

/* Form Fields */
.ttl-field {
  margin-bottom: 14px;
  position: relative;
}

.ttl-label {
  display: block;
  font-size: 12px;
  color: #cbd5e0;
  margin-bottom: 6px;
  font-weight: 500;
}

.ttl-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ttl-icon {
  position: absolute;
  left: 12px;
  font-size: 15px;
  color: #a0aec0;
  pointer-events: none;
}

.ttl-input {
  width: 100%;
  height: 44px;
  background: rgba(13, 19, 33, 0.85);
  border: 1px solid rgba(218, 165, 32, 0.3);
  border-radius: 10px;
  padding: 0 38px 0 36px;
  color: #ffffff;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.ttl-input:focus {
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
  background: rgba(18, 27, 48, 0.95);
}

.ttl-eye-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #a0aec0;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

/* Options */
.ttl-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 18px 0;
  font-size: 12px;
  color: #a0aec0;
}

.ttl-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.ttl-checkbox-label input {
  margin-right: 6px;
  accent-color: #d4af37;
}

/* Message Toast */
.ttl-msg {
  display: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: center;
  animation: ttlFadeIn 0.2s;
}

.ttl-msg.error {
  display: block;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.ttl-msg.success {
  display: block;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #86efac;
}

/* Submit Buttons */
.ttl-btn-primary {
  width: 100%;
  height: 46px;
  background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 60%, #b45309 100%);
  border: 1px solid #fef08a;
  border-radius: 12px;
  color: #1a0f02;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ttl-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.ttl-btn-primary:active {
  transform: translateY(1px);
}

.ttl-btn-guest {
  width: 100%;
  height: 38px;
  margin-top: 10px;
  background: transparent;
  border: 1px solid rgba(218, 165, 32, 0.35);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ttl-btn-guest:hover {
  background: rgba(218, 165, 32, 0.12);
  border-color: #ffd700;
  color: #ffd700;
}

/* Floating Switch Account Pill Button */
#ttl-switch-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99999;
  background: rgba(13, 19, 33, 0.85);
  border: 1px solid rgba(218, 165, 32, 0.6);
  border-radius: 20px;
  padding: 6px 12px;
  color: #fef08a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  user-select: none;
}

#ttl-switch-btn:hover {
  background: rgba(218, 165, 32, 0.3);
  border-color: #fef08a;
  transform: scale(1.05);
}

/* 2026-09-25 Login redesign */
#ttl-login-overlay {
  display: none;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 12%, rgba(102,72,170,.24), transparent 38%),
    rgba(3, 4, 12, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#ttl-login-overlay .ttl-modal {
  max-width: 430px;
  max-height: min(720px, calc(100vh - 32px));
  overflow-y: auto;
  padding: 28px 24px 24px;
  border: 1px solid rgba(252,224,127,.56);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(26,20,49,.98), rgba(10,9,22,.99));
  box-shadow: 0 24px 70px rgba(0,0,0,.72), 0 0 34px rgba(212,175,55,.16), inset 0 1px rgba(255,255,255,.12);
}
#ttl-login-overlay .ttl-header { margin-bottom: 18px; }
#ttl-login-overlay .ttl-header img {
  max-width: 190px;
  width: 64%;
  height: auto;
}
#ttl-login-overlay .ttl-title {
  font-size: 22px !important;
  letter-spacing: 1px;
}
#ttl-login-overlay .ttl-subtitle { color: rgba(241,235,255,.62); font-size: 11px; }
#ttl-login-overlay .ttl-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  margin-bottom: 20px;
  border-radius: 13px;
  background: rgba(5,5,16,.64);
}
#ttl-login-overlay .ttl-tab-btn {
  min-width: 0;
  min-height: 38px;
  padding: 8px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(226,232,240,.66);
  font-size: 12px;
  letter-spacing: 0;
}
#ttl-login-overlay .ttl-tab-btn.active {
  color: #1d1205;
  background: linear-gradient(180deg, #ffe99a, #d4af37);
  border-color: #fff4b8;
  box-shadow: 0 4px 16px rgba(212,175,55,.25);
}
#ttl-login-overlay .ttl-label {
  display: block;
  margin-bottom: 7px;
  text-align: left;
  color: #f3e7bd;
  font-size: 12px;
  letter-spacing: .02em;
}
#ttl-login-overlay .ttl-field { margin-bottom: 14px; }
#ttl-login-overlay .ttl-input {
  height: 46px;
  border-radius: 11px;
  border-color: rgba(212,175,55,.28);
  background: rgba(6,7,17,.84);
}
#ttl-login-overlay .ttl-input:focus {
  border-color: #fce07f;
  box-shadow: 0 0 0 3px rgba(212,175,55,.12), 0 0 18px rgba(212,175,55,.16);
}
#ttl-login-overlay .gold-bevel-btn {
  width: 100%;
  justify-content: center;
  min-height: 46px;
}
#ttl-login-overlay .ttl-btn-guest {
  width: 100%;
  margin-top: 10px;
  min-height: 40px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 10px;
  color: rgba(226,232,240,.76);
  background: rgba(30,27,55,.72);
  cursor: pointer;
}
#ttl-login-overlay .ttl-btn-guest:hover { background: rgba(52,45,87,.88); color: #fff; }
#ttl-login-overlay .ttl-options { margin: 10px 0 18px; color: rgba(226,232,240,.65); }
#ttl-login-overlay .ttl-msg { border-radius: 10px; line-height: 1.45; }
@media (max-width: 480px) {
  #ttl-login-overlay { padding: 10px; }
  #ttl-login-overlay .ttl-modal { padding: 22px 16px 18px; border-radius: 18px; }
  #ttl-login-overlay .ttl-title { font-size: 19px !important; }
  #ttl-login-overlay .ttl-tab-btn { font-size: 10px; min-height: 36px; }
}
#ttl-login-overlay .ttl-modal { scrollbar-width: none; -ms-overflow-style: none; }
#ttl-login-overlay .ttl-modal::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* Keep login logo at its native aspect ratio */
#ttl-login-overlay .ttl-header img {
  display: block;
  width: min(250px, 72vw) !important;
  max-width: 250px !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain;
  aspect-ratio: auto;
  margin-left: auto;
  margin-right: auto;
}


/* Xianxia login backdrop + spiritual-qi atmosphere v20260925242 */
#ttl-login-overlay {
  background:
    linear-gradient(180deg, rgba(4,7,18,.58), rgba(4,6,16,.86)),
    url('xianxia-bg.png') center / cover no-repeat fixed !important;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  overflow: hidden;
}
#ttl-login-overlay::before {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  opacity: .34;
  background:
    radial-gradient(ellipse at 16% 42%, rgba(91,214,255,.18), transparent 28%),
    radial-gradient(ellipse at 84% 30%, rgba(173,120,255,.18), transparent 26%),
    radial-gradient(ellipse at 52% 88%, rgba(255,210,116,.10), transparent 22%);
  mix-blend-mode: screen;
  animation: ttlLoginQiDrift 16s ease-in-out infinite alternate;
}
#ttl-login-overlay > * {
  position: relative;
  z-index: 1;
}
@keyframes ttlLoginQiDrift {
  from { transform: translate3d(-1.2%, .5%, 0) scale(1); opacity: .24; }
  to { transform: translate3d(1.2%, -.8%, 0) scale(1.04); opacity: .38; }
}
@media (max-width: 680px) {
  #ttl-login-overlay {
    background-attachment: scroll !important;
    background-position: 54% center !important;
  }
}


/* Keep login modal above the generated backdrop */
#ttl-login-overlay::before { display: none !important; }


/* Drifting spiritual-qi animation for login v20260925252 */
#ttl-login-overlay::before {
  content: "";
  display: block !important;
  position: absolute;
  inset: -16%;
  z-index: 0;
  pointer-events: none;
  opacity: .27;
  filter: blur(8px);
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse 38% 8% at 16% 48%, rgba(92,224,255,.38), transparent 72%),
    radial-gradient(ellipse 30% 7% at 84% 34%, rgba(190,148,255,.36), transparent 72%),
    radial-gradient(ellipse 26% 6% at 54% 82%, rgba(255,213,133,.24), transparent 74%);
  animation: ttlLoginQiWisp 17s ease-in-out infinite alternate;
}
#ttl-login-overlay > * { position: relative; z-index: 1; }
@keyframes ttlLoginQiWisp {
  from { transform: translate3d(-2%, .8%, 0) rotate(-1deg) scale(1); }
  to { transform: translate3d(2%, -.8%, 0) rotate(1.2deg) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  #ttl-login-overlay::before { animation: none !important; }
}


/* Visible spiritual-qi pass for login v20260925258 */
#ttl-login-overlay::before {
  opacity: .48 !important;
  filter: blur(6px) saturate(1.35) !important;
  background:
    radial-gradient(ellipse 44% 9% at 13% 49%, rgba(92,224,255,.68), transparent 70%),
    radial-gradient(ellipse 38% 8% at 86% 34%, rgba(190,148,255,.62), transparent 70%),
    radial-gradient(ellipse 32% 7% at 61% 78%, rgba(255,213,133,.44), transparent 72%),
    conic-gradient(from 225deg at 17% 51%, transparent 0 20%, rgba(92,224,255,.16) 24%, transparent 38% 100%),
    conic-gradient(from 45deg at 84% 35%, transparent 0 26%, rgba(190,148,255,.14) 31%, transparent 46% 100%) !important;
  animation-duration: 11s !important;
}

.ttl-input { pointer-events: auto !important; user-select: text !important; -webkit-user-select: text !important; cursor: text !important; }
#ttl-login-overlay { pointer-events: auto !important; }
.ttl-modal { pointer-events: auto !important; }
