/* ============================================================
   extras.css —— 增量模块样式（邀请码门禁 + 留言板）
   纯原生 CSS，不依赖 Tailwind / 任何框架
   设计 token 与 src/index.css 保持同源：
     背景 #050510 → #0A0A1E / 文字 #EAEAF2 / 香槟金 #C9A96E
   硬约束：圆角 ≤16px、不使用 backdrop-filter（全站 blur 只留给 AI 面板）
   ============================================================ */

/* ---------------- 门禁：状态控制 ---------------- */

html.cc-locked,
html.cc-locked body {
  overflow: hidden !important;
}

/* 未通过时先藏住主内容，避免遮罩后面内容提前露出 */
html.cc-locked #root {
  visibility: hidden;
}

/* 已通过时遮罩彻底移除 */
html.cc-passed #cc-gate {
  display: none !important;
}

/* ---------------- 门禁：全屏遮罩 ---------------- */

#cc-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: Inter, 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  color: #eaeaf2;
  background:
    radial-gradient(circle at 50% 36%, rgba(201, 169, 110, 0.1), transparent 58%),
    linear-gradient(180deg, #050510 0%, #080818 48%, #0a0a1e 100%);
}

.cc-gate-card {
  width: 100%;
  max-width: 396px;
  padding: 40px 34px 32px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 32px 70px -30px rgba(0, 0, 0, 0.9);
}

.cc-gate-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.cc-gate-eyebrow {
  margin: 0 0 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(201, 169, 110, 0.75);
}

.cc-gate-title {
  margin: 0;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #eaeaf2;
}

.cc-gate-lede {
  margin: 12px 0 26px;
  font-size: 14px;
  line-height: 1.7;
  color: #a5a5bd;
}

#cc-gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#cc-gate-input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #eaeaf2;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

#cc-gate-input::placeholder {
  color: #6b6b85;
  letter-spacing: 0.02em;
}

#cc-gate-input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(201, 169, 110, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12);
}

#cc-gate-submit {
  width: 100%;
  padding: 13px 18px;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #0a0a1e;
  background: linear-gradient(180deg, #d7bb85 0%, #c9a96e 55%, #b4924f 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 200ms ease, transform 200ms ease;
}

#cc-gate-submit:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

#cc-gate-submit:active:not(:disabled) {
  transform: translateY(0);
}

#cc-gate-submit:disabled {
  cursor: default;
  opacity: 0.6;
}

#cc-gate-submit:focus-visible {
  outline: 2px solid rgba(201, 169, 110, 0.7);
  outline-offset: 3px;
}

.cc-gate-error {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #e0553f;
}

.cc-gate-tip {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #6b6b85;
}

/* 错误时轻微抖动，给一个明确的操作反馈 */
@keyframes cc-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.cc-gate-card.cc-shake {
  animation: cc-shake 400ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------------- 留言板 ---------------- */

#cc-board {
  position: relative;
  padding: 76px 24px 92px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #070716 0%, #0a0a1e 100%);
  font-family: Inter, 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  color: #eaeaf2;
}

.cc-board-wrap {
  max-width: 680px;
  margin: 0 auto;
}

.cc-board-eyebrow {
  margin: 0 0 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(201, 169, 110, 0.75);
}

.cc-board-title {
  margin: 0;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #eaeaf2;
}

.cc-board-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: #a5a5bd;
}

#cc-board-form {
  margin-top: 30px;
  padding: 26px 26px 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.cc-field {
  margin-bottom: 18px;
}

.cc-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #a5a5bd;
}

.cc-req {
  color: rgba(201, 169, 110, 0.9);
}

#cc-nickname,
#cc-message {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.7;
  color: #eaeaf2;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

#cc-message {
  min-height: 128px;
  resize: vertical;
}

#cc-nickname::placeholder,
#cc-message::placeholder {
  color: #6b6b85;
}

#cc-nickname:focus,
#cc-message:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(201, 169, 110, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12);
}

.cc-counter {
  margin-top: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #6b6b85;
  text-align: right;
}

.cc-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#cc-board-submit {
  padding: 11px 26px;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #0a0a1e;
  background: linear-gradient(180deg, #d7bb85 0%, #c9a96e 55%, #b4924f 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 200ms ease, transform 200ms ease;
}

#cc-board-submit:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

#cc-board-submit:active:not(:disabled) {
  transform: translateY(0);
}

#cc-board-submit:disabled {
  cursor: default;
  opacity: 0.6;
}

#cc-board-submit:focus-visible {
  outline: 2px solid rgba(201, 169, 110, 0.7);
  outline-offset: 3px;
}

#cc-board-status {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #a5a5bd;
}

#cc-board-status[data-state='ok'] {
  color: #c9a96e;
}

#cc-board-status[data-state='err'] {
  color: #e0553f;
}

/* ---------------- 无障碍 ---------------- */

.cc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 520px) {
  .cc-gate-card {
    padding: 32px 22px 26px;
  }

  .cc-gate-title {
    font-size: 23px;
  }

  #cc-board {
    padding: 56px 18px 68px;
  }

  .cc-board-title {
    font-size: 24px;
  }

  #cc-board-form {
    padding: 20px 18px 18px;
  }

  .cc-actions {
    gap: 10px;
  }

  #cc-board-submit {
    width: 100%;
  }
}

/* ---------------- 动效降级 ---------------- */

@media (prefers-reduced-motion: reduce) {
  #cc-gate *,
  #cc-board * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
