@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 {
  --logical-width: 1280px;
  --logical-height: 720px;
  --screen-fade: 320ms;
  --cyan-glow: #5cf5ff;
  --deep-blue: #031d3e;
}

* {
  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: #001126;
  color: #fff;
  font-family: "Roboto", Arial, sans-serif;
  touch-action: none;
}

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

button { font: inherit; }

#gameHost {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #075c99, #001020 78%);
}

#gameView {
  position: relative;
  width: var(--logical-width);
  height: var(--logical-height);
  flex: 0 0 auto;
  overflow: hidden;
  transform-origin: center center;
  background: var(--deep-blue);
  box-shadow: 0 0 70px rgba(25, 198, 255, 0.24);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--screen-fade) 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 { background-image: url("../Assets/LoadingScreenBackground.jpg"); }
.title-screen { background-image: url("../Assets/TittleScreenBackground.jpg"); }
.gameplay-screen { background-image: url("../Assets/GamePlayScreenBackground.jpg"); }

.image-button {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  transform-origin: center;
  transform: translateZ(0);
  transition: transform 130ms cubic-bezier(.22,.72,.25,1.18), filter 150ms ease, opacity 150ms ease;
}

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

.image-button:hover:not(:disabled) {
  filter: brightness(1.11) drop-shadow(0 0 9px rgba(95, 238, 255, .64));
  transform: scale(1.035);
}

.image-button:active:not(:disabled),
.image-button.pressed:not(:disabled) {
  filter: brightness(.96) saturate(1.08);
  transform: scale(.94);
}

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

.image-button:disabled,
.image-button.disabled {
  cursor: default;
  opacity: .45;
  filter: grayscale(.55) brightness(.68);
}

.loading-tray {
  position: absolute;
  left: 398.5px;
  top: 515.7px;
  width: 449px;
  height: 78.4px;
}

.loading-fill-clip {
  position: absolute;
  left: 416.5px;
  top: 535.8px;
  width: 0;
  height: 42.2px;
  overflow: hidden;
  transition: width 120ms linear;
}

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

.loading-percent {
  position: absolute;
  left: 778px;
  top: 598px;
  width: 68px;
  font-size: 18px;
  font-weight: 850;
  text-align: right;
  text-shadow: 0 2px 4px #00182f, 0 0 8px #35dfff;
}

.title-start { left: 445.4px; top: 488.9px; width: 389.2px; height: 130.6px; }
.title-audio { left: 1185.9px; top: 9.2px; width: 76.7px; height: 77.9px; }
.game-back { left: 13.2px; top: 9.2px; width: 77px; height: 77.9px; }
.game-restart { left: 1096.2px; top: 9.2px; width: 76.7px; height: 77.9px; }
.game-audio { left: 1185.9px; top: 9.2px; width: 76.7px; height: 77.9px; }

.game-back,
.game-restart,
.game-audio { z-index: 16; }

.score-panel {
  position: absolute;
  left: 405.7px;
  top: 5.6px;
  width: 460.6px;
  height: 87.1px;
  z-index: 12;
}

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

.score-zone {
  position: absolute;
  top: 10px;
  width: 165px;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  text-shadow: 0 2px 3px #00162d;
}

.score-current { left: 39px; }
.score-best { right: 38px; }
.score-zone span { font-size: 15px; font-weight: 850; }
.score-zone strong { margin-top: 5px; font-size: 29px; font-weight: 900; color: #ffd85c; }
.score-best strong { color: #56e9ff; }

.ambient-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

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

.board-layer { z-index: 5; pointer-events: none; }
.preview-layer { z-index: 7; pointer-events: none; }
.drag-layer { z-index: 14; pointer-events: none; }

.board-cell,
.preview-cell,
.piece-cell {
  position: absolute;
  display: block;
  pointer-events: none;
  transform-origin: center;
}

.board-cell,
.piece-cell { object-fit: contain; }

.board-cell { width: 43.3px; height: 43.3px; }
.board-cell.occupied { z-index: 2; animation: cellSettle 180ms cubic-bezier(.2,.85,.25,1.25); }
.board-cell.clearing { z-index: 3; animation: cellClear 430ms ease-in forwards; }

.preview-cell {
  width: 43.3px;
  height: 43.3px;
  border-radius: 10px;
  background: rgba(80, 255, 206, .28);
  box-shadow: inset 0 0 12px rgba(255,255,255,.65), 0 0 11px #40ffd1;
}

.preview-layer.invalid .preview-cell {
  background: rgba(191, 214, 230, .19);
  box-shadow: inset 0 0 10px rgba(255,255,255,.22), 0 0 8px rgba(157,189,211,.35);
}

.tray-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.tray-art {
  position: absolute;
  left: 351.7px;
  top: 531.7px;
  width: 576.7px;
  height: 170.4px;
  pointer-events: none;
}

.tray-pieces { position: absolute; inset: 0; pointer-events: none; }

.piece {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transform-origin: center;
  transition: left 220ms cubic-bezier(.2,.78,.2,1), top 220ms cubic-bezier(.2,.78,.2,1), opacity 180ms ease, filter 150ms ease;
}

.piece:hover { filter: brightness(1.12) drop-shadow(0 0 7px rgba(88,239,255,.68)); }
.piece:active { cursor: grabbing; }
.piece.dragging { z-index: 20; filter: brightness(1.12) drop-shadow(0 7px 10px rgba(0,22,57,.55)); transition: none; }
.piece.returning { animation: rejectWobble 300ms ease; }
.piece.spawning { animation: pieceSpawn 360ms cubic-bezier(.18,.86,.2,1.2); }
.piece.used { pointer-events: none; opacity: 0; transform: scale(.55); }

.sea-burst-button { left: 1117.1px; top: 224.4px; width: 137.6px; height: 143px; z-index: 16; }
.shuffle-button { left: 1115.5px; top: 404.7px; width: 137.6px; height: 143px; z-index: 16; }

.power-badge {
  position: absolute;
  right: 1px;
  top: -1px;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 2px #17401b, 0 0 4px #fff;
  pointer-events: none;
}

.power-badge.ad { font-size: 14px; letter-spacing: -.5px; }

.sea-burst-preview {
  position: absolute;
  z-index: 13;
  display: none;
  width: 125.6px;
  height: 125.6px;
  border: 3px solid rgba(130, 252, 255, .92);
  border-radius: 16px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.52), rgba(31,216,255,.22) 38%, rgba(38,99,255,.11) 72%);
  box-shadow: inset 0 0 24px #73f8ff, 0 0 22px #2adfff;
  animation: seaTargetPulse 760ms ease-in-out infinite alternate;
}

.sea-burst-preview.active { display: block; }
.sea-burst-preview.empty { border-color: rgba(190,213,225,.7); filter: grayscale(.55); }

.combo-effect {
  position: absolute;
  left: 475px;
  top: 300px;
  z-index: 18;
  width: 330px;
  text-align: center;
  color: #fff7a0;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 3px 4px #004170, 0 0 8px #fff, 0 0 18px #5feaff;
}

.combo-effect.show { animation: comboPop 1050ms ease-out forwards; }

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

.game-over-overlay.visible { visibility: visible; opacity: 1; pointer-events: auto; }
.game-over-dim { position: absolute; inset: 0; background: rgba(0, 10, 24, .75); }
.game-over-panel { position: absolute; left: 340.3px; top: 120.2px; width: 599.4px; height: 479.7px; animation: panelEnter 420ms cubic-bezier(.18,.85,.25,1.18); }

.game-over-score {
  position: absolute;
  z-index: 31;
  width: 228px;
  height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-shadow: 0 2px 3px #001937;
}

.game-over-score span { font-size: 17px; font-weight: 850; }
.game-over-score strong { margin-top: 7px; font-size: 36px; font-weight: 900; color: #ffd85d; }
.final-score { left: 597px; top: 263px; }
.final-best { left: 597px; top: 351px; }
.final-best strong { color: #55e9ff; }

.game-over-button { z-index: 32; }
.home-button { left: 490.5px; top: 449.4px; width: 81.8px; height: 103.5px; }
.encore-button { left: 590px; top: 438.7px; width: 91.2px; height: 115.6px; }
.retry-button { left: 698.9px; top: 449.2px; width: 81.8px; height: 103.7px; }

.fx-canvas { position: absolute; inset: 0; z-index: 11; pointer-events: none; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 55;
  min-width: 250px;
  max-width: 580px;
  padding: 11px 20px;
  border: 1px solid rgba(91, 235, 255, .82);
  border-radius: 18px;
  background: rgba(0, 31, 67, .94);
  color: #fff;
  font-size: 18px;
  font-weight: 750;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 170ms ease, transform 170ms ease;
  box-shadow: 0 0 20px rgba(23, 210, 255, .5);
}

.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(4,104,158,.98), rgba(0,17,38,.99));
  color: #fff;
  text-align: center;
}

.rotate-message strong { font-size: 32px; text-shadow: 0 0 12px #36e8ff; }
.rotate-message span { font-size: 18px; color: #c9f5ff; }
.rotate-icon { font-size: 72px; color: #81f6ff; text-shadow: 0 0 18px #11bff1; }

@keyframes cellSettle {
  0% { transform: scale(.72); filter: brightness(1.8); }
  72% { transform: scale(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes cellClear {
  0% { transform: scale(1); filter: brightness(1); opacity: 1; }
  45% { transform: scale(1.18); filter: brightness(2.15) drop-shadow(0 0 10px #83f9ff); opacity: 1; }
  100% { transform: scale(.12) rotate(12deg); filter: brightness(2.2); opacity: 0; }
}

@keyframes rejectWobble {
  0%, 100% { transform: translateX(0) scale(1); }
  25% { transform: translateX(-8px) scale(.98); }
  50% { transform: translateX(7px) scale(1.02); }
  75% { transform: translateX(-4px) scale(.99); }
}

@keyframes pieceSpawn {
  0% { opacity: 0; transform: translateY(12px) scale(.38); filter: brightness(1.9); }
  72% { opacity: 1; transform: translateY(-2px) scale(1.08); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes seaTargetPulse { from { transform: scale(.98); opacity: .78; } to { transform: scale(1.03); opacity: 1; } }
@keyframes comboPop { 0% { opacity: 0; transform: scale(.35) translateY(14px); } 24% { opacity: 1; transform: scale(1.12) translateY(0); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.82) translateY(-30px); } }
@keyframes panelEnter { 0% { transform: scale(.72) translateY(24px); opacity: 0; } 75% { transform: scale(1.035) translateY(-3px); opacity: 1; } 100% { transform: scale(1); } }

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

@media (prefers-reduced-motion: reduce) {
  .screen,
  .image-button,
  .piece,
  .toast,
  .game-over-overlay { transition-duration: 1ms !important; }
}
