/* Self-hosted so no visitor request leaves for a font CDN. These are the
   variable originals; assets/fonts holds static cuts of the same faces for the
   share card. Regenerate both with scripts/make-og.js and the README steps. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/fonts/fraunces-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/hanken-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/hanken-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Bot Bait.
   Ink on paper. Fraunces where weight is needed, Hanken Grotesk everywhere
   else. No monospace, no tracked-out capitals: hierarchy comes from size,
   weight and space. Light mode is unforgiving about rhythm, so spacing here
   sticks to multiples of 4. */

:root {
  --paper: #fcfcfa;
  --card: #ffffff;
  --surface: #f1f1ee;
  --raised: #eaeae6;
  --rule: #e4e4e0;
  --ink: #16161a;
  --ink-soft: #3c3c44;
  --muted: #6e6e76;
  --muted-light: #9a9aa2;
  --ink-hover: #33333b;

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ui: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

  --shell: 500px;
  --r: 10px;
  --r-lg: 14px;
  --r-sm: 6px;
  --lift: 0 1px 2px rgba(22, 22, 26, 0.05), 0 8px 24px rgba(22, 22, 26, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button {
  font-family: var(--ui);
  color: inherit;
  cursor: pointer;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--shell);
  height: 100dvh;
  margin: 0 auto;
  padding: 0 20px env(safe-area-inset-bottom);
}

/* Masthead ----------------------------------------------------------------- */

.masthead {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  padding: 20px 0 16px;
}

.titles {
  text-align: center;
}

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-size: 32px;
  font-weight: 800;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
  letter-spacing: -0.02em;
  line-height: 1;
}

.dateline {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted-light);
  transition: color 0.14s ease, background 0.14s ease;
}

.icon:hover {
  color: var(--ink);
  background: var(--surface);
}

/* Brief: the phrase, the banned list, the tries ---------------------------- */

.brief {
  padding: 2px 0 16px;
  border-bottom: 1px solid var(--rule);
}

.goal-label {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.goal {
  margin: 2px 0 3px;
  font-family: var(--display);
  font-size: 27px;
  font-weight: 800;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.brief-meta {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted-light);
}

.banned-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.banned-label {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--muted);
}

.banned {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 2px 10px 3px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-color: var(--muted-light);
  text-decoration-thickness: 1px;
}

/* Transcript --------------------------------------------------------------- */

.transcript {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  /* 2px so an outlined bubble never renders flush against the column edge. */
  padding: 20px 2px;
  overflow-y: auto;
  /* Overlay scrollbars draw on top of content and were cutting the right edge
     off an outlined bubble. The fade below already signals there is more. */
  scrollbar-width: none;
  /* Older lines dissolve under the target rather than butting against it. */
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
}

.transcript::-webkit-scrollbar {
  display: none;
}

.line {
  max-width: 82%;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-size: 15.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  animation: settle 0.18s ease-out;
}

/* Yours is ruled, its replies are filled. Neither needs to be solid black. */
.line.you {
  align-self: flex-end;
  border-color: var(--ink);
  border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg);
  background: var(--card);
  color: var(--ink);
  font-weight: 400;
}

.line.them {
  align-self: flex-start;
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}

.line.them mark {
  padding-bottom: 1px;
  border-bottom: 2px solid var(--ink);
  background: none;
  color: var(--ink);
  font-weight: 600;
}

.line.note {
  align-self: center;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.standby {
  margin: auto 0;
  padding: 0 28px;
  color: var(--muted-light);
  font-size: 14.5px;
  line-height: 1.55;
  text-align: center;
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.thinking {
  display: flex;
  align-self: flex-start;
  gap: 5px;
  padding: 15px 14px;
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm);
  background: var(--surface);
}

.thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-light);
  animation: breathe 1.3s infinite ease-in-out;
}

.thinking span:nth-child(2) {
  animation-delay: 0.16s;
}

.thinking span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes breathe {
  0%,
  75%,
  100% {
    opacity: 0.3;
  }
  35% {
    opacity: 1;
  }
}

/* Result ------------------------------------------------------------------- */

.result {
  margin-bottom: 16px;
  padding: 24px 20px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--lift);
  text-align: center;
  animation: settle 0.22s ease-out;
}

.result-title {
  margin: 0;
  font-family: var(--display);
  font-size: 29px;
  font-weight: 800;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.result-sub {
  margin: 8px 0 20px;
  font-size: 14.5px;
  color: var(--muted);
}

.btn {
  padding: 12px 28px;
  border: 0;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.14s ease;
}

.btn:hover {
  background: var(--ink-hover);
}

.btn.wide {
  width: 100%;
  margin-top: 24px;
}

.until {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted-light);
}

/* Composer ----------------------------------------------------------------- */

.composer {
  padding-bottom: 20px;
  border-top: 1px solid var(--rule);
}

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 0;
}

.ticks {
  display: flex;
  flex: 1;
  gap: 4px;
}

.tick {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--raised);
  transition: background 0.2s ease;
}

.tick.spent {
  background: var(--muted-light);
}

.tick.hit {
  background: var(--ink);
}

.progress-label {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--muted);
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--card);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.field:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 22, 26, 0.07);
}

.input {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  outline: none;
}

.input::placeholder {
  color: var(--muted-light);
}

.input:disabled {
  color: var(--muted);
}

.send {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  transition: background 0.14s ease;
}

.send:disabled {
  background: var(--raised);
  color: var(--muted-light);
  cursor: not-allowed;
}

.send:not(:disabled):hover {
  background: var(--ink-hover);
}

.allowance {
  margin: 10px 2px 0;
  font-size: 13px;
  color: var(--muted-light);
  text-align: right;
  transition: color 0.14s ease;
}

.allowance.spent {
  color: var(--ink);
  font-weight: 500;
}

/* Sheets ------------------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 22, 26, 0.32);
  animation: fade 0.14s ease-out;
}

.scrim[hidden] {
  display: none;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 424px;
  max-height: 88dvh;
  padding: 28px 26px 24px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 12px rgba(22, 22, 26, 0.08), 0 24px 60px rgba(22, 22, 26, 0.14);
  overflow-y: auto;
  animation: settle 0.2s ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted-light);
}

.sheet-close:hover {
  color: var(--ink);
  background: var(--surface);
}

.sheet-title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.sub-title {
  margin: 28px 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.sheet-lead {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.sheet-lead strong {
  color: var(--ink);
  font-weight: 600;
}

.rules {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  counter-reset: rule;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.5;
}

/* Grid rather than list markers, so a wrapped line sits flush under its own
   text instead of under the number. */
.rules li {
  display: grid;
  grid-template-columns: 19px 1fr;
  margin-bottom: 11px;
}

.rules li::before {
  counter-increment: rule;
  content: counter(rule) ".";
  color: var(--muted-light);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.demo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 16px;
  border-radius: var(--r);
  background: var(--paper);
}

.demo-caption {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
}

.demo-caption em {
  color: var(--ink);
  font-style: normal;
  font-weight: 600;
}

.demo .line {
  max-width: 92%;
  font-size: 14px;
  animation: none;
}

.demo .line.them {
  background: var(--surface);
}

.demo-result {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

/* Record ------------------------------------------------------------------- */

.figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 4px;
  border-radius: var(--r);
  background: var(--surface);
  text-align: center;
}

.figure-num {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  font-variation-settings: 'SOFT' 20;
  letter-spacing: -0.02em;
  line-height: 1.05;
  white-space: nowrap;
}

.figure-num .pct {
  margin-left: 0.12em;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  vertical-align: 0.08em;
}

.figure-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.histogram {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-key {
  width: 7px;
  color: var(--muted);
  text-align: center;
}

.bar {
  display: flex;
  justify-content: flex-end;
  min-width: 28px;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--muted);
  font-weight: 500;
  transition: width 0.3s ease;
}

.bar.today {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.sheet-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.sheet-footer .btn.wide {
  margin-top: 0;
}

/* Toast -------------------------------------------------------------------- */

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 60;
  padding: 10px 20px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--lift);
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
