/* どうぶつの赤ちゃん地図 — Apple HIG の部品の作り（シート・ツールチップ・44pt の当たり）に、赤ちゃん向けの淡い配色を当てる。
   決まり：枠線は押せる物だけ／枠の中に枠を入れない／一辺だけの線・色の帯を付けない／青・紺を使わない／絵文字を使わない */
:root {
  --paper: #FFF6EA;
  --ink: #4A3426;
  --ink2: #7A5E4C;
  --mute: #B9A391;
  --l1: #C23A63;      /* 1年以内：いちごミルク */
  --l1-soft: #F7C3CF;
  --l2: #3C7A44;      /* 2年以内：わかば */
  --l2-soft: #CBE6C1;
  --hover: rgba(226, 178, 140, .2);
  --shadow: 0 8px 22px rgba(120, 78, 46, .16), 0 2px 6px rgba(120, 78, 46, .1);
  --peek: 176px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .9, .3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: clip; background: var(--paper); }
h1, h2, h3, h4, p, li, dt, dd, a, span, strong, small, button, label {
  line-break: strict; word-break: auto-phrase; overflow-wrap: normal;
}
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.nb, .age, .num, .unit, .ct { white-space: nowrap; }
svg.ic { display: block; flex: none; }
svg.ic .fl { fill: currentColor; stroke: none; }
svg.face { display: block; flex: none; overflow: visible; }

#app { display: grid; grid-template-columns: minmax(360px, 404px) 1fr; height: 100dvh; }

/* ── 左の欄（地の色のまま。枠にしない） ── */
#panel { position: relative; display: flex; flex-direction: column; min-height: 0; padding: 30px 0 0; }
#grip { display: none; }
#head { padding: 0 30px 0 34px; }
#title { margin: 0 0 22px; line-height: 1.05; letter-spacing: .02em; }
#title .t1 { display: block; font-size: clamp(15px, 1.25vw, 18px); font-weight: 700; color: var(--ink2); margin-bottom: 6px; white-space: nowrap; }
#title .t2 { display: block; font-size: clamp(30px, 2.55vw, 38px); font-weight: 900; white-space: nowrap; }

#layers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 0 -10px; }
.lay { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 6px; padding: 10px 8px; border-radius: 18px; text-align: left; transition: background .2s var(--ease), transform .25s var(--spring); }
.lay:hover, .lay:focus-visible { background: var(--hover); outline: none; }
.lay:active { transform: scale(.96); }
.lay .ico { color: var(--mute); transition: color .25s var(--ease), transform .4s var(--spring); }
.lay .lbl { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); white-space: nowrap; }
.lay .ct { display: block; color: var(--ink2); line-height: 1.1; transition: color .25s var(--ease); }
.lay .num { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.lay .unit { font-size: 11.5px; font-weight: 700; margin-left: 2px; }
.lay[aria-pressed="true"][data-l="1"] .ico, .lay[aria-pressed="true"][data-l="1"] .ct { color: var(--l1); }
.lay[aria-pressed="true"][data-l="2"] .ico, .lay[aria-pressed="true"][data-l="2"] .ct { color: var(--l2); }
.lay[aria-pressed="true"] .lbl { color: var(--ink); }
.lay[aria-pressed="true"][data-l="p"] .ico, .lay[aria-pressed="true"][data-l="p"] .ct { color: var(--ink); }
.lay[aria-pressed="false"] .ico .fl { fill: none; stroke: currentColor; stroke-width: 1.4; }
.lay[aria-pressed="true"] .ico { transform: rotate(-6deg); }

#scroll { flex: 1; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; padding: 4px 20px 24px 24px; scrollbar-width: thin; scrollbar-color: var(--mute) transparent; }

/* ── 一覧 ── */
.grp { margin-top: 26px; }
.grp h2 { margin: 0 0 6px 10px; font-size: 13px; font-weight: 800; letter-spacing: .06em; }
.grp[data-l="1"] h2 { color: var(--l1); }
.grp[data-l="2"] h2 { color: var(--l2); }
.row { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 10px 10px; border-radius: 20px; text-align: left; transition: background .2s var(--ease), transform .3s var(--spring); }
.row:hover, .row:focus-visible { background: var(--hover); outline: none; }
.row:active { transform: scale(.98); }
.row .face { width: 54px; height: 54px; transition: transform .4s var(--spring); }
.row:hover .face { transform: rotate(-8deg) scale(1.06); }
.row .tx { min-width: 0; }
.row .sp { display: block; font-size: 15.5px; font-weight: 800; line-height: 1.3; }
.row .sp .nm { font-weight: 700; color: var(--ink2); margin-left: 4px; font-size: 14px; }
.row .sp .n { font-size: 12px; font-weight: 700; color: var(--ink2); margin-left: 4px; }
.row .fac { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink2); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .rt { text-align: right; line-height: 1; }
.row .age { display: block; }
.age .num { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.age .unit { font-size: 11px; font-weight: 700; margin: 0 1px; }
.row[data-l="1"] .age { color: var(--l1); }
.row[data-l="2"] .age { color: var(--l2); }
.row .km { display: block; margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--ink2); }
.pinrow { grid-template-columns: 54px 1fr auto; padding-top: 6px; padding-bottom: 6px; }
.pinrow svg.pin { justify-self: center; }
.pinrow .sp { font-size: 14.5px; font-weight: 700; }
.nobaby { display: flex; align-items: center; gap: 16px; margin: 20px 0 0; }
.nobaby svg.pin { flex: none; }
.nobaby p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--ink2); }
.empty { margin: 40px 10px; color: var(--ink2); font-size: 14px; }

/* ── 施設の詳細 ── */
#detail { padding: 6px 10px 0; animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 10px -8px; padding: 10px 14px 10px 6px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink2); min-height: 44px; }
.back:hover, .back:focus-visible { background: var(--hover); outline: none; color: var(--ink); }
#detail h2 { margin: 0; font-size: 25px; font-weight: 900; line-height: 1.3; }
#detail .meta { margin: 6px 0 0; font-size: 13px; color: var(--ink2); }
.acts { display: flex; gap: 6px; margin: 14px 0 6px -12px; }
.act { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 10px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; }
.act:hover, .act:focus-visible { background: var(--hover); outline: none; }
.babies { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 30px; }
.baby { display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: start; animation: rise .5s var(--ease) both; }
.baby .face { width: 92px; height: 92px; }
.baby h3 { margin: 4px 0 0; font-size: 18px; font-weight: 800; line-height: 1.35; }
.baby .who { margin: 3px 0 0; font-size: 14px; font-weight: 700; color: var(--ink2); }
.baby .when { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 10px 0 0; }
.baby .when .age .num { font-size: 30px; }
.baby .when .age .unit { font-size: 13px; }
.baby[data-l="1"] .when .age { color: var(--l1); }
.baby[data-l="2"] .when .age { color: var(--l2); }
.baby .bd { font-size: 13px; color: var(--ink2); }
.baby .note { margin: 6px 0 0; font-size: 13px; color: var(--ink2); line-height: 1.6; }
.baby .src { display: inline-flex; align-items: center; gap: 5px; margin: 8px 0 0 -8px; padding: 8px; border-radius: 12px; font-size: 13px; font-weight: 700; color: var(--ink2); text-decoration: none; min-height: 40px; }
.baby .src .k { font-weight: 500; margin-right: 6px; }
.baby .src:hover, .baby .src:focus-visible { background: var(--hover); color: var(--ink); outline: none; }

#foot { margin: 36px 10px 0; font-size: 11.5px; line-height: 1.7; color: var(--ink2); }
#foot p { margin: 0 0 4px; }

/* ── 地図 ── */
#stage { position: relative; padding: 14px 14px 14px 0; min-width: 0; }
#map { position: absolute; inset: 14px 14px 14px 0; border-radius: 30px; overflow: hidden; }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: none; box-shadow: none; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib { background: none !important; font-size: 10.5px; color: var(--ink2); text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 2px var(--paper); }
.maplibregl-ctrl-attrib a { color: var(--ink2); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin-right: 20px; }
.maplibregl-ctrl-attrib-button { display: none; }

#ctrl { position: absolute; right: 30px; bottom: 30px; display: flex; flex-direction: column; gap: 10px; z-index: 3; }
.fab { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--ink); box-shadow: var(--shadow); transition: transform .3s var(--spring), color .2s; }
.fab:hover, .fab:focus-visible { transform: scale(1.08); outline: none; }
.fab:active { transform: scale(.92); }
.fab[aria-pressed="true"] { color: var(--l1); }
.fab.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 地図の上の印（顔の絵と月齢の字。箱は敷かず、字のふちで読ませる） */
.mk { display: flex; flex-direction: column; align-items: center; cursor: pointer; transform-origin: 50% 100%; }
.mk .pop { display: flex; flex-direction: column; align-items: center; animation: pop .55s var(--spring) both; animation-delay: var(--d, 0ms); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.4); } }
.mk svg.face { width: 46px; height: 46px; filter: drop-shadow(0 4px 5px rgba(110, 70, 40, .28)); transition: transform .4s var(--spring); }
.mk:hover svg.face { transform: translateY(-4px) rotate(-6deg) scale(1.08); }
.mk .age, .mk .nm { margin-top: -2px; line-height: 1.1; text-shadow: 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 4px var(--paper), 0 0 6px var(--paper); }
.mk .age .num { font-size: 15px; }
.mk .age .unit { font-size: 10px; }
.mk[data-l="1"] .age { color: var(--l1); }
.mk[data-l="2"] .age { color: var(--l2); }
.mk .nm { display: none; font-size: 13px; font-weight: 800; color: var(--ink); white-space: nowrap; margin-top: 2px; }
.mk.sel { z-index: 2; }
.mk.sel svg.face { width: 64px; height: 64px; }
.mk.sel .nm { display: block; }
.mk .stack { position: relative; width: 70px; height: 50px; }
.mk .stack > svg { position: absolute; top: 2px; transition: transform .4s var(--spring); }
.mk .stack svg.face { width: 42px; height: 42px; }
.mk .stack svg.pin { top: 8px; }
.mk .stack > svg:nth-child(1) { left: 0; transform: rotate(-10deg); }
.mk .stack > svg:nth-child(2) { left: 26px; transform: rotate(9deg); }
.mk .stack > svg:nth-child(3) { left: 13px; top: -2px; z-index: 1; }
.mk.cl:hover .stack > svg:nth-child(1) { transform: rotate(-16deg) translateX(-3px); }
.mk.cl:hover .stack > svg:nth-child(2) { transform: rotate(15deg) translateX(3px); }
.mk.pincl .stack { width: 58px; height: 44px; }
.mk.pincl .stack > svg:nth-child(2) { left: 22px; }
.mk[data-l="p"] .age { color: var(--ink2); }
/* 赤ちゃんの発表が見つからない園館のピン（顔の印より小さく控えめに） */
.mk svg.pin { display: block; filter: drop-shadow(0 3px 3px rgba(110, 70, 40, .26)); transition: transform .4s var(--spring); }
.mk.pinmk:hover svg.pin { transform: translateY(-3px) rotate(-5deg); }
.mk.pinmk.sel svg.pin { width: 42px; height: 49px; }
.mk.me { pointer-events: none; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--l1); box-shadow: 0 0 0 5px rgba(194, 58, 99, .22); animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 10px rgba(194, 58, 99, .08); } }

/* ── ツールチップ（名前と、押すと何が起きるか） ── */
#tip { position: fixed; z-index: 50; max-width: 240px; padding: 9px 12px; border-radius: 14px; background: var(--ink); color: var(--paper); font-size: 12.5px; line-height: 1.55; pointer-events: none; box-shadow: var(--shadow); animation: tipin .18s var(--ease); }
@keyframes tipin { from { opacity: 0; transform: translateY(4px); } }
#tip b { display: block; font-size: 13px; }
#tip span { display: block; opacity: .9; }

/* ── スマホ：地図を全面に、一覧は下から引き上げるシート ── */
@media (max-width: 859px) {
  #app { display: block; }
  #stage { position: fixed; inset: 0; padding: 0; }
  #map { inset: 0; border-radius: 0; }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin-right: 0; }
  #panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: 88dvh; padding: 0;
    background: var(--paper); border-radius: 28px 28px 0 0;
    box-shadow: 0 -10px 30px rgba(110, 70, 40, .16);
    transform: translateY(calc(88dvh - var(--peek)));
    transition: transform .5s var(--ease);
    touch-action: none;
  }
  #panel[data-s="half"] { transform: translateY(calc(88dvh - 58dvh)); }
  #panel[data-s="full"] { transform: translateY(0); }
  #panel.drag { transition: none; }
  #grip { display: grid; place-items: center; width: 100%; height: 30px; color: var(--mute); }
  #grip svg { transition: transform .4s var(--spring); }
  #panel[data-s="full"] #grip svg { transform: rotate(180deg); }
  #head { padding: 0 18px 0 22px; }
  #title { margin: 0 0 8px; display: flex; align-items: baseline; gap: 4px; }
  #title .t1 { display: inline; font-size: 14px; margin: 0; }
  #title .t2 { display: inline; font-size: 22px; }
  #layers { margin: 0 -8px; }
  .lay { padding: 8px; }
  #scroll { padding: 0 10px 40px 14px; touch-action: pan-y; }
  #ctrl { right: 14px; bottom: calc(var(--peek) + 16px); transition: bottom .5s var(--ease); }
  body[data-s="half"] #ctrl { bottom: calc(58dvh + 16px); }
  body[data-s="full"] #ctrl { opacity: 0; pointer-events: none; }
  .fab { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
