/* The Gliss demonstration: a scripted loop that shows the rules.
   Not the game: nothing here responds to a flick. Colours, puck shading and
   numerals are copied from the game's own styles.css so it looks like itself. */

.gliss-demo {
  --gd-bg: #0d1322;
  --gd-rink: #16203a;
  --gd-rink-edge: #24335a;
  --gd-dot: #2b3b66;
  --gd-ink: #eef2fd;
  --gd-muted: #8a96b8;
  --gd-accent: #8fdcff;
  --gd-font: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;

  container-type: inline-size;
  position: relative;
  aspect-ratio: 100 / 178;
  overflow: hidden;
  background: radial-gradient(120% 60% at 50% 0%, #17223f 0%, var(--gd-bg) 62%);
  color: var(--gd-ink);
  font-family: var(--gd-font);
  -webkit-user-select: none;
  user-select: none;
}

.gd-top {
  position: absolute;
  left: 6cqw;
  right: 6cqw;
  top: 6cqw;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.gd-wordmark {
  margin: 0;
  font-size: 9cqw;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.gd-wordmark i {
  position: relative;
  font-style: normal;
}

/* The dot of the "i" is a puck, as in the game. */
.gd-wordmark i::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0.1em;
  width: 0.19em;
  height: 0.19em;
  margin-left: -0.095em;
  border-radius: 50%;
  background: var(--gd-accent);
}

.gd-scores {
  position: absolute;
  left: 6.5cqw;
  right: 6.5cqw;
  bottom: calc(5cqw + 135cqw + 4cqw);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.gd-scores span {
  display: block;
  font-size: 3.1cqw;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gd-muted);
}

.gd-scores output {
  display: block;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.gd-score output {
  font-size: 12cqw;
}

.gd-best {
  text-align: right;
}

.gd-best output {
  margin-top: 0.6cqw;
  font-size: 6.2cqw;
}

.gd-rink {
  --cell: 22.5cqw;
  position: absolute;
  left: 5cqw;
  right: 5cqw;
  bottom: 5cqw;
  height: 135cqw;
  border-radius: 8cqw;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gd-rink) 93%, white) 0%, var(--gd-rink) 26%);
  box-shadow: inset 0 0 0 max(1px, 0.5cqw) var(--gd-rink-edge), inset 0 2cqw 6cqw rgba(0, 0, 0, 0.25);
}

.gd-board {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, var(--gd-dot) 0 7%, transparent 8.5%);
  background-size: var(--cell) var(--cell);
  transition: opacity 320ms ease-out;
}

.gd-board.is-resetting {
  opacity: 0;
}

.gd-tile,
.gd-ring,
.gd-finger,
.gd-gain {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cell);
  height: var(--cell);
  translate: calc(var(--cell) * var(--x, 0)) calc(var(--cell) * var(--y, 0));
}

.gd-tile {
  transition: translate var(--slide, 0ms) cubic-bezier(0.3, 0.7, 0.4, 1);
  will-change: translate;
}

.gd-puck {
  --c: #d7e7f8;
  --rim: color-mix(in srgb, var(--c) 58%, black);
  --tile-ink: #14203c;
  position: absolute;
  inset: 5.5%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--tile-ink);
  font-size: calc(var(--cell) * 0.5);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: radial-gradient(
    circle at 34% 26%,
    color-mix(in srgb, var(--c) 72%, white) 0%,
    var(--c) 52%,
    color-mix(in srgb, var(--c) 88%, black) 100%
  );
  box-shadow: inset 0 calc(var(--cell) * 0.02) 0 color-mix(in srgb, var(--c) 60%, white),
    0 calc(var(--cell) * 0.05) 0 var(--rim), 0 calc(var(--cell) * 0.1) calc(var(--cell) * 0.14) rgba(0, 0, 0, 0.38);
}

.gd-puck span {
  transform: translateY(-3%);
}

.gd-tile[data-digits='2'] .gd-puck {
  font-size: calc(var(--cell) * 0.42);
  letter-spacing: -0.03em;
}
.gd-tile[data-digits='3'] .gd-puck {
  font-size: calc(var(--cell) * 0.35);
  letter-spacing: -0.03em;
}

.gd-tile[data-tier='2'] .gd-puck { --c: #8fd0f8; }
.gd-tile[data-tier='3'] .gd-puck { --c: #4fd2c0; }
.gd-tile[data-tier='4'] .gd-puck { --c: #93df74; }
.gd-tile[data-tier='5'] .gd-puck { --c: #f7dc4d; }
.gd-tile[data-tier='6'] .gd-puck { --c: #ffab4a; }
.gd-tile[data-tier='7'] .gd-puck { --c: #ff7767; }
.gd-tile[data-tier='8'] .gd-puck { --c: #f763a6; --tile-ink: #2c0a1c; }

.gd-tile.is-held .gd-puck {
  filter: brightness(1.12);
  scale: 1.06;
}

.gd-tile.is-fused .gd-puck {
  animation: gd-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gd-tile.is-landing .gd-puck {
  animation: gd-land 420ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes gd-pop {
  0% { scale: 1.28; }
  100% { scale: 1; }
}

@keyframes gd-land {
  0% { scale: 0.2; opacity: 0; }
  100% { scale: 1; opacity: 1; }
}

.gd-ring::before {
  content: '';
  position: absolute;
  inset: 27%;
  border-radius: 50%;
  border: max(1.5px, calc(var(--cell) * 0.03)) dashed color-mix(in srgb, var(--gd-accent) 70%, transparent);
  animation: gd-turn 6s linear infinite;
}

.gd-ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--cell) * 0.24);
  font-weight: 600;
  color: var(--gd-accent);
}

.gd-ring.is-called::before {
  animation: gd-turn 6s linear infinite, gd-call 700ms ease-in-out 2;
}

@keyframes gd-turn {
  to { rotate: 360deg; }
}

@keyframes gd-call {
  50% { scale: 1.45; border-color: var(--gd-accent); }
}

.gd-finger {
  z-index: 3;
  opacity: 0;
  transition: translate var(--drag, 0ms) cubic-bezier(0.5, 0, 0.3, 1), opacity 180ms ease-out;
}

.gd-finger.is-down {
  opacity: 1;
}

.gd-finger::before {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 max(2px, calc(var(--cell) * 0.045)) rgba(255, 255, 255, 0.75);
}

.gd-gain {
  z-index: 4;
  display: grid;
  place-items: center;
  font-size: calc(var(--cell) * 0.3);
  font-weight: 700;
  color: #ffd75e;
  text-shadow: 0 calc(var(--cell) * 0.03) calc(var(--cell) * 0.08) rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: gd-gain 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gd-gain {
  0% { transform: translateY(-20%); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-95%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .gd-ring::before,
  .gd-ring.is-called::before {
    animation: none;
  }
  .gd-board,
  .gd-tile,
  .gd-finger {
    transition: none;
  }
  .gd-tile.is-fused .gd-puck,
  .gd-tile.is-landing .gd-puck {
    animation: none;
  }
}

/* ------------------------------------------------------------ the taster
   Twenty real flicks, played with the game's own rules (assets/gliss/engine.js). */

.gd-go {
  position: absolute;
  right: 5cqw;
  top: 4.6cqw;
  z-index: 6;
  min-height: max(44px, 11cqw);
  padding: 0 max(16px, 4.6cqw);
  border: 0;
  border-radius: 999px;
  background: var(--gd-accent);
  color: #06233a;
  font: 600 max(0.875rem, 4.3cqw) / 1 var(--gd-font);
  cursor: pointer;
  box-shadow: 0 1.2cqw 0 #4ea5cf;
  transition: translate 120ms ease-out, box-shadow 120ms ease-out;
}

.gd-go:hover {
  translate: 0 -0.3cqw;
  box-shadow: 0 1.5cqw 0 #4ea5cf;
}

.gd-go:active {
  translate: 0 0.8cqw;
  box-shadow: 0 0.4cqw 0 #4ea5cf;
}

.gd-go:focus-visible,
.gd-end button:focus-visible {
  outline: max(2px, 0.8cqw) solid #fff;
  outline-offset: max(2px, 0.8cqw);
}

.gliss-demo.is-playing .gd-tile {
  cursor: grab;
  touch-action: none;
}

.gliss-demo.is-playing .gd-board:focus-visible {
  outline: max(2px, 0.8cqw) solid var(--gd-accent);
  outline-offset: 1cqw;
  border-radius: 7cqw;
}

.gd-board:focus {
  outline: none;
}

/* Keyboard play: the tile the arrow keys are on. */
.gd-board:focus-visible .gd-tile.is-cursor .gd-puck {
  outline: max(2px, 0.9cqw) solid #fff;
  outline-offset: max(1px, 0.5cqw);
}

.gd-end {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3cqw;
  padding: 8cqw;
  border-radius: 8cqw;
  background: rgba(8, 12, 24, 0.86);
  text-align: center;
  animation: gd-end-in 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gd-end[hidden] {
  display: none;
}

.gd-end strong {
  font-size: 13cqw;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.gd-end p {
  margin: 0;
  font-size: 4.6cqw;
  line-height: 1.35;
  color: #c6cee6;
  text-wrap: balance;
}

.gd-end p:first-child {
  font-size: 3.6cqw;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gd-muted);
}

.gd-end button {
  min-height: max(44px, 13cqw);
  margin-top: 2cqw;
  padding: 0 max(20px, 7cqw);
  border: 0;
  border-radius: 999px;
  background: var(--gd-accent);
  color: #06233a;
  font: 600 max(1rem, 5cqw) / 1 var(--gd-font);
  cursor: pointer;
}

@keyframes gd-end-in {
  from { opacity: 0; }
}

.gd-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .gd-go,
  .gd-end {
    transition: none;
    animation: none;
  }
}
