@font-face {
  font-family: "Gilroy";
  src: url("../../../fonts/Gilroy-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Gilroy";
  src: url("../../../fonts/Gilroy-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Gilroy";
  src: url("../../../fonts/Gilroy-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Gilroy";
  src: url("../../../fonts/Gilroy-Extrabold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --vvw: 100vw;
  --vvh: 100svh;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  overflow: hidden;
  background: #1e0041;
  color: #f1f1f1;
  font-family: "Gilroy", system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--vvw);
  height: var(--vvh);
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

#playfield {
  position: relative;
  flex: 0 0 auto;
  width: min(var(--vvw), calc(var(--vvh) * 480 / 800));
  height: auto;
  aspect-ratio: 480 / 800;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  overscroll-behavior: none;
  --chip: 44px;
  --chip-gap: 8px;
  --chip-top: 31px;
  --chip-left: 22px;
  --chip-right: 22px;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud-chip {
  position: absolute;
  top: var(--chip-top);
  width: var(--chip);
  height: var(--chip);
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #902ff2, #ff0090);
  box-shadow: 0 3px 0 rgba(30, 0, 65, 0.35);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 6;
}

.hud-chip:active {
  filter: brightness(0.92);
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(30, 0, 65, 0.35);
}

#back-button {
  left: var(--chip-left);
}

#hud-corner {
  position: absolute;
  top: var(--chip-top);
  right: var(--chip-right);
  z-index: 6;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--chip-gap);
}

#hud-corner .hud-chip {
  position: relative;
  top: auto;
  right: auto;
}

.hud-chip svg {
  width: 50%;
  height: 50%;
  fill: currentColor;
}

#back-button svg {
  fill: none;
}

#help-button svg {
  fill: currentColor;
}

#mute-button .slash {
  display: none;
}

#mute-button.is-muted .waves {
  display: none;
}

#mute-button.is-muted .slash {
  display: block;
}

#overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  background: rgba(30, 0, 65, 0.42);
}

#overlay[hidden] {
  display: none;
}

.card {
  --scale: min(var(--vvw) / 480px, var(--vvh) / 800px);
  --field-w: min(var(--vvw), calc(var(--vvh) * 480 / 800));
  width: calc(var(--field-w) * 0.9);
  max-width: 100%;
  height: auto;
  max-height: min(calc(var(--vvh) * 0.86), 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  font-size: clamp(12px, calc(var(--scale) * 17px), 22px);
  padding: 1.45em 1.35em 1.2em;
  border-radius: 2.15em 0.7em 0.7em 0.7em;
  background: linear-gradient(135deg, rgba(144, 47, 242, 0.94), rgba(255, 0, 144, 0.88));
  color: #fff;
  text-align: left;
}

.card[hidden] {
  display: none;
}

.card h1 {
  margin: 0 0 0.32em;
  font-size: 1.85em;
  font-weight: 800;
  line-height: 1.05;
}

.lead {
  margin: 0 0 0.7em;
  font-size: 1.05em;
  font-weight: 800;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.95);
}

.tutorial-skip {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin: 0 0 0.9em;
  font-size: 0.95em;
  font-weight: 800;
  cursor: pointer;
}

.tutorial-skip input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.tutorial-check {
  width: 1.35em;
  height: 1.35em;
  flex-shrink: 0;
  border-radius: 0.28em;
  background: rgba(12, 0, 28, 0.5);
  border: 0.09em solid rgba(241, 241, 241, 0.4);
  position: relative;
}

.tutorial-check::after {
  content: "";
  position: absolute;
  left: 0.32em;
  top: 0.08em;
  width: 0.32em;
  height: 0.62em;
  border: solid #1e003c;
  border-width: 0 0.14em 0.14em 0;
  transform: rotate(45deg);
  opacity: 0;
}

.tutorial-skip input:checked + .tutorial-check {
  background: #902ff2;
  border-color: rgba(241, 241, 241, 0.7);
}

.tutorial-skip input:checked + .tutorial-check::after {
  opacity: 1;
}

.score {
  margin: 0.2em 0 0.1em;
  font-size: 2.35em;
  font-weight: 800;
  color: #fad604;
}

.stat {
  margin: 0 0 0.7em;
  font-size: 1.05em;
  font-weight: 800;
  color: #fad604;
}

.stat[hidden] {
  display: none;
}

.rules {
  font-size: 1.05em;
  font-weight: 800;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.95);
}

.rules p {
  margin: 0;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65em;
  margin-top: 1em;
}

.actions-row {
  display: flex;
  gap: 0.65em;
}

.actions-row button {
  flex: 1;
  min-width: 0;
}

.actions button {
  padding: 0.75em 1.05em;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font: 800 1.05em/1 "Gilroy", system-ui, sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.actions button.primary {
  background: #ff0090;
  box-shadow: none;
}

.actions button:active {
  background: #e00080;
}
