/* WrittenCheck reviews: the homepage carousel, the /reviews page, the write form and the after-check prompt. */
:root { --star: #f5a524; --star-off: #dfe3ea; --rv-ok: #0f8a6e; --rv-ok-soft: #d9f3ec; --rv-wait: #8a5a00; --rv-wait-soft: #fdf1c9; }
:root[data-theme="dark"] { --star: #f7b23b; --star-off: #2c3646; --rv-ok: #5fd3b8; --rv-ok-soft: #10302b; --rv-wait: #f0c060; --rv-wait-soft: #33280f; }

/* ---- Stars ------------------------------------------------------------------------------------- */
.rv-stars { --g: 2px; position: relative; display: inline-block; line-height: 0; vertical-align: middle; }
.rv-stars .bg, .rv-stars .fg { display: flex; gap: var(--g); }
.rv-stars svg { flex: none; width: var(--s, 18px); height: var(--s, 18px); display: block; }
.rv-stars .bg path { fill: var(--star-off); }
.rv-stars .fg { position: absolute; top: 0; left: 0; bottom: 0; overflow: hidden; white-space: nowrap; }
[dir="rtl"] .rv-stars .fg { left: auto; right: 0; }
.rv-stars .fg path { fill: var(--star); }
.rv-stars.lg { --s: 26px; --g: 4px; }
.rv-stars.pop .fg svg { animation: rv-pop .5s var(--ease) both; }
.rv-stars.pop .fg svg:nth-child(2) { animation-delay: .07s; } .rv-stars.pop .fg svg:nth-child(3) { animation-delay: .14s; }
.rv-stars.pop .fg svg:nth-child(4) { animation-delay: .21s; } .rv-stars.pop .fg svg:nth-child(5) { animation-delay: .28s; }
@keyframes rv-pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }

/* ---- Avatar ------------------------------------------------------------------------------------ */
.rv-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 1rem; }
.rv-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rv-ava.sm { width: 32px; height: 32px; font-size: .9rem; }

/* ---- Review card ------------------------------------------------------------------------------- */
.rv-card { position: relative; display: flex; flex-direction: column; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease); }
.rv-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.rv-card .rv-quote { position: absolute; top: 18px; right: 20px; width: 34px; height: 34px; color: var(--accent); opacity: .12; }
[dir="rtl"] .rv-card .rv-quote { right: auto; left: 20px; }
.rv-card h3 { font-size: 1.04rem; margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.rv-body { margin: 0; color: var(--text-2); font-size: .98rem; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.rv-card.clamp .rv-body { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.rv-more { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); font: 600 .92rem var(--font); cursor: pointer; }
.rv-more:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.rv-who { margin-top: auto; display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.rv-who div b { display: block; font-size: .95rem; color: var(--text); line-height: 1.3; }
.rv-who div span { display: block; font-size: .83rem; color: var(--text-3); }
.rv-reply { margin: 2px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--bg-soft); border-inline-start: 3px solid var(--accent); font-size: .92rem; color: var(--text-2); }
.rv-reply b { display: block; font-size: .82rem; color: var(--accent); margin-bottom: 2px; letter-spacing: .01em; }
.rv-reply p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.rv-edited { color: var(--text-3); font-size: .8rem; }

/* ---- Homepage section -------------------------------------------------------------------------- */
.rv-home .sec-head { margin-bottom: 36px; }
.rv-home-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: stretch; }
.rv-home-grid.rv-solo { grid-template-columns: minmax(0, 720px); justify-content: center; }
.rv-solo .rv-empty { align-items: center; text-align: center; padding: 40px 28px; }
.rv-score { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 30px 26px; border-radius: 18px; background: var(--bg-soft); border: 1px solid var(--border); text-align: center; align-items: center; }
.rv-score .rv-big { font-size: 3.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.rv-score .rv-of { color: var(--text-3); font-size: .95rem; margin: 0; }
.rv-score .btn { width: 100%; }
.rv-score .rv-all { font-weight: 600; font-size: .95rem; }
.rv-carousel { position: relative; min-width: 0; }
.rv-viewport { overflow: hidden; margin: -10px; padding: 10px; }
.rv-track { display: flex; gap: 20px; transition: transform .9s var(--ease); will-change: transform; }
.rv-track.no-anim { transition: none; }
.rv-track > .rv-card { flex: 0 0 calc((100% - 40px) / 3); min-height: 270px; }
.rv-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.rv-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.rv-dot { position: relative; width: 26px; height: 6px; border-radius: 99px; border: 0; padding: 0; background: var(--border); cursor: pointer; overflow: hidden; }
.rv-dot::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: var(--accent); border-radius: inherit; }
.rv-dot.on::after { transform: scaleX(1); }
.rv-carousel.playing .rv-dot.on::after { transform: scaleX(0); animation: rv-progress var(--rv-delay, 7s) linear forwards; }
.rv-carousel.paused .rv-dot.on::after { animation-play-state: paused; }
@keyframes rv-progress { to { transform: scaleX(1); } }
.rv-arrows { display: flex; gap: 8px; }
.rv-arrow { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; transition: border-color .15s, background-color .15s, transform .15s; }
.rv-arrow:hover { border-color: var(--border-2); background: var(--bg-soft); }
.rv-arrow:active { transform: scale(.94); }
.rv-arrow svg { width: 18px; height: 18px; }
[dir="rtl"] .rv-arrow svg { transform: scaleX(-1); }
.rv-empty { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 10px; padding: 34px; border-radius: 18px; border: 1px dashed var(--border-2); background: var(--card); height: 100%; }
.rv-empty h3 { margin: 0; font-size: 1.3rem; }
.rv-empty p { margin: 0; color: var(--text-2); }

/* Cards rise in when the section comes into view. */
.rv-anim .rv-in { opacity: 0; transform: translateY(18px); }
.rv-anim.rv-seen .rv-in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }
.rv-anim.rv-seen .rv-in:nth-child(2) { transition-delay: .08s; } .rv-anim.rv-seen .rv-in:nth-child(3) { transition-delay: .16s; }
.rv-anim.rv-seen .rv-in:nth-child(4) { transition-delay: .24s; }

/* ---- Read dialog ------------------------------------------------------------------------------- */
.rv-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 20px; background: transparent; color: var(--text); }
.rv-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.rv-dialog[open] { animation: rv-dialog-in .35s var(--ease); }
.rv-dialog[open]::backdrop { animation: rv-fade .3s ease; }
@keyframes rv-dialog-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes rv-fade { from { opacity: 0; } }
.rv-dialog .rv-card { box-shadow: var(--shadow-lg); padding: 28px; max-height: calc(100vh - 48px); overflow: auto; }
.rv-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg-soft); color: var(--text); display: grid; place-items: center; cursor: pointer; z-index: 1; }
[dir="rtl"] .rv-close { right: auto; left: 14px; }
.rv-close svg { width: 16px; height: 16px; }

/* ---- Reviews page ------------------------------------------------------------------------------ */
.rv-page { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 32px; align-items: start; padding: 32px 0 0; }
.rv-side { position: sticky; top: 88px; display: grid; gap: 16px; }
.rv-side .rv-score { text-align: start; align-items: stretch; padding: 26px; }
.rv-side .rv-score .rv-headline { display: flex; align-items: center; gap: 14px; }
.rv-bars { display: grid; gap: 6px; margin-top: 4px; }
.rv-bar { display: grid; grid-template-columns: 46px 1fr 34px; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: 500 .9rem var(--font); cursor: pointer; text-align: start; transition: background-color .15s; }
.rv-bar:hover { background: var(--card); }
.rv-bar[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.rv-bar .rv-n { display: inline-flex; align-items: center; gap: 4px; }
.rv-bar .rv-n svg { width: 13px; height: 13px; } .rv-bar .rv-n path { fill: var(--star); }
.rv-bar .rv-track-bar { height: 8px; border-radius: 99px; background: var(--star-off); overflow: hidden; }
.rv-bar .rv-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--star); transition: width 1s var(--ease); }
.rv-bar .rv-c { text-align: end; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rv-note { font-size: .86rem; color: var(--text-3); margin: 0; }
.rv-main { display: grid; gap: 18px; min-width: 0; }
.rv-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rv-toolbar h2 { font-size: 1.25rem; margin: 0; }
.rv-toolbar select { font: 500 .93rem var(--font); color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.rv-filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font: 600 .85rem var(--font); border: 0; cursor: pointer; }
.rv-filter-chip svg { width: 14px; height: 14px; }
.rv-list { display: grid; gap: 14px; }
.rv-list .rv-card { animation: rv-rise .55s var(--ease) both; }
@keyframes rv-rise { from { opacity: 0; transform: translateY(14px); } }
.rv-list .rv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rv-list .rv-date { color: var(--text-3); font-size: .85rem; }
.rv-list .rv-card .rv-who { margin-top: 0; padding-top: 0; }
.rv-list .rv-quote, .rv-panel .rv-quote { display: none; }
.rv-loadmore { justify-self: center; }
.rv-none { padding: 34px; text-align: center; border-radius: 18px; border: 1px dashed var(--border-2); color: var(--text-2); }
.rv-skel { height: 150px; border-radius: 18px; background: linear-gradient(90deg, var(--bg-soft) 0%, var(--card-2) 50%, var(--bg-soft) 100%); background-size: 200% 100%; animation: rv-shimmer 1.4s ease-in-out infinite; }
@keyframes rv-shimmer { to { background-position: -200% 0; } }

/* ---- Your review + the form -------------------------------------------------------------------- */
.rv-panel { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-sm); }
.rv-panel h2 { font-size: 1.25rem; margin: 0 0 4px; }
.rv-panel > p { color: var(--text-2); margin: 0 0 16px; }
.rv-mine-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.rv-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: .82rem; font-weight: 600; }
.rv-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rv-pill.wait { background: var(--rv-wait-soft); color: var(--rv-wait); }
.rv-pill.wait::before { animation: rv-blink 1.6s ease-in-out infinite; }
.rv-pill.ok { background: var(--rv-ok-soft); color: var(--rv-ok); }
.rv-pill.no { background: var(--ai-soft); color: var(--ai-ink); }
@keyframes rv-blink { 50% { opacity: .3; } }
.rv-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.rv-form { display: grid; gap: 18px; }
.rv-field { display: grid; gap: 6px; }
.rv-field > span, .rv-legend { font-weight: 600; font-size: .95rem; color: var(--text); }
.rv-field input, .rv-field textarea { width: 100%; font: 400 1rem/1.55 var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--border-2); border-radius: 12px; padding: 11px 14px; transition: border-color .15s, box-shadow .15s; }
.rv-field textarea { min-height: 140px; resize: vertical; }
.rv-field input:focus, .rv-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rv-count { justify-self: end; font-size: .82rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rv-count.low { color: var(--mixed-ink); }
.rv-as { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-soft); font-size: .9rem; color: var(--text-2); }
.rv-as b { color: var(--text); }
.rv-msg { padding: 10px 14px; border-radius: 10px; font-size: .93rem; }
.rv-msg.err { background: var(--ai-soft); color: var(--ai-ink); }

/* Star picker: five radio buttons drawn as stars. */
.rv-picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.rv-pick-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.rv-pick { display: inline-flex; gap: 6px; }
.rv-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rv-pick label { cursor: pointer; line-height: 0; padding: 2px; border-radius: 8px; transition: transform .18s var(--ease); }
.rv-pick label svg { width: 38px; height: 38px; display: block; }
.rv-pick label path { fill: var(--star-off); stroke: transparent; stroke-width: 1; transition: fill .18s, stroke .18s; }
.rv-pick label.lit path { fill: var(--star); }
.rv-pick label:hover { transform: scale(1.15) rotate(-6deg); }
.rv-pick input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.rv-pick label.burst { animation: rv-burst .45s var(--ease); }
@keyframes rv-burst { 40% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1); } }
.rv-pick-label { min-width: 110px; white-space: nowrap; font-weight: 600; color: var(--text-2); transition: color .2s; }
.rv-pick-label.set { color: var(--text); }

/* Thank-you state */
.rv-done { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 12px 0 4px; }
.rv-done svg { width: 64px; height: 64px; }
.rv-done circle { fill: none; stroke: var(--rv-ok); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: rv-draw .7s var(--ease) forwards; }
.rv-done path { fill: none; stroke: var(--rv-ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: rv-draw .45s .5s var(--ease) forwards; }
.rv-done h3 { margin: 8px 0 0; font-size: 1.25rem; }
.rv-done p { margin: 0; color: var(--text-2); max-width: 420px; }
@keyframes rv-draw { to { stroke-dashoffset: 0; } }

/* ---- After-check feedback card (inside the detector result, under the score) -------------------- */
.rv-inline { display: grid; grid-template-rows: 0fr; opacity: 0; margin-top: -12px; transition: grid-template-rows .55s var(--ease), opacity .45s ease, margin .55s var(--ease); }
.rv-inline.show { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.result.anim-in > .rv-inline { animation: none; }   /* our own opening animation, not the result's */
.rv-inline-in { position: relative; min-height: 0; overflow: hidden; padding: 16px 18px 14px; border-radius: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.rv-inline.show .rv-inline-in { animation: rv-glow 1.8s .5s ease-out 1; }
@keyframes rv-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.rv-inline h3 { font-size: 1rem; margin: 0 30px 2px 0; letter-spacing: -.01em; }
[dir="rtl"] .rv-inline h3 { margin: 0 0 2px 30px; }
.rv-inline p { margin: 0 0 8px; color: var(--text-2); font-size: .9rem; line-height: 1.5; }
.rv-inline .rv-pick-row { gap: 12px; margin-top: 0; flex-wrap: nowrap; }
.rv-inline .rv-pick label svg { width: 32px; height: 32px; }
.rv-inline .rv-pick label:not(.lit) path { fill: var(--border-2); }
.rv-inline .rv-pick-label { min-width: 0; font-size: .9rem; }
.rv-inline .rv-later { margin-top: 6px; background: none; border: 0; padding: 0; color: var(--text-3); font: 500 .85rem var(--font); cursor: pointer; }
.rv-inline .rv-later:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.rv-inline .rv-close { top: 8px; right: 8px; width: 30px; height: 30px; background: none; }
.rv-inline .rv-close:hover { background: var(--card); }
.rv-inline.picked .rv-inline-in { background: var(--rv-ok-soft); border-color: transparent; transition: background-color .3s; }

/* ---- Small screens ----------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .rv-track > .rv-card { flex-basis: calc((100% - 20px) / 2); }
}
@media (max-width: 900px) {
  .rv-home-grid, .rv-page { grid-template-columns: 1fr; }
  .rv-side { position: static; }
  .rv-score { flex-direction: row; flex-wrap: wrap; justify-content: center; text-align: center; }
  .rv-score .btn { width: auto; }
  .rv-home .rv-score .rv-big { font-size: 2.8rem; }
  .rv-side .rv-score { flex-direction: column; align-items: stretch; text-align: start; }
  .rv-side .rv-score .btn { width: 100%; }
}
@media (max-width: 640px) {
  .rv-track > .rv-card { flex-basis: 88%; min-height: 250px; }
  .rv-track { gap: 14px; }
  .rv-card { padding: 20px; }
  .rv-panel { padding: 20px; }
  .rv-pick label svg { width: 34px; height: 34px; }
  .rv-pick-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .rv-inline .rv-pick label svg { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .rv-track, .rv-card, .rv-bar .rv-fill, .rv-inline { transition: none !important; }
  .rv-stars.pop .fg svg, .rv-list .rv-card, .rv-inline.show .rv-inline-in, .rv-dialog[open], .rv-pick label.burst, .rv-skel { animation: none !important; }
  .rv-anim .rv-in { opacity: 1; transform: none; }
  .rv-carousel.playing .rv-dot.on::after { animation: none; transform: scaleX(1); }
}
