* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  font-family: 'Noto Sans JP', 'Noto Sans', sans-serif;
  touch-action: none;
  user-select: none;
}

#game-container {
  position: relative;
  width: 800px;
  max-width: 100vw;
  height: 100vh;
  overflow: hidden;
  margin: 0 auto;
}

#ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

#score-panel {
  display: flex;
  flex-direction: row;
  gap: 16px;
  color: #fff;
  font-size: 21px;
  background: rgba(0,0,0,0.6);
  padding: 8px 22px;
  border-radius: 6px;
  width: fit-content;
  align-self: center;
}

#score-panel strong {
  color: #ffd700;
}

.instruction {
  color: #fff;
  font-size: 19px;
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 4px;
  text-align: center;
  min-height: 32px;
}

#guide {
  position: absolute;
  top: 48px;
  right: 12px;
  z-index: 10;
  background: rgba(0,0,0,0.55);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.guide-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ccc;
  font-size: 17px;
  font-family: 'Noto Sans', sans-serif;
}

.key {
  display: inline-block;
  background: #444;
  color: #fff;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 15px;
  font-family: 'Space Mono', monospace;
  min-width: 32px;
  text-align: center;
  border-bottom: 2px solid #222;
}

#lang-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 20;
  background: rgba(0,0,0,0.75);
  color: #fff;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'Noto Sans', sans-serif;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: auto;
  outline: none;
}
#lang-btn:focus { border-color: #aaa; }

#gameCanvas {
  display: block;
  touch-action: none;
}



#overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#overlay.hidden {
  display: none;
}

#overlay-box {
  background: #222;
  border: 2px solid #444;
  border-radius: 12px;
  padding: 32px 40px;
  text-align: center;
  color: #fff;
  max-width: 320px;
  width: 90%;
}

#overlay-box h2 {
  font-size: 24px;
  margin-bottom: 12px;
  color: #ffd700;
}

#overlay-box p {
  font-size: 15px;
  margin-bottom: 24px;
  color: #ccc;
  line-height: 1.6;
}

#overlay-btn {
  background: #ffd700;
  color: #111;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s;
}

#overlay-btn:active {
  opacity: 0.7;
}