:root {
  --page: #f1efea;
  --paper: #ffffff;
  --ink: #17171a;
  --soft: #55524c;
  --muted: #9a958c;
  --faint: #d3cfc6;
  --line: rgba(23, 23, 26, 0.08);
  --accent: #ffc21a;
  --mark: rgba(255, 199, 38, 0.5);
  --mark-hot: rgba(255, 190, 20, 0.78);
  --glow: rgba(255, 196, 30, 0.55);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(120% 80% at 50% 0%, #f7f5f1 0%, var(--page) 62%, #e9e6df 100%);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 32px) clamp(12px, 3vw, 32px);
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ the panel */
.doc {
  position: relative;
  width: min(476px, 100%);
  padding: clamp(13px, min(4.2vw, 3.4vh), 22px);
  border-radius: clamp(14px, 3.6vw, 20px);
  background: var(--paper);
  box-shadow:
    0 0 0 1px rgba(23, 23, 26, 0.06),
    0 1px 1px rgba(23, 23, 26, 0.04),
    0 6px 14px -6px rgba(40, 32, 12, 0.12),
    0 28px 60px -24px rgba(40, 32, 12, 0.22);
  opacity: 0;
}
.doc::before {
  /* the top edge catching the light */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0) 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.doc__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(60% 40% at 18% 0%, rgba(255, 214, 90, 0.10), transparent 70%);
}

.doc__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: clamp(10px, 2.4vh, 15px);
  border-bottom: 1px solid var(--line);
}
.doc__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(28px, 4.4vh, 34px);
  aspect-ratio: 1;
  border-radius: 9px;
  background: linear-gradient(180deg, #fbfaf7, #f1eee8);
  box-shadow: inset 0 0 0 1px rgba(23, 23, 26, 0.07), 0 1px 2px rgba(23, 23, 26, 0.06);
}
.doc__icon svg { width: 58%; fill: none; stroke: var(--soft); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.doc__title { display: grid; gap: 1px; min-width: 0; flex: 1; }
.doc__name {
  font-size: clamp(12.5px, min(3.6vw, 2.6vh), 14.5px);
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.01em;
}
.doc__meta { font-size: clamp(10.5px, min(2.9vw, 2.2vh), 12px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.doc__status {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: clamp(24px, 3.8vh, 28px);
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: #f6f4ef;
  box-shadow: inset 0 0 0 1px rgba(23, 23, 26, 0.07);
  font-size: clamp(10.5px, min(2.9vw, 2.2vh), 12px);
  font-weight: 560;
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
}
.doc__spark { width: 11px; fill: var(--accent); filter: drop-shadow(0 0 3px var(--glow)); }
.doc__ok { position: absolute; left: 7px; width: 13px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.doc__ok path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.doc__status-words {
  display: inline-block;
  background: linear-gradient(90deg, var(--soft) 0 40%, #d9d4ca 50%, var(--soft) 60% 100%);
  background-size: 250% 100%;
  background-position: var(--shine, 100%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ------------------------------------------------------------------ the clause */
.doc__body {
  position: relative;
  padding: clamp(10px, 2.6vh, 18px) 0 clamp(10px, 2.4vh, 16px);
}
.doc__text {
  margin: 0;
  font-size: clamp(12.2px, min(3.55vw, 2.75vh), 15.5px);
  line-height: 1.66;
  font-stretch: 96%;
  letter-spacing: -0.003em;
  color: var(--ink);
  overflow: hidden;
}
.w {
  display: inline;
  color: var(--faint);
  transition: color 0.35s ease, opacity 0.35s ease;
}
.doc__text.is-read .w { color: var(--ink); }
.doc__text.is-focus .w:not(.is-hot .w) { color: #bdb8ae; }

.flag {
  cursor: pointer;
  outline: none;
  border-radius: 4px;
}
.flag .w {
  background-image: linear-gradient(var(--mk, var(--mark)), var(--mk, var(--mark)));
  background-repeat: no-repeat;
  background-size: calc(var(--m, 0) * 100%) 80%;
  background-position: 0 62%;
}
.flag .old .w:first-child { border-radius: 3px 0 0 3px; padding-left: 0.14em; margin-left: -0.14em; }
.flag .old .w:last-child { border-radius: 0 3px 3px 0; padding-right: 0.14em; margin-right: -0.14em; }
.flag.is-hot .w { --mk: var(--mark-hot); }
.flag:focus-visible .w { --mk: var(--mark-hot); }
.flag .new { display: none; }
.flag.is-fixed { cursor: default; }
.flag.is-fixed .old { display: none; }
.flag.is-fixed .new { display: inline; }
.flag .new .w {
  /* the fixed wording keeps a hairline of the accent under it */
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: calc(var(--u, 0) * 100%) 1.5px;
  background-position: 0 92%;
  color: var(--ink);
}
.flag__ok {
  display: inline-block;
  width: 0.92em;
  height: 0.92em;
  margin-left: 0.18em;
  vertical-align: -0.1em;
  margin-right: -0.1em;
}
.flag__ok path { fill: none; stroke: #c98f00; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

.doc__scan {
  position: absolute;
  left: -6px;
  right: -6px;
  top: 0;
  height: 22px;
  margin-top: -11px;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255, 194, 26, 0.9) 18%, rgba(255, 236, 170, 1) 50%, rgba(255, 194, 26, 0.9) 82%, transparent) center / 100% 1px no-repeat,
    radial-gradient(50% 50% at 50% 50%, rgba(255, 205, 60, 0.22), transparent 70%);
}
.doc__head-light {
  /* the bright tip of the marker of light */
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 26px;
  margin: -13px 0 0 -9px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(closest-side, rgba(255, 250, 225, 1), rgba(255, 205, 50, 0.7) 45%, rgba(255, 196, 30, 0) 100%);
  filter: blur(1.5px);
  mix-blend-mode: multiply;
}
.doc__head-light::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 14%;
  bottom: 14%;
  width: 1.5px;
  margin-left: -0.75px;
  border-radius: 2px;
  background: #f0a800;
}

/* ------------------------------------------------------------------ the foot */
.doc__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: clamp(10px, 2.4vh, 15px);
  border-top: 1px solid var(--line);
  font-size: clamp(10.5px, min(2.9vw, 2.2vh), 12px);
  color: var(--muted);
}
.doc__label { font-weight: 560; color: var(--soft); }
.doc__track {
  position: relative;
  flex: 1;
  max-width: 150px;
  height: 4px;
  border-radius: 4px;
  background: #efece6;
  box-shadow: inset 0 0 0 1px rgba(23, 23, 26, 0.04);
  overflow: hidden;
}
.doc__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd65a, var(--accent));
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.doc__score { min-width: 2ch; font-variant-numeric: tabular-nums; font-weight: 620; color: var(--ink); }
.doc__brand { margin-left: auto; white-space: nowrap; }

/* ------------------------------------------------------------------ the note */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: min(272px, calc(100% - 20px));
  padding: 11px 12px 11px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow:
    0 0 0 1px rgba(23, 23, 26, 0.07),
    0 2px 4px rgba(23, 23, 26, 0.05),
    0 14px 34px -10px rgba(40, 32, 12, 0.3);
  display: grid;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: 50% 100%;
}
.tip.is-open { visibility: visible; pointer-events: auto; }
.tip__caret {
  position: absolute;
  left: 30px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.96);
  transform: rotate(45deg);
  box-shadow: 1px 1px 0 rgba(23, 23, 26, 0.06);
}
.tip.is-below .tip__caret { bottom: auto; top: -5px; box-shadow: -1px -1px 0 rgba(23, 23, 26, 0.06); }
.tip__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 640;
  font-stretch: 108%;
  color: #a77400;
  letter-spacing: 0.01em;
}
.tip__note { font-size: 12px; line-height: 1.42; color: var(--soft); }
.tip__rule { height: 1px; margin: 4px 0 3px; background: var(--line); }
.tip__row { display: flex; align-items: center; gap: 10px; }
.tip__fix { display: grid; gap: 1px; flex: 1; min-width: 0; }
.tip__fix-label { font-size: 10px; color: var(--muted); }
.tip__fix-words { font-size: 12px; font-weight: 560; line-height: 1.3; color: var(--ink); }
.tip__btn {
  flex: none;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.tip__btn-face {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2a2f, #121215);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  font-stretch: 104%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 10px -4px rgba(0, 0, 0, 0.4);
}
.tip__btn:focus-visible .tip__btn-face { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .tip__btn:hover .tip__btn-face { background: linear-gradient(180deg, #34343a, #18181c); }
}
