:root {
  --kas: #70c7ba;
  --kas-dim: #3f7a72;
  --bg: #0a1418;
  --panel: #0f1e24;
  --text: #d9eeea;
  --gold: #f5b83d;
  --red: #e0564b;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  z-index: 5;
}
.hud-big { font-size: clamp(18px, 3.4vw, 28px); font-weight: 800; letter-spacing: 1px; }
.hud-right { text-align: right; }
.hud-price { color: var(--gold); font-size: clamp(13px, 2.2vw, 18px); margin-top: 2px; }
.hud-coins { font-size: clamp(12px, 2vw, 16px); margin-top: 2px; color: var(--kas); }
.hud-sompi {
  color: var(--gold);
  font-size: clamp(14px, 2.6vw, 22px);
  font-weight: 700;
  margin-top: 2px;
}
.hud-combo {
  display: inline-block;
  margin-top: 8px;
  color: var(--kas);
  font-weight: 800;
  font-size: clamp(13px, 2.2vw, 18px);
  letter-spacing: 1px;
}
#combo-bar {
  width: clamp(120px, 18vw, 200px);
  height: 6px;
  margin-top: 4px;
  background: rgba(112, 199, 186, 0.18);
  border-radius: 3px;
  overflow: hidden;
}
#combo-bar-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--kas);
  border-radius: 3px;
}

#toast {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 30, 36, 0.9);
  border: 1px solid var(--kas-dim);
  color: var(--kas);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 15px;
  z-index: 6;
  pointer-events: none;
  white-space: nowrap;
}

/* Sound toggle: top-right, tucked under the pause button. */
#mute {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 6;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.6;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Pause: top-right corner, clear of the HUD text block below it. */
#pause {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 7;
  width: 38px;
  height: 38px;
  background: rgba(15, 30, 36, 0.85);
  border: 1px solid var(--kas-dim);
  border-radius: 50%;
  color: var(--kas);
  font-size: 15px;
  cursor: pointer;
  /* flex-center the glyph — emoji baselines drift off-center otherwise */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
#pause:hover { border-color: var(--kas); }
/* Make room so the score block doesn't sit under the pause button. */
#hud .hud-right { padding-right: 48px; }

/* Run progress bar: bottom edge, KAS coin marker travelling toward the moon. */
#progress {
  position: fixed;
  left: 16px;
  right: 52px; /* clear of the mute button */
  bottom: 14px;
  z-index: 5;
  pointer-events: none;
}
#progress-track {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: rgba(112, 199, 186, 0.16);
  overflow: hidden;
}
#progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--kas-dim), var(--kas));
}
#progress-coin {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--kas);
  color: #081217;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  line-height: 18px;
  box-shadow: 0 0 8px rgba(112, 199, 186, 0.7);
}
#progress-moon {
  position: absolute;
  top: 50%;
  right: -4px;
  transform: translateY(-50%);
  font-size: 14px;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(112, 199, 186, 0.08), transparent 60%),
    rgba(6, 12, 15, 0.82);
  z-index: 10;
  overflow-y: auto;
  padding: 20px;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(560px, 94vw);
  background: var(--panel);
  border: 1px solid #1d3a42;
  border-radius: 16px;
  padding: 28px clamp(18px, 4vw, 36px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  margin: auto;
}

h1 { font-size: clamp(21px, 4.2vw, 34px); letter-spacing: 1px; color: var(--kas); white-space: nowrap; }
h2 { font-size: clamp(20px, 4vw, 28px); color: var(--kas); margin-bottom: 10px; }

.k-coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em; height: 1.1em;
  border-radius: 50%;
  background: var(--kas);
  color: #081217;
  font-weight: 900;
  vertical-align: -0.12em;
}

.tagline { margin: 8px 0 14px; font-size: 13.5px; line-height: 1.5; }

.howto {
  text-align: left;
  margin: 0 auto 18px;
  max-width: 440px;
  font-size: 13.5px;
  line-height: 1.7;
  list-style: none;
}
.howto li::before { content: "▸ "; color: var(--kas); }

#start-form input, #again-name {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #29505a;
  background: #0a161b;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
#start-form input:focus, #again-name:focus { outline: 2px solid var(--kas-dim); }
#again-name { max-width: 340px; margin-top: 6px; }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 13px 22px;
  font-weight: 800;
  font-size: 16px;
  background: var(--kas);
  color: #081217;
  transition: transform 0.08s, filter 0.15s;
}
button:hover { filter: brightness(1.1); }
button:active { transform: scale(0.97); }
button.secondary { background: #1d3a42; color: var(--text); }
button.linkish {
  background: none;
  color: var(--kas);
  font-weight: 600;
  font-size: 14px;
  padding: 10px;
  text-decoration: underline;
}
#play-btn { width: 100%; margin-top: 4px; }
.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* Ghost opt-in: quiet checkbox line under the start form, off by default.
   Full-width flex line so the leaderboard link lands on its own row below. */
.ghost-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 13px;
  color: #8fb5ae;
  cursor: pointer;
  user-select: none;
}
.ghost-opt input { accent-color: var(--kas); width: 15px; height: 15px; cursor: pointer; }

/* Social share row: recognizable round network buttons. */
.share-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.share-label { font-size: 12.5px; color: #8fb5ae; margin-right: 2px; }
.share-net {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: #12262d;
  border: 1px solid #1d3a42;
  color: #a9cfc9;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.share-net:hover { border-color: var(--kas); color: var(--kas); }
.share-net.copied { border-color: var(--kas); color: var(--kas); }
.share-net[hidden] { display: none; } /* authored display would otherwise beat [hidden] */

.tabs { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.tab {
  background: #12262d;
  color: #8fb5ae;
  font-size: 14px;
  padding: 8px 18px;
  border: 1px solid #1d3a42;
}
.tab.active {
  background: var(--kas);
  color: #081217;
  border-color: var(--kas);
}

.fineprint { font-size: 11.5px; line-height: 1.5; color: #8fb5ae; margin: 6px 0 12px; }
.dim { color: #567c76; }
.footer { margin-top: 16px; }
.fineprint a { color: var(--kas); }

/* Tip line: deliberately quiet — same size and colour as the other fineprint,
   just an underlined tap-to-copy address. */
.tip-line { margin-top: 2px; }
.tip-addr {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #8fb5ae;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #2a4a52;
  text-underline-offset: 2px;
}
.tip-addr:hover { color: var(--kas); }
#tip-hint { text-decoration: none; color: #567c76; }
.tip-addr.copied, .tip-addr.copied #tip-hint { color: var(--kas); }

.score-line { font-size: clamp(34px, 8vw, 54px); font-weight: 900; color: var(--gold); margin: 14px 0 6px; }
.score-breakdown { font-size: 14px; color: #8fb5ae; margin-bottom: 14px; line-height: 1.6; }

/* Leaderboard */
#board-list {
  text-align: left;
  max-height: 46vh;
  overflow-y: auto;
  margin: 14px 0 4px;
  padding-left: 0;
  list-style: none;
  font-size: 14.5px;
}
#board-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid #16303a;
}
#board-list li .rank { color: #567c76; min-width: 2.2em; }
#board-list li .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board-list li .pts { color: var(--gold); font-weight: 700; }
#board-list li.you { background: rgba(112, 199, 186, 0.12); border-radius: 6px; }
#board-list li.first .who { color: var(--gold); }

/* Kaspa Price Runner additions */
.bigline {
  margin: 12px 0 4px;
  font-size: clamp(14px, 2.4vw, 17px);
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--gold);
}
.tagline.dim { color: #8fb5ae; font-size: 13px; }
