/* Windows では国旗の絵文字が表示されないため、国旗だけ Twemoji フォントで補う */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
  src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.8/dist/TwemojiCountryFlags.woff2") format("woff2");
  font-display: swap;
}

/* ───────── デザイントークン ───────── */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efeae2;
  --text: #1f2a2e;
  --muted: #66727a;
  --line: #e2dcd2;
  --primary: #0b7a75;
  --primary-ink: #ffffff;
  --accent: #e4572e;
  --up: #1f8a4c;
  --down: #c0392b;
  --warn: #c0392b;
  --shadow: 0 6px 20px rgba(31, 42, 46, .08);
  --radius: 16px;
  --hud-h: 64px;
  --space: #02040b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181b;
    --surface: #1b2428;
    --surface-2: #232e33;
    --text: #e9eef0;
    --muted: #9aa8af;
    --line: #2d3a40;
    --primary: #2bb3a9;
    --primary-ink: #06201e;
    --accent: #ff7a50;
    --up: #4cc27f;
    --down: #ff6b5b;
    --warn: #ff6b5b;
    --shadow: 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Twemoji Country Flags", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: var(--primary); }
.hidden { display: none; }

/* ───────── 地球儀（背面に常駐） ───────── */
.world {
  position: fixed; inset: 0; z-index: 0;
  display: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent 60%),
    radial-gradient(1px 1px at 72% 12%, #fff9, transparent 60%),
    radial-gradient(1.5px 1.5px at 38% 72%, #fff7, transparent 60%),
    radial-gradient(1px 1px at 88% 64%, #fff8, transparent 60%),
    radial-gradient(1px 1px at 22% 88%, #fff6, transparent 60%),
    radial-gradient(1.5px 1.5px at 55% 35%, #fff5, transparent 60%),
    radial-gradient(1px 1px at 92% 92%, #fff7, transparent 60%),
    radial-gradient(ellipse at 50% 120%, #0b2350 0%, var(--space) 60%);
}
.world-on { background: var(--space); }
.world-on .world { display: block; }
.world-on .screen { position: relative; z-index: 1; pointer-events: none; max-width: none; padding: 0; }
.world-on .screen > * { pointer-events: auto; }
.world-on .hud {
  background: linear-gradient(rgba(2, 4, 11, .6), transparent);
  border-bottom: 0; backdrop-filter: none; color: #fff;
}
.world-on .hud .brand small, .world-on .hud-place span { color: rgba(255, 255, 255, .75); }
.world-on .stat { background: rgba(0, 0, 0, .45); color: #fff; }
.world-on .hud-menu { background: rgba(0, 0, 0, .45); border-color: transparent; color: #fff; }
.maplibregl-ctrl-attrib { font-size: 10px; }

.world-title {
  position: fixed; left: 0; right: 0; top: calc(var(--hud-h) + 8px);
  padding: 0 20px; color: #fff; text-align: center; pointer-events: none !important;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .7);
}
.world-title h1 { margin: 0; font-size: clamp(30px, 7vw, 52px); line-height: 1.25; }
.world-title p { margin: 4px 0 0; opacity: .9; }
.world-title .eyebrow { color: #8ff3e9; }

/* 地図の上に重なるパネル（スマホは下から、PCは左側） */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  max-height: 58vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
  animation: sheet-up .45s cubic-bezier(.2, .8, .2, 1) both;
}
.sheet::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 4px;
  background: var(--line); margin: -6px auto 10px;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .stack { margin: 8px 0 12px; }
.sub { margin: 0 0 12px; font-size: 14px; color: var(--muted); }

/* 地球儀上のマーカー */
.globe-marker {
  border: 0; background: none; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .9);
  transition: transform .15s ease;
}
.globe-marker:hover { transform: scale(1.15); }
.globe-marker span { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
.globe-marker small { font-size: 11px; font-weight: 700; white-space: nowrap; }
.globe-marker.spot span { font-size: 22px; }
.globe-marker.pin { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .3); }
.globe-marker.pin.from { background: #2bd4c5; }
.globe-marker.pin.to { background: #ff7a50; }
.map-vehicle { font-size: 34px; line-height: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6)); }

/* ───────── HUD（上部バー） ───────── */
.hud {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--hud-h);
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.world-on .hud { position: fixed; left: 0; right: 0; }
.brand { font-weight: 800; font-size: 18px; display: flex; align-items: baseline; gap: 8px; }
.brand small { font-weight: 500; font-size: 12px; color: var(--muted); }
.hud-place { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.hud-place b { font-size: 15px; white-space: nowrap; }
.hud-place span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hud-stats { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.stat {
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stat.warn { color: var(--warn); }
.hud-menu {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer; flex-shrink: 0;
}

/* ───────── 画面 ───────── */
.screen {
  max-width: 640px; margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom));
}
/* fill-mode を backwards にして、終了後に transform が残らないようにする
   （残ると .screen が position:fixed の基準になり、地図上のパネルがずれる） */
.fade-in { animation: fade .35s ease backwards; }
.world-on .screen.fade-in { animation: none; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.h { font-size: 24px; line-height: 1.35; margin: 4px 0 12px; }
.h3 { font-size: 16px; margin: 24px 0 10px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--primary); }
.lead { font-size: 15px; margin: 8px 0 16px; }
.hint { background: var(--surface-2); padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.center { text-align: center; }
.big-icon { font-size: 64px; text-align: center; line-height: 1.2; margin: 16px 0 4px; }
.shake { animation: shake .6s ease both; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: rotate(-8deg) scale(1.1); }
  40% { transform: rotate(8deg) scale(1.1); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
}

/* ───────── ボタン ───────── */
.btn {
  display: block; width: 100%;
  padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.big { padding: 16px; font-size: 17px; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { color: var(--down); margin-top: 32px; }
.btn + .btn { margin-top: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.stack .btn + .btn { margin-top: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.row .btn + .btn { margin-top: 0; }
.back {
  background: none; border: 0; padding: 4px 0; margin-bottom: 4px;
  color: var(--muted); font-size: 14px; cursor: pointer;
}

/* ───────── 写真 ───────── */
.ph {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 35%, var(--surface-2)), color-mix(in srgb, var(--accent) 30%, var(--surface-2)));
  display: grid; place-items: center;
}
.ph img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .5s ease;
}
.ph.loaded img { opacity: 1; }
.ph-emoji { font-size: 40px; }
.ph.loaded .ph-emoji { visibility: hidden; }
.ph.thumb { aspect-ratio: 4 / 3; }
.ph-credit {
  position: absolute; right: 8px; bottom: 6px; z-index: 3; max-width: 70%;
  font-size: 10px; color: #fff; background: rgba(0, 0, 0, .45);
  padding: 1px 6px; border-radius: 6px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ───────── 観光地：全画面スライドショー ───────── */
.scene {
  position: relative; overflow: hidden; cursor: pointer;
  margin: -16px -16px 0; height: 62vh; min-height: 360px;
  background: #111;
}
.scene.full { height: calc(100svh - var(--hud-h)); max-height: 820px; }
.scene-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.scene-stage .ph-emoji { font-size: 80px; opacity: .6; }
.scene.loaded .scene-stage .ph-emoji { display: none; }
.scene-stage img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.6s ease;
}
.scene-stage img.on { opacity: 1; }
/* ゆっくりズーム・パン（Ken Burns） */
.kb { animation: 14s ease-out both; }
.kb-0 { animation-name: kb0; } .kb-1 { animation-name: kb1; } .kb-2 { animation-name: kb2; } .kb-3 { animation-name: kb3; }
@keyframes kb0 { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.18) translate(-3%, -2%); } }
@keyframes kb1 { from { transform: scale(1.18) translate(3%, 2%); } to { transform: scale(1.04) translate(0, 0); } }
@keyframes kb2 { from { transform: scale(1.05) translate(-2%, 2%); } to { transform: scale(1.2) translate(2%, -1%); } }
@keyframes kb3 { from { transform: scale(1.2) translate(-2%, -2%); } to { transform: scale(1.06) translate(2%, 1%); } }
@media (prefers-reduced-motion: reduce) { .kb { animation: none; } }

.scene-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, .35), transparent 22%, transparent 50%, rgba(0, 0, 0, .78));
}
/* 時間帯で光の色が変わる */
.scene.tod-morning .scene-shade { background: linear-gradient(rgba(255, 190, 120, .25), transparent 30%, transparent 50%, rgba(0, 0, 0, .75)); }
.scene.tod-evening .scene-shade { background: linear-gradient(rgba(255, 120, 40, .35), rgba(255, 90, 40, .12) 40%, rgba(40, 0, 30, .8)); }
.scene.tod-night .scene-shade { background: linear-gradient(rgba(5, 10, 40, .55), rgba(10, 20, 70, .35) 40%, rgba(0, 0, 10, .88)); }
.scene-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 20px 20px 34px; color: #fff; pointer-events: none;
}
.scene-overlay h1 { margin: 2px 0 6px; font-size: clamp(28px, 7vw, 44px); line-height: 1.2; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.scene-overlay .eyebrow { color: #fff; opacity: .9; }
.ambience { margin: 0; font-size: 14px; opacity: .92; font-style: italic; max-width: 36em; }
.scene-dots { position: absolute; left: 0; right: 0; bottom: 12px; z-index: 2; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.scene-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.scene-dots i.on { background: #fff; }
.scene-credit .ph-credit { bottom: auto; top: calc(8px); right: 8px; }
.after-scene { padding-top: 4px; }
.look-row { margin-top: 16px; }

/* ───────── 一人称のファインダー ───────── */
.viewfinder {
  position: relative; overflow: hidden; border-radius: 14px;
  aspect-ratio: 4 / 3; background: #0d0d0d; margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.vf-photo { position: absolute; inset: 0; display: grid; place-items: center; }
.vf-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(10px) brightness(.85); transform: scale(1.08);
  animation: handheld 3s ease-in-out infinite;
  transition: filter .6s ease, transform .8s ease;
}
.viewfinder.shot .vf-photo img { filter: none; transform: scale(1); animation: none; }
@keyframes handheld { 0%, 100% { translate: 0 0; } 33% { translate: -4px 2px; } 66% { translate: 3px -2px; } }
.vf-wait { color: #fff; font-size: 48px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vf-wait small { font-size: 12px; opacity: .7; animation: blink 1s steps(2) infinite; }
.viewfinder.loaded .vf-wait, .viewfinder.shot .vf-wait { display: none; }
.viewfinder.noimg .vf-wait { display: flex; }
.viewfinder.noimg .vf-wait small { display: none; }
.vf-ui { position: absolute; inset: 14px; pointer-events: none; transition: opacity .5s ease; }
.viewfinder.shot .vf-ui { opacity: 0; }
.vf-c { position: absolute; width: 26px; height: 26px; border: 3px solid rgba(255, 255, 255, .9); }
.vf-c.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.vf-c.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.vf-c.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.vf-c.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.vf-focus {
  position: absolute; left: 50%; top: 50%; width: 70px; height: 52px; translate: -50% -50%;
  border: 2px solid #ffd54a; border-radius: 4px; animation: focus 1.2s ease-in-out infinite;
}
@keyframes focus { 50% { scale: .85; border-color: #8cff6a; } }
.vf-rec { position: absolute; top: 4px; left: 36px; color: #ff4d4d; font-size: 12px; font-weight: 800; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.vf-stamp {
  position: absolute; right: 12px; bottom: 10px; z-index: 2;
  font: 700 13px/1 ui-monospace, "Consolas", monospace; color: #ffb347;
  text-shadow: 0 0 4px rgba(0, 0, 0, .8); letter-spacing: .04em;
  opacity: 0; transition: opacity .4s ease .3s;
}
.viewfinder.shot .vf-stamp { opacity: 1; }
.viewfinder .ph-credit { top: 8px; bottom: auto; opacity: 0; transition: opacity .4s ease .5s; }
.viewfinder.shot .ph-credit { opacity: 1; }
.vf-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.viewfinder.shot .vf-flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.exp .h { margin-top: 0; }

/* ───────── 全画面ビューア（周りを見渡す） ───────── */
.viewer { position: fixed; inset: 0; z-index: 120; background: #000; color: #fff; animation: fade .2s ease both; }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.viewer-stage img { width: 100%; height: 100%; object-fit: contain; animation: fade .3s ease both; }
.viewer-stage .ph-emoji { font-size: 64px; }
.viewer-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: linear-gradient(rgba(0, 0, 0, .7), transparent);
}
.viewer-top span { font-size: 13px; opacity: .8; }
.viewer-top button { margin-left: auto; background: rgba(255, 255, 255, .15); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.viewer-nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 48px; height: 64px; border: 0;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 36px; cursor: pointer;
}
.viewer-nav.prev { left: 0; border-radius: 0 12px 12px 0; }
.viewer-nav.next { right: 0; border-radius: 12px 0 0 12px; }
.viewer-credit .ph-credit { position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); right: 12px; top: auto; }

/* ───────── タイトル・国選択 ───────── */
.howto-box summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); padding: 4px 0; }
.howto { list-style: none; counter-reset: step; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.howto li {
  counter-increment: step; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px 10px 50px; display: flex; flex-direction: column;
}
.howto li::before {
  content: counter(step); position: absolute; left: 12px; top: 12px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.howto span { font-size: 13px; color: var(--muted); }
.disclaimer { font-size: 11px; color: var(--muted); margin-top: 12px; }

.country-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 10px;
  overflow-x: auto; padding: 12px 2px 6px; scroll-snap-type: x mandatory;
}
.country-row .country-card { scroll-snap-align: start; }
.album-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.country-card, .album-card {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 0; overflow: hidden; cursor: pointer; text-align: left;
  box-shadow: var(--shadow); transition: transform .12s ease;
}
.country-card:active, .album-card:active { transform: scale(.97); }
.cc-body { padding: 8px 10px 10px; display: flex; flex-direction: column; line-height: 1.4; }
.cc-body small { color: var(--muted); font-size: 12px; }
.cc-body em { font-style: normal; font-size: 11px; color: var(--accent); }

.roulette { text-align: center; padding: 32px 16px; }
.roulette-flag { font-size: 96px; line-height: 1.2; }
.roulette-flag.pop { animation: pop .5s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
.roulette-name { font-size: 20px; font-weight: 800; margin-top: 8px; }

/* ───────── 旅の設定 ───────── */
.mini-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.mini-gallery .ph { border-radius: 8px; aspect-ratio: 1; }
.mini-gallery .ph-emoji { font-size: 24px; }
.facts { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0; }
.facts div { display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; background: var(--surface); padding: 6px 12px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.seg button {
  padding: 10px 0; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; cursor: pointer;
}
.seg button.on { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
section > .btn.big:last-child { margin-top: 24px; }

/* ───────── 選択肢 ───────── */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 12px; align-items: stretch; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .15s ease;
}
.choice:hover:not(:disabled) { border-color: var(--primary); }
.choice:active:not(:disabled) { transform: scale(.98); }
.choice:disabled { opacity: .45; cursor: not-allowed; }
.choice.special { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.choice-body { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.5; }
.choice-body b { font-size: 15px; }
.choice-body p { margin: 2px 0; font-size: 13px; color: var(--muted); }
.choice-body small { font-size: 12px; color: var(--muted); }
.spot-choice, .food { padding: 8px; }
.spot-choice .ph.thumb, .food .ph.thumb { width: 112px; flex-shrink: 0; border-radius: 10px; aspect-ratio: 1; }
.spot-choice .ph-emoji, .food .ph-emoji { font-size: 32px; }

/* ───────── 結果 ───────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 20px; }
.chip { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.chip.up { color: var(--up); }
.chip.down { color: var(--down); }

/* ───────── 移動演出 ───────── */
.travel-sheet { max-height: 48vh; }
.legs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.leg { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 700; }
.leg small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.arrow { color: var(--muted); }
.route { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.route span:last-child { text-align: right; }
.progress { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); margin: 18px 16px 6px; }
.progress .bar { height: 100%; width: 0; border-radius: inherit; background: var(--primary); }
.progress .vehicle { position: absolute; top: 50%; left: 0; transform: translate(-50%, -60%); font-size: 26px; }
.clock { text-align: center; font-variant-numeric: tabular-nums; margin: 12px 0 0; }
.clock b { font-size: 20px; }
.note { text-align: center; font-size: 11px; color: var(--muted); margin: 2px 0 8px; }
.arrived { text-align: center; font-weight: 800; font-size: 18px; color: var(--primary); margin: 0 0 10px; }
.actions { margin-top: 10px; }

/* ───────── イベント ───────── */
.event { text-align: center; }
.event .lead { text-align: left; }
.event .choices { text-align: left; }
.event .chips { justify-content: center; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 999px;
  background: var(--surface-2);
}
.type-disaster .badge { background: #fde2d6; color: #9a3412; }
.type-crime .badge { background: #fde0e0; color: #9b1c1c; }
.type-disease .badge { background: #f3e8ff; color: #6b21a8; }
.type-people .badge { background: #dcfce7; color: #166534; }
.type-luck .badge { background: #fef9c3; color: #854d0e; }
.type-trouble .badge { background: #e0f2fe; color: #075985; }

.tip, .info-box {
  background: var(--surface); border: 1px dashed var(--line); border-radius: 12px;
  padding: 12px; font-size: 13px; margin: 16px 0; text-align: left;
}
.info-box ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 2px; }

/* ───────── 旅日記 ───────── */
.diary .eyebrow { text-align: center; font-size: 14px; }
.polaroids { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 16px 0 8px; min-height: 20px; }
.polaroid {
  margin: 0 -6px; width: 128px; background: #fff; padding: 6px 6px 4px; border-radius: 2px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}
.polaroid .ph { aspect-ratio: 1; }
.polaroid figcaption { font-size: 10px; color: #444; text-align: center; padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.polaroid.p0 { rotate: -5deg; } .polaroid.p1 { rotate: 3deg; translate: 0 6px; } .polaroid.p2 { rotate: -2deg; } .polaroid.p3 { rotate: 6deg; translate: 0 4px; }
.diary-page {
  margin: 16px 0; padding: 18px 20px; border-radius: 6px;
  background:
    repeating-linear-gradient(transparent 0 31px, color-mix(in srgb, var(--primary) 18%, transparent) 31px 32px),
    color-mix(in srgb, #fffaf0 88%, var(--surface));
  color: #3a3226; line-height: 32px; font-size: 15px;
  box-shadow: var(--shadow);
}
.diary-page p { margin: 0; }
.diary-meta { font-weight: 700; color: var(--primary) !important; }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.review p { margin: 4px 0 0; font-size: 14px; }
.stars { color: #f5a623; letter-spacing: 2px; }
.stars small { color: var(--muted); margin-left: 6px; letter-spacing: 0; }

/* ───────── まとめ ───────── */
.summary { text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat-grid div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; display: flex; flex-direction: column; }
.stat-grid b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 11px; color: var(--muted); }
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 8px 0; scroll-snap-type: x mandatory; }
.strip .ph.thumb { width: 96px; flex-shrink: 0; border-radius: 10px; scroll-snap-align: start; }
.cta-box {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: var(--radius); padding: 16px; margin: 20px 0;
}
.cta-box h3 { margin: 0 0 4px; }
.cta-box p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }

/* ───────── アフィリエイト・広告 ───────── */
.aff-links { display: grid; gap: 8px; margin-top: 8px; }
.aff-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); font-weight: 700; font-size: 14px; text-decoration: none; color: var(--text);
}
.aff-link.is-empty { opacity: .6; }
.aff-link small { font-weight: 500; font-size: 11px; color: var(--muted); }
.aff-note { font-size: 10px; color: var(--muted); margin: 6px 0 0; }
.ad-slot { margin: 16px auto; max-width: 100%; }
.ad-placeholder {
  display: grid; place-items: center;
  border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 11px;
  background: repeating-linear-gradient(45deg, transparent 0 10px, var(--surface-2) 10px 20px);
}
.ad-banner.ad-placeholder { height: 60px; }
.ad-rect.ad-placeholder { height: 120px; }

/* ───────── アルバム ───────── */
.day-head { border-bottom: 2px solid var(--primary); padding-bottom: 4px; }
.memories { display: grid; gap: 10px; }
.memory {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px;
}
.photo-mem { cursor: pointer; }
.photo-mem .ph.thumb { width: 96px; flex-shrink: 0; border-radius: 8px; aspect-ratio: 1; }
.memory b { font-size: 14px; }
.memory p { margin: 2px 0; font-size: 12px; color: var(--muted); }
.memory small { font-size: 11px; color: var(--muted); }
.mem-diary { font-style: italic; }
.kind-stay { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.event-mem { background: var(--surface-2); }
.mem-icon { font-size: 28px; width: 40px; text-align: center; flex-shrink: 0; }

/* ───────── モーダル ───────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px;
  animation: fade .2s ease both;
}
.modal-card {
  width: min(400px, 100%); background: var(--bg); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 12px; }
.lb-card { width: min(720px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: var(--radius); }
.lb-photo .ph { aspect-ratio: 4 / 3; }
.lb-photo .ph-emoji { font-size: 64px; }
.lb-body { padding: 12px 16px 0; }
.lb-body p { margin: 4px 0; font-size: 14px; color: var(--muted); }
.lb-body small { color: var(--muted); }
.lb-card .btn { margin: 12px 16px 16px; width: calc(100% - 32px); }

/* ───────── HUD のアイコン ───────── */
.hud-right { margin-left: auto; }
.hud-icon {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.world-on .hud-icon { background: rgba(0, 0, 0, .45); border-color: transparent; }
.lc { font-size: .85em; color: var(--muted); font-weight: 500; }

/* ───────── 国選び：絞り込み ───────── */
.count { font-size: 13px; color: var(--muted); font-weight: 500; }
.fchips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.fchip {
  flex-shrink: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.fchip.on { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.country-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.select-sheet { max-height: 64vh; }
.tags { font-size: 13px; letter-spacing: 2px; }
.globe-marker.flag span { font-size: 24px; }
.globe-marker.trail span { font-size: 20px; }
.globe-marker.trail small { background: rgba(0, 0, 0, .55); padding: 0 6px; border-radius: 6px; }

/* ───────── 豆知識・会話帳 ───────── */
.trivia-card {
  margin: 16px 0 0; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, #f5a623 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #f5a623 35%, var(--line));
}
.trivia-card b { font-size: 13px; }
.trivia-card p { margin: 4px 0 0; font-size: 14px; }
.link { background: none; border: 0; padding: 4px 0 0; color: var(--primary); font-weight: 700; font-size: 13px; cursor: pointer; }
.trivia-inline {
  display: block; margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, #f5a623 12%, var(--surface));
}
.phrases { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 12px; }
.phrases div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; background: var(--surface); padding: 6px 12px; font-size: 13px; }
.phrases dt { color: var(--muted); }
.phrases dd { margin: 0; font-weight: 700; }
.mem-trivia { color: color-mix(in srgb, #b7791f 80%, var(--text)) !important; }

/* ───────── まとめ（地図の上） ───────── */
.summary-sheet { max-height: 62vh; }
.souvenirs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.souvenir { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.souvenir .ph { border-radius: 10px; aspect-ratio: 1; }
.souvenir .ph-emoji { font-size: 28px; }
.souvenir small { color: var(--muted); font-size: 11px; }
.kind-buy { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }

/* 写真が見つからないときのイメージ画像 */
.ph-illust {
  position: absolute; left: 8px; top: 8px; z-index: 3;
  font-size: 10px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .5);
  padding: 1px 7px; border-radius: 6px; pointer-events: none;
}
.viewfinder .ph-illust { top: 10px; left: auto; right: 10px; }

/* 料理の「〇〇の名物」タグ */
.food-tag { color: var(--accent) !important; font-weight: 700; }

/* ───────── 実際の発生頻度 ───────── */
.stat-box {
  text-align: left; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line));
}
.stat-box b { font-size: 13px; }
.stat-box p { margin: 4px 0 0; font-size: 13px; }
.stat-box small { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ───────── 写真のクレジット ───────── */
.page-foot { text-align: center; padding: 28px 0 8px; }
.page-foot .link { font-size: 12px; color: var(--muted); font-weight: 500; }
.disclaimer .link { font-size: inherit; padding: 0; }
.credits-card { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; }
.credit-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.credit-list li { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.credit-list img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: var(--surface-2); }
.credit-list span { display: flex; flex-direction: column; min-width: 0; }
.credit-list small { color: var(--muted); }
.credit-list b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ───────── PC向け ───────── */
@media (min-width: 720px) {
  .screen { max-width: 760px; padding-top: 24px; }
  .album-grid { grid-template-columns: repeat(3, 1fr); }
  .food-grid { grid-template-columns: 1fr 1fr; }
  .food-grid .food { flex-direction: column; }
  .food-grid .food .ph.thumb { width: 100%; aspect-ratio: 4 / 3; }
  .scene { margin: -24px calc(50% - 50vw) 0; }
  .scene-overlay { padding: 32px max(24px, calc(50vw - 360px)) 40px; }
}
@media (min-width: 900px) {
  .sheet {
    left: 20px; right: auto; top: calc(var(--hud-h) + 12px); bottom: 20px; width: 400px;
    max-height: none; border-radius: 20px; animation-name: sheet-left;
  }
  .sheet::before { display: none; }
  .travel-sheet { top: auto; max-height: none; }
  .select-sheet, .summary-sheet { max-height: none; width: 440px; }
  .world-title { left: 440px; text-align: left; top: auto; bottom: 40px; }
  @keyframes sheet-left { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
}
/* スマホ・タブレット：タイトルと移動演出以外のパネルは全画面（地図は背景に回る） */
@media (max-width: 899px) {
  .sheet:not(.title-sheet):not(.travel-sheet) {
    top: 0; max-height: none; border-radius: 0;
    padding-top: calc(var(--hud-real, var(--hud-h)) + 12px);
    background: var(--bg); backdrop-filter: none;
  }
  .sheet:not(.title-sheet):not(.travel-sheet)::before { display: none; }
  .title-sheet { max-height: 58dvh; }
  .travel-sheet { max-height: 48dvh; }
}
@media (max-width: 380px) {
  .hud-place span { display: none; }
  .spot-choice .ph.thumb, .food .ph.thumb { width: 88px; }
}
