/* THE 漁師 — 画面レイアウト
   ボタンの見た目は仮。完成デザイン受領後に差し替える */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* --- 操作ボタン ---
   参考画像にボタンは描かれていないため、ゲーム画面の外側（横長スマホの左右余白）に置く。
   余白が足りない端末（iPadなど）では画面の下隅に半透明で重なる */
.pad {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 6px;
  --b: clamp(40px, 12vh, 60px);
}

#pad-left {
  left: calc(12px + env(safe-area-inset-left, 0px));
  grid-template-areas: "up up" "left right";
  grid-template-columns: var(--b) var(--b);
  grid-template-rows: var(--b) var(--b);
  row-gap: 16px; /* 2026-10-08：撒き餌のボタンを左右のボタンから上へ離す（押せる範囲どうしは重ならない） */
}

#pad-right {
  right: calc(16px + env(safe-area-inset-right, 0px));
}

.btn {
  margin: 0;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.85);
  font: bold 22px/1 monospace;
  touch-action: none;
  cursor: pointer;
}

.btn.is-down { background: rgba(255, 255, 255, 0.45); }

.btn-up { grid-area: up; justify-self: center; width: var(--b); }
.btn-left { grid-area: left; }
.btn-right { grid-area: right; }

/* ← →（2026-10-08）：四角い枠を外して矢印だけ。押せる範囲（ボタンの大きさ）は今までどおり
   矢印は白で、黒いふちを付けて、明るい背景の上でも見分けられるようにする。押している間は黄色 */
.btn-left, .btn-right {
  border: none;
  background: transparent;
  color: #ffffff;
  font: bold 30px/1 monospace;
  text-shadow: -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000, 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}
.btn-left.is-down, .btn-right.is-down { background: transparent; color: #f8d878; }

/* 撒き餌（↑、2026-10-08）：小さめの丸。金色〜黄土色の縁と、真ん中に撒き餌のアイコン（images/sprites/icon_bait.png を拡大）
   押せる範囲は、ボタンの大きさ（左右のボタンと同じ四角）のまま。見た目の丸だけ、その 76% */
.btn-up {
  position: relative;
  border: none;
  background: transparent;
  font-size: 0;
}
.btn-up::before {
  content: '';
  position: absolute;
  inset: 12%;
  border: 3px solid #db9820;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45) url("images/sprites/icon_bait.png") center / 52% auto no-repeat;
  image-rendering: pixelated;
  box-shadow: 0 0 0 1px #6b3d06;
  pointer-events: none;
}
.btn-up.is-down { background: transparent; }
.btn-up.is-down::before { background-color: rgba(253, 225, 102, 0.55); border-color: #fde166; }

/* ○（針の操作）：押せる範囲は今までどおり。見た目の円だけ、その 80% に小さくする（2026-10-08） */
.btn-action {
  position: relative;
  width: clamp(64px, 22vh, 96px);
  height: clamp(64px, 22vh, 96px);
  border: none;
  border-radius: 50%;
  background: transparent;
}
.btn-action::before {
  content: '';
  position: absolute;
  inset: 10%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.btn-action.is-down { background: transparent; }
.btn-action.is-down::before { background: rgba(255, 255, 255, 0.45); }

/* --- ニックネーム登録画面の入力欄（工程6.7） ---
   位置と大きさは js/nickname_screen.js が Canvas に合わせて決める */
#nickname-input {
  position: fixed;
  z-index: 5;
  margin: 0;
  padding: 0 0.4em;
  border: none;
  outline: none;
  border-radius: 0;
  background: #000;
  color: #f8f8f8;
  caret-color: #f8f8f8;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", monospace;
  font-weight: bold;
  touch-action: auto;
  -webkit-user-select: text;   /* 画面全体の選択禁止の中でも、入力欄だけは文字を入力できるようにする */
  user-select: text;
}

#nickname-input::placeholder { color: #7c7c7c; }

#nickname-message {
  position: fixed;
  z-index: 5;
  color: #f8d878;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 1px 1px 0 #000;
}

/* β版の案内（2026-10-10）：ITEM・コンテニューを押したとき。js/title.js の BetaNotice が位置を合わせる */
#beta-notice {
  position: fixed;
  z-index: 5;
  color: #f8f8f8;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 1px 1px 0 #000;
}

/* β版：ホーム画面からの起動を必須にする案内（2026-10-10）。画面全体・縦向きでも出す（縦向きの警告より手前） */
#home-guide {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.82);
  overflow-y: auto;
  touch-action: pan-y;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  color: #f8f8f8;
}
#home-guide[hidden] { display: none; }
#home-guide .hg-panel {
  max-width: 560px;
  width: 100%;
  margin: auto;
  padding: 16px 18px;
  background: #000;
  border: 3px solid #f8f8f8;
  box-shadow: 0 0 0 3px #000, 0 0 0 6px #d82800;
}
#home-guide .hg-title {
  text-align: center;
  color: #f8d878;
  font-weight: bold;
  font-size: 20px;
  margin-bottom: 12px;
  text-shadow: 2px 2px 0 #7c0800;
}
#home-guide .hg-steps { list-style: none; margin: 0; padding: 0; }
#home-guide .hg-steps li { display: flex; gap: 8px; margin: 8px 0; font-size: 15px; line-height: 1.5; font-weight: bold; }
#home-guide .hg-num { color: #f8d878; flex: none; }
#home-guide .hg-foot { margin-top: 12px; text-align: center; font-size: 14px; color: #bcbcbc; }
#home-guide .hg-url { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
#home-guide .hg-url-text { font: 12px Menlo, monospace; color: #f8f8f8; word-break: break-all; -webkit-user-select: text; user-select: text; }
#home-guide .hg-copy { font: bold 14px sans-serif; padding: 6px 12px; color: #fff; background: #d82800; border: 2px solid #f8f8f8; border-radius: 0; }

/* --- 縦向き警告（スマホ・タブレットのみ） --- */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
  font: 16px monospace;
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: flex; }
}

/* --- 開発用表示 --- */
#debug {
  position: fixed;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: #0f0;
  font: 10px/1.3 monospace;
  text-align: center;
  pointer-events: none;
  text-shadow: 1px 1px 0 #000;
}
