* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0f1220;
  color: #f4f7ff;
  font-family: Arial, sans-serif;
}

.app-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 16px 16px;
  color: #7f8bb7;
  font-size: 13px;
}

.layout {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.game-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.touch-pause-btn {
  margin-top: 0;
  width: 100%;
  max-width: 300px;
  align-self: center;
  background: #2f3b64;
}

.touch-pause-btn:hover {
  background: #45568f;
}

.mobile-stats {
  display: none;
}

.mobile-info-toggle,
.mobile-info-panel {
  display: none;
}

.board-section {
  border: 2px solid #2e3557;
  background: #11172c;
}

#board {
  display: block;
  background: #0a0e1c;
  touch-action: none;
}

.panel {
  width: 260px;
  background: #161d38;
  border: 1px solid #2e3557;
  border-radius: 10px;
  padding: 16px;
}

h1,
h2 {
  margin: 0 0 12px;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
  margin-top: 16px;
}

.stat {
  margin-bottom: 8px;
}

.controls ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.controls li {
  margin-bottom: 6px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
}

.setting-row input {
  width: 16px;
  height: 16px;
  accent-color: #4a8bff;
}

button {
  margin-top: 16px;
  width: 100%;
  border: none;
  border-radius: 8px;
  background: #4a8bff;
  color: #fff;
  padding: 10px 12px;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background: #6ca2ff;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
}

.overlay-content {
  background: #1b2442;
  border: 1px solid #3d4772;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  width: min(90vw, 360px);
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.overlay-name-wrap {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 6px;
  margin-top: 10px;
}

.overlay-name-wrap label {
  font-size: 14px;
  color: #d7e0ff;
}

.overlay-name-wrap input {
  border: 1px solid #45568f;
  border-radius: 8px;
  background: #10162b;
  color: #f4f7ff;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}

.overlay-name-wrap input:focus {
  border-color: #6ca2ff;
}

button.secondary {
  background: #2f3b64;
}

button.secondary:hover {
  background: #45568f;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: auto;
    padding: 10px 14px 8px;
    gap: 10px;
  }

  .app-footer {
    padding-bottom: 10px;
  }

  .game-area {
    align-items: center;
    gap: 8px;
  }

  .touch-pause-btn {
    padding: 8px 12px;
    font-size: 15px;
  }

  .mobile-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 300px;
    border: 1px solid #2e3557;
    border-radius: 8px;
    background: #161d38;
    padding: 8px 10px;
    font-size: 14px;
  }

  .mobile-stats strong {
    color: #ffffff;
  }

  .mobile-info-toggle {
    display: block;
    width: 100%;
    max-width: 300px;
    margin-top: 0;
    background: #2f3b64;
    padding: 4px 12px 7px;
    font-size: 18px;
    line-height: 1;
  }

  .mobile-info-panel {
    width: 100%;
    max-width: 300px;
    border: 1px solid #2e3557;
    border-radius: 8px;
    background: #161d38;
    padding: 10px;
    font-size: 14px;
  }

  .mobile-info-panel:not(.hidden) {
    display: block;
  }

  .mobile-info-panel h2 {
    margin: 0 0 8px;
    font-size: 15px;
  }

  .mobile-info-panel .controls h2 {
    margin-top: 10px;
  }

  .mobile-info-panel .controls ul {
    margin-top: 6px;
  }

  .mobile-info-panel .controls li {
    margin-bottom: 4px;
  }

  .mobile-info-panel .setting-row {
    margin-top: 10px;
  }

  .mobile-info-panel button {
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .panel {
    display: none;
  }
}
