/* 公開ビューワー（Read-Only）— 有田ケーブルネットワーク
   カード型タイムライン: 薄ブルー背景 × 白カード × ネイビー文字 */
:root {
  --bg: #eaf1fb;            /* ページ背景（ごく薄いブルー） */
  --surface: #ffffff;       /* カード・バー面 */
  --ink: #1f2d3d;           /* 本文（濃ネイビーグレー） */
  --muted: #8a97a8;         /* 補助文字 */
  --label: #2b5fd9;         /* エリアラベルの青 */
  --primary: #24527a;       /* メイン（藍） */
  --navy: #1e3a8a;          /* タイムラインのドット */
  --rail: #c9d9f0;          /* タイムラインの縦ライン */
  --line: #dfe7f2;          /* 罫線（極薄ブルーグレー） */
  --sat: #2f6aa8;           /* 土曜（落ち着いた青） */
  --sun: #b3524a;           /* 日曜（落ち着いた赤） */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(30, 58, 138, 0.06), 0 4px 14px rgba(30, 58, 138, 0.05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

.viewer {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- ページタイトル ---- */
.v-pagehead {
  padding: 18px 20px 10px;
  text-align: center;
}
.v-pagehead h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.06em;
}
.v-pagehead p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---- ナビ（ツールバー） ---- */
.v-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.v-nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 980px;
  margin: 0 auto;
}
.v-datenav { display: flex; align-items: center; gap: 8px; }
.v-iconbtn {
  height: 42px; width: 42px;
  border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius-sm);
  color: var(--primary); font-size: 20px; cursor: pointer;
  transition: background 0.18s ease;
}
.v-iconbtn:hover { background: #f2f7ff; }
.v-range {
  height: 42px; display: flex; align-items: center;
  padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--primary); white-space: nowrap;
}
.v-tabs {
  display: inline-flex; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px;
}
.v-tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease;
}
.v-tab:hover { color: var(--primary); }
.v-tab.active { background: var(--primary); color: #fff; }

/* 拡大・縮小（文字サイズ） */
.v-zoom { display: inline-flex; align-items: center; gap: 4px; }
.v-zoom .v-iconbtn { font-size: 18px; font-weight: 700; }

.v-searchbtn {
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 0; background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background 0.18s ease;
}
.v-searchbtn:hover { background: #1d4363; }

/* ---- 検索モーダル ---- */
.v-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(30, 58, 138, 0.28);
  display: grid; place-items: center; padding: 16px;
}
.v-modal[hidden] { display: none; }
.v-modal-card {
  width: 560px; max-width: 100%; max-height: 88vh;
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: 0 18px 46px rgba(30, 58, 138, 0.18);
  display: flex; flex-direction: column; overflow: hidden;
  animation: v-pop 0.18s ease-out;
}
@keyframes v-pop {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
.v-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.v-modal-head h2 { margin: 0; font-size: 16px; color: var(--primary); }
.v-modal-x { border: 0; background: transparent; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; }
.v-modal-x:hover { color: var(--ink); }
.v-modal-body { padding: 16px 18px; overflow: auto; }
.v-srow { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.v-srow input[type="text"] { flex: 1; }
.v-srow input, .v-srow select {
  height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 10px; font-size: 15px; color: var(--ink); background: #fff;
}
.v-srow input:focus, .v-srow select:focus { outline: 2px solid #bcd2f7; border-color: var(--label); }
.v-speriod { color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.v-sresults {
  margin-top: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: #f6f9ff; padding: 12px 14px; min-height: 120px; max-height: 320px; overflow: auto;
  font-size: 15px; line-height: 1.9;
}
.v-sresults .row { color: var(--ink); font-variant-numeric: tabular-nums; }
.v-sresults .none { color: var(--muted); font-size: 14px; }
.v-modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-top: 1px solid var(--line);
}
.v-scount { font-size: 13px; color: var(--muted); }
.v-sfoot-btns { display: flex; gap: 8px; }
.v-btn-ghost {
  height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 14px; cursor: pointer;
}
.v-btn-ghost:hover { background: #f2f7ff; }
.v-btn-primary {
  height: 40px; padding: 0 16px; border-radius: 9px; border: 0;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
}
.v-btn-primary:hover { background: #1d4363; }
.v-btn-primary:disabled { opacity: 0.45; }

/* ---- 時間軸グリッド（新聞EPG型） ---- */
.v-main { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; background: var(--bg); }

.v-board.g-board {
  display: grid;
  grid-template-columns: var(--gutter, 52px) repeat(var(--cols, 1), minmax(var(--colmin, 150px), 1fr));
  align-items: start;
  width: 100%;
  min-width: max-content;   /* 列が入り切らない時は横スクロール */
  background: var(--surface);
}

/* 左上コーナー */
.g-corner {
  position: sticky; top: 0; left: 0; z-index: 7;
  background: var(--surface);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
/* 日付ヘッダー */
.g-dayhead {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-align: center; padding: 9px 4px; font-size: 14px; font-weight: 700; color: var(--ink);
}
.g-dayhead.sat { color: var(--sat); }
.g-dayhead.sun { color: var(--sun); }
.g-dayhead.today { color: #fff; background: var(--primary); }

/* 時刻ガター */
.g-gutter {
  position: sticky; left: 0; z-index: 3;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.g-hlabel {
  position: absolute; right: 6px; transform: translateY(-0.6em);
  font-size: 12px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--surface); padding: 0 2px;
}

/* 日列 */
.g-col { position: relative; border-right: 1px solid var(--line); }

/* 番組ブロック */
.g-block {
  position: absolute; left: 3px; right: 3px;
  border: 1px solid var(--line); border-left: 4px solid var(--navy);
  border-radius: 6px;
  padding: 4px 8px; overflow: hidden;
}
.g-block .g-time {
  font-size: 11px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.g-block .g-name {
  font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.g-block.is-live {
  box-shadow: 0 0 0 2px rgba(43, 95, 217, 0.35) inset;
}
.g-block .g-live {
  display: inline-block; margin-top: 2px;
  background: #e7efff; color: var(--label);
  font-size: 10px; font-weight: 700; padding: 0.1em 0.6em; border-radius: 999px;
}
/* 現在時刻ライン */
.g-nowline {
  position: absolute; left: 0; right: 0; height: 2px; z-index: 4;
  background: #e53e3e;
}
.g-nowline::before {
  content: ''; position: absolute; left: -1px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: #e53e3e;
}

/* ---- 1ヶ月ビュー（カレンダー） ---- */
.v-board.v-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, 1fr);   /* 曜日ヘッダー + 6週を縦いっぱいに均等 */
  min-width: 700px;
  height: 100%;                              /* .v-main いっぱいに（幅・高さフィット） */
  gap: 1px; background: var(--line);
}
.v-mhead {
  position: sticky; top: 0; z-index: 4;
  background: #f0f5fd; text-align: center; padding: 8px 2px;
  font-size: 13px; font-weight: 700; color: var(--primary);
}
.v-mhead.sat { color: var(--sat); } .v-mhead.sun { color: var(--sun); }
.v-mcell {
  background: var(--surface); min-height: 0; padding: 5px 5px 7px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;                          /* 1fr で縦に伸ばす。多い日ははみ出さず切り詰め */
  transition: background 0.15s ease;
}
.v-mcell:hover { background: #f3f7ff; }
.v-mcell.out { background: #f6f8fc; opacity: 0.5; }
.v-mnum { font-size: 13px; font-weight: 700; color: var(--ink); }
.v-mnum.sat { color: var(--sat); } .v-mnum.sun { color: var(--sun); }
.v-mitem {
  display: flex; gap: 5px; align-items: baseline;
  border-radius: 4px; padding: 1px 4px; overflow: hidden; white-space: nowrap;
}
.v-mitem .mt { font-size: 11px; font-weight: 700; color: #475569; font-variant-numeric: tabular-nums; }
.v-mitem .mn { font-size: 11px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.v-more { font-size: 10px; color: var(--muted); }

.v-empty {
  padding: 40px 16px; text-align: center; color: var(--muted); font-size: 14px;
}

/* ---- 免責事項（下部固定） ---- */
.v-disclaimer {
  position: sticky; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  text-align: center; font-size: 12.5px; color: var(--muted);
  padding: 10px 12px;
}

/* ---- レスポンシブ（スマホ） ---- */
@media (max-width: 768px) {
  .v-pagehead { padding: 14px 14px 6px; }
  .v-pagehead h1 { font-size: 18px; }
  .v-pagehead p { font-size: 11.5px; }

  .v-nav { padding: 8px 10px; }
  .v-nav-row { gap: 8px 8px; }

  /* 1段目: 日付ナビを横いっぱいに、検索はアイコンのみ */
  .v-datenav { flex: 1 1 auto; }
  .v-iconbtn { height: 40px; width: 40px; font-size: 18px; }
  .v-range {
    height: 40px; font-size: 13.5px; padding: 0 10px;
    flex: 1 1 auto; justify-content: center;
  }
  .v-searchbtn {
    width: 44px; height: 44px; padding: 0;
    font-size: 18px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .v-searchbtn .sb-label { display: none; }
  .v-tabs { flex: 1 1 auto; justify-content: center; }
  .v-tab { padding: 8px 12px; font-size: 13.5px; }

  /* 検索モーダル: 短い縦画面でも収める */
  .v-modal { align-items: flex-start; justify-items: center; padding: 12px; }
  .v-modal-card { width: 100%; max-height: calc(100dvh - 24px); }
  .v-modal-body { flex: 1 1 auto; min-height: 0; }
  .v-sresults { max-height: none; }

  /* 時間軸グリッド（スマホ）: ガター狭め・列幅~116px。1日=フィット、3日/1週間=横スクロールで比較可 */
  .v-board.g-board { --gutter: 46px; --colmin: 108px; }
  .g-dayhead { font-size: 13px; padding: 7px 3px; }
  .g-hlabel { font-size: 11px; }
  .g-block { padding: 3px 6px; }
  .g-block .g-name { font-size: 13px; }
  .g-block .g-time { font-size: 10.5px; }

  /* 1ヶ月: 700px強制を解除し画面幅にフィット、セルはドット俯瞰 */
  .v-board.v-month {
    min-width: 0;
    height: 100%;
    grid-template-rows: auto repeat(6, 1fr);
  }
  .v-mhead { font-size: 12px; padding: 6px 1px; }
  .v-mcell { min-height: 0; padding: 3px; gap: 3px; }
  .v-mnum { font-size: 12px; }
  .v-mdots { display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
  .v-dot { width: 7px; height: 7px; border-radius: 50%; }
  .v-dotmore { font-size: 9px; color: var(--muted); line-height: 7px; }
}
