[hidden] { display: none !important; }
/* 言語は src/lang.js が <html lang> に立てる。要らないほうの文言を伏せる */
html[lang="ja"] [lang="en"], html[lang="en"] [lang="ja"] { display: none !important; }
:root {
  --bg: #f5ecd8;
  --paper: #fffaf0;
  --paper2: #f8efdc;
  --ink: #4a3226;
  --sub: #8a6f5c;
  --line: #d9c7a8;
  --green: #5f8f3e;
  --green2: #e3efcf;
  --orange: #d9772f;
  --red: #c8503c;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; }
body { background:
  radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.5), transparent 40%),
  radial-gradient(circle at 90% 30%, rgba(160, 200, 120, 0.12), transparent 40%),
  var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }

#site-header { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto; padding: 8px 16px; }
#site-header .apps-link { color: var(--sub); text-decoration: none; font-size: 14px; display: inline-flex; align-items: center; min-height: 40px; white-space: nowrap; }
#site-header .name { font-weight: 900; font-size: 21px; margin: 0; min-width: 0; letter-spacing: 0.04em; }
#site-header .name a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; vertical-align: middle; }
.header-sub { margin-left: 8px; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--sub); }
.langsw { margin-left: auto; display: inline-flex; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; background: var(--paper); }
.langsw button { font-size: 12px; padding: 0 12px; min-height: 40px; min-width: 44px; border: 0; background: none; color: var(--sub); }
.langsw button[aria-pressed="true"] { background: var(--green2); color: var(--ink); font-weight: 900; }
@media (max-width: 560px) { .header-sub { display: none; } }

#app { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ── 庭 ── */
#stage { position: relative; width: min(100%, calc(76svh * 1000 / 820)); aspect-ratio: 1000 / 820; margin: 0 auto; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; background: #b6d77a; box-shadow: 0 8px 0 rgba(74, 50, 38, 0.18); user-select: none; -webkit-user-select: none; }
#scroller { position: absolute; inset: 0; overflow: hidden; }
#yard { display: block; height: 100%; width: auto; aspect-ratio: 1000 / 820; }
.pan { position: absolute; top: 56%; transform: translateY(-50%); width: 40px; height: 64px; border: 2px solid var(--ink); background: rgba(255, 250, 238, 0.85); font-size: 28px; font-weight: 900; line-height: 1; padding: 0 0 4px; z-index: 2; }
#pan-l { left: 0; border-left: 0; border-radius: 0 14px 14px 0; }
#pan-r { right: 0; border-right: 0; border-radius: 14px 0 0 14px; }
/* スマホでは庭を大きく見せ、横にずらして見る（縦に収めると動物が指より小さくなる） */
@media (max-width: 700px) {
  #stage { aspect-ratio: auto; width: 100%; height: min(66svh, 560px); }
  #scroller { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
  #scroller::-webkit-scrollbar { display: none; }
  .tools button { padding: 0 12px; font-size: 13px; }
  /* 数字・包み・時間を 1 行目、ボタンを 2 行目に（左に縦 4 段積むと庭の左上が隠れた） */
  #hud { flex-direction: column; align-items: stretch; gap: 6px; }
  .money { flex-wrap: nowrap; }
  .tools { justify-content: flex-end; }
  .chip { padding: 0 10px 0 6px; font-size: 15px; }
  .gift-label { display: none; }
  /* 来ている子の数も 1 行目に収める（«匹» を省いて詰める。収まらないと帯が 3 行になって庭を隠した） */
  #hud .chip.phase { padding: 0 8px; }
  #hud .unit { display: none; }
  /* 英語の時間帯の名前（Evening など）は長く、1 行目が折り返したので伏せる */
  html[lang="en"] #v-phase .pname { display: none; }
  #v-here { margin-right: auto; }
}
.vis, .marker, #bowl { cursor: pointer; }
.vis:focus, .marker:focus, #bowl:focus { outline: none; }
.hop.go { animation: hop 0.5s ease-out; }
@keyframes hop { 30% { transform: translateY(-16px); } 60% { transform: translateY(0); } 75% { transform: translateY(-5px); } }
.munch { animation: munch 0.5s ease-in-out infinite alternate; }
@keyframes munch { to { transform: translateY(-6px); } }
.bob { animation: bob 0.28s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-9px); } }
.marker ellipse { fill: rgba(255, 252, 235, 0.35); stroke: #fffbe8; stroke-width: 4; stroke-dasharray: 12 9; animation: march 1.2s linear infinite; }
.marker.taken ellipse { fill: rgba(255, 210, 120, 0.25); stroke: #ffd27a; }
.marker text { font: 900 34px var(--font); fill: #fffbe8; stroke: var(--ink); stroke-width: 6px; paint-order: stroke; text-anchor: middle; pointer-events: none; }
.marker.sel ellipse { stroke: #ff9a3c; fill: rgba(255, 160, 60, 0.3); }
@keyframes march { to { stroke-dashoffset: -21; } }
.badge circle { fill: var(--red); stroke: var(--ink); stroke-width: 3; }
.badge text { font: 900 22px var(--font); fill: #fff; text-anchor: middle; }
.badge.big circle { stroke: #fff; stroke-width: 3.5; paint-order: stroke; filter: drop-shadow(0 0 4px rgba(255, 210, 90, 0.9)); }
.badge.big text { font-size: 26px; }
.heart { font: 900 30px var(--font); fill: #f07a8a; stroke: #fff; stroke-width: 3px; paint-order: stroke; pointer-events: none; animation: rise 1s ease-out forwards; }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }

#hud { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.money { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px 0 8px; border-radius: 999px; background: rgba(255, 250, 238, 0.94); border: 2px solid var(--ink); font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; }
.chip.gift { height: 40px; font: inherit; font-weight: 900; font-size: 17px; color: inherit; cursor: pointer; }
.chip.gift { position: relative; }
.gift-label { font-size: 13px; }
/* 受け取れるときは赤い «!» が跳ね、ボタンがふわっと光る（数字だけでは押せると気づかれなかった） */
.chip.gift .bang { display: none; position: absolute; top: -4px; right: -9px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; border: 2px solid var(--ink); font-size: 14px; font-weight: 900; line-height: 18px; text-align: center; animation: bang 0.9s ease-in-out infinite; }
.chip.gift.has { background: #fff1b8; animation: glow 1.6s ease-in-out infinite; }
.chip.gift.has .bang { display: block; }
@keyframes bang { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-3px) rotate(-8deg); } 60% { transform: translateY(0) rotate(6deg); } }
.chip.gift.glow { animation: glow 1.2s ease-in-out infinite; }
.chip.phase { font-size: 13px; padding: 0 12px; white-space: nowrap; }
#L-tint { transition: fill 3s ease-in-out, opacity 3s ease-in-out; }
.chip.bump { animation: bump 0.35s; }
@keyframes bump { 40% { transform: scale(1.18); } }
.ic { display: inline-flex; width: 20px; height: 24px; }
.ic svg { width: 100%; height: 100%; }
.tools { display: flex; gap: 6px; }
.tools button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--ink); background: rgba(255, 250, 238, 0.94); font-weight: 700; font-size: 14px; white-space: nowrap; }
.tools button.round { width: 40px; padding: 0; font-size: 17px; }
.tools button.off { opacity: 0.5; text-decoration: line-through; }
.tools button.on { background: #ffd98a; }
#coach { position: absolute; left: 50%; top: calc(var(--hud-h, 40px) + 14px); transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 8px 16px; border-radius: 14px; background: #fff3c4; border: 2px solid var(--ink); font-size: 14px; font-weight: 700; text-align: center; pointer-events: none; box-shadow: 0 3px 0 rgba(74, 50, 38, 0.2); animation: coach 1.6s ease-in-out infinite; }
@keyframes coach { 50% { transform: translateX(-50%) translateY(-3px); } }
.tools button.glow { background: #ffd98a; animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255, 207, 58, 0.55); } }
#edit-hint { position: absolute; left: 50%; top: calc(var(--hud-h, 40px) + 14px); transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(74, 50, 38, 0.86); color: #fff8e6; font-size: 14px; font-weight: 700; white-space: nowrap; pointer-events: none; }

#toasts { position: absolute; left: 50%; top: calc(var(--hud-h, 40px) + 16px + var(--coach-h, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: max-content; max-width: calc(100% - 96px); }
.toast { padding: 8px 16px; border-radius: 14px; background: rgba(255, 250, 238, 0.97); border: 2px solid var(--ink); font-weight: 700; font-size: 15px; box-shadow: 0 3px 0 rgba(74, 50, 38, 0.2); animation: toast 3.4s ease forwards; text-align: center; }
.toast.big { background: #fff3c4; font-size: 17px; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
#flash { position: absolute; inset: 0; background: #fff; animation: flash 0.5s ease-out forwards; pointer-events: none; }
@keyframes flash { from { opacity: 0.95; } to { opacity: 0; } }
.fly { position: absolute; width: 22px; height: 26px; pointer-events: none; z-index: 5; }

/* ── 画面の中の板 ── */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(60, 40, 25, 0.35); z-index: 10; }
.sheet { position: relative; width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 16px 18px 18px; box-shadow: 0 6px 0 rgba(74, 50, 38, 0.25); }
.sheet h2 { margin: 0 44px 10px 0; font-size: 19px; font-weight: 900; }
.close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper2); font-size: 20px; line-height: 1; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
/* 長い一覧の上に置くボタン（下だと毎回いちばん下まで送らないと押せなかった） */
.acts.top { justify-content: flex-start; margin: 0 0 12px; }
.ach-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.ach-head .progress { margin: 0; }
.btn { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper2); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn.primary { background: #ffd98a; }
.btn.green { background: #cfe6ad; }
.btn .ic { width: 16px; height: 20px; }
.note { color: var(--sub); font-size: 13px; margin: 6px 0 0; }

.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.pick button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 13px; font-weight: 700; min-height: 44px; }
.pick button:hover:not(:disabled) { border-color: var(--ink); }
.pick button.cur { border-color: var(--orange); background: #fff3dd; }
.pick button small { font-weight: 500; color: var(--sub); font-size: 11.5px; }
.pick button > svg { width: 84px; height: 64px; }

.card { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: center; }
.card .pic { background: radial-gradient(circle at 50% 70%, #e9f3d6, #fdf7e8 70%); border: 2px solid var(--line); border-radius: 16px; }
.card .pic > svg { display: block; width: 100%; height: auto; }
.card p { margin: 4px 0; }
.card .sp { color: var(--sub); font-size: 13px; }
.stars { color: #e0a020; letter-spacing: 1px; }
@media (max-width: 420px) { .card { grid-template-columns: 96px 1fr; gap: 10px; } }

.gifts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gifts li { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.gifts li > svg { width: 48px; height: 48px; display: block; }
.gifts .amt { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; }
.gifts .amt .ic { width: 15px; height: 18px; }
.gifts .tr { color: var(--orange); font-size: 13px; font-weight: 700; }
.tag { display: inline-block; margin: 2px 4px 0 0; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.new { background: #ffe0a8; color: #8a4a12; }
.tag.sp { background: #e8defa; color: #5a3a8a; }
.gifts .where { font-size: 12.5px; color: var(--sub); white-space: nowrap; }
.gifts .where.here { color: var(--green); font-weight: 700; }

/* ── 下の帳面 ── */
#book { max-width: 1100px; margin: 14px auto 0; }
/* 帯はスクロールさせない。overflow-x: auto にしていたら、選んだタブを 3px 下げた分が縦にはみ出し、帯の上でホイールを回すとタブだけ動いた */
.tabs { display: flex; gap: 4px; padding: 0 8px; }
.tabs button { min-height: 44px; padding: 0 clamp(10px, 2.6vw, 18px); border: 3px solid var(--ink); border-bottom: 0; border-radius: 14px 14px 0 0; background: var(--paper2); font-weight: 700; font-size: 15px; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--paper); position: relative; top: 3px; }
@media (max-width: 420px) { .tabs { gap: 3px; padding: 0 2px; } .tabs button { padding: 0 8px; font-size: 14px; } }
#panel { background: var(--paper); border: 3px solid var(--ink); border-radius: 0 18px 18px 18px; padding: 16px; min-height: 280px; }
#panel h3 { margin: 14px 0 8px; font-size: 16px; font-weight: 900; }
#panel h3:first-child { margin-top: 0; }

.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 420px) { .shop { grid-template-columns: 1fr 1fr; gap: 8px; } .item { padding: 8px 6px; } .item .btn { padding: 0 8px; white-space: nowrap; } .item > svg { width: 100px; height: 70px; } }
.item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px; background: #fff; border: 2px solid var(--line); border-radius: 16px; }
.item > svg { width: 120px; height: 84px; }
.item .nm { font-weight: 900; }
.item .ds { color: var(--sub); font-size: 12.5px; flex: 1; }
.item .size { font-size: 11px; color: var(--sub); }
.item .btn { width: 100%; padding: 0 10px; white-space: nowrap; }
.item.owned { background: var(--green2); }

.zukan { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.zukan button { display: flex; flex-direction: column; align-items: center; padding: 6px 4px 8px; background: #fff; border: 2px solid var(--line); border-radius: 14px; font-size: 13px; font-weight: 700; }
.zukan button.unseen { color: var(--sub); background: var(--paper2); }
.zukan button.sel { border-color: var(--orange); }
.zukan button > svg { width: 96px; height: 96px; }
.zukan small { color: var(--sub); font-weight: 500; font-size: 12px; }
.detail { margin-bottom: 14px; padding: 12px; border: 2px dashed var(--line); border-radius: 16px; background: #fffdf6; }
.detail .card { grid-template-columns: 150px 1fr; }
@media (max-width: 420px) { .detail .card { grid-template-columns: 100px 1fr; } }
.progress { margin: 0 0 12px; color: var(--sub); font-size: 14px; }
.progress b { color: var(--ink); font-size: 18px; }

.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { padding: 8px 8px 6px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 3px 8px rgba(74, 50, 38, 0.15); text-align: center; font-size: 13px; font-weight: 700; }
.photo:nth-child(odd) { transform: rotate(-1.2deg); }
.photo:nth-child(even) { transform: rotate(1deg); }
.photo > svg { display: block; width: 100%; height: auto; border-radius: 3px; }
.photo small { display: block; color: var(--sub); font-weight: 500; font-size: 11.5px; }
.photo .row { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.photo .row .btn { min-height: 40px; padding: 0 12px; font-size: 13px; }
.empty { color: var(--sub); text-align: center; padding: 30px 10px; }

/* 実績 */
.ach { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.ach li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border: 2px solid var(--line); border-radius: 14px; }
.ach li.done { background: #fff8e0; border-color: #e8c66a; }
.ach .medal { font-size: 24px; text-align: center; color: var(--line); }
.ach b { display: block; font-size: 15px; }
.ach small { display: block; color: var(--sub); font-size: 12px; }
.ach .bar { display: block; height: 7px; margin: 4px 0 2px; border-radius: 4px; background: var(--paper2); overflow: hidden; }
.ach .bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.ach .btn { min-height: 40px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.ach .btn .ic { width: 14px; height: 18px; }
.ach .got { color: var(--green); font-size: 12px; font-weight: 700; white-space: nowrap; }
.ach .reward { display: inline-flex; align-items: center; gap: 2px; color: var(--sub); font-size: 13px; font-weight: 700; white-space: nowrap; }
.ach .reward .ic { width: 14px; height: 18px; }
.sp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sp-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 6px 10px; background: #fff; border: 2px solid #d9c8f0; border-radius: 14px; font-size: 13px; }
.sp-card svg { width: 100%; max-width: 150px; height: 104px; }
.sp-card small { color: var(--sub); font-size: 12px; font-weight: 500; }
.sp-card.none { background: var(--paper2); border-color: var(--line); color: var(--sub); }
/* 受け取れる実績があるときのタブの «!» */
.tabs button { position: relative; }
.tabs .bang { display: none; position: absolute; top: -8px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; border: 2px solid var(--ink); font-size: 12px; font-weight: 900; line-height: 16px; text-align: center; animation: bang 0.9s ease-in-out infinite; }
.tabs button.has .bang { display: block; }
@media (max-width: 420px) { .ach { grid-template-columns: 1fr; } .sp-list { grid-template-columns: 1fr 1fr; } }
.treasures { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.tr-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; background: #fff; border: 2px solid var(--line); border-radius: 14px; text-align: center; font-size: 13px; font-weight: 700; }
.tr-item .big { font-size: 34px; line-height: 1.2; }
.tr-item small { color: var(--sub); font-weight: 500; font-size: 11.5px; }
.tr-item.none { background: var(--paper2); color: var(--sub); }
.tr-item.none .big { filter: grayscale(1) opacity(0.25); }

#guide-section { max-width: 1100px; margin: 26px auto 0; padding: 0 4px; }
#guide-section h2 { font-size: 18px; font-weight: 900; }
#guide-section li { margin: 6px 0; line-height: 1.75; }
#site-footer { max-width: 1100px; margin: 30px auto 0; padding: 20px 16px 40px; text-align: center; color: var(--sub); font-size: 13px; }
#site-footer p { margin: 4px 0; }
.related-apps, #ad-section { max-width: 1100px; margin: 28px auto 0; padding: 0 4px; }
.related-apps-title { font-size: 18px; font-weight: 900; margin: 0 0 10px; }
.related-apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, calc(50% - 5px)), 1fr)); gap: 10px; }
.related-app-link.ra-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; transition: transform 0.15s, border-color 0.15s; }
.related-app-link.ra-card:hover { transform: translateY(-2px); border-color: var(--sub); }
.ra-card .ra-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.ra-card .ra-name { display: block; padding: 8px 12px 10px; font-size: 13px; font-weight: 700; line-height: 1.4; }
.footer-links { display: flex; justify-content: center; gap: 10px; align-items: center; }
.footer-link { color: var(--sub); text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; }
.footer-refs a { color: var(--sub); }
