/* Craballs - the public site of the game.
   The palette follows the game itself: grey walls, white corner posts, a yellow
   ball and the four paddle colours (blue, red, green, orange). */

:root {
  --bg: #090c14;
  --bg-2: #0e1420;
  --panel: #131a28;
  --panel-2: #18202f;
  --border: #24304a;
  --text: #eef2fb;
  --muted: #9aa6bf;
  --accent: #ffc93c;
  --accent-2: #ffd76b;
  --blue: #2f6df6;
  --red: #ff4d4d;
  --green: #4ddb4d;
  --orange: #ff9933;
  --wall: #b3b3b3;
  --link: #8fb9ff;
  --radius: 14px;
  --max: 1000px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(47, 109, 246, .16), transparent 62%),
    radial-gradient(760px 420px at 6% 4%, rgba(255, 201, 60, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  /* A phone must not rubber-band the page while the game is played. */
  overscroll-behavior-y: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 12, 20, .82);
  backdrop-filter: blur(10px);
}

header .bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 3px;
  color: var(--text);
  text-decoration: none;
}

header .brand .logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 2px solid var(--blue);
  position: relative;
  flex: none;
}

header .brand .logo::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--accent);
}

header nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 15px;
}

header nav a:hover {
  color: var(--text);
  background: var(--panel);
}

header nav a.active {
  color: var(--text);
  background: var(--panel-2);
}

header nav a.cta {
  background: var(--accent);
  color: #1d1800;
  font-weight: 700;
  padding: 8px 16px;
}

header nav a.cta:hover {
  background: var(--accent-2);
  color: #1d1800;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px 72px;
}

h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.5px;
}

/* The pages without a hero need the room under the header. */
main > h1:first-child {
  margin-top: 36px;
}

h2 {
  font-size: clamp(20px, 3vw, 26px);
  margin: 0 0 10px;
  letter-spacing: -0.2px;
}

h3 {
  font-size: 17px;
  margin: 0 0 6px;
}

p {
  color: var(--muted);
  margin: 0 0 14px;
}

a {
  color: var(--link);
}

strong {
  color: var(--text);
}

/* --- the hero ---------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 44px;
  padding: 56px 0 44px;
}

.hero .eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero .lead {
  font-size: 18px;
  color: #cdd6e8;
  max-width: 52ch;
}

.hero .sub {
  max-width: 52ch;
}

.hero .cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 26px 0 20px;
}

.hero .facts {
  display: flex;
  gap: 8px 20px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}

.hero .facts li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  vertical-align: middle;
}

/* --- the animated court (the hero visual) ----------------------------------- */

.court {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 42%, #18213a 0%, #0b111d 72%);
  border: 2px solid var(--blue);
  box-shadow: 0 0 0 8px rgba(47, 109, 246, .10), 0 30px 70px rgba(0, 0, 0, .55);
  overflow: hidden;
}

.court::before {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1px dashed rgba(154, 166, 191, .16);
  border-radius: 50%;
}

.court .wall {
  position: absolute;
  background: var(--wall);
}

.court .wall-top {
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
}

.court .wall-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  height: 7px;
}

.court .wall-left {
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
}

.court .wall-right {
  top: 0;
  bottom: 0;
  right: 0;
  width: 7px;
}

.court .post {
  position: absolute;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 3px;
}

.court .post-tl { top: -3px; left: -3px; }
.court .post-tr { top: -3px; right: -3px; }
.court .post-bl { bottom: -3px; left: -3px; }
.court .post-br { bottom: -3px; right: -3px; }

.court .paddle {
  position: absolute;
  border-radius: 4px;
}

.court .paddle-top {
  top: 10px;
  left: 50%;
  width: 26%;
  height: 9px;
  margin-left: -13%;
  background: var(--red);
  animation: slide-h 3.4s ease-in-out infinite alternate;
}

.court .paddle-bottom {
  bottom: 10px;
  left: 50%;
  width: 26%;
  height: 9px;
  margin-left: -13%;
  background: var(--blue);
  animation: slide-h 3.4s ease-in-out infinite alternate-reverse;
}

.court .paddle-left {
  left: 10px;
  top: 50%;
  width: 9px;
  height: 26%;
  margin-top: -13%;
  background: var(--green);
  animation: slide-v 2.8s ease-in-out infinite alternate;
}

.court .paddle-right {
  right: 10px;
  top: 50%;
  width: 9px;
  height: 26%;
  margin-top: -13%;
  background: var(--orange);
  animation: slide-v 2.8s ease-in-out infinite alternate-reverse;
}

.court .ball {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px rgba(255, 201, 60, .6);
  animation: ball 4.6s linear infinite;
}

@keyframes slide-h {
  from { transform: translateX(-40%); }
  to { transform: translateX(40%); }
}

@keyframes slide-v {
  from { transform: translateY(-40%); }
  to { transform: translateY(40%); }
}

@keyframes ball {
  0%   { left: 18%; top: 76%; }
  25%  { left: 50%; top: 52%; }
  50%  { left: 80%; top: 24%; }
  75%  { left: 44%; top: 32%; }
  100% { left: 18%; top: 76%; }
}

/* --- sections ---------------------------------------------------------------- */

.section {
  padding: 44px 0 0;
}

.section > .section-head {
  max-width: 62ch;
  margin-bottom: 22px;
}

.section .kicker {
  display: block;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.card p:last-child {
  margin-bottom: 0;
}

.card .mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.card.duel .mode-icon { color: var(--blue); }
.card.four .mode-icon { color: var(--orange); }

/* --- the steps --------------------------------------------------------------- */

.steps {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.step {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 22px 24px;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent);
  color: #1d1800;
  font-weight: 800;
  font-size: 15px;
}

.step p {
  margin-bottom: 0;
}

/* --- buttons ----------------------------------------------------------------- */

.button {
  display: inline-block;
  background: var(--accent);
  color: #1d1800;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
}

.button:hover {
  background: var(--accent-2);
  color: #1d1800;
}

.button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.button.ghost:hover {
  background: var(--panel);
  color: var(--text);
}

.button.small {
  padding: 9px 16px;
  font-size: 15px;
}

/* --- the call to action band ------------------------------------------------- */

.cta-band {
  margin-top: 48px;
  padding: 34px 30px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(420px 200px at 12% 0%, rgba(255, 201, 60, .16), transparent 70%),
    linear-gradient(120deg, #16203a 0%, #131a28 60%);
  text-align: center;
}

.cta-band h2 {
  margin-bottom: 8px;
}

.cta-band p {
  margin-bottom: 20px;
}

/* --- the download cards ------------------------------------------------------ */

.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.dl-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease;
}

.dl-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.dl-card .dl-name {
  font-weight: 700;
  font-size: 17px;
}

.dl-card .dl-meta {
  color: var(--muted);
  font-size: 14px;
}

.dl-card .dl-action {
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}

.notice {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--muted);
}

.notice a {
  color: var(--link);
}

/* --- tables ------------------------------------------------------------------ */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  width: 38%;
}

td {
  color: #cdd6e8;
}

tr:last-child th,
tr:last-child td {
  border-bottom: 0;
}

kbd {
  display: inline-block;
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* --- the play frame ---------------------------------------------------------- */

.play-frame {
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  display: block;
  /* The game handles the touches itself - the page must not scroll or zoom
     while a finger is on the game. */
  touch-action: none;
}

.how-to-play {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.how-to-play li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--muted);
  font-size: 15px;
}

.how-to-play li b {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 4px;
}

/* --- the footer -------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  background: rgba(0, 0, 0, .25);
}

footer .bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

footer .bar nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

footer .bar nav a {
  color: var(--muted);
  text-decoration: none;
}

footer .bar nav a:hover {
  color: var(--text);
}

/* --- small screens ----------------------------------------------------------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 34px 0 30px;
    text-align: left;
  }

  .hero .cta-row {
    justify-content: flex-start;
  }

  header .bar {
    gap: 10px;
  }

  header nav {
    margin-left: 0;
    width: 100%;
  }

  .play-frame {
    height: calc(100vh - 230px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .court .paddle,
  .court .ball {
    animation: none;
  }
}
