/* ナイトパトロール檜原 */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0e1a;
  color: #e8e4d8;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

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

#screen-start {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(4, 7, 16, 0.34), rgba(6, 10, 20, 0.82)),
    url("../images/title.jpg") center / cover,
    linear-gradient(#060a14 0%, #0d1428 55%, #1a2440 80%, #253550 100%);
  overflow-y: auto;
}

.start-inner {
  width: min(92vw, 420px);
  text-align: center;
  padding: 24px 0;
}

.start-catch {
  font-size: 13px;
  letter-spacing: 0;
  color: #8fa3c8;
  margin-bottom: 10px;
}

.start-title {
  font-size: 40px;
  line-height: 1.3;
  letter-spacing: 0;
  color: #f2eee0;
  text-shadow: 0 0 24px rgba(140, 180, 255, 0.45);
  margin-bottom: 18px;
}
.start-title rt { font-size: 12px; letter-spacing: 0; color: #a8b6d4; }

.start-desc {
  font-size: 14px;
  line-height: 2;
  color: #c7c2b2;
  margin-bottom: 30px;
}

.start-audio-note {
  width: min(78vw, 300px);
  margin: -10px auto 18px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #f1dca1;
  background: rgba(255, 210, 110, 0.1);
  border: 1px solid rgba(255, 210, 110, 0.25);
  border-radius: 8px;
}

.stage-select {
  width: min(84vw, 340px);
  margin: -4px auto 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}
.stage-select-title {
  margin-bottom: 8px;
  color: #f1dca1;
  font-size: 12px;
  line-height: 1.4;
}
.stage-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.stage-button {
  min-height: 36px;
  color: #cfd8ea;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: bold;
}
.stage-button.selected {
  color: #3a2a08;
  background: linear-gradient(#ffcf5e, #e8a828);
  border-color: rgba(255, 221, 135, 0.75);
}

.btn-primary, .btn-secondary {
  display: block;
  width: min(78vw, 300px);
  margin: 0 auto 14px;
  padding: 15px;
  font-size: 17px;
  font-weight: bold;
  font-family: inherit;
  border-radius: 12px;
  border: none;
  cursor: pointer;
}
.btn-primary.inline, .btn-secondary.inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 118px;
  margin: 0 6px 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}
.btn-primary {
  background: linear-gradient(#ffcf5e, #e8a828);
  color: #3a2a08;
  box-shadow: 0 4px 16px rgba(232, 168, 40, 0.35);
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #cfd8ea;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.btn-secondary:active { transform: scale(0.97); }

.start-credit {
  margin-top: 26px;
  font-size: 10px;
  line-height: 1.7;
  color: #5d6b85;
}

.start-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 20;
  width: min(90vw, 430px);
  max-height: 82vh;
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 22px;
  text-align: center;
  background: rgba(9, 15, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}
.start-panel h2 { margin-bottom: 12px; font-size: 22px; }
.start-panel p { margin-bottom: 12px; font-size: 14px; line-height: 1.8; color: #d7d1c0; }

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

#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: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 13px;
  text-shadow: 0 1px 3px #000;
}

#hud-time { font-weight: bold; color: #ffd97a; }
#hud-mission { color: #dfe6f2; }

#hud-stats {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 38px);
  left: 14px;
  right: 14px;
  font-size: 12px;
  color: #f0d79c;
  text-shadow: 0 1px 3px #000;
}

/* 音が鳴った方向を一瞬だけ光らせる全画面HUD */
#sound-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.inspect-button {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 160px);
  transform: translateX(-50%);
  pointer-events: auto;
  padding: 12px 18px;
  font: inherit;
  font-weight: bold;
  color: #302205;
  background: linear-gradient(#ffe083, #ebb33f);
  border: none;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.toast {
  position: absolute;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  transform: translateX(-50%);
  max-width: min(88vw, 380px);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #fff0c6;
  text-align: center;
  background: rgba(12, 18, 30, 0.9);
  border: 1px solid rgba(255, 220, 150, 0.28);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
}

.game-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  pointer-events: auto;
  background: rgba(4, 7, 12, 0.44);
}

.modal-card {
  width: min(94vw, 520px);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 20px;
  color: #eee7d5;
  background: rgba(9, 15, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.56);
}

.modal-card h2 {
  margin-bottom: 12px;
  font-size: 24px;
  line-height: 1.35;
}
.modal-card h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.35;
}
.modal-card p {
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.75;
  color: #d9d1bc;
}
.modal-kicker {
  margin-bottom: 8px !important;
  color: #ffd97a !important;
  font-weight: bold;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 12px;
}

.dialog-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
}
.ojiichan {
  width: 96px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.equip {
  min-height: 92px;
  padding: 10px;
  text-align: left;
  color: #d8deec;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  font: inherit;
}
.equip strong {
  display: block;
  margin-bottom: 4px;
  color: #fff0c6;
  font-size: 14px;
}
.equip span {
  display: block;
  font-size: 11px;
  line-height: 1.55;
}
.equip.selected {
  background: rgba(255, 210, 110, 0.18);
  border-color: rgba(255, 210, 110, 0.72);
}

.zukan-list {
  display: grid;
  gap: 10px;
}
.zukan-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}
.zukan-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
}
.zukan-card p {
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1.55;
}
.zukan-card.locked img {
  filter: grayscale(1) brightness(0.45);
}

/* ミニマップ (右下) */
#minimap {
  position: absolute;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  width: 150px;
  height: 133px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(5, 8, 16, 0.6);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

/* バーチャルスティック (タッチ時のみ表示) */
#stick-base {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  display: none;
}
#stick-knob {
  position: absolute;
  left: 35px;
  top: 35px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 380px) {
  .start-title { font-size: 34px; }
  .dialog-row { grid-template-columns: 1fr; text-align: center; }
  .ojiichan { margin: 0 auto; }
  .equip-grid { grid-template-columns: 1fr; }
  .zukan-card { grid-template-columns: 1fr; }
  .zukan-card img { width: 100%; height: 130px; }
}
