* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #0f0f1a;
  color: #eee;
  font-family: 'Courier New', Courier, monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.game-container a {
  color: #00e5ff;
  font-size: 12px;
  text-decoration: none;
}

.game-container a:hover {
  text-decoration: underline;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

h1 {
  letter-spacing: 6px;
  color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
  font-size: 22px;
}

.main-area {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.board-wrapper {
  position: relative;
  border: 4px solid #333;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
  background: #1a1a2e;
  padding: 12px;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 88px);
  grid-template-rows: repeat(4, 108px);
  gap: 10px;
}

.card {
  position: relative;
  width: 88px;
  height: 108px;
  perspective: 600px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-back {
  background: linear-gradient(135deg, #1a1a2e, #262646);
  border: 2px solid #333;
  font-size: 28px;
}

.card-front {
  transform: rotateY(180deg);
  border: 2px solid #00e5ff;
  background: #0f0f1a;
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card.matched .card-front {
  border-color: #4dff88;
  box-shadow: 0 0 10px rgba(77, 255, 136, 0.6);
}

.card:not(.flipped):not(.matched):hover .card-back {
  border-color: #00e5ff;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
}

.overlay.hidden {
  display: none;
}

.overlay p {
  font-size: 15px;
  color: #fff;
  line-height: 1.6;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 150px;
}

.panel-box {
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}

.panel-box h2 {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.panel-box p {
  font-size: 18px;
  color: #00e5ff;
  font-weight: bold;
}

.controls-box ul {
  list-style: none;
  text-align: left;
  font-size: 11px;
  color: #aaa;
  line-height: 1.6;
}

button {
  width: 100%;
  padding: 8px;
  margin-top: 6px;
  background: #00e5ff;
  color: #0f0f1a;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #4df0ff;
}

button:active {
  transform: scale(0.97);
}

#restart-btn {
  background: #ff4d6d;
}

#restart-btn:hover {
  background: #ff7a91;
}
