/* App.Hello.Nexus — hi.agentic.ge
   Phone-first, light, warm. Half of this is seen by someone who has just been
   handed a stranger's phone, so it has to read as friendly and above-board in
   under a second: paper-white surfaces, soft shadows instead of hard rules, and
   one warm accent doing all the work.

   Deliberately light-only — no prefers-color-scheme switch. The screen she sees
   should look the same every time, whatever your phone is set to. */

:root {
  --paper: #fbf7f6;
  --surface: #ffffff;
  --surface-2: #fdf4f5;
  --line: rgba(46, 36, 52, 0.09);
  --text: #2e2434;
  --muted: #877c92;
  --rose: #f26d8a;
  --peach: #ffb98a;
  --ink-on-accent: #40142a;
  --good: #2aa079;
  --amber: #c07a35;
  --radius: 22px;
  --tap: 0.06s;

  /* Smooth, not sharp: depth comes from shadow, never from a heavy border. */
  --shadow-sm: 0 1px 2px rgba(46, 36, 52, 0.04), 0 6px 16px -10px rgba(46, 36, 52, 0.16);
  --shadow-md: 0 2px 5px rgba(46, 36, 52, 0.05), 0 18px 38px -20px rgba(46, 36, 52, 0.28);
  --ring: 0 0 0 3px rgba(242, 109, 138, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* The paint lives on <html>, not <body>: it propagates to the canvas, so an
   overscroll bounce or a short page shows the wash instead of flat white — and
   it leaves body's own layer free for the ornament to sit behind the content. */
html {
  height: 100%;
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 80% at 12% -10%, #fde8ee 0%, transparent 62%),
    radial-gradient(100% 72% at 96% 104%, #ece7fa 0%, transparent 58%),
    linear-gradient(170deg, #fffdfc, #f7f1f3);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body {
  min-height: 100%;
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Georgian", "Noto Sans Georgian",
    "BPG Arial", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* Flourish anchored to the bottom of the viewport, behind everything. */
body::after {
  content: "";
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(190vw, 1200px);
  height: min(42vh, 330px);
  transform: translateX(-50%);
  background: url("/ornament.svg") center bottom / 100% 100% no-repeat;
  opacity: 0.9;
  pointer-events: none;
  z-index: -1;
}

.view {
  display: none;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  flex-direction: column;
}
.view.is-active {
  display: flex;
}

/* ------------------------------------------------------------------ shared */

/* Deep plum on the warm gradient, not white — white on this much light peach
   sits under 3:1 and goes muddy in sunlight. */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 18px 26px;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 19px;
  color: var(--ink-on-accent);
  background: linear-gradient(135deg, var(--peach), var(--rose));
  box-shadow: 0 10px 26px -12px rgba(242, 109, 138, 0.75);
  transition: transform var(--tap) ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.btn:active {
  transform: scale(0.97);
  box-shadow: 0 6px 16px -12px rgba(242, 109, 138, 0.7);
}
.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  padding: 14px 22px;
}
.btn--danger {
  background: var(--surface);
  color: #cc4a5c;
  border: 1px solid rgba(204, 74, 92, 0.22);
  box-shadow: none;
  font-weight: 600;
}

.field {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field::placeholder {
  color: var(--muted);
}
.field:focus {
  outline: none;
  border-color: rgba(242, 109, 138, 0.55);
  box-shadow: var(--shadow-sm), var(--ring);
}
textarea.field {
  resize: vertical;
  min-height: 92px;
}

/* -------------------------------------------------------------------- gate */

.gate {
  justify-content: center;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.gate__mark {
  font-size: 54px;
  line-height: 1;
}
.gate form {
  width: min(340px, 100%);
  display: grid;
  gap: 12px;
}
.gate__error {
  color: #cc4a5c;
  font-size: 15px;
  min-height: 22px;
  margin: 0;
}
.gate__lock {
  width: 46px;
  height: 46px;
  color: var(--rose);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gate__hint {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}
.back--center {
  justify-self: center;
  display: inline-block;
}

/* ------------------------------------------------------------------ kiosk */

.kiosk {
  gap: 14px;
  justify-content: space-between;
  user-select: none;
  -webkit-user-select: none;
}
.kiosk__head {
  text-align: center;
  padding-top: 8px;
}

/* One word per line, each its own element. */
.kiosk__hook {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin: 0 0 14px;
  font-size: clamp(30px, 9.8vw, 44px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.01em;
}
/* The sign-off — smaller, rose, given a little air above it. No tracking:
   `<3` needs its two characters to stay a single glyph pair, not "< 3".
   It also carries a slow lub-dub, because it is, after all, a heart. */
.kiosk__hook span:last-child {
  font-size: 0.74em;
  color: var(--rose);
  letter-spacing: -0.07em;
  margin-top: 12px;
  animation: heartbeat 2.8s ease-in-out infinite;
}
/* When the heart is the whole hook it carries the screen alone — let it be
   bigger than the words ever were, and drop the sign-off's top margin. */
.kiosk__hook span:only-child {
  font-size: 1.3em;
  margin-top: 0;
}
@keyframes heartbeat {
  0%, 26%, 100% {
    transform: scale(1);
  }
  8% {
    transform: scale(1.14);
  }
  14% {
    transform: scale(1.02);
  }
  20% {
    transform: scale(1.09);
  }
}

.kiosk__ask {
  margin: 0;
  color: var(--muted);
  font-size: clamp(13px, 3.7vw, 15px);
  letter-spacing: 0.05em;
}

/* Hugs the line above it instead of centring in the leftover space — on a tall
   screen centring opened a void between the ask and the field, and once the
   keyboard is up, higher is safer anyway. flex: 1 still pins the footer down. */
.entry {
  display: grid;
  gap: 12px;
  flex: 1;
  align-content: start;
  padding-top: clamp(8px, 3vh, 26px);
}
.entry .field {
  text-align: center;
  font-size: 16px;
  padding: 13px 14px;
}

/* "ან" — either will do, and she only has to fill one. */
.or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.1em;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(46, 36, 52, 0.14), transparent);
}

/* Icon-prefixed field. Padding is symmetric so the centred text stays centred
   even though the icon only sits on one side. */
.input-row {
  position: relative;
  display: block;
}
.input-row__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  color: #b0a5bb;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: color 0.15s ease;
  z-index: 1;
}
.input-row:focus-within .input-row__icon {
  color: var(--rose);
}
.input-row .field {
  padding-left: 52px;
  padding-right: 52px;
}
.input-row .phone {
  padding-left: 56px;
  padding-right: 56px;
}
.input-row:has(.phone) .input-row__icon {
  width: 26px;
  height: 26px;
}

/* The one field that matters — big enough to read at arm's length. */
.phone {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-bottom: 2px solid rgba(242, 109, 138, 0.45);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: clamp(24px, 7.4vw, 34px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 18px 12px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.phone::placeholder {
  color: #c8bfd0;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.phone:focus {
  outline: none;
  border-color: rgba(242, 109, 138, 0.4);
  border-bottom-color: var(--rose);
  box-shadow: var(--shadow-sm), var(--ring);
}
/* No spinners, whatever the browser thinks a tel field deserves. */
.phone::-webkit-outer-spin-button,
.phone::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

/* ------------------------------------------------------------------- charm */

/* Hearts that answer her keyboard. Spawned by app.js, one per keystroke and a
   shower when the number is whole; each removes itself when its rise ends. */
.bubbles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}
.bubble {
  position: absolute;
  width: var(--size);
  height: var(--size);
  animation: bubble-rise var(--dur) cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  will-change: transform, opacity;
}
.bubble svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: bubble-sway var(--sway) ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 6px rgba(242, 109, 138, 0.28));
}
@keyframes bubble-rise {
  0% {
    transform: translate(0, 0) scale(0.3) rotate(0deg);
    opacity: 0;
  }
  14% {
    transform: translate(calc(var(--drift) * 0.3), calc(var(--rise) * -0.14)) scale(1)
      rotate(calc(var(--tilt) * 0.4));
    opacity: 0.95;
  }
  100% {
    transform: translate(var(--drift), calc(var(--rise) * -1)) scale(0.7) rotate(var(--tilt));
    opacity: 0;
  }
}
@keyframes bubble-sway {
  from {
    transform: translateX(-3px);
  }
  to {
    transform: translateX(3px);
  }
}

/* The field's icon gives a tiny hop with every character. Keep translateY in
   every frame — it's what centres the icon vertically. */
.input-row__icon.is-pop {
  animation: icon-pop 0.3s ease;
}
@keyframes icon-pop {
  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }
  40% {
    transform: translateY(-50%) scale(1.3);
  }
}

/* Ninth digit: the field itself takes a happy little breath. */
.phone.is-celebrate {
  animation: field-bounce 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes field-bounce {
  35% {
    transform: scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble,
  .bubble svg,
  .kiosk__hook span:last-child,
  .input-row__icon.is-pop,
  .phone.is-celebrate {
    animation: none;
  }
}

.kiosk__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}
.saved {
  font-size: 14px;
  color: var(--muted);
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}
.saved.is-on {
  opacity: 1;
  color: var(--good);
}
.saved.is-pending {
  opacity: 1;
  color: var(--amber);
}

/* Long-press to leave — a stranger holding the phone will not find this. */
.exit {
  appearance: none;
  border: 0;
  background: none;
  color: rgba(46, 36, 52, 0.16);
  font-size: 22px;
  letter-spacing: 0.2em;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.exit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(242, 109, 138, 0.18);
  transform: scaleX(0);
  transform-origin: left;
}
.exit.is-holding::after {
  transform: scaleX(1);
  transition: transform 1.2s linear;
}

/* ------------------------------------------------------------------- vault */

.vault__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.vault__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}
.back {
  color: var(--muted);
  text-decoration: none;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  align-content: start;
  flex: 1;
}
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  color: inherit;
  font: inherit;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.row:active {
  background: var(--surface-2);
}
.row__num {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.row__meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Tinted pills — on paper a coloured outline alone is too quiet to scan. */
.chip {
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
  border: 0;
}
.chip--new {
  color: #b0642a;
  background: #fff0e2;
}
.chip--texted {
  color: #3a6cb0;
  background: #e9f1fd;
}
.chip--met {
  color: #1d7d5c;
  background: #e4f6ee;
}
.chip--no {
  color: var(--muted);
  background: #f1eef4;
}

.empty {
  color: var(--muted);
  text-align: center;
  margin-top: 60px;
}

/* Editor sheet */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(46, 36, 52, 0.32);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-end;
  z-index: 10;
}
.sheet.is-open {
  display: flex;
}
.sheet__panel {
  width: 100%;
  max-height: 88dvh;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff, #fdfafb);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  padding: 22px 20px max(22px, env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
  box-shadow: 0 -20px 50px -24px rgba(46, 36, 52, 0.4);
  animation: rise 0.22s ease;
}
@keyframes rise {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
}
.sheet__num {
  font-size: 27px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.sheet__sub {
  color: var(--muted);
  font-size: 14px;
  margin: -6px 0 6px;
}
/* Against the panel's 12px gap this nets 5px to the field it names and 19px
   from the field above — each label reads as part of its own input, not as a
   caption floating between two. */
.label {
  color: var(--muted);
  font-size: 13px;
  margin: 7px 0 -7px;
}
.statuses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.status {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 14px;
  padding: 11px 4px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.status.is-on {
  color: var(--ink-on-accent);
  background: linear-gradient(135deg, var(--peach), var(--rose));
  border-color: transparent;
  font-weight: 700;
}
