/* Loop Engineering · live: the audience page. joe IT brand: blue #1f4cff on ink, lime sparingly. */
@font-face { font-family: 'Figtree'; src: url('fonts/Figtree-VariableFont_wght.ttf') format('truetype'); font-weight: 300 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('fonts/jetbrains-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --ink: #050817;
  --navy: #0e1530;
  --blue: #1f4cff;
  --blue-2: #5a7dff;
  --lime: #c8ff3d;
  --fg: #f1f4ff;
  --muted: #8a93bd;
  --line: rgba(255, 255, 255, .14);
  --card: rgba(255, 255, 255, .06);
  --sans: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(45, 90, 255, .32), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(45, 90, 255, .16), transparent 60%),
    var(--ink);
  background-attachment: fixed;
  color: var(--fg);
  font: 500 17px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(120px + env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; }
.joe {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding-bottom: 2px;
  border-radius: 50%; background: var(--blue);
  font-weight: 650; font-size: 15px; letter-spacing: -.03em; color: #fff;
}
.kicker { font: 500 12px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--blue-2); }
h1 { font-weight: 800; font-size: clamp(34px, 10vw, 46px); line-height: 1.02; letter-spacing: -.035em; text-wrap: balance; }
.sub { margin-top: 14px; color: var(--muted); }
.note:empty { display: none; }

/* one view at a time: the presenter decides which */
.view { display: none; }
#app[data-view="hello"] #v-hello,
#app[data-view="wait"] #v-wait,
#app[data-view="poll"] #v-poll,
#app[data-view="end"] #v-end { display: block; animation: in .45s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes in { from { opacity: 0; transform: translateY(14px); } }
.up { display: inline-block; color: var(--lime); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-6px); } }

#v-poll .kicker { margin-bottom: 12px; }
.opts { display: grid; gap: 10px; margin-top: 24px; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 58px; padding: 14px 18px;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--card);
  font-weight: 650; font-size: 19px; text-align: left; letter-spacing: -.01em;
  cursor: pointer; transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}
.opt:active { transform: scale(.98); }
.opt::after { content: ''; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); }
.opt[aria-checked="true"] { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 30px rgba(31, 76, 255, .45); }
.opt[aria-checked="true"]::after {
  border-color: var(--lime); background: var(--lime);
  -webkit-mask: none;
  box-shadow: inset 0 0 0 5px var(--blue);
}

.ask { margin-top: 40px; padding: 18px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--card); }
.ask form { display: grid; gap: 12px; }
.ask textarea {
  width: 100%; resize: none; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .25);
  font-size: 17px; line-height: 1.35;
}
.ask textarea:focus { outline: none; border-color: var(--blue-2); }
.ask-row { display: flex; align-items: center; justify-content: space-between; }
.count { font: 500 12px/1 var(--mono); color: var(--muted); }
.ask button {
  min-width: 96px; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 99px; background: var(--blue);
  font-weight: 700; font-size: 16px; cursor: pointer;
}
.ask button:disabled { opacity: .45; }
.ask .sub { margin-top: 10px; font-size: 14px; }

/* reactions: always there, fixed to the bottom */
.react {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(5, 8, 23, .92) 30%);
}
.react-row { display: flex; justify-content: center; gap: 6px; max-width: 520px; margin: 0 auto; }
.react-row button {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 56px; height: 52px; padding: 0;
  display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: 16px; background: rgba(14, 21, 48, .9);
  font: 26px/1 var(--emoji); cursor: pointer;
  transition: transform .12s ease;
}
.react-row button:active { transform: scale(.88); }
.react-row button.wait { animation: wiggle .3s ease; }
.react.cool .react-row button { opacity: .3; filter: grayscale(1); }
.cool-note { margin: 0 auto 8px; text-align: center; font: 500 12px/1 var(--mono); color: var(--muted); }
.cool-note[hidden] { display: none; }
@keyframes wiggle { 33% { transform: rotate(-8deg); } 66% { transform: rotate(8deg); } }
.react-row button.more { font: 600 24px/1 var(--sans); color: var(--blue-2); }
.react-row button.more[aria-expanded="true"] { border-color: var(--blue-2); background: var(--blue); color: #fff; }

/* ＋: a panel of more emoji above the bar (no phone keyboard) */
.picker {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 4px);
  max-width: 496px; margin: 0 auto; padding: 12px;
  border: 1.5px solid var(--line); border-radius: 20px; background: rgba(14, 21, 48, .97);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
  animation: in .25s cubic-bezier(.16, 1, .3, 1) both;
}
.picker[hidden] { display: none; }
.picker-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 8px; }
.picker .x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--card); font: 600 15px/1 var(--sans); color: var(--muted); }
.picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 46vh; overflow-y: auto; }
.picker-grid button {
  aspect-ratio: 1; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 12px; background: transparent;
  font: 28px/1 var(--emoji); cursor: pointer; transition: transform .12s ease, background-color .12s ease;
}
.picker-grid button:active { transform: scale(.85); background: var(--card); }
.floats { position: absolute; inset: 0; pointer-events: none; }
.float {
  position: absolute; bottom: 60px; left: var(--x);
  font: 34px/1 var(--emoji);
  animation: float 1.4s cubic-bezier(.22, .61, .36, 1) forwards;
}
@keyframes float { to { transform: translate(var(--dx), -240px) scale(1.3); opacity: 0; } }

.net {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); translate: -50% 0;
  padding: 8px 14px; border-radius: 99px; background: rgba(14, 21, 48, .95); border: 1px solid var(--line);
  font: 500 12px/1 var(--mono); color: var(--muted); white-space: nowrap;
}
.net[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .up, .view, .float { animation: none !important; }
}

/* end of the talk: rating, feedback, community */
#v-end h1 { margin-top: 12px; }
.rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 24px; }
.rate button {
  aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 16px; background: var(--card);
  font-weight: 800; font-size: 26px; cursor: pointer; transition: transform .15s ease, background-color .2s ease, border-color .2s ease;
}
.rate button:active { transform: scale(.94); }
.rate button[aria-checked="true"] { background: var(--blue); border-color: var(--lime); box-shadow: 0 0 30px rgba(31, 76, 255, .5); }
.rate-ends { display: flex; justify-content: space-between; margin-top: 8px; font: 500 12px/1 var(--mono); color: var(--muted); }
.card { margin-top: 24px; padding: 18px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--card); }
#fb-form { display: grid; gap: 12px; }
#fb-form textarea, .join input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .25);
  font-size: 17px; line-height: 1.35;
}
#fb-form textarea { resize: none; }
#fb-form textarea:focus, .join input:focus { outline: none; border-color: var(--blue-2); }
#fb-form button, .join button {
  min-width: 96px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 99px; background: var(--blue);
  font-weight: 700; font-size: 16px; cursor: pointer;
}
#fb-form button:disabled, .join button:disabled { opacity: .45; }
.join { margin-top: 36px; border-color: rgba(200, 255, 61, .35); }
.join h2 { margin: 10px 0 0; font-weight: 800; font-size: 30px; letter-spacing: -.03em; }
.join .sub { margin-top: 8px; }
.join form { display: flex; gap: 8px; margin-top: 16px; }
.join form[hidden] { display: none; }
.join input { flex: 1; min-width: 0; }
.fine { margin-top: 10px; font-size: 12px; line-height: 1.4; color: var(--muted); }

/* ------------------------------------------------------------------ the crash
   The product loop slide "crashes" every phone: a short glitch, then a black screen with a
   random JavaScript error in red and Report a bug. The report flies into the loop; Josip's
   click ships the fix. */
#app.glitching { animation: glitch .9s steps(1) both; }
@keyframes glitch {
  0%   { transform: translate(0, 0); filter: none; }
  10%  { transform: translate(-6px, 3px) skewX(6deg); filter: hue-rotate(90deg) saturate(3); clip-path: inset(10% 0 55% 0); }
  20%  { transform: translate(8px, -2px); filter: invert(1); clip-path: inset(40% 0 20% 0); }
  30%  { transform: translate(-3px, 0) skewX(-10deg); filter: hue-rotate(200deg) contrast(2); clip-path: none; }
  45%  { transform: translate(5px, 6px); filter: invert(1) hue-rotate(60deg); clip-path: inset(0 0 70% 0); }
  60%  { transform: translate(-9px, -4px) scale(1.02); filter: saturate(6) brightness(1.6); clip-path: inset(30% 0 30% 0); }
  75%  { transform: translate(2px, 0); filter: invert(1); clip-path: inset(65% 0 5% 0); }
  90%  { transform: translate(0, 0); filter: brightness(3); clip-path: none; }
  100% { transform: none; filter: none; clip-path: none; }
}

.crash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  overflow: hidden;
  background: #000; color: #e6e6e6;
}
.crash[hidden] { display: none; }
.crash-err {
  margin: 10px 0 0;
  font: 500 14px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word;
  color: #ff5f56;
}
.crash-err b { font-weight: 500; }
.crash-err i { font-style: normal; color: #8a8a8a; }
.crash-err::after { content: '\258D'; color: #e6e6e6; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.crash-foot { margin-top: auto; display: grid; gap: 10px; }
.crash-note { min-height: 1em; text-align: center; font: 500 13px/1.2 var(--mono); color: #ff5f56; }
.crash-btn {
  width: 100%; min-height: 58px; cursor: pointer;
  border: 1.5px solid #e6e6e6; border-radius: 10px; background: #000; color: #fff;
  font: 500 19px/1 var(--mono);
}
.crash-btn:disabled { opacity: .5; }
.crash-btn:active { transform: scale(.98); }

/* in the loop: the report flies in, the loop works on it, Josip ships the fix */
#app[data-view="bug"] #v-bug { display: block; animation: in .45s cubic-bezier(.16, 1, .3, 1) both; }
#v-bug { text-align: center; }
#v-bug .kicker { display: block; }
.ploop {
  position: relative; width: 210px; height: 210px; margin: 34px auto 34px;
  border-radius: 50%; border: 9px solid var(--blue);
  box-shadow: 0 0 60px rgba(31, 76, 255, .55), inset 0 0 50px rgba(31, 76, 255, .45);
  transition: border-color .5s ease, box-shadow .5s ease;
}
.ploop-spin { position: absolute; inset: -9px; animation: pspin 2.2s linear infinite; }
.ploop-spin i { position: absolute; left: 50%; top: 0; width: 22px; height: 22px; margin: -6px 0 0 -11px; border-radius: 50%; background: #fff; box-shadow: 0 0 20px 5px rgba(31, 76, 255, .8); }
.ploop-spin i + i { top: auto; bottom: 0; margin: 0 0 -6px -11px; background: var(--lime); box-shadow: 0 0 20px 5px rgba(200, 255, 61, .6); }
@keyframes pspin { to { transform: rotate(360deg); } }
.pfile {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: grid; justify-items: center; gap: 6px;
  padding: 12px 12px 10px; border-radius: 10px; background: #fff; color: #1c1f26;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  font: 500 11px/1 var(--mono); white-space: nowrap;
}
.pfile s { width: 30px; height: 36px; border-radius: 3px 10px 3px 3px; background: linear-gradient(225deg, #ffd2cc 0 9px, #ff5f56 9px); }
.pfile b { font-weight: 500; }
#v-bug.fly .pfile { animation: pfile 1.15s cubic-bezier(.3, .7, .25, 1) both; }
@keyframes pfile {
  from { transform: translateY(58vh) scale(1.5) rotate(-8deg); }
  70%  { transform: translateY(-6px) scale(.92) rotate(2deg); }
  to   { transform: none; }
}
#v-bug.fly .ploop { animation: phit .5s 1s ease both; }
@keyframes phit { 40% { box-shadow: 0 0 90px rgba(200, 255, 61, .8), inset 0 0 60px rgba(200, 255, 61, .5); border-color: var(--lime); } }
.pok { position: absolute; inset: 0; display: grid; place-items: center; font: 800 96px/1 var(--sans); color: var(--lime); opacity: 0; transform: scale(.3); transition: opacity .4s ease, transform .6s cubic-bezier(.34, 1.8, .64, 1); }
#v-bug.fixed .ploop { border-color: var(--lime); box-shadow: 0 0 70px rgba(200, 255, 61, .45), inset 0 0 50px rgba(200, 255, 61, .25); }
#v-bug.fixed .ploop-spin { animation-duration: 6s; }
#v-bug.fixed .pfile { opacity: 0; transform: scale(.4); transition: opacity .3s ease, transform .4s ease; }
#v-bug.fixed .pok { opacity: 1; transform: none; }
#v-bug.fixed .kicker { color: var(--lime); }
#bug-sub { min-height: 1.4em; }

@media (prefers-reduced-motion: reduce) {
  #app.glitching, .crash-err::after, .ploop-spin, #v-bug.fly .pfile, #v-bug.fly .ploop { animation: none !important; }
}
