:root {
  color-scheme: dark;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  color: #edf2f7;
  background: #000000;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #08090c url('login_bg.jpg') no-repeat center center / 100% 100%;
  overflow: hidden;
  height: 100vh;
}

[hidden] {
  display: none !important;
}

#elysian-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: none;
}

.shell {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  overflow: hidden;
  background: #08090c url('login_bg.jpg') no-repeat center center / 100% 100%;
}

.shell[data-phase="world"],
.shell[data-phase="character"] {
  display: none;
}

/* In loading phase: full loading presentation */
.shell[data-phase="loading"] footer,
.shell[data-phase="loading"] .client-card {
  display: none !important;
}

/* Masthead header is completely removed on login for full-screen immersive identity */
.masthead {
  display: none !important;
}

.shell-content {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0;
  position: relative;
}

/* Login card - Exact JZserver authentic ornate login dialog using login_card_bg.png */
.client-card {
  width: 390px;
  height: 310px;
  min-width: 390px;
  min-height: 310px;
  box-sizing: border-box;
  padding: 0 20px 14px;
  background: url('login_box_bg.png') no-repeat center center / 100% 100%;
  border: none;
  border-radius: 6px;
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.92), 0 0 25px rgba(198, 162, 86, 0.28);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.client-card::before {
  display: none;
}

#login-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-header {
  position: absolute;
  top: 1px;
  left: 0;
  right: 0;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#login-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: #ffd764;
  margin: 0;
  letter-spacing: 0.8px;
  text-shadow: 0 0 10px rgba(255, 215, 100, 0.4), 0 2px 4px #000;
  line-height: 1;
}

.server-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 20px;
  margin-top: 48px;
  margin-bottom: 8px;
  background: transparent;
  border: none;
}

.status-label {
  font-size: 12.5px;
  color: #dac391;
}

.server-status strong {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  color: #87eba5;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #555;
  transition: all 0.2s ease;
}

.server-status[data-state="online"] .status-dot {
  background: #87eba5;
  box-shadow: 0 0 8px #87eba5;
}

#login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 8px;
  gap: 10px;
}

.form-row label {
  width: 76px;
  text-align: right;
  font-size: 13.5px;
  font-weight: 700;
  color: #ffda80;
  letter-spacing: 0.5px;
  margin: 0;
}

.form-row input {
  width: 216px;
  height: 32px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #4a3c24;
  border-radius: 3px;
  background: #111110;
  color: #c1c0c0;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row input::placeholder {
  color: rgba(180, 160, 120, 0.4);
}

.form-row input:focus {
  border-color: #ffd764;
  box-shadow: 0 0 8px rgba(255, 215, 100, 0.35);
  outline: none;
}

.password-field {
  position: relative;
  width: 216px;
  display: flex;
}

.password-field input {
  width: 100%;
  padding-right: 48px;
}

.reveal {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  width: 40px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #caa867;
  font-size: 11px;
  cursor: pointer;
}

.reveal:hover {
  background: #261c0d;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 2px;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  color: #dac391;
  letter-spacing: 0.3px;
  transition: color 0.15s ease;
}

.checkbox-option:hover {
  color: #ffd764;
}

.checkbox-option input[type="checkbox"] {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
}

.checkbox-option .custom-checkbox {
  display: inline-block;
  width: 20px;
  height: 18px;
  min-width: 20px;
  min-height: 18px;
  background: url('chk_n.png') no-repeat center center / 100% 100%;
  image-rendering: pixelated;
  transition: transform 0.1s ease;
}

.checkbox-option input[type="checkbox"]:checked+.custom-checkbox {
  background-image: url('chk_p.png');
}

.checkbox-option input[type="checkbox"]:focus-visible+.custom-checkbox {
  outline: 1px solid #ffd764;
  outline-offset: 1px;
}

.login-status-msg {
  min-height: 18px;
  font-size: 11.5px;
  text-align: center;
  margin: 2px 0 2px;
  padding: 0 6px;
  line-height: 1.3;
  transition: all 0.2s ease;
  word-break: break-word;
}

.login-status-msg.error {
  color: #ff7d6e;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.login-status-msg.connecting {
  color: #ffd764;
  font-weight: 500;
}

.button-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}

#enter-button {
  width: 134px;
  height: 42px;
  min-width: 134px;
  min-height: 42px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: url('btn_signin_n.png') no-repeat center center / 100% 100%;
  color: #ffe896;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  transition: filter 0.15s ease;
}

#enter-button:hover:not(:disabled) {
  background-image: url('btn_signin_h.png');
  border: none;
  color: #ffffff;
  box-shadow: none;
  filter: brightness(1.15);
}

#enter-button:active:not(:disabled) {
  background-image: url('btn_signin_p.png');
  transform: translateY(1px);
}

#enter-button:disabled {
  background-image: url('btn_signin_d.png');
  opacity: 0.65;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

footer {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  padding: 0 24px;
  text-align: center;
  color: #877450;
  font-size: 11.5px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto;
  z-index: 5;
}

.footer-links {
  color: #ebd49a;
}

.footer-sub {
  font-size: 11px;
  opacity: 0.75;
}

footer span {
  margin: 0 5px;
}

a {
  color: #cca65e;
  text-underline-offset: 3px;
}

/* ====================================================================
   AUTHENTIC FULL-SCREEN LOADING SCREEN (Identical to JZserver ChangeMapWnd)
   ==================================================================== */
#loading-card {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #08090c url('loading_screen_bg.jpg') no-repeat center center / 100% 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  z-index: 20;
  overflow: hidden;
}

.loading-overlay-dock {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: clamp(14px, 2.8vh, 24px);
  z-index: 10;
}



.loading-tip-container {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 557px;
  max-width: 92vw;
  padding: 0 4px;
  box-sizing: border-box;
}

.loading-tip-text {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffd764;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.loading-progress-info {
  font-size: 11px;
  color: #dac391;
  font-family: system-ui, -apple-system, sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.loading-progress-info .percentage {
  color: #00e5ff;
  font-weight: 700;
  font-size: 12px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.loading-bar-container {
  width: 557px;
  height: 22px;
  background: url('loading_bar_bg.png') no-repeat center center;
  background-size: 557px 22px;
  position: relative;
  display: flex;
  align-items: center;
}

@media (max-width: 580px) {
  .loading-bar-container {
    transform: scale(calc(92vw / 557));
    transform-origin: center bottom;
  }

  .loading-tip-container {
    width: 92vw;
  }
}

.loading-bar-track-wrap {
  position: absolute;
  left: 41px;
  width: 472px;
  height: 4px;
  top: 10px;
  overflow: hidden;
}

.loading-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(to bottom, #136e8c 0%, #58d7f7 33%, #73d1e7 66%, #347b8b 100%);
  box-shadow: 0 0 4px #00e5ff, 0 0 8px rgba(0, 229, 255, 0.7);
  transition: width 0.15s ease-out;
}

.loading-bar-container[data-mode="waiting"] .loading-bar-fill {
  width: 4%;
  opacity: 0.5;
}

.loading-error {
  padding: 8px 12px;
  margin: 6px 0 0;
  border: 1px solid #ff7d6e;
  border-radius: 4px;
  color: #ffc2c2;
  background: rgba(50, 15, 15, 0.88);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  pointer-events: auto;
}

.loading-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
  pointer-events: auto;
}

.loading-actions .primary-button {
  width: 134px;
  height: 42px;
  min-width: 134px;
  min-height: 42px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: url('btn_signin_n.png') no-repeat center center / 100% 100%;
  color: #ffe896;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  transition: filter 0.15s ease;
}

.loading-actions .primary-button:hover {
  background-image: url('btn_signin_h.png');
  filter: brightness(1.15);
}

.loading-actions .primary-button:active {
  background-image: url('btn_signin_p.png');
  transform: translateY(1px);
}

.no-script {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000;
  color: #f5d898;
  font-family: 'Cinzel', serif;
}

@media(max-width: 480px) {
  .masthead {
    padding: 16px 20px;
  }

  .version {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .client-card {
    padding: 22px;
  }

  .loading-dock {
    width: 95vw;
    margin-bottom: 20px;
  }
}