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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #87ceeb;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

#hud {
  position: fixed;
  /* viewport-fit=cover でノッチ下まで描画されるため safe-area 分だけ避ける */
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.hud-item {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  width: fit-content;
}

/* チュートリアルの誘導テキスト(自転車購入まで表示) */
#tutorial-hint {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 17px;
  pointer-events: none;
}

/* ショップ(停車中に表示されるオーバーレイ) */
#shop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#shop[hidden] {
  display: none;
}

#shop-panel {
  background: #fffdf5;
  border-radius: 16px;
  padding: 20px 24px;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#shop-status {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: #555;
}

.shop-item[hidden] {
  display: none;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e0d8c4;
  border-radius: 10px;
  background: #fff;
}

.shop-item-name {
  font-weight: bold;
}

.shop-item-level {
  color: #888;
  font-weight: normal;
  font-size: 14px;
}

.shop-item-desc {
  font-size: 13px;
  color: #777;
}

.shop-item-effect {
  font-size: 13px;
  color: #2b7a2b;
  font-variant-numeric: tabular-nums;
}

.shop-buy {
  flex-shrink: 0;
  min-width: 110px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: #d94f2b;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.shop-buy:hover:not(:disabled) {
  background: #bf3f1f;
}

.shop-buy:disabled {
  background: #ccc;
  color: #888;
  cursor: default;
}

#shop-depart {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #2b5fd9;
  color: #fff;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

#shop-depart:hover:not(:disabled) {
  background: #2450b8;
}

#shop-depart:disabled {
  background: #ccc;
  color: #888;
  cursor: default;
}

/* プレステージ「旅を終える」(解禁距離以降の店でのみ表示) */
#shop-prestige[hidden] {
  display: none;
}

#shop-prestige {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e8c86a;
  border-radius: 10px;
  background: #fff8e0;
}

#shop-prestige-info {
  font-size: 13px;
  color: #7a5c00;
}

#shop-prestige-button {
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: #c98a00;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

#shop-prestige-button:hover {
  background: #a87300;
}

/* 設定・統計(⚙️ボタンで開閉するオーバーレイ) */
#settings-open {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  font-size: 20px;
  cursor: pointer;
}

#settings {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#settings[hidden] {
  display: none;
}

#settings-panel {
  background: #fffdf5;
  border-radius: 16px;
  padding: 20px 24px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#settings-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e0d8c4;
  border-radius: 10px;
  background: #fff;
}

.settings-stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: #555;
}

.settings-stat-value {
  font-variant-numeric: tabular-nums;
  color: #222;
}

#settings-mute,
#settings-close {
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: #2b7ad9;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

#settings-close {
  background: #888;
}

#settings-reset {
  padding: 10px 12px;
  border: 1px solid #d94f2b;
  border-radius: 10px;
  background: #fff;
  color: #d94f2b;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

/* ゴール画面(45,000km 到達で表示)。祝福トーンはプレステージ節の金色系に合わせる */
#goal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#goal[hidden] {
  display: none;
}

#goal-panel {
  background: #fff8e0;
  border: 2px solid #e8c86a;
  border-radius: 16px;
  padding: 24px;
  width: min(380px, calc(100vw - 32px));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

#goal-title {
  color: #7a5c00;
}

.goal-row {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: #6b5410;
}

#goal-prestige {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #c98a00;
  color: #fff;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

#goal-prestige:hover {
  background: #a87300;
}

/* おかえりモーダル(オフライン収益の受け取り)。ショップより手前に重ねる */
#offline {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#offline[hidden] {
  display: none;
}

#offline-panel {
  background: #fffdf5;
  border-radius: 16px;
  padding: 20px 24px;
  width: min(380px, calc(100vw - 32px));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.offline-row {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: #444;
}

#offline-close {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #2b5fd9;
  color: #fff;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

#offline-close:hover {
  background: #2450b8;
}
