* {
  box-sizing: border-box;
}

html.auth-shell-active,
body.auth-shell-active {
  min-height: 100%;
  overflow-x: hidden;
  background: #cfe7d1;
}

body.auth-shell-active {
  margin: 0;
  color: #2d392c;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body.auth-shell-active #GameCanvas,
body.auth-shell-active #splash {
  display: none !important;
}

.auth-shell {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .06) 42%, rgba(100, 158, 109, .18)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .18) 0 1px, transparent 1px 15px),
    #cfe7d1;
}

.auth-shell::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 12%, rgba(255, 255, 255, .34), transparent 22%),
    radial-gradient(circle at 74% 18%, rgba(234, 117, 42, .14), transparent 20%),
    radial-gradient(circle at 50% 92%, rgba(68, 144, 77, .22), transparent 30%);
  content: "";
}

.auth-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 420px);
  min-height: calc(100dvh - 38px);
}

.auth-top {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  min-height: 18px;
  padding: 2px 0 10px;
}

.auth-mark {
  color: rgba(36, 111, 57, .54);
  font-size: 12px;
  line-height: 1;
}

.auth-panel {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 24px;
  padding: 30px 22px 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow:
    0 20px 50px rgba(69, 120, 75, .22),
    0 2px 0 rgba(255, 255, 255, .8) inset;
  overflow: visible;
}

.auth-view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
}

.auth-view.is-active {
  display: flex;
  flex-direction: column;
}

.auth-title {
  margin: 0;
  color: #24803c;
  font-size: 36px;
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
}

.auth-subtitle {
  margin: 7px 0 24px;
  color: #e86d1d;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-field {
  position: relative;
  display: block;
}

.auth-field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
}

.auth-control {
  display: flex;
  align-items: center;
  width: 100%;
  height: 54px;
  border: 1px solid #d9e2d6;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(64, 116, 67, .08);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.auth-control:focus-within {
  border-color: #68b874;
  box-shadow: 0 0 0 3px rgba(104, 184, 116, .17);
}

.auth-field-icon {
  position: relative;
  flex: 0 0 47px;
  width: 47px;
  height: 100%;
  color: #7d8b79;
}

.auth-field-icon::before,
.auth-field-icon::after {
  position: absolute;
  display: block;
  content: "";
}

.auth-field-icon.is-account::before {
  left: 18px;
  top: 14px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.auth-field-icon.is-account::after {
  left: 14px;
  top: 29px;
  width: 18px;
  height: 10px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.auth-field-icon.is-password::before,
.auth-field-icon.is-confirm::before {
  left: 14px;
  top: 24px;
  width: 20px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.auth-field-icon.is-password::after,
.auth-field-icon.is-confirm::after {
  left: 18px;
  top: 12px;
  width: 12px;
  height: 16px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.auth-field-icon.is-confirm {
  color: #6b9b64;
}

.auth-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  padding: 0 12px 0 0;
  background: transparent;
  color: #263126;
  font-size: 15px;
  line-height: 54px;
}

.auth-input::placeholder {
  color: #9ca59a;
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 1px;
  color: #63705f;
  font-size: 12px;
  line-height: 1.55;
}

.auth-check-box {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 20px;
}

.auth-check input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: #f27a22;
}

.auth-check-text {
  white-space: nowrap;
}

.auth-check-copy {
  min-width: 0;
}

.auth-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: #f06f1d;
  font: inherit;
  text-decoration: none;
}

.auth-link:active {
  color: #cf4b12;
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 17px;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: linear-gradient(180deg, #ffa72f, #ff7420);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(226, 98, 23, .24), inset 0 1px 0 rgba(255, 255, 255, .32);
}

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

.auth-btn[disabled] {
  cursor: default;
  opacity: .62;
  transform: none;
}

.auth-btn.is-ghost {
  min-height: 44px;
  border: 1px solid #d7e1d6;
  background: #f7fbf5;
  color: #2b823f;
  box-shadow: none;
  font-size: 15px;
}

.auth-switch {
  margin: 15px 0 0;
  color: #6b7568;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.auth-switch .auth-link {
  color: #df3e28;
  font-weight: 700;
}

.auth-copyright {
  margin-top: auto;
  padding-top: 19px;
  color: #7d897a;
  font-size: 11px;
  line-height: 1.65;
  text-align: center;
  overflow-wrap: anywhere;
}

.auth-copyright::before {
  display: block;
  width: 78%;
  height: 1px;
  margin: 0 auto 10px;
  background: linear-gradient(90deg, transparent, rgba(124, 148, 119, .46), transparent);
  content: "";
}

.auth-copyright p {
  margin: 0;
}

.server-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: #657260;
  font-size: 13px;
}

.server-list {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.server-card {
  width: 100%;
  min-height: 66px;
  margin-bottom: 10px;
  border: 1px solid #dce5d9;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  color: #273226;
  text-align: left;
  box-shadow: 0 5px 14px rgba(70, 116, 75, .09);
}

.server-card:active {
  border-color: #72bd77;
  background: #f4fbf1;
}

.server-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
}

.server-name > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.server-meta {
  margin-top: 6px;
  color: #7a8676;
  font-size: 12px;
}

.server-tag {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e7f7e5;
  color: #2b9440;
  font-size: 11px;
  font-weight: 700;
}

.auth-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border: 1px dashed #cbdac8;
  border-radius: 10px;
  color: #6d7969;
  font-size: 13px;
  text-align: center;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 2px solid rgba(242, 122, 34, .22);
  border-top-color: #f27a22;
  border-radius: 50%;
  animation: auth-spin .8s linear infinite;
}

.auth-toast {
  position: fixed;
  z-index: 100001;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(86vw, 360px);
  border: 1px solid rgba(244, 132, 39, .25);
  border-radius: 10px;
  padding: 10px 14px;
  background: rgba(39, 49, 38, .94);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 16px 34px rgba(44, 73, 48, .28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .18s ease, transform .18s ease;
}

.auth-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.auth-modal-mask {
  position: fixed;
  z-index: 100000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 39, 25, .55);
  backdrop-filter: blur(6px);
}

.auth-modal-mask.is-visible {
  display: flex;
}

.auth-modal {
  width: min(100%, 390px);
  max-height: min(76vh, 560px);
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 18px;
  padding: 20px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(41, 76, 46, .32);
}

.auth-modal-title {
  margin: 0 0 10px;
  color: #25813c;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.auth-modal-body {
  max-height: 46vh;
  overflow: auto;
  color: #5b6758;
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.auth-modal-body p {
  margin: 0 0 10px;
}

.auth-modal-actions {
  margin-top: 16px;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 380px) {
  .auth-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .auth-panel {
    border-radius: 20px;
    padding: 25px 16px 17px;
  }

  .auth-title {
    font-size: 32px;
  }

  .auth-subtitle {
    margin-bottom: 20px;
    font-size: 18px;
  }

  .auth-control {
    height: 50px;
  }

  .auth-field-icon {
    flex-basis: 43px;
    width: 43px;
  }

  .auth-input {
    font-size: 14px;
    line-height: 50px;
  }

  .auth-check {
    font-size: 11px;
  }
}

@media (min-width: 700px) {
  .auth-shell {
    align-items: center;
    padding: 32px;
  }

  .auth-stage {
    min-height: min(720px, calc(100dvh - 64px));
  }
}
