/* じゃがめぐり檜原: スタイルシート
   スマホ縦持ちが基本。PC でも破綻しないよう幅を制限する */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2a3d24;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'BIZ UDPGothic', Meiryo, sans-serif;
  color: #333;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.screen { position: fixed; inset: 0; }
.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- スタート画面 */

#screen-start {
  overflow-y: auto;
  background:
    radial-gradient(circle at 70% 15%, rgba(255, 240, 180, 0.5), transparent 45%),
    linear-gradient(180deg, #a8d8f0 0%, #cfe8c8 45%, #e8dfc0 100%);
}

.start-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 36px 20px 32px;
  text-align: center;
}

.start-catch {
  display: inline-block;
  background: #4a6b3a;
  color: #fff;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 99px;
  letter-spacing: 0.05em;
}

.start-title {
  margin: 14px 0 10px;
  font-size: 44px;
  line-height: 1.15;
  color: #5a3d1e;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}
.start-title rt { font-size: 13px; color: #7a5a34; }

.start-desc {
  font-size: 14px;
  line-height: 1.8;
  color: #4a4234;
  margin-bottom: 20px;
}

/* ステージ選択カード */
#stage-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.stage-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #7a5a34;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 3px 0 rgba(90, 61, 30, 0.35);
  text-align: left;
  transition: transform 0.08s;
}
.stage-card:active { transform: translateY(2px); box-shadow: none; }
.stage-card.locked { opacity: 0.55; border-color: #999; box-shadow: none; cursor: default; }

.stage-emoji { font-size: 30px; }
.stage-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.stage-name { font-size: 15px; font-weight: bold; color: #4a3520; }
.stage-sub { font-size: 11px; color: #857a66; }
.stage-stars { font-size: 14px; color: #e8a020; letter-spacing: 0.1em; }

.start-credit {
  margin-top: 22px;
  font-size: 10px;
  line-height: 1.7;
  color: #6a6a58;
}

/* ---------------------------------------------------------------- ボタン共通 */

.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 10px auto 0;
  padding: 13px 20px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 99px;
}

.btn-primary {
  background: #e8a020;
  color: #fff;
  border: none;
  box-shadow: 0 4px 0 #b07610;
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b07610; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  color: #5a4a30;
  border: 2px solid #a08a60;
  box-shadow: 0 3px 0 rgba(120, 100, 60, 0.3);
}
.btn-secondary:active { transform: translateY(2px); box-shadow: none; }

/* ---------------------------------------------------------------- プレイ画面 HUD */

#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

#hud { position: absolute; inset: 0; pointer-events: none; }

#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  background: linear-gradient(180deg, rgba(20, 30, 15, 0.55), transparent);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

#btn-back {
  pointer-events: auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 17px;
  line-height: 1;
}

#hud-stage { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hud-time.warn { color: #ff8060; }

/* バーチャルスティック */
#stick-zone { position: absolute; inset: 0; }
#stick-base {
  display: none;
  position: absolute;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.35);
}
#stick-knob {
  position: absolute;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

/* ミニマップ */
#minimap {
  position: absolute;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  width: 150px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 10px;
  background: #1a2415;
  opacity: 0.92;
}

/* 掘るボタン */
#btn-dig {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 40px);
  padding: 16px 34px;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  background: #e8621c;
  border: 3px solid #fff;
  border-radius: 99px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
  animation: pulse 0.9s infinite alternate;
}
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.08); } }

/* トースト (ステージ開始メッセージ) */
#toast {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 12px 22px;
  background: rgba(20, 30, 15, 0.75);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  border-radius: 12px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- オーバーレイ */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 25, 15, 0.6);
  padding: 20px;
  z-index: 10;
}

.panel {
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  background: #fdf8ec;
  border: 3px solid #7a5a34;
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.panel h2 { color: #5a3d1e; font-size: 22px; margin: 6px 0 12px; }
.panel p { font-size: 14px; line-height: 1.9; text-align: left; color: #4a4234; }

.card-golden {
  display: inline-block;
  background: linear-gradient(90deg, #f6d365, #fda085);
  color: #6a4a10;
  font-size: 13px;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 99px;
  text-align: center !important;
}
.card-emoji { font-size: 44px; text-align: center !important; margin: 6px 0 0; }
.card-source { font-size: 10px; color: #8a8070; margin-top: 10px; }

.result-stars {
  font-size: 40px;
  color: #e8a020;
  text-align: center !important;
  letter-spacing: 0.15em;
  margin: 4px 0;
}
#result-detail { text-align: center; }

.howto b { color: #5a3d1e; }
