/* KAKOMI — モバイルゲームの定番に沿ったUI（太い輪郭線・ベタ塗り・押し込める立体ボタン） */
:root {
  --ink: #1b2238;          /* 輪郭線・影 */
  --navy: #2c3a63;
  --navy-2: #24304f;
  --paper: #f3f5fb;        /* パネルの中身 */
  --paper-2: #e2e7f3;
  --text: #1b2238;
  --muted: #6b7591;
  --yellow: #ffc928; --yellow-d: #d9960a;
  --green: #4bd25f;  --green-d: #2c9a3f;
  --blue: #3e8cff;   --blue-d: #2560c4;
  --red: #ff5a5a;    --red-d: #c6383d;
  --purple: #8a63ff; --purple-d: #5f3fd0;
  --gray: #8a94ad;   --gray-d: #5d6680;
  --me: #ff3b5c;
  --font: "M PLUS Rounded 1c", system-ui, sans-serif;
  --logo: "Dela Gothic One", "M PLUS Rounded 1c", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #cfd6e4; color: var(--text); font-family: var(--font); font-weight: 800; }
/* スマホで画面全体が引っ張られて動かないよう固定する */
body { position: fixed; inset: 0; touch-action: manipulation; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
/* 縁取り文字（ゲームのボタンや数字の定番） */
.stroke { -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }

#map { position: absolute; inset: 0; }
/* 地図の出典は画面のいちばん下に1行で常に表示する */
.maplibregl-ctrl-bottom-right { right: 0; bottom: 0; left: 0; z-index: 11; display: flex; justify-content: center; padding-bottom: var(--safe-b); pointer-events: none; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin: 0; padding: 1px 8px; border-radius: 6px 6px 0 0; background: rgba(255, 255, 255, .75);
  font-size: 9px; font-weight: 500; line-height: 1.5; white-space: nowrap; pointer-events: auto; }

.hud { position: absolute; z-index: 10; }

/* ---------- ボタン ---------- */
.btn { --c: var(--gray); --d: var(--gray-d);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; padding: 0 18px; width: 100%;
  border: 3px solid var(--ink); border-radius: 14px; background: var(--c); color: #fff; font-size: 18px; font-weight: 900; text-decoration: none;
  box-shadow: inset 0 -6px 0 var(--d), inset 0 3px 0 rgba(255, 255, 255, .35), 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s; }
.btn:active { transform: translateY(3px); box-shadow: inset 0 -3px 0 var(--d), inset 0 3px 0 rgba(255, 255, 255, .35), 0 1px 0 var(--ink); }
.btn i { font-size: 20px; }
.btn .stroke { -webkit-text-stroke-width: 4px; }
.btn-yellow { --c: var(--yellow); --d: var(--yellow-d); }
.btn-green { --c: var(--green); --d: var(--green-d); }
.btn-blue { --c: var(--blue); --d: var(--blue-d); }
.btn-red { --c: var(--red); --d: var(--red-d); }
.btn-dark { --c: #2b2f3a; --d: #14171e; }
.btn-lg { min-height: 60px; font-size: 22px; }
.btn-sm { min-height: 44px; width: auto; padding: 0 14px; font-size: 14px; border-radius: 12px; }

.c-yellow { --c: var(--yellow); --d: var(--yellow-d); }
.c-green { --c: var(--green); --d: var(--green-d); }
.c-blue { --c: var(--blue); --d: var(--blue-d); }
.c-red { --c: var(--red); --d: var(--red-d); }
.c-purple { --c: var(--purple); --d: var(--purple-d); }
.c-gray { --c: var(--gray); --d: var(--gray-d); }
.c-white { --c: #fff; --d: #c9d1e3; }

/* ---------- 上部HUD ---------- */
#top { top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; gap: 10px; align-items: flex-start; }
.profile { display: flex; align-items: center; flex: 1; min-width: 0; text-align: left; }
.lvbadge { position: relative; z-index: 1; flex: none; width: 54px; height: 58px; display: grid; place-content: center; text-align: center; line-height: .9; color: #fff;
  background: var(--purple); border: 3px solid var(--ink); clip-path: polygon(50% 0, 100% 22%, 100% 74%, 50% 100%, 0 74%, 0 22%);
  box-shadow: inset 0 -6px 0 var(--purple-d); }
.lvbadge::before { content: ""; position: absolute; inset: -3px; z-index: -1; background: var(--ink); clip-path: inherit; }
.lvbadge small { font-size: 11px; }
.lvbadge b { font-size: 22px; font-weight: 900; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.plate { margin-left: -10px; padding: 5px 10px 7px 18px; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px;
  background: var(--navy); border: 3px solid var(--ink); border-radius: 0 12px 12px 0; box-shadow: 0 3px 0 var(--ink); color: #fff; }
.plate-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
#rankTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.streak { flex: none; display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; border-radius: 99px; background: #ff7a1a; border: 2px solid var(--ink); font-size: 11px; }
.xpbar { height: 10px; border-radius: 99px; background: var(--ink); padding: 2px; }
.xpbar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--yellow); box-shadow: inset 0 -2px 0 var(--yellow-d); transition: width .8s cubic-bezier(.2, .9, .3, 1.2); }

.resource { flex: none; display: flex; align-items: center; margin-top: 6px; }
.res-icon { position: relative; z-index: 1; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; font-size: 22px; color: #fff;
  background: var(--me); border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); }
.res-body { margin-left: -14px; padding: 3px 12px 3px 20px; min-width: 110px; background: var(--ink); border-radius: 0 10px 10px 0; color: #fff; display: flex; flex-direction: column; }
.res-body b { font-size: 17px; font-weight: 900; line-height: 1.2; }
.res-body small { font-size: 10px; color: var(--yellow); }

#ticker { top: calc(80px + var(--safe-t)); left: 10px; max-width: calc(100% - 84px); display: flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 8px; border-radius: 99px; background: rgba(27, 34, 56, .85); color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; }
#ticker > i { color: var(--red); font-size: 16px; flex: none; }
#tickerText { overflow: hidden; text-overflow: ellipsis; transition: opacity .3s, transform .3s; }
#tickerText.out { opacity: 0; transform: translateY(-6px); }

/* ---------- 右の丸ボタン ---------- */
#side { right: 10px; top: calc(80px + var(--safe-t)); display: flex; flex-direction: column; gap: 10px; }
.icon-btn { position: relative; width: 56px; height: 56px; border-radius: 16px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--c); border: 3px solid var(--ink); color: #fff;
  box-shadow: inset 0 -5px 0 var(--d), inset 0 3px 0 rgba(255, 255, 255, .35), 0 3px 0 var(--ink); transition: transform .06s; }
.icon-btn:active { transform: translateY(3px); box-shadow: inset 0 -3px 0 var(--d), 0 0 0 var(--ink); }
.icon-btn i { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25)); }
.icon-btn small { font-size: 10px; line-height: 1.2; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.icon-btn.c-white { color: var(--ink); }
.icon-btn.c-white small { -webkit-text-stroke: 0; }
/* 背の低い画面では右のボタンを小さくして、下の走行パネルと重ならないようにする */
@media (max-height: 740px) {
  #side { gap: 7px; }
  .icon-btn { width: 48px; height: 48px; border-radius: 14px; }
  .icon-btn i { font-size: 22px; }
  .icon-btn small { font-size: 9px; }
  #navBar { right: 66px; }
}
.badge { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; background: var(--red);
  border: 2px solid var(--ink); color: #fff; font-size: 12px; font-style: normal; display: grid; place-items: center; animation: pop .4s; }

/* ---------- ルート案内 ---------- */
#navBar { top: calc(80px + var(--safe-t)); left: 10px; right: 76px; display: flex; align-items: stretch; gap: 0; overflow: hidden; cursor: pointer;
  border-radius: 16px; border: 3px solid var(--ink); background: #2f9e57; color: #fff; box-shadow: inset 0 -5px 0 #1f7a40, 0 4px 0 var(--ink); }
.nav-turn { flex: none; width: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0 8px; background: rgba(0, 0, 0, .18); }
.nav-turn i { font-size: 34px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3)); }
.nav-turn b { font-size: 14px; font-weight: 900; }
.nav-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 6px 10px 8px; }
.nav-main b { font-size: 20px; font-weight: 900; line-height: 1.2; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-main small { font-size: 12px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding: 6px 4px 8px; text-align: right; }
.nav-meta b { font-size: 14px; font-weight: 900; }
.nav-meta small { font-size: 11px; color: #d8ffe4; }
.nav-end { flex: none; width: 40px; display: grid; place-items: center; color: #fff; font-size: 20px; }
/* 案内中は速報を隠し、通知は案内板の下に出す */
body.navi #ticker { display: none; }
body.navi #toasts { top: calc(170px + var(--safe-t)); }
.dest-pin { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50% 50% 50% 0; rotate: -45deg; background: var(--red);
  border: 3px solid var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.dest-pin i { rotate: 45deg; font-size: 20px; color: #fff; }
.searchrow { display: flex; gap: 8px; align-items: stretch; }
.searchrow .btn { flex: none; min-height: 0; }
.searchbox { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; border: 3px solid var(--ink); background: #fff; }
.searchbox i { font-size: 20px; color: var(--muted); flex: none; }
.searchbox input { border: 0; box-shadow: none; padding: 12px 0; }
.placelist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.placelist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #fff; border: 3px solid var(--paper-2); cursor: pointer; }
.placelist li:active { border-color: var(--ink); }
.placelist li > i { font-size: 22px; color: var(--red); flex: none; }
.pl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-body b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-body small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placelist em { flex: none; font-style: normal; font-size: 12px; color: var(--navy); }
.pick { display: grid; gap: 4px; font-family: var(--font); }
.pick b { font-size: 14px; }
.pick small { font-size: 11px; color: var(--muted); font-weight: 700; }
.pick .btn { margin-top: 4px; width: 100%; }
.maplibregl-popup-content { border-radius: 14px; border: 3px solid var(--ink); padding: 12px 14px 12px; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.maplibregl-popup-close-button { font-size: 20px; padding: 0 6px; }

/* ---------- ポケットモード ---------- */
#pocket { position: fixed; inset: 0; z-index: 90; background: #000; color: #6f7894; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(60px + var(--safe-t)) 20px calc(40px + var(--safe-b)); touch-action: none; user-select: none; -webkit-user-select: none; }
.pk-body { display: flex; flex-direction: column; align-items: center; gap: 28px; text-align: center; }
.pk-nav { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #8fd8a8; }
.pk-nav i { font-size: 64px; }
.pk-nav b { font-size: 26px; font-weight: 900; }
.pk-run b { display: block; font-size: 52px; font-weight: 900; color: #9aa3bd; line-height: 1; }
.pk-run small { font-size: 20px; }
.pk-note { margin: 0; font-size: 12px; font-weight: 700; }
.pk-unlock { position: relative; width: 96px; height: 96px; border-radius: 50%; border: 2px solid #2a3047; color: #6f7894;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.pk-unlock i { font-size: 28px; }
.pk-unlock small { font-size: 10px; }
.pk-ring { position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(#8fd8a8 calc(var(--p, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(closest-side, transparent 88%, #000 90%); mask: radial-gradient(closest-side, transparent 88%, #000 90%); }

/* ---------- 走行パネル ---------- */
#runPanel { left: 10px; right: 10px; bottom: calc(112px + var(--safe-b)); padding: 8px 10px; border-radius: 14px;
  background: var(--navy); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); color: #fff; }
.runstats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.runstats > div + div { border-left: 2px solid var(--ink); }
.runstats small { display: block; font-size: 10px; color: #aab6d6; }
.runstats b { font-size: 20px; font-weight: 900; }
.runhint { margin-top: 6px; padding: 4px 8px; border-radius: 8px; background: var(--ink); text-align: center; font-size: 12px; color: var(--yellow); }
.combo { position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(-4deg); padding: 1px 12px; border-radius: 8px;
  background: var(--yellow); border: 3px solid var(--ink); color: var(--ink); font-size: 14px; font-weight: 900; animation: pop .4s; }

/* ---------- メインボタン ---------- */
#dock { left: 0; right: 0; bottom: calc(24px + var(--safe-b)); display: flex; align-items: center; justify-content: center; gap: 12px; pointer-events: none; }
#dock > * { pointer-events: auto; }
.mainbtn { --c: var(--yellow); --d: var(--yellow-d); width: 180px; height: 78px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--c); border: 4px solid var(--ink); color: #fff;
  box-shadow: inset 0 -9px 0 var(--d), inset 0 4px 0 rgba(255, 255, 255, .45), 0 6px 0 var(--ink); transition: transform .06s, box-shadow .06s; }
.mainbtn:active { transform: translateY(4px); box-shadow: inset 0 -5px 0 var(--d), inset 0 4px 0 rgba(255, 255, 255, .45), 0 2px 0 var(--ink); }
#mainLabel { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: .03em; -webkit-text-stroke-width: 6px; }
#mainSub { margin-top: 3px; font-size: 11px; color: var(--ink); }
.mainbtn.running { --c: #fff; --d: #c9d1e3; }
.mainbtn.running #mainLabel { color: var(--red); }
.mainbtn.paused { --c: var(--green); --d: var(--green-d); }
.mainbtn.paused #mainSub { color: #0e3a17; }
.mainbtn:not(.running):not(.paused) { animation: nudge 2.2s ease-in-out infinite; }

/* ---------- 地図上のマーカー ---------- */
.me-marker { width: 24px; height: 24px; border-radius: 50%; background: var(--me); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--ink), 0 3px 0 2px rgba(0, 0, 0, .25); position: relative; }
.me-marker::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--me); animation: ripple 1.8s ease-out infinite; }
/* マーカー要素そのものの transform は MapLibre が使うので、見た目は内側の要素で付ける */
.flag-pin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; rotate: -45deg;
  background: #fff; border: 3px solid var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.flag-pin i { rotate: 45deg; font-size: 18px; color: var(--me); }
.treasure-token { --c: var(--yellow); --d: var(--yellow-d); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--c); border: 3px solid var(--ink); color: #fff; font-size: 18px; box-shadow: inset 0 -4px 0 var(--d), inset 0 2px 0 rgba(255, 255, 255, .5), 0 3px 0 rgba(0, 0, 0, .3); }
.treasure-token i { filter: drop-shadow(0 1px 0 var(--ink)); }
.treasure-token.gem { --c: #36c6ff; --d: #1d8fc4; border-radius: 10px; transform: rotate(45deg); }
.treasure-token.gem i { transform: rotate(-45deg); }
.treasure-token.crown { --c: var(--purple); --d: var(--purple-d); width: 42px; height: 42px; font-size: 24px; }
/* お宝: 3Dモデル（canvas）＋後光＋きらめき＋地面の影。3Dが使えない端末は上のアイコンのまま */
.treasure { cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.treasure-fx { --glow: 255, 201, 40; --size: 66px; position: relative; display: grid; place-items: center; width: var(--size); height: var(--size); }
.treasure-fx.gem { --glow: 54, 198, 255; }
.treasure-fx.crown { --glow: 196, 120, 255; --size: 84px; }
.treasure .treasure-fx { animation: bob 2.2s ease-in-out infinite; }
.treasure-fx.is-3d .treasure-token { display: none; }
.treasure-fx .t3d { position: relative; z-index: 1; width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(27, 34, 56, .35)); }
/* 後光（ゆっくり回る光の筋） */
.treasure-fx.is-3d::before { content: ""; position: absolute; inset: -14%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--glow), .55), rgba(var(--glow), .18) 55%, transparent 72%),
    repeating-conic-gradient(rgba(var(--glow), .35) 0 8deg, transparent 8deg 30deg);
  -webkit-mask: radial-gradient(closest-side, #000 45%, transparent); mask: radial-gradient(closest-side, #000 45%, transparent);
  animation: spin 9s linear infinite; }
/* きらめき（4方向の光） */
.treasure-fx.is-3d::after { content: ""; position: absolute; z-index: 2; top: 10%; right: 12%; width: 16px; height: 16px; background: #fff;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 4px rgba(var(--glow), 1)); animation: glint 2.6s ease-in-out infinite; }
.treasure-shadow { width: 34px; height: 9px; margin-top: -8px; border-radius: 50%; background: radial-gradient(closest-side, rgba(14, 18, 32, .45), transparent);
  animation: shadow 2.2s ease-in-out infinite; }
.treasure-fx.crown + .treasure-shadow { width: 44px; }
.treasure.got { filter: grayscale(1); opacity: .5; }
.treasure.got .treasure-fx, .treasure.got .treasure-shadow, .treasure.got .treasure-fx::before, .treasure.got .treasure-fx::after { animation: none; }
.treasure.got .treasure-fx::before, .treasure.got .treasure-fx::after { display: none; }
@keyframes glint { 0%, 55%, 100% { transform: scale(0) rotate(0); opacity: 0; } 70% { transform: scale(1) rotate(45deg); opacity: 1; } 85% { transform: scale(.4) rotate(90deg); opacity: .6; } }
@keyframes shadow { 50% { transform: scaleX(.8); opacity: .6; } }

/* ---------- トースト ---------- */
#toasts { position: absolute; z-index: 40; top: calc(118px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 150px); min-width: 220px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; font-size: 14px; background: #fff; color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.4); max-width: 100%; }
.toast i { font-size: 20px; flex: none; }
.toast.good { background: var(--green); color: #fff; }
.toast.bad { background: var(--red); color: #fff; }
.toast.gold { background: var(--yellow); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }

/* ---------- 画面・パネル ---------- */
/* 列幅を画面幅に固定しないと、中身の幅に引っ張られて横にはみ出す */
.screen { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.modal { background: rgba(14, 18, 32, .6); animation: fade .2s; }
.panel { position: relative; width: min(400px, 100%); margin-top: 22px; background: var(--navy); border: 4px solid var(--ink); border-radius: 22px;
  box-shadow: inset 0 -6px 0 var(--navy-2), 0 6px 0 var(--ink); padding: 10px; animation: popIn .3s cubic-bezier(.2, .9, .3, 1.3); }
.panel-body { background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 18px 14px 16px; }
.panel.tall .panel-body.scroll { max-height: calc(100dvh - 140px); overflow-y: auto; }
.ribbon { position: relative; z-index: 2; margin: -34px auto 10px; width: fit-content; max-width: 90%; padding: 8px 28px;
  background: var(--c); border: 4px solid var(--ink); border-radius: 12px; color: #fff; font-size: 20px; font-weight: 900; text-align: center;
  box-shadow: inset 0 -5px 0 var(--d), 0 4px 0 var(--ink); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.close { position: absolute; z-index: 3; top: -16px; right: -12px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); border: 3px solid var(--ink); color: #fff; font-size: 22px; box-shadow: inset 0 -4px 0 var(--red-d), 0 3px 0 var(--ink); }
.close:active { transform: translateY(2px); }
.row { display: flex; gap: 10px; margin-top: 16px; }
.sub { margin: 18px 0 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sub::after { content: ""; flex: 1; height: 3px; border-radius: 3px; background: var(--paper-2); }
.fine { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.6; margin: 12px 0 0; }
.fine.light { color: #dfe5f3; text-align: center; }

input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 3px solid var(--ink); background: #fff; font-weight: 800; font-size: 16px; outline: none;
  box-shadow: inset 0 3px 0 var(--paper-2); }
input:focus { border-color: var(--blue); }
.field-label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin: 4px 0 -4px; }
.colors { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 4px 0; }
.colors button { width: 38px; height: 38px; border-radius: 10px; border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); transition: transform .1s; }
.colors button.on, .colors .custom.on { transform: translateY(-3px); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
/* 自由に選ぶ色: 未選択のときは虹色、選んだらその色になる */
.colors .custom { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 3px solid var(--ink); display: grid; place-items: center; cursor: pointer;
  background: conic-gradient(#ff3b5c, #ffd400, #2ee59d, #00c2ff, #b04dff, #ff3b5c); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); transition: transform .1s; }
.colors .custom i { font-size: 18px; color: #fff; filter: drop-shadow(0 1px 0 var(--ink)) drop-shadow(0 -1px 0 var(--ink)) drop-shadow(1px 0 0 var(--ink)) drop-shadow(-1px 0 0 var(--ink)); }
.colors.locked { opacity: .45; filter: grayscale(.7); pointer-events: none; }
.color-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.color-note i { font-size: 18px; flex: none; color: var(--navy); }
.color-note b { color: var(--ink); }
.save-color { display: flex; margin: 10px auto 0; }
.save-color:disabled { opacity: .45; filter: grayscale(1); pointer-events: none; }
.colors .custom input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }

/* ---------- タイトル ---------- */
#title { background: rgba(20, 27, 48, .55); }
.title-inner { width: min(400px, 100%); text-align: center; padding: 20px 0; }
.logo { margin: 0; font-family: var(--logo); font-weight: 400; font-size: clamp(44px, 15.5vw, 80px); line-height: 1; color: var(--yellow); letter-spacing: .02em;
  -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); animation: logoIn .6s cubic-bezier(.2, .9, .3, 1.4) both; }
.tagline { display: inline-block; margin: 14px 0 6px; padding: 4px 16px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 14px; letter-spacing: .12em; }
.howto { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; text-align: left; }
.howto li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.step { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 18px;
  background: var(--c); border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 var(--d); }
#joinForm, .pfform { display: grid; gap: 10px; }
/* データ引き継ぎ */
.linkbtn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 100%; margin-top: 10px; padding: 6px; font-size: 13px; color: var(--navy);
  text-decoration: underline; text-underline-offset: 3px; }
.transfer-in { display: grid; gap: 8px; text-align: left; }
.transfer-lead { margin: 0 0 4px; font-size: 13px; text-align: center; }
#tiCode { font-variant-numeric: tabular-nums; letter-spacing: .08em; text-transform: uppercase; }
.transfer { display: grid; gap: 8px; }
.transfer-code { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 10px 12px; border-radius: 12px; background: #fff;
  border: 3px solid var(--ink); }
.transfer-code small { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.transfer-code b { font-size: clamp(16px, 5vw, 20px); letter-spacing: .04em; white-space: nowrap; }
.transfer-form { display: grid; gap: 8px; }
/* 背の低いスマホでも、タイトル画面がスクロールせずに収まるよう詰める */
@media (max-height: 700px) {
  .title-inner { padding: 0; }
  .logo { font-size: clamp(40px, 13vw, 60px); -webkit-text-stroke-width: 8px; text-shadow: 0 5px 0 var(--ink); }
  .tagline { margin: 8px 0 2px; }
  .howto { gap: 4px; margin-bottom: 8px; }
  .howto .step { width: 30px; height: 30px; font-size: 15px; }
  #title .panel-body { padding: 12px 12px 12px; }
  #title .fine { margin-top: 8px; }
}
@media (max-height: 580px) {
  .howto { display: none; }
}
#btnContinue { margin-top: 4px; }
.welcome { margin: 0 0 10px; font-size: 15px; }

/* ---------- 結果 ---------- */
.rays { position: fixed; inset: -50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 201, 40, .22) 0 10deg, transparent 10deg 20deg); animation: spin 18s linear infinite; }
.result-panel { text-align: center; }
.result-panel .panel-body { max-height: calc(100dvh - 90px); overflow-y: auto; }
.res-map { position: relative; aspect-ratio: 900 / 640; border-radius: 12px; border: 3px solid var(--ink); overflow: hidden; background: #dfe4ee; }
.res-map img { display: block; width: 100%; height: 100%; object-fit: cover; animation: fade .4s; }
.res-map.loading img { visibility: hidden; }
.res-map.loading::after { content: "地図を読み込み中…"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #dfe4ee 0 12px, #e8ecf4 12px 24px); }
.res-map-credit { position: absolute; right: 4px; bottom: 2px; font-size: 9px; font-weight: 700; color: #4a5370; background: rgba(255, 255, 255, .7); padding: 0 4px; border-radius: 4px; }
.result-area-label { margin-top: 10px; font-size: 12px; color: var(--muted); }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.res-stats div { display: flex; flex-direction: column; align-items: center; padding: 6px 2px 8px; border-radius: 12px; background: #fff; border: 3px solid var(--ink); }
.res-stats i { font-size: 20px; color: var(--blue); }
.res-stats small { font-size: 10px; color: var(--muted); }
.res-stats b { font-size: 15px; font-weight: 900; }
.res-stats .hot { background: #ffe9e9; }
.res-stats .hot i, .res-stats .hot b { color: var(--red-d); }
.result-panel .ribbon { --c: var(--yellow); --d: var(--yellow-d); font-size: 24px; }
.result-area { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
#resArea { font-size: clamp(46px, 14vw, 62px); font-weight: 900; color: var(--yellow); -webkit-text-stroke-width: 8px; line-height: 1.1; }
.result-unit { font-size: 22px; font-weight: 900; color: var(--ink); }
.result-compare { display: inline-block; margin-top: 4px; padding: 3px 12px; border-radius: 99px; background: var(--paper-2); font-size: 14px; }
.rewards { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.rewards:empty { display: none; }
.rewards li, .rewards > div { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 12px; background: #fff; border: 3px solid var(--ink);
  font-size: 13px; text-align: left; animation: slideIn .35s both; }
.rewards .ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 17px; border: 2px solid var(--ink);
  background: var(--c, var(--gray)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.rewards .lbl { flex: 1; min-width: 0; }
.rewards b { flex: none; color: var(--green-d); }
.result-xp { margin-top: 12px; display: flex; justify-content: center; gap: 8px; align-items: center; flex-wrap: wrap; }
.xp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 6px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 16px; }
.xp-chip i { color: var(--yellow); font-size: 22px; }
.levelup { padding: 3px 12px; border-radius: 10px; background: var(--purple); border: 3px solid var(--ink); color: #fff; font-weight: 900; animation: pop .5s .4s both; }
.share-img { width: 100%; border-radius: 10px; border: 3px solid var(--ink); display: block; background: #000; aspect-ratio: 4 / 5; object-fit: cover; }

/* ---------- リスト ---------- */
.ranklist, .feedlist, .missionlist, .achievements, .treasure-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ranklist li { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 12px; background: #fff; border: 3px solid var(--paper-2); }
.ranklist li.me { border-color: var(--ink); background: #fff6d6; }
.ranklist .no { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--paper-2); color: var(--muted); font-size: 15px; }
.ranklist li:nth-child(1) .no { background: var(--yellow); color: #fff; border: 2px solid var(--ink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.ranklist li:nth-child(2) .no { background: #c5cede; color: #fff; border: 2px solid var(--ink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.ranklist li:nth-child(3) .no { background: #e59a5c; color: #fff; border: 2px solid var(--ink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.ranklist .dot, .feedlist .dot { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); flex: none; }
.ranklist .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ランキングのタブ */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--paper-2); }
.tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 10px; font-size: 14px; color: var(--muted); }
.tabs button i { font-size: 18px; }
.tabs button.on { background: var(--yellow); color: #fff; border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 var(--yellow-d);
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.tabs button.on i { -webkit-text-stroke: 0; color: #fff; filter: drop-shadow(0 1px 0 var(--ink)); }
/* 都道府県ごとの1位 */
.pref-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px;
  background: #fff6d6; border: 3px solid var(--ink); font-size: 13px; }
.pref-summary:empty { display: none; }
.pref-summary > i { font-size: 22px; color: var(--yellow-d); }
.pref-summary b { font-size: 18px; }
.pref-summary small { flex-basis: 100%; color: var(--muted); font-size: 11px; }
.preflist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.preflist li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fff; border: 3px solid var(--paper-2); cursor: pointer; }
.preflist li:active { border-color: var(--ink); }
.preflist li.me { border-color: var(--ink); background: #fff6d6; }
.preflist .pf { flex: none; width: 4.6em; font-size: 13px; }
.preflist .dot { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); flex: none; }
.preflist .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.preflist .nm i { color: var(--yellow-d); margin-right: 2px; }
.preflist .ar { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; }
.preflist .ar small { font-size: 10px; color: var(--muted); }
.pref-empty { display: flex; flex-wrap: wrap; gap: 4px; }
.pref-empty span { padding: 2px 8px; border-radius: 99px; background: var(--paper-2); color: var(--muted); font-size: 11px; }
.pref-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 4px; border-radius: 10px; color: var(--navy); font-size: 13px; }
.pref-title { margin: 6px 0 10px; font-size: 18px; }
.feedlist li { display: flex; gap: 8px; align-items: center; padding: 6px 4px; font-size: 12px; border-bottom: 2px solid var(--paper-2); cursor: pointer; }
.feedlist time { margin-left: auto; color: var(--muted); font-size: 11px; flex: none; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; border: 0 !important; background: none !important; }

.streak-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #ff7a1a; border: 3px solid var(--ink);
  box-shadow: inset 0 -5px 0 #c9560a; color: #fff; }
.streak-card > i { font-size: 38px; filter: drop-shadow(0 2px 0 var(--ink)); }
.streak-card b { font-size: 22px; font-weight: 900; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.streak-card small { display: block; font-size: 12px; }
.missionlist { margin-top: 10px; }
.missionlist li { padding: 10px 12px; border-radius: 12px; background: #fff; border: 3px solid var(--paper-2); }
.missionlist li.done { border-color: var(--green); background: #eafbe9; }
.missionlist .mtop { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.missionlist .mtop > i { font-size: 22px; color: var(--paper-2); }
.missionlist li.done .mtop > i { color: var(--green); }
.missionlist .mname { flex: 1; }
.missionlist .mxp { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 99px; background: var(--ink); color: var(--yellow); font-size: 12px; }
.missionlist .mbar { margin-top: 8px; height: 14px; border-radius: 99px; background: var(--ink); padding: 2px; }
.missionlist .mbar i { display: block; height: 100%; border-radius: 99px; background: var(--green); box-shadow: inset 0 -3px 0 var(--green-d); min-width: 10px; }
.missionlist .mnum { margin-top: 3px; font-size: 11px; color: var(--muted); text-align: right; }
.treasure-legend { grid-template-columns: repeat(3, 1fr); }
.treasure-legend .treasure-fx { --size: 56px; }
.treasure-legend li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: #fff; border: 3px solid var(--paper-2); font-size: 12px; }
.treasure-legend b { color: var(--green-d); }

.pfstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pfstats div { padding: 8px 4px; border-radius: 12px; background: #fff; border: 3px solid var(--paper-2); text-align: center; }
.pfstats small { display: block; color: var(--muted); font-size: 10px; }
.pfstats b { font-size: 15px; font-weight: 900; }
.achievements { grid-template-columns: repeat(2, 1fr); }
.achievements li { display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 12px; background: var(--paper-2); font-size: 11px; color: var(--muted); }
.achievements li .ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #c5cede; color: #fff; font-size: 18px; border: 2px solid #aab3c7; }
.achievements li b { display: block; font-size: 13px; color: var(--muted); }
.achievements li.got { background: #fff; border: 3px solid var(--yellow); }
.achievements li.got .ico { background: var(--yellow); border: 2px solid var(--ink); box-shadow: inset 0 -3px 0 var(--yellow-d); }
.achievements li.got b { color: var(--ink); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 3px solid var(--paper-2); cursor: pointer; }
.toggle span { display: flex; align-items: center; gap: 8px; }
.toggle span i { font-size: 22px; color: var(--navy); }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw { position: relative; flex: none; width: 54px; height: 30px; border-radius: 99px; background: #c5cede; border: 3px solid var(--ink); transition: background .15s; }
/* 内側は 48×24px。つまみ（20px＋枠2px×2）を上下中央に置く */
.sw::after { content: ""; position: absolute; top: 50%; left: 1px; width: 22px; height: 22px; box-sizing: border-box; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink); transform: translateY(-50%); transition: left .15s; }
.toggle input:checked + .sw { background: var(--green); }
.toggle input:checked + .sw::after { left: 25px; }

@keyframes nudge { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.06, .94); } 94% { transform: scale(.97, 1.04); } }
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
@keyframes bob { 50% { translate: 0 -5px; } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); } }
@keyframes popIn { from { transform: scale(.7); opacity: 0; } }
@keyframes slideIn { from { transform: translateX(-16px); opacity: 0; } }
@keyframes toastIn { from { transform: translateY(-12px) scale(.9); opacity: 0; } }
@keyframes logoIn { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
