:root {
  --fondo: #ffffff;
  --ink: #141418;
  --ink-2: #5d5f68;
  --ink-3: #9a9ca5;
  --line: #ebecef;
  --panel: #fbfbfc;
  --accent: #ff5b3a;          /* the crop frame and the broken line */
  --accent-soft: #ffe7e0;
  --pill: #17171b;
  --pill-2: #26262c;
  --ok: #2fb46c;
  --chart: #4b5cf0;
  --chart-soft: rgba(75, 92, 240, 0.12);
}

* { box-sizing: border-box; }
html { font-size: clamp(13px, min(1.35vw, 2.4vh), 17px); }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--ink);
  font-family: "Geist Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.mono { font-family: "Geist Mono Variable", ui-monospace, monospace; font-size: 0.92em; letter-spacing: 0.01em; }

.wrap {
  position: relative;
  width: min(23.5rem, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
}

/* ---- the panel of the app ---- */
.panel {
  position: relative;
  width: 100%;
  padding: 0.95rem 1rem 0.9rem;
  border-radius: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 12px 28px -18px rgba(20, 20, 24, 0.22), 0 2px 4px -2px rgba(20, 20, 24, 0.06);
}
.panel__top { display: flex; align-items: center; justify-content: space-between; }
.panel__title { font-size: 0.78rem; font-weight: 560; color: var(--ink-2); letter-spacing: 0.005em; }
.panel__chip {
  font-size: 0.66rem; font-weight: 520; color: var(--ink-2);
  padding: 0.22rem 0.55rem; border-radius: 999px; background: #fff; border: 1px solid var(--line);
}
.panel__value { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.3rem 0 0.55rem; }
.panel__value b { font-size: 1.45rem; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.panel__value i { font-style: normal; font-size: 0.72rem; font-weight: 560; color: var(--ok); }
.panel__chart { position: relative; height: 4.6rem; }
.panel__chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.panel__chart .grid { stroke: var(--line); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.panel__chart .area { fill: var(--chart-soft); }
.panel__chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.panel__chart .line--broken { stroke: #c9cbd3; stroke-dasharray: 3 5; }
.panel__error {
  position: absolute; right: 0.1rem; bottom: 0.15rem;
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.64rem; font-weight: 540; color: #c2462d;
  padding: 0.2rem 0.5rem 0.2rem 0.35rem; border-radius: 999px;
  background: var(--accent-soft);
}
.panel__error svg { width: 0.8rem; height: 0.8rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.panel__dim {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: rgba(20, 20, 24, 0.32); opacity: 0;
}
.flash {
  position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: #fff; opacity: 0;
}
.frame {
  position: absolute; left: 0; top: 0; width: 10px; height: 10px; pointer-events: none;
  opacity: 0;
  border-radius: 0.4rem;
  box-shadow: 0 0 0 1px rgba(255, 91, 58, 0.9), 0 0 0 999px rgba(20, 20, 24, 0);
}
.frame__c { position: absolute; width: 0.75rem; height: 0.75rem; border: 2.5px solid var(--accent); }
.frame__c--tl { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-radius: 0.45rem 0 0 0; }
.frame__c--tr { right: -3px; top: -3px; border-left: 0; border-bottom: 0; border-radius: 0 0.45rem 0 0; }
.frame__c--bl { left: -3px; bottom: -3px; border-right: 0; border-top: 0; border-radius: 0 0 0 0.45rem; }
.frame__c--br { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-radius: 0 0 0.45rem 0; }
.frame__size {
  position: absolute; left: 50%; top: calc(100% + 0.4rem); transform: translateX(-50%);
  font-family: "Geist Mono Variable", ui-monospace, monospace; font-size: 0.6rem; font-weight: 500;
  color: #fff; background: var(--accent); padding: 0.14rem 0.4rem; border-radius: 0.3rem; white-space: nowrap;
}

/* ---- the crop that flies ---- */
.crop {
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5;
  border-radius: 0.5rem; visibility: hidden;
  box-shadow: 0 14px 30px -12px rgba(20, 20, 24, 0.45), 0 0 0 1px rgba(20, 20, 24, 0.08);
  transform-origin: 0 0;
}
.crop__in { position: absolute; inset: 0; border-radius: inherit; clip-path: inset(0 round 0.5rem); background: var(--panel); }
.crop__in .panel { position: absolute; margin: 0; box-shadow: none; }

/* ---- the pill ---- */
.pill {
  position: relative; height: 60px; border-radius: 999px;
  --mx: 50%; --my: 50%;
}
.pill__halo {
  position: absolute; inset: 6px 10px -6px; border-radius: inherit; pointer-events: none;
  background: rgba(20, 20, 24, 0.5); filter: blur(14px); opacity: 0.55;
}
.pill__body {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  background: linear-gradient(180deg, var(--pill-2), var(--pill) 62%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -1px 0 rgba(0, 0, 0, 0.4), 0 1px 2px rgba(20, 20, 24, 0.2);
}
.pill__grain {
  position: absolute; inset: 0; opacity: 0.08; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}
.pill__light {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.35s ease;
  background: radial-gradient(9rem 4rem at var(--mx) var(--my), rgba(255, 140, 110, 0.22), transparent 70%);
}
@media (hover: hover) {
  .pill:hover .pill__light { opacity: 1; }
}

.ask {
  position: absolute; inset: 0; width: 100%;
  appearance: none; border: 0; background: none; padding: 0 1.55rem 0 1.35rem; margin: 0;
  font: inherit; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  border-radius: inherit;
}
.ask:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ask__in { display: inline-flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.ask__word { font-size: 1rem; font-weight: 560; letter-spacing: -0.005em; }
.bug { width: 1.4rem; height: 1.4rem; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.bug__body { fill: rgba(255, 91, 58, 0.28); stroke: #ff8a6e; }
.bug__seam { stroke: #ff8a6e; opacity: 0.8; }
.bug__head { stroke: #ff8a6e; }
.bug__legs path, .bug__ant { stroke: rgba(255, 255, 255, 0.82); }
.bug__legs { transform-origin: 12px 13.6px; }

/* ---- the form inside the open pill ---- */
.form {
  position: absolute; inset: 0; margin: 0;
  display: flex; align-items: center; gap: 0.7rem; padding: 0 0.55rem 0 0.6rem;
  opacity: 0; visibility: hidden;
}
.form__thumb {
  position: relative; flex: 0 0 auto; width: 4rem; height: 2.6rem; border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
}
.form__thumbin { position: absolute; inset: 0; border-radius: inherit; clip-path: inset(0 round 0.55rem); background: var(--panel); }
.form__thumbin .panel { position: absolute; margin: 0; box-shadow: none; transform-origin: 0 0; }
.form__clip {
  position: absolute; right: -0.4rem; top: -0.4rem; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent);
  box-shadow: 0 0 0 2px var(--pill);
}
.form__clip svg { width: 0.7rem; height: 0.7rem; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.form__field { position: relative; flex: 1 1 auto; min-width: 0; height: 100%; display: flex; align-items: center; }
.form__input {
  width: 100%; border: 0; background: none; color: #fff; outline: none;
  font: inherit; font-size: 0.92rem; font-weight: 460; letter-spacing: -0.003em; padding: 0;
  caret-color: transparent;
}
.form__input::placeholder { color: rgba(255, 255, 255, 0.42); }
.form__caret {
  position: absolute; left: 0; top: 50%; width: 1.5px; height: 1.15rem; margin-top: -0.575rem;
  background: var(--accent); border-radius: 1px; opacity: 0;
}
.send {
  flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #ff6f4f, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(255, 91, 58, 0.8);
  -webkit-tap-highlight-color: transparent;
}
.send:disabled { cursor: default; }
.send:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.send svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- done ---- */
.done {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 0.75rem; padding: 0 1.4rem 0 0.75rem;
  color: #fff; opacity: 0; visibility: hidden;
}
.done__badge {
  flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center;
  background: rgba(47, 180, 108, 0.16); box-shadow: inset 0 0 0 1px rgba(47, 180, 108, 0.55);
}
.done__badge svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: #5fd896; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.done__lines { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.done__lines b { font-size: 0.95rem; font-weight: 580; white-space: nowrap; }
.done__lines i { font-style: normal; font-size: 0.7rem; color: rgba(255, 255, 255, 0.56); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the pilot's pointer */
.pointer {
  position: absolute; left: 0; top: 0; width: 1.25rem; height: 1.25rem; z-index: 9; pointer-events: none;
  opacity: 0; filter: drop-shadow(0 2px 3px rgba(20, 20, 24, 0.3));
}
.pointer svg { width: 100%; height: 100%; fill: #fff; stroke: #141418; stroke-width: 1.3; stroke-linejoin: round; }

@media (max-width: 420px) {
  .ask__word { font-size: 0.95rem; }
  .form__input { font-size: 0.85rem; }
  .done__lines b { font-size: 0.88rem; }
}
