/* ============================================================
   顶栏工具：我要吐槽 / 极简版方案（独立文件，勿并入 style.css）
   —— 只新增组件，不覆盖任何既有选择器
   ============================================================ */

/* ---------- 1. 顶栏两个按钮 ---------- */
.top-btn {
  height: 38px;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.top-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
  box-shadow: none;
}
.top-btn .ico { width: 16px; height: 16px; }
.top-btn.is-on {
  color: var(--accent-2);
  border-color: var(--accent);
  background: var(--accent-weak);
}
.top-btn .fang-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
}
.top-btn .fang-count[hidden] { display: none; }

@media (max-width: 1100px) {
  .top-btn span { display: none; }
  .top-btn { width: 38px; padding: 0; justify-content: center; }
}

/* ---------- 2. 吐槽：标注模式 ---------- */
body.fang-mode,
body.fang-mode #view,
body.fang-mode #view * { cursor: crosshair; }

.fang-hit {
  outline: 2px solid var(--warn) !important;
  outline-offset: 2px;
  border-radius: 4px;
}

.fang-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 9px 10px 9px 16px;
  border-radius: 999px;
  background: #0B1224;
  color: #EAF0FF;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(8, 15, 26, .35);
}
.fang-bar .ico { width: 15px; height: 15px; color: #9DB2FF; flex: 0 0 auto; }
.fang-bar[hidden] { display: none; }

/* 标注条出现时，把 toast 抬起来，避免叠字 */
body.fang-mode .toast { bottom: 86px; }
.fang-exit {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: none;
  color: #EAF0FF;
  font-size: 12px;
  cursor: pointer;
}
.fang-exit:hover { background: rgba(255, 255, 255, .1); }

/* 气泡 */
.fang-pop {
  position: fixed;
  z-index: 95;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-3);
}
.fang-pop[hidden] { display: none; }
.fang-tag {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  max-height: 34px;
  overflow: hidden;
}
.fang-pop textarea {
  display: block;
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}
.fang-pop textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.fang-ops { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.fang-ops button {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.fang-ops #fangCancel {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}
.fang-ops #fangCancel:hover { border-color: var(--border-strong); color: var(--text); }
.fang-ops #fangSave {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}
.fang-ops #fangSave:hover { background: var(--accent-hover, var(--accent)); filter: brightness(1.06); }

/* 记录面板 */
.fang-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 92;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.fang-panel[hidden] { display: none; }
.fang-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px 11px 14px;
  border-bottom: 1px solid var(--border);
}
.fang-panel header b { font-size: 14px; color: var(--text); }
.fang-panel header em { font-style: normal; margin-left: 4px; color: var(--accent-2); }
.fang-panel .icon-btn { width: 44px; height: 44px; }
.fang-list {
  flex: 1 1 auto;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fang-item {
  position: relative;
  padding: 8px 30px 8px 10px;
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.fang-item b {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
.fang-item .del {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.fang-item .del:hover { background: var(--danger-weak); color: var(--danger); }
.fang-empty { padding: 18px 12px; text-align: center; font-size: 13px; color: var(--text-3); line-height: 1.7; }
.fang-panel footer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.fang-panel footer button {
  flex: 1 1 auto;
  min-height: 36px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#fangStart {
  flex: 0 0 100%;
  border: 1px dashed var(--accent);
  background: var(--accent-weak);
  color: var(--accent-2);
}
#fangCopyAll { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
#fangCopyAll:disabled { opacity: .45; cursor: not-allowed; }
#fangClear { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.fang-head-ops { display: flex; align-items: center; gap: 6px; }
.fang-panel header #fangStart {
  flex: 0 0 auto; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer;
}
.fang-panel header #fangStart:hover { filter: brightness(1.06); }

/* 暗色下主色偏亮，白字对比度不足（沿用项目里 .ai-mode.is-on 的处理方式） */
[data-theme="dark"] .fang-ops #fangSave { color: #06202e; }
[data-theme="dark"] #fangCopyAll { color: #06202e; }

@media (max-width: 820px) {
}

@media (max-width: 560px) {
  .fang-bar { font-size: 12px; gap: 8px; padding: 8px 8px 8px 12px; }
  .fang-panel { right: 12px; bottom: 12px; left: 12px; width: auto; }
}

/* ===== 截图标注（类似微信截图） ===== */
.shot-mask { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; background: rgba(7,12,24,.88); }
.shot-mask[hidden] { display: none; }
.shot-bar { width: min(1100px, 100%); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; background: #0B1224; color: #fff; border-radius: 12px; }
.shot-bar b { font-size: 13px; }
.shot-tools, .shot-colors, .shot-ops { display: inline-flex; align-items: center; gap: 6px; }
.shot-tools button, .shot-ops button { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; font: inherit; font-size: 12.5px; cursor: pointer; }
.shot-tools button.is-on { background: #2457F5; border-color: #2457F5; }
.shot-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.shot-color[data-on] { border-color: #fff; }
.shot-ops { margin-left: auto; }
#shotDone { background: #2457F5; border-color: #2457F5; }
#shotCanvas { max-width: 100%; max-height: calc(100vh - 118px); background: #fff; border-radius: 8px; touch-action: none; cursor: crosshair; }
@media (max-width: 560px) {
  .shot-bar { gap: 6px; padding: 8px; }
  .shot-tools button, .shot-ops button { height: 30px; padding: 0 9px; font-size: 12px; }
  .shot-ops { margin-left: 0; width: 100%; justify-content: flex-end; }
}
