/* ==========================================================================
   gate.css — 进入口令（公会暗号）弹框
   ========================================================================== */

.gate {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: clamp(14px, 4vw, 40px);
}
.gate[hidden] { display: none; }

.gate__scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 55% at 50% 42%, rgba(9, 15, 32, 0.82), rgba(2, 4, 10, 0.96));
  backdrop-filter: blur(7px) saturate(110%);
  -webkit-backdrop-filter: blur(7px) saturate(110%);
}

.gate__card {
  position: relative;
  width: min(520px, 100%);
  display: grid; gap: var(--sp-3); justify-items: center;
  padding: clamp(22px, 3.4vw, 40px);
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(16, 24, 46, 0.94), rgba(6, 10, 20, 0.96));
  box-shadow: var(--shadow-2), 0 0 90px -34px var(--gold), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: gateIn 420ms var(--ease) both;
}
.gate__card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.85;
}

@keyframes gateIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

/* 答错时的抖动 */
.gate.is-shake .gate__card { animation: gateShake 420ms var(--ease); }
@keyframes gateShake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* ---------------------------- 徽记 ---------------------------- */

.gate__sigil { width: 96px; height: 96px; }
.gate__sigil svg { width: 100%; height: 100%; animation: gateSpin 24s linear infinite; }
.gate__sigil circle { fill: none; stroke: var(--gold); stroke-width: 1; opacity: 0.5; }
.gate__sigil path { fill: none; stroke: var(--gold); stroke-width: 0.6; opacity: 0.35; }
.gate__sigil .gate__core {
  fill: var(--accent); stroke: none; opacity: 0.92;
  animation: gatePulse 2.2s ease-in-out infinite;
}
@keyframes gateSpin { to { transform: rotate(360deg); } }
@keyframes gatePulse { 50% { opacity: 0.35; } }

/* ---------------------------- 文字 ---------------------------- */

.gate__kicker {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.42em; text-indent: 0.42em;
  color: var(--gold); opacity: 0.9;
}
.gate__question {
  font-family: var(--font-display);
  font-size: clamp(19px, 2.6vw, 26px);
  letter-spacing: 0.06em;
  color: var(--ink);
  text-wrap: balance;
}

/* ---------------------------- 表单 ---------------------------- */

.gate__form {
  display: grid; gap: var(--sp-3);
  width: 100%;
  margin-top: var(--sp-2);
}
.gate__input {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(4, 8, 18, 0.8);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.gate__input::placeholder { color: var(--ink-faint); letter-spacing: 0.1em; }
.gate__input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 201, 121, 0.14);
  background: rgba(8, 14, 28, 0.9);
}
.gate__input:disabled { opacity: 0.55; cursor: not-allowed; }

.gate__btn {
  padding: 12px 18px;
  font-family: var(--font-display);
  font-size: 14px; letter-spacing: 0.22em; text-indent: 0.22em;
  color: #10131d;
  border: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #fff3cf, var(--gold) 46%, var(--gold-deep));
  box-shadow: 0 10px 26px -12px var(--gold);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast), box-shadow var(--t-fast);
}
.gate__btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 14px 30px -12px var(--gold); }
.gate__btn:active { transform: translateY(1px); }
.gate__btn:disabled { filter: grayscale(0.5) brightness(0.8); cursor: not-allowed; transform: none; }

/* ---------------------------- 反馈 ---------------------------- */

.gate__msg {
  min-height: 1.4em;
  font-size: 12.5px;
  color: #ffb4b4;
}
.gate__msg.is-ok { color: #8ef0a8; }

.gate__granted {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em;
  color: #8ef0a8;
  animation: gateIn 300ms var(--ease) both;
}

.gate__hint {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  color: var(--ink-faint);
}

/* ---------------------------- 未解锁时藏起大厅 ---------------------------- */

html[data-gate="locked"] .stage { display: none; }
html[data-gate="locked"] .boot { display: none !important; }

@media (max-width: 520px) {
  .gate__sigil { width: 76px; height: 76px; }
  .gate__card { padding: 20px 18px; }
}
