/* ==========================================================================
   夜游档案 · 留言板（催更 / 求游戏 / 问题建议）
   来源：Center 网页项目 · 2026-09-24
   适用：index.html 的悬浮留言按钮 + 留言对话框 + 详情页内联催更入口
   依赖：styles.css 的主题变量（--bg/--surface/--ink/--cyan/--lime/--line…）
   验证状态：本地 wrangler pages dev 端到端通过（见 FEEDBACK-SETUP.md）
   ========================================================================== */

.feedback-backdrop[hidden],
.feedback-done[hidden],
.feedback-actions [hidden] {
  display: none !important;
}

/* ---------- 1. 悬浮按钮（叠在「回到顶部」上方，同尺寸同位置口径） ---------- */

.feedback-fab {
  position: fixed;
  right: 18px;
  bottom: 66px;
  z-index: 60;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(13, 20, 25, 0.88);
  color: var(--cyan);
  opacity: 0.78;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

html[data-theme="light"] .feedback-fab {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(38, 66, 78, 0.2);
}

.feedback-fab:hover,
.feedback-fab:focus-visible {
  color: #0b0e0f;
  background: var(--cyan);
  border-color: var(--cyan);
  opacity: 1;
  transform: translateY(-2px);
}

.feedback-fab svg {
  width: 17px;
  height: 17px;
}

.feedback-fab-tip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.feedback-fab:hover .feedback-fab-tip,
.feedback-fab:focus-visible .feedback-fab-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* 首次访问时的三次呼吸圈，之后不再出现（首访标记存在 localStorage） */
.feedback-fab.is-fresh::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  opacity: 0;
  animation: feedback-pulse 2.4s ease-out 3;
  pointer-events: none;
}

@keyframes feedback-pulse {
  0% { opacity: 0.55; transform: scale(0.86); }
  70% { opacity: 0; transform: scale(1.24); }
  100% { opacity: 0; transform: scale(1.24); }
}

/* ---------- 2. 对话框骨架 ---------- */

.feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 10, 0.76);
  backdrop-filter: blur(10px);
}

.feedback-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px 26px 22px;
  background: var(--surface);
  border: 1px solid rgba(237, 245, 239, 0.24);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: feedback-in 220ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

html[data-theme="light"] .feedback-dialog {
  border-color: rgba(20, 36, 45, 0.2);
}

@keyframes feedback-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.feedback-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.feedback-close:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.feedback-close svg {
  width: 18px;
  height: 18px;
}

.feedback-eyebrow {
  display: block;
  color: var(--cyan);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  margin-bottom: 10px;
}

.feedback-head h2 {
  margin: 0 0 10px;
  padding-right: 34px;
  font: 700 24px Orbitron, sans-serif;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.feedback-head p {
  max-width: 400px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

/* ---------- 3. 表单 ---------- */

.feedback-form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.feedback-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.feedback-types legend {
  padding: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.feedback-type {
  min-height: 40px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.feedback-type:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.feedback-type[aria-pressed="true"] {
  border-color: var(--cyan);
  background: rgba(115, 231, 210, 0.12);
  color: var(--ink);
  font-weight: 600;
}

.feedback-field {
  display: grid;
  gap: 7px;
}

.feedback-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.feedback-label em {
  color: var(--faint);
  font-style: normal;
  letter-spacing: 0;
}

.feedback-label .feedback-count {
  margin-left: auto;
  color: var(--faint);
  font-weight: 400;
  letter-spacing: 0;
}

.feedback-field input,
.feedback-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  transition: border-color 160ms ease, background 160ms ease;
}

.feedback-field textarea {
  min-height: 104px;
  resize: vertical;
}

.feedback-field input::placeholder,
.feedback-field textarea::placeholder {
  color: var(--faint);
}

.feedback-field input:focus-visible,
.feedback-field textarea:focus-visible {
  border-color: var(--cyan);
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* 机器人蜜罐：视觉与人读屏都不可见，只等着被自动填 */
.feedback-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.feedback-status {
  margin: 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.feedback-status[data-state="error"] { color: var(--orange); }
.feedback-status[data-state="ok"] { color: var(--cyan); }

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.feedback-actions .button {
  min-height: 42px;
}

.feedback-button-quiet {
  min-height: 42px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.feedback-button-quiet:hover {
  color: var(--ink);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.feedback-footnote {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.7;
}

/* ---------- 4. 提交完成态 ---------- */

.feedback-done {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid rgba(115, 231, 210, 0.3);
  border-radius: 6px;
  background: linear-gradient(120deg, rgba(115, 231, 210, 0.09), transparent 62%);
  animation: feedback-in 200ms ease both;
}

.feedback-done h3 {
  margin: 0 0 8px;
  font: 700 18px Orbitron, sans-serif;
  letter-spacing: -0.03em;
}

.feedback-done p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.feedback-done .feedback-actions {
  margin-top: 18px;
}

/* 完成态里的打赏加速引导 */

.feedback-tip {
  display: grid;
  gap: 9px;
  justify-items: start;
  margin: 16px 0 2px;
  padding: 14px 15px;
  border: 1px solid rgba(214, 248, 92, 0.26);
  background: linear-gradient(120deg, rgba(214, 248, 92, 0.09), transparent 72%);
}

.feedback-tip-eyebrow {
  color: var(--lime);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
}

.feedback-tip p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.72;
}

.feedback-tip p strong {
  color: var(--ink);
}

.feedback-tip-button {
  min-height: 34px;
  padding: 0 13px;
  border-color: rgba(214, 248, 92, 0.42);
  background: var(--surface-2);
  color: var(--lime);
  font-size: 11px;
}

.feedback-tip-button:hover {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--bg);
}

/* ---------- 5. 详情页内联催更入口 ---------- */

.feedback-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(115, 231, 210, 0.06), transparent 62%);
}

.feedback-inline strong {
  display: block;
  margin-bottom: 6px;
  font: 700 15px Orbitron, sans-serif;
  letter-spacing: -0.02em;
}

.feedback-inline p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.feedback-inline .button {
  white-space: nowrap;
}

/* ---------- 6. 页脚入口（与「支持分享」并排，同为强调色 CTA） ---------- */

.footer .footer-feedback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: inherit;
  text-shadow: 0 0 12px rgba(115, 231, 210, 0.34);
  transition: color 160ms ease, text-shadow 160ms ease;
}

.footer .footer-feedback:hover {
  color: var(--lime);
  text-shadow: 0 0 14px rgba(214, 248, 92, 0.5);
}

/* ---------- 7. 响应式与动效降级 ---------- */

/* 窄屏页脚：链接组整体换行，避免 5 个入口被挤成逐字折行 */
@media (max-width: 720px) {
  .footer-right {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px 20px;
  }

  .footer-right > * {
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  .feedback-fab {
    right: 12px;
    bottom: 62px;
    width: 40px;
    height: 40px;
  }

  .feedback-fab-tip {
    display: none;
  }

  .feedback-dialog {
    padding: 22px 18px 18px;
  }

  .feedback-types {
    grid-template-columns: 1fr 1fr;
  }

  .feedback-inline {
    grid-template-columns: 1fr;
  }

  .feedback-inline .button {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-fab,
  .feedback-fab-tip,
  .feedback-type,
  .feedback-button-quiet {
    transition: none;
  }

  .feedback-fab.is-fresh::after {
    animation: none;
  }

  .feedback-dialog,
  .feedback-done {
    animation: none;
  }
}
