* { margin: 0; padding: 0; box-sizing: border-box; }
#title-screen, #victory-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
}
#title-screen img, #victory-screen img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
#victory-screen { display: none; }
#victory-screen h2 {
  color: #ffd700;
  font-size: 32px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  margin-bottom: 16px;
}
#victory-screen button {
  margin-top: 16px;
  padding: 12px 32px;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  background: #8b4513;
  color: #fff;
  cursor: pointer;
}
#victory-screen button:active { background: #a0522d; }
body {
  background: #87CEEB;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100dvh;
  overflow: hidden;
  font-family: sans-serif;
  color: #fff;
  touch-action: none;
  user-select: none;
}
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  position: relative;
  z-index: 2;
}
#header h1 {
  font-size: 18px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
#next-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
#next-preview {
  width: 40px;
  height: 40px;
}
#game-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  flex: 1;
  border: 2px solid #8B7355;
  border-top: none;
  overflow: hidden;
}
canvas { display: block; }
#bg-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}
#game-canvas {
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
}
#guide-line {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 2;
}
#overlay {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 10;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
#overlay.show { display: flex; }
#overlay h2 { font-size: 28px; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
#overlay button {
  padding: 12px 32px;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  background: #8b4513;
  color: #fff;
  cursor: pointer;
}
#overlay button:active { background: #a0522d; }
#rank-list {
  display: flex;
  gap: 4px;
  padding: 4px 12px;
  width: 100%;
  max-width: 400px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 11px;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  color: #333;
}
.rank-item {
  display: flex;
  align-items: center;
  gap: 2px;
}
.rank-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.rank-arrow { color: #666; }
