:root {
  --bg-dark: #111520;
  --bg-black: #0b0b0d;
  --card-dark: #282e37;
  --text-light: #f8fafc;
  --text-subtle: #94a3b8;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --border: #334155;
  --coin: #4ade80;
  --green: #00ff00;
  --red: #ff6347;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
}

header {
  color: var(--text-light);
  text-align: center;
  padding: 1rem 0;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 1.25px;
}

header p {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

button {
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: var(--accent);
  color: var(--bg-dark);
  cursor: pointer;
}
button:hover {
  background: var(--accent-hover);
}

footer {
  margin-top: auto;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
}
footer a {
  color: var(--text-subtle);
}

#buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

#solve4Btn,
#solve5Btn {
  background-color: var(--bg-dark);
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: normal;
}

#surface {
  background: var(--bg-black);
  width: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 10rem 1rem 1rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.buffer {
  border-radius: 50%;
  min-width: 50px;
  min-height: 50px;
  border: 1px dashed var(--card-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.coin {
  border-radius: 50%;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  z-index: 500;
}
.coin.one {
  background-color: var(--coin);
}
.coin.zero {
  background-color: var(--card-dark);
}
.coin.dragging {
  position: absolute; /* follow the pointer */
  z-index: 1000; /* above everything else */
  pointer-events: none; /* allow pointer detection on underlying cells */
  cursor: grabbing;
}

#msg {
  font-size: 1.25rem;
}
#msg.loss {
  color: var(--red);
}
#msg.win {
  color: var(--green);
}
