/* =========================================================
   nclToyTools ─ モンスターのこえ
   昼のくさむらテーマ（むしのこえ mushi.css の夜テーマを昼の草原に置きかえ）
   モンスターあつめ風の、くさむらを歩くモンスターたち。
   ========================================================= */

:root {
  --day-bg: linear-gradient(180deg, #bff0ff 0%, #d9f7c2 40%, #9bd671 70%, #4f9a3f 100%);
  --panel-bg: rgba(255, 255, 255, 0.72);
  --panel-border: rgba(255, 255, 255, 0.92);
  --text-main: #234b2a;
  --text-sub: #4b6b46;
  --accent: #ffc94a;              /* 太陽の色 */
  --accent-2: #1f7b46;
  --shadow-soft: 0 12px 30px rgba(40, 90, 40, 0.18);
  --shadow-tile: 0 7px 16px rgba(30, 70, 30, 0.22);
  --radius-card: 24px;
  --radius-btn: 999px;
  --font-main: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  overflow: hidden;            /* スクロール禁止（アプリ風に画面ぴったり） */
  overscroll-behavior: none;   /* 端のバウンス防止 */
}

body {
  margin: 0;
  position: fixed;             /* iOS でのスクロール／バウンスを確実に止める */
  inset: 0;
  font-family: var(--font-main);
  color: var(--text-main);
  background: var(--day-bg);
  background-attachment: fixed;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, p { margin: 0; }
button { font-family: inherit; }

/* hidden 属性を確実に効かせる（.meadow-card 等が display:flex を持つと
   作者CSSがUAの [hidden]{display:none} に勝ってしまい、ビューが隠れないため）。 */
[hidden] { display: none !important; }

/* =========================================================
   昼の飾り（背景装飾・操作不可）
   ========================================================= */
.day-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.day-decor .sun {
  position: absolute;
  top: 4vh;
  right: 7vw;
  font-size: clamp(44px, 10vw, 88px);
  filter: drop-shadow(0 0 22px rgba(255, 210, 90, 0.6));
  animation: floaty 9s ease-in-out infinite;
}
.day-decor .cloud {
  position: absolute;
  font-size: clamp(34px, 7vw, 60px);
  opacity: 0.85;
  animation: drift 26s linear infinite;
}
.day-decor .c1 { top: 10vh; left: -12%; animation-delay: 0s; }
.day-decor .c2 { top: 20vh; left: -20%; animation-delay: -9s; font-size: clamp(40px, 9vw, 74px); }
.day-decor .c3 { top: 6vh;  left: -30%; animation-delay: -17s; }
.day-decor .grass {
  position: absolute;
  bottom: -6px;
  font-size: clamp(40px, 9vw, 78px);
  opacity: 0.8;
  transform-origin: bottom center;
  animation: sway 6s ease-in-out infinite;
}
.day-decor .g1 { left: 2vw;  animation-delay: 0s; }
.day-decor .g2 { left: 50vw; animation-delay: 1.1s; font-size: clamp(48px, 11vw, 96px); }
.day-decor .g3 { right: 3vw; animation-delay: 2s; }

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(160vw); } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }

/* =========================================================
   レイアウト
   ========================================================= */
#app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.glass-card {
  background: var(--panel-bg);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---- コンパクトなトップバー＋ハンバーガーメニュー ---- */
.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px 9px 16px;
}
.topbar .title {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  line-height: 0;            /* 画像まわりの余白を消す */
}
/* タイトルロゴ（差し替え画像・透過WebP）。ヘッダー高さに合わせて縮尺。 */
.title-logo {
  height: clamp(50px, 15vw, 72px);
  width: auto;
  display: block;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  filter: drop-shadow(0 1px 2px rgba(20, 50, 20, 0.18));
}
.menu-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--panel-border);
  background: #fff;
  color: var(--text-main);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
}
.menu-btn:hover { background: #f3fff0; }
.menu-btn:active { transform: scale(0.94); }

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  z-index: 30;
  width: min(262px, 82vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #ffffff;
  border: 1.5px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.menu[hidden] { display: none; }
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  background: #f1faec;
  border: 1.5px solid #dceccf;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.menu-item:hover { background: #e7f6dd; }
.menu-item:active { transform: scale(0.98); }
/* BGM音量スライダー（メニュー内の1行） */
.menu-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: #f1faec;
  border: 1.5px solid #dceccf;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}
.menu-slider > span { white-space: nowrap; flex: 0 0 auto; }
.menu-slider input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 24px;
  accent-color: #4fa24a;
  cursor: pointer;
}
.menu-views {
  display: flex;
  gap: 4px;
  background: #eaf5e2;
  border-radius: 999px;
  padding: 4px;
}
.menu-views .view-btn { flex: 1 1 0; min-width: 0; }

/* ---- 表示きりかえ（くさむら / いちらん）---- */
.view-btn {
  border: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 12.5px;
  color: var(--text-sub);
  background: transparent;
  border-radius: var(--radius-btn);
  padding: 8px 4px;
  text-align: center;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease, transform 0.1s ease;
}
.view-btn[aria-pressed="true"] {
  color: #3a2a1e;
  background: linear-gradient(145deg, #ffe27a, #ffbe3d);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.view-btn:active { transform: scale(0.96); }

/* =========================================================
   くさむらビュー
   ========================================================= */
.meadow-card {
  padding: 8px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.meadow {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #bff0ff 0%, #dff7c6 40%, #a9dd7e 66%, #5aa544 100%);
  box-shadow: inset 0 2px 10px rgba(30, 80, 30, 0.18);
  touch-action: manipulation;
}

/* 草のシルエット（bottom-anchored・fillはCSSで継承させる） */
.grass-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  display: block;
  pointer-events: none;
}
.grass-far { height: 30%; fill: #bfe08a; opacity: 0.55; }
.grass-mid { height: 30%; fill: #6fb84f; opacity: 0.85; z-index: 2; }
.grass-near { height: 40%; fill: #3f8f43; opacity: 0.95; z-index: 4; }

/* 昼のお日さま（くさむらの右上・飾り） */
.meadow-sun {
  position: absolute;
  top: 7%;
  right: 9%;
  width: clamp(44px, 12vw, 64px);
  height: clamp(44px, 12vw, 64px);
  border-radius: 50%;
  z-index: 1;
  background: radial-gradient(circle at 40% 38%, #fff6c8, #ffdf7a 52%, #ffc242 100%);
  box-shadow: 0 0 30px 10px rgba(255, 214, 110, 0.5), 0 0 66px 20px rgba(255, 214, 110, 0.22);
  pointer-events: none;
}

.critter-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* 1体のモンスター（歩き回る・タップできる） */
.critter {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(66px, 19vw, 104px);   /* M（ふつう）。S/L は下で上書き */
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
  pointer-events: auto;
}
/* 個体差サイズ（S/M/L）。M は上の既定値。ちょっとずつ大きさに差をつける。 */
.critter.size-s { width: clamp(54px, 15.5vw, 86px); }
.critter.size-l { width: clamp(82px, 23.5vw, 128px); }
.critter-face {
  display: block;
  width: 100%;
  transform-origin: 50% 70%;
}
.critter-face .mon-img,
.critter-face .mon-fallback {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 3px 4px rgba(20, 50, 20, 0.4));
}
.critter-face .mon-fallback {
  font-size: clamp(48px, 14vw, 80px);
  text-align: center;
  line-height: 1;
}
/* 足もとに落ちるやわらかい影 */
.critter-shadow {
  position: absolute;
  left: 50%;
  bottom: -6%;
  width: 68%;
  height: 12%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(20, 50, 20, 0.28), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
/* 飛ぶ鳥・漂う幻は 地面の影を出さない（浮いているので） */
.critter.kind-fly .critter-shadow,
.critter.kind-phantom .critter-shadow { display: none; }
/* 幻は JS で opacity をなめらかに動かす（出現・逃走のフェード） */
.critter.kind-phantom { will-change: transform, opacity; }

.critter:hover .critter-face { filter: brightness(1.03); }
.critter:focus-visible { outline: none; }
.critter:focus-visible .critter-face {
  filter: drop-shadow(0 0 0 rgba(0,0,0,0)) drop-shadow(0 0 6px rgba(255, 200, 60, 0.95));
}

/* 鳴き声の吹き出し（モンスターの上に出る） */
.critter-bubble {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, 6px) scale(0.7);
  background: rgba(255, 255, 255, 0.97);
  color: var(--text-main);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  text-align: center;
  padding: 5px 11px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(30, 70, 30, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.critter-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.97);
  border-bottom: 0;
}
.critter-bubble.show {
  opacity: 1;
  transform: translate(-50%, -4px) scale(1);
}

/* 鳴いているとき: ぴょこっと弾む */
.critter.singing .critter-face { animation: hop 0.42s ease-in-out infinite; }
@keyframes hop {
  0%, 100% { transform: translateY(0) scaleY(1); }
  40% { transform: translateY(-5px) scaleY(1.04); }
  70% { transform: translateY(0) scaleY(0.98); }
}

@media (prefers-reduced-motion: reduce) {
  .day-decor .sun, .day-decor .cloud, .day-decor .grass,
  .critter.singing .critter-face { animation: none; }
  .view-btn, .critter { transition: none; }
}

/* =========================================================
   いちらん（アイコングリッド）
   ========================================================= */
.grid-card {
  padding: 14px 16px 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 2px 8px;
  font-size: 15px;
  font-weight: 800;
}
.cat-head:first-child { margin-top: 2px; }
.cat-head::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: rgba(60, 110, 50, 0.22); }
.cat-chip { background: #fff; border: 1px solid #d7e8ca; border-radius: 999px; padding: 2px 10px; font-size: 12px; }

.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: clamp(12px, 3vw, 20px) clamp(10px, 2.6vw, 16px);
  justify-items: center;
}
.mon-tile {
  appearance: none;
  border: none;
  background: none;
  padding: 2px;
  width: 100%;
  max-width: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}
.tile-icon {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  background: linear-gradient(150deg, var(--c1), var(--c2));
  box-shadow: var(--shadow-tile), inset 0 2px 4px rgba(255, 255, 255, 0.5), inset 0 -6px 12px rgba(0, 0, 0, 0.12);
  overflow: visible;
  display: grid;
  place-items: center;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tile-icon .mon-img,
.tile-icon .mon-fallback {
  display: block;
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}
.tile-icon .mon-fallback { font-size: 40px; display: grid; place-items: center; }
.mon-tile:hover .tile-icon { transform: translateY(-4px) scale(1.03); }
.mon-tile:active .tile-icon { transform: translateY(-1px) scale(0.95); }
.mon-tile:focus-visible { outline: none; }
.mon-tile:focus-visible .tile-icon { box-shadow: var(--shadow-tile), 0 0 0 4px rgba(255, 200, 60, 0.9); }

.tile-icon.wiggle { animation: wiggle 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes wiggle {
  0% { transform: scale(0.95); }
  30% { transform: scale(1.08) rotate(-4deg); }
  55% { transform: scale(1.02) rotate(4deg); }
  75% { transform: scale(1.05) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); }
}

.tile-bubble {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translate(-50%, -6px) scale(0.7);
  background: rgba(255, 255, 255, 0.97);
  color: var(--text-main);
  font-weight: 800;
  font-size: clamp(11px, 2.6vw, 14px);
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(30, 70, 30, 0.26);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tile-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.97);
  border-bottom: 0;
}
.tile-bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.tile-name { font-weight: 800; font-size: clamp(12.5px, 3.1vw, 15px); }
.tile-type { font-size: 11px; color: var(--text-sub); margin-top: -2px; }

/* =========================================================
   ずかん（図鑑）ビュー
   ========================================================= */
.zukan-card {
  padding: 14px 16px 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.zukan-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  touch-action: pan-y; /* 横スワイプは JS のページめくりへ・縦は通常スクロール */
}
.z-art {
  position: relative;
  width: min(52%, 190px);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  background: linear-gradient(150deg, var(--c1), var(--c2));
  box-shadow: var(--shadow-tile), inset 0 2px 4px rgba(255, 255, 255, 0.5), inset 0 -6px 12px rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
  margin-top: 2px;
}
/* 図鑑番号（No.）は キャラ画像の右上に のせる */
.z-no {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 2px 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  font-variant-numeric: tabular-nums;
}
/* 鳴き声のオノマトペ（小さめの見出し） */
.z-voice { font-size: 13px; font-weight: 800; color: var(--accent-2); margin-top: -2px; }
.z-art .mon-img,
.z-art .mon-fallback {
  width: 84%;
  height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}
.z-art .mon-fallback { font-size: clamp(56px, 20vw, 110px); display: grid; place-items: center; }
.z-art.wiggle { animation: wiggle 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.z-name { font-size: clamp(20px, 5.4vw, 26px); font-weight: 800; }
.z-badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 2px; }
.z-type, .z-cat { font-size: 12.5px; font-weight: 800; border-radius: 999px; padding: 4px 12px; }
.z-type { background: #eef7e6; border: 1px solid #d7e8ca; }
.z-cat { background: #fff; border: 1px solid #e8ddc2; }
.z-cry {
  font-family: inherit;
  font-weight: 800;
  font-size: 13.5px;
  color: #3a2a1e;
  background: linear-gradient(145deg, #ffe27a, #ffbe3d);
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(200, 150, 40, 0.5);
  transition: transform 0.1s ease, filter 0.1s ease;
}
.z-cry:hover { filter: brightness(1.04); }
.z-cry:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(200, 150, 40, 0.5); }
.z-flavor {
  max-width: 40em;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text-main);
  text-align: left;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  padding: 12px 15px;
  margin-top: 2px;
  -webkit-user-select: text;
  user-select: text;
}
.zukan-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 8px;
  flex: 0 0 auto;
}
.zukan-navbtn {
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  color: var(--text-main);
  background: #fff;
  border: 1px solid #d7e8ca;
  border-radius: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.12s ease;
}
.zukan-navbtn:hover { background: #f3fff0; }
.zukan-navbtn:active { transform: scale(0.96); }
.zukan-count { font-weight: 800; font-size: 13px; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.zukan-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 4px;
  flex: 0 0 auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  position: relative; /* サムネの offsetLeft を この帯の基準にする（中央寄せスクロール用） */
}
.zukan-thumb {
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  scroll-snap-align: center;
}
.thumb-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--c1), var(--c2));
  box-shadow: 0 2px 6px rgba(30, 70, 30, 0.2);
  opacity: 0.68;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.thumb-icon .mon-img,
.thumb-icon .mon-fallback { width: 80%; height: 80%; object-fit: contain; }
.thumb-icon .mon-fallback { font-size: 24px; display: grid; place-items: center; }
.zukan-thumb.on .thumb-icon { opacity: 1; outline: 3px solid #ffbe3d; outline-offset: 1px; transform: translateY(-2px); }
.zukan-thumb:focus-visible .thumb-icon { outline: 3px solid #2f8f4a; }
@media (prefers-reduced-motion: reduce) {
  .z-art.wiggle { animation: none; }
}

/* ---- 合唱ボタン ---- */
.chorus-row { display: flex; justify-content: center; flex: 0 0 auto; }
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-weight: 800;
  border-radius: var(--radius-btn);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-chorus {
  font-size: clamp(16px, 4vw, 19px);
  color: #3a2a1e;
  background: linear-gradient(145deg, #ffe27a, #ffbe3d);
  padding: 14px 26px;
  box-shadow: 0 6px 0 rgba(200, 150, 40, 0.5), var(--shadow-soft);
}
.btn-chorus:hover { transform: translateY(-2px); filter: brightness(1.04); }
.btn-chorus:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(200, 150, 40, 0.5); }

.small { font-size: 12px; color: var(--text-sub); line-height: 1.7; }

/* 読み込み失敗時の簡易メッセージ */
body.load-error #app::before {
  content: '😢 うまく よみこめなかったみたい。さいしんの Chrome / Safari で ためしてね。';
  display: block;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}

/* =========================================================
   クレジット・せつめい（フッターのリンクボタン＋モーダル）
   ========================================================= */
.credits-modal {
  width: min(440px, 92vw);
  max-height: 82vh;
  padding: 0;
  border: 1.5px solid var(--panel-border);
  border-radius: 18px;
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.credits-modal::backdrop {
  background: rgba(20, 50, 20, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.credits-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e4efd9;
}
.credits-head h2 { font-size: 17px; font-weight: 800; }
.credits-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #dceccf;
  background: #f1faec;
  color: var(--text-main);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.credits-close:hover { background: #e7f6dd; }
.credits-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  max-height: calc(82vh - 58px);
  font-size: 13px;
  line-height: 1.7;
  -webkit-user-select: text;
  user-select: text;
}
.credits-body h3 { font-size: 12px; color: var(--text-sub); margin: 14px 0 6px; font-weight: 800; }
.credits-body h3:first-child { margin-top: 0; }
.credits-body p { margin: 4px 0; }
.credits-note { color: var(--text-sub); }

@media (max-width: 560px) {
  .topbar .title { font-size: 15px; }
}

/* =========================================================
   おうちのひと モード（親モード）: ロック画面＋設定ダイアログ
   ========================================================= */
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(120% 80% at 50% 30%, rgba(60, 110, 80, 0.55), transparent 70%),
    linear-gradient(180deg, rgba(20, 50, 30, 0.82), rgba(20, 40, 60, 0.9));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lock-overlay[hidden] { display: none; }
.lock-card {
  width: min(340px, 90vw);
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  padding: 26px 22px 22px;
  text-align: center;
}
.lock-emoji { font-size: 54px; line-height: 1; }
.lock-title { font-size: 20px; font-weight: 800; margin-top: 8px; color: var(--text-main); }
.lock-msg { font-size: 13.5px; line-height: 1.8; color: var(--text-sub); margin-top: 8px; white-space: pre-line; }
.lock-parent {
  margin-top: 16px;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  color: var(--text-main);
  background: #f1faec;
  border: 1.5px solid #d7e8ca;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
}
.lock-parent:active { transform: scale(0.97); }

.parent-dialog {
  width: min(440px, 92vw);
  max-height: 88vh;
  padding: 0;
  border: none;
  border-radius: 18px;
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.parent-dialog::backdrop { background: rgba(20, 40, 30, 0.5); backdrop-filter: blur(2px); }
.pd-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid #e4efd9;
}
.pd-head h2 { font-size: 16px; font-weight: 800; }
.pd-x {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid #dceccf; background: #f1faec; color: var(--text-main);
  font-size: 14px; cursor: pointer;
}
.pd-body { padding: 14px 16px 18px; overflow-y: auto; max-height: calc(88vh - 56px); }
.pd-sec { padding: 10px 0; border-bottom: 1px dashed #e0ecd4; }
.pd-toggle { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14.5px; cursor: pointer; }
.pd-toggle input { width: 20px; height: 20px; accent-color: #4fa24a; }
.pd-sub { margin: 8px 0 2px; padding-left: 4px; }
.pd-sub.off { display: none; }
.pd-note { font-size: 12px; color: var(--text-sub); line-height: 1.7; margin-top: 6px; }
.pd-note.tiny { font-size: 11px; opacity: 0.85; }
.pd-err { font-size: 12.5px; color: #c0392b; font-weight: 800; margin-top: 6px; }
.pin-input {
  display: block; width: 160px; margin: 12px auto 4px; text-align: center;
  font-size: 30px; font-weight: 800; letter-spacing: 0.4em; font-family: inherit;
  padding: 8px 10px; border: 2px solid #cfe3c2; border-radius: 14px; color: var(--text-main);
}
.pin-input:focus { outline: 3px solid #9bd36a; outline-offset: 1px; }
.pd-row { display: flex; gap: 8px; margin-top: 14px; justify-content: center; }
.pd-row.wrap { flex-wrap: wrap; }
.pd-btn {
  font-family: inherit; font-weight: 800; font-size: 14px; color: var(--text-main);
  background: #fff; border: 1.5px solid #d7e8ca; border-radius: 12px; padding: 10px 16px; cursor: pointer;
}
.pd-btn.small { font-size: 13px; padding: 7px 12px; }
.pd-btn.primary { background: linear-gradient(145deg, #ffe27a, #ffbe3d); border-color: #e9a92f; color: #3a2a1e; }
.pd-btn:active { transform: scale(0.97); }
.pd-link { background: none; border: none; color: #1f7b46; font: inherit; font-size: 12px; font-weight: 800; text-decoration: underline; cursor: pointer; padding: 0; }
.pd-mins { display: flex; flex-wrap: wrap; gap: 6px; }
.min-btn {
  font-family: inherit; font-weight: 800; font-size: 13px; color: var(--text-sub);
  background: #f1faec; border: 1.5px solid #dceccf; border-radius: 999px; padding: 7px 14px; cursor: pointer;
}
.min-btn.on { color: #3a2a1e; background: linear-gradient(145deg, #ffe27a, #ffbe3d); border-color: #e9a92f; }
.pwin { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.pwin-s, .pwin-e { font-family: inherit; font-size: 14px; padding: 6px 8px; border: 1.5px solid #cfe3c2; border-radius: 10px; }
.pwin-tilde { color: var(--text-sub); font-weight: 800; }
.pwin-del { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid #eecccc; background: #fff5f5; color: #c0392b; font-size: 13px; cursor: pointer; }
