/* 帮助与反馈页：顶栏下方用滑块切换「常见问题 / 意见反馈」两个面板。 */

html {
  /* 两个面板高度不同，预留滚动条位置，切换时不因出现/消失滚动条而横移 */
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--head-h) + 16px);
}

@supports not (scrollbar-gutter: stable) {
  html {
    overflow-y: scroll;
  }
}

.help-main {
  padding: var(--head-h) 0 0;
}

/* ---------- 滑块 ---------- */

/* 不吸顶：滑块就是页面里的第一块内容，往下滚就跟着走，
   免得看起来像第二条顶栏 */
.help-switch {
  padding-top: 10px;
}

.help-switch-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 13px;
  padding-bottom: 13px;
}

.help-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(300px, 100%);
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-soft);
}

.help-tabs-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 22, 21, 0.12);
  transition: transform 0.28s var(--ease);
}

.help-tabs.is-feedback .help-tabs-thumb {
  transform: translateX(100%);
}

.help-tab {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.help-tab:hover {
  color: var(--ink);
}

.help-tab.is-active {
  color: var(--ink);
  font-weight: 500;
}

.help-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.help-count {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font: 11px var(--font-mono);
  white-space: nowrap;
}

/* ---------- 面板 ---------- */

.help-panel {
  padding-top: clamp(26px, 3.6vw, 42px);
  padding-bottom: clamp(52px, 6vw, 76px);
}

.help-panel[hidden] {
  display: none;
}

.help-panel-inner {
  max-width: 860px;
  margin: 0 auto;
}

.help-panel-inner--form {
  max-width: 760px;
}

.help-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- 搜索 ---------- */

.faq-search {
  position: relative;
  margin: 0 0 10px;
}

.faq-search-icon {
  position: absolute;
  left: 19px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* 左右半圆的胶囊，但宽度跟下面的抽屉卡片对齐：
   1px 边框 + 52px 内缩 = 放大镜与序号同一条竖线、文字与问题同一条竖线 */
.faq-search-input {
  width: 100%;
  padding: 15px 18px 15px 52px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.faq-search-input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.faq-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.faq-item mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--ink);
}

/* ---------- 问答 ---------- */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.18s var(--ease);
}

.faq-item[open] {
  border-color: var(--line-strong);
}

.faq-item summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 18px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  background: var(--hover);
}

.faq-index {
  flex: none;
  min-width: 22px;
  padding-top: 1px;
  color: var(--muted);
  font: 10.5px/1.6 var(--font-mono);
}

.faq-question {
  flex: 1;
  min-width: 0;
}

.faq-chev {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}

.faq-item[open] .faq-chev {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 18px 16px 52px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.help-empty {
  margin: 0;
  padding: 26px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.help-empty a {
  margin-left: 4px;
}

/* ---------- 反馈 ---------- */

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.feedback-kind {
  margin: 0;
  padding: 0;
  border: 0;
}

.feedback-kind legend,
.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font: 11px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field > span i {
  margin-left: 4px;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.segmented label {
  position: relative;
  display: block;
}

.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: block;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.segmented label:hover span {
  border-color: var(--line-strong);
  color: var(--ink);
}

.segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 500;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.kind-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
  line-height: 1.6;
}

.field {
  display: block;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.field textarea {
  min-height: 132px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.field .counter {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font: 10.5px var(--font-mono);
  text-align: right;
}

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

/* .field input 的 display:block 会盖掉 hidden 的 UA 样式，这里明确藏掉 */
.dropzone input[type="file"] {
  display: none;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 15px 12px;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
}

.dropzone-label svg {
  width: 18px;
  height: 18px;
  margin-bottom: 2px;
  color: var(--muted);
}

.dropzone-label strong {
  color: var(--ink);
  font-weight: 500;
}

.dropzone-label small {
  color: var(--muted);
  font: 10.5px var(--font-mono);
}

.attachment-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font: 10.5px var(--font-mono);
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}

.attachment-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item-size {
  flex: none;
  color: var(--muted);
  font: 10.5px var(--font-mono);
  white-space: nowrap;
}

.attachment-remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.attachment-remove:hover {
  background: rgba(176, 68, 54, 0.1);
  color: #b04436;
}

.attachment-remove svg {
  width: 12px;
  height: 12px;
}

.form-status {
  min-height: 18px;
  margin: 0;
  color: var(--accent-ink);
  font-size: 12.5px;
}

.form-status.is-error {
  color: var(--danger, #b04436);
}

.feedback-honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-form .btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.help-foot {
  margin-top: 0;
  margin-bottom: 40px;
}

@media (max-width: 620px) {
  .help-count {
    display: none;
  }

  .faq-item summary {
    padding: 13px 14px;
  }

  /* 搜索框跟着抽屉一起对齐：窄屏卡片内边距是 14px */
  .faq-search-icon {
    left: 15px;
  }

  .faq-search-input {
    padding: 14px 14px 14px 48px;
  }

  .faq-answer {
    padding: 0 14px 14px 40px;
  }

  .feedback-form {
    padding: 18px 16px;
  }
}

@media (max-width: 380px) {
  .help-tabs {
    width: 100%;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-tabs-thumb {
    transition: none;
  }
}

/* ---------- 提交成功页（/help/success/） ---------- */

.help-panel--sent {
  padding-top: clamp(44px, 10vh, 120px);
}

.help-panel-inner.sent-card {
  max-width: 560px;
  padding: clamp(28px, 4.4vh, 46px) clamp(22px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.sent-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.sent-mark svg {
  width: 22px;
  height: 22px;
}

.sent-card h1 {
  font-size: clamp(22px, 2.6vw, 28px);
  letter-spacing: -0.02em;
}

.sent-text {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.8;
  text-wrap: pretty;
}

.sent-actions {
  margin-top: 26px;
}

.sent-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
}

.sent-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 480px) {
  .sent-actions .btn {
    width: 100%;
  }
}
