/* ==========================================================================
   Ridgeline — Ibrahim Games skin.
   The same look as the portal and the 3D games: Nunito + Lilita One, the dark
   ink palette, chunky yellow Play buttons, image tiles. Layered over
   style.css (which keeps the layout + HUD mechanics), so every rule here is
   scoped under `body` to win over that file's media-query passes.
   ========================================================================== */

@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-latin-var.woff2") format("woff2"); font-weight: 600 900; font-display: swap; }
@font-face { font-family: "Lilita One"; src: url("/assets/fonts/lilita-one-latin.woff2") format("woff2"); font-display: swap; }

:root {
  --font: "Nunito", "Segoe UI", system-ui, sans-serif;
  --display: "Lilita One", "Nunito", system-ui, sans-serif;
  --ink: #f6f7ff;
  --dim: #b9bdd9;
  --accent: #ffcc1f;
  --accent-deep: #d99a00;
  --panel: rgba(12, 14, 30, 0.9);
  --surface: #171a2e;
  --surface-2: #21253f;
  --line: rgba(255, 255, 255, 0.08);
}

body { font-family: var(--font); font-weight: 700; }
body button, body input { font-family: var(--font); }

/* ---------- panels ---------- */
body .panel {
  border-radius: 26px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 28, 56, 0.94), rgba(10, 12, 26, 0.95));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
body .panel h2, body .panel-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}
body .panel .tag { color: var(--dim); font-weight: 700; }
body .back {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 0;
  font-size: 22px;
  font-weight: 900;
}
body .back:hover { background: #2c3152; }

/* ---------- title ---------- */
body .title-wide { width: min(1180px, 94vw); padding-top: 22px; }
body .brand .studio {
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--accent);
}
body .title-wide .game-name,
body .game-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(46px, 7vh, 72px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  background: none;
  -webkit-text-fill-color: #fff;
  color: #fff;
  text-shadow: 0 5px 0 #c9780f, 0 10px 24px rgba(0, 0, 0, 0.4);
  transform: rotate(-2deg);
  animation: rl-logo 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
body .game-name::after { display: none; }
body .game-kind {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 0.34em;
  letter-spacing: 0.12em;
  -webkit-text-fill-color: var(--accent);
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
@keyframes rl-logo { from { transform: rotate(-2deg) scale(0.5); opacity: 0; } }
body .title-wide .tag { font-size: 15px; color: var(--dim); }

body .ts-chip {
  border-radius: 999px;
  background: var(--surface-2);
  border: 0;
  font-weight: 900;
  padding: 6px 14px;
}

/* The big Play button — same as every Ibrahim Games title screen. */
body .title-wide .hero-play,
body .hero-play {
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffd84a, #ff9a1f);
  color: #1b1200;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 0.03em;
  box-shadow: 0 7px 0 #b3470a, 0 16px 34px rgba(0, 0, 0, 0.4);
  border: 0;
  animation: rl-breathe 2.4s ease-in-out infinite;
}
body .hero-play:hover { animation: none; transform: translateY(-3px) scale(1.02); filter: none; }
body .hero-play:active { transform: translateY(4px); box-shadow: 0 3px 0 #b3470a; }
body .hero-play .hp-ic { background: rgba(0, 0, 0, 0.15); color: #1b1200; }
body .title-wide .hero-play::after { display: none; }
@keyframes rl-breathe { 50% { transform: scale(1.03); } }

body .home-section {
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #fff;
}
body .home-section small { font-family: var(--font); font-weight: 700; font-size: 14px; color: var(--dim); letter-spacing: 0; }

/* ---------- world tiles (real cover art) ---------- */
body .home-track-grid,
body #track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
body .track-card,
body .home-track-grid .track-card,
body .track-card.compact {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
  padding: 0;
  border-radius: 16px;
  border: 0;
  background: var(--card-accent, var(--surface-2));
  overflow: hidden;
  text-align: left;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}
body .track-card::before { display: none; }
body .track-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(6, 8, 18, 0.9));
  pointer-events: none;
}
body .track-card:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 0 0 3px var(--card-accent, var(--accent)), 0 16px 34px rgba(0, 0, 0, 0.5);
  background: var(--card-accent, var(--surface-2));
}
body .track-thumb { position: absolute; inset: 0; }
body .track-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 2.5s ease-out; }
body .track-card:hover .track-thumb img { transform: scale(1.12); }
body .track-card .track-emoji,
body .track-card.compact .track-emoji {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 17px;
  background: rgba(6, 8, 18, 0.6);
  backdrop-filter: blur(4px);
}
body .track-card .track-info {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  z-index: 2;
  gap: 1px;
}
body .track-card .track-name,
body .track-card.compact .track-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.02em;
  padding-right: 0;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body .track-card .track-foot,
body .track-card.compact .track-foot { font-size: 12px; color: rgba(255, 255, 255, 0.85); font-weight: 800; }
body .track-card .track-blurb { display: none; }
body .track-card .track-stars {
  position: absolute;
  top: 7px;
  right: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 9px;
  background: rgba(6, 8, 18, 0.6);
  font-size: 13px;
  color: var(--accent);
}
/* The full Adventures screen shows the story under each tile. */
body #track-grid .track-card .track-blurb { display: none; }

/* ---------- challenge (mode) cards with covers ---------- */
body .mode-grid { gap: 12px; }
body .mode-card {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  border-radius: 16px;
  border: 0;
  background: var(--surface-2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  padding: 12px 14px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}
body .mode-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6, 8, 18, 0.85), rgba(6, 8, 18, 0.15)); pointer-events: none; }
body .mode-card .mc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
body .mode-card > :not(.mc-img) { position: relative; z-index: 1; }
body .mode-card .mc-emoji { font-size: 22px; }
body .mode-card b { font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: 0.02em; }
body .mode-card small { color: rgba(255, 255, 255, 0.85); font-weight: 800; }
body .mode-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 0 0 3px var(--accent), 0 14px 30px rgba(0, 0, 0, 0.5); }

body .chip-btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 2px solid transparent;
  font-weight: 900;
  font-size: 15px;
}
body .chip-btn:hover { border-color: var(--accent); background: #2c3152; }

body .keys kbd, body .keys.compact kbd {
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  font-family: var(--font);
  font-weight: 900;
}
body .seo-about { font-weight: 600; }

/* ---------- levels, garage, tricks ---------- */
body .pack, body h3.pack { font-weight: 900; letter-spacing: 0.14em; color: var(--accent); }
body .lvl {
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface-2);
  transition: transform 0.15s, border-color 0.15s;
}
body .lvl:hover { transform: translateY(-3px); border-color: var(--accent); background: #2c3152; }
body .lvl-name { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: 0.02em; }
body .lvl-stars i.on { color: var(--accent); text-shadow: 0 0 8px rgba(255, 204, 31, 0.6); }
body .bike { border-radius: 16px; background: var(--surface-2); border: 2px solid transparent; }
body .bike.active { border-color: var(--accent); }
body .bike-name { font-family: var(--display); font-weight: 400; font-size: 18px; }
body .stars-total { font-weight: 900; }

/* ---------- result + run-over buttons ---------- */
body .modes button {
  height: 52px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 16px;
  border: 0;
}
body .modes button.primary {
  background: linear-gradient(180deg, #ffd84a, #ff9a1f);
  color: #1b1200;
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.03em;
  box-shadow: 0 5px 0 #b3470a;
}
body .modes button.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 #b3470a; }
body .modes button.ghost { background: var(--surface-2); color: #fff; }
body .modes button.ghost:hover { background: #2c3152; }
body #result-title, body #screen-over h2 { font-size: 40px; }

/* ---------- in-ride HUD ---------- */
body #hud { gap: 10px; padding: 14px 16px; text-shadow: none; }
body #hud .stat {
  min-width: 78px;
  padding: 5px 12px 7px;
  border-radius: 14px;
  background: rgba(10, 14, 30, 0.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
body #hud .stat .label { font-size: 10px; font-weight: 900; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.65); }
body #hud .stat .value { font-family: var(--display); font-weight: 400; font-size: 24px; }
body #toast { font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; text-shadow: 0 4px 0 #c9780f, 0 8px 18px rgba(0, 0, 0, 0.45); }
body #hint { font-weight: 900; border-radius: 999px; background: rgba(10, 14, 30, 0.7); }
body #unlock { font-family: var(--display); font-weight: 400; }

/* Mute + the new in-ride bar (pause, exit), top-right. */
body #mute {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(10, 14, 30, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  font-size: 18px;
}
#play-bar { display: none; }
body.playing #play-bar {
  position: fixed;
  top: 16px;
  right: 70px;
  z-index: 8;
  display: flex;
  gap: 8px;
}
#play-bar button {
  height: 46px;
  min-width: 46px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 14, 30, 0.62);
  backdrop-filter: blur(8px);
  color: #fff;
  font: 900 15px var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
#play-bar button:hover { background: rgba(20, 26, 52, 0.9); transform: translateY(-1px); }
#play-bar #exit-btn { background: rgba(232, 48, 58, 0.85); border-color: rgba(255, 255, 255, 0.3); }
#play-bar #exit-btn:hover { background: #e8303a; }
/* In a friends room the roster sits top-right: keep the bar clear of it. */
body.friends.playing #play-bar { top: 16px; }

/* Pause menu */
#pause-menu { display: none; }
#pause-menu.open {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 45%, rgba(8, 10, 22, 0.5), rgba(8, 10, 22, 0.85));
  backdrop-filter: blur(3px);
}
.pm-card {
  width: min(400px, 92vw);
  padding: 24px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(24, 30, 60, 0.97), rgba(12, 16, 34, 0.97));
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: rl-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pm-card h2 { font-family: var(--display); font-weight: 400; font-size: 40px; letter-spacing: 0.02em; color: #fff; text-shadow: 0 4px 0 #c9780f; margin-bottom: 6px; }
.pm-card button, .pm-card a {
  height: 52px;
  border-radius: 16px;
  border: 0;
  background: #21253f;
  color: #fff;
  font: 900 16px var(--font);
  text-decoration: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pm-card button:hover, .pm-card a:hover { background: #2c3152; }
.pm-card .pm-go { height: 62px; background: linear-gradient(180deg, #ffd84a, #ff9a1f); color: #1b1200; font-family: var(--display); font-weight: 400; font-size: 26px; box-shadow: 0 6px 0 #b3470a; }
.pm-card .pm-go:hover { background: linear-gradient(180deg, #ffe066, #ffab3a); }
.pm-row { display: flex; gap: 10px; }
.pm-row button { flex: 1; }
@keyframes rl-pop { from { transform: scale(0.85); opacity: 0; } }

/* Home + Friends pills on the menu match the portal. */
body.at-title:not(.playing) #home-btn {
  height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  font: 900 15px var(--font);
}

/* Start card + room notice */
body .sc-title { font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; }
body .sc-play { font-family: var(--display); font-weight: 400; background: linear-gradient(180deg, #ffd84a, #ff9a1f); box-shadow: 0 5px 0 #b3470a; }
body .fmodal-card h2 { font-family: var(--display); font-weight: 400; font-size: 28px; }

/* Touch buttons: round glass like the 3D games. */
body .tbtn { border-radius: 50%; background: rgba(10, 14, 30, 0.45); border: 3px solid rgba(255, 255, 255, 0.35); backdrop-filter: blur(4px); }

@media (max-width: 700px) {
  body .home-track-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  body .track-card .track-name { font-size: 15px; }
  body.playing #play-bar { right: 66px; top: 12px; }
  #play-bar #exit-btn span { display: none; }
  body #hud .stat { min-width: 0; padding: 4px 8px 5px; }
  body #hud .stat .value { font-size: 18px; }
}
/* Narrow portrait phones: pause/exit move under the stats (they sat on top of
   them), the stats wrap instead of running under the buttons, and the boost
   meter steps down out of the way. */
@media (max-width: 520px) and (orientation: portrait) {
  body #hud { flex-wrap: wrap; padding-right: 70px; gap: 6px; }
  body.playing #play-bar { top: auto; bottom: auto; top: 124px; right: 12px; }
  body.touch #boost { top: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  body .game-name, body .hero-play, .pm-card { animation: none; }
}

/* The vertical BOOST label, centred in its meter (it used to hang off the bottom as "OOST"). */
body #boost { border-radius: 12px; }
body #boost .boost-label {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%) rotate(-90deg);
  white-space: nowrap;
  font-weight: 900;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.75);
}

/* Phones: three challenge cards side by side must fit the panel. */
@media (max-width: 520px) {
  body .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body .mode-card { min-height: 78px; padding: 8px 9px; }
  body .mode-card b { font-size: 16px; }
  body .mode-card .mc-emoji { font-size: 17px; }
  body .mode-card small { display: none; }
}
