/* ===========================================================================
   Rozzo — line by line (review.js). The résumé on the left zooms to one line
   at a time; Rozzo's comment sits on the right like a comment in Word, with
   a dotted line joining the two. On phones the page sits on top and the
   comment below it.
   =========================================================================== */
body.in-review { overflow: hidden; background: var(--bg); }
.rozzo-review { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }

/* ---------- top bar ---------- */
.rv-top { flex: 0 0 auto; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: #fff; border-bottom: 2px solid var(--line); }
.rv-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 0 0 auto; }
.rv-title b { font-size: 16px; font-weight: 900; }
.rv-title span { font-size: 12.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.rv-ticks { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 3px; height: 30px; }
.rv-ticks .tk { flex: 1 1 0; min-width: 3px; max-width: 30px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: var(--surface-3); cursor: pointer; transition: height .22s var(--ease), background .3s, box-shadow .22s; }
.rv-ticks .tk.fix { background: #f3c4c6; }
.rv-ticks .tk.improve { background: #f4d9a6; }
.rv-ticks .tk.strong { background: #cfe8c3; }
.rv-ticks .tk.done { background: var(--green); }
.rv-ticks .tk.done.kept { background: var(--lav-deep); }
.rv-ticks .tk.on { height: 14px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.rv-ticks .tk:hover { height: 12px; }
.rv-filter { flex: 0 0 auto; }
.rv-filter button { white-space: nowrap; }
.rv-filter .sm { display: none; }
.rv-filter i { font-style: normal; }
.rv-score { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface-3); color: var(--ink); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; transition: background .3s, color .3s; }
.rv-score .of { color: var(--ink-3); font-size: 12px; font-weight: 800; }
.rv-score .was { color: var(--ink-3); text-decoration: line-through; font-weight: 800; }
.rv-score .ic { width: 14px; height: 14px; }
.rv-score.up { background: var(--green-2); color: var(--green-ink); }
.rv-score.up b { animation: rvPop .45s var(--ease) both; }

/* ---------- the page and the highlight ---------- */
.rv-body { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); }
.rv-stage { position: relative; overflow: hidden; background: var(--surface-3); }
.rv-canvas { position: absolute; top: 0; left: 0; width: 720px; transform-origin: 0 0; transition: transform .64s var(--ease); will-change: transform; }
.rv-canvas.instant { transition: none; }
.rv-paper .paper { background: #fff; border-radius: 3px; box-shadow: 0 1px 2px rgba(30,36,66,.08), 0 20px 50px rgba(30,36,66,.14); }
.rv-hl { position: absolute; z-index: 2; pointer-events: none; border-radius: 6px;
  --hl: 238,162,53;
  background: rgba(var(--hl), .14); box-shadow: 0 0 0 2px rgba(var(--hl), .95), 0 0 0 9999px rgba(30,36,66,.2);
  transition: left .64s var(--ease), top .64s var(--ease), width .64s var(--ease), height .64s var(--ease), background .3s, box-shadow .3s, opacity .3s; }
.rv-hl.fix { --hl: 221,75,80; }
.rv-hl.strong, .rv-hl.settled { --hl: 73,165,44; }
.rv-hl.ok { animation: rvOk .8s var(--ease); }
.rv-hl.hide { opacity: 0; }
@keyframes rvOk { 0% { background: rgba(73,165,44,.5); } 100% { background: rgba(var(--hl), .14); } }

/* ---------- the dotted line from the words to the comment ---------- */
.rv-link { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; opacity: 0; transition: opacity .25s; }
.rv-link.on { opacity: 1; }
.rv-link path { fill: none; stroke: var(--mustard); stroke-width: 2; stroke-dasharray: 3 5; stroke-linecap: round; }
.rv-link circle { fill: var(--mustard); }

/* ---------- Rozzo's comment ---------- */
.rv-side { position: relative; z-index: 4; display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 18px 18px 14px; background: var(--bg); border-left: 2px solid var(--line); }
.rv-card { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #fff; border: 2px solid var(--line); border-radius: 20px; box-shadow: var(--sh-2); scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.rv-card.enter { animation: rvIn .34s var(--ease) both; }
.rv-card.refreshed .rvc-note, .rv-card.refreshed .rvc-sugg, .rv-card.refreshed .rvc-ask { animation: rvIn .36s var(--ease) both; }
@keyframes rvIn { from { transform: translateY(10px); } to { transform: none; } }
@keyframes rvPop { from { transform: scale(.82); } to { transform: none; } }
.rvc-head { display: flex; align-items: center; gap: 10px; }
.rvc-av { width: 46px; flex: 0 0 auto; }
.rvc-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.rvc-who b { font-size: 15px; font-weight: 900; }
.rvc-who span { font-size: 12.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-verdict { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 900; white-space: nowrap; animation: rvPop .42s var(--ease) both; }
.rv-verdict.strong { background: var(--green-2); color: var(--green-ink); }
.rv-verdict.improve { background: var(--mustard-2); color: var(--mustard-ink); }
.rv-verdict.fix { background: var(--red-2); color: var(--red-ink); }
.rvc-quote { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; font-weight: 600; line-height: 1.5; }
.rvc-note { font-size: 15px; font-weight: 700; line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.rvc-lbl { margin-bottom: 6px; font-size: 12.5px; font-weight: 900; color: var(--ink-3); }
.rvc-sugg { padding: 12px 14px; border-radius: 14px; background: var(--green-2); }
.rvc-sugg .rvc-lbl { color: var(--green-ink); }
.rvc-diff { font-size: 15px; font-weight: 700; line-height: 1.55; color: var(--ink); }
.rvc-diff ins { text-decoration: none; padding: 0 2px; border-radius: 4px; background: #c6ebb3; animation: rvIns .6s var(--ease) both; }
.rvc-diff del { color: var(--red-ink); text-decoration: line-through; text-decoration-thickness: 2px; opacity: .7; }
@keyframes rvIns { from { background: rgba(198,235,179,0); } }
.rvc-sugg-txt { font-size: 14px; font-weight: 700; line-height: 1.5; }
.rvc-ask { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--mustard-2); color: var(--mustard-ink); font-size: 14px; font-weight: 800; line-height: 1.45; }
.rvc-ask .ic { width: 18px; height: 18px; margin-top: 1px; }
.rvc-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rvc-acts .btn { min-height: 42px; }
.rvc-edit .textarea { min-height: 84px; margin-bottom: 8px; }
.rvc-fields { display: grid; gap: 10px; }
.rvc-chips .chip { min-height: 34px; }
.rvc-chips .chip.on { background: var(--green-2); border-color: var(--green); box-shadow: 0 3px 0 var(--green-lip); color: var(--green-ink); }
.rvc-status { display: flex; align-items: center; gap: 6px; color: var(--green-ink); font-size: 13.5px; font-weight: 800; }
.rvc-status .ic { width: 16px; height: 16px; }
.rvc-think { display: none; align-items: center; gap: 5px; color: var(--ink-3); font-size: 13px; font-weight: 800; }
.rvc-think em { font-style: normal; margin-left: 4px; }
.rvc-think span, .msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lav-deep); animation: rvDot 1s infinite ease-in-out; }
.rvc-think span:nth-child(2), .msg.typing span:nth-child(2) { animation-delay: .15s; }
.rvc-think span:nth-child(3), .msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes rvDot { 0%, 80%, 100% { opacity: .35; transform: scale(.65); } 40% { opacity: 1; transform: scale(1); } }
.rv-card.thinking .rvc-think { display: flex; }
.rv-card.thinking .rvc-sugg, .rv-card.thinking .rvc-acts, .rv-card.thinking .rvc-note { opacity: .55; transition: opacity .2s; }

/* the thread under the comment, like replies in Word */
.rvc-thread { display: flex; flex-direction: column; gap: 8px; max-height: 230px; overflow: auto; }
.rvc-thread:empty { display: none; }
.msg { display: flex; align-items: flex-end; gap: 8px; animation: rvIn .26s var(--ease) both; }
.msg img { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; background: var(--lav); }
.msg p { max-width: 86%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.msg.rozzo p { background: var(--lav-2); color: var(--ink); border-bottom-left-radius: 4px; }
.msg.me { justify-content: flex-end; }
.msg.me p { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg.typing p { display: flex; gap: 4px; padding: 12px 14px; }
.rvc-quick { gap: 6px; }
.rvc-quick .chip { min-height: 32px; font-size: 13px; }
.rvc-reply { display: flex; gap: 8px; }
.rvc-reply .input { flex: 1 1 auto; min-height: 46px; padding: 10px 14px; font-size: 15px; }
.rvc-reply .btn { flex: 0 0 auto; width: 50px; padding: 0; }

/* ---------- moving between lines ---------- */
.rv-nav { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.rv-keys { flex: 1 1 auto; text-align: center; color: var(--ink-4); font-size: 12px; font-weight: 700; }
.rv-nav .btn[disabled] { visibility: hidden; }

/* ---------- the end ---------- */
.rv-card.done { justify-content: center; align-items: center; text-align: center; }
.rv-fin { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 6px; }
.rv-fin-av { width: 150px; }
.rv-fin h2 { font-size: 26px; }
.rv-fin p { max-width: 34ch; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.rv-fin p b { color: var(--green-ink); font-variant-numeric: tabular-nums; }
.rv-fin-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }

/* ---------- tablets and phones: page on top, comment below ---------- */
@media (max-width: 900px) {
  /* the page on top; below it Rozzo's comment scrolls on its own and the Previous / Next bar stays put under it */
  .rv-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(180px, 36vh) minmax(0, 1fr); }
  .rv-side { padding: 10px 10px calc(8px + env(safe-area-inset-bottom)); gap: 8px; border-left: 0; border-top: 2px solid var(--line); overflow: hidden; }
  .rv-card { flex: 1 1 auto; min-height: 0; overflow: auto; box-shadow: none; padding: 14px; }
  .rv-keys, .rv-link { display: none; }
  .rv-nav { position: static; }
  .rv-nav .btn { flex: 1 1 0; min-height: 46px; }
  .rv-nav .btn[disabled] { display: none; }
  .rv-top { gap: 10px; padding: 0 10px; }
  .rv-fin { gap: 8px; padding: 4px 0; }
  /* compact comment: everything fits above the Previous / Next bar */
  .rv-card { gap: 9px; padding: 12px; border-radius: 16px; }
  .rvc-av { width: 38px; }
  .rvc-note { font-size: 14.5px; line-height: 1.42; }
  .rvc-sugg { padding: 10px 12px; }
  .rvc-ask { padding: 8px 10px; font-size: 13.5px; }
  .rvc-quick { flex-wrap: nowrap; }
  .rvc-quick .chip:nth-child(n+3) { display: none; }
  .rvc-thread { max-height: none; }
  .rv-fin-av { width: 104px; }
  .rv-fin h2 { font-size: 22px; }
}
@media (max-width: 640px) {
  .rv-top { gap: 8px; padding: 0 8px; }
  .rv-ticks, .rv-done-lbl, #rv-done .lbl, .rv-title b, .rv-filter .lg { display: none; }
  .rv-filter .sm { display: inline; }
  .rv-title { flex: 1 1 auto; }
  .rv-title span { white-space: normal; font-size: 12px; line-height: 1.25; }
  .rv-filter button { padding: 0 9px; font-size: 12.5px; }
  #rv-done { min-width: 40px; padding: 0 10px; }
  .rv-score { height: 30px; padding: 0 10px; font-size: 13px; }
  .rv-score .of { display: none; }
  .rvc-note, .rvc-diff { font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .rv-canvas, .rv-hl, .rv-ticks .tk { transition: none; }
  .rv-card.enter, .rv-card.refreshed .rvc-note, .rv-card.refreshed .rvc-sugg, .msg, .rv-verdict, .rvc-diff ins, .rv-hl.ok, .rv-score.up b { animation: none; }
}
