* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Hiragino Maru Gothic Pro', 'BIZ UDPGothic', sans-serif;
  background: #0e0e1a;
  color: #fff;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.screen.hidden {
  display: none;
}

/* タイトル */
.logo {
  font-size: 2.2rem;
  text-shadow: 0 2px 12px rgba(34, 200, 80, 0.5);
}

.title-scores {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 1.3rem;
}

.label {
  opacity: 0.65;
  font-size: 0.75rem;
}

.title-rule {
  text-align: center;
  line-height: 1.7;
  opacity: 0.8;
  font-size: 0.9rem;
}

.btn-primary {
  padding: 14px 40px;
  font-size: 1.1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #22cc66, #009944);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34, 204, 102, 0.45);
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary {
  padding: 10px 28px;
  font-size: 0.95rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ゲーム画面 */
#screen-game {
  justify-content: flex-start;
  padding: 0;
}

.game-header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  flex-shrink: 0;
  z-index: 10;
}

.info-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-table {
  width: 100%;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.score-row {
  display: flex;
  justify-content: space-around;
}

.frame-label {
  width: 18%;
  text-align: center;
  font-size: 0.68rem;
  opacity: 0.55;
  padding-bottom: 2px;
}

.frame-cell {
  width: 18%;
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #88ddff;
  font-weight: bold;
}

#renderCanvas {
  flex: 1;
  width: 100%;
  touch-action: none;
  display: block;
  outline: none;
}

.message {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.4rem;
  font-weight: bold;
  text-shadow: 0 0 24px currentColor;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  animation: msgPop 0.3s ease-out;
}

.message.hidden {
  display: none;
}

@keyframes msgPop {
  from { transform: translateX(-50%) scale(0.5); }
  to   { transform: translateX(-50%) scale(1); }
}

.controls-hint {
  position: fixed;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  opacity: 0.4;
  z-index: 10;
  pointer-events: none;
}

/* 結果画面 */
.result-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.result-emoji {
  font-size: 3.5rem;
}

.result-title {
  font-size: 1.9rem;
  font-weight: bold;
}

.result-score,
.result-best {
  font-size: 1.25rem;
}
