/* brain tree, the tap-5 board: a dark field, paper cards, one pink string. */

@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url(/braintree/fonts/archivo-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: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url(/braintree/fonts/archivo-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Boldonse'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/braintree/fonts/boldonse-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: 'Silkscreen'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/braintree/fonts/silkscreen-latin.woff2) format('woff2'); }

:root {
  --bg: #121016;
  --bg-2: #1b1722;
  --ink: #f1ecf7;
  --mute: #a59db4;
  --faint: #6f6780;
  --line: rgba(236, 228, 250, 0.12);
  --pink: #ff5fa2;
  --yellow: #ffd84d;
  --violet: #9d8cff;
  --paper: #fbf4e6;
  --paper-ink: #1d1720;
  --ui: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --pix: 'Silkscreen', ui-monospace, monospace;
  --display: 'Boldonse', 'Archivo', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(120% 70% at 50% 0%, #211b2b 0%, #15121b 55%, var(--bg) 100%) fixed;
  background-color: var(--bg);
  color: var(--ink);
  font: 400 15px/1.4 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; padding: 0; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

/* ---------- header and footer ---------- */

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; }
.btn.pill { border-radius: 999px; border-color: rgba(255, 95, 162, 0.55); color: #ffd1e5; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand img { image-rendering: pixelated; }
.wordmark { font: 400 17px/1.5 var(--display); white-space: nowrap; }
.foot { text-align: center; padding: 22px 0 calc(18px + env(safe-area-inset-bottom)); }
.credit { font: 400 12px var(--pix); letter-spacing: 0.08em; color: var(--mute); text-decoration: none; text-transform: uppercase; }
.credit:hover { color: var(--mute); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px; font-weight: 650;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.go { background: var(--pink); color: #1a0d14; border-color: transparent; }
.btn.go:disabled { background: #2a2433; color: #b9b0c8; opacity: 1; cursor: default; }
.btn.big { min-height: 54px; font-size: 16px; border-radius: 16px; width: 100%; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14.5px; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--mute); }
/* hover only where there is a mouse: on a phone it sticks to whatever ends up under the finger */
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.11); }
  .btn.go:hover:not(:disabled) { background: #ff7db4; }
  .btn.quiet:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
}
.btn:focus-visible, .chip:focus-visible, .brand:focus-visible, input:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .btn { flex: 1 1 0; }

/* ---------- pick ---------- */

.pick h1 { margin: 22px 0 4px; font: 400 clamp(26px, 7.6vw, 36px)/1.5 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
.sub { margin: 0; color: var(--mute); font-size: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 12px 10px; margin-top: 22px; }
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(236, 228, 250, 0.16);
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.chip:hover { border-color: var(--c, var(--line)); background: rgba(255, 255, 255, 0.08); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed='true'] { border-color: var(--c); background: color-mix(in srgb, var(--c) 26%, #15121b); }
/* the pick number sits on the corner, so selecting never changes a chip's size */
.chip .num {
  position: absolute; top: -9px; right: -4px;
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--c); color: #15121b;
  font: 800 13px/1 var(--ui);
  box-shadow: 0 0 0 3px var(--bg);
}
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip.add { border-style: dashed; color: var(--ink); }
.chip.more { color: var(--mute); border-color: transparent; background: transparent; }
.chip.more:hover { color: var(--ink); }

.own { display: flex; gap: 8px; margin-top: 12px; }
.own input, .publish input, .url {
  flex: 1 1 auto; min-width: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(236, 228, 250, 0.2);
  background: #0e0c12;
  font-size: 16px;
}
.own input::placeholder, .publish input::placeholder { color: var(--faint); }

.dock {
  position: sticky; bottom: 0; z-index: 5;
  margin: 18px -16px 0;
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(18, 16, 22, 0), var(--bg) 14px);
}
.meter { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 0 12px; }
.meter span { margin-left: 6px; font: 600 14px/1 var(--ui); color: var(--mute); }
.meter i { width: 10px; height: 10px; border-radius: 50%; background: rgba(236, 228, 250, 0.16); transition: background 0.2s, transform 0.2s; }
.meter i.on { background: var(--pink); transform: scale(1.15); box-shadow: 0 0 8px rgba(255, 95, 162, 0.6); }
.note-line { margin: 0 0 8px; text-align: center; font: 400 11.5px var(--pix); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.note-line.warn { color: var(--yellow); font: 600 14.5px/1.3 var(--ui); letter-spacing: 0; text-transform: none; }
body[data-view='pick'] .foot { padding-top: 6px; }

/* ---------- result + page ---------- */

.result { padding-top: 8px; }
.kick { margin: 0 0 6px; font: 400 12px var(--pix); letter-spacing: 0.12em; text-transform: uppercase; color: var(--pink); }
.sheet {
  border-radius: 22px;
  border: 1px solid rgba(255, 95, 162, 0.28);
  background: linear-gradient(180deg, #241c2e 0%, #1a1621 60%);
  padding: 16px 12px 12px;
  box-shadow: 0 20px 60px -30px rgba(255, 95, 162, 0.45);
}
.sheet .kick { text-align: center; }
.head {
  margin: 0 4px 10px;
  text-align: center;
  font: 400 clamp(24px, 7vw, 30px)/1.45 var(--display);
  text-wrap: balance;
}
/* result and page actions: right under the board (a side column on desktop) */
.after { display: grid; gap: 8px; text-align: center; margin-top: 16px; }
.after .sub { font-size: 14.5px; margin: 0 0 4px; }
.after .kick { margin: 4px 0 0; }
.row .btn.big { flex: 1 1 0; width: auto; padding: 0 12px; }
.row .btn.go { flex-grow: 1.4; }
.publish .btn.quiet, .quiet-row .btn.quiet { min-height: 40px; }
.quiet-row { justify-content: center; }
/* brighter than the usual quiet button, so the page links read as links and not as switched off */
.quiet-row .btn.quiet { color: #d9d0e6; text-decoration: underline; text-decoration-color: rgba(217, 208, 230, 0.35); text-underline-offset: 4px; }

/* the friend match: under your board, or under a friend's page */
.from { margin: 10px 0 0; color: #ffd1e5; font-size: 14.5px; font-weight: 600; }
.meet-slot:empty { display: none; }
.sheet.meet { margin-top: 16px; display: grid; gap: 0; }
.meet .head { font-size: clamp(22px, 6.4vw, 26px); }
.meet > .sub { margin: 4px 0 10px; text-align: center; font-size: 15px; }
.meet > .btn { margin-top: 2px; }
.meet > .row { margin-top: 12px; flex-wrap: wrap; }
.meet > .row > .btn { flex: 1 1 auto; }
.board.pair { height: 300px; }
.who {
  position: absolute; z-index: 2; top: 20px;
  margin: 0; max-width: 46%;
  transform: translate(-50%, -50%);
  font: 400 12px/1 var(--pix); letter-spacing: 0.12em; text-transform: uppercase;
  color: #d9d0e6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who.l { left: 26%; }
.who.r { left: 74%; color: #ff9cc6; }
.jump {
  display: block; margin: -4px auto 10px; padding: 6px 12px; min-height: 32px;
  border: 1px solid rgba(255, 95, 162, 0.45); border-radius: 999px; background: rgba(255, 95, 162, 0.1);
  color: #ffd1e5; font-size: 13.5px; font-weight: 650; cursor: pointer;
}
.jump:hover { background: rgba(255, 95, 162, 0.18); }
/* matched: on a phone the header already has My board, so the button below the board goes */
.after.done { display: none; }

/* the off-screen copy of the board the story image is drawn from, shaped to fill a story */
.stage { position: fixed; left: -10000px; top: 0; width: 380px; pointer-events: none; }
.stage .board { height: 540px; }
.stage .board.pair { min-height: 530px; }

.dotdot::after { content: ''; display: inline-block; width: 1.4em; text-align: left; white-space: nowrap; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.result > .kick { text-align: center; margin-top: 18px; }

.oops { margin-top: 40px; padding: 22px 18px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg-2); text-align: center; display: grid; gap: 14px; }
.oops p { margin: 0; font-size: 16px; }

/* ---------- the board ---------- */

.board {
  position: relative;
  height: 400px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 1.4px) 0 0 / 14px 14px,
    radial-gradient(120% 80% at 50% 40%, #1e1826, #141018);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.string { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; }
.string path { fill: none; stroke: var(--pink); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); }

.pin {
  position: absolute; z-index: 2;
  transform: translate(-50%, -50%) rotate(var(--tilt));
  width: max-content;
  max-width: 50%;
  padding: 10px 12px 8px;
  border-radius: 4px;
  border-top: 4px solid var(--c);
  background: var(--paper);
  color: var(--paper-ink);
  font: 750 14px/1.2 var(--ui);
  font-stretch: 92%;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}
.pin span { display: block; text-wrap: balance; }
.pin.short span { white-space: nowrap; }
.tack {
  position: absolute; top: -8px; left: 50%;
  width: 13px; height: 13px; margin-left: -6.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #ffe3ef 0 14%, #ff5fa2 40%, #a3004a 100%);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5);
}
.tag {
  position: absolute; z-index: 3; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(var(--tilt));
  width: max-content;
  max-width: 60%;
  padding: 5px 9px 4px;
  border-radius: 3px;
  background: var(--yellow);
  color: #2a1f00;
  font: 650 12.5px/1.25 var(--ui);
  text-wrap: balance;
  text-align: center;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
}

.tag::before {
  content: ''; position: absolute; top: -4px; left: 50%;
  width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #ffe3ef 0 14%, #ff5fa2 45%, #a3004a 100%);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
}

/* waiting: the cards are up, the string is still being worked out */
.board.live .string path { stroke-dasharray: 6 8; animation: march 0.9s linear infinite; opacity: 0.8; }
.board.live .pin { animation: bob 1.6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes march { to { stroke-dashoffset: -28; } }
@keyframes bob { 50% { transform: translate(-50%, calc(-50% - 4px)) rotate(var(--tilt)); } }

/* arriving: cards pin, the string runs, the notes stick */
.board.enter .pin { animation: pinIn 0.42s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: var(--d); }
.board.enter .string path { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); animation: draw 0.34s ease-out forwards; animation-delay: calc(var(--d) + 300ms); }
.board.enter .tag { animation: tagIn 0.32s cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(var(--d) + 360ms); }
@keyframes pinIn { from { opacity: 0; transform: translate(-50%, calc(-50% - 18px)) rotate(calc(var(--tilt) * 3)) scale(1.06); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes tagIn { from { opacity: 0; transform: translate(-50%, -50%) rotate(var(--tilt)) scale(0.6); } }

/* ---------- publish sheet ---------- */

.publish {
  width: 100%; max-width: 480px;
  margin: auto auto 0;
  padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--bg-2);
  color: var(--ink);
}
.publish::backdrop { background: rgba(8, 6, 10, 0.66); backdrop-filter: blur(3px); }
.publish form, .publish { display: grid; gap: 12px; }
.publish:not([open]) { display: none; }
.publish h2 { margin: 0; font: 400 21px/1.5 var(--display); }
.publish .hint { margin: 0; color: var(--mute); font-size: 14.5px; }
.url { width: 100%; font-size: 14px; color: var(--mute); }

@media (min-width: 700px) {
  .publish { margin: auto; border-radius: 22px; border-bottom: 1px solid var(--line); }
  .pick h1 { margin-top: 36px; }
  body[data-view='pick'] #app { max-width: 760px; }
  .dock { position: static; background: none; margin: 22px 0 0; padding: 0; }
  .chip { font-size: 16px; min-height: 46px; }
}

@media (min-width: 1000px) {
  body[data-view='result'] #app, body[data-view='page'] #app { max-width: 880px; }
  /* one column (a finished match): the header lines up with the cards */
  body:has(.after.done) #app { max-width: 552px; }
  .result:has(.after) {
    display: grid;
    grid-template-columns: minmax(0, 520px) 280px;
    justify-content: center;
    align-items: start;
    gap: 28px;
  }
  .after { position: sticky; top: 24px; margin-top: 0; grid-column: 2; grid-row: 1; }
  .result:has(.after) > .meet-slot { grid-column: 1; }
  /* a finished match leaves nothing for the side column, so the page goes to one column */
  .result:has(.after.done) { grid-template-columns: minmax(0, 520px); }
  .pin { font-size: 15px; }
  .tag { font-size: 13px; }
  .head { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.noscript { padding: 40px 20px; text-align: center; color: var(--mute); }

/* the paper plane on Send */
.btn .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }

/* above your board: the yellow notes are post ideas, with a little note swatch */
.postline { margin: -2px 4px 12px; text-align: center; font-size: 14.5px; line-height: 1.45; color: #d9d0e6; text-wrap: balance; }
.postline::before { content: ''; display: inline-block; width: 12px; height: 10px; margin-right: 8px; border-radius: 2px; background: #ffd84d; transform: rotate(-4deg); vertical-align: 0; }
