/* Контекстное меню и форма «Замечание разработчику» (feedback.js). Цвета и шрифты — из style.css. */

:root {
  --fb-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --fb-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ——— меню у курсора ——— */
.fb-menu {
  position: fixed; z-index: 96;
  min-width: 232px; max-width: min(320px, calc(100vw - 16px));
  padding: 5px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
  font-family: var(--font);
  opacity: 0; transform: scale(.96);
  transition: opacity 160ms var(--fb-ease-out), transform 160ms var(--fb-ease-out);
  outline: none;
}
.fb-menu.in { opacity: 1; transform: none; }
.fb-menu[hidden] { display: none; }

.fb-item {
  display: grid; grid-template-columns: 18px 1fr; align-items: center; column-gap: 10px;
  width: 100%; min-height: 40px; padding: 6px 12px 6px 10px;
  border-radius: 8px; font-size: 14px; line-height: 1.3; text-align: left; color: var(--ink);
  transition: background-color 120ms ease;
}
.fb-item svg { color: var(--ink-2); grid-row: span 2; }
.fb-item span { font-weight: 500; }
.fb-item small { grid-column: 2; font-size: 12px; color: var(--ink-3); font-family: var(--font-code); letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-item:focus-visible, .fb-item:focus { background: var(--surface-2); outline: none; }
@media (hover: hover) and (pointer: fine) { .fb-item:hover { background: var(--surface-2); } }
.fb-item:active { background: var(--surface-3); }
.fb-item.danger, .fb-item.danger svg { color: var(--critical-ink); }
.fb-item.armed, .fb-item.armed svg { background: var(--serious-soft); color: var(--serious-ink); }
.fb-sep { height: 1px; margin: 4px 6px; background: var(--line-soft); }

/* ——— на телефоне: шторка снизу ——— */
.fb-backdrop {
  position: fixed; inset: 0; z-index: 95;
  background: rgb(0 0 0 / .32);
  opacity: 0; transition: opacity 240ms var(--fb-ease-out);
}
.fb-backdrop.in { opacity: 1; }
.fb-backdrop[hidden] { display: none; }
.fb-menu.sheet {
  left: 0; right: 0; bottom: 0; top: auto;
  max-width: none; min-width: 0; width: auto;
  margin: 0 auto;
  padding: 6px 10px calc(10px + var(--safe-bottom, 0px));
  border-radius: 18px 18px 0 0; border-bottom: 0;
  box-shadow: 0 -8px 40px rgb(0 0 0 / .18);
  transform: translateY(100%); opacity: 1;
  transition: transform 300ms var(--fb-ease-drawer);
}
.fb-menu.sheet::before {
  content: ""; display: block; width: 38px; height: 4px; margin: 4px auto 10px;
  border-radius: 2px; background: var(--axis);
}
.fb-menu.sheet.in { transform: none; }
.fb-menu.sheet .fb-item { min-height: 50px; font-size: 15.5px; padding: 8px 12px; border-radius: 10px; }
.fb-menu.sheet .fb-item svg { width: 20px; height: 20px; }
.fb-menu.sheet .fb-sep { margin: 6px 8px; }
@media (min-width: 640px) { .fb-menu.sheet { max-width: 480px; border-radius: 18px; bottom: 12px; } }

/* ——— форма ——— */
.fb-dialog { max-width: 520px; }
.fb-dialog[open] { animation: fbIn 240ms var(--fb-ease-out) both; }
@keyframes fbIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.fb-form { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 16px; font-family: var(--font); }
.fb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fb-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.fb-close { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-soft); }
@media (hover: hover) and (pointer: fine) { .fb-close:hover { background: var(--surface-3); } }
.fb-lead { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.fb-field { display: flex; flex-direction: column; gap: 6px; }
.fb-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 560; color: var(--ink-3); }
.fb-count { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.fb-count.near { color: var(--serious-ink); }
.fb-field textarea {
  width: 100%; min-height: 108px; max-height: 40vh; resize: vertical;
  font: inherit; font-size: 15px; line-height: 1.45; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.fb-field textarea::placeholder { color: var(--ink-3); }
.fb-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fb-field textarea[aria-invalid="true"] { border-color: var(--critical); }
.fb-error { margin: -4px 0 0; font-size: 13px; color: var(--critical-ink); }
.fb-attached { font-size: 12.5px; color: var(--ink-3); }
.fb-attached summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 540; }
.fb-attached summary::-webkit-details-marker { display: none; }
.fb-attached summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); margin-right: 2px; transition: transform 160ms var(--fb-ease-out); }
.fb-attached[open] summary::before { transform: rotate(45deg); }
.fb-attached dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); line-height: 1.4; }
.fb-attached dt { color: var(--ink-3); }
.fb-attached dd { margin: 0; color: var(--ink-2); word-break: break-word; font-family: var(--font-code); font-size: 12px; }
.fb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.fb-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
.fb-actions .btn-primary { flex: 1; min-width: 140px; justify-content: center; }
@media (max-width: 480px) {
  .fb-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: calc(100dvh - 24px - var(--safe-top)); }
  .fb-form { padding-bottom: calc(16px + var(--safe-bottom, 0px)); }
}

/* ——— незаметная ссылка в подвале и справке ——— */
.fb-link { font: inherit; font-size: 13px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); padding: 0; }
.fb-link:focus-visible { color: var(--ink-2); text-decoration-color: currentColor; outline: none; }
@media (hover: hover) and (pointer: fine) { .fb-link:hover { color: var(--ink-2); text-decoration-color: currentColor; outline: none; } }
.fb-help { margin: 14px 0 0; text-align: left; }
.help-drawer .fb-help { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .fb-menu, .fb-menu.sheet { transform: none; transition: opacity 120ms ease; }
  .fb-menu.sheet { opacity: 0; }
  .fb-menu.sheet.in { opacity: 1; }
  .fb-backdrop { transition: opacity 120ms ease; }
  .fb-dialog[open] { animation: none; }
  .fb-attached summary::before { transition: none; }
}
