/* Import Google font */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Open Sans', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
html {
  overflow: hidden;
  height: 100vh;
  touch-action: none;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  height: 100vh;
  background: #E3F2FD;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
}
.wrapper {
  width: 450px;
  height: 500px;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  background: #2D3748;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.game-details {
  color: #B8C6DC;
  font-weight: 500;
  font-size: 1rem;
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2D3748;
  gap: 15px;
}
.play-board {
  height: 100%;
  width: 100%;
  display: grid;
  background: #1A202C;
  grid-template: repeat(15, 1fr) / repeat(15, 1fr);
}
.play-board .food {
  background: #FF3366;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
  margin: 1px;
}
.play-board .head {
  background: linear-gradient(135deg, #5FE3FB 0%, #4FD8EB 50%, #3FC8DB 100%);
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(79, 216, 235, 0.3);
  margin: 1px;
  border: 1px solid rgba(95, 227, 251, 0.3);
}
.play-board .head.snake-head {
  background: linear-gradient(135deg, #5FE3FB 0%, #4FD8EB 50%, #3FC8DB 100%);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(79, 216, 235, 0.6);
  margin: 1px;
  position: relative;
}
.play-board .head.snake-head::before,
.play-board .head.snake-head::after {
  content: '';
  position: absolute;
  width: 25%;
  height: 25%;
  background: #1A202C;
  border-radius: 50%;
  top: 30%;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.5);
}
.play-board .head.snake-head.right::before {
  right: 15%;
  top: 25%;
}
.play-board .head.snake-head.right::after {
  right: 15%;
  top: 55%;
}
.play-board .head.snake-head.left::before {
  left: 15%;
  top: 25%;
}
.play-board .head.snake-head.left::after {
  left: 15%;
  top: 55%;
}
.play-board .head.snake-head.up::before {
  left: 25%;
  top: 15%;
}
.play-board .head.snake-head.up::after {
  left: 55%;
  top: 15%;
}
.play-board .head.snake-head.down::before {
  left: 25%;
  bottom: 15%;
}
.play-board .head.snake-head.down::after {
  left: 55%;
  bottom: 15%;
}

.controls {
  display: none;
  position: relative;
  width: 180px;
  height: 180px;
  margin: 20px auto;
}
.controls::before {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  background: #1A202C;
  border: 3px solid #2D3748;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.controls i {
  position: absolute;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #B8C6DC;
  cursor: pointer;
  background: #2D3748;
  border: 2px solid #1A202C;
  transition: all 0.2s;
}
.controls i:active {
  background: #1A202C;
  transform: scale(0.95);
}
.controls i[data-key="ArrowUp"] {
  top: 0;
  left: 60px;
  border-radius: 8px 8px 0 0;
}
.controls i[data-key="ArrowDown"] {
  bottom: 0;
  left: 60px;
  border-radius: 0 0 8px 8px;
}
.controls i[data-key="ArrowLeft"] {
  left: 0;
  top: 60px;
  border-radius: 8px 0 0 8px;
}
.controls i[data-key="ArrowRight"] {
  right: 0;
  top: 60px;
  border-radius: 0 8px 8px 0;
}

@media screen and (max-width: 800px) {
  body {
    background: #1A202C;
  }
  .wrapper {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    justify-content: center;
    gap: 10px;
    overflow: hidden;
    touch-action: none;
  }
  .game-details {
    font-size: 1rem;
    padding: 15px 20px;
    gap: 20px;
    flex-shrink: 0;
    order: 1;
  }
  .play-board {
    width: min(100vw, calc(100vh - 350px));
    height: min(100vw, calc(100vh - 350px));
    margin: 0 auto;
    flex-shrink: 0;
    order: 2;
  }
  .controls {
    display: block;
    flex-shrink: 0;
    order: 3;
  }
}