/* Quiver Labs — minimal fantasy-UI entity page.
   Palette echoes the Quiver "Desk" look: near-black ground, thin white lines,
   indigo accent, tiny tracking-wider monospace chrome. */

:root {
  --bg: #0a0b0e;
  --ink: #f4f4f6;
  --dim: #8a8d97;
  --faint: #54565e;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #8b8ff5; /* indigo, lifted for contrast on near-black */
  --accent-soft: rgba(124, 128, 240, 0.16);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  /* A faint overhead glow + a vignette to seat the dark ground. */
  background-image:
    radial-gradient(1100px 620px at 50% -12%, rgba(124, 128, 240, 0.1), transparent 62%),
    radial-gradient(900px 900px at 50% 120%, rgba(0, 0, 0, 0.6), transparent 60%);
}

/* The arrow field sits behind everything and catches every click. */
#field {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  cursor: crosshair;
}

/* ── Centered entity content ──────────────────────────────────────────────
   pointer-events:none so clicks fall through to the canvas; interactive bits
   (links) re-enable it. */
.stage {
  position: relative;
  z-index: 10;
  pointer-events: none;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
}

.eyebrow {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.wordmark {
  font-weight: 300;
  font-size: clamp(44px, 9vw, 104px);
  letter-spacing: -0.02em;
  line-height: 0.96;
  /* a whisper of light through the letters */
  background: linear-gradient(180deg, #ffffff, #c7c9d4 70%, #9a9cab);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wordmark .dim {
  font-weight: 200;
  color: var(--faint);
  -webkit-text-fill-color: var(--faint);
}

.lede {
  color: var(--dim);
  font-size: clamp(14px, 2.2vw, 17px);
  font-weight: 360;
  max-width: 30ch;
  line-height: 1.5;
}

.link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  pointer-events: auto;
  transition: border-color 0.2s, color 0.2s;
}
.link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.cta {
  pointer-events: auto;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.cta:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.cta .glyph {
  color: var(--accent);
  transition: transform 0.2s;
}
.cta:hover .glyph {
  transform: translate(2px, -2px);
}

/* compact links row (About · tellquiver.ai) — replaces the wordy hero copy */
.links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: var(--dim);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s;
}
.linkish:hover {
  color: var(--accent);
}
.sep {
  color: var(--faint);
}
.about {
  max-width: 32ch;
  margin-top: -2px;
  color: var(--dim);
  font-size: clamp(13px, 2vw, 15px);
  line-height: 1.55;
}
.about[hidden] {
  display: none;
}

/* difficulty picker on the landing (and reused shape on the results tabs) */
.modepick {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
.modepick button {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.modepick button:hover {
  color: var(--ink);
}
.modepick button.on {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hint {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
  transition: opacity 0.6s;
}
.hint.spent {
  opacity: 0;
}
/* Game HUD (score + quiver) stays out of sight until you loose your first arrow. */
.hud-tr,
.hud-bl {
  opacity: 0;
  transition: opacity 0.5s;
}
body.engaged .hud-tr,
body.engaged .hud-bl {
  opacity: 1;
}

/* ── Corner HUD / chrome ─────────────────────────────────────────────────── */
.hud {
  position: fixed;
  z-index: 10;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  pointer-events: none;
  user-select: none;
}
.mono {
  font-family: var(--mono);
}
.hud-tl {
  top: 22px;
  left: 24px;
  letter-spacing: 0.3em;
  color: var(--dim);
}
.hud-tr {
  top: 22px;
  right: 24px;
  color: var(--dim);
}
.hud-bl {
  bottom: 22px;
  left: 24px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.hud-br {
  bottom: 22px;
  right: 24px;
}

/* Quiver arrows (filled = available, hollow = spent), drawn as tiny chevrons. */
.tick {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--accent);
  border-top: 1.5px solid var(--accent);
  transform: rotate(45deg);
  opacity: 0.9;
  transition: opacity 0.2s, border-color 0.2s;
}
.tick.spent {
  border-color: var(--faint);
  opacity: 0.3;
}

@media (max-width: 540px) {
  .hud-br,
  .hud-bl {
    display: none;
  }
}

/* ── Play the field — enter immersive game ──────────────────────────────── */
.play {
  pointer-events: auto;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}
.play:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* In play mode the marketing chrome gets out of the way and the field is vivid. */
body.playing .stage,
body.playing .hud-tl,
body.playing .hud-tr,
body.playing .hud-bl,
body.playing .hud-br {
  opacity: 0;
  pointer-events: none;
}
/* The links/buttons set pointer-events:auto, which overrides the hidden stage —
   force them off so the invisible tellquiver link can't hijack a tap meant for
   the field. */
body.playing .stage a,
body.playing .stage button {
  pointer-events: none;
}

/* Game HUD — score, arrows, exit. Shown only while playing (incl. mobile). */
/* Play HUD: a responsive top bar — score+quiver on the left, actions on the
   right — so nothing collides on a narrow phone (was fixed-positioned + overlapped). */
.game-hud {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
body.playing .game-hud {
  opacity: 1;
}
.gh-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}
.gh-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gh-score {
  color: var(--dim);
  font-size: 12px;
  letter-spacing: 0.2em;
}
.gh-score b {
  color: var(--ink);
  font-weight: 600;
}
.gh-level {
  margin-left: 10px;
  color: #ffd66b;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.gh-level:empty {
  display: none;
}
.gh-arrows {
  display: flex;
  gap: 5px;
  align-items: center;
  min-height: 14px;
}
/* unlimited-arrows indicator (easy mode) */
.inf {
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
}
/* mode label — READ-ONLY during play (the mode is locked once a run starts; you
   pick it on the landing / results, never mid-game). */
.gh-diff {
  pointer-events: none;
  display: grid;
  place-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  cursor: default;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
/* tint the toggle warm once it carries real stakes (medium), hotter for hard */
body.normal .gh-diff {
  color: #ffb3bd;
  border-color: rgba(255, 90, 105, 0.4);
}
body.hard .gh-diff {
  color: #ff5a69;
  border-color: rgba(255, 90, 105, 0.85);
  background: rgba(255, 90, 105, 0.12);
}
.gh-sound {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s;
}
.gh-sound:hover {
  border-color: var(--accent);
}
.gh-exit {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.gh-exit:hover {
  color: var(--ink);
  border-color: var(--accent);
}

/* Game over */
.gameover {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(8, 9, 12, 0.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.gameover.show {
  display: flex;
}
.go-kicker {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.go-title {
  font-weight: 300;
  font-size: clamp(40px, 9vw, 76px);
  letter-spacing: -0.02em;
  line-height: 1;
  background: linear-gradient(180deg, #fff, #c7c9d4 70%, #9a9cab);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.go-score {
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.2em;
}
.go-score b {
  color: var(--ink);
}
.gameover .play {
  margin-top: 8px;
}
.go-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(92vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 4px;
}
.go-card .go-title {
  font-size: clamp(34px, 7vw, 58px);
}
.go-rank {
  min-height: 15px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
/* live "playing now" — landing badge + results line */
.go-playing {
  min-height: 14px;
  color: #5fd39a;
  font-size: 12px;
  letter-spacing: 0.06em;
}
/* per-mode leaderboard tabs on the results screen */
.go-modes {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.go-mode {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.go-mode:hover {
  color: var(--ink);
}
.go-mode.on {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.nowplaying {
  margin-top: 4px;
  color: #5fd39a;
  font-size: 11px;
  letter-spacing: 0.08em;
  animation: livepulse 2.4s ease-in-out infinite;
}
.nowplaying[hidden] {
  display: none;
}
@keyframes livepulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
/* leaderboard list */
.lb {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 3px;
}
.lb-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--mono);
  font-size: 12.5px;
}
.lb-row.me {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.lb-rank {
  text-align: right;
  color: var(--faint);
  font-size: 11px;
}
.lb-name {
  overflow: hidden;
  color: var(--dim);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-val {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lb-row.me .lb-name {
  color: var(--ink);
}
.lb-empty {
  padding: 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}
/* you + rename */
.go-you {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--dim);
  font-size: 12px;
}
.go-you b {
  color: var(--ink);
}
.go-rename {
  pointer-events: auto;
  border: none;
  background: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}
.go-name-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.go-name-edit[hidden] {
  display: none; /* an explicit display: would otherwise beat the [hidden] UA rule */
}
.go-namein {
  width: 130px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  pointer-events: auto;
}
.go-namesave {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #14141c;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  pointer-events: auto;
}
/* "Finish" button in the play HUD (banks the score — esp. for easy mode) */
.gh-finish {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  pointer-events: auto;
}
.gh-finish:hover {
  background: rgba(124, 128, 240, 0.28);
}
