* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  color: #f5f5f5;
  font-family: 'Courier New', Courier, monospace;
  padding: 12px;
}

#wrap {
  text-align: center;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0a0a0a;
  color: #f5f5f5;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

#rotate-overlay .icon {
  font-size: 64px;
  margin-bottom: 18px;
  animation: rotate-hint 1.6s ease-in-out infinite;
}

#rotate-overlay p {
  font-size: 18px;
  max-width: 320px;
  line-height: 1.5;
  color: #ccc;
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

@media (orientation: portrait) and (max-width: 900px) {
  #rotate-overlay { display: flex; }
  #wrap { display: none; }
}

.home-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid #f5f5f5;
  color: #f5f5f5;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.home-btn:hover {
  filter: brightness(1.25);
}

h1 {
  letter-spacing: 0.4em;
  margin: 0 0 4px;
  font-size: 1.1rem;
  flex: 0 0 auto;
}

#hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}

.score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.8rem;
  min-width: 90px;
}

.score .label {
  font-size: 0.7rem;
  opacity: 0.6;
}

#speedSelect {
  display: flex;
  gap: 6px;
}

.speedBtn {
  background: #111;
  color: #ccc;
  border: 1px solid #444;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 3px;
}

.speedBtn:hover {
  border-color: #888;
}

.speedBtn.active {
  background: #fff;
  color: #000;
  border-color: #fff;
}

canvas {
  background: #000;
  border: 2px solid #fff;
  display: block;
  cursor: none;
  touch-action: none;
  flex: 0 0 auto;
}

#hint {
  margin-top: 4px;
  font-size: 0.7rem;
  opacity: 0.6;
  flex: 0 0 auto;
}

@media (max-width: 480px) {
  body { align-items: flex-start; padding-top: 64px; }
  h1 { font-size: 1.1rem; letter-spacing: 0.25em; }
  #hud { gap: 10px; }
  .score { font-size: 1.2rem; min-width: 64px; gap: 4px; }
  .speedBtn { padding: 5px 8px; font-size: 0.65rem; }
  #hint { font-size: 0.68rem; padding: 0 8px; }
}
