:root {
  --background: #ffffff;
  --text: #000000;
  --button-bg: #3a5bb4;
  --button-bg2: #b12323;
  --button-border: #000000;
  --wrapper-bg: #c0c0c0;
  --line: #000000;
  --primary: #3a5bb4;
  --accent: #b12323;
}
* {
  margin: 0;
  box-sizing: border-box;
  text-align: center;
}

body {
  text-align: center;
  background-color: var(--background);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
  font-style: italic;
  padding: 11vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.noFlex {
  display: block;
}

body.dark-mode {
  --background: #1a1a1a;
  --text: #ffffff;
  --button-bg: #3a5bb4;
  --button-bg2: #b12323;
  --button-border: #ffffff;
  --wrapper-bg: #2a2a2a;
  --line: #000000;
  --primary: #3a5bb4;
  --accent: #b12323;
}
h1 {
  color: var(--accent);
}
h2 {
  color: var(--primary);
}
button {
  background-color: var(--button-bg);
  color: inherit;
  border: var(--button-border) 4px inset;
  padding: 0.75rem 1.5rem;
  font-size: 1.25rem;
  margin: 1rem;
  cursor: pointer;
  height: 125px;
  width: 275px;
  transition: background-color 0.3s ease;
  max-width: 275px;
}
.button2 {
  background-color: #b12323;
}
a {
  color: rgb(255, 255, 255);
  text-decoration: none;
}

.wrapper {
  border-radius: 4em;
  padding: 2em;
  background: var(--wrapper-bg);
  color: var(--text);
  transition: background 0.7s, color 0.3s;
  border: 3px inset;
  position: relative;
  width: min(95vw, 960px);
  margin: 0 auto;
}

#canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 0.75rem;
  border-radius: 1rem;
}

.mobile-controls {
  display: none;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.mobile-controls .dpad {
  display: grid;
  grid-template-columns: 48px 48px 48px;
  grid-template-rows: 48px 48px 48px;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.mobile-controls button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.25rem;
  width: 48px;
  height: 48px;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

@media (max-width: 800px) {
  body {
    padding: 4vh;
  }

  .mobile-controls {
    display: flex;
    margin-top: 0.5rem;
  }

  .controls { display: none; }

  #startBtn {
    min-width: 72px;
    font-size: 0.9rem;
    padding: 6px 8px;
  }
}

.row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.row div {
  font-size: min(9vw, 10em);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  width: min(33%, 20vh);
  aspect-ratio: 1;
  transition: border 0.3s;
}

.controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1em;
}

.controls button {
  padding: 0.5em 1.2em;
  margin: 0 0.5em;
  background: #3a5bb4;
  color: white;
  border: none;
  border-radius: 0.5em;
  font-size: 1em;
  cursor: pointer;
  transition: 0.2s;
}

.controls button:hover {
  background: #5777d1;
}

#themeToggleBtn {
  position: absolute;
  top: 10px;
  right: 15px;
  background-color: #b12323;
  color: white;
  border: 4px solid black;
  padding: 0.5rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 12px;
  transition: 0.3s;
  height: 3rem;
  width: 8rem;
  background-color: #b12323;
}

#themeToggleBtn:hover {
  background-color: #5777d1;
}

ul {
  font-size: 1.25rem;
}

#startBtn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background-color: #b12323;
  border: 1px solid #000000;
  border-radius: 6px;
  font-size: 13px;
  z-index: 999;
  min-width: 90px;
  max-height: 90px;
}
#startBtn:hover {
  background-color: #e0e0e0;
}

body.dark-mode #startBtn {
  background-color: #333;
  border-color: #555;
  color: #fff;
}

body.dark-mode #startBtn:hover {
  background-color: #444;
}

footer {
  position: center;
  padding: 1rem;
}

br {
  font: Segoe UI;
}
