:root {
  /* ヘッダー/フッター: 雨雲レーダーアプリと同じ黒基調 */
  --header-bg: #000;
  --header-text: #e5e7eb;
  --header-muted: #a0a0a0;
  --header-border: #333;
  --header-accent: #38bdf8;

  /* メインコンテンツ: ページ地は薄いグレー、カードは白 */
  --main-bg: #f5f5f5;
  --main-text: #1a1a1a;
  --main-muted: #6b7280;
  --main-border: #d8d8d8;
  --card-bg: #ffffff;
  --accent: #0284c7;

  --brand: #f0232d;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--main-bg);
  color: var(--main-text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "游ゴシック Medium", メイリオ, meiryo, sans-serif;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- サイト共通ヘッダー (雨雲レーダーアプリと同一デザイン) ---- */

.site-header {
  flex: none;
  background: #fefefe;
  border-bottom: 1px solid #d4d4d4;
}

.site-header-inner {
  padding: 8px 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .site-header-inner { padding-left: 20px; padding-right: 20px; }
}

.site-logo { display: flex; align-items: center; }

.site-logo-img {
  height: clamp(24px, 6vw, 34px);
  width: auto;
  display: block;
}

.site-lang {
  position: relative;
  display: flex;
  align-items: center;
  padding: 4px 6px;
}

.site-lang-icon {
  width: 24px;
  height: 24px;
  background-image: url("../../img/i_lang_select_sp.png");
  background-size: 24px 24px;
  background-repeat: no-repeat;
  background-position: center;
}

.site-lang-label { display: none; }

.site-lang-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: none;
  background-color: #fff;
  color: #000;
}

@media (min-width: 768px) {
  .site-lang {
    flex-direction: column;
    padding: 4px 10px 2px;
    border-left: 1px solid #f7bbc2;
    border-right: 1px solid #f7bbc2;
  }
  .site-lang-icon {
    width: 32px;
    height: 32px;
    background-image: url("../../img/i_lang_select_pc.png");
    background-size: 32px 32px;
  }
  .site-lang-label {
    display: inline-block;
    color: #f0232d;
    font-size: 11px;
    line-height: 1.4;
  }
}

/* ---- アプリヘッダー ---- */

.app-header {
  flex: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  flex-wrap: wrap;
}

.brand h1 { margin: 0; font-size: 1.15rem; }

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--header-muted);
  margin-left: auto;
}

.nav-link {
  background: #fff;
  color: var(--brand);
  text-decoration: none;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
}

.nav-link:hover { background: #fff; border-color: var(--brand); color: var(--brand); }

.rain-radar-cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  align-self: stretch;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px 20px;
}

.nav-icon { display: inline-flex; align-items: center; }

.nav-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  line-height: 1;
}

/* 選択中エリアの雨雲レーダーを、操作UIなしでそのまま見せるミニプレビュー */
.mini-radar-section { display: flex; flex-direction: column; gap: 4px; }

.mini-radar-section h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--main-muted);
}

.mini-radar-map {
  width: 100%;
  height: 250px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--main-border);
}

.mini-radar-credit {
  margin: 0;
  font-size: 0.5rem;
  color: var(--main-muted);
  text-align: right;
}

/* ---- 本文 ---- */

.app-main {
  flex: 1 1 auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  background: var(--main-bg);
  color: var(--main-text);
}

select, button {
  background: #fff;
  color: var(--main-text);
  border: 1px solid var(--main-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--main-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.app-description {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--main-muted);
}

.area-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  container-type: inline-size;
  container-name: area-picker-row;
}

.area-picker-row select { flex: 1 1 220px; }

.area-label { display: inline-flex; align-items: center; }

/* 「現在地の天気」ボタン: プルダウンの横に並べ、押下中はローディング表示にする */
.my-location-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--brand);
  border-color: var(--brand);
}

.my-location-btn:hover { border-color: var(--brand); }

.my-location-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.my-location-icon { display: inline-flex; align-items: center; }

/* 折り返す直前の幅ではテキストを消してアイコンのみのボタンにする */
@container area-picker-row (max-width: 400px) {
  .my-location-btn { gap: 0; padding: 6px 8px; }
  .my-location-text { display: none; }
}

/* LIVE JAPANサイト共通のヘッダースプライトから位置ピンのアイコンだけを切り出して使う */
.icon-pin {
  display: inline-block;
  width: 15px;
  height: 18px;
  background-image: url("https://rimage.gnst.jp/livejapan.com/images/sp/sprite/header/sprite.png?1747807290924");
  background-repeat: no-repeat;
  background-size: 136.8px 113.4px;
  background-position: -116.55px -67.95px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-message {
  min-height: 1.2em;
  color: var(--main-muted);
  font-size: 0.85rem;
}

.daily-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
}

.day-card {
  padding: 14px 16px;
  container-type: inline-size;
  container-name: day-card;
}

/* 今日/明日を1つの枠にまとめ、間を縦線で区切る */
.day-card + .day-card {
  border-left: 1px solid var(--main-border);
}

@media (max-width: 768px) {
  .day-card { padding: 10px 12px; }
}

@media (max-width: 389px) {
  .daily-cards { grid-template-columns: 1fr; }
  .day-card + .day-card {
    border-left: none;
    border-top: 1px solid var(--main-border);
  }
}

.day-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--main-muted);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.day-card h2::before,
.weekly-section h2::before,
.related-articles-section h2::before,
.nationwide-section h2::before,
.mini-radar-section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--brand);
  vertical-align: middle;
}

.day-card h2::before { align-self: center; }
.weekly-section h2::before,
.related-articles-section h2::before,
.nationwide-section h2::before,
.mini-radar-section h2::before { margin-right: 6px; }

.day-date { font-size: 0.65rem; color: var(--main-muted); font-weight: 400; }

/* 天気アイコン+テキストを左、気温+降水確率を右に配置。
   幅が足りず折り返す場合は自然に「気温+降水確率」が下段に落ちる。 */
.day-body {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px 16px;
}

.day-weather { min-width: 0; display: flex; flex-direction: column; align-items: center; }

.day-info { min-width: 0; }

/* 気象庁の公式アイコンは正方形ではなく横長(概ね3:2)なため、枠も同じ比率の
   固定サイズ(横90px・縦60px)にする。カードがそれより狭い場合だけmax-widthで縮める。 */
.day-icon {
  width: 90px;
  height: 60px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.day-icon svg, .day-icon img { display: block; max-width: 100%; max-height: 100%; height: auto; }

.day-label { font-size: clamp(13px, 4.5cqw, 16px); font-weight: 700; margin: 6px 0 0; text-align: center; }

.day-temps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: clamp(18px, 6.7cqw, 24px);
  font-weight: 600;
  margin-bottom: 6px;
}

.temp-high, .temp-low, .temp-now { white-space: nowrap; }
.temp-high { color: #dc2626; }
.temp-low { color: #2563eb; }
.temp-now { color: var(--main-text); }
.temp-label { font-size: 0.75em; font-weight: 500; }

/* カード自体の横幅に応じて、アイコン+天気テキストと気温+降水確率の配置を段階的に詰める。
   最高/最低はできるだけ横並びのままにしたいため、途中で強制的に縦並びにする段階は設けず、
   .day-temps の flex-wrap による自然な折り返し(本当に入らない時だけ)に任せる。 */
@container day-card (max-width: 260px) {
  .day-card { padding: 12px; }
  .day-body { flex-direction: column; align-items: center; }
  .day-info { width: 100%; display: flex; flex-direction: column; align-items: center; }
  .day-temps { flex-direction: row; justify-content: center; gap: 6px 14px; }
  .day-pops { justify-content: center; }
}

@container day-card (max-width: 150px) {
  .day-temps { flex-direction: column; align-items: center; gap: 2px; }
}

.day-pops { display: flex; align-items: center; }
.pop-icon { display: inline-flex; align-items: center; color: var(--accent); vertical-align: middle; }
/* cqw は .day-card 内(コンテナ指定あり)でのみ意味を持つため、週間予報側には影響しないよう
   .day-pops 配下だけに絞る */
.day-pops .pop-icon svg { width: clamp(11px, 3.6cqw, 13px); height: auto; }
.pop-value { font-size: clamp(13px, 4.5cqw, 16px); font-weight: 600; color: var(--accent); vertical-align: middle; margin-left: 4px; }

.weekly-section h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--main-muted);
}

.weekly-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  container-type: inline-size;
  container-name: weekly-list;
}

/* 気温・降水確率は右寄せかつ全行で縦に揃えたいので grid のまま維持する。
   ただし「天気テキスト」列を 1fr で丸ごと引き伸ばすと、列自体は横幅いっぱいに
   広がったカードの右端まで気温を押し出し、テキストが短い時に間延びした空白が
   目立っていた。列を1frにするのはそのままに、行自体の最大幅を絞ることで
   間延びを抑えつつ、右寄せ・縦の整列は維持する。 */
.weekly-item {
  display: grid;
  grid-template-columns: 60px 60px 1fr auto;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid var(--main-border);
  font-size: 0.85rem;
}

.weekly-item:first-child { border-top: none; }

.weekly-icon { width: 60px; height: 40px; display: flex; align-items: center; justify-content: center; min-width: 0; }
.weekly-icon svg, .weekly-icon img { display: block; max-width: 100%; max-height: 100%; height: auto; }

/* 万一(他言語などで)さらに長い天気テキストが来た場合の保険として、重ならず省略記号で収める */
.weekly-label { min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* スマホ幅など、1行に収まらない場合は気温+降水確率を2行目に折り返す(右寄せは維持)。
   最長のラベル("Cloudy (at times Sunny)"等)でも1行に収まる目安の460pxを閾値にする。 */
@container weekly-list (max-width: 460px) {
  .weekly-item { grid-template-columns: 56px 60px 1fr; }
  .weekly-label { overflow: visible; text-overflow: clip; white-space: normal; }
  .weekly-temp-pop {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

.weekly-temp-pop { display: flex; align-items: center; gap: 12px; white-space: nowrap; }

.weekly-temps { display: flex; gap: 8px; white-space: nowrap; font-weight: 600; }

.weekly-pop { display: flex; align-items: center; gap: 3px; color: var(--accent); font-size: 0.8rem; white-space: nowrap; }
.weekly-pop .pop-icon { color: inherit; }

/* 「関連記事」誘導カセット: PCは画像+キャプションの3枠グリッド、
   狭い幅ではサムネイル+テキストを横並びにした1列のリストに切り替える。 */
.related-articles-section h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--main-muted);
}

.related-articles-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-article-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.related-article-img-area {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--main-border);
}

.related-article-img-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-article-txt {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 599px) {
  .related-articles-list {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .related-article-item {
    border-top: 1px solid var(--main-border);
  }

  .related-article-item:first-child {
    border-top: none;
  }

  .related-article-link {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
  }

  .related-article-img-area {
    aspect-ratio: 1 / 1;
    width: 84px;
  }

  .related-article-txt {
    margin: 0;
  }
}

/* 「晴れの日/雨の日のアクティビティ」カセット。見出し自体をタブにして切り替える
   (通常のカードのようなh2は置かず、2つのタブボタンが見出しを兼ねる)。
   カードのレイアウトは関連記事カセット(.related-article-*)と揃えている。 */
.activities-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--main-border);
}

.activities-tab {
  flex: 1 1 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0px;
  padding: 4px 4px 10px;
  margin-bottom: -1px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--main-muted);
  cursor: pointer;
  text-align: center;
}

.activities-tab.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.activities-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.activities-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--main-muted);
}

.activity-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.activity-img-area {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--main-border);
}

.activity-img-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.activity-body { margin-top: 8px; }

.activity-name {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.activity-price {
  margin: 4px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--main-text);
}

@media (max-width: 599px) {
  .activities-list {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .activity-item {
    border-top: 1px solid var(--main-border);
  }

  .activity-item:first-child {
    border-top: none;
  }

  .activity-link {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
  }

  .activity-img-area {
    aspect-ratio: 1 / 1;
    width: 84px;
  }

  .activity-body { margin-top: 0; }
}

.nationwide-section h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--main-muted);
}

/* 見出しと「今日/明日」切り替えボタンを両端に配置する */
.nationwide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.nationwide-day-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 6px;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
}

.nationwide-day-toggle:hover { border-color: var(--brand); }

.nationwide-day-toggle-arrow { font-size: 1rem; line-height: 1; }

.jp-layout {
  position: relative;
}

/* 地図はできるだけ大きく見せる。吹き出しは地図の左右端の上に重ねて置く。 */
.jp-map {
  position: relative;
  width: 100%;
  margin: 0 auto;
  z-index: 1;
}

.jp-map-img {
  display: block;
  width: 100%;
  height: auto;
}

.jp-markers {
  position: absolute;
  inset: 0;
}

.jp-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--brand);
  border: 1px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.jp-map-credit {
  margin: 6px 0 0;
  font-size: 0.55rem;
  color: var(--main-muted);
  text-align: center;
}

.jp-map-credit a { color: inherit; }

/* 吹き出し(地名+アイコン+気温+降水確率)を地図の左右端の上に重ねて縦並びで配置する */
.jp-callouts {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 90px;
  z-index: 3;
}

.jp-callouts-left { left: 0; }
.jp-callouts-right { right: 0; }

.jp-callout {
  background: #fff;
  border: 1px solid var(--main-border);
  border-radius: 7px;
  padding: 2px 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.jp-callout:hover,
.jp-callout:focus-visible {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--brand);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
  outline: none;
}

.jp-callout-name {
  font-size: 0.64rem;
  font-weight: 700;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jp-callout-body {
  display: flex;
  align-items: center;
  gap: 2px;
}

.jp-callout-icon { line-height: 1; flex: none; }
.jp-callout-icon svg { display: block; }
.jp-callout-icon img { display: block; width: auto; }

.jp-callout-detail { min-width: 0; }

.jp-callout-temps {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 2px;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.15;
}

.jp-callout-pop {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--accent);
}

.jp-leader-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.jp-leader-line {
  stroke: var(--main-border);
  stroke-width: 1;
}

@media (max-width: 480px) {
  .jp-callouts { width: 78px; }
  .jp-callout-icon svg { width: 20px; height: 20px; }
  .jp-callout-icon img { height: 20px; width: auto; }
  .jp-callout-name { font-size: 0.58rem; }
  .jp-callout-temps { font-size: 0.58rem; }
  .jp-callout-pop { font-size: 0.54rem; }
}

@media (max-width: 360px) {
  .jp-callouts { width: 68px; }
}

/* PCでは吹き出しが地図に埋もれすぎないよう、地図に少し余白を持たせて吹き出しを大きくする */
@media (min-width: 600px) {
  .jp-map { max-width: 560px; }

  .jp-callouts {
    width: 118px;
    gap: 8px;
  }

  .jp-callout { padding: 3px 6px; border-radius: 8px; }

  .jp-callout-body { gap: 4px; }

  .jp-callout-icon svg { width: 30px; height: 30px; }
  .jp-callout-icon img { height: 30px; width: auto; }

  .jp-callout-name { font-size: 0.8rem; margin-bottom: 1px; }
  .jp-callout-temps { font-size: 0.8rem; }
  .jp-callout-pop { font-size: 0.72rem; }
}

.banner-section {
  display: flex;
  justify-content: center;
}

.app-footer {
  flex: none;
  padding: 10px 16px;
  font-size: 0.75rem;
  background: var(--header-bg);
  color: var(--header-muted);
  text-align: center;
  border-top: 1px solid var(--header-border);
}
