@font-face {
  font-family: "Roboto";
  src: url("../Assets/Fonts/Roboto-Latin-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --neon-pink: #ff38ea;
  --neon-cyan: #33eaff;
  --neon-purple: #8b2cff;
  --logical-width: 1280px;
  --logical-height: 720px;
  --screen-transition: 320ms;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #050008;
  color: #fff;
  font-family: "Roboto", Arial, sans-serif;
  touch-action: none;
}

button,
img {
  -webkit-user-drag: none;
  user-drag: none;
}

#gameHost {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at center, #180429, #030005 75%);
}

#gameView {
  position: relative;
  width: var(--logical-width);
  height: var(--logical-height);
  flex: 0 0 auto;
  overflow: hidden;
  transform-origin: center center;
  background: #08000d;
  box-shadow: 0 0 60px rgba(132, 24, 255, 0.28);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--screen-transition) ease;
  background-position: center;
  background-size: 1280px 720px;
  background-repeat: no-repeat;
}

.screen.active {
  z-index: 2;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.loading-screen,
.title-screen {
  background-image: url("../Assets/TittleScreenBackground.jpg");
}

.level-select-screen {
  background-image: url("../Assets/SelectLevelScreenBackground.jpg");
}

.gameplay-screen {
  background-image: url("../Assets/GameplayScreenBackground.jpg");
}

#particleCanvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
}

.screen > * {
  z-index: 4;
}

.image-button {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 120ms ease, filter 160ms ease, opacity 160ms ease;
}

.image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.image-button:hover:not(:disabled) {
  filter: brightness(1.15) drop-shadow(0 0 9px rgba(76, 225, 255, 0.75));
  transform: scale(1.035);
}

.image-button:active:not(:disabled),
.image-button.pressed:not(:disabled) {
  filter: brightness(0.95) drop-shadow(0 0 5px rgba(255, 52, 228, 0.75));
  transform: scale(0.965);
}

.image-button:focus-visible {
  filter: brightness(1.18) drop-shadow(0 0 12px #fff);
}

.image-button:disabled,
.image-button.disabled {
  cursor: default;
  opacity: 0.45;
  filter: grayscale(0.8) brightness(0.65);
}

.title-start {
  left: 533.8px;
  top: 476px;
  width: 360.2px;
  height: 112.5px;
}

.title-audio {
  left: 1166.3px;
  top: 18.1px;
  width: 85.4px;
  height: 83.3px;
}

.loading-label {
  position: absolute;
  left: 481px;
  top: 487px;
  color: #f0a6ff;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 0 8px #cf30ff;
}

.loading-tray {
  position: absolute;
  left: 470.9px;
  top: 534.9px;
  width: 482.2px;
  height: 41.4px;
}

.loading-fill-clip {
  position: absolute;
  left: 481.7px;
  top: 543.9px;
  width: 0;
  height: 23.4px;
  overflow: hidden;
  transition: width 120ms linear;
}

.loading-fill-clip img {
  position: absolute;
  left: 0;
  top: 0;
  width: 463.5px;
  height: 23.4px;
  max-width: none;
}

.loading-percent {
  position: absolute;
  left: 858px;
  top: 542px;
  width: 76px;
  color: #42e8ff;
  font-size: 23px;
  font-weight: 800;
  text-align: right;
  text-shadow: 0 0 8px #198cff;
}

.level-back {
  left: 13.3px;
  top: 13.2px;
  width: 77.4px;
  height: 76.2px;
}

.level-audio {
  left: 1189.6px;
  top: 13.2px;
  width: 75.5px;
  height: 73.6px;
}

.level-grid {
  position: absolute;
  left: 381.5px;
  top: 143px;
  width: 699px;
  height: 432px;
  display: grid;
  grid-template-columns: repeat(6, 101.9px);
  grid-template-rows: repeat(5, 86.1px);
  column-gap: 17.5px;
  row-gap: 0;
}

.level-button {
  position: relative;
  width: 101.9px;
  height: 86.1px;
}

.level-button span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 1px;
  color: #fff;
  font-size: 29px;
  font-weight: 850;
  line-height: 1;
  text-shadow: 0 2px 3px #09000f, 0 0 8px rgba(255,255,255,0.4);
  pointer-events: none;
}

.level-button.locked span {
  color: #d5d5d5;
  transform: translateY(-10px);
}

.page-decrease {
  left: 540.9px;
  top: 594.2px;
  width: 78.2px;
  height: 56.8px;
}

.page-panel {
  position: absolute;
  left: 629px;
  top: 593px;
  width: 173.9px;
  height: 56.4px;
}

.page-panel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.page-panel span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 25px;
  font-weight: 850;
  letter-spacing: 2px;
  text-shadow: 0 0 7px #7e35ff;
}

.page-increase {
  left: 812.4px;
  top: 594.2px;
  width: 77.8px;
  height: 56.8px;
}

.game-back {
  left: 16.1px;
  top: 14.8px;
  width: 69.4px;
  height: 68.4px;
}

.game-restart {
  left: 1113.2px;
  top: 14.8px;
  width: 67.4px;
  height: 67.4px;
}

.game-audio {
  left: 1196.3px;
  top: 15.1px;
  width: 67.7px;
  height: 66px;
}

.level-label {
  position: absolute;
  left: 465px;
  top: 27px;
  width: 378px;
  height: 49px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 850;
  letter-spacing: 1px;
  text-shadow: 0 0 7px #7f26ff, 0 2px 3px #000;
}

.stats-panel,
.goal-panel {
  position: absolute;
  left: 15px;
  width: 116px;
  text-align: center;
  color: #fff;
}

.stats-panel {
  top: 110px;
  height: 143px;
}

.goal-panel {
  top: 270px;
  height: 92px;
}

.stats-title,
.stats-value,
.stats-divider {
  position: absolute;
  left: 0;
  width: 100%;
  display: block;
}

.stats-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.stats-value {
  font-weight: 850;
  text-shadow: 0 0 8px rgba(107, 225, 255, 0.45);
}

.moves-title { top: 14px; }
.moves-value { top: 42px; font-size: 34px; }
.stats-divider { top: 80px; color: #d5d5e5; letter-spacing: 5px; font-size: 12px; }
.time-title { top: 92px; }
.time-value { top: 113px; font-size: 21px; }
.goal-title { top: 16px; }
.goal-value { top: 44px; font-size: 27px; }

.board-layer,
.transfer-layer {
  position: absolute;
  inset: 0;
}

.board-layer {
  z-index: 5;
  pointer-events: none;
}

.transfer-layer {
  z-index: 9;
  pointer-events: none;
}

.speaker-slot {
  position: absolute;
  width: 99.1px;
  height: 235.8px;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform-origin: 50% 55%;
  transition: left 520ms cubic-bezier(.2,.8,.2,1), top 520ms cubic-bezier(.2,.8,.2,1), filter 180ms ease;
}

.speaker-slot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.speaker-art {
  position: absolute;
  inset: 0;
  width: 99.1px;
  height: 235.8px;
  pointer-events: none;
}

.cd-art {
  position: absolute;
  left: 25.6px;
  width: 46px;
  height: 46px;
  pointer-events: none;
  transform-origin: 50% 50%;
  transition: transform 180ms ease, filter 180ms ease, opacity 120ms ease;
}

.cd-bay-0 { top: 17.5px; }
.cd-bay-1 { top: 64.8px; }
.cd-bay-2 { top: 112px; }
.cd-bay-3 { top: 159.3px; }

.speaker-slot.selected .cd-movable {
  transform: translateY(-13px) scale(1.08);
  filter: brightness(1.22) drop-shadow(0 0 8px #54e9ff) drop-shadow(0 0 11px #e630ff);
  z-index: 3;
}

.speaker-slot.hint-source {
  filter: drop-shadow(0 0 10px #ffd92e) drop-shadow(0 0 18px #ff8c00);
  animation: hintPulse 620ms ease-in-out infinite alternate;
}

.speaker-slot.hint-destination {
  filter: drop-shadow(0 0 11px #35ffdf) drop-shadow(0 0 20px #0a83ff);
  animation: hintPulse 620ms ease-in-out infinite alternate-reverse;
}

.speaker-slot.invalid {
  animation: rejectShake 260ms ease;
}

.speaker-slot.complete {
  animation: speakerPulse 1500ms ease-in-out infinite;
  cursor: default;
}

.speaker-slot.complete .cd-art {
  animation: cdCounterclockwise 2300ms linear infinite;
}

.screen:not(.active) .speaker-slot.complete,
.screen:not(.active) .speaker-slot.complete .cd-art {
  animation-play-state: paused;
}

.speaker-slot.materialize {
  animation: materialize 520ms cubic-bezier(.18,.85,.25,1.25);
}

.transfer-cd {
  position: absolute;
  width: 46px;
  height: 46px;
  z-index: 20;
  pointer-events: none;
  filter: brightness(1.18) drop-shadow(0 0 9px #37e8ff);
}

.booster-button {
  z-index: 8;
}

.hint-button {
  left: 1147.2px;
  top: 282.3px;
  width: 112.8px;
  height: 123.1px;
}

.extra-button {
  left: 1147.2px;
  top: 425.7px;
  width: 109.1px;
  height: 126px;
}

.booster-quantity {
  position: absolute;
  right: -1px;
  top: 1px;
  width: 31px;
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #1d0027, 0 0 5px #fff;
  pointer-events: none;
}

.booster-quantity.ad {
  font-size: 13px;
  letter-spacing: -0.5px;
}

.completion-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.completion-overlay.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.completion-art {
  position: absolute;
  inset: 0;
  width: 1280px;
  height: 720px;
}

.complete-stat {
  position: absolute;
  width: 100px;
  text-align: right;
  color: #fff;
  font-size: 28px;
  font-weight: 850;
  text-shadow: 0 0 7px #5735ff, 0 2px 3px #000;
}

.complete-time { left: 714px; top: 346px; }
.complete-moves { left: 714px; top: 399px; }

.all-levels-button {
  left: 582.2px;
  top: 449.7px;
  width: 100px;
  height: 74.5px;
}

.next-button {
  left: 690.9px;
  top: 449.7px;
  width: 96.2px;
  height: 74.2px;
}

.replay-button {
  left: 797.1px;
  top: 449.7px;
  width: 96.9px;
  height: 74.7px;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  min-width: 260px;
  max-width: 620px;
  padding: 12px 22px;
  border: 1px solid rgba(95, 232, 255, 0.8);
  border-radius: 18px;
  background: rgba(9, 1, 22, 0.92);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 0 18px rgba(202, 46, 255, 0.55);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.rotate-message {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle, rgba(46, 6, 78, 0.98), rgba(4, 0, 9, 0.99));
  color: #fff;
  text-align: center;
}

.rotate-message strong {
  font-size: 32px;
  text-shadow: 0 0 12px #ec3cff;
}

.rotate-message span { font-size: 18px; color: #bcecff; }
.rotate-icon { font-size: 70px; color: #3ee9ff; text-shadow: 0 0 18px #b82cff; }

@keyframes speakerPulse {
  0%, 100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 0 rgba(255,45,236,0)); }
  50% { transform: scale(1.035); filter: brightness(1.16) drop-shadow(0 0 10px rgba(255,45,236,.85)); }
}

@keyframes cdCounterclockwise { to { transform: rotate(-360deg); } }
@keyframes hintPulse { from { transform: scale(1); } to { transform: scale(1.035); } }
@keyframes rejectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}
@keyframes materialize {
  0% { opacity: 0; transform: scale(.25) rotate(-8deg); filter: brightness(2) blur(5px); }
  70% { opacity: 1; transform: scale(1.07) rotate(2deg); filter: brightness(1.45) blur(0); }
  100% { transform: scale(1); filter: brightness(1); }
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-message { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .image-button,
  .speaker-slot,
  .cd-art,
  .toast { transition-duration: 1ms !important; }
}
