:root {
  --square: min(100vw, 100vh - 200px);
}

body {
  font-family: sans-serif;
  line-height: 1.6;
  background-color: #222;
  color: white;
}

#game {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--square);
  height: 100%;
}

#handicap, #settings {
  display: flex;
  justify-content: center;
}

#lower-win, #upper-win {
  display: flex;
  justify-content: center;
}

body:not(.paused) #upper-win, body:not(.paused) #lower-win, .running #settings, .running #handicap {
  opacity: 0.03;
  pointer-events: none;
}

.handicap-enabled #handicap {
  color: #924fff;
}

.larger-icon {
  font-size: 3em;
  margin-bottom: 10px;
}

.larger-icon:hover,
.larger-icon:focus {
  color: #0d75da !important;
  text-decoration: none;
  cursor: pointer;
}

.timer-container {
  display: grid;
  grid-template-columns: repeat(3, auto);
  align-items: center;
  width: var(--square);
}

#upper-timer,
#lower-timer {
  font-size: 3em;
  font-family: monospace;
  text-align: center;
}

#puzzle-container {
  width: var(--square);
  height: var(--square);
  align-items: center;
  justify-items: center;
}

.upside-down {
  transform: rotate(180deg);
}

rect {
  width: 38px;
  height: 38px;
  stroke: #000;
  stroke-linejoin: round;
  border-radius: 20%;
  stroke-width: 4px;
  paint-order: stroke;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  width: min(var(--square), 80%);
  background-color: #333;
  padding: 0 20px 20px 20px;
  border: 1px solid #888;
  border-radius: 10px;
  color: white;
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

h2 {
  font-size: 1.5em;
  margin-bottom: 10px;
}

.setting-row {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#applySettings {
  margin-top: 15px;
}

label, .label {
  font-size: 1.1em;
  display: inline-block;
  margin-bottom: 10px;
  margin-right: 10px;
}

input {
  width: 100%;
  font-size: 2em;
  padding: 8px;
  box-sizing: border-box;
  margin-bottom: 20px;
}

button {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
}

button:hover {
  background-color: #45a049;
}

.setting {
  background-color: #84aed0;
  font-size: 1.2em;
  font-weight: bold;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 10px;
}

.setting:hover {
  background-color: #0d75da;
}

.setting.selected {
  background-color: #0a559b;
}

.setting:disabled {
  background-color: #888;
  cursor: not-allowed;
}

.button {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  margin-right: 10px;
}

.button:hover {
  background-color: #45a049;
}

.button:disabled {
  background-color: #888;
  cursor: not-allowed;
}

.close {
  color: #aaa;
  float: right;
  font-size: 40px;
  font-weight: bold;
}

#version {
  color: #ccc;
  position: absolute;
  bottom: 0;
  right: 10px;
  font-size: 20px;
}

.close:hover,
.close:focus {
  color: white;
  text-decoration: none;
  cursor: pointer;
}

html {
  font-size: 1em;
  line-height: 1.4;
}

#countdown-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

#countdown-number {
  font-size: 8rem;
  color: #fff;
  font-weight: bold;
}
