:root {
  --bg: #0b0b0c;
  --fg: #f5f5f4;
  --yes: #22c55e;
  --maybe: #f5a524;
  --no: #ef4444;
  --dim: #8a8a93;
  --word: min(21vw, 15vh);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

/* The word, centered on the line a third of the way down the screen */
#stage, .ghost { position: fixed; inset: 0; display: grid; grid-template-rows: 2fr 1fr; place-items: center; }
#stage { touch-action: none; }
.ghost { z-index: 1; pointer-events: none; }
#word, .ghost span {
  font-size: var(--word);
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
}
/* Tapping the word cycles lowercase, Capitalized, ALL CAPS */
[data-case="lower"] #word, [data-case="lower"] .ghost span, [data-case="lower"] .chip { text-transform: none; }
[data-case="title"] #word, [data-case="title"] .ghost span, [data-case="title"] .chip { text-transform: capitalize; }
#word { position: relative; z-index: 1; padding: .25em .4em; will-change: transform; }
#word.yes, .ghost.yes span { color: var(--yes); }
#word.maybe, .ghost.maybe span { color: var(--maybe); }
.ghost.no span { color: var(--no); }
.ghost.undo span { color: var(--dim); }

/* Color washing in from the side the word leaves by */
#glow { position: fixed; inset: 0; opacity: 0; pointer-events: none; }
#glow.yes { background: linear-gradient(to right, rgb(34 197 94 / .5), transparent 70%); }
#glow.maybe { background: linear-gradient(to top, rgb(245 165 36 / .5), transparent 70%); }
#glow.no { background: linear-gradient(to bottom, rgb(239 68 68 / .5), transparent 70%); }
#glow.undo { background: linear-gradient(to left, rgb(138 138 147 / .35), transparent 70%); }

/* Buttons */
button {
  display: grid;
  place-items: center;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: none;
}
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--dim); outline-offset: 3px; }
svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg .dot { fill: currentColor; stroke: none; }

.corner { position: fixed; z-index: 2; top: calc(env(safe-area-inset-top) + 10px); width: 52px; height: 52px; opacity: .6; }
.corner.left { left: calc(env(safe-area-inset-left) + 8px); color: var(--yes); }
.corner.right { right: calc(env(safe-area-inset-right) + 8px); color: var(--maybe); }

#bar {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 66px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 max(18px, 7vw);
}
/* Each button's tap area is taller than the circle drawn in it */
.big { position: relative; width: 84px; height: 120px; opacity: .9; transition: transform .12s; }
.big::before { content: ""; position: absolute; inset: 18px 0; border-radius: 50%; border: 2.5px solid currentColor; }
.big:active { transform: scale(.9); }
.big svg { position: relative; width: 38px; height: 38px; stroke-width: 2.4; }
.big.yes { color: var(--yes); }
.big.maybe { color: var(--maybe); }
.big.no { color: var(--no); }

/* Ticker check just under the word: chain logo, market cap, 24h volume, or a
   status symbol. Nothing shows while a lookup is running. */
#dex {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  top: calc(100% / 3 + var(--word) * .8);
  display: flex;
  justify-content: center;
  pointer-events: none;
}
#dex > * { pointer-events: auto; }
.dex-go { width: 48px; height: 48px; border-radius: 50%; color: var(--dim); }
.dex-go svg { width: 24px; height: 24px; }
#dex .dex-go svg, #dex .dex-hit { display: none; }
#dex[data-state="busy"] .dex-go { visibility: hidden; }
#dex[data-state="none"] .none, #dex[data-state="limited"] .limited, #dex[data-state="down"] .down { display: block; }
#dex[data-state="limited"] .dex-go { color: var(--maybe); } /* hourglass: DexScreener's rate limit */
#dex[data-state="down"] .dex-go { color: var(--no); } /* warning: DexScreener unreachable */
#dex[data-state="hit"] .dex-go { display: none; }
#dex[data-state="hit"] .dex-hit { display: grid; }
.dex-hit {
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 7px 18px 7px 7px;
  border-radius: 999px;
  background: #161618;
  color: var(--fg);
  text-decoration: none;
  animation: fade .2s ease-out;
}
.dex-hit .logo { display: block; grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; background: #26262a; overflow: hidden; }
.dex-hit img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dex-hit .cap { font-size: 20px; font-weight: 750; line-height: 1.15; }
.dex-hit .vol { display: flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1.2; color: var(--dim); }
.dex-hit .vol svg { width: 13px; height: 13px; stroke-width: 2.6; }

/* Only shows when the PC can't be reached */
#dot {
  position: fixed;
  z-index: 3;
  top: calc(env(safe-area-inset-top) + 18px);
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--no);
  opacity: 0;
  transition: opacity .3s;
}
#dot.on { opacity: 1; }

/* Yes / maybe lists */
#list {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  animation: rise .18s ease-out;
}
#list[data-kind="yes"] { --c: var(--yes); }
#list[data-kind="maybe"] { --c: var(--maybe); }
#list header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 8px) 6px calc(env(safe-area-inset-left) + 8px);
  background: var(--bg);
}
#list .back { width: 52px; height: 52px; color: var(--c); touch-action: manipulation; }
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
  padding: 4px calc(env(safe-area-inset-right) + 16px) calc(env(safe-area-inset-bottom) + 32px) calc(env(safe-area-inset-left) + 16px);
}
.chip {
  padding: 16px 0;
  border-radius: 14px;
  background: #161618;
  color: var(--c);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  touch-action: pan-y;
}
.chip:active { background: #222226; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
