:root {
  --page: #f3f1ec;
  --panel: #ffffff;
  --ink: #17181c;
  --soft: #5d606a;
  --faint: #9a9ca5;
  --line: rgba(23, 24, 28, 0.09);
  --field: #f7f7f8;
  --good: #2f9a68;
  --warn: #d4841a;
  --short: #8a8f9c;
  --over-wash: rgba(232, 150, 40, 0.2);
  --accent: #4b5bdc;
  --link: #2a3fd6;
  --url: #4d5156;
  --snippet: #4d5156;
  --ui: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  --serp: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  background:
    radial-gradient(120% 70% at 50% 0%, #fbfaf7 0%, rgba(251, 250, 247, 0) 60%),
    var(--page);
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
}

/* the panel: GSAP never touches it, the script only sets its scale to fit short screens */
.panel {
  position: relative;
  width: min(600px, 100%);
  padding: 22px 22px 20px;
  background: var(--panel);
  border-radius: 22px;
  border: 1px solid rgba(23, 24, 28, 0.07);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(23, 24, 28, 0.05),
    0 8px 20px -8px rgba(23, 24, 28, 0.12),
    0 30px 60px -24px rgba(23, 24, 28, 0.18);
  transform-origin: 50% 50%;
  overflow: hidden;
}

.panel__shine {
  position: absolute;
  inset: 0 0 auto 0;
  height: 120px;
  background: radial-gradient(70% 100% at 30% 0%, rgba(75, 91, 220, 0.07), rgba(75, 91, 220, 0) 70%);
  pointer-events: none;
}

/* header */
.head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.head__app {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #22242b, #0f1014);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 4px 10px -4px rgba(15, 16, 20, 0.6);
  flex: none;
}

.head__app svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #f3f1ec;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.head__meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.head__app-name { font-size: 12px; color: var(--faint); font-weight: 500; letter-spacing: 0.01em; }
.head__title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }

.head__post {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--soft);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* fields */
.field { margin-bottom: 14px; }

.field__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.field__label { font-size: 13px; font-weight: 600; }

.badge {
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  display: inline-block;
}

.badge__in {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--short);
  background: rgba(138, 143, 156, 0.12);
  white-space: nowrap;
}

.badge__icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge__icon[hidden] { display: none; }

.box {
  position: relative;
  border-radius: 12px;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(23, 24, 28, 0.04) inset;
  transition: border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
}

.box.is-focus {
  background: #ffffff;
  border-color: rgba(75, 91, 220, 0.55);
  box-shadow: 0 0 0 4px rgba(75, 91, 220, 0.12);
}

.box.is-over.is-focus {
  border-color: rgba(212, 132, 26, 0.6);
  box-shadow: 0 0 0 4px rgba(212, 132, 26, 0.13);
}

.box__mirror,
.box__input {
  display: block;
  width: 100%;
  font: 500 15px/22px var(--ui);
  letter-spacing: 0;
  padding: 10px 13px;
  border: 0;
  background: transparent;
  outline: none;
}

.box__mirror {
  position: absolute;
  inset: 0;
  white-space: pre;
  overflow: hidden;
  color: var(--ink);
  pointer-events: none;
}

.box__input {
  position: relative;
  color: transparent;
  caret-color: var(--ink);
  resize: none;
}

.box__input::placeholder { color: var(--faint); }
.box__input::selection { background: rgba(75, 91, 220, 0.2); color: transparent; }

.box--area .box__mirror,
.box--area .box__input {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  height: 76px;
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
}

.over {
  background: var(--over-wash);
  color: #8a4f06;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.caret {
  display: inline-block;
  width: 1.5px;
  height: 18px;
  margin-left: 1px;
  vertical-align: -3px;
  background: var(--ink);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.meter__track {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(23, 24, 28, 0.07);
  overflow: hidden;
}

.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: var(--short);
  box-shadow: 0 0 10px -1px currentColor;
}

/* the limit sits at 85% of the track, so going over has room to show */
.meter__mark {
  position: absolute;
  left: 85%;
  top: -2px;
  bottom: -2px;
  width: 1.5px;
  background: rgba(23, 24, 28, 0.25);
}

.meter__count {
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 118px;
  text-align: right;
}

.meter__count span { color: var(--soft); font-weight: 600; }

/* preview */
.preview {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.preview__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.preview__label { font-size: 13px; font-weight: 600; }

.seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--line);
}

.seg__pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(23, 24, 28, 0.1), 0 2px 8px -2px rgba(23, 24, 28, 0.14);
}

.seg__btn {
  position: relative;
  border: 0;
  background: none;
  font: 600 11.5px/1 var(--ui);
  color: var(--soft);
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s;
}

.seg__btn.is-on { color: var(--ink); }
.seg__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.result-wrap {
  position: relative;
  border-radius: 14px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  padding: 14px 16px;
  overflow: hidden;
}

/* the result keeps the real width of a search result (600 px) and is scaled to fit */
.result {
  width: 600px;
  transform-origin: 0 0;
  font-family: var(--serp);
}

.result.is-mobile {
  padding: 12px 14px 14px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 24, 28, 0.08), 0 6px 18px -8px rgba(23, 24, 28, 0.16);
}

.result__site { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

.result__fav {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 13px/1 var(--ui);
  color: #ffffff;
  background: linear-gradient(150deg, #2f6b8f, #173a52);
  box-shadow: 0 0 0 1px rgba(23, 24, 28, 0.06);
  flex: none;
}

.result__who { display: flex; flex-direction: column; line-height: 1.25; }
.result__name { font-size: 14px; color: #202124; }

.result__url {
  font-size: 12px;
  color: var(--url);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.result__url svg { width: 8px; height: 8px; fill: none; stroke: var(--url); stroke-width: 1.2; }

.result__title {
  font: 400 20px/26px var(--serp);
  color: var(--link);
  margin-bottom: 4px;
  min-height: 26px;
  white-space: nowrap;
}

.result.is-mobile .result__title {
  font-size: 18px;
  line-height: 24px;
  white-space: normal;
}

.result__desc {
  font: 400 14px/22px var(--serp);
  color: var(--snippet);
  min-height: 22px;
}

.rw {
  display: inline-block;
  white-space: pre;
}

.rw.is-ghost { color: var(--faint); }

.rdots { display: inline-block; }

@media (hover: hover) {
  .result-wrap:hover .result__title { color: #1a2ab8; }
  .seg__btn:hover { color: var(--ink); }
}

/* the pointer of the pilot */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  fill: #ffffff;
  stroke: #17181c;
  stroke-width: 1.1;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.28));
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .panel { padding: 16px 15px 15px; border-radius: 18px; }
  .head { margin-bottom: 13px; }
  .head__post { display: none; }
  .meter__count { min-width: 0; }
}

/* in a short box the meta description gives its room to the preview */
@media (max-height: 560px) {
  .field[data-field="desc"] { display: none; }
  .head { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
}
