/* ==========================================================================
   反馈模块 — 就地弹层，沿用计算器的设计令牌
   ========================================================================== */

/* 结果卡里的低调入口：只在对结果有疑问时才是目标 */
.result__feedback {
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: right;
  cursor: pointer;
  transition: color 0.16s var(--ease);
}
.result__feedback:hover { color: var(--accent); }
.result__feedback em {
  font-style: normal;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--hair-strong);
}

/* 有未读回复时给入口一个红点，不改文案也不占布局 */
.has-reply { color: var(--accent); }
.result__feedback.has-reply::after,
.footer a.has-reply::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 5px;
  border-radius: 50%;
  background: #ff3b30;
  vertical-align: middle;
}

/* 上次反馈的进度条：代码 + 状态 + 开发者回复 */
.fb__thread {
  margin: 0 0 15px;
  padding: 12px 13px;
  border-radius: var(--radius-field);
  background: var(--key-tint);
  border-left: 3px solid var(--accent);
}
.fb__thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.fb__thread-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.fb__thread-state {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 10.5px;
  color: var(--text-3);
}
.fb__thread-state.is-replied { background: var(--accent-weak); color: var(--accent); }
.fb__thread-reply {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}
.fb__thread-time {
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
}

/* ---------- 弹层骨架 ---------- */
.fb {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.fb[hidden] { display: none; }
/* hidden 属性要压得住后面的 display:flex */
.fb [hidden] { display: none !important; }

.fb__mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.24s var(--ease);
}
.fb.is-open .fb__mask { opacity: 1; }

.fb__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(580px, 100%);
  max-height: min(86vh, 760px);
  background: var(--bg-elevated);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}
/* 移动端浏览器地址栏伸缩会让 vh 跳，优先用 dvh */
@supports (height: 1dvh) {
  .fb__panel { max-height: min(86dvh, 760px); }
}
.fb.is-open .fb__panel { opacity: 1; transform: none; }

.fb__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 14px;
  flex: 0 0 auto;
}
.fb__head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.fb__head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
.fb__close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.fb__close:hover { background: var(--chip-hover); color: var(--text); }
.fb__close svg { width: 13px; height: 13px; }

.fb__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 22px 4px;
  -webkit-overflow-scrolling: touch;
}

/* ---------- 类型：三个胶囊 ---------- */
.fb__types {
  display: flex;
  gap: 6px;
  padding: 3px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--inset);
}
.fb__type {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.fb__type:hover { color: var(--text); }
.fb__type[aria-checked="true"] {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ---------- 描述 ---------- */
.fb__field {
  position: relative;
  border-radius: var(--radius-field);
  background: var(--inset);
  transition: box-shadow 0.18s var(--ease);
}
.fb__field:focus-within {
  box-shadow: 0 0 0 3px var(--accent-weak), inset 0 0 0 1px var(--accent);
}
.fb__field textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 13px 14px 26px;
  border: 0;
  border-radius: inherit;
  background: none;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  resize: vertical;
}
.fb__field textarea:focus { outline: none; }
.fb__field textarea::placeholder { color: var(--text-3); }
.fb__count {
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ---------- 截图 ---------- */
.fb__shots { margin-top: 12px; }

.fb__drop {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px dashed var(--hair-strong);
  border-radius: var(--radius-field);
  background: none;
  font: inherit;
  text-align: left;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), color 0.16s var(--ease);
}
.fb__drop:hover,
.fb__drop:focus-visible { border-color: var(--accent); color: var(--text-2); outline: none; }
.fb__drop.is-over {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}
.fb__drop svg { width: 16px; height: 16px; flex: 0 0 auto; }
.fb__drop-text { font-size: 12.5px; line-height: 1.5; }
.fb__drop-text b { font-weight: 500; color: var(--text-2); }
.fb__drop:hover .fb__drop-text b { color: var(--accent); }
.fb__drop kbd {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--chip);
  font-family: inherit;
  font-size: 10.5px;
  color: var(--text-3);
}

.fb__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.fb__thumbs:empty { display: none; }
.fb__thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--inset);
  box-shadow: var(--shadow-thumb);
}
.fb__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fb__thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}
.fb__thumb-del:hover { background: rgba(0, 0, 0, 0.85); }
.fb__thumb-del svg { width: 9px; height: 9px; }
.fb__thumb-size {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 5px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
  font-size: 9.5px;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- 可选信息 ---------- */
.fb__more {
  margin-top: 14px;
  border-top: 1px solid var(--hair);
}
.fb__more > summary {
  padding: 11px 0;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  list-style: none;
  transition: color 0.16s var(--ease);
}
.fb__more > summary::-webkit-details-marker { display: none; }
.fb__more > summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  font-size: 13px;
  color: var(--text-3);
}
.fb__more[open] > summary::before { content: "−"; }
.fb__more > summary:hover { color: var(--text); }
.fb__more-body { padding-bottom: 4px; }

.fb__input {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-field);
  background: var(--inset);
  font: inherit;
  font-size: 13px;
  color: var(--text);
}
.fb__input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-weak), inset 0 0 0 1px var(--accent);
}
.fb__input::placeholder { color: var(--text-3); }
.fb__input.is-invalid { box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.16), inset 0 0 0 1px #ff3b30; }
.fb__input-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.55;
}

/* ---------- 附带参数的勾选 ---------- */
.fb__check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: var(--radius-field);
  background: var(--inset);
  cursor: pointer;
}
.fb__check input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.fb__check-text { font-size: 12px; line-height: 1.5; color: var(--text-2); }
.fb__check-text span { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }

.fb__privacy {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-3);
}
.fb__privacy a { color: var(--text-3); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 底部操作 ---------- */
.fb__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--hair);
  margin-top: 4px;
}
.fb__foot .btn { flex: 0 0 auto; }
.fb__foot .btn:disabled { opacity: 0.5; cursor: not-allowed; }
#fbFootDone { justify-content: flex-end; }
#fbFootDone .btn--ghost { margin-right: auto; }
.fb__status {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.45;
}
.fb__status.is-error { color: var(--c-pit); }

/* 提交后的结果态 */
.fb__done {
  padding: 26px 0 30px;
  text-align: center;
}
.fb__done-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent);
}
.fb__done-icon svg { width: 22px; height: 22px; }
.fb__done h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.fb__done p {
  margin: 0 auto;
  max-width: 340px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.fb__code {
  display: inline-block;
  margin: 14px 0 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--inset);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* ---------- 小屏：底部抽屉 ---------- */
@media (max-width: 780px) {
  .fb { padding: 0; align-items: flex-end; }
  .fb__panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    transform: translateY(24px);
  }
  @supports (height: 1dvh) {
    .fb__panel { max-height: 92dvh; }
  }
  .fb.panel-instant .fb__panel { transform: translateY(0); }
  .fb__head { padding: 18px 18px 12px; }
  .fb__body { padding: 0 18px 4px; }
  .fb__foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .fb__thumbs { grid-template-columns: repeat(3, 1fr); }
  .fb__foot .btn { padding: 10px 15px; }
}

@media (max-width: 380px) {
  .fb__type { padding: 8px 4px; font-size: 12px; }
  .fb__foot .btn--mail { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .fb__mask, .fb__panel { transition-duration: 0.01ms; }
}
