/* =====================================================================
   Japan Live Cam - 共通スタイル
   PC / スマホ レスポンシブ対応
   ===================================================================== */
:root {
  /* ロゴ(#012051: deep navy / 216.8°) の色相を保ったまま明度を上げた薄青
     例: bg L92% S30% → #e6ecf5 */
  --bg: #e6ecf5;
  --card: #ffffff;
  --ink: #1d2b3a;
  --sub: #64748b;
  --line: #cfd9e8;
  --brand: #00B8D1; /*#0f766e;*/
  --brand-dark: #008496;/*#115e59;*/
  --accent: #e11d48;
  --live: #dc2626;
  --live-bg: #fee2e2;
  --idle: #94a3b8;
  --idle-bg: #f1f5f9;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 23, 42, .08);
  --header-height: 72px;          /* ロゴ表示用に高めに設定 */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
}
img { max-width: 100%; height:auto;}
.filter-tabs .tab.on { /* unify active tab with logo navy hue */
                       background: var(--brand-dark); border-color: var(--brand-dark); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ================= ヘッダー ================= */
.site-header { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-height, 72px); gap: 12px; }
.logo { color: #fff; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.logo:hover { text-decoration: none; }
.logo-img {
  height: calc(var(--header-height, 72px) - 16px);   /* 上下に 8px の余白 */
  width: auto;
  max-width: 280px;
  display: block;
  /* 黒背景ロゴを teal ヘッダー上で見やすくするため軽いシャドウ */
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}
.logo-mark { font-size: 1.3rem; }
.logo-text { white-space: nowrap; }
.site-nav { display: flex; gap: 18px; }
.site-nav a { color: rgba(255, 255, 255, .85); font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, .12); text-decoration: none; }
.site-nav a.on { color: #fff; background: rgba(255, 255, 255, .18); }

/* ================= ヒーロー ================= */
.hero { text-align: center; padding: 42px 0 8px; position: relative; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.3rem); margin: 0 0 10px; }
.hero p { color: var(--sub); margin: 0 0 22px; }
.hero-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 26px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 1.6rem; color: var(--brand); }
.stat span { color: var(--sub); font-size: .85rem; }

/* ヒーロー右上のキャラ立ち絵 (chara2.png) — TOPページ黒塗り位置に配置
   v5.3.7 改訂:
     - text-align:center の親 .hero に inline img が乗ると中央に寄せてしまうため
       display:block と position:absolute を !important 併用
     - ヒーローテキストと LIVE 配信中セクションは一切広げない (既存スタイル不変)
     - inline style フォールバックも img タグ側に指点 */
.hero-chara {
  display: block !important;
  position: absolute !important;
  top: 70px !important;
  right: 80px !important;
  width: 150px;
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  margin: 0 !important;
}

/* ================= セクション ================= */
.map-section, .fav-section, .new-section, .pref-list-section, .pref-head, .fav-section.page { margin-top: 40px; }
h2 { font-size: 1.3rem; margin: 0 0 6px; }
.section-note, .map-hint { color: var(--sub); font-size: .9rem; margin: 0 0 16px; }

/* ================= 日本地図 ================= */
.japan-map {
  background: linear-gradient(180deg, #e6ecf5 0%, #dbe4f0 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px; max-height: 620px; overflow: hidden;
}
.japan-map svg { width: 100%; height: auto; display: block; }
.japan-map .pref path {
  fill: #c8d6e8; stroke: #ffffff; stroke-width: 1800; cursor: pointer;
  transition: fill .15s, filter .15s;
}
.japan-map .pref:hover path { filter: brightness(.93); }
.japan-map .pref:focus { outline: none; }
.japan-map .pref:focus path { filter: brightness(.90); }
.japan-map .pref.has-cam path { fill: #a9cce8; }
.japan-map .pref.has-live path { fill: #8fd6b8; }
.japan-map .pref.none path { fill: #e6edf4; }
.japan-map .badge-circle { fill: #ffffff; stroke: var(--brand); stroke-width: 26000; pointer-events: none; }
.japan-map .badge-text { font-weight: 800; fill: var(--brand-dark); pointer-events: none; font-family: sans-serif; }
.japan-map .pref.has-live .badge-circle { stroke: var(--live); }
.japan-map .pref.has-live .badge-text { fill: var(--live); }
.map-legend { display: flex; gap: 20px; justify-content: center; margin-top: 12px; font-size: .85rem; color: var(--sub); flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }
.map-legend .live i { background: #8fd6b8; }
.map-legend .normal i { background: #a9cce8; }
.map-legend .none i { background: #e6edf4; border: 1px solid #d3dde7; }

/* ================= 日本地図(スマホ用 地方別リスト #pref-list) =================
   map.js の buildList() が生成する div。768px以下で .japan-map の代わりに表示。
   JS側で display:none をインラインで設定しているため、表示側は !important で上書き。 */
#pref-list { display: none; }
#pref-list .pref-region { margin-bottom: 16px; }
#pref-list .pref-region:last-child { margin-bottom: 0; }
#pref-list .pref-region__title {
  margin: 0 0 8px; padding: 6px 12px; border-radius: 8px;
  font-size: .95rem; color: #fff;
}
#pref-list .pref-region__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px;
}
#pref-list .pref-btn {
  border: none; border-radius: 8px; padding: 8px 10px; font-size: .82rem; font-weight: 600;
  cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 4px;
}
#pref-list .pref-btn:hover { filter: brightness(.95); }
#pref-list .pref-btn.none { opacity: .85; }
#pref-list .pref-btn__count { font-weight: 400; font-size: .75rem; }

@media (max-width: 768px) {
  #japan-map { display: none; }
  #pref-list { display: block !important; }
}

/* ================= カードグリッド ================= */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .1s;
}
.card:hover { transform: translateY(-2px); }
.card .thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #0f172a; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.92); }
.card.is-idle .thumb img { filter: grayscale(.85) brightness(.92); }
.card .badge { position: absolute; top: 8px; left: 8px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.badge .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-right: 5px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.badge.live { background: var(--live); color: #fff; }
.badge.idle { background: var(--idle); color: #fff; }
.badge.unknown { background: #475569; color: #fff; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .name { font-size: .98rem; margin: 0; line-height: 1.4; }
.card .pref-name { margin: 0; font-size: .78rem; color: var(--sub); }
.card .live-title { margin: 2px 0 0; font-size: .8rem; color: var(--sub); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .actions { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 6px; }
.fav-btn {
  border: 1px solid var(--line); background: #fff; width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; font-size: 1.05rem; color: var(--idle); line-height: 1; transition: all .15s;
}
.fav-btn:hover { transform: scale(1.12); border-color: var(--accent); }
.fav-btn.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.sns { display: flex; gap: 6px; flex-wrap: wrap; }
.sns-link {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px;
  padding: 0 8px; border-radius: 8px; font-size: .78rem; font-weight: 700; color: #fff; background: var(--sub);
}
.sns-link:hover { text-decoration: none; filter: brightness(1.1); }
.sns-link.x { background: #000; }
.sns-link.facebook { background: #1877f2; }
.sns-link.line { background: #06c755; }
.sns-link.instagram { background: #e1306c; }
.sns-link.youtube { background: #ff0000; }
.sns-link.website { background: #334155; }
.sns-link.share { background: #eef2f7; color: var(--sub); border: 1px solid var(--line); }
.empty { color: var(--sub); padding: 30px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ================= 都道府県ページ ================= */
.crumb { font-size: .82rem; color: var(--sub); margin: 0 0 4px; }
.pref-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--brand); padding-bottom: 16px; }
.pref-head h1 { margin: 0 0 6px; font-size: 1.6rem; }
.pref-head-info { display: flex; gap: 14px; align-items: center; margin: 0; color: var(--sub); font-size: .9rem; }
.info-link { background: var(--card); border: 1px solid var(--brand); color: var(--brand); padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: .9rem; }
.info-link:hover { background: var(--brand); color: #fff; text-decoration: none; }
.pref-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; margin-top: 22px; align-items: start; }
@media (max-width: 860px) { .pref-layout { grid-template-columns: 1fr; } }
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--card); padding: 7px 16px; border-radius: 20px;
  cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--sub);
}
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pref-side { display: flex; flex-direction: column; gap: 16px; }
.side-note { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-size: .83rem; color: var(--sub); }
.side-note h3 { font-size: .95rem; color: var(--ink); margin: 0 0 6px; }

/* ================= 都道府県一覧リンク ================= */
.pref-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; padding: 0; margin: 12px 0 0; }
.pref-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.pref-list a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; color: var(--ink); font-weight: 600; }
.pref-list a:hover { background: #f0faf9; text-decoration: none; }
.pref-list .cnt { color: var(--sub); font-size: .78rem; font-weight: 400; }

/* ================= バナー ================= */
.banner { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.banner-top .banner-item, .banner-footer .banner-item { text-align: center; }
.banner-item a { display: inline-block; }
.banner-item img { border-radius: 10px; max-width: 100%; }
.banner .custom iframe { max-width: 100%; }

/* ================= フッター ================= */
.site-footer { margin-top: 50px; background: #12202e; color: #b7c3cf; text-align: center; padding: 30px 16px 20px; }
.site-footer .logo { justify-content: center; color: #fff; margin-bottom: 6px; }
.site-footer p { margin: 4px 0; font-size: .85rem; }
.foot-links a { color: #e6edf4; }
.copy { color: #6b7a89; font-size: .78rem; }

/* ================= 管理画面 ================= */
body.admin { background: #f1f5f9; }
.admin-header { background: #0f172a; color: #fff; }
.admin-header .wrap { display: flex; justify-content: space-between; align-items: center; height: 56px; flex-wrap: wrap; gap: 8px; }
.admin-header .logo { font-size: 1rem; }
.admin-nav { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-nav a { color: #cbd5e1; font-size: .86rem; font-weight: 600; padding: 5px 8px; border-radius: 6px; }
.admin-nav a:hover { color: #fff; background: #1e293b; text-decoration: none; }
.admin-nav .logout { color: #fda4af; }
main.wrap.admin-main { padding-top: 20px; padding-bottom: 40px; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.a-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.a-card strong { display: block; font-size: 1.8rem; color: var(--brand); }
.a-card.live strong { color: var(--live); }
.a-card.idle strong { color: var(--idle); }
.a-card span { color: var(--sub); font-size: .82rem; }
.a-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: .88rem; }
.a-table th { background: #f8fafc; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.a-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.a-table tr.off { opacity: .55; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; }
.a-form { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 26px; }
.f-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.a-form label { display: block; font-size: .82rem; font-weight: 700; color: var(--sub); margin-bottom: 8px; }
.a-form input[type=text], .a-form input[type=url], .a-form input[type=password], .a-form input[type=number], .a-form input[type=datetime-local],
.a-form select, .a-form textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; margin-top: 4px; }
.a-form small { font-weight: 400; color: var(--sub); display: block; margin-top: 3px; }
.a-form .check { font-weight: 600; color: var(--ink); }
.a-form .check input { margin-right: 6px; width: auto; }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 16px; border-radius: 9px; font-size: .88rem; font-weight: 700; cursor: pointer; }
.btn:hover { text-decoration: none; background: #f8fafc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--accent); border-color: #fecdd3; }
.btn.danger:hover { background: #fff1f2; }
.btn.small { padding: 4px 10px; font-size: .78rem; }
.note { font-size: .85rem; color: var(--sub); background: #eff6ff; border-left: 4px solid #3b82f6; padding: 8px 12px; border-radius: 0 8px 8px 0; }
.inline { display: inline; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: .9rem; margin: 10px 0; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #991b1b; }

/* ログイン */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: linear-gradient(160deg, #0f766e, #134e4a); }
.login-box { background: #fff; border-radius: 16px; padding: 32px; width: min(92vw, 400px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-box h1 { font-size: 1.2rem; margin: 0 0 4px; }
.login-box h2 { font-size: .95rem; color: var(--sub); margin: 0 0 18px; font-weight: 600; }
.login-box form label { display: block; font-size: .82rem; font-weight: 700; color: var(--sub); margin-bottom: 14px; }
.login-box form input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; }
.login-box form .btn { width: 100%; margin-top: 6px; }

/* ================= その他 ================= */
body.error main { text-align: center; padding-top: 80px; }
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
@media (max-width: 600px) {
  .header-inner { height: auto; padding: 8px 0; gap: 6px; }
  .logo-img { height: 44px; max-width: 200px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .hero { padding-top: 24px; padding-right: 116px; }
  .japan-map { max-height: 480px; }
  .stat { padding: 8px 16px; }
  .stat strong { font-size: 1.25rem; }
  .hero-chara { width: 100px !important; top: 14px !important; right: 12px !important; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .hero { padding-right: 168px; }
  .hero-chara { width: 120px !important; top: 28px !important; right: 8px !important; }
}

/* v5.3.8: hero右パディング (キャラの占有領域を確保) */
@media (min-width: 901px) and (max-width: 1100px) { .hero { padding-right: 168px; } }
@media (min-width: 1101px) { .hero { padding-right: 170px; } }
