/* ============ 台湾旅行ゲーム 共通スタイル ============ */
:root {
  --bg: #fff6ea;
  --panel: #ffffff;
  --ink: #4a3b32;
  --ink-soft: #8a7768;
  --accent: #e8505b;      /* ランタンの赤 */
  --accent-dark: #c63d48;
  --teal: #2bb3a3;
  --gold: #f4b63f;
  --line: #f0e0cc;
  --board: #ffe9cf;
  --cell-a: #fff3e2;
  --cell-b: #ffeede;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(120, 80, 40, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Yu Gothic UI", "Meiryo", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

button { font: inherit; color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 999px;
  padding: 12px 22px; min-height: 44px;
  font-weight: 700; font-size: 16px;
  background: var(--accent); color: #fff;
  box-shadow: 0 3px 0 var(--accent-dark);
  cursor: pointer;
  transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-teal { background: var(--teal); box-shadow: 0 3px 0 #1f8a7e; }
.btn-ghost { background: transparent; color: var(--ink-soft); box-shadow: none; border: 2px solid var(--line); }
.btn-block { width: 100%; }

.screen-title { font-size: 20px; font-weight: 800; margin: 4px 0 12px; }
.note { font-size: 12px; color: var(--ink-soft); }

/* ============ パズル ============ */
.puzzle { position: relative; display: flex; flex-direction: column; gap: 12px; user-select: none; -webkit-user-select: none; }

.hud { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; }
.hud-title { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.hud-row { display: flex; align-items: center; gap: 12px; }
.hud-moves { text-align: center; min-width: 76px; padding-right: 12px; border-right: 2px dashed var(--line); }
.hud-label { font-size: 11px; color: var(--ink-soft); }
.hud-moves-val { font-size: 26px; font-weight: 800; line-height: 1.1; }
.hud-moves-val.is-low { color: var(--accent); }
.hud-goals { display: flex; flex-wrap: wrap; gap: 8px 14px; flex: 1; }
.goal { display: flex; align-items: center; gap: 6px; position: relative; }
.goal-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.goal-icon-piece { border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); }
/* 文章の中に出す駒の色見本（仮：色の丸） */
.piece-dot { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; vertical-align: -0.2em; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.goal-icon-total { background: var(--line); font-size: 11px; font-weight: 800; }
.goal-icon-special { background: #fff1c9; box-shadow: 0 0 0 2px var(--gold) inset; }
.goal-count { font-size: 18px; font-weight: 800; }
.goal-count small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.goal.is-done .goal-count { color: var(--teal); }
.goal-check { color: var(--teal); font-weight: 900; }

.board-wrap { background: var(--board); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.board {
  --n: 6;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  font-size: min(calc((100vw - 48px) / 6 * 0.55), 40px);
}
.cell:nth-child(12n+1), .cell:nth-child(12n+3), .cell:nth-child(12n+5),
.cell:nth-child(12n+8), .cell:nth-child(12n+10), .cell:nth-child(12n+12) { background: var(--cell-a); }
.cell { background: var(--cell-b); }

.piece {
  position: absolute; top: 0; left: 0;
  width: calc(100% / var(--n)); height: calc(100% / var(--n));
  display: flex; align-items: center; justify-content: center;
  transition: transform .26s cubic-bezier(.3, .8, .4, 1);
  will-change: transform; /* スマホに「この駒は動きます」と前もって伝えて、なめらかにする（2026-10-28） */
  pointer-events: none;
}
.piece-face {
  position: relative;
  width: 88%; height: 88%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12), 0 2px 3px rgba(120, 80, 40, .15);
  line-height: 1;
  transition: transform .15s, opacity .2s;
  overflow: hidden;
}
.piece.is-selected .piece-face { transform: scale(1.1); box-shadow: 0 0 0 3px var(--accent), 0 4px 8px rgba(0, 0, 0, .2); }
.piece.is-clearing .piece-face { transform: scale(0); opacity: 0; transition: transform .22s ease-in, opacity .22s; }
.piece.is-born .piece-face { animation: born .4s ease-out; }
@keyframes born { 0% { transform: scale(1.4); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }

/* 特殊駒：白いしま模様＋光る枠 */
.piece.special-h .piece-face, .piece.special-v .piece-face, .piece.special-b .piece-face {
  box-shadow: 0 0 0 3px #fff, 0 0 10px 3px var(--gold);
  animation: glow 1.2s ease-in-out infinite;
}
.piece.special-h .piece-face::after, .piece.special-v .piece-face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
.piece.special-h .piece-face::after { background: repeating-linear-gradient(0deg, transparent 0 7px, rgba(255, 255, 255, .55) 7px 11px); }
.piece.special-v .piece-face::after { background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(255, 255, 255, .55) 7px 11px); }
/* ばくだん駒：まん中に白い星のような光 */
.piece.special-b .piece-face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle, #fff 0 16%, rgba(255, 255, 255, .55) 17% 34%, transparent 35% 52%, rgba(255, 255, 255, .5) 53% 62%, transparent 63%);
}
@keyframes glow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 16px 6px var(--gold); } }

/* 箱（じゃまをする物）：仮の見た目の段ボール。本番の絵が決まったら、ここを書きかえる */
.piece.is-box .piece-face {
  width: 90%; height: 90%;
  border-radius: 10%;
  background:
    linear-gradient(90deg, transparent 42%, #e9cf9a 42% 58%, transparent 58%),
    linear-gradient(180deg, #d9a766, #c48a4a);
  box-shadow: inset 0 0 0 2px #a8733a, inset 0 -4px 0 rgba(0, 0, 0, .12), 0 2px 3px rgba(120, 80, 40, .2);
}
/* ひびが入った箱（あと1回でこわれる） */
.piece.is-box.is-cracked .piece-face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(55deg, transparent 47%, #5c3a17 47% 52%, transparent 52%) 0 0 / 60% 60% no-repeat,
    linear-gradient(-40deg, transparent 46%, #5c3a17 46% 51%, transparent 51%) 100% 100% / 55% 55% no-repeat;
  opacity: .8;
}
.piece.is-box.is-hit .piece-face { animation: box-hit .3s ease-out; }
@keyframes box-hit { 30% { transform: scale(.88) rotate(-4deg); } 70% { transform: scale(1.04) rotate(3deg); } }
.goal-icon-box { background: #f3dfbc; }

/* リボンの駒（ラッピング・日本編から）：仮の見た目。ピンクのリボンを十字にかけて、上にちょうちょ結び。本番の絵が決まったら、ここを書きかえる */
.piece-ribbon { display: none; }
.piece.is-wrapped .piece-ribbon {
  display: block; position: absolute; inset: 6%; pointer-events: none; border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 42%, #ff7fb0 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 42%, #ff7fb0 42% 58%, transparent 58%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.piece.is-wrapped .piece-ribbon::before, .piece.is-wrapped .piece-ribbon::after {
  content: ""; position: absolute; top: -6%; width: 30%; height: 24%;
  background: #ff5f9e; border: 2px solid #fff; border-radius: 50%;
}
.piece.is-wrapped .piece-ribbon::before { left: 20%; transform: rotate(-25deg); }
.piece.is-wrapped .piece-ribbon::after { right: 20%; transform: rotate(25deg); }
/* リボンがほどけたとき */
.piece.is-untie .piece-face { animation: untie .4s ease-out; }
@keyframes untie { 40% { transform: scale(1.15); } }
.tut-piece.tut-wrap { position: relative; }
.tut-piece.tut-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(90deg, transparent 40%, #ff7fb0 40% 60%, transparent 60%), linear-gradient(0deg, transparent 40%, #ff7fb0 40% 60%, transparent 60%);
}
.tut-piece.tut-box {
  position: relative; border-radius: 10%;
  background: linear-gradient(90deg, transparent 42%, #e9cf9a 42% 58%, transparent 58%), linear-gradient(180deg, #d9a766, #c48a4a);
  box-shadow: inset 0 0 0 2px #a8733a;
}
.tut-piece.tut-box.is-cracked::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(55deg, transparent 45%, #5c3a17 45% 52%, transparent 52%);
}

.beam { position: absolute; pointer-events: none; z-index: 5; animation: beam .45s ease-out forwards; }
.beam-h { left: 0; right: 0; height: calc(100% / var(--n)); background: linear-gradient(180deg, transparent, rgba(255, 240, 150, .95), transparent); }
.beam-v { top: 0; bottom: 0; width: calc(100% / var(--n)); background: linear-gradient(90deg, transparent, rgba(255, 240, 150, .95), transparent); }
@keyframes beam { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
.burst {
  position: absolute; pointer-events: none; z-index: 5; width: calc(300% / var(--n)); height: calc(300% / var(--n)); border-radius: 30%;
  background: radial-gradient(circle, rgba(255, 250, 200, .98) 0 30%, rgba(255, 215, 110, .8) 55%, transparent 72%);
  animation: burst .45s ease-out forwards;
}
@keyframes burst { 0% { opacity: 0; transform: scale(.3); } 35% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }

.puzzle-footer { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
/* ハンマー：押すと、こわすマスを選ぶ状態になる */
.btn-hammer.is-active { box-shadow: 0 0 0 3px var(--gold); }
.board.is-hammer { cursor: crosshair; box-shadow: 0 0 0 4px var(--gold); }
.sheet-hammer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: #fff8e8; text-align: left;
}
.sheet-hammer small { display: block; font-size: 11px; color: #8a7a6c; }
.sheet-hammer .btn { white-space: nowrap; flex-shrink: 0; }

.toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(74, 59, 50, .9); color: #fff; font-weight: 800;
  padding: 12px 24px; border-radius: 999px; z-index: 10; pointer-events: none;
}

/* ============ モーダル（結果表示など） ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(60, 40, 30, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.modal {
  width: 100%; max-width: 400px; background: var(--panel); border-radius: 24px;
  padding: 24px 20px; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  animation: pop .25s ease-out;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 { margin: 0 0 8px; font-size: 24px; }
.modal p { margin: 6px 0; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ============ 上部バー ============ */
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.topbar-title { font-size: 18px; font-weight: 800; }
.miles { background: var(--panel); border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow); font-size: 14px; }
.miles b { font-size: 17px; color: var(--accent); }
.warn { background: #ffe1e1; color: var(--accent-dark); border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.complete-banner {
  background: linear-gradient(90deg, #ffd166, #ff9f9f); color: #5a2a1a; font-weight: 800;
  text-align: center; border-radius: 14px; padding: 10px; margin-bottom: 12px;
}

/* ============ 部屋・マップ上部のプレイヤー情報 ============ */
.player-bar { display: flex; align-items: center; gap: 6px; margin: 2px 0 10px; }
.pb-who { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.pb-face { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; background: #ffe9cf; border: 3px solid #fff; box-shadow: var(--shadow); flex-shrink: 0; }
.pb-face .avatar-bust { aspect-ratio: 1 / 1; }
.pb-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-stat {
  background: var(--panel); border-radius: 999px; box-shadow: var(--shadow);
  padding: 5px 10px; font-size: 11px; white-space: nowrap; flex-shrink: 0;
}
.pb-stat b { font-size: 14px; }
.pb-hunger { width: 104px; }
.pb-hunger .pb-label { display: block; line-height: 1.2; }
.pb-hunger .gauge { height: 6px; margin-top: 2px; }
.pb-hunger.is-full .gauge i { background: linear-gradient(90deg, #5fd1a8, var(--teal)); }
.pb-miles { display: flex; align-items: center; gap: 4px; }
.pb-miles b { color: var(--accent); }
.pb-coin { width: 20px; height: 20px; border-radius: 50%; background: #f4b63f; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }

/* ============ 自分の部屋 ============ */
.room-title { text-align: center; margin: 6px 0; }
.room-note { text-align: center; margin: 6px 0 0; }
/* 部屋：背景 → 主人公 → 置き場所 の順に重ねる */
.room-scene { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #fdebd3; }
.room-bg, .room-bg > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.room-bg img { object-fit: cover; }
.room-figure { position: absolute; left: 36%; width: 28%; bottom: 3%; pointer-events: none; }
/* 部屋の中身。広くなった部屋（.is-wide）では、中身が枠より横に長くなり、指で横にすべらせて見る */
.room-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.room-scroll::-webkit-scrollbar { display: none; }
.room-canvas { position: relative; height: 100%; }
.room-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .85); color: var(--accent, #d9534f); font-size: 22px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.room-arrow[hidden] { display: none; }
.room-arrow-left { left: 8px; }
.room-arrow-right { right: 8px; }
.room-slot {
  position: absolute; padding: 0; cursor: pointer;
  background: rgba(255, 255, 255, .45); border: 2px dashed #d9b488; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}
.room-slot.is-filled { background: transparent; border-color: transparent; }
.room-slot:active { transform: scale(.96); }
.room-slot-plus { font-size: 24px; font-weight: 800; color: #c79a6b; }
.room-slot .item-art { width: 92%; height: 92%; font-size: 48px; }

/* アイテムの絵（画像が無い間は絵文字） */
.item-art { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.3em; height: 1.3em; line-height: 1; }
.item-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* 記念プレートのリボンに書く地名（文字の大きさは絵の幅に合わせる。cqw＝絵の幅の1%） */
.item-art.has-label { container-type: inline-size; }
.item-label { position: absolute; left: 0; right: 0; transform: translateY(-50%); text-align: center; font-size: 11cqw; font-weight: 800; line-height: 1; letter-spacing: .1em; color: #0e5560; font-family: Georgia, 'Times New Roman', serif; text-shadow: 0 0 2px #fff, 0 0 2px #fff; pointer-events: none; white-space: nowrap; }
.item-ph { filter: drop-shadow(0 2px 2px rgba(120, 80, 40, .25)); }

/* 壁紙：部屋の下のボタン、選ぶ一覧・お土産屋の小さな見本、買ったときの見本 */
.room-wall { text-align: center; margin-top: 6px; }
.wall-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 12%; border-radius: 10px; display: block; }
.pick-item .wall-thumb { width: 78%; }
.food-emoji .wall-thumb { width: 100%; height: 100%; border-radius: 12px; }
.wall-preview { width: 72%; max-width: 240px; border-radius: 14px; box-shadow: var(--shadow); display: block; margin: 0 auto 8px; }

/* 飾る物を選ぶ一覧 */
.pick-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; max-height: 46vh; overflow-y: auto; padding: 2px; }
.pick-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 96px;
  background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 8px 4px; cursor: pointer; color: var(--ink);
}
.pick-item .item-art { font-size: 34px; }
.pick-item b { font-size: 12px; line-height: 1.3; }
.pick-item small { font-size: 10px; color: var(--ink-soft); min-height: 1.3em; }
.pick-item.is-current { border-color: var(--teal); background: #eafaf6; }
/* 国を選ぶカード：コンプリートした国には、記念プレートをシールのように貼る（文字は左、バッジは右） */
.country-card { position: relative; align-items: flex-start; justify-content: center; text-align: left; padding: 10px 10px 10px 12px; }
.country-card.is-complete { padding-right: 40%; background: linear-gradient(135deg, #fff8ec, #ffeccf); border-color: #f0c98a; }
.country-card.is-complete.is-current { border-color: var(--teal); }
.country-card.is-complete small { color: #c2873a; font-weight: 800; }
.country-badge { position: absolute; right: 6px; top: 50%; width: 38%; max-width: 72px; aspect-ratio: 1; transform: translateY(-50%) rotate(-10deg); filter: drop-shadow(0 3px 4px rgba(90, 60, 30, .3)); animation: badge-pop .45s cubic-bezier(.3, 1.6, .5, 1) both; pointer-events: none; }
.country-badge .item-art { width: 100%; height: 100%; font-size: 40px; }
@keyframes badge-pop { 0% { transform: translateY(-50%) rotate(-30deg) scale(.2); opacity: 0; } 100% { transform: translateY(-50%) rotate(-10deg) scale(1); opacity: 1; } }
.owned-tag { font-size: 12px; font-weight: 800; color: var(--teal); white-space: nowrap; }
.room-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.room-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.room-sub .menu-btn { font-size: 13px; padding: 10px 2px; white-space: nowrap; }
.btn-big { font-size: 18px; min-height: 58px; }

/* ============ 旅行マップ ============ */
.map-screen { padding-bottom: 170px; }
.map-legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px;
  background: rgba(255, 255, 255, .85); border-radius: 14px; padding: 6px 10px; margin-bottom: 8px;
  font-size: 11px; font-weight: 700; color: var(--ink-soft);
}
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.map {
  position: relative; width: 100%; border-radius: 22px; overflow: hidden;
  border: 5px solid #fffaf0; box-shadow: 0 6px 18px rgba(120, 80, 40, .18);
}
.map-layer { position: absolute; }
.map-layer-background { z-index: 0; }
.map-layer-landmark { z-index: 1; }
.map-layer-prop { z-index: 2; }
.map-layer.is-over-road { z-index: 4; } /* 道（z-index 3）より上、地点と主人公より下 */
.map-layer.is-behind { z-index: 0; } /* 背景より上（あとから描かれるため）、観光地（z-index 1）より下 */
.map-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-asset { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.map-layer-background .map-asset { object-fit: cover; }
.map-road { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; }

/* 左上の「台北」メモカード */
.map-title-card {
  position: absolute; left: 3%; top: .6%; width: 44%; z-index: 4;
  background: #fffaf0; border-radius: 6px; padding: 10px 12px 10px;
  box-shadow: 0 4px 10px rgba(120, 80, 40, .2); transform: rotate(-3deg);
}
.map-title-card::before {
  content: ""; position: absolute; top: -8px; left: 50%; width: 56px; height: 16px; transform: translateX(-50%) rotate(2deg);
  background: rgba(247, 184, 203, .75); border-radius: 2px;
}
.mtc-name { font-size: 30px; font-weight: 900; line-height: 1; color: #4a3b32; letter-spacing: .05em; }
.mtc-en { font-size: 12px; font-weight: 800; letter-spacing: .25em; color: #6d5847; margin-top: 2px; }
.mtc-copy { font-size: 10px; line-height: 1.4; margin: 6px 0 0; color: #6d5847; }
.mtc-stamp {
  position: absolute; right: -14px; top: -6px; width: 50px; height: 50px; border-radius: 50%;
  border: 3px double #3e7cc2; color: #3e7cc2; transform: rotate(14deg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255, 255, 255, .6);
}
.mtc-stamp small { font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.mtc-stamp span { font-size: 16px; line-height: 1; }

/* 地点 */
.map-node {
  position: absolute; transform: translate(-50%, -18px); z-index: 5;
  width: 140px; padding: 0; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
}
.map-node:disabled { cursor: default; }
/* マスの丸：小さな色つきの丸。まだクリアしていない＝青、クリア済み＝緑 */
.node-pic {
  width: 36px; height: 36px; border-radius: 50%;
  background: #3aa0e8; box-shadow: 0 0 0 3px #fff, 0 3px 8px rgba(60, 40, 20, .3);
}
.node-tag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; max-width: 140px;
  background: #fffdf8; border: 2px solid #eadcc6; border-radius: 999px; padding: 2px 6px 2px 2px;
  font-size: 12px; font-weight: 800; white-space: nowrap; color: var(--ink); box-shadow: 0 2px 5px rgba(60, 40, 20, .15);
}
.node-no { width: 22px; height: 22px; border-radius: 50%; background: #2f4a6d; color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.node-name { overflow: hidden; text-overflow: ellipsis; }

/* 状態マーク（地点の名札・凡例で共通） */
.st { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; flex-shrink: 0; }
.st-cleared { background: #3bb273; color: #fff; }
.st-next { background: #3aa0e8; }
.st-current, .st-locked { font-size: 13px; }

.map-node.is-cleared .node-pic { background: #3bb273; }
.map-node.is-current .node-pic { box-shadow: 0 0 0 4px #7cc8f5, 0 4px 10px rgba(60, 40, 20, .22); animation: ringCurrent 1.8s ease-in-out infinite; }
.map-node.is-current .node-tag { border-color: #7cc8f5; }
.map-node.is-next .node-pic { animation: ringNext 1.3s ease-in-out infinite; }
.map-node.is-next .node-tag { border-color: #3aa0e8; }
.map-node.is-locked .node-pic { background: #8fc4ec; }
.map-node.is-locked .node-tag { background: #f3f1ee; color: #8a939e; }
.map-node.is-locked .node-no { background: #a9b2bd; }
@keyframes ringCurrent { 50% { box-shadow: 0 0 0 8px rgba(124, 200, 245, .45), 0 4px 10px rgba(60, 40, 20, .22); } }
@keyframes ringNext { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 10px rgba(58, 160, 232, .45), 0 3px 8px rgba(60, 40, 20, .3); } }
/* 主人公は地点の丸の上に立つ。吹き出しはその頭の上に出す */
.node-bubble {
  position: absolute; top: -78px; left: 50%; transform: translateX(-50%); font-style: normal; white-space: nowrap;
  background: #3aa0e8; color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2); animation: bounce 1.2s ease-in-out infinite;
}
.node-bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #3aa0e8; border-bottom: 0; }
@keyframes bounce { 50% { transform: translate(-50%, -4px); } }

.map-start {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  background: rgba(255, 255, 255, .95); border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 800; white-space: nowrap;
}
.map-avatar {
  position: absolute; width: 46px; z-index: 6; pointer-events: none;
  transform: translate(-50%, calc(-100% + 14px)); /* 足もとが地点の丸の下のふちに来るように（丸の上に立つ） */
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .25));
}
.map-avatar.is-walking { will-change: transform; } /* 歩いている間、スマホに「動きます」と前もって伝える */
.map-avatar.is-walking .avatar { animation: walk .35s ease-in-out infinite; }
@keyframes walk { 50% { transform: translateY(-5px) rotate(3deg); } }

/* 画面下の固定ボタン */
.map-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 480px; margin: 0 auto; padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 246, 234, 0), rgba(255, 246, 234, .95) 22%);
}
.next-card {
  width: 100%; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; cursor: pointer; text-align: left;
  background: #fffaf0; border: 2px solid #eadcc6; border-radius: 18px; padding: 6px 12px 6px 6px; box-shadow: var(--shadow);
}
.next-face { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: #ffe9cf; flex-shrink: 0; }
.next-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-text small { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.next-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-go { width: 34px; height: 34px; border-radius: 50%; background: #3aa0e8; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.dock-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr; gap: 5px; }
.dock-row .dock-btn { font-size: 10px; letter-spacing: -.03em; white-space: nowrap; padding: 0 2px; }
.dock-btn {
  min-height: 56px; border: none; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 12px; font-weight: 800; cursor: pointer;
}
.dock-btn span { font-size: 20px; line-height: 1.1; }
.dock-btn:disabled { background: #efe6db; color: var(--ink-soft); box-shadow: none; cursor: default; }
.dock-back { background: #8a5a3c; color: #fff; }

/* 地点の確認カード */
.sheet-icon { font-size: 44px; line-height: 1; }
.sheet-pic { position: relative; height: 130px; margin: -4px auto 4px; display: flex; align-items: center; justify-content: center; }
.sheet-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(120, 80, 40, .18)); }
.sheet-pic-ph { font-size: 52px; line-height: 1; }
.sheet-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 8px; }
.sheet-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; background: #fff7ec; font-size: 15px; }
.sheet-chip b { font-size: 17px; }
.sheet-chip .piece-dot { width: 1.2em; height: 1.2em; }
.sheet-chip small { font-size: 11px; color: var(--teal); font-weight: 700; }
.sheet-chip-moves { background: #eef7ff; }
.chip-total { font-style: normal; font-size: 11px; font-weight: 800; background: var(--line); border-radius: 6px; padding: 2px 5px; }
.sheet-place { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.sheet-goals { list-style: none; padding: 0; margin: 10px 0; text-align: left; }
.sheet-goals li { background: #fff7ec; border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; font-weight: 700; font-size: 14px; }
.sheet-moves { font-size: 14px; }
.sheet-moves b { font-size: 18px; }
.sheet-note { text-align: left; }

.dev-tools { margin-top: 28px; text-align: center; }
.room-foot { margin-top: 20px; text-align: center; }
.consent-en { margin-top: 10px; }
.consent-link { margin-top: 14px; font-size: 13px; }
.consent-link a { color: var(--ink-soft); }
.btn-link { background: none; border: none; color: var(--ink-soft); font-size: 12px; text-decoration: underline; cursor: pointer; padding: 8px; }

/* ============ おなかゲージ ============ */
.hunger {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border-radius: 999px; box-shadow: var(--shadow);
  padding: 6px 14px; margin-bottom: 12px; font-size: 13px;
}
.hunger-label { font-weight: 700; color: var(--ink-soft); }
.gauge { position: relative; flex: 1; height: 10px; border-radius: 999px; background: #f1e4d4; overflow: hidden; }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffb35c, #ff8a5c); border-radius: 999px; transition: width .3s; }
.gauge em { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(74, 59, 50, .35); }
.hunger.is-full .gauge i { background: linear-gradient(90deg, #5fd1a8, var(--teal)); }
.hunger.is-empty b { color: var(--accent); }
.hunger b { min-width: 26px; text-align: right; }
.hunger-tag { background: var(--teal); color: #fff; font-weight: 800; font-size: 11px; border-radius: 999px; padding: 2px 8px; }
.hud-bonus { font-size: 11px; font-weight: 800; color: var(--teal); }

/* ============ メニュー・食事 ============ */
.menu-row { display: flex; gap: 10px; margin-bottom: 12px; }
.menu-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); border: none; border-radius: 16px; box-shadow: var(--shadow);
  padding: 10px; font-weight: 800; font-size: 15px; cursor: pointer; min-height: 56px;
}
.menu-btn small { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.menu-btn:disabled { background: #efe6db; color: var(--ink-soft); box-shadow: none; cursor: default; }

.section-title { font-size: 15px; margin: 16px 0 8px; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow);
  padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 108px; justify-content: center;
}
.slot.is-empty { background: transparent; box-shadow: none; border: 2px dashed var(--line); color: var(--ink-soft); font-size: 13px; }
.slot-emoji { font-size: 28px; }
.slot-name { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.2; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: 13px; }

.food-list { display: flex; flex-direction: column; gap: 8px; }
.food-card { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 10px; }
.food-emoji { position: relative; font-size: 32px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: #fff3e2; border-radius: 12px; flex-shrink: 0; }
.food-new { position: absolute; top: -6px; right: -8px; font-style: normal; font-size: 9px; font-weight: 800; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 5px; }
.food-info { flex: 1; min-width: 0; }
.food-name { font-weight: 800; font-size: 14px; }
.food-meta { font-size: 12px; color: var(--ink-soft); }
.food-actions { display: flex; flex-direction: column; gap: 6px; }
.bottom-actions { margin-top: 20px; }
.eat-emoji { font-size: 56px; }

/* ---- 食べる演出（app.js の showEatScene） ---- */
.eat-scene { text-align: center; }
.eat-table { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
/* 主人公（パスポート写真と同じ上半身）。食べている間、もぐもぐと上下に揺れる */
.eat-face { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: #ffe9cf; border: 3px solid #fff; box-shadow: var(--shadow); flex-shrink: 0; }
.eat-face .avatar-bust { aspect-ratio: 1 / 1; }
.eat-scene.is-eating .eat-face .avatar { animation: eat-chew-face .32s ease-in-out infinite; }
@keyframes eat-chew-face { 50% { transform: translateY(4%); } }
.eat-plate { position: relative; width: 120px; height: 120px; }
.eat-food { width: 100%; height: 100%; }
.eat-food .item-art { width: 100%; height: 100%; font-size: 76px; }
.eat-scene.is-eating .eat-food { animation: eat-wobble .64s ease-in-out infinite; }
@keyframes eat-wobble { 50% { transform: rotate(-3deg) scale(.97); } }
/* 湯気：ゆらゆら上がって消える */
.eat-steam { position: absolute; top: 4%; width: 10px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 0 6px rgba(200, 180, 160, .6); opacity: 0; }
.eat-steam:nth-of-type(1) { left: 30%; } .eat-steam:nth-of-type(2) { left: 48%; } .eat-steam:nth-of-type(3) { left: 66%; }
.eat-scene.is-eating .eat-steam { animation: eat-steam 1.1s ease-out infinite; }
.eat-scene.is-eating .eat-steam:nth-of-type(2) { animation-delay: .35s; }
.eat-scene.is-eating .eat-steam:nth-of-type(3) { animation-delay: .7s; }
@keyframes eat-steam { 0% { opacity: 0; transform: translateY(0) scaleY(.6); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-26px) translateX(4px) scaleY(1.2); } }
/* ♪ ✨ ♡ がポンポン出る */
.eat-pop { position: absolute; font-style: normal; font-weight: 900; font-size: 20px; color: #ff7a8a; opacity: 0; }
.eat-pop:nth-of-type(4) { left: -6%; top: 10%; color: #f0a030; } .eat-pop:nth-of-type(5) { right: -8%; top: 0; } .eat-pop:nth-of-type(6) { right: -4%; top: 58%; }
.eat-scene.is-eating .eat-pop { animation: eat-pop .9s ease-out infinite; }
.eat-scene.is-eating .eat-pop:nth-of-type(5) { animation-delay: .3s; }
.eat-scene.is-eating .eat-pop:nth-of-type(6) { animation-delay: .6s; }
@keyframes eat-pop { 0% { opacity: 0; transform: translateY(6px) scale(.5); } 35% { opacity: 1; transform: translateY(0) scale(1.15); } 100% { opacity: 0; transform: translateY(-14px) scale(1); } }
.eat-say { font-weight: 800; color: #b07a4f; margin: 6px 0; transition: opacity .3s; }
.eat-scene.is-full-tummy .eat-say { opacity: 0; height: 0; margin: 0; overflow: hidden; }
.eat-after { opacity: 0; max-height: 0; overflow: hidden; transition: opacity .4s, max-height .4s; }
.eat-scene.is-full-tummy .eat-after { opacity: 1; max-height: 200px; }
.eat-gauge-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 700; }
.eat-gauge { height: 14px; }
.eat-gauge i { transition: width .7s cubic-bezier(.3, .8, .4, 1); }
.eat-num { min-width: 2.2em; text-align: right; }
.eat-book { opacity: 0; max-height: 0; overflow: hidden; transform: translateY(8px); transition: opacity .4s, max-height .4s, transform .4s; }
.eat-scene.show-book .eat-book { opacity: 1; max-height: 220px; transform: none; }
.eat-book-head { font-weight: 800; font-size: 13px; color: #8a6a4a; margin-top: 8px; }
.eat-book-page { position: relative; display: flex; align-items: center; gap: 10px; margin: 6px auto 0; max-width: 240px; padding: 10px 14px; background: #fffaf0; border: 2px dashed #e3cfae; border-radius: 12px; }
.eat-book-art { width: 48px; height: 48px; flex-shrink: 0; }
.eat-book-art .item-art { width: 100%; height: 100%; font-size: 34px; }
.eat-stamp {
  position: absolute; right: -6px; top: -10px; padding: 3px 9px; border: 3px solid #e2554f; border-radius: 8px;
  color: #e2554f; font-style: normal; font-weight: 900; font-size: 15px; background: rgba(255, 255, 255, .85);
  transform: rotate(-12deg) scale(2.4); opacity: 0;
}
.eat-scene.show-book .eat-stamp { animation: eat-stamp .45s cubic-bezier(.3, 1.6, .5, 1) .25s forwards; }
@keyframes eat-stamp { 0% { opacity: 0; transform: rotate(-12deg) scale(2.4); } 100% { opacity: 1; transform: rotate(-12deg) scale(1); } }
.eat-complete { opacity: 0; transition: opacity .4s; }
.eat-scene.show-complete .eat-complete { opacity: 1; }

/* ============ 主人公の絵 ============ */
.avatar { position: relative; width: 100%; aspect-ratio: 2 / 3; }
.avatar-layer, .avatar-placeholder, .avatar-img, .avatar-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar-img { object-fit: contain; }
.avatar-wear { position: absolute; object-fit: contain; }
.wear-preview { width: 130px; margin: 0 auto 10px; }
.wear-list { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.wear-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: #fff8e8; }
.wear-row b { flex: 1; }
.wear-art { width: 48px; height: 48px; flex-shrink: 0; }
.wear-art .item-art { width: 100%; height: 100%; }
/* パスポート写真用：上半身だけ見せる */
.avatar-bust { position: relative; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; }
.avatar-bust .avatar { position: absolute; width: 140%; left: -20%; top: 2%; }

/* ============ 主人公の作成 ============ */
.gender-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gender-card {
  background: var(--panel); border: 3px solid transparent; border-radius: 18px; box-shadow: var(--shadow);
  padding: 10px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-weight: 800;
}
.gender-card .avatar { width: 80%; }
.gender-card.is-selected { border-color: var(--accent); background: #fff4f4; }
.text-input {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; min-height: 48px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink);
}
.text-input:focus { outline: none; border-color: var(--accent); }
.form-error { color: var(--accent-dark); font-size: 13px; min-height: 1.4em; margin: 6px 0; }

/* ============ パスポート ============ */
.passport { background: #1f3a5f; border-radius: 20px; padding: 10px; box-shadow: var(--shadow); }
.pp-cover-strip { color: #e9c46a; font-weight: 800; letter-spacing: .12em; text-align: center; font-size: 13px; padding: 4px 0 10px; }
.pp-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.pp-tab { flex: 1; border: none; border-radius: 10px; padding: 8px 4px; min-height: 40px; font-weight: 800; font-size: 13px; background: rgba(255, 255, 255, .15); color: #dfe8f5; cursor: pointer; }
.pp-tab.is-active { background: #fbf6e9; color: #1f3a5f; }
.pp-page {
  background-color: #fbf6e9;
  background-image: repeating-radial-gradient(circle at 50% 120%, transparent 0 14px, rgba(31, 58, 95, .05) 14px 15px);
  border-radius: 12px; padding: 14px; color: #2e3a4a; min-height: 360px;
}
.pp-page-head { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: #1f3a5f; border-bottom: 1px solid rgba(31, 58, 95, .2); padding-bottom: 6px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.pp-complete { background: #e9c46a; color: #5a3b00; border-radius: 999px; padding: 1px 8px; font-size: 10px; }
.pp-id-row { display: flex; gap: 14px; }
.pp-photo { width: 38%; flex-shrink: 0; background: #e6eef7; border: 1px solid rgba(31, 58, 95, .25); border-radius: 6px; overflow: hidden; }
.pp-fields { margin: 0; flex: 1; min-width: 0; }
.pp-fields dt { font-size: 10px; color: #6a7a8e; margin-top: 6px; }
.pp-fields dd { margin: 0; font-weight: 800; font-size: 15px; word-break: break-all; }
.pp-mrz { font-family: "Courier New", monospace; font-size: 11px; letter-spacing: .05em; color: #4a5a6e; margin: 14px 0 10px; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.stamp-row { display: flex; justify-content: space-around; gap: 10px; margin-bottom: 14px; }
.stamp, .stamp-empty { width: 128px; height: 128px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.stamp { border: 4px double currentColor; transform: rotate(-12deg); opacity: .85; line-height: 1.2; }
.stamp b { font-size: 22px; }
.stamp small { font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.stamp i { font-style: normal; font-size: 11px; font-weight: 700; margin-top: 2px; }
.stamp-entry { color: #c63d48; }
.stamp-exit { color: #2d6cb5; transform: rotate(9deg); }
.stamp-empty { border: 2px dashed rgba(31, 58, 95, .25); color: #8a97a8; font-size: 12px; font-weight: 700; }
.stamp-empty small { font-size: 10px; font-weight: 400; }
.pp-sub { font-size: 13px; margin: 8px 0 6px; display: flex; align-items: center; gap: 8px; }
.pp-stages { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pp-stages li { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .7); border-radius: 8px; padding: 6px; }
.pp-stages li i { margin-left: auto; font-style: normal; color: var(--teal); font-weight: 900; }
.pp-stages li.is-locked { color: #a7b0bc; }
.pp-no { width: 20px; height: 20px; border-radius: 50%; background: #1f3a5f; color: #fff; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pp-stages li.is-cleared .pp-no { background: var(--teal); }
.pp-stages li.is-locked .pp-no { background: #c9d0d9; }
.collection-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.col-item { background: rgba(255, 255, 255, .6); border: 1px dashed rgba(31, 58, 95, .2); border-radius: 10px; padding: 6px 2px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.col-item.is-got { background: #fff; border-style: solid; }
.col-emoji { font-size: 26px; line-height: 1.2; color: #b8c1cc; font-weight: 800; }
.col-item b { font-size: 10px; line-height: 1.2; }
.col-item small { font-size: 9px; color: #8a97a8; }

/* ============ 結果画面 ============ */
.reward-list { list-style: none; padding: 0; margin: 14px 0 8px; text-align: left; }
.reward-list li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: #fff7ec; margin-bottom: 6px; }
.reward-list b { color: var(--accent); }
.event { background: #eef7ff; border-radius: 12px; padding: 10px; margin-top: 8px; font-weight: 700; font-size: 14px; }
.event-stamp { background: #fff1c9; }
.event-complete { background: linear-gradient(90deg, #ffd166, #ff9f9f); }

/* ============ 説明（チュートリアル） ============ */
.tut-icon { font-size: 44px; line-height: 1.1; }
/* ---- 説明のポップアップ（1文ずつ） ---- */
.tut-pop { text-align: center; }
.tut-line { font-size: 16px; line-height: 1.7; font-weight: 700; background: #fff6ea; border-radius: 14px; padding: 14px 16px; margin: 12px 0 4px; text-align: left; }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tut-dots i.is-on { background: var(--accent); }
.pop-in { animation: pop-in .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.pop-in-late { animation: rise-in .45s ease-out .15s both; }
@keyframes pop-in { 0% { transform: scale(.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise-in { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
/* 図：左から順に出てくる */
.tut-pop .tut-demo > * { animation: rise-in .4s ease-out both; }
.tut-pop .tut-demo > *:nth-child(2) { animation-delay: .35s; } .tut-pop .tut-demo > *:nth-child(3) { animation-delay: .7s; }
.tut-pop .tut-demo > *:nth-child(4) { animation-delay: 1.05s; } .tut-pop .tut-demo > *:nth-child(5) { animation-delay: 1.4s; }
/* ---- スタンプが押される演出（app.js の showStampScene） ---- */
/* 絵（img/passport/）が読めたら .has-art が付き、仮の見た目を消す */
.pp-scene { text-align: center; }
.pp-book { position: relative; width: 290px; height: 186px; margin: 64px auto 10px; perspective: 900px; } /* 上の余白：いちばん上の段に押すときも、ハンコが枠の外に出ないように */
/* 閉じているあいだは、表紙がまん中に来るように左へずらしておき、開くと元の位置へ */
.pp-book { transform: translateX(-25%); transition: transform .7s cubic-bezier(.5, 0, .3, 1); }
.pp-scene.is-open .pp-book { transform: none; }
.pp-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* 見開き（仮の見た目：クリーム色の2ページ、うすい模様、まん中の綴じ目） */
.pp-spread {
  position: absolute; inset: 0; border-radius: 8px; overflow: hidden;
  background:
    linear-gradient(90deg, transparent 48.5%, rgba(120, 100, 70, .18) 50%, transparent 51.5%),
    repeating-radial-gradient(circle at 30% 40%, rgba(70, 150, 140, .07) 0 2px, transparent 2px 9px),
    #fbf5e6;
  box-shadow: 0 6px 14px rgba(60, 40, 20, .25), inset 0 0 0 2px rgba(70, 150, 140, .25);
  opacity: 0; transition: opacity .3s .25s;
}
.pp-spread.has-art { background: none; box-shadow: none; }
.pp-scene.is-open .pp-spread { opacity: 1; }
.pp-spread-head { position: absolute; left: 8%; top: 8%; font-size: 11px; font-weight: 800; color: #4c6f6a; letter-spacing: .05em; }
/* 査証のスタンプ：見開きの上に、旅をした順に並ぶ（app.js の stampSlot）。1つの大きさは見開きの幅の 18% */
.st-layer { position: absolute; inset: 0; }
.st-slot { position: absolute; width: 18%; aspect-ratio: 1; transform: rotate(var(--rot)); opacity: .88; container-type: inline-size; }
.st-slot .stamp { width: 100%; height: 100%; transform: none; border-width: 3px; line-height: 1.05; mix-blend-mode: multiply; }
.st-slot .stamp { border-width: max(2px, 3cqw); }
/* 文字の大きさは、スタンプの大きさに合わせる（cqw＝スタンプの幅の1%） */
.st-slot .stamp b { font-size: 21cqw; }
.st-slot .stamp small { font-size: 9.5cqw; letter-spacing: .04em; }
.st-slot .stamp i { font-size: 9.5cqw; margin-top: 1px; }
.stamp-square { border-radius: 16%; }
/* 国の柄のスタンプの絵があるとき：枠と文字は絵にまかせ、日付だけを絵の空白の帯（まん中より少し下）に書く */
.stamp { position: relative; }
.stamp-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stamp.has-art { border: none; }
.stamp.has-art > small, .stamp.has-art > b { display: none; }
.stamp.has-art .stamp-date { position: absolute; left: 0; right: 0; top: var(--date-y); transform: translateY(-50%); margin: 0; text-align: center; font-weight: 800; letter-spacing: .02em; }
.st-slot .stamp.has-art .stamp-date { font-size: 7.5cqw; }
/* 押す前は見えない。ハンコが押されたら、にじむように出る */
.st-slot.pp-ink { opacity: 0; }
.pp-scene.is-ink .st-slot.pp-ink { animation: pp-ink .35s ease-out forwards; }
@keyframes pp-ink { 0% { opacity: 0; transform: rotate(var(--rot)) scale(1.3); filter: blur(1px); } 60% { opacity: .95; transform: rotate(var(--rot)) scale(.95); filter: blur(0); } 100% { opacity: .88; transform: rotate(var(--rot)) scale(1); filter: blur(0); } }
/* パスポートの「スタンプ」のページでは、見開きを並べて見せる */
.pp-spread.pp-spread-static { position: relative; inset: auto; width: 100%; max-width: 560px; aspect-ratio: 1000 / 640; opacity: 1; margin: 10px auto; }
/* 表紙（仮の見た目：紺色に金の飾り）。左のふちを軸にして、パタンと開く */
.pp-cover {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; border-radius: 4px 10px 10px 4px;
  background: radial-gradient(circle at 50% 45%, rgba(230, 190, 90, .25) 0 18%, transparent 19%), #1f3a5f;
  box-shadow: 0 6px 14px rgba(20, 30, 60, .35), inset 0 0 0 3px rgba(230, 190, 90, .55);
  transform-origin: left center; transition: transform .7s cubic-bezier(.5, 0, .3, 1);
  display: flex; align-items: center; justify-content: center; backface-visibility: hidden; z-index: 3;
}
.pp-cover.has-art { background: none; box-shadow: none; }
.pp-cover.has-art .pp-cover-mark { display: none; }
.pp-cover-mark { font-size: 34px; color: #e6be5a; }
.pp-scene.is-open .pp-cover { transform: rotateY(-180deg); }
/* ハンコ（仮の見た目：木の持ち手・首・黒い印面）。右上から傾いて近づき → 真上でまっすぐ → グッと押しこむ → 傾けながら持ち上げる */
.pp-stamper { position: absolute; width: 70px; height: 84px; z-index: 4; opacity: 0; transform-origin: 50% 100%;
  transform: translate(70px, -120px) rotate(22deg); transition: transform .55s cubic-bezier(.25, .8, .35, 1), opacity .3s; }
.pp-stamper i { position: absolute; left: 50%; display: block; }
/* 傾けた絵（132）があるときは、近づく・持ち上げるときにそちらを見せ、押している最中だけまっすぐの絵（131）にする */
.pp-art-tilt { opacity: 0; }
/* 傾けた絵そのものが傾いているので、動きの傾きは小さくする */
.pp-stamper.has-tilt { transform: translate(70px, -120px) rotate(6deg); }
.pp-scene.is-up .pp-stamper.has-tilt { transform: translate(-40px, -130px) rotate(-4deg); }
.pp-stamper.has-tilt .pp-art-tilt { opacity: 1; }
.pp-stamper.has-tilt .pp-art-press { opacity: 0; }
.pp-scene.is-press .pp-stamper.has-tilt .pp-art-press { opacity: 1; }
.pp-scene.is-press .pp-stamper.has-tilt .pp-art-tilt { opacity: 0; }
/* 傾けた絵そのものが傾いているので、動きの傾きは小さくする */
.pp-stamper.has-tilt { transform: translate(70px, -120px) rotate(6deg); }
.pp-scene.is-up .pp-stamper.has-tilt { transform: translate(-40px, -130px) rotate(-4deg); }
.pp-scene.is-up .pp-stamper.has-tilt .pp-art-press { opacity: 0; }
.pp-scene.is-up .pp-stamper.has-tilt .pp-art-tilt { opacity: 1; }
.pp-stamper.has-art i { display: none; }
.pp-stamper-knob { top: 0; width: 38px; height: 34px; margin-left: -19px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e7b98a, #a8703f); }
.pp-stamper-neck { top: 30px; width: 16px; height: 30px; margin-left: -8px; background: #b98352; border-radius: 4px; }
.pp-stamper-base { top: 58px; width: 66px; height: 24px; margin-left: -33px; border-radius: 6px; background: linear-gradient(#c7925f 0 55%, #2b2b2b 55%); }
.pp-scene.is-down .pp-stamper { opacity: 1; transform: translate(0, -14px) rotate(0deg); }
.pp-scene.is-press .pp-stamper { animation: pp-press .6s ease-in-out forwards; }
@keyframes pp-press {
  0% { transform: translate(0, -14px); }
  30% { transform: translate(0, 2px) scale(1.04, .9); }
  45% { transform: translate(0, 2px) scale(1.04, .9) rotate(-3deg); }
  60% { transform: translate(0, 2px) scale(1.04, .9) rotate(3deg); }
  75% { transform: translate(0, 2px) scale(1.04, .9) rotate(0deg); }
  100% { transform: translate(0, -2px) scale(1, 1); }
}
.pp-scene.is-up .pp-stamper { animation: none; transform: translate(-40px, -130px) rotate(-16deg); opacity: 0; transition: transform .5s cubic-bezier(.5, 0, .7, .4), opacity .45s .1s; }
/* ハンコの影：近づくほど濃く小さく。押しているあいだ、いちばん濃い */
.pp-shadow { position: absolute; width: 64px; height: 18px; margin: -6px 0 0 -32px; border-radius: 50%; background: rgba(40, 25, 10, .45); filter: blur(5px);
  opacity: 0; transform: scale(1.7); transition: opacity .55s, transform .55s; z-index: 3; }
.pp-scene.is-down .pp-shadow { opacity: .55; transform: scale(1.1); }
.pp-scene.is-press .pp-shadow { opacity: .8; transform: scale(.9); }
.pp-scene.is-up .pp-shadow { opacity: 0; transform: scale(1.8); }
/* 押したとき、スタンプのまわりにポンと広がる輪 */
.pp-ring { position: absolute; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 10px rgba(255, 220, 140, .8); opacity: 0; z-index: 3; pointer-events: none; }
.pp-scene.is-ink .pp-ring { animation: pp-ring .55s ease-out forwards; }
@keyframes pp-ring { 0% { opacity: .9; transform: scale(.5); } 100% { opacity: 0; transform: scale(1.6); } }
.pp-scene-text { opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; }
.pp-scene.is-done .pp-scene-text { opacity: 1; transform: none; }

/* ---- クリア：マイルが貯まる演出（app.js の showResult） ---- */
.mile-scene { text-align: center; }
.mile-card-wrap { position: relative; width: 250px; margin: 14px auto 6px; padding-top: 34px; }
.mile-card {
  position: relative; aspect-ratio: 1.6 / 1; border-radius: 14px; padding: 12px 14px; color: #fff; text-align: left;
  background: linear-gradient(135deg, #2f6fb0 0%, #4f9bd9 55%, #7cc3e8 100%);
  box-shadow: 0 6px 14px rgba(40, 80, 130, .3), inset 0 0 0 2px rgba(255, 255, 255, .25);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.mile-card::after { content: ""; position: absolute; inset: -40% -60%; background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .45) 50%, transparent 60%); transform: translateX(-60%); }
.mile-card.is-done::after { animation: mile-shine .9s ease-out; }
@keyframes mile-shine { to { transform: translateX(60%); } }
.mile-card-top { display: flex; justify-content: space-between; align-items: center; font-weight: 900; font-size: 13px; letter-spacing: .08em; }
.mile-card-chip { width: 30px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, #ffe08a, #e2b13c); box-shadow: inset 0 0 0 1px rgba(120, 80, 0, .35); }
.mile-card-name { font-size: 12px; opacity: .9; letter-spacing: .1em; }
.mile-card-bal { display: flex; align-items: baseline; gap: 6px; justify-content: flex-end; }
.mile-card-bal small { font-size: 11px; opacity: .9; }
.mile-card-bal b { font-size: 26px; font-variant-numeric: tabular-nums; }
.mile-card.is-done { animation: mile-bump .35s ease-out; }
@keyframes mile-bump { 50% { transform: scale(1.04); } }
/* ✈ のコイン：上から次々にカードへ飛びこむ */
.mile-coin {
  position: absolute; left: 50%; top: 0; width: 28px; height: 28px; margin-left: calc(-14px + var(--x)); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 14px; color: #8a5a00;
  background: radial-gradient(circle at 35% 30%, #fff3b8, #f6c531 60%, #d99a14); box-shadow: 0 2px 3px rgba(120, 80, 0, .3);
  opacity: 0; z-index: 2; animation: mile-coin .6s cubic-bezier(.5, 0, .7, 1) calc(.35s + var(--k) * .16s) both;
}
@keyframes mile-coin { 0% { opacity: 0; transform: translateY(-16px) scale(.6); } 20% { opacity: 1; transform: translateY(-6px) scale(1.1); } 100% { opacity: 0; transform: translateY(96px) scale(.7); } }
.mile-got { margin: 8px 0 2px; font-weight: 800; font-size: 16px; }
.mile-got b { font-size: 30px; color: var(--accent); font-variant-numeric: tabular-nums; }
.mile-detail { list-style: none; padding: 0; margin: 0 auto 6px; max-width: 250px; font-size: 12px; color: var(--ink-soft); }
.mile-detail li { display: flex; justify-content: space-between; padding: 1px 4px; }
/* 新しく解放された場所 */
.unlock-stage { width: 220px; height: 170px; }
.unlock-art { width: 200px; height: 150px; }
.unlock-art img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(120, 80, 40, .2)); }
/* ---- もらった物のポップアップ ---- */
.got-pop { text-align: center; }
.got-kicker { font-weight: 800; color: var(--accent); margin: 0 0 4px; animation: rise-in .4s ease-out both; }
.got-stage { position: relative; width: 170px; height: 170px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.got-rays { position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 214, 102, .55) 0 12deg, rgba(255, 214, 102, 0) 12deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: got-spin 8s linear infinite, got-fade .6s ease-out both; }
@keyframes got-spin { to { transform: rotate(360deg); } }
@keyframes got-fade { from { opacity: 0; } to { opacity: 1; } }
.got-art { position: relative; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; animation: got-pop .7s cubic-bezier(.3, 1.6, .5, 1) .15s both; }
.got-art .item-art { width: 100%; height: 100%; font-size: 80px; }
@keyframes got-pop { 0% { transform: scale(.1) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.got-flag { font-size: 80px; }
.got-name { margin: 6px 0 2px; animation: rise-in .4s ease-out .35s both; }
.got-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.6; animation: rise-in .4s ease-out .5s both; }
.tut-title { font-size: 20px !important; }
.tut-lines { list-style: none; padding: 0; margin: 12px 0 0; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.tut-lines li { background: #fff6ea; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.6; }
/* 特殊駒の作り方の図 */
.tut-demo { display: flex; align-items: flex-start; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.tut-demo > b { color: var(--ink-soft); font-size: 12px; margin-top: 8px; }
.tut-step { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 108px; }
.tut-step small { flex-basis: 100%; font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-top: 4px; }
.tut-piece { position: relative; width: 22px; height: 22px; border-radius: 50%; overflow: hidden; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.tut-piece.is-special { width: 30px; height: 30px; box-shadow: 0 0 0 2px #fff, 0 0 8px 2px var(--gold); }
.tut-piece.is-special::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255, 255, 255, .6) 5px 8px); }
.tut-piece.is-bomb { width: 30px; height: 30px; box-shadow: 0 0 0 2px #fff, 0 0 8px 2px var(--gold); }
.tut-piece.is-bomb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #fff 0 16%, rgba(255, 255, 255, .55) 17% 34%, transparent 35% 52%, rgba(255, 255, 255, .5) 53% 62%, transparent 63%); }
.tut-burst { width: 44px; height: 44px; border-radius: 30%; background: radial-gradient(circle, #fff7c2 0 30%, #ffd76e 55%, transparent 72%); }
.tut-beam { width: 84px; height: 22px; border-radius: 11px; background: linear-gradient(90deg, rgba(255, 240, 150, .2), #ffe066, rgba(255, 240, 150, .2)); box-shadow: 0 0 10px 2px rgba(244, 182, 63, .6); margin-top: 4px; }

/* ============ スタンプの演出 ============ */
.stamp-scene {
  background-color: #fbf6e9;
  background-image: repeating-radial-gradient(circle at 50% 120%, transparent 0 14px, rgba(31, 58, 95, .05) 14px 15px);
  border: 6px solid #1f3a5f; border-radius: 14px; padding: 12px; margin-bottom: 14px; color: #2e3a4a; text-align: left;
}
.stamp-scene-pad { display: flex; align-items: center; justify-content: center; min-height: 168px; }
/* 上から「ポン」と押されて、少しはずむ */
.stamp-press { animation: stampPress .7s cubic-bezier(.2, .9, .3, 1.2) .35s both; }
@keyframes stampPress {
  0% { transform: scale(3); opacity: 0; }
  55% { transform: scale(.9); opacity: 1; }
  75% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .stamp-press { animation: none; } }

/* ============ パソコン（横長の広い画面）用のレイアウト ============
 * スマホ・タブレット縦持ちは上の指定のまま。幅が広く横向きのときだけ、ここで並べ方を変える。
 * （スマホを横にしたときは高さが足りないので対象外）
 */
@media (min-width: 900px) and (min-height: 560px) and (orientation: landscape) {
  #app:has(.map-screen), #app:has(.room-screen), #app:has(.puzzle) { max-width: 1080px; }
  #app:has(.food-list), #app:has(.passport) { max-width: 820px; }

  /* ----- 旅行マップ：左にボタン、真ん中にマップ、右に凡例と「次はどこに行こう？」 ----- */
  .map-screen {
    padding-bottom: 24px;
    display: grid; grid-template-columns: 210px minmax(0, 460px) 250px; justify-content: center; gap: 0 24px;
  }
  .map-screen > .player-bar, .map-screen > .warn, .map-screen > .complete-banner { grid-column: 1 / -1; }
  .map-screen > .map { grid-column: 2; grid-row: 4; }
  .map-screen > .map-legend {
    grid-column: 3; grid-row: 4; align-self: start; position: sticky; top: 16px;
    flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; margin: 0;
    background: #fffaf0; box-shadow: var(--shadow); font-size: 13px;
  }
  .map-dock { display: contents; }
  .map-dock .next-card {
    grid-column: 3; grid-row: 4; align-self: start; position: sticky; top: 190px; margin: 0;
  }
  .map-dock .next-text b { white-space: normal; font-size: 14px; }
  .map-dock .dock-row {
    grid-column: 1; grid-row: 4; align-self: start; position: sticky; top: 16px;
    grid-template-columns: 1fr; gap: 10px;
  }
  .map-dock .dock-btn { flex-direction: row; gap: 10px; font-size: 15px; min-height: 60px; }

  /* ----- 自分の部屋：左に部屋、右にボタン ----- */
  .room-screen { display: grid; grid-template-columns: minmax(0, auto) 320px; justify-content: center; gap: 0 32px; }
  .room-screen > .player-bar, .room-screen > .warn, .room-screen > .room-title { grid-column: 1 / -1; }
  .room-screen > .room-scene { grid-column: 1; grid-row: 4; width: min(560px, calc(100vh - 190px)); }
  .room-screen > .room-note { grid-column: 1; grid-row: 5; }
  .room-screen > .room-actions { grid-column: 2; grid-row: 4; align-self: center; margin: 0; }
  .room-screen > .dev-tools { grid-column: 2; grid-row: 5; margin: 0; }
  .room-screen > .room-foot { grid-column: 1 / -1; grid-row: 6; }
  .room-sub { grid-template-columns: 1fr; }
  .room-sub .menu-btn { font-size: 15px; padding: 10px; }

  /* ----- パズル：左に目標と残り手数、右に盤面 ----- */
  .puzzle {
    display: grid; grid-template-columns: 300px min(600px, calc(100vh - 60px)); grid-template-rows: auto 1fr;
    justify-content: center; gap: 16px 28px; align-items: start;
  }
  .puzzle > .hud { grid-column: 1; grid-row: 1; padding: 16px; }
  .puzzle > .board-wrap { grid-column: 2; grid-row: 1 / 3; }
  .puzzle > .puzzle-footer { grid-column: 1; grid-row: 2; }
  .hud-row { flex-direction: column; align-items: stretch; }
  .hud-moves { border-right: none; border-bottom: 2px dashed var(--line); padding: 0 0 10px; }
  .hud-moves-val { font-size: 40px; }
  .hud-goals { flex-direction: column; gap: 10px; }

  /* ----- 食事・お土産屋：商品を2列に ----- */
  .food-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .bottom-actions { max-width: 400px; margin-left: auto; margin-right: auto; }

  /* ----- パスポート：幅を広げる ----- */
  .collection-grid { grid-template-columns: repeat(8, 1fr); }
  .pp-stages { grid-template-columns: repeat(5, 1fr); }
}
