/* ARC CREATE WORLD：島と天界の共通スタイル
   見た目は公式サイト（arc-create.com）に合わせる：Unbounded＋Zen Kaku Gothic New＋JetBrains Mono、
   紺の半透明に白い細線の「HUD」パーツ、青のアクセント、クリスタルのロゴ。絵（島・天界）はそのまま主役。 */
:root {
  --sea: #186db9;
  --fg: #0a1838;
  --fg-2: #3f5179;
  --fg-3: #6a7fa8;
  --line: rgba(28, 84, 214, 0.14);
  --line-2: rgba(28, 84, 214, 0.28);
  --surface: rgba(255, 255, 255, 0.94);
  --accent: #1c5cf5;
  --accent-2: #12a8ee;
  --deep: #0d2c86;
  --deep-2: #0a1f63;
  --hud-bg: rgba(9, 30, 98, 0.6);
  --hud-bg-solid: rgba(9, 30, 98, 0.84);
  --hud-line: rgba(255, 255, 255, 0.26);
  --hud-fg: #ffffff;
  --hud-fg-2: rgba(230, 240, 255, 0.8);
  --mint: #7dfcc6;
  --ice: #8fd8ff;
  --focus: #ffb020;
  --c-web: #2f6bff;
  --c-con: #0fae86;
  --c-game: #8a4dff;
  --c-music: #ff8a1f;
  --on-sea: #ffffff;
  --on-sea-2: rgba(255, 255, 255, 0.82);
  --sky-shadow: rgba(6, 34, 112, 0.45);
  --font-display: 'Unbounded', 'Zen Kaku Gothic New', system-ui, sans-serif;
  --font-jp: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', Meiryo, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; min-height: 100%; }
body {
  margin: 0;
  background: linear-gradient(rgba(10, 31, 99, 0) 0, rgba(10, 31, 99, 0) 92vh, rgba(10, 31, 99, 0.84) calc(92vh + 340px), rgba(10, 31, 99, 0.94) 100%), url('img/sea-tile.webp') 0 0 / 333px auto;
  background-color: var(--sea);
  color: var(--on-sea);
  font-family: var(--font-jp);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.02em;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@keyframes blink { 50% { opacity: 0.2; } }

/* 上の帯：クリスタルのロゴ（公式サイトと同じ形） */
.top {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  position: relative;
  z-index: 3;
}
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--on-sea); text-decoration: none; text-shadow: 0 1px 10px var(--sky-shadow); min-width: 0; }
.logo-mark { width: 32px; height: 32px; flex: none; overflow: visible; filter: drop-shadow(0 2px 6px rgba(6, 34, 112, 0.35)); }
.logo-word { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.logo-word b { font-family: var(--font-display); font-weight: 600; font-size: clamp(12.5px, 3.6vw, 15px); letter-spacing: 0.07em; white-space: nowrap; }
.logo-word small { font-size: 10px; letter-spacing: 0.24em; opacity: 0.85; margin-top: 4px; white-space: nowrap; }
/* 紺の半透明のボタン（公式サイトの MENU と同じ形） */
.top-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 16px 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--hud-line);
  background: var(--hud-bg-solid);
  color: var(--hud-fg);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s, border-color 0.25s;
}
.top-link svg { width: 15px; height: 15px; transition: transform 0.3s; }
.top-link:hover { background: var(--deep); border-color: rgba(255, 255, 255, 0.55); }
.top-link:hover svg { transform: translateX(-3px); }
/* 幅の狭いスマホ：ロゴと「島へ戻る」がぶつからないよう、少し小さく */
@media (max-width: 430px) {
  .top { gap: 10px; }
  .logo { gap: 8px; }
  .logo-mark { width: 28px; height: 28px; }
  .logo-word b { font-size: clamp(11.5px, 3.3vw, 14px); letter-spacing: 0.05em; }
  .logo-word small { font-size: 9px; letter-spacing: 0.2em; }
  .top-link { padding: 8px 12px 8px 10px; gap: 6px; font-size: 12.5px; }
  .top-link svg { width: 14px; height: 14px; }
}
main { position: relative; display: flow-root; } /* flow-root：地図の負の margin が main の外へ抜けて、札がロゴに重ならないように */
/* 地図の左上の小さな札（公式サイトの「● ENTERTAINMENT × WEB STUDIO」と同じ形） */
.eyebrow {
  position: absolute;
  z-index: 4;
  left: max(16px, env(safe-area-inset-left));
  top: 4px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--hud-line);
  background: rgba(9, 30, 98, 0.72);
  color: var(--hud-fg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  line-height: 1.6;
  pointer-events: none;
}
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint); animation: blink 1.6s steps(2, start) infinite; }

/* 地図 */
.map-wrap { overflow: hidden; margin-top: calc(var(--header) * -0.55); }
.stage {
  position: relative;
  aspect-ratio: 3 / 2;
  width: min(100vw, calc((100vh - var(--header) * 0.45 - 44px) * 1.5));
  width: min(100vw, calc((100svh - var(--header) * 0.45 - 44px) * 1.5));
  min-width: min(100vw, 720px);
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: 60% 28%;
  /* 絵のふちを海のタイルへ溶かす */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%), linear-gradient(transparent 0, #000 5%, #000 95%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%), linear-gradient(transparent 0, #000 5%, #000 95%, transparent 100%);
  mask-composite: intersect;
}
.stage > img, .stage > canvas, .stage > svg, .lits, .lit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.stage > img { -webkit-user-drag: none; }
.sea2 { pointer-events: none; opacity: 0; animation: seaBreath 7s ease-in-out 1s infinite alternate; }
@keyframes seaBreath { from { opacity: 0; } to { opacity: 0.95; } }
.seagl { pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
.seagl.on { opacity: 1; }
.stage > img.boat {
  inset: auto;
  height: auto;
  pointer-events: none;
  transform-origin: 50% 88%;
  animation: bob 4.6s ease-in-out infinite;
}
/* 浮かぶもの（天界）：上下にふよふよ。押した行き先と一緒に光る */
.stage > img.floater {
  inset: auto;
  height: auto;
  pointer-events: none;
  animation: floaty 5s ease-in-out infinite;
}
.floater-glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(110, 195, 255, 0.9), rgba(80, 160, 255, 0.45) 50%, rgba(80, 160, 255, 0));
  opacity: 0;
  transition: opacity 0.25s ease;
  animation: floaty 5s ease-in-out infinite;
}
.floater-glow.on { opacity: 1; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(var(--amp, -4%)); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-0.5deg); }
  50% { transform: translateY(0.45%) rotate(0.6deg); }
}
#fx, .crystalgl { pointer-events: none; }

/* 絵を包む箱：絵とぴったり同じ大きさ（吹き出しの位置を絵に対する % で置くため） */
.pan { position: relative; width: fit-content; max-width: none; margin: 0 auto; }

/* 押せる場所：普段は透明。近づくと絵がふわっと明るくなる */
.lits { pointer-events: none; filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 2px #fff); }
.lit {
  opacity: 0;
  background-size: 100% 100%;
  filter: brightness(1.14) saturate(1.08);
  transition: opacity 0.18s ease;
}
.lit.on { opacity: 1; }
svg.hits { overflow: visible; touch-action: manipulation; }
svg.hits a { outline: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg.hits polygon {
  fill: transparent;
  stroke: transparent;
  stroke-width: 6px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}
@media (pointer: coarse) { svg.hits polygon { stroke-width: 20px; } }

/* 住人のつぶやき（文字は使わず、点だけ） */
.sigh {
  position: absolute;
  display: flex;
  gap: 0.18em;
  font-size: clamp(5px, 0.62vw, 9px);
  padding: 0.55em 0.8em;
  background: #fff;
  border-radius: 1.2em;
  transform: translate(-10%, -130%);
  pointer-events: none;
  opacity: 0;
  animation: sigh 9s ease-in-out 2.5s infinite;
  box-shadow: 0 1px 4px rgba(10, 40, 80, 0.3);
}
.sigh i { width: 0.6em; height: 0.6em; border-radius: 50%; background: #5a6f8c; }
@keyframes sigh {
  0%, 62%, 100% { opacity: 0; }
  68%, 90% { opacity: 1; }
}

/* 準備中（紺の吹き出し） */
.soon {
  position: fixed;
  z-index: 20;
  transform: translate(-50%, -100%);
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--hud-line);
  background: var(--hud-bg-solid);
  color: var(--hud-fg);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 18px 40px -16px rgba(0, 10, 50, 0.7);
  pointer-events: none;
  animation: soon 1.8s ease both;
}
.soon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  background: #13296f;
  border-right: 1px solid var(--hud-line);
  border-bottom: 1px solid var(--hud-line);
  transform: rotate(45deg);
}
@keyframes soon {
  0% { opacity: 0; margin-top: 8px; }
  12%, 80% { opacity: 1; margin-top: 0; }
  100% { opacity: 0; margin-top: -6px; }
}

.hint { margin: 0; text-align: center; font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px var(--sky-shadow), 0 2px 14px var(--sky-shadow); padding: 12px 16px 0; min-height: 44px; }

/* 行き先一覧（公式サイトの見出し：等幅の小さな道しるべ＋英字の小見出し） */
.places-wrap { max-width: 1040px; margin: 0 auto; padding: 30px 16px 8px; }
.sec-head { margin: 0 0 18px; }
.sec-path { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; color: var(--ice); }
.sec-path::after { content: ''; width: 8px; height: 14px; background: currentColor; animation: blink 1.1s steps(2, start) infinite; }
.places-wrap h2 { margin: 0; font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2rem); font-weight: 900; line-height: 1.3; letter-spacing: 0.04em; text-shadow: 0 1px 10px var(--sky-shadow); }
.places-wrap h2 small { display: block; margin-bottom: 6px; font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.18em; opacity: 0.8; }
.places {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 14px;
}
.place {
  --c: var(--accent);
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  height: 100%;
  padding: 12px 16px 12px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  box-shadow: 0 24px 60px -30px rgba(16, 50, 140, 0.45), 0 4px 16px rgba(5, 30, 80, 0.12);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s, box-shadow 0.3s;
}
.place:hover, .place:focus-visible { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 28px 60px -28px color-mix(in srgb, var(--c) 60%, transparent), 0 4px 16px rgba(5, 30, 80, 0.14); }
.thumb { width: 84px; height: 84px; border-radius: 14px; background-repeat: no-repeat; background-color: var(--sea); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.place .tag { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; line-height: 1.6; color: var(--fg-3); }
.place .tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.place b { display: block; margin-top: 1px; font-size: 16.5px; line-height: 1.35; font-weight: 900; letter-spacing: 0.04em; }
.place .where { display: block; font-size: 12.5px; font-weight: 700; color: var(--fg-2); margin-top: 2px; }
.place .desc { display: block; font-size: 13px; line-height: 1.65; margin-top: 4px; color: var(--fg-2); }
.place[href='#soon'] b::after {
  content: '準備中';
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--fg-3);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.8;
  vertical-align: 2px;
}

footer { text-align: center; padding: 30px 16px calc(30px + env(safe-area-inset-bottom)); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; color: var(--on-sea-2); }
footer a { color: inherit; }

/* 上へ昇る／天界に着く */
#veil { position: fixed; inset: 0; z-index: 30; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.85s ease-in; }
body.ascending #veil { opacity: 1; }
body.ascending .map-wrap { overflow: visible; }
body.ascending .stage { transition: transform 1s cubic-bezier(0.5, 0, 0.8, 0.6); transform: scale(2.4); }

/* スマホ：海の余白を少し切って、島を大きく */
@media (max-width: 700px) {
  .map-wrap { margin-top: 0; }
  .stage { width: 118vw; margin-left: -9vw; min-width: 0; }
  .stage { -webkit-mask-image: linear-gradient(transparent 0, #000 5%, #000 94%, transparent 100%); -webkit-mask-composite: source-over; mask-image: linear-gradient(transparent 0, #000 5%, #000 94%, transparent 100%); mask-composite: add; }
  body:not(.heaven) { background-size: auto, 190px auto; }
  .hint { padding-top: 6px; min-height: 0; }
}

/* スマホ：島を大きく出して、指でなでて見回す（kingdom.js の「見回す」が .explore を付ける） */
.map-wrap.explore {
  position: relative;
  /* スマホの1画面に、上の帯・地図・下の案内がちょうど収まる高さ */
  height: 72vh;
  height: min(74svh, 170vw, calc(100svh - var(--header) - 112px));
  margin-top: 0;
  touch-action: pan-y;
  -webkit-touch-callout: none;
}
.map-wrap.explore.zoomed {
  touch-action: none;
  /* 拡大して上下が枠からはみ出したら、枠の上下のふちをぼかす */
  -webkit-mask-image: linear-gradient(transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 7%, #000 93%, transparent 100%);
}
.map-wrap.explore .pan { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map-wrap.explore .stage {
  margin: 0;
  min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(transparent 0, #000 4%, #000 96%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(transparent 0, #000 4%, #000 96%, transparent 100%);
  mask-composite: intersect;
}
/* 指で押したときの吹き出し（1回目で名前、もう一度押すと入る）。紺の半透明に白い「いく →」 */
.pop {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 12px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--hud-line);
  background: var(--hud-bg-solid);
  color: var(--hud-fg);
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 18px 40px -16px rgba(0, 10, 50, 0.7);
  -webkit-tap-highlight-color: transparent;
}
.pop[hidden] { display: none; }
.pop::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  background: #13296f;
  border-right: 1px solid var(--hud-line);
  border-bottom: 1px solid var(--hud-line);
  transform: rotate(45deg);
}
/* 上に出す余地がないときは下に出す */
.pop.below { transform: translate(-50%, 12px); }
.pop.below::after { bottom: auto; top: -6px; border: 0; border-left: 1px solid var(--hud-line); border-top: 1px solid var(--hud-line); }
.pop b { font-weight: 900; letter-spacing: 0.04em; }
.pop-go { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px 6px 15px; border-radius: 999px; background: #fff; color: var(--deep-2); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; }
.pop-go::after { content: '→'; font-weight: 700; }
.pop.is-soon .pop-go { background: transparent; color: var(--hud-fg-2); border: 1px solid var(--hud-line); }
.pop.is-soon .pop-go::after { content: none; }
.pop.show { animation: popIn 0.22s ease-out both; }
@keyframes popIn { from { opacity: 0; margin-top: 6px; } to { opacity: 1; margin-top: 0; } }

.hint-drag { display: none; }
.exploring .hint-drag { display: block; font-size: 12.5px; font-weight: 500; opacity: 0.9; }

@media (prefers-reduced-motion: reduce) {
  .sea2, .stage > img.boat, .stage > img.floater, .floater-glow, .sigh, .eyebrow::before, .sec-path::after { animation: none; }
  .sigh { opacity: 0; }
  body.ascending .stage { transition: none; transform: none; }
  #veil { transition: none; }
}

/* 天界：公式サイトの明るい面（白っぽい空に紺の文字）に寄せる */
body.heaven {
  --sea: #5aaeea;
  --on-sea: #0a1838;
  --on-sea-2: #3f5179;
  background: linear-gradient(#5aaeea 0, #a9d9f6 22vh, #dcf0fb 44vh, #eef6ff 70vh, #f2f7ff 100%);
  color: var(--fg);
}
body.heaven .logo { color: #fff; }
body.heaven .hint, body.heaven .places-wrap h2 { color: var(--fg); text-shadow: none; }
body.heaven .sec-path { color: var(--accent); }
body.heaven .place { background: #fff; }
body.heaven .places { grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); }
#veil.arrive { animation: arrive 1.2s ease-out both; }
@keyframes arrive { from { opacity: 1; } to { opacity: 0; } }
