/* The feedback box: the picture (snap / attach / paste, then mark it up) beside the note. One send. */
.feedback-page { max-width: 880px; }
.feedback-page .tool-head { max-width: 640px; }
html:has(.feedback-dialog[open]) { overflow: hidden; }

.feedback-dialog {
  --fb-gut: clamp(16px, 3vw, 26px);
  box-sizing: border-box;
  width: min(1080px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--e3), 0 40px 90px -30px rgba(12, 26, 21, .45);
}
.feedback-dialog[open] { animation: fb-in var(--t-3) var(--out); }
.feedback-dialog::backdrop { background: rgba(12, 26, 21, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes fb-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .feedback-dialog[open] { animation: none; } }

.fb-panel { display: flex; flex-direction: column; max-height: inherit; }
.fb-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px var(--fb-gut);
  border-bottom: 1px solid #ECEAE4;
}
.fb-head h2 { margin: 0; font: 900 24px/1.1 var(--sans); letter-spacing: -.02em; }
.fb-close {
  display: grid;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--t-1) var(--ease);
}
.fb-close:hover { background: var(--concrete); }

.fb-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.fb-form[hidden] { display: none; }

/* ── the picture ── */
.fb-shot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px var(--fb-gut) 20px;
  background: #F6F5F1;
  border-right: 1px solid #ECEAE4;
}
.fb-empty {
  display: grid;
  flex: 1;
  align-content: center;
  justify-items: center;
  gap: 18px;
  min-height: 400px;
  padding: 28px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 62%),
    repeating-linear-gradient(135deg, rgba(23, 33, 29, .028) 0 2px, transparent 2px 9px),
    #EEECE7;
  box-shadow: inset 0 0 0 1px rgba(23, 33, 29, .06);
}
.fb-empty[hidden], .fb-editor[hidden] { display: none; }
.fb-snap {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(100%, 420px);
  padding: 16px 26px 16px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--e2), 0 14px 30px -18px rgba(12, 26, 21, .5);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-2) var(--out), box-shadow var(--t-2) var(--ease);
}
.fb-snap img { flex: none; width: 92px; height: 92px; transition: transform .45s var(--out); }
.fb-snap strong { display: block; font: 900 23px/1.1 var(--sans); letter-spacing: -.02em; }
.fb-snap small { display: block; margin-top: 6px; color: var(--ink-2); font-size: 15px; line-height: 1.35; }
.fb-snap:hover { transform: translateY(-2px); box-shadow: var(--e3); }
.fb-snap:hover img { transform: rotate(-6deg) scale(1.06); }
.fb-snap:active { transform: translateY(0); }
.is-snapping .fb-snap { cursor: progress; }
.is-snapping .fb-snap img { animation: fb-flash .9s var(--ease) infinite; }
@keyframes fb-flash { 50% { transform: scale(.92); opacity: .7; } }
.fb-or { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; }
.fb-attach {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px 0 6px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
  box-shadow: var(--e1);
  color: var(--ink);
  font: 700 15px/1 var(--sans);
  cursor: pointer;
  transition: background-color var(--t-1) var(--ease), box-shadow var(--t-2) var(--ease);
}
.fb-attach img { width: 36px; height: 36px; }
.fb-attach:hover { background: #FFFFFF; box-shadow: var(--e2); }
.fb-paste { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.fb-paste kbd, .fb-hint kbd {
  padding: 2px 6px;
  border-radius: 5px;
  background: #FFFFFF;
  box-shadow: inset 0 -1px 0 rgba(23, 33, 29, .14), 0 0 0 1px rgba(23, 33, 29, .1);
  font: 700 12.5px/1 var(--sans);
}
@media (hover: none) { .fb-paste { display: none; } }

.fb-editor { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; }
.fb-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.fb-marks {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: #E6E4DE;
  box-shadow: inset 0 1px 2px rgba(12, 26, 21, .08);
}
.fb-marks button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: 700 14px/1 var(--sans);
  cursor: pointer;
  transition: background-color var(--t-1) var(--ease), color var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease);
}
.fb-marks svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fb-marks svg .fill { fill: currentColor; }
.fb-marks button:hover { color: var(--ink); }
.fb-marks button[aria-checked=true] { background: #FFFFFF; color: var(--ink); box-shadow: var(--e1); }
.fb-marks button[aria-checked=true] svg { stroke: #E4572E; }
.fb-marks button[data-mark=hide][aria-checked=true] svg { stroke: var(--ink); }
.fb-tools-end { display: inline-flex; gap: 2px; }
.fb-tool {
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--forest);
  font: 700 14px/1 var(--sans);
  cursor: pointer;
  transition: background-color var(--t-1) var(--ease);
}
.fb-tool:hover { background: rgba(23, 33, 29, .07); }
.fb-tool:disabled { color: #A5AAA6; background: transparent; cursor: default; }
.fb-stage {
  position: relative;
  flex: 1;
  min-height: 340px;
  height: clamp(340px, 56vh, 560px);
  overflow: hidden;
  border-radius: 12px;
  background: #E7E5DF;
  box-shadow: inset 0 0 0 1px rgba(23, 33, 29, .06);
}
.fb-stage canvas { position: absolute; inset: 0; display: block; cursor: crosshair; touch-action: none; }
.fb-hint, .fb-msg { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.4; }
.fb-msg.is-error { color: var(--warn); font-weight: 700; }

/* ── the note ── */
.fb-note { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 18px var(--fb-gut) 20px; }
.fb-kind { margin: 0; padding: 0; border: 0; min-width: 0; }
.fb-kind legend, .fb-label {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink);
  font: 700 15px/1.3 var(--sans);
}
.fb-label small { color: var(--ink-2); font-size: 14px; font-weight: 400; }
.fb-kind {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.fb-kind legend { grid-column: 1 / -1; float: left; width: 100%; }
.fb-kind label { position: relative; display: block; margin: 0; }
.fb-kind input { position: absolute; opacity: 0; pointer-events: none; }
.cic-page .fb-kind label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 9px;
  background: #F1F0EC;
  box-shadow: inset 0 0 0 1px rgba(23, 33, 29, .08);
  color: var(--ink);
  font: 700 15px/1.1 var(--sans);
  cursor: pointer;
  transition: background-color var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease), color var(--t-1) var(--ease);
}
.cic-page .fb-kind label > span:hover { background: #E8E6E0; }
.cic-page .fb-kind input:checked + span { background: var(--forest); color: #FFFFFF; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(12, 26, 21, .2); }
.fb-kind input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.fb-field { display: block; margin: 0; }
.fb-field textarea, .fb-field input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: var(--control);
  padding: 11px 13px;
  border: 0;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px #BFC4BE, 0 1px 2px rgba(12, 26, 21, .04);
  color: var(--ink);
  font: 400 16px/1.45 var(--sans);
  transition: box-shadow var(--t-2) var(--ease);
}
.fb-field textarea { min-height: 150px; resize: vertical; }
.fb-field textarea:hover, .fb-field input:hover { box-shadow: inset 0 0 0 1px var(--edge); }
.fb-field textarea:focus, .fb-field input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--forest), 0 0 0 4px rgba(36, 77, 61, .14); }
.fb-field ::placeholder { color: #7D857F; opacity: 1; }
.feedback-trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.fb-foot { display: grid; gap: 10px; margin-top: auto; }
.fb-send { width: 100%; min-height: 50px; font-size: 16.5px; }
.fb-result { margin: 0; color: var(--forest); font-size: 15px; font-weight: 700; }
.fb-result:empty { display: none; }
.fb-result.is-error { color: var(--warn); }

/* ── sent ── */
.fb-done { display: grid; justify-items: center; gap: 6px; padding: 40px var(--fb-gut) 44px; text-align: center; }
.fb-done[hidden] { display: none; }
.fb-done img { width: 200px; height: auto; margin-bottom: 6px; animation: fb-in .5s var(--out); }
.fb-done h3 { margin: 0; font: 900 28px/1.1 var(--sans); letter-spacing: -.02em; }
.fb-done p { margin: 0; color: var(--ink-2); font-size: 16px; }
.fb-done-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

/* ── phone: the box is the whole screen, picture first ── */
@media (max-width: 760px) {
  .feedback-dialog {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .feedback-dialog[open] { animation-name: fb-up; }
  @keyframes fb-up { from { transform: translateY(24px); opacity: 0; } }
  .fb-panel { height: 100%; }
  .fb-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .fb-form { display: flex; flex-direction: column; flex: 1; }
  .fb-shot { padding: 14px 16px; border-right: 0; border-bottom: 1px solid #ECEAE4; }
  .fb-empty { grid-template-columns: 1fr 1fr; align-items: stretch; gap: 10px; min-height: 0; padding: 0; background: none; box-shadow: none; }
  .fb-snap, .fb-attach {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 132px;
    padding: 14px 10px;
    border-radius: 14px;
    background: #FFFFFF;
    box-shadow: var(--e2);
    text-align: center;
  }
  .fb-snap img { width: 64px; height: 64px; }
  .fb-snap strong { font-size: 17px; }
  .fb-snap small { display: none; }
  .fb-or { display: contents; }
  .fb-attach { display: flex; font-size: 17px; font-weight: 900; letter-spacing: -.02em; }
  .fb-attach img { width: 64px; height: 64px; }
  .fb-shot, .fb-editor, .fb-note { flex: none; }
  .fb-marks button span { display: none; }
  .fb-marks button { height: 40px; padding: 0 10px; }
  .fb-tools { flex-wrap: nowrap; gap: 4px; }
  .fb-tool { min-height: 40px; padding: 0 7px; font-size: 14px; }
  .fb-stage { flex: none; min-height: 0; height: 50dvh; }
  .fb-note { padding: 16px 16px max(20px, env(safe-area-inset-bottom)); }
  .cic-page .fb-kind label > span { min-height: 44px; }
  .fb-field textarea { min-height: 110px; }
}

.fb-panel:focus { outline: none; }
