/* ================================================================
   SHOKEI ISLAND — どうぶつの森風UI
   丸ゴシック・クリーム色の吹き出し・まるいボタン
   ================================================================ */
:root {
  --cream: #fff8ec;
  --cream2: #fdf3e0;
  --brown: #5b4632;
  /* 2026-08-16 WCAG AA 対応で暗くした。旧 #96826b は cream 上 3.49:1 で 4.5:1 に届かず。
     新 #7e6d5a は cream 上 4.71:1 / cream2 上 4.52:1（色相・彩度は維持）。 */
  --brown-light: #7e6d5a;
  --line: #ead9bd;
  /* 2026-08-16 WCAG AA 対応で暗くした。旧 #ea6224 は白文字ボタンで 3.35:1、
     cream 上の小さな見出しで 3.17:1 と、いずれも 4.5:1 未満だった。
     新 #c14913 は 白文字上 4.96:1 / cream 上 4.70:1 / cream2 上 4.51:1（色相維持）。 */
  --acc: #c14913;
  --leaf: #58b64c;
  --sky: #7ecdf5;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(91, 70, 50, 0.18);
  --font: "Hiragino Maru Gothic ProN", "BIZ UDGothic", "Yu Gothic", system-ui, sans-serif;
}

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

button, .btn, a.btn { touch-action: manipulation; }

/* hidden属性は display 指定より必ず優先させる */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--brown);
  background: var(--sky);
  -webkit-font-smoothing: antialiased;
}

.en { font-family: var(--font); letter-spacing: 0.14em; }

/* ===== 3Dキャンバス ===== */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.no3d #scene { display: none; }

/* ===== HUD ===== */
#hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  pointer-events: none;
  z-index: 30;
}
#hud-left {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  min-width: 0;
}
#brand {
  /* 押せることが伝わるように、見た目はラベルのままボタンにしている */
  font-family: var(--font);
  color: var(--brown);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 8px 18px;
  font-weight: bold;
  font-size: 0.95rem;
  pointer-events: auto;
}
#brand:hover { transform: scale(1.04); }
#brand .en {
  display: block;
  font-size: 0.58rem;
  color: var(--acc);
  font-weight: bold;
}
#hud-right {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
#sound-btn {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.15s;
}
#sound-btn:hover { transform: scale(1.08); }
#menu-btn {
  pointer-events: auto;
  min-height: 44px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s;
}
#menu-btn:hover { transform: scale(1.06); }

/* ===== しらべるプロンプト ===== */
#prompt {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 25;
  background: var(--cream);
  border: 2px solid var(--acc);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 12px 22px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--brown);
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: min(92vw, 560px);
  animation: pop 0.25s ease-out;
}
#prompt:hover { background: var(--cream2); }
#prompt-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@keyframes pop {
  from { transform: translateX(-50%) scale(0.85); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ===== ジョイスティック ===== */
#joystick { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#joy-base {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 248, 236, 0.35);
  border: 2px solid rgba(255, 248, 236, 0.8);
  backdrop-filter: blur(2px);
}
#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--cream);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

/* ===== 一覧メニュー ===== */
#menu {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 40;
  width: min(88vw, 360px);
  max-height: calc(100vh - 110px - env(safe-area-inset-top));
  max-height: calc(100dvh - 110px - env(safe-area-inset-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
#menu h3 {
  font-size: 0.8rem;
  color: var(--acc);
  letter-spacing: 0.1em;
  margin: 10px 4px 6px;
}
#menu ul { list-style: none; }
#menu li + li { margin-top: 4px; }
#menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--brown);
  cursor: pointer;
}
#menu button:hover { background: var(--cream2); }
#menu img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--line);
  flex: none;
}

/* ===== モーダル ===== */
#modal-root { position: fixed; inset: 0; z-index: 50; }
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(60, 40, 20, 0.45);
}
.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 640px);
  max-height: min(86vh, 780px);
  max-height: min(86dvh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream);
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 16px 48px rgba(60, 40, 20, 0.35);
  padding: 28px;
  animation: rise 0.28s ease-out;
}
@keyframes rise {
  from { transform: translate(-50%, -46%) scale(0.96); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.close-btn {
  position: sticky;
  top: 0;
  float: right;
  background: var(--cream2);
  border: 2px solid var(--line);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1rem;
  color: var(--brown);
  cursor: pointer;
  font-family: var(--font);
}
.close-btn:hover { background: var(--line); }
.modal-eyebrow {
  color: var(--acc);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}
.modal-card h2 {
  font-size: 1.3rem;
  line-height: 1.5;
  margin-bottom: 14px;
}
.modal-img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 2px solid var(--line);
  margin-bottom: 14px;
}
.modal-lines {
  list-style: none;
  margin-bottom: 12px;
}
.modal-lines li {
  padding: 6px 0 6px 26px;
  position: relative;
  font-size: 0.92rem;
  line-height: 1.7;
}
.modal-lines li::before {
  content: "🌱";
  position: absolute;
  left: 0;
}
.modal-body {
  font-size: 0.9rem;
  line-height: 2;
  margin-bottom: 12px;
}
.btn {
  display: inline-block;
  background: var(--acc);
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: bold;
  cursor: pointer;
  margin: 4px 6px 4px 0;
  transition: transform 0.15s;
}
.btn:hover { transform: scale(1.05); }
.btn.primary { font-size: 1.05rem; padding: 14px 28px; }
.modal-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  border-top: 2px dashed var(--line);
  padding-top: 14px;
}
.nav-btn {
  background: var(--cream2);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--brown);
  cursor: pointer;
}
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.nav-btn:not(:disabled):hover { background: var(--line); }

/* ABOUT */
.about-grid { display: grid; gap: 12px; margin-top: 8px; }
.about-card {
  background: var(--cream2);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.about-icon { font-size: 1.6rem; }
.about-card h3 { font-size: 0.95rem; margin: 6px 0; }
.about-card p { font-size: 0.85rem; line-height: 1.9; }

/* NEWS */
.news-list { list-style: none; }
.news-list li {
  display: flex;
  gap: 14px;
  padding: 10px 4px;
  border-bottom: 2px dashed var(--line);
  font-size: 0.88rem;
  line-height: 1.7;
}
.news-date { color: var(--acc); font-weight: bold; flex: none; }

/* INFO */
.info-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.info-table th {
  text-align: left;
  color: var(--acc);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  padding: 10px 12px 10px 0;
  vertical-align: top;
  white-space: nowrap;
}
.info-table td {
  font-size: 0.88rem;
  line-height: 1.8;
  padding: 10px 0;
  border-bottom: 2px dashed var(--line);
}
.link-row { display: flex; flex-wrap: wrap; }

/* PLAY */
.play-h { font-size: 0.95rem; margin: 14px 0 4px; }

/* ===== イントロ ===== */
#intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(126, 205, 245, 0.25);
}
.intro-card {
  max-height: 100%;
  overflow-y: auto;
  background: var(--cream);
  border: 3px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 16px 48px rgba(60, 40, 20, 0.3);
  padding: 36px 32px;
  max-width: 560px;
  text-align: center;
  animation: rise2 0.4s ease-out;
}
@keyframes rise2 {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.intro-eyebrow {
  color: var(--acc);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.2em;
  margin-bottom: 10px;
}
.intro-card h1 { font-size: 1.5rem; margin-bottom: 14px; }
.intro-lead { font-size: 0.92rem; line-height: 2; margin-bottom: 18px; }
.intro-warn {
  font-size: 0.85rem;
  line-height: 1.8;
  background: #fff1e8;
  border: 2px solid #f5c6a5;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.intro-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.intro-hint { margin-top: 16px; font-size: 0.78rem; color: var(--brown-light); }
.sp-only { display: none; }
@media (pointer: coarse) {
  .pc-only { display: none; }
  .sp-only { display: inline; }
}

/* ===== ローディング ===== */
#loader {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 0.95rem;
  font-weight: bold;
  transition: opacity 0.4s;
}
#loader.done { opacity: 0; pointer-events: none; }
.spin {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 6px solid var(--line);
  border-top-color: var(--acc);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== その他 ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* この中のリンクはタブ順に残るため、フォーカスされたら見える位置へ出す。
   出さないと「見えないのにフォーカスが飛ぶ」状態になる。 */
.visually-hidden:focus-within {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
  width: auto;
  height: auto;
  max-width: min(92vw, 560px);
  max-height: 70vh;
  overflow: auto;
  clip: auto;
  white-space: normal;
  z-index: 90;
  background: var(--cream);
  border: 2px solid var(--acc);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.noscript-box {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--cream);
  padding: 40px 24px;
  font-size: 1rem;
  line-height: 2;
}
.no3d #intro-walk { display: none; }

@media (max-width: 560px) {
  #brand { font-size: 0.82rem; padding: 7px 14px; }
  #menu-btn { padding: 10px 16px; font-size: 0.88rem; }
  .modal-card { padding: 20px 16px; }
  /* .intro-card / .intro-card h1 はここに書いても、後段の
     「@media (max-width: 560px), (max-height: 780px)」で必ず上書きされて
     一度も効かなかったため削除した。イントロの縮小指定はそちらに集約している。 */
}

@media (prefers-reduced-motion: reduce) {
  #prompt, .modal-card, .intro-card { animation: none; }
  .btn, #menu-btn { transition: none; }
  /* 回り続けるスピナーも止める（動きを減らす設定の趣旨に反するため） */
  .spin { animation: none; border-top-color: var(--line); }
}

/* タッチ端末ではプロンプトを親指の操作域より上へ（ジョイスティックと重ねない） */
@media (pointer: coarse) {
  #prompt {
    bottom: calc(104px + env(safe-area-inset-bottom));
  }
}

/* 一覧メニューの © 表記 */
.menu-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px dashed var(--line);
  font-size: 0.68rem;
  color: var(--brown-light);
  text-align: center;
  letter-spacing: 0.06em;
}

/* イントロのキャッチコピー */
.intro-tag {
  color: var(--acc);
  font-weight: bold;
  font-size: 1.02rem;
  letter-spacing: 0.14em;
  margin-bottom: 12px;
}

/* ===== イントロの「お仕事のご依頼」要約（発注者が10秒で読む） ===== */
.intro-hire {
  text-align: left;
  background: var(--cream2);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 4px 0 16px;
}
.intro-hire-h {
  font-size: 0.9rem;
  font-weight: bold;
  line-height: 1.8;
  margin-bottom: 8px;
}
.intro-hire-list { list-style: none; }
.intro-hire-list li {
  position: relative;
  padding: 3px 0 3px 20px;
  font-size: 0.84rem;
  line-height: 1.8;
}
.intro-hire-list li::before {
  content: "▸";
  position: absolute;
  left: 2px;
  color: var(--acc);
  font-weight: bold;
}
.btn.ghost {
  background: var(--cream2);
  color: var(--brown);
  border: 2px solid var(--line);
}

/* 対応範囲外などの注記 */
.modal-note {
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--brown-light);
  background: var(--cream2);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
}

/* 発注導線ではない参考リンク（格下げ表示） */
.ref-links { list-style: none; margin-top: 4px; }
.ref-links li { padding: 4px 0; font-size: 0.82rem; }
.ref-links a { color: var(--brown-light); }

/* ===== 狭い画面: 依頼ブロックとボタンを1画面に収める ===== */
@media (max-width: 560px), (max-height: 780px) {
  .pc-only { display: none; }
  .sp-only { display: inline; }
  .intro-card { padding: 20px 18px; }
  .intro-card h1 { font-size: 1.15rem; margin-bottom: 8px; }
  .intro-tag { font-size: 0.92rem; margin-bottom: 8px; }
  .intro-lead { font-size: 0.86rem; line-height: 1.8; margin-bottom: 12px; }
  .intro-hire { padding: 11px 13px; margin: 2px 0 12px; }
  .intro-hire-h { font-size: 0.85rem; margin-bottom: 6px; }
  .intro-hire-list li { font-size: 0.79rem; padding: 2px 0 2px 18px; }
  .intro-btns { gap: 8px; }
  .btn.primary { font-size: 0.98rem; padding: 13px 22px; }
  .intro-hint { margin-top: 10px; font-size: 0.72rem; }
}
