:root {
  --bg: #0d1117;
  --panel: #161b22;
  --accent: #4ade80;
  --accent2: #60a5fa;
  --text: #e6edf3;
  --danger: #f87171;
  --shadow: 0 4px 18px -4px rgba(0,0,0,0.6);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
}

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

body {
  margin: 0;
  background: radial-gradient(circle at 30% 30%, #1e293b 0%, #0f172a 65%, #020617 100%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 1.2rem;
  min-height: 100vh;
}

h1 {
  text-align: center;
  margin: .2rem 0 1rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.wrapper {
  width: min(100%, 960px);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  margin-bottom: .8rem;
  align-items: center;
}

.controls button {
  background: var(--panel);
  border: 1px solid #2d3642;
  padding: .55rem 1rem;
  color: var(--text);
  font-size: .9rem;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: .5px;
  transition: background .25s, transform .1s;
}

.controls button:hover {
  background: #243044;
}

.controls button:active {
  transform: translateY(2px);
}

.controls .hint {
  font-size: .75rem;
  opacity: .75;
  flex: 1 1 100%;
  text-align: center;
}

#gameContainer {
  position: relative;
  background: linear-gradient(135deg,#0f172a,#1e293b 55%,#0f172a);
  border: 2px solid #1f2937;
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 10;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  background: repeating-linear-gradient(
    to right,
    rgba(255,255,255,0.03) 0 12px,
    rgba(255,255,255,0.01) 12px 24px
  );
  width: 100%;
  height: 100%;
  border-radius: 10px;
  image-rendering: pixelated;
}

#overlay {
  position: absolute;
  inset: 12px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: opacity .3s;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay .message {
  font-size: clamp(1rem, 2.4vw, 2.2rem);
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  padding: 1rem 1.2rem;
  background: linear-gradient(145deg,#1e293b,#0f172a);
  border: 1px solid #334155;
  border-radius: 12px;
  max-width: 70%;
  box-shadow: 0 8px 22px -6px rgba(0,0,0,.6);
}

.footer {
  font-size: .75rem;
  opacity: .65;
  text-align: center;
  margin-top: 1rem;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .controls button {
    flex: 1 1 calc(50% - .6rem);
  }
  .controls .hint {
    order: 10;
  }
}