* { margin:0; padding:0; box-sizing:border-box; }
html, body {
  overscroll-behavior: none;
  touch-action: pan-y;
}
body {
  background:#000;
  font-family:-apple-system, BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
  display:flex;
  justify-content:center;
  align-items:center;
  height:100vh;
  overflow:hidden;
  color:#fff;
}
#game-container {
  position:relative;
  width:100vw;
  max-width:600px;
  aspect-ratio:3/4;
  overflow:hidden;
  border-radius:16px;
  background:#000;
  box-shadow:0 10px 40px rgba(0,0,0,0.7);
}
canvas { width:100%; height:100%; display:block; }

.pixel {
  font-family:"Press Start 2P", system-ui, sans-serif;
  letter-spacing:0.08em;
}

.overlay {
  position:absolute; inset:0;
  background:rgba(0,0,0,0.55);
  display:flex; flex-direction:column;
  justify-content:center; align-items:center;
  text-align:center; padding:16px;
}
#start-overlay {
    background-image: url("title_bg.jpg"); /* ← あなたの背景画像ファイル */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    /* いまの黒背景を上書き */
    background-color: transparent !important;
}

/* ロゴ画像（ふわふわ） */
.main-logo {
  width:200px;
  max-width:55%;
  margin-bottom:12px;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  animation: logoFloat 2.6s ease-in-out infinite;
    position: relative;
  z-index: 1;
}

.logo {
  width:50px;
  max-width:55%;
  margin-bottom:12px;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  animation: logoFloat 2.6s ease-in-out infinite;
}
@keyframes logoFloat {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

.title {
  margin-bottom:8px;
}
.title.pixel {
  font-size:16px;
  line-height:1.4;
}
.subtitle {
  font-size:13px;
  opacity:0.85;
  margin-bottom:10px;
}
.subtitle-go {
  font-size:11px;
  opacity:0.9;
  margin-top:4px;
  margin-bottom:8px;
  line-height:1.4;
}
.btn {
  padding:10px 22px;
  border:none;
  border-radius:999px;
  font-size:10px;
  font-weight:600;
  background:#ffdd57;
  color:#222;
  cursor:pointer;
  margin-top:10px;
  box-shadow:0 4px 12px rgba(0,0,0,0.4);
  text-transform:uppercase;
  transition:opacity 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}
.btn:active {
  transform:translateY(1px);
  box-shadow:0 2px 6px rgba(0,0,0,0.4);
}
.btn:disabled {
  opacity:0.5;
  filter:grayscale(0.6);
  cursor:default;
  box-shadow:none;
  transform:none;
}

.score-display {
  position:absolute;
  top:8px;
  left:10px;
  font-size:18px;
  text-shadow:0 0 4px #000;
}
.score-display.pixel span {
  display:block;
  margin-bottom:2px;
}

.ranking-box {
  background:rgba(0,0,0,0.35);
  padding:10px 14px;
  border-radius:12px;
  width:100%;
  max-width:320px;
  margin-top:10px;
}
.ranking-list {
  list-style: none;
  font-size: 11px;
  max-height: 110px;   /* ★ 約5行ぶんの高さに抑える */
  overflow-y: auto;    /* それ以上はスクロール */
}
.ranking-list li {
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid rgba(255,255,255,0.08);
  padding:3px 0;
}
.name {
  max-width:60%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:4px;
}
.ranking-list li a {
  color:#8ecaff;
  text-decoration:none;
  transition:0.1s;
  font-family:"Press Start 2P", system-ui, sans-serif;
  font-size:9px;
}
.ranking-list li a:active {
  transform:scale(0.92);
  opacity:0.7;
}

.avatar {
  width:14px;
  height:14px;
  border-radius:3px;
  box-shadow:0 0 0 2px #000;
  position:relative;
  display:inline-block;
  flex-shrink:0;
}
.avatar::before,
.avatar::after {
  content:"";
  position:absolute;
  width:2px;
  height:2px;
  background:#111;
  top:4px;
  box-shadow:0 0 0 1px rgba(0,0,0,0.4);
}
.avatar::before { left:3px; }
.avatar::after { right:3px; }
.avatar-mouth {
  position:absolute;
  bottom:3px;
  left:4px;
  width:6px;
  height:2px;
  background:#111;
  box-shadow:0 0 0 1px rgba(0,0,0,0.4);
}

.input-row {
  width:100%;
  max-width:280px;
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.input-row input {
  padding:8px 10px;
  border-radius:999px;
  border:none;
  font-size:13px;
  outline:none;
  font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
}

.final-score {
  margin-top:6px;
  margin-bottom:4px;
  font-size:10px;
}
.final-score .pixel {
  font-size:12px;
}

.status-msg {
  font-size:10px;
  min-height:1.4em;
  opacity:0.85;
  margin-top:4px;
}

.bonus-label {
  position:absolute;
  top:8px;
  right:10px;
  font-size:9px;
  padding:4px 6px;
  border-radius:4px;
  background:rgba(255,128,255,0.2);
  border:1px solid #ff80ff;
  text-shadow:0 0 4px #000;
}

.confirm-panel {
  margin-top:10px;
  padding:8px 10px;
  border-radius:10px;
  background:rgba(0,0,0,0.6);
  border:1px solid rgba(255,255,255,0.22);
  width:100%;
  max-width:280px;
  font-size:10px;
}
.confirm-text {
  margin-bottom:6px;
  line-height:1.4;
}
.confirm-text small {
  opacity:0.8;
}
.confirm-actions {
  display:flex;
  justify-content:center;
  gap:8px;
}
.confirm-panel .btn {
  padding:6px 12px;
  font-size:9px;
  margin-top:0;
  box-shadow:none;
}

/* キャラ選択UI */
.chara-select {
  margin-top:4px;
  margin-bottom:6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}

.hidden-chara {
  display: none;
}

.chara-label {
  font-size:9px;
  opacity:0.9;
}
.chara-options-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;  /* 全体を中央に */
  align-items: center;
}

.chara-option {
    width:60px;
  padding:4px;
  border-radius:10px;
  border:2px solid rgba(255,255,255,0.25);
  background:rgba(0,0,0,0.35);
  cursor:pointer;
  transition:transform 0.1s, border-color 0.1s, box-shadow 0.1s, background 0.1s;
    overflow: hidden;
}

.chara-option img {
    width: 208px;
  height: 52px;
  display: block;
  image-rendering: pixelated;
  object-fit: ;          /* 拡大縮小しない */
  object-position: 0 0;      /* 左上だけ表示（1コマ目） */
  clip-path: inset(0 75% 0 0);/* 画像の左25%だけ切り出す */
}
.chara-option.selected {
  border-color:#ffdd57;
  box-shadow:0 0 10px rgba(255,221,87,0.7);
  background:rgba(255,221,87,0.1);
}
.chara-option:active {
  transform:scale(0.95);
}
