/* 入口校验层：验证完成前隐藏测试正文，避免未授权用户直接看到题目。 */
html.entry-locked {
  overflow: hidden;
}

html.entry-locked:not(.entry-gate-deferred) body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background:
    radial-gradient(120% 90% at 50% 0%, #eef3ff 0%, #f6f7fb 55%, #eef1f8 100%);
}

html.entry-locked:not(.entry-gate-deferred) body > *:not(.entry-gate-layer) {
  display: none !important;
}

.entry-gate-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, #eef3ff 0%, #f6f7fb 55%, #eef1f8 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1d2638;
  -webkit-font-smoothing: antialiased;
}

/* 延迟校验的授权码以弹窗形式覆盖在欢迎页上。 */
.entry-gate-layer.entry-gate-layer--modal {
  background: rgba(12, 18, 32, 0.52);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: entry-gate-fade-in 0.18s ease-out both;
}

.entry-gate-layer--modal .entry-gate-card {
  animation: entry-gate-pop-in 0.24s cubic-bezier(0.2, 0.85, 0.35, 1.15) both;
}

@keyframes entry-gate-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes entry-gate-pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.entry-gate-card {
  width: min(420px, 100%);
  padding: 34px 32px 28px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(29, 56, 117, 0.16), 0 2px 6px rgba(29, 56, 117, 0.06);
  text-align: center;
}

.entry-gate-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #eef3ff, #dfe9ff);
  color: #4f7cff;
}

.entry-gate-badge svg {
  width: 26px;
  height: 26px;
}

.entry-gate-eyebrow {
  margin: 0 0 6px;
  color: #8b95a7;
  font-size: 12px;
  letter-spacing: 0.16em;
}

.entry-gate-title {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
}

.entry-gate-subtitle {
  margin: 0 0 22px;
  color: #78818f;
  font-size: 13px;
  line-height: 1.7;
}

.entry-gate-form {
  text-align: left;
}

.entry-gate-label {
  display: block;
  margin: 0 0 8px;
  color: #5b6475;
  font-size: 12px;
  font-weight: 500;
}

.entry-gate-input {
  box-sizing: border-box;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1.5px solid #dde3ee;
  border-radius: 12px;
  outline: none;
  background: #fbfcfe;
  color: #1d2638;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.entry-gate-input::placeholder {
  color: #aab2c0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.entry-gate-input:focus {
  border-color: #4f7cff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.entry-gate-submit {
  width: 100%;
  height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b86ff, #3f68f0);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  box-shadow: 0 12px 26px rgba(79, 124, 255, 0.3);
}

.entry-gate-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(79, 124, 255, 0.36);
}

.entry-gate-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.entry-gate-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #e05252;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: left;
}

.entry-gate-error:empty {
  margin-top: 0;
}

.entry-gate-note {
  margin: 14px 0 0;
  padding-top: 16px;
  border-top: 1px solid #eef1f7;
  color: #98a1b1;
  font-size: 11.5px;
  line-height: 1.7;
}

.entry-gate-shop {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eef1f7;
  text-align: left;
}

.entry-gate-shop[hidden] {
  display: none;
}

.entry-gate-shop-title {
  margin: 0 0 10px;
  color: #5b6475;
  font-size: 12px;
  font-weight: 500;
}

.entry-gate-shop-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.entry-gate-shop-link {
  flex: 1 1 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff1f0;
  color: #c2410c;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.entry-gate-shop-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(194, 65, 12, 0.16);
}

.entry-gate-shop-link--xianyu {
  background: #fff7e6;
  color: #b45309;
}

.entry-gate-shop-link--xianyu:hover {
  box-shadow: 0 8px 18px rgba(180, 83, 9, 0.16);
}

.entry-gate-busy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px 0 10px;
  color: #6b7688;
  font-size: 13px;
}

.entry-gate-busy[hidden] {
  display: none;
}

.entry-gate-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(79, 124, 255, 0.2);
  border-top-color: #4f7cff;
  border-radius: 50%;
  animation: entry-gate-spin 0.8s linear infinite;
}

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

/* 雾都庄园主题：只由站点 meta 中的 gateTheme: "manor" 启用。 */
.entry-gate-layer--theme-manor {
  color: #eadfce;
  background:
    radial-gradient(90% 75% at 50% 0%, rgba(117, 76, 66, 0.34), transparent 65%),
    linear-gradient(rgba(12, 10, 13, 0.86), rgba(12, 10, 13, 0.92));
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
}

.entry-gate-layer--theme-manor.entry-gate-layer--modal {
  background:
    radial-gradient(90% 80% at 50% 0%, rgba(123, 73, 61, 0.38), rgba(10, 9, 12, 0.87)),
    rgba(10, 9, 12, 0.78);
  -webkit-backdrop-filter: blur(9px) saturate(.8);
  backdrop-filter: blur(9px) saturate(.8);
}

.entry-gate-layer--theme-manor .entry-gate-card {
  position: relative;
  overflow: hidden;
  max-width: 440px;
  padding: 39px 35px 31px;
  border: 1px solid rgba(224, 190, 132, 0.42);
  border-radius: 0;
  color: #eadfce;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(47, 37, 39, 0.98), rgba(24, 21, 26, 0.99)),
    #211c20;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62), inset 0 0 0 6px rgba(224, 190, 132, 0.035);
}

.entry-gate-layer--theme-manor .entry-gate-card::before,
.entry-gate-layer--theme-manor .entry-gate-card::after {
  position: absolute;
  width: 94px;
  height: 94px;
  border: 1px solid rgba(224, 190, 132, 0.22);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.entry-gate-layer--theme-manor .entry-gate-card::before { top: -56px; left: -54px; }
.entry-gate-layer--theme-manor .entry-gate-card::after { right: -54px; bottom: -56px; }

.entry-gate-layer--theme-manor .entry-gate-badge {
  position: relative;
  width: 62px;
  height: 62px;
  margin-bottom: 17px;
  border: 1px solid rgba(230, 197, 138, 0.7);
  border-radius: 50%;
  color: #e3c58e;
  background: radial-gradient(circle, rgba(227, 197, 142, 0.2), rgba(75, 47, 43, 0.45));
  box-shadow: 0 0 0 5px rgba(227, 197, 142, 0.055), inset 0 0 18px rgba(227, 197, 142, 0.1);
}

.entry-gate-layer--theme-manor .entry-gate-badge::before {
  position: absolute;
  width: 76px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(227, 197, 142, 0.65), transparent);
}

.entry-gate-layer--theme-manor .entry-gate-badge svg { width: 28px; height: 28px; stroke-width: 1.5; }

.entry-gate-layer--theme-manor .entry-gate-eyebrow {
  color: #d4b583;
  font-size: 10px;
  letter-spacing: .22em;
}

.entry-gate-layer--theme-manor .entry-gate-title {
  margin-bottom: 10px;
  color: #f0e4d0;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: .09em;
}

.entry-gate-layer--theme-manor .entry-gate-subtitle {
  max-width: 300px;
  margin-right: auto;
  margin-left: auto;
  color: #a99d91;
  line-height: 1.85;
}

.entry-gate-layer--theme-manor .entry-gate-form { margin-top: 26px; text-align: left; }
.entry-gate-layer--theme-manor .entry-gate-label { color: #cbb18b; letter-spacing: .1em; }

.entry-gate-layer--theme-manor .entry-gate-input {
  height: 53px;
  border: 1px solid rgba(224, 190, 132, 0.33);
  border-radius: 0;
  color: #f1dfc1;
  background: rgba(6, 6, 8, 0.38);
  font-size: 18px;
}

.entry-gate-layer--theme-manor .entry-gate-input::placeholder { color: #786e67; }

.entry-gate-layer--theme-manor .entry-gate-input:focus {
  border-color: #dfbc80;
  background: rgba(8, 7, 9, 0.6);
  box-shadow: 0 0 0 3px rgba(223, 188, 128, 0.12);
}

.entry-gate-layer--theme-manor .entry-gate-submit {
  height: 50px;
  border: 1px solid #d7b376;
  border-radius: 0;
  color: #251b1a;
  letter-spacing: .1em;
  background: linear-gradient(135deg, #e3c58e, #b77e4e);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
}

.entry-gate-layer--theme-manor .entry-gate-submit:hover { box-shadow: 0 15px 30px rgba(0, 0, 0, 0.46); }
.entry-gate-layer--theme-manor .entry-gate-error { color: #e78578; }

.entry-gate-layer--theme-manor .entry-gate-note,
.entry-gate-layer--theme-manor .entry-gate-shop {
  border-top-color: rgba(224, 190, 132, 0.16);
  color: #837970;
}

.entry-gate-layer--theme-manor .entry-gate-shop-title { color: #cfb187; }
.entry-gate-layer--theme-manor .entry-gate-shop-link { border: 1px solid rgba(224, 190, 132, 0.24); border-radius: 0; color: #ead6b5; background: rgba(227, 197, 142, 0.08); }
.entry-gate-layer--theme-manor .entry-gate-shop-link--xianyu { color: #e7c086; background: rgba(183, 126, 78, 0.12); }
.entry-gate-layer--theme-manor .entry-gate-busy { color: #cdb48e; }
.entry-gate-layer--theme-manor .entry-gate-spinner { border-color: rgba(227, 197, 142, 0.22); border-top-color: #e3c58e; }

@media (max-width: 480px) {
  .entry-gate-card {
    padding: 28px 22px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entry-gate-spinner {
    animation-duration: 2s;
  }
}
