/* ==========================================================================
   数字后端面试题库 · 内容解锁层（gate.js 配套）
   --------------------------------------------------------------------------
   正文（目录 + 问答 + 原理图）是密文，页面加载时先显示这层遮罩，
   解锁成功后才注入 DOM。遮罩用不透明底色覆盖全屏，避免「先闪正文再被盖住」。
   配色沿用题库 main.css 的暗色体系（橙 #ff8f52 / 青 #3fc9bb / 底 #070a0f），
   网格背景与正文 44px 网格呼应。
   ========================================================================== */

html.ivq-locked, html.ivq-locked body { overflow: hidden; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background-color: #070a0f;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    radial-gradient(880px 620px at 8% 5%, rgba(255, 143, 82, 0.14), transparent 62%),
    radial-gradient(820px 600px at 94% 88%, rgba(63, 201, 187, 0.12), transparent 62%);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

/* 卡片 */
.gate-card {
  position: relative;
  width: 100%;
  max-width: 384px;
  padding: 44px 32px 30px;
  background: rgba(14, 18, 25, 0.9);
  border: 1px solid rgba(255, 143, 82, 0.24);
  border-radius: 16px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
  text-align: center;
  animation: ivq-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 顶部橙→青渐变饰条 */
.gate-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #ff8f52, #3fc9bb, transparent);
  opacity: 0.85;
}

/* 印章式 logo */
.gate-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  font-size: 25px;
  font-weight: 700;
  border-radius: 14px;
  background: rgba(255, 143, 82, 0.12);
  border: 1px solid rgba(255, 143, 82, 0.35);
  color: #ff8f52;
  text-shadow: 0 0 18px rgba(255, 143, 82, 0.45);
}

.gate-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
  color: #e9edf4;
  letter-spacing: -0.01em;
}

.gate-sub {
  margin: 0 0 26px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #8b96a6;
}

.gate form { display: block; }

.gate-input {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14.5px;
  color: #e9edf4;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.gate-input::placeholder { color: #5f6a7a; }
.gate-input:focus {
  border-color: rgba(255, 143, 82, 0.55);
  background: rgba(255, 143, 82, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 143, 82, 0.14);
}
.gate-input:disabled { opacity: 0.55; }

.gate-btn {
  position: relative;
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  color: #070a0f;
  background: linear-gradient(135deg, #ff8f52, #ffab73);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.12s, box-shadow 0.2s;
}
.gate-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(255, 143, 82, 0.35);
}
.gate-btn:active { transform: translateY(1px); box-shadow: none; }
.gate-btn:disabled { opacity: 0.75; cursor: default; transform: none; box-shadow: none; }

/* 解锁中：文字后跟一个转圈 */
.gate-btn:disabled::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(7, 10, 15, 0.35);
  border-top-color: #070a0f;
  border-radius: 50%;
  animation: ivq-spin 0.7s linear infinite;
}

.gate-msg {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  color: #ffcf4d;
}
.gate-msg.is-error { color: #ff5d6c; animation: ivq-shake 0.4s ease; }

.gate-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: #616c7d;
}
.gate-note a {
  color: #3fc9bb;
  text-decoration: none;
  transition: color 0.2s;
}
.gate-note a:hover { color: #8fe6dc; text-decoration: underline; }

/* 解锁成功：正文淡入上移（gate.js 给容器加 .ivq-revealed） */
.ivq-revealed { animation: ivq-fade-in 0.45s ease both; }

/* ---------- 动画 ---------- */
@keyframes ivq-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ivq-spin {
  to { transform: rotate(360deg); }
}
@keyframes ivq-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@keyframes ivq-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .gate-card, .gate-msg.is-error, .ivq-revealed { animation-duration: 0.01ms; }
  .gate-btn:disabled::after { animation-duration: 0.01ms; }
}
