:root {
  --login-bg: #F8ECDC;
  --login-window: #E7E8EB;
  --login-text: #152E3F;
  --login-muted: #5a777c;
  --login-border: #cfd6da;
}

html, body {
  height: 100%;
  margin: 0;
}

body.login-page {
  font-family: var(--sp-font-ui);
  background: radial-gradient(90vw 90vw at -10% -20%, rgba(20,144,138,.25) 0%, rgba(20,144,138,0) 60%),
              linear-gradient(135deg, var(--sp-primary) 0%, #0e5b66 52%, #0b4b56 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  color: var(--login-text);
}

.login-bg-animation {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.6;
  mix-blend-mode: screen;
  z-index: 1;
}

.login-logo {
  position: fixed;
  top: 12px;
  left: 32px;
  width: 300px;
  z-index: 50;
  user-select: none;
  pointer-events: none;
  transition: opacity 0.5s, transform 0.5s;
  opacity: 0.95;
}

.login-logo.fadeout {
  opacity: 0;
  transform: scale(0.96) translateY(30px);
}

.login-center-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.login-card {
  background: #152E3F;
  border-radius: 16px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3);
  padding: 40px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 320px;
  max-width: 380px;
  transition: opacity 0.5s, transform 0.5s;
}

.login-card.fadeout {
  opacity: 0;
  transform: scale(0.96) translateY(30px);
  pointer-events: none;
}

.login-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.login-home-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.login-title {
  font-family: var(--sp-font-brand);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 18px 4px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.login-title .sp {
  color: var(--sp-primary);
}

.login-title .account {
  color: #e5e7eb;
}

.login-form label {
  display: block;
  color: #e5e7eb;
  font-weight: 700;
  margin-bottom: 7px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 1.06rem;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.login-form input:focus {
  border-color: var(--sp-primary);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 0.15rem rgba(20, 144, 138, 0.18);
}

.login-checkbox-row {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  font-size: 0.97rem;
  color: #e5e7eb;
}

.login-checkbox-row input[type="checkbox"] {
  accent-color: var(--sp-primary);
  margin-right: 8px;
  width: 1.1em;
  height: 1.1em;
  cursor: pointer;
}

.login-checkbox-row label {
  margin: 0;
  font-weight: 400;
  cursor: pointer;
  color: #e5e7eb;
}

.login-checkbox-row a {
  color: var(--sp-orange);
  text-decoration: underline dotted;
}

.login-checkbox-row a:hover {
  color: #ffa850;
}

.login-btn,
.login-code-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px 0 12px;
  font-size: 1.08rem;
  font-weight: 800;
  color: #fff;
  position: relative;
  background: linear-gradient(135deg, #F07F03 0%, #d66f03 100%) !important;
  box-shadow: 0 4px 15px rgba(240, 127, 3, 0.2);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-btn::before,
.login-code-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.login-btn:hover:not(:disabled)::before,
.login-code-btn:hover:not(:disabled)::before {
  left: 100%;
}

.login-btn:hover:not(:disabled),
.login-code-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(240, 127, 3, 0.3);
}

.login-btn:active:not(:disabled),
.login-code-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.997);
}

.login-btn:disabled,
.login-code-btn:disabled {
  background: #b7b9bd !important;
  color: #eef1f3;
  cursor: not-allowed;
  opacity: 0.85;
}

.login-error,
.login-success {
  border-radius: 6px;
  padding: 9px 10px 7px;
  text-align: center;
  font-size: 1rem;
  margin-bottom: 4px;
}

.login-error {
  color: #d64545;
  background: #fff7f7;
}

.login-success {
  color: #1c8a52;
  background: #f5fff4;
}

.login-timer {
  font-size: 0.97rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
  text-align: center;
  min-height: 18px;
}

.login-welcome {
  margin-bottom: 16px;
  color: #e5e7eb;
}

.login-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.login-modal-backdrop.show {
  display: flex;
}

.login-modal {
  background: #fff;
  width: min(920px, 96vw);
  height: min(85vh, 92vh);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.login-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.login-modal-title {
  font-weight: 800;
  color: var(--login-text);
}

.login-modal-close {
  border: none;
  background: linear-gradient(135deg, #F07F03 0%, #d66f03 100%) !important;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(240, 127, 3, 0.2);
}

.login-modal-close::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.login-modal-close:hover::before {
  left: 100%;
}

.login-modal-close:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(240, 127, 3, 0.3);
}

.login-modal-body {
  flex: 1;
  display: flex;
  overflow: auto;
}

.login-terms-box {
  flex: 1;
  padding: 16px 18px 22px;
  overflow: auto;
}

.login-terms-box h1,
.login-terms-box h2 {
  margin: 0 0 10px;
}

.login-terms-box h3 {
  margin: 14px 0 8px;
}

.login-terms-box p,
.login-terms-box li {
  line-height: 1.58;
}

.login-terms-box ol,
.login-terms-box ul {
  padding-left: 20px;
}

.login-terms-box ul {
  margin: 8px 0;
}

.login-terms-box code {
  background: rgba(240, 127, 3, 0.1);
  color: #F07F03;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.92em;
}

.login-small-muted {
  color: #6b7280;
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .login-logo {
    width: 180px;
    top: 12px;
    left: 16px;
  }
}

@media (max-width: 600px) {
  .login-card {
    margin: 7vh 7vw;
    padding: 27px 6vw 23px;
    max-width: 98vw;
  }

  .login-title {
    font-size: 1.38rem;
  }

  .login-logo {
    width: 120px;
    top: 10px;
    left: 10px;
  }
}