:root {
  --cell: 40px;
  --gap: 4px;
  --vh: 0px;
  --font-alt-color: #2c7391;
  --bg: #202629;
  --fg:#DCEDF5;
  --blue: #68AECC;
  --slider-blue: #3A90B5;
  --light-blue: #a5c9d9;
  --accent:#fab76b;
  --accent-dark: #A98153;
  --bar-light:#A5C9D9;    
  --bar-dark: #264C62;
  --max-width: 95vw;
  --cell-menu-multiplier: 1.0;
  --cell-menu: calc(var(--cell) * var(--cell-menu-multiplier));
  --tile-colour-med: rgb(157,115,68);
  --tile-colour-dark: rgb(110,81,48);
}
@supports (height: 100dvh) {
  :root { --vh: 1dvh; }
}
* {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  position: static;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE10+ */
  overscroll-behavior: none;
  
}

body {
  background: var(--bg);
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* WebKit (Chrome, Safari, Opera) */
html::-webkit-scrollbar, body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Container for the entire content */
.top-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Header container with scaling for the banner image */
.header-container {
  width: calc(var(--cell) * 8);
  /* margin-bottom: calc(var(--cell) * 0.6);
  margin-top: calc(var(--cell) * 1.4); */
  display: flex;
  justify-content: center;
}

.header-container img {
  width: 100%;
  height: auto;
}

/* Central container to center-align the list */
.center-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  width: 100%;
}

/* List of SVG links, displayed horizontally and evenly spaced */
.link-list {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  width: 100%;
  padding: 0;
  /* margin: calc(var(--cell) * 1); */
  list-style: none;
}

/* Individual list items */
.link-item {
  display: flex;
  justify-content: center;
  align-items: center;
}

.link-item .link-icon {
  width: calc(var(--cell) * 1.1);
  height: auto;
  transition: transform 0.2s ease-in-out;
}

/* Add hover effect for icons */
.link-item:hover .link-icon {
  transform: scale(1.2);
  animation: wobble 0.5s ease-in-out;
}

@keyframes wobble {
  0%, 100% { transform: scale(1.2) rotate(0deg); }
  16.67%, 83.33% { transform: scale(1.2) rotate(5deg); }
  50% { transform: scale(1.2) rotate(-5deg); }
  
}















#title-container {
  display: flex;
  justify-content: center;
  flex-direction: row;
  padding: calc(var(--cell-menu) * 0.4) 0px calc(var(--cell-menu) * 0.4) 0px;
  cursor: pointer;
}
#titleGrid {
  grid-template-columns: repeat(2, var(--cell));
  grid-template-rows: repeat(2, var(--cell));
}

#titleGrid .tile  {
  transform: translateY(-120vh);
  transition: transform .65s cubic-bezier(.22,1,.36,1);
}

.grid {
  display: grid;
  gap: var(--gap);
}






.cell {
  width: var(--cell);
  height: var(--cell);
  background: var(--fg);
  /* background: rgba(1, 1, 1, 0.08); */
  border-radius: calc(var(--cell) * 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s;
  box-shadow: 
    inset calc(var(--cell) * (0.04)) calc(var(--cell) * (0.05)) 0 rgba(0, 10, 20, 0.4);
  transform: scale(1) rotate(0deg);
}


.tile {
  font-family: system-ui;
  touch-action: none;
  color: #000;
  width: 100%;
  height: 100%;
  background-color: var(--accent);
  /* background-image: var(--tile-front); */
  background-size: contain;
  border-radius: calc(var(--cell) * 0.2);
  font-size: calc(var(--cell) * 0.7);
  font-weight: 900;
  display: block;
  text-align: center;
  /* align-items: center;
  justify-content: center; */
  cursor: grab;
  user-select: none;
  position: relative;
  z-index: 1;
  box-shadow:
    inset calc(var(--cell) * (-0.025)) calc(var(--cell) * (-0.025)) 0 rgba(0, 0, 0, 0.4),
    inset calc(var(--cell) * (0.02)) calc(var(--cell) * (0.02)) 0 rgba(255, 255, 255, 0.67);
  overflow: hidden;
}




/* --- Game row layout --- */
#gameRow {
  display: flex;
  align-items: center;
  justify-content: space-evenly;              /* equidistant spacing */
  width: calc(var(--cell) * 10); 
}

/* Keep both sides balanced and centered */
#rocketPoolIconContainer,
#title-container {
  flex: 0 1 auto;
}

/* RocketPool icon scales from your cell size */
#flame {
  width: calc(var(--cell) * 2.3);
  height: auto;
  display: block;
  transform: rotate(-135deg) scale(1.34) translate(calc(var(--cell) *0.22), calc(var(--cell) *(-0.22)));
  cursor: pointer;
}

/* Title tiles already sized via --cell; trim title padding for balance */
#title-container {
  padding: 0;
  text-decoration: none;
  color: var(--bg);
}

/* Header + links: stack naturally instead of full-viewport centering */
.top-container {
  height: 100%;
  justify-content: space-evenly;
}
.center-container {
  flex-grow: 0;                     
}







/* Add once */
#titleGrid .tile {
  transform-origin: 50% 50%;
  transform: none;
  will-change: transform;
  position: relative;
  z-index: 0;
}

@keyframes wigglePop {
  0%   { transform: none; }
  12%  { transform: scale(1.08) rotate(-7deg); }  /* anticlockwise */
  45%  { transform: scale(1.14) rotate(7deg);  }  /* clockwise */
  70%  { transform: scale(1.04) rotate(3deg);  }  /* “back to” clockwise (softer) */
  100% { transform: none; }
}

.tile.wiggle {
  animation: wigglePop 0.54s ease-in-out both;
}



#top-container{ 
  perspective: calc(var(--cell) * 6);
  transform-style: preserve-3d;
}

@property --f-dx {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}
@property --f-h {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}
@property --f-dy {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}
@property --f-i {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}

@keyframes liftFlip {
  0% {
    --f-i: -0.025;
    --f-dx: 0.0;
    --f-dy: 0.0;
    --f-h: 0.0;
    transform: none;
  }
  10% {
    --f-i: 0.0;
    --f-dx: 0.05;
    --f-dy: 0.0;
    --f-h: 0.1;
    transform: translateX(0) scale(1.1) rotateY(1deg);
  }
  38% {
    --f-i: 0.0;
    --f-dx: 0.7;
    --f-dy: 0.0;
    --f-h: 0.3;
    transform: translateX(-8%) scale(1.25) rotateY(65deg);
  }
  50% {
    --f-i: 0.0;
    --f-dx: 2.0;
    --f-dy: 0.0;
    --f-h: 0.3;
    transform: translateX(-10%) scale(1.25) rotateY(84deg);
  }
  50.01% {
    --f-i: 0.0;
    --f-dx: -2.0; /* swap light side after crossing 90° */
    --f-dy: 0.0;
    --f-h: 0.3;
    transform: translateX(10%) scale(1.25)  rotateY(-84deg);
  }
  62% {
    --f-i: 0.0;
    --f-dx: -0.7; /* swap light side after crossing 90° */
    --f-dy: 0.0;
    --f-h: 0.3;
    transform: translateX(8%) scale(1.25)  rotateY(-65deg);
  }
  90% {
    --f-i: 0.0;
    --f-dx: -0.05;
    --f-dy: 0.0;
    --f-h: 0.1;
    transform: translateX(0) scale(1.1) rotateY(-1deg);
  }
  100% {
    --f-i: -0.025;
    --f-dx: 0.0;
    --f-dy: 0.0;
    --f-h: 0.0;
    transform: none;
  }
}


.unlocking {
  /* 3D setup */
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform;

  --f-i: -0.025;
  --f-dx: 0.0;
  --f-dy: 0.0;
  --f-h: 0.0;

  /* Drag-style shadow stack, but driven by --f-dx/--f-dy */
  box-shadow:
    inset calc(var(--cell) * var(--f-i)) calc(var(--cell) * var(--f-i)) 0 var(--tile-colour-med),
    inset calc(var(--cell) * (0.02))  calc(var(--cell) * (0.02))  0 rgba(255,255,255,0.67),
    calc(var(--cell) * ((var(--f-dx) * 0.4)))
    calc(var(--cell) * ((var(--f-dy) * 0.4))) 0 var(--tile-colour-med),
    calc(var(--cell) * ((var(--f-dx) * 0.5)))
    calc(var(--cell) * ((var(--f-dy) * 0.5)))  0 var(--tile-colour-dark),
    calc(var(--cell) * (var(--f-h) * 2)) calc(var(--cell) * (var(--f-h))) 0 rgba(0, 0, 0, 0.3);

  /* Keep your existing animation hook */
  animation: liftFlip var(--flip-dur, 600ms) var(--flip-delay, 0ms) linear both;
}






@media (max-aspect-ratio: 1/1) {
  :root {
    /* --cell: calc((100dvh) / 16.4); */
    --cell-w: calc(var(--max-width) / 8);
    --cell-h: calc((var(--vh, 1vh) * 100) / 14);
    --cell: min(var(--cell-w), var(--cell-h));
    --gap: calc(var(--cell) * 0.1);
  }
  .link-list {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: center;        /* center the grid block */
    place-items: center;            /* center each icon in its cell */
    gap: calc(var(--cell) * 0.6) calc(var(--cell) * 1.0);
    width: auto;                    /* avoid stretching across full width */
    margin: 0 auto;
  }
  .link-item .link-icon {
    width: calc(var(--cell) * 1.3);
  }
}
/* @media (1.0 < aspect-ratio <= 1.2)  */
@media (min-aspect-ratio: 1/1) {
  :root {
    /* --cell: calc((100dvh) / 14); */
    --cell: calc((var(--vh, 1vh) * 100) / 14);
    --gap: calc(var(--cell) * 0.1);
  }
  .header-container {
    width: calc(var(--cell) * 14);
    /* margin-bottom: calc(var(--cell) * 1);
    margin-top: calc(var(--cell) * 1.4); */
  }

  #gameRow {
    width: calc(var(--cell) * 12); 
  }
  
}