/*
  marmot-review.css: the "How's <App> working for you?" popup (marmot-review.js). Shared by all four apps.
  Every class is prefixed mr- (Marmot review). Never ad-: ad blockers hide those.

  Theme it by setting these on :root in the app's own CSS (see THEMES.md). Each one is optional:
  unset, it falls back to the light or dark default below (prefers-color-scheme).
    --mr-bg            the box's background                  (light #ffffff   / dark #16181d)
    --mr-text          title and body text                   (#101828         / #f2f4f7)
    --mr-muted         the secondary line, labels            (#475467         / #b4bcc8)
    --mr-border        box, textarea and Not now borders     (#e4e7ec         / #262a33)
    --mr-field         the textarea's background             (#ffffff         / #121418)
    --mr-accent        Send button, focus ring               (#15803d         / #4ade80)
    --mr-accent-hover  Send on hover                         (#166534         / #86efac)
    --mr-accent-text   text on the Send button               (#ffffff         / #0f1115)
    --mr-star          a filled star                         (#f5a524         / #fbbf24)
    --mr-star-edge     a filled or half star's outline       (#b45309         / #fbbf24)  3:1 or more on --mr-bg
    --mr-star-empty    an empty star's outline               (#858fa1         / #6b7385)  3:1 or more on --mr-bg
    --mr-bad           the "Couldn't send" line              (#c01048         / #fd6f8e)
    --mr-scrim         the dim behind the box                (rgba(16,24,40,.45) / rgba(0,0,0,.55))
    --mr-shadow        the box's shadow                      (0 12px 32px rgba(16,24,40,.16) / ... .5)
    --mr-radius        the box's corner radius               (14px)
    --mr-radius-sm     buttons' and the textarea's radius    (8px)
    --mr-font          font family                           (system-ui stack)
    --mr-z             the layer's z-index                   (480: over modals and toasts, under tours at 500)
*/

.mr-layer {
  --_bg: var(--mr-bg, #ffffff);
  --_text: var(--mr-text, #101828);
  --_muted: var(--mr-muted, #475467);
  --_border: var(--mr-border, #e4e7ec);
  --_field: var(--mr-field, #ffffff);
  --_accent: var(--mr-accent, #15803d);
  --_accent-hover: var(--mr-accent-hover, #166534);
  --_accent-text: var(--mr-accent-text, #ffffff);
  --_star: var(--mr-star, #f5a524);
  --_star-edge: var(--mr-star-edge, #b45309);
  --_star-empty: var(--mr-star-empty, #858fa1);
  --_bad: var(--mr-bad, #c01048);
  --_scrim: var(--mr-scrim, rgba(16, 24, 40, .45));
  --_shadow: var(--mr-shadow, 0 12px 32px rgba(16, 24, 40, .16));
  --_radius: var(--mr-radius, 14px);
  --_radius-sm: var(--mr-radius-sm, 8px);
  --_font: var(--mr-font, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);

  position: fixed;
  inset: 0;
  z-index: var(--mr-z, 480);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--_scrim);
  font-family: var(--_font);
  color: var(--_text);
  animation: mr-fade .14s ease-out;
}
@media (prefers-color-scheme: dark) {
  .mr-layer {
    --_bg: var(--mr-bg, #16181d);
    --_text: var(--mr-text, #f2f4f7);
    --_muted: var(--mr-muted, #b4bcc8);
    --_border: var(--mr-border, #262a33);
    --_field: var(--mr-field, #121418);
    --_accent: var(--mr-accent, #4ade80);
    --_accent-hover: var(--mr-accent-hover, #86efac);
    --_accent-text: var(--mr-accent-text, #0f1115);
    --_star: var(--mr-star, #fbbf24);
    --_star-edge: var(--mr-star-edge, #fbbf24);
    --_star-empty: var(--mr-star-empty, #6b7385);
    --_bad: var(--mr-bad, #fd6f8e);
    --_scrim: var(--mr-scrim, rgba(0, 0, 0, .55));
    --_shadow: var(--mr-shadow, 0 12px 32px rgba(0, 0, 0, .5));
  }
}
html.mr-lock, html.mr-lock body { overflow: hidden; }
.mr-layer.mr-leaving { animation: mr-fade-out .15s ease-in forwards; pointer-events: none; }

.mr-box {
  box-sizing: border-box;
  width: min(26rem, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--_bg);
  color: var(--_text);
  border: 1px solid var(--_border);
  border-radius: var(--_radius);
  box-shadow: var(--_shadow);
  padding: 1.25rem 1.25rem 1.1rem;
  text-align: left;
  animation: mr-in .16s ease-out;
}
.mr-box:focus { outline: none; }
.mr-box *, .mr-box *::before, .mr-box *::after { box-sizing: border-box; }

.mr-title { margin: 0 0 .4rem; font-size: 1.1rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; color: var(--_text); }
.mr-text { margin: 0; font-size: .92rem; line-height: 1.45; color: var(--_muted); overflow-wrap: anywhere; }

/* The stars: a slider. Each star is 40px drawn inside a 44px tap target. */
.mr-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 1rem auto .15rem;
  width: max-content;
  max-width: 100%;
  padding: 2px 4px;
  border-radius: var(--_radius-sm);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.mr-stars:focus { outline: none; }
.mr-stars:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }
.mr-star { position: relative; display: block; width: 44px; height: 44px; flex: 0 0 auto; }
.mr-star svg { position: absolute; top: 2px; left: 2px; width: 40px; height: 40px; pointer-events: none; }
.mr-star-base path { fill: transparent; stroke: var(--_star-empty); stroke-width: 1.5; stroke-linejoin: round; }
.mr-star-fill { position: absolute; inset: 0; width: 0; overflow: hidden; pointer-events: none; }
.mr-star-top path { fill: var(--_star); stroke: var(--_star-edge); stroke-width: 1.5; stroke-linejoin: round; }
/* (the fill layer is clipped at the star's middle for a half: the star itself is 2..42px of the 44px box) */
.mr-star.mr-half .mr-star-fill { width: 22px; }
.mr-star.mr-full .mr-star-fill { width: 100%; }
.mr-star.mr-full .mr-star-base path, .mr-star.mr-half .mr-star-base path { stroke: var(--_star-edge); }
.mr-stars.mr-previewing .mr-star-top path { opacity: .7; }
@media (hover: hover) { .mr-stars:hover .mr-star { transition: transform .08s ease-out; } }

.mr-pick { min-height: 1.3em; margin: 0 0 .9rem; text-align: center; font-size: .86rem; font-weight: 600; color: var(--_muted); font-variant-numeric: tabular-nums; }
.mr-pick.mr-pick-set { color: var(--_text); }

.mr-label { display: block; margin: 0 0 .35rem; font-size: .86rem; font-weight: 600; color: var(--_text); }
.mr-optional { font-weight: 400; color: var(--_muted); }
.mr-note {
  display: block;
  width: 100%;
  min-height: 4.6rem;
  max-height: 40vh;
  resize: vertical;
  margin: 0;
  padding: .55rem .65rem;
  font: 1rem/1.4 var(--_font); /* 16px: no zoom-on-focus on iPhone */
  color: var(--_text);
  background: var(--_field);
  border: 1px solid var(--_border);
  border-radius: var(--_radius-sm);
}
.mr-note::placeholder { color: var(--_muted); }
.mr-note:focus { outline: 2px solid var(--_accent); outline-offset: -1px; border-color: transparent; }

.mr-err { margin: .6rem 0 0; font-size: .86rem; color: var(--_bad); }
.mr-err[hidden], .mr-form[hidden], .mr-thanks[hidden] { display: none; }

.mr-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.mr-btn {
  appearance: none;
  min-width: 5.5rem;
  min-height: 40px;
  padding: .55rem .95rem;
  font: 600 .92rem/1.2 var(--_font);
  border-radius: var(--_radius-sm);
  border: 1px solid var(--_border);
  background: transparent;
  color: var(--_text);
  cursor: pointer;
}
.mr-btn:focus { outline: none; }
.mr-btn:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }
.mr-later:hover:not(:disabled) { background: color-mix(in srgb, var(--_text) 6%, transparent); }
.mr-send { background: var(--_accent); border-color: var(--_accent); color: var(--_accent-text); }
.mr-send:hover:not(:disabled) { background: var(--_accent-hover); border-color: var(--_accent-hover); }
.mr-btn:disabled { opacity: .5; cursor: not-allowed; }

.mr-thanks { padding: .6rem 0 .3rem; text-align: center; }
.mr-thanks .mr-text { text-align: center; }
.mr-thanks-title { margin: .35rem 0 .3rem; font-size: 1.15rem; font-weight: 700; color: var(--_text); }
.mr-tick { width: 44px; height: 44px; }
.mr-tick path { fill: none; stroke: var(--_accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Phone: a sheet along the bottom, over the safe area. */
@media (max-width: 480px) {
  .mr-layer { align-items: flex-end; padding: 0; }
  .mr-box {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--_radius) var(--_radius) 0 0;
    border-bottom: 0;
    padding: 1.1rem 16px calc(1rem + env(safe-area-inset-bottom));
    animation-name: mr-up;
  }
  .mr-foot .mr-btn { flex: 1 1 0; }
}
@media (max-width: 340px) {
  .mr-star { width: 40px; height: 40px; }
  .mr-star svg { top: 2px; left: 2px; width: 36px; height: 36px; }
  .mr-star.mr-half .mr-star-fill { width: 20px; }
  .mr-stars { gap: 2px; }
}

@keyframes mr-fade { from { opacity: 0; } }
@keyframes mr-fade-out { to { opacity: 0; } }
@keyframes mr-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes mr-up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .mr-layer, .mr-layer.mr-leaving, .mr-box { animation: none; }
}
@media (forced-colors: active) {
  .mr-star-top path { fill: CanvasText; stroke: CanvasText; }
  .mr-star-base path { stroke: CanvasText; }
}
