/* ============================================================
   GameChanger gcc2 — REVIEW LAYER (copy edits + pinned comments)
   Mirrors the gcc-design comment system; adds an "Edit copy" mode.
   Writes to the shared D1 (gcc-design-feedback) via /api/feedback.
   Hidden from print. Identity captured client-side (no CF Access here).
   ============================================================ */

/* ---- cursors / hover affordance when a mode is active ---- */
body.rv-editing [data-rv-editable], body.rv-commenting * { cursor: crosshair; }
body.rv-editing [data-rv-editable]:hover {
  outline: 2px dashed var(--green-deep); outline-offset: 3px; border-radius: 3px;
}
body.rv-commenting :hover { }

/* ---- pin layer ---- */
#rvPinLayer { position: absolute; top: 0; left: 0; width: 100%; height: 0; pointer-events: none; z-index: 80; }
.rv-pin {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  width: 26px; height: 26px; border-radius: 50% 50% 50% 2px; border: 2px solid #fff;
  background: var(--ink); color: #fff; font: 700 12px/1 var(--font-mono); cursor: pointer;
  box-shadow: var(--shadow-card); display: grid; place-items: center;
}
.rv-pin:hover { background: var(--slate); }
.rv-pin.resolved { background: var(--green-deep); }
.rv-pin.edit { background: var(--terra-deep); }
.rv-pin.flash { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---- popover (composer + thread) ---- */
.rv-pop {
  position: absolute; z-index: 90; width: min(360px, calc(100vw - 24px)); pointer-events: auto;
  background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-elevated); padding: var(--s-3);
  font-family: var(--font-body); color: var(--ink);
}
.rv-pop .ctx { font-size: .8rem; color: var(--slate); background: var(--paper-2);
  border-radius: var(--r-md); padding: .5em .7em; margin-bottom: var(--s-2);
  max-height: 60px; overflow: auto; }
.rv-pop .ctx b { color: var(--ink); }
.rv-pop textarea {
  width: 100%; box-sizing: border-box; min-height: 84px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: .6em .7em;
  font-family: var(--font-body); font-size: 16px; line-height: 1.5; color: var(--ink);
}
.rv-pop textarea:focus-visible { outline: 2px solid var(--green-deep); outline-offset: 1px; }
.rv-thread { max-height: 220px; overflow-y: auto; margin-bottom: var(--s-2); }
.rv-c { padding: 7px 0; border-bottom: 1px solid var(--line); }
.rv-c:last-child { border-bottom: none; }
.rv-c .meta { font-size: .72rem; color: var(--slate); display: flex; gap: 8px; flex-wrap: wrap; }
.rv-c .meta b { color: var(--ink); }
.rv-c .txt { font-size: .92rem; white-space: pre-wrap; margin-top: 2px; }
.rv-actions { display: flex; gap: 8px; margin-top: var(--s-2); align-items: center; flex-wrap: wrap; }
.rv-actions .spacer { flex: 1; }

/* buttons */
.rv-send { background: var(--green); color: var(--ink); border: 0; border-radius: var(--r-pill);
  padding: .55em 1.2em; font-weight: 700; font-family: var(--font-body); font-size: .9rem; cursor: pointer; }
.rv-send:hover { background: var(--green-cta); }
.rv-cancel { background: none; border: 0; color: var(--slate); font-weight: 600; cursor: pointer;
  font-family: var(--font-body); font-size: .9rem; padding: .55em .4em; }
.rv-cancel:hover { color: var(--ink); text-decoration: underline; }
.rv-resolve { background: none; border: 1.5px solid var(--line-strong); border-radius: var(--r-pill);
  padding: 5px 13px; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--slate);
  font-family: var(--font-body); }
.rv-resolve:hover { border-color: var(--green-deep); color: var(--green-deep); }

/* ---- FABs ---- */
.rv-fabs { position: fixed; right: 16px; bottom: 16px; z-index: 95; display: flex; flex-direction: column;
  gap: 8px; align-items: flex-end; }
.rv-fab { font-family: var(--font-body); font-weight: 700; font-size: .9rem; cursor: pointer;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--r-pill); padding: .65em 1.1em;
  box-shadow: var(--shadow-elevated); display: inline-flex; align-items: center; gap: .5em; }
.rv-fab:hover { background: var(--slate); }
.rv-fab--edit { background: var(--green); color: var(--ink); }
.rv-fab--edit:hover { background: var(--green-cta); }
.rv-fab[aria-pressed="true"] { outline: 3px solid var(--amber); outline-offset: 1px; }
.rv-count { background: var(--gold); color: var(--ink); border-radius: var(--r-pill);
  font: 700 .72rem var(--font-mono); padding: 1px 7px; }

/* ---- hint toast ---- */
.rv-hint { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: .85rem; padding: .6em 1em;
  border-radius: var(--r-pill); box-shadow: var(--shadow-elevated); z-index: 96;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 24px); text-align: center; }
.rv-hint.show { opacity: 1; }

/* ---- drawer / log ---- */
.rv-drawer { position: fixed; right: 0; top: 0; height: 100vh; width: min(380px, 92vw);
  background: var(--white); border-left: 1px solid var(--line); box-shadow: var(--shadow-elevated);
  z-index: 97; transform: translateX(100%); transition: transform var(--duration-ui) var(--ease-brand);
  display: flex; flex-direction: column; }
.rv-drawer.open { transform: none; }
.rv-drawer header { padding: var(--s-3); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.rv-who { font-size: .8rem; color: var(--slate); }
.rv-tabs { display: inline-flex; gap: 4px; background: var(--paper-2); border-radius: var(--r-pill); padding: 3px; }
.rv-tab { border: 0; background: transparent; color: var(--slate); font-weight: 600; font-size: .8rem;
  border-radius: var(--r-pill); padding: .35em .8em; cursor: pointer; font-family: var(--font-body); }
.rv-tab[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: var(--shadow-card); }
.rv-list { padding: var(--s-3); overflow-y: auto; display: grid; gap: var(--s-2); }
.rv-muted { color: var(--slate); font-size: .9rem; }
.rv-entry { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); cursor: pointer; }
.rv-entry:hover { border-color: var(--green-deep); }
.rv-entry .meta { font-size: .72rem; color: var(--slate); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rv-entry .meta .sec { background: var(--paper-2); border-radius: var(--r-pill); padding: 1px 8px; }
.rv-entry .meta .tag-edit { background: #f6e1d8; color: var(--terra-text); border-radius: var(--r-pill); padding: 1px 8px; font-weight: 700; }
.rv-entry .meta .done { color: var(--green-deep); }
.rv-entry .meta b { color: var(--ink); }
.rv-entry .txt { font-size: .9rem; margin-top: 3px; white-space: pre-wrap; }

/* ---- identity dialog ---- */
.rv-idask { position: fixed; inset: 0; z-index: 99; background: rgba(14,27,42,.55);
  display: grid; place-items: center; padding: var(--s-3); }
.rv-idask[hidden] { display: none; }
.rv-idcard { background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-elevated);
  padding: var(--s-5); width: min(420px, 100%); }
.rv-idcard h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; margin-bottom: var(--s-1); }
.rv-idcard input { width: 100%; box-sizing: border-box; margin: var(--s-3) 0; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); padding: .7em .8em; font-size: 16px; font-family: var(--font-body); }

@media print { .rv-fabs, .rv-drawer, .rv-pop, #rvPinLayer, .rv-hint, .rv-idask { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .rv-drawer, .rv-hint { transition: none; } }
