* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: var(--app-height, 100dvh);
  min-height: var(--app-height, 100dvh);
  overflow: hidden;
  background: #CFEAF7;
  font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Helvetica Neue", Arial, sans-serif;
  touch-action: none;
}

#game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: var(--app-height, 100dvh);
}

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* スコア表示: 画面左上に大きく白文字+影 */
#score-display {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 20px;
  font-size: 56px;
  font-weight: 900;
  color: #ffffff;
  text-shadow:
    3px 3px 0 rgba(0, 0, 0, 0.35),
    0 0 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
  line-height: 1;
  pointer-events: none;
}

#high-score-display {
  position: fixed;
  top: max(76px, calc(env(safe-area-inset-top) + 72px));
  left: 20px;
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: 900;
  color: #fff9ec;
  text-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.35),
    0 0 8px rgba(0, 0, 0, 0.12);
  z-index: 10;
  line-height: 1;
  pointer-events: none;
}

#multiplier-display {
  position: fixed;
  top: max(102px, calc(env(safe-area-inset-top) + 98px));
  left: 20px;
  z-index: 10;
  color: #fff9ec;
  font-size: clamp(11px, 2.8vw, 14px);
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

#multiplier-display.max {
  color: #ffe08a;
}

#suppori-display {
  position: fixed;
  top: max(126px, calc(env(safe-area-inset-top) + 122px));
  left: 20px;
  font-size: clamp(22px, 5.6vw, 32px);
  font-weight: 900;
  color: #ffcf5f;
  text-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.35),
    0 0 8px rgba(0, 0, 0, 0.12);
  z-index: 10;
  line-height: 1;
  pointer-events: none;
}

#suppori-combo-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: #fff9ec;
  color: #e8453c;
  font-size: 0.58em;
  text-shadow: none;
  vertical-align: 0.15em;
}

#suppori-count {
  color: inherit;
}

/* ミュートボタン: 画面右上の小さな丸ボタン(オーバーレイより上) */
#mute-button {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 30, 40, 0.45);
  color: #ffffff;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

#mute-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  pointer-events: none;
}

#mute-button:active {
  background: rgba(20, 30, 40, 0.7);
}

/* オーバーレイ共通 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(20, 30, 40, 0.35);
  text-align: center;
  padding: 24px;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  display: none;
}

/* タイトルは上寄せ配置(中央やや下に立つおにぎりと重ならないように) */
#title-overlay {
  justify-content: flex-start;
  padding-top: max(5vh, env(safe-area-inset-top));
  background: rgba(20, 30, 40, 0.18);
}

#title-overlay h1 {
  width: min(720px, 94vw);
  height: clamp(100px, 15vh, 150px);
  margin: -8px 0 -10px;
  line-height: 0;
}

#title-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 4px rgba(0, 0, 0, 0.3));
}

@media (min-width: 768px) {
  #title-overlay h1 {
    height: 170px;
  }
}

#title-overlay .story {
  font-size: clamp(13px, 3.4vw, 17px);
  color: #ffe9c9;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  margin: 0;
  line-height: 1.6;
}

#title-overlay .hint {
  font-size: clamp(16px, 4vw, 22px);
  color: #ffffff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  margin: 0;
  animation: pulse 1.6s ease-in-out infinite;
}

#capo-preview-button {
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 800;
  padding: 10px 24px;
  min-width: 112px;
  border: 0;
  border-radius: 999px;
  color: #4A3F36;
  background: #FFF9EC;
  box-shadow: 0 4px 0 #d8c9ad, 0 6px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

#capo-preview-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d8c9ad, 0 3px 8px rgba(0, 0, 0, 0.18);
}

.poyo-speech {
  position: fixed;
  top: clamp(286px, 42vh, 366px);
  left: calc(50% + clamp(52px, 8vw, 104px));
  z-index: 24;
  padding: 9px 14px;
  border-radius: 18px;
  background: #fff9ec;
  color: #7a4f45;
  font-size: clamp(15px, 3.6vw, 20px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 0 #e2c9b5, 0 7px 14px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  transform: translate(-12px, 8px) scale(0.86);
  opacity: 0;
}

.poyo-speech::after {
  content: "";
  position: absolute;
  left: 7px;
  bottom: -13px;
  width: 22px;
  height: 17px;
  background: #fff9ec;
  clip-path: polygon(0 0, 100% 0, 8% 100%);
  filter: drop-shadow(3px 3px 0 #e2c9b5);
  transform: rotate(18deg);
}

.poyo-speech.show {
  animation: poyo-speech-pop 1.05s ease-out forwards;
}

.poyo-speech.hidden {
  display: none;
}

@keyframes poyo-speech-pop {
  0% { opacity: 0; transform: translate(-12px, 10px) scale(0.82); }
  14% { opacity: 1; transform: translate(-12px, -2px) scale(1.08); }
  28% { opacity: 1; transform: translate(-12px, 0) scale(0.98); }
  78% { opacity: 1; transform: translate(-12px, -3px) scale(1); }
  100% { opacity: 0; transform: translate(-12px, -16px) scale(0.96); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

#gameover-overlay h2 {
  font-size: clamp(28px, 7vw, 48px);
  color: #ffffff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  margin: 0;
}

#gameover-overlay .score-label {
  font-size: clamp(18px, 5vw, 26px);
  color: #ffffff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  margin: 0;
}

#gameover-overlay .main-score-result {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  font-size: clamp(20px, 5.2vw, 30px);
  font-weight: 900;
}

#final-score {
  font-size: clamp(68px, 20vw, 112px);
  line-height: 0.86;
  color: #ffffff;
  text-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.35),
    0 0 10px rgba(0, 0, 0, 0.18);
}

#gameover-overlay .suppori-result {
  color: #ffcf5f;
}

#gameover-overlay .best-result {
  color: #fff9ec;
}

#gameover-overlay .new-record-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffcf5f;
  color: #4a3f36;
  font-size: 0.62em;
  line-height: 1;
  vertical-align: 0.18em;
  text-shadow: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

#gameover-overlay .new-record-badge.hidden {
  display: none;
}

#gameover-overlay .coin-breakdown {
  width: min(360px, 82vw);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255, 249, 236, 0.16);
  color: #fff9ec;
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 800;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.28);
}

#gameover-overlay .coin-breakdown span:nth-child(2n) {
  color: #ffe08a;
  text-align: right;
}

#retry-button {
  font-size: 20px;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 999px;
  border: none;
  background: #FFAFB6;
  color: #4A3F36;
  box-shadow: 0 4px 0 #d98890, 0 6px 10px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.1s ease;
}

#retry-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d98890, 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* コイン表示: すっぽりカウンターの下 */
#coin-display {
  position: fixed;
  top: max(166px, calc(env(safe-area-inset-top) + 162px));
  left: 20px;
  font-size: clamp(18px, 4.6vw, 26px);
  font-weight: 900;
  color: #ffe08a;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  z-index: 10;
  line-height: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.title-state #score-display,
body.title-state #high-score-display,
body.title-state #multiplier-display,
body.title-state #suppori-display,
body.title-state #run-items-display {
  display: none;
}

body.title-state #coin-display {
  top: max(18px, env(safe-area-inset-top));
}

/* ゲームオーバー画面はオーバーレイ側にスコア・コイン内訳が出るのでHUDを全て隠す */
body.gameover-state #score-display,
body.gameover-state #high-score-display,
body.gameover-state #multiplier-display,
body.gameover-state #suppori-display,
body.gameover-state #run-items-display,
body.gameover-state #coin-display {
  display: none;
}

/* プレイ中の装備アイテムチップ: すっぽり表示・コイン表示の下 */
#run-items-display {
  position: fixed;
  top: max(206px, calc(env(safe-area-inset-top) + 202px));
  left: 20px;
  z-index: 10;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

#run-items-display.hidden {
  display: none;
}

#run-items-display .run-item-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(20, 30, 40, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.55);
  font-size: 17px;
  line-height: 1;
  transition: opacity 0.4s ease;
}

#run-items-display .run-item-chip.used {
  opacity: 0.15;
}

.coin-dot {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe89a, #f2c14e 60%, #c9932a);
  border: 2px solid #a87c1f;
  vertical-align: -0.08em;
}

/* タイトル下部メニュー(キャラ/ガチャ/10連ガチャ) */
#title-menu {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  padding: 0 10px;
}

#title-menu-sub {
  position: absolute;
  bottom: calc(max(26px, env(safe-area-inset-bottom)) + 62px);
  left: 0;
  right: 0;
  display: flex;
  /* ボタン内でテキストを折り返さず、入り切らない時はボタン単位で行を折り返す */
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
}

#title-menu-sub button {
  min-height: 34px;
  padding: 8px 12px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  background: rgba(20, 30, 40, 0.58);
  color: #fff9ec;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

#daily-badge {
  padding: 8px 12px;
  border: 2px solid #fff9ec;
  border-radius: 6px;
  background: #ffcf5f;
  color: #4a3f36;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(135, 85, 20, 0.35);
}

#title-menu button {
  font-size: clamp(14px, 3.6vw, 19px);
  font-weight: 800;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  color: #4A3F36;
  background: #FFF9EC;
  box-shadow: 0 4px 0 #d8c9ad, 0 6px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

#title-menu button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d8c9ad, 0 3px 8px rgba(0, 0, 0, 0.18);
}

#title-menu button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* 狭い画面: 3ボタン(キャラ/ガチャ/10連)が1行に収まるよう縮める。
   1行維持でメニュー高さが固定になり、#gacha-result の「ボタンのすぐ上」位置が崩れない */
@media (max-width: 430px) {
  #title-menu {
    gap: 8px;
  }

  #title-menu button {
    font-size: 13px;
    padding: 11px 13px;
    gap: 4px;
  }

  #gacha-result {
    bottom: calc(max(26px, env(safe-area-inset-bottom)) + 102px);
  }
}

/* ガチャ結果バナー: タイトルメニューのボタンのすぐ上に出す(下端基準で上へ伸びるのでボタンに被らない) */
#gacha-result {
  position: absolute;
  bottom: calc(max(26px, env(safe-area-inset-bottom)) + 108px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 249, 236, 0.96);
  color: #4A3F36;
  border-radius: 16px;
  padding: 14px 26px;
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  z-index: 25;
  pointer-events: none;
}

#gacha-result .rarity-chip {
  margin-right: 8px;
}

#gacha-result .gacha-refund {
  color: #e8a13c;
  text-shadow: 0 1px 0 rgba(120, 78, 12, 0.22);
}

#gacha-result.hidden {
  display: none;
}

/* 10連ガチャ結果: 5x2グリッド(スマホ縦画面でもはみ出さないよう幅を制限) */
#gacha-result.gacha10 {
  width: min(320px, 88vw);
  white-space: normal;
  padding: 12px 12px 14px;
}

.gacha10-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.gacha10-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 5px;
  border-radius: 10px;
  background: rgba(74, 63, 54, 0.07);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.gacha10-card .rarity-chip {
  margin-right: 0;
}

.gacha10-name {
  max-width: 100%;
  word-break: break-word;
}

.gacha10-new {
  position: absolute;
  top: -6px;
  right: -4px;
  background: #ffcf5f;
  color: #4A3F36;
  font-size: 8px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  line-height: 1.4;
}

/* キャラずかん */
#chars-overlay {
  background: rgba(20, 30, 40, 0.72);
  justify-content: flex-start;
  padding-top: max(6vh, env(safe-area-inset-top));
  padding-bottom: max(112px, calc(env(safe-area-inset-bottom) + 104px));
  overflow-y: auto;
}

#chars-overlay h2 {
  font-size: clamp(22px, 6vw, 34px);
  color: #ffffff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  margin: 0;
}

#chars-overlay .score-label {
  color: #ffe9c9;
  margin: 0;
  font-size: clamp(13px, 3.4vw, 16px);
}

#chars-filter {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 27;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: min(680px, 94vw);
  min-height: 58px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 2px 10px;
  margin-bottom: 8px;
  background: linear-gradient(
    180deg,
    rgba(20, 30, 40, 0.92) 0%,
    rgba(20, 30, 40, 0.86) 76%,
    rgba(20, 30, 40, 0) 100%
  );
  scrollbar-width: none;
}

#chars-filter::-webkit-scrollbar {
  display: none;
}

.chars-filter-button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 249, 236, 0.18);
  color: #fff9ec;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  padding: 9px 12px;
  min-width: 58px;
  min-height: 38px;
  cursor: pointer;
}

.chars-filter-button.active {
  background: #fff9ec;
  border-color: #ffcf5f;
  color: #4A3F36;
  box-shadow: 0 3px 0 rgba(255, 207, 95, 0.55);
}

#chars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
  width: min(680px, 94vw);
}

.char-cell {
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(255, 249, 236, 0.92);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: #4A3F36;
  font-weight: 800;
  font-size: 12px;
  line-height: 1.2;
  min-height: 52px;
  text-align: left;
}

.char-cell.locked {
  background: rgba(70, 80, 90, 0.75);
  color: rgba(255, 255, 255, 0.75);
  cursor: default;
}

.char-cell.selected {
  border-color: #ffcf5f;
  box-shadow: 0 0 0 3px rgba(255, 207, 95, 0.55);
}

.char-swatch {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  position: relative;
}

.char-swatch .filling-dot {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
}

.rarity-chip {
  font-size: 10px;
  font-weight: 900;
  border-radius: 6px;
  padding: 1px 6px;
  color: #ffffff;
  background: #9aa5ad;
}

.rarity-UC { background: #58b368; }
.rarity-R { background: #4a90d9; }
.rarity-SR { background: #9b59d0; }
.rarity-UR { background: #e8a13c; }
.rarity-SUR { background: linear-gradient(90deg, #e8453c, #e8a13c, #58b368, #4a90d9, #9b59d0); }
.rarity-SEC { background: linear-gradient(90deg, #101820, #ff4fd8, #ffd75e, #9be8ff); }

#chars-close-button {
  position: fixed;
  left: 50%;
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 20px));
  transform: translateX(-50%);
  z-index: 28;
  font-size: 17px;
  font-weight: 800;
  padding: 12px 34px;
  border: 0;
  border-radius: 999px;
  color: #4A3F36;
  background: #FFF9EC;
  box-shadow: 0 4px 0 #d8c9ad;
  cursor: pointer;
  margin-bottom: 0;
}

#gameover-overlay .coin-result {
  color: #ffe08a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-popup {
  position: fixed;
  left: 50%;
  z-index: 18;
  transform: translateX(-50%);
  color: #fff9ec;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.38);
}

#multiplier-popup {
  top: 42%;
  color: #ffe08a;
  font-size: clamp(34px, 10vw, 68px);
}

#combo-popup {
  top: 27%;
  color: #ffcf5f;
  font-size: clamp(24px, 7vw, 42px);
}

#multiplier-popup.play {
  animation: multiplier-pop 1.2s ease-out forwards;
}

#combo-popup.play {
  animation: combo-pop 0.9s ease-out forwards;
}

@keyframes multiplier-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.55); }
  18% { opacity: 1; transform: translateX(-50%) scale(1.16); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.08); }
}

@keyframes combo-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.75); }
  22% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.08); }
  72% { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.96); }
}

.meta-overlay {
  z-index: 26;
  justify-content: flex-start;
  gap: 12px;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(94px, calc(env(safe-area-inset-bottom) + 82px));
  background: rgba(20, 30, 40, 0.9);
}

.meta-overlay h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(24px, 6vw, 34px);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.meta-panel,
.meta-list,
.ranking-list {
  width: min(560px, 94vw);
}

.meta-panel {
  padding: 16px;
  border-radius: 8px;
  background: #fff9ec;
  color: #4a3f36;
}

.meta-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.meta-panel hr {
  margin: 18px 0;
  border: 0;
  border-top: 2px solid #e2d5bd;
}

.meta-panel input {
  width: 100%;
  min-height: 42px;
  margin: 8px 0;
  padding: 8px 10px;
  border: 2px solid #b8aa91;
  border-radius: 6px;
  background: #fff;
  color: #302b27;
  font: inherit;
  user-select: text;
  -webkit-user-select: text;
}

.meta-panel button,
.meta-close-button {
  min-height: 40px;
  padding: 9px 18px;
  border: 0;
  border-radius: 6px;
  background: #ffcf5f;
  color: #4a3f36;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.meta-panel button:disabled {
  opacity: 0.48;
}

#transfer-code {
  display: block;
  margin: 8px 0 12px;
  padding: 10px;
  border: 2px dashed #b8aa91;
  border-radius: 6px;
  background: #fff;
  color: #302b27;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

.meta-note,
.meta-status,
.meta-summary,
.meta-confirm p,
.ranking-me-panel p {
  margin: 10px 0 0;
  line-height: 1.55;
  font-size: 13px;
  font-weight: 800;
}

.meta-status {
  min-height: 20px;
  color: #c64a43;
}

.meta-confirm {
  margin-top: 12px;
  padding: 12px;
  border: 2px solid #e8a13c;
  border-radius: 6px;
  background: #fff1c7;
}

.meta-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.meta-close-button {
  position: fixed;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  z-index: 28;
  transform: translateX(-50%);
  min-width: 110px;
  background: #fff9ec;
  box-shadow: 0 4px 0 #b9aa90;
}

.meta-summary {
  color: #ffe9c9;
  font-size: 16px;
}

.achievement-notice {
  min-height: 22px;
  margin: -4px 0 0;
  color: #ffcf5f;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.4;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.meta-list {
  display: grid;
  gap: 8px;
}

.achievement-item {
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(94, 104, 112, 0.86);
  color: rgba(255, 255, 255, 0.8);
  text-align: left;
}

.achievement-item.achieved {
  border-color: #58b368;
  background: #fff9ec;
  color: #4a3f36;
}

.achievement-item.claimable {
  border-color: #ffcf5f;
  background: #fff3c8;
  color: #4a3f36;
  box-shadow: 0 3px 0 rgba(232, 161, 60, 0.5);
}

.achievement-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.achievement-head span {
  flex: 0 0 auto;
  color: #ffe08a;
  font-weight: 900;
}

.achievement-item.achieved .achievement-head span,
.achievement-item.claimable .achievement-head span {
  color: #b56b18;
}

.achievement-item p {
  margin: 6px 0;
  font-size: 12px;
  font-weight: 800;
}

.achievement-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
}

.achievement-bar span {
  display: block;
  height: 100%;
  background: #ffcf5f;
}

.achievement-item.achieved .achievement-bar span {
  background: #58b368;
}

.achievement-claimed {
  display: block;
  margin-top: 9px;
  color: #287a43;
  font-size: 14px;
  text-align: right;
}

.achievement-claim-button {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: #e8453c;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 3px 0 #aa312b;
  cursor: pointer;
}

.achievement-claim-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #aa312b;
}

.achievement-claim-button:disabled {
  opacity: 0.55;
}

/* アイテム一覧(じっせき一覧のトーンを流用) */
.item-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(94, 104, 112, 0.86);
  color: rgba(255, 255, 255, 0.85);
  text-align: left;
  cursor: pointer;
}

.item-row .item-icon {
  flex: 0 0 auto;
  width: 34px;
  font-size: 26px;
  text-align: center;
}

.item-row .item-info {
  flex: 1 1 auto;
  min-width: 0;
}

.item-row .item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
}

.item-row .item-desc {
  margin: 4px 0 0;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

.item-row .item-count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 900;
  color: #ffe08a;
}

.item-row.locked {
  opacity: 0.5;
  cursor: default;
}

.item-row.equipped {
  border-color: #ffcf5f;
  background: #fff3c8;
  color: #4a3f36;
  box-shadow: 0 3px 0 rgba(232, 161, 60, 0.5);
}

.item-row.equipped .item-count {
  color: #b56b18;
}

.item-equipped-badge {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 900;
  color: #b56b18;
  background: #ffe08a;
  border-radius: 6px;
  padding: 3px 6px;
}

.ranking-list {
  display: grid;
  gap: 5px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 48px 1fr 64px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 249, 236, 0.9);
  color: #4a3f36;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.ranking-row span:last-child {
  color: #b56b18;
  text-align: right;
}

.ranking-row.me {
  border: 2px solid #ffcf5f;
  background: #fff3c8;
}

#share-button {
  min-height: 42px;
  padding: 10px 30px;
  border: 2px solid #fff9ec;
  border-radius: 6px;
  background: rgba(20, 30, 40, 0.5);
  color: #fff9ec;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.share-status {
  min-height: 18px;
  margin: -8px 0 0;
  color: #fff9ec;
  font-size: 13px;
  font-weight: 900;
}

@media (max-height: 720px) {
  #title-overlay {
    gap: 9px;
    padding-top: max(7vh, env(safe-area-inset-top));
  }

  #gameover-overlay {
    gap: 8px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  #final-score {
    font-size: clamp(52px, 14vw, 76px);
  }

  #gameover-overlay .coin-breakdown {
    padding: 7px 12px;
    font-size: 12px;
  }
}
