html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
}
:root {
  --bg: #111;
  --fg: #eee;
  --accent: #3c8dc3;
}
/* ------------ */
input.no-select:focus {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
input.no-select::selection {
  background: transparent;
}
input.no-select::-moz-selection {
  background: transparent;
}
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: -moz-none;
  -o-user-select: none;
  user-select: none;
}
.noselect {
    -webkit-touch-callout: none; /* iOS Safari */
      -webkit-user-select: none; /* Safari */
       -khtml-user-select: none; /* Konqueror HTML */
         -moz-user-select: none; /* Old versions of Firefox */
          -ms-user-select: none; /* Internet Explorer/Edge */
              user-select: none; /* Non-prefixed version, currently
                                    supported by Chrome, Edge, Opera and Firefox */
}
::selection { background: transparent; }
::-moz-selection { background: transparent; }
.dark {
  --bg: #f5fff3c0;
  --fg: #000000;
  --accent: #85519f;
}
body {
  background: var(--bg);
  color: var(--fg);
  transition: background 0.5s, color 0.5s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
button {
  background: linear-gradient(135deg, var(--accent), #6ff);
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  margin: 10px;
  font-size: clamp(14px, 4vw, 20px);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent);
  transition: transform 0.2s, box-shadow 0.5s;
}
button:hover {
  transform: translateY(-3px) scale(1.05);
  animation: neonPulse 1.5s infinite alternate;
}
@keyframes neonPulse {
  from { box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent); }
  to { box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent); }
}

ul {
  padding-top: 10px;
   text-align: left;
}

/* Меню */
#menu {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
#game {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}
#controls {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 5px 10px;
  gap: 10px;
}
#board {
  display: grid;
  gap: 5px;
  width: 95vw;
  max-width: 600px;
  height: 70vh; /* 70% экрана */
  grid-template-rows: repeat(6, 1fr);
}
#currentTime {
  font-size: clamp(24px, 3vw, 18px);
  font-weight: 500;
  color: var(--fg);
  margin-right: auto; /* чтобы оттолкнуть кнопки вправо */
  padding-left: 15px;
  align-self: center;
}
.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.cell {
  border: 2px solid #999;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
  text-transform: uppercase;
  font-size: calc((70vh / 6) * 0.6); /* масштабируем под высоту ряда */
  transition: background 0.4s, transform 0.6s;
}
.correct { background:#538d4e; color:white; border-color:#538d4e; }
.present { background:#b59f3b; color:white; border-color:#b59f3b; }
.absent { background:#3a3a3c; color:white; border-color:#3a3a3c; }
.flip { animation: flip 0.6s ease forwards; }
@keyframes flip {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}
/* Клавиатура */
#keyboard {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  width: 98vw;
  max-width: 600px;
  margin-top: 15px;
  margin-bottom: 15px;
  height: 20vh; /* 20% экрана */
}
.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0px;
  flex: 1;
}
.keyboard-row button {
  flex: 1;
  font-size: calc(25vh / 6 * 0.5);
  padding: 0;
  margin: 3px;
  border-radius: 5px;
}
.toast {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  display: none;
  z-index: 100;
}

/* Canvas дождь */
#rain {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
}

#instructionModal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
#instructionContent {
  margin: 10px;
  background: var(--bg);
  color: var(--fg);
  padding: 20px;
  border-radius: 12px;
  max-width: 90%;
  text-align: center;
}
#instructionContent button {
  margin-top: 10px;
}
.hidden { display: none; }