/* Ride the Chart (?ride, formerly Buy the Dip at ?dip). The game itself is one canvas; this styles the menu and the end card over it. */
html.dip-on, html.dip-on body { overflow: hidden; overscroll-behavior: none; }
#dip {
  position: fixed; inset: 0; z-index: 9999; background: #03040a; color: #fff; overflow: hidden;
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#dip { --up: #1ff2a0; --down: #ff3d71; --down-rgb: 255, 61, 113; --coin: #ffc53d; --accent: #1fe08f; --btn-bg: #1ff2a0; --btn-ink: #04140d; }
#dip [hidden] { display: none !important; }
#dip-cv { position: absolute; inset: 0; display: block; touch-action: none; cursor: pointer; }

.dip-menu, .dip-end {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); text-align: center;
  overflow-y: auto;
}
.dip-end { background: rgba(3, 4, 10, 0.72); animation: dip-in 0.35s ease-out; }
@keyframes dip-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

.dip-logo {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.08em 0.28em; font: 800 clamp(38px, 10vw, 104px)/0.95 "JetBrains Mono", ui-monospace, Menlo, monospace;
  letter-spacing: -0.04em; color: #fff;
}
.dip-logo-dip { color: var(--down); text-shadow: 0 0 34px rgba(var(--down-rgb), 0.65); transform: translateY(0.14em) rotate(4deg); display: inline-block; }
.dip-tag { margin: 0; font-size: clamp(14px, 2.4vw, 19px); line-height: 1.45; color: rgba(255, 255, 255, 0.78); }
.dip-how { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; font-size: clamp(13px, 2vw, 16px); color: rgba(255, 255, 255, 0.78); margin: 2px 0 8px; }
.dip-how b { color: #fff; font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }
.dip-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; }
.dip-red { background: var(--down); box-shadow: 0 0 12px var(--down); }
.dip-green { background: var(--up); box-shadow: 0 0 12px var(--up); }

.dip-btn {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.06); color: #fff;
  width: min(360px, 100%); padding: 14px 18px; border-radius: 14px; cursor: pointer; font: inherit;
  display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; gap: 2px 12px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.dip-btn b { font: 800 18px "JetBrains Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.02em; }
.dip-btn small { grid-column: 1; font-size: 13px; color: rgba(255, 255, 255, 0.62); }
.dip-btn em { grid-column: 2; grid-row: 1 / span 2; font: 800 12px "JetBrains Mono", ui-monospace, Menlo, monospace; font-style: normal; color: var(--coin); }
.dip-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.45); }
.dip-btn:active { transform: scale(0.97); }
.dip-btn:focus-visible, .dip-link:focus-visible, .dip-pause:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.dip-btn-main { background: var(--btn-bg); border-color: transparent; color: var(--btn-ink); box-shadow: 0 0 40px rgba(255, 255, 255, 0.12); }
.dip-btn-main small { color: var(--btn-ink); opacity: 0.72; }
.dip-btn-main em { color: var(--btn-ink); }
.dip-btn-main:hover { filter: brightness(1.12); }
.dip-end .dip-btn-main { grid-template-columns: 1fr; text-align: center; }
.dip-row { display: flex; gap: 10px; width: min(360px, 100%); }
.dip-btn-sm { grid-template-columns: 1fr; text-align: center; padding: 11px 12px; }
.dip-btn-sm b { font-size: 14px; }

.dip-foot { display: flex; gap: 22px; margin-top: 8px; }
.dip-link {
  appearance: none; background: none; border: 0; padding: 6px 4px; cursor: pointer; text-decoration: none;
  font: 800 11px "JetBrains Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.5);
}
.dip-link:hover { color: #fff; }

.dip-end-title {
  font: 800 clamp(38px, 10vw, 88px)/1 "JetBrains Mono", ui-monospace, Menlo, monospace; letter-spacing: -0.03em;
  color: var(--down); text-shadow: 0 0 40px rgba(var(--down-rgb), 0.7);
}
.dip-end-where { font-size: clamp(22px, 4.6vw, 38px); font-weight: 700; line-height: 1.15; }
.dip-end-sub { font-size: clamp(13px, 2vw, 16px); color: rgba(255, 255, 255, 0.65); margin-top: -8px; }
.dip-end-score { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.dip-end-score b { font: 800 clamp(34px, 7vw, 56px)/1 "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--coin); }
.dip-end-score small { font: 800 13px "JetBrains Mono", ui-monospace, Menlo, monospace; color: rgba(255, 255, 255, 0.6); }
.dip-end-best { font: 800 12px "JetBrains Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.6); min-height: 14px; margin-top: -6px; }
.dip-end-break { font: 500 12px "JetBrains Mono", ui-monospace, Menlo, monospace; color: rgba(255, 255, 255, 0.6); margin-top: -8px; }
.dip-end-race { font: 800 14px "JetBrains Mono", ui-monospace, Menlo, monospace; color: rgba(255, 255, 255, 0.85); padding: 8px 14px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 10px; }
.dip-end-race.won { color: var(--up); border-color: var(--up); }
.dip-challenge { width: min(360px, 100%); display: grid; gap: 8px; padding: 12px; border-radius: 16px; border: 1px dashed rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.05); }
.dip-challenge p { margin: 0; font-size: 14px; line-height: 1.4; color: #fff; }
.dip-btn-race { width: 100%; background: #fff; color: #05060c; border-color: #fff; }
.dip-btn-race small { color: rgba(5, 6, 12, 0.65); }
.dip-btn-race:hover { background: #e8e8f0; }
.dip-note { font-size: 13px; color: rgba(255, 255, 255, 0.7); min-height: 16px; }

.dip-pause {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 34px; height: 34px; border-radius: 50%;
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.7);
  font: 500 20px/1 system-ui, sans-serif; cursor: pointer;
}
.dip-pause:hover { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
@media (prefers-reduced-motion: reduce) { .dip-end { animation: none; } }

/* Posting a score (end screen) and the leaderboard (from the menu). */
.dip-post { display: flex; gap: 10px; width: min(360px, 100%); }
.dip-post input {
  width: 92px; flex: none; text-align: center; padding: 10px 8px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08); color: #fff; font: 800 20px "JetBrains Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.18em;
  text-transform: uppercase; -webkit-user-select: text; user-select: text;
}
.dip-post input::placeholder { color: rgba(255, 255, 255, 0.3); }
.dip-post input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.dip-post .dip-btn { flex: 1; }
.dip-btn:disabled { opacity: 0.5; cursor: default; }
.dip-lb {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); background: rgba(3, 4, 10, 0.86); overflow-y: auto;
}
.dip-lb-title { font: 800 clamp(28px, 7vw, 48px)/1 "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--coin); letter-spacing: 0.02em; }
.dip-lb-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dip-lb-tab {
  appearance: none; cursor: pointer; padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25); background: none;
  color: rgba(255, 255, 255, 0.7); font: 800 12px "JetBrains Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.06em;
}
.dip-lb-tab.on { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.dip-lb-list { list-style: none; margin: 0; padding: 0; width: min(440px, 100%); counter-reset: lb; display: grid; gap: 6px; }
.dip-lb-list li {
  counter-increment: lb; display: grid; grid-template-columns: 26px 48px 1fr auto auto; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); font: 500 13px "JetBrains Mono", ui-monospace, Menlo, monospace;
}
.dip-lb-list li::before { content: counter(lb); color: rgba(255, 255, 255, 0.45); font-weight: 800; }
.dip-lb-list li:first-child { background: rgba(255, 197, 61, 0.14); }
.dip-lb-list b { font-weight: 800; letter-spacing: 0.08em; }
.dip-lb-list span { color: rgba(255, 255, 255, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dip-lb-list em { font-style: normal; font-weight: 800; color: var(--coin); white-space: nowrap; }
.dip-lb-race {
  appearance: none; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.35); background: none; color: #fff; border-radius: 8px;
  padding: 5px 8px; font: 800 11px "JetBrains Mono", ui-monospace, Menlo, monospace;
}
.dip-lb-race:hover { background: rgba(255, 255, 255, 0.12); }
.dip-lb .dip-btn-sm { width: min(200px, 100%); }
@media (max-width: 380px) { .dip-lb-list li { grid-template-columns: 20px 42px 1fr auto; } .dip-lb-list span { display: none; } }
/* The chain buttons keep their own colors on hover (the plain hover above would wash them out). */
.dip-btn-main:hover { background: var(--btn-bg); border-color: transparent; }
