/* WORLTONE — 世界の音を聴く */

:root {
  --ink: #06070b;
  --ink-2: #0b0e17;
  --bone: #e9e4d8;
  --bone-dim: rgba(233, 228, 216, 0.56);
  --bone-faint: rgba(233, 228, 216, 0.3);
  --line: rgba(233, 228, 216, 0.13);
  --gold: #e8c48a;
  --accent: #e8c48a; /* 選んだ土地の気温の色に JS が差し替える */
  --serif: 'Cormorant Garamond', 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --mincho: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--mincho);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 90% at 50% 38%, #101627 0%, var(--ink-2) 42%, var(--ink) 78%);
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ── 地図 ───────────────────────────────────────── */

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#map.is-hover { cursor: pointer; }
#map:active { cursor: grabbing; }

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.085;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(80% 60% at 50% 40%, rgba(214, 226, 255, 0.9), rgba(214, 226, 255, 0) 70%);
  opacity: 0;
}
.flash.on { animation: flash 1.1s ease-out; }
@keyframes flash {
  0% { opacity: 0; } 6% { opacity: 0.22; } 14% { opacity: 0.04; } 22% { opacity: 0.16; } 100% { opacity: 0; }
}

/* ── ヘッダー ───────────────────────────────────── */

.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(26px + env(safe-area-inset-top)) 32px 0;
  pointer-events: none;
  z-index: 5;
}
/* 拡大した地図が下に来ても題字が読めるように */
.top::before {
  content: '';
  position: absolute;
  inset: 0 0 -46px 0;
  background: linear-gradient(180deg, rgba(6, 7, 11, 0.88) 0%, rgba(6, 7, 11, 0.55) 55%, rgba(6, 7, 11, 0) 100%);
  z-index: -1;
}

.brand h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 26px;
  letter-spacing: 0.52em;
  line-height: 1;
}
.brand p {
  margin-top: 10px;
  font-size: 11.5px;
  letter-spacing: 0.3em;
  color: var(--bone-dim);
}
.brand p span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--bone-faint);
}

.status {
  font-family: var(--mono);
  font-weight: 300;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-align: right;
  line-height: 1.9;
}
.status b { font-weight: 400; color: var(--bone); }
.status .live::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: #9fe6b8;
  box-shadow: 0 0 8px #9fe6b8;
  vertical-align: 1px;
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ── パネル ─────────────────────────────────────── */

.panel {
  position: fixed;
  right: 32px;
  top: 50%;
  width: 368px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  padding: 26px 28px 24px;
  background: linear-gradient(160deg, rgba(16, 19, 30, 0.74), rgba(8, 9, 14, 0.8));
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  backdrop-filter: blur(22px) saturate(1.25);
  border: 1px solid var(--line);
  border-top-color: color-mix(in srgb, var(--accent) 55%, transparent);
  z-index: 6;
  opacity: 0;
  transform: translate(18px, -50%);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), border-color 1.2s;
  scrollbar-width: none;
}
.panel::-webkit-scrollbar { display: none; }
.panel.open { opacity: 1; transform: translate(0, -50%); }
.panel[hidden] { display: none; }

.panel-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  color: var(--bone-faint);
  transition: color 0.3s;
}
.panel-close:hover { color: var(--bone); }

.panel-meta {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--bone-dim);
  padding-right: 30px;
}

.place {
  margin-top: 16px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 44px;
  line-height: 1.02;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
}
.place.long { font-size: 32px; }
.place-ja {
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--bone-dim);
}

.now {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-top: 22px;
}
.temp {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 68px;
  line-height: 0.82;
  color: var(--accent);
  transition: color 1.2s;
  font-variant-numeric: lining-nums;
}
.temp sup { font-size: 0.42em; vertical-align: top; margin-left: 2px; position: relative; top: 0.05em; }
.cond { display: flex; flex-direction: column; gap: 4px; padding-bottom: 2px; }
.cond span { font-size: 15px; letter-spacing: 0.16em; }
.cond em { font-family: var(--serif); font-size: 15px; color: var(--bone-dim); }

.scope {
  display: block;
  width: 100%;
  height: 48px;
  margin: 20px 0 8px;
}

/* この空から生まれた曲 */
.genre {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.genre-main { display: flex; flex-direction: column; min-width: 0; }
.genre-label { font-size: 10px; letter-spacing: 0.4em; color: var(--bone-faint); }
.genre strong {
  margin-top: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 27px;
  line-height: 1.05;
  color: var(--accent);
  transition: color 1.2s;
}
.genre-ja { margin-top: 5px; font-size: 11px; letter-spacing: 0.18em; color: var(--bone-dim); }

.btn-take {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px 8px 10px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--bone-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.3s, border-color 0.3s;
}
.btn-take svg { width: 14px; height: 14px; transition: transform 0.6s var(--ease); }
.btn-take:hover { color: var(--bone); border-color: var(--bone-faint); }
.btn-take:hover svg { transform: rotate(180deg); }

.voices {
  margin: 10px 0 14px;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.12em;
  color: var(--bone-dim);
}

.score { border-top: 1px solid var(--line); }
.score-head, .row {
  display: grid;
  grid-template-columns: 4.4em 1fr 16px 1.4fr;
  align-items: baseline;
  column-gap: 7px;
}
.score-head {
  grid-template-columns: calc(4.4em + 7px + 1fr) 16px 1.4fr;
  padding: 10px 0 6px;
  font-size: 10px;
  letter-spacing: 0.5em;
  color: var(--bone-faint);
}
.row {
  padding: 8px 0;
  border-top: 1px solid rgba(233, 228, 216, 0.06);
}
.row .k { font-size: 11px; letter-spacing: 0.14em; color: var(--bone-dim); }
.row .v { font-family: var(--mono); font-weight: 300; font-size: 11px; letter-spacing: 0.02em; white-space: nowrap; }
.row i { font-style: normal; font-size: 11px; color: var(--accent); opacity: 0.8; transition: color 1.2s; }
.row .m { font-size: 12px; letter-spacing: 0.06em; white-space: nowrap; }
.row .m small { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--bone-dim); margin-left: 6px; letter-spacing: 0.02em; }

.note {
  margin-top: 14px;
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: 0.06em;
  color: var(--bone-faint);
}

/* ── ドック ─────────────────────────────────────── */

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 20px 0 8px;
  background: rgba(10, 12, 18, 0.66);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 999px;
  z-index: 7;
}

.btn-play {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bone-faint);
  display: grid;
  place-items: center;
  transition: border-color 0.3s, background 0.3s, opacity 0.3s;
}
.btn-play svg { width: 16px; height: 16px; fill: var(--bone); grid-area: 1 / 1; }
.btn-play .i-pause { display: none; }
.btn-play.playing .i-play { display: none; }
.btn-play.playing .i-pause { display: block; }
.btn-play:hover:not(:disabled) { border-color: var(--bone); background: rgba(233, 228, 216, 0.06); }
.btn-play:disabled { opacity: 0.35; cursor: default; }

.dock-now {
  min-width: 132px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--bone-dim);
}
.dock-now b { font-family: var(--serif); font-weight: 400; font-size: 17px; letter-spacing: 0.04em; color: var(--bone); margin-right: 8px; }

.btn-drift {
  position: relative;
  padding: 6px 4px 6px 18px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--bone-dim);
  transition: color 0.3s;
}
.btn-drift::before {
  content: '';
  position: absolute;
  left: 2px; top: 50%;
  width: 7px; height: 7px;
  margin-top: -4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  transition: background 0.3s, box-shadow 0.3s;
}
.btn-drift:hover { color: var(--bone); }
.btn-drift[aria-pressed='true'] { color: var(--gold); }
.btn-drift[aria-pressed='true']::before { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.vol { display: flex; align-items: center; gap: 8px; }
.vol svg { width: 16px; height: 16px; fill: var(--bone-dim); color: var(--bone-dim); }
.vol input {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 14px;
  background: transparent;
  cursor: pointer;
}
.vol input::-webkit-slider-runnable-track { height: 1px; background: var(--bone-faint); }
.vol input::-moz-range-track { height: 1px; background: var(--bone-faint); }
.vol input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 9px; height: 9px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--bone);
}
.vol input::-moz-range-thumb { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--bone); }

/* ── 凡例・クレジット ───────────────────────────── */

.legend {
  position: fixed;
  left: 32px;
  bottom: calc(44px + env(safe-area-inset-bottom));
  width: 168px;
  z-index: 4;
  pointer-events: none;
}
.legend-bar {
  height: 2px;
  background: linear-gradient(90deg, #8fa8ff, #8fd0ff 28%, #b9f0f0 42%, #a8ecc0 56%, #f5e6a3 70%, #ffa25e 85%, #ff5d6c);
}
.legend-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-weight: 300;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--bone-faint);
}

.credit {
  position: fixed;
  right: 32px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  font-family: var(--mono);
  font-weight: 300;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--bone-faint);
  z-index: 4;
}
.credit a { text-underline-offset: 3px; text-decoration-color: rgba(233, 228, 216, 0.25); }
.credit a:hover { color: var(--bone); }

/* ── はじまりの画面 ─────────────────────────────── */

.intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  overflow-y: auto; /* 背の低い画面でもボタンまで届くように */
  padding: 32px;
  background: radial-gradient(90% 70% at 50% 45%, rgba(6, 7, 11, 0.5), rgba(6, 7, 11, 0.93) 75%);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  transition: opacity 1.4s var(--ease), visibility 0s linear 1.4s;
}
.intro.gone { opacity: 0; visibility: hidden; pointer-events: none; }

.intro-inner { width: 100%; margin: auto; text-align: center; }
.intro-inner > p { max-width: 560px; margin-left: auto; margin-right: auto; }
.intro-inner > * { opacity: 0; animation: rise 1.6s var(--ease) forwards; }
.intro-inner > :nth-child(1) { animation-delay: 0.15s; }
.intro-inner > :nth-child(2) { animation-delay: 0.35s; }
.intro-inner > :nth-child(3) { animation-delay: 0.75s; }
.intro-inner > :nth-child(4) { animation-delay: 1.0s; }
.intro-inner > :nth-child(5) { animation-delay: 1.3s; }
.intro-inner > :nth-child(6) { animation-delay: 1.6s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.intro-kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--bone-dim);
}
.intro h2 {
  display: inline-block;
  margin: 20px 0 30px;
  padding-left: 0.42em; /* 字間ぶんを左に足して視覚的に中央へ */
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(34px, 9vw, 112px);
  letter-spacing: 0.42em;
  line-height: 1.1;
  white-space: nowrap;
  background: linear-gradient(100deg, #8fd0ff 0%, #e9e4d8 38%, #f5e6a3 68%, #ffa25e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-lead {
  margin-top: 0;
  font-size: clamp(17px, 3.6vw, 22px);
  line-height: 2;
  letter-spacing: 0.24em;
}
.intro-body {
  margin-top: 22px;
  font-size: 12.5px;
  line-height: 2.2;
  letter-spacing: 0.14em;
  color: var(--bone-dim);
}
.intro-body span { font-family: var(--mono); color: var(--bone); letter-spacing: 0.04em; }

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 38px;
}
.btn-enter {
  padding: 15px 34px;
  font-size: 13px;
  letter-spacing: 0.36em;
  border: 1px solid var(--bone);
  background: var(--bone);
  color: var(--ink);
  transition: background 0.4s, color 0.4s, border-color 0.4s, letter-spacing 0.6s var(--ease);
}
.btn-enter:hover { letter-spacing: 0.44em; }
.btn-enter.ghost { background: transparent; color: var(--bone); border-color: var(--bone-faint); }
.btn-enter.ghost:hover { border-color: var(--bone); }

.intro-foot {
  margin-top: 30px;
  font-family: var(--mono);
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--bone-faint);
}

/* ── スマートフォン ─────────────────────────────── */

@media (max-width: 760px) {
  .top { padding: calc(18px + env(safe-area-inset-top)) 18px 0; }
  .brand h1 { font-size: 20px; }
  .brand p { font-size: 10px; margin-top: 8px; }
  .brand p span { display: none; }
  .status { font-size: 9px; letter-spacing: 0.1em; }

  .legend { display: none; }
  .credit {
    left: 0; right: 0;
    bottom: calc(6px + env(safe-area-inset-bottom));
    text-align: center;
    font-size: 8.5px;
  }

  .dock {
    bottom: calc(26px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    gap: 12px;
    justify-content: space-between;
  }
  .dock-now { flex: 1; min-width: 0; }
  .vol { display: none; } /* スマホは本体の音量ボタンで */
  .btn-drift { margin-right: 6px; }

  .panel {
    left: 12px; right: 12px;
    top: auto;
    bottom: calc(90px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 46vh;
    padding: 16px 18px 12px;
    transform: translateY(18px);
  }
  .panel.open { transform: none; }
  .panel-close { top: 6px; right: 8px; }
  .place { font-size: 30px; margin-top: 8px; }
  .place.long { font-size: 24px; }
  .place-ja { margin-top: 4px; font-size: 11.5px; }
  .now { margin-top: 12px; gap: 14px; }
  .temp { font-size: 42px; }
  .cond { gap: 2px; padding-bottom: 0; }
  .cond span, .cond em { font-size: 12.5px; }
  .scope { height: 22px; margin: 6px 0 4px; }
  .genre { padding-top: 9px; }
  .genre strong { font-size: 22px; margin-top: 3px; }
  .voices { margin: 5px 0 8px; font-size: 10.5px; }
  .row { padding: 5px 0; }
  .row .m small { display: none; }
  .score-head { padding: 7px 0 3px; }
}

/* 背の低い画面（横向きのスマホ、小さなウィンドウ） */
@media (max-height: 560px) {
  .intro { padding: 18px; }
  .intro h2 { font-size: clamp(30px, 7.5vw, 58px); margin: 8px 0 12px; }
  .intro-kicker { font-size: 13px; }
  .intro-lead { font-size: 15px; line-height: 1.7; }
  .intro-lead br { display: none; }
  .intro-body { margin-top: 10px; font-size: 11px; line-height: 1.8; }
  .intro-actions { margin-top: 16px; }
  .btn-enter { padding: 11px 24px; font-size: 12px; }
  .intro-foot { margin-top: 12px; }
  .panel { max-height: calc(100vh - 150px); }
}

@media (prefers-reduced-motion: reduce) {
  .intro-inner > * { animation-duration: 0.01s; animation-delay: 0s; }
  .flash.on { animation: none; }
}
