/* TV 全画面（1280x720 前提。vw ベースで追従） */
:root {
  --bg: #0b1220;
  --card: rgba(10, 16, 30, 0.72);
  --card-border: rgba(148, 163, 184, 0.16);
  --fg: #f1f5f9;
  --muted: #a5b4c8;
  --faint: #6b7a91;
  --accent: #38bdf8;
  --today: #f59e0b;
  --sun: #fb7185;
  --sat: #60a5fa;
  --p1: #ef4444;
  --p2: #f97316;
  --p3: #3b82f6;
  --gap: 1.1vw;
  --radius: 0.9vw;
  font-size: clamp(9px, 1.1vw, 22px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--gap);
  padding: var(--gap) 1.4vw;
  overflow: hidden;
  line-height: 1.3;
  position: relative;
}
/* 空の背景（sky.js が描く） */
.sky-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.top, .grid { position: relative; z-index: 1; }

/* ヘッダー: 日付 / 天気 / 時計 */
.top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2vw; padding: 0 0.4vw; text-shadow: 0 1px 6px rgba(0,0,0,0.55); }
.today { min-width: 0; max-width: 34vw; }
.today-date { font-size: 2.1rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.today-dow { font-size: 1rem; color: var(--muted); margin-top: 0.1em; }
.today-fact { font-size: 0.85rem; color: #dbe4f0; margin-top: 0.25em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; transition: opacity 0.35s; }
.today-fact.fade { opacity: 0; }
.clock { font-size: 3.8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.weather { display: flex; align-items: center; justify-content: center; gap: 2vw; min-width: 0; }
.wx-now { display: flex; align-items: center; gap: 0.6vw; white-space: nowrap; }
.wx-icon { font-size: 2.6rem; line-height: 1; }
.wx-temp { font-size: 2.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-desc { display: flex; flex-direction: column; font-size: 0.95rem; color: var(--muted); line-height: 1.3; }
.wx-desc b { color: var(--fg); font-weight: 600; }
.wx-days { display: flex; gap: 1.4vw; }
.wx-day { display: grid; grid-template-columns: auto auto; column-gap: 0.5vw; align-items: center; font-size: 0.85rem; color: var(--muted); white-space: nowrap; line-height: 1.25; }
.wx-day .ic { grid-row: 1 / 3; font-size: 1.7rem; line-height: 1; }
.wx-day .lbl { color: var(--fg); font-weight: 600; }
.wx-day .hi { color: var(--sun); } .wx-day .lo { color: var(--sat); }
.wx-day .rain { color: var(--accent); }

/* メイングリッド: 左上=カレンダー / 左下=バス / 右=写真（全高） */
.grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  grid-template-rows: 0.85fr 1.2fr;
  gap: var(--gap);
  min-height: 0;
}
.week { grid-column: 1; grid-row: 1; }
.airspace-card { grid-column: 2; grid-row: 1 / 3; }
.photos-card { grid-column: 2; grid-row: 1 / 3; }
.card[hidden] { display: none; }
.bus { grid-column: 1; grid-row: 2; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 0.9vw 1.1vw;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.5vw; gap: 0.6vw; }
.card-head h2 { margin: 0; font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.card-head h2 small { font-size: 0.8rem; font-weight: 500; color: var(--faint); margin-left: 0.4em; }
.card-sub { font-size: 0.8rem; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 週カレンダー: 今日から 7 日を列で並べる */
.week-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4vw; flex: 1; min-height: 0; }
.wday { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: 0.6vw; background: rgba(255,255,255,0.03); overflow: hidden; }
.wday.today { background: rgba(245, 158, 11, 0.12); outline: 1px solid rgba(245, 158, 11, 0.45); }
.wday-head { text-align: center; padding: 0.35vw 0.2vw 0.3vw; border-bottom: 1px solid var(--card-border); }
.wday-head .d { display: inline; font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.wday-head .w { display: inline; margin-left: 0.35em; font-size: 1.05rem; color: var(--muted); }
.wday.sun .wday-head .d, .wday.holiday .wday-head .d { color: var(--sun); }
.wday.sat .wday-head .d { color: var(--sat); }
.wday.today .wday-head .d { color: var(--today); }
.wday-head .hol { display: block; font-size: 0.9rem; color: var(--sun); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wday-body { display: flex; flex-direction: column; gap: 0.3vw; padding: 0.4vw 0.35vw; overflow: hidden; flex: 1; min-height: 0; }
.wev { border-radius: 0.4vw; padding: 0.25vw 0.5vw; font-size: 1.2rem; line-height: 1.25; background: rgba(56, 189, 248, 0.18); color: #e0f2fe; }
.wev .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.wev.timed { background: rgba(255,255,255,0.06); color: var(--fg); border-left: 0.25vw solid var(--accent); }
.wev.past { opacity: 0.4; }
.wev .t { font-size: 1.05rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 0.4em; }
.wev.more { background: transparent; color: var(--faint); text-align: center; font-size: 1.05rem; padding: 0 0.55vw; }
.wday-empty { color: var(--faint); font-size: 1.05rem; text-align: center; padding-top: 1vw; }


/* 上空（飛行機・雨雲） */
.airspace-map { position: relative; flex: 1; min-height: 0; border-radius: 0.6vw; overflow: hidden; background: #0a1222; }
.airspace-map canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.airspace-nearest { font-size: 0.85rem; margin-top: 0.45vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; line-height: 1.3; }
.airspace-nearest b { font-weight: 700; }
.airspace-nearest .rt { color: var(--today); font-weight: 600; margin-left: 0.3em; }
.airspace-nearest .meta { color: var(--muted); font-size: 0.8rem; margin-left: 0.3em; }
.airspace-nearest .muted { color: var(--faint); }

/* 写真スライドショー */
.photo-stage { position: relative; flex: 1; min-height: 0; border-radius: 0.6vw; overflow: hidden; background: #060a14; }
/* 写真全体を収め（contain）、余白は同じ写真をぼかして暗くした背景で埋める */
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease; }
.slide.show { opacity: 1; }
.slide img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.slide .bg { object-fit: cover; filter: blur(16px) brightness(0.45); transform: scale(1.12); }
.slide .fg { object-fit: contain; will-change: transform; }
.photos-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 0.95rem; text-align: center; padding: 1vw; }
.photos-empty[hidden] { display: none; }

/* バス（2×2） */
.bus-list { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 0.55vw; flex: 1; min-height: 0; }
.route { min-height: 0; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5vw; align-items: center; background: rgba(255,255,255,0.04); border-radius: 0.6vw; padding: 0.4vw 0.6vw; }
.route .info { min-width: 0; }
.route-head { display: flex; align-items: baseline; gap: 0.2em 0.4em; min-width: 0; flex-wrap: wrap; overflow: hidden; }
.route .op { font-size: 0.9rem; font-weight: 700; padding: 0.05em 0.45em; border-radius: 0.3em; white-space: nowrap; }
.route.kokusai .op { background: #14532d; color: #bbf7d0; }
.route.tobu .op { background: #1e3a8a; color: #bfdbfe; }
.route .dir { font-size: 1.15rem; font-weight: 600; line-height: 1.2; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.route .dir .arrow { color: var(--faint); margin: 0 0.2em; }
.route .next { display: flex; align-items: baseline; gap: 0.5em; margin-top: 0.15vw; }
.route .next .time { font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.route .next .in { font-size: 1.2rem; color: var(--accent); font-weight: 600; }
.route .next .in.soon { color: var(--today); }
.route .later { font-size: 1.1rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 0.1vw; }
.route .none { font-size: 1.1rem; color: var(--faint); margin-top: 0.3vw; }
.route .qr { background: #fff; padding: 0.25vw; border-radius: 0.35vw; width: 5.6vw; height: 5.6vw; flex: none; display: flex; align-items: center; justify-content: center; }
.route .qr img, .route .qr canvas, .route .qr table { width: 100% !important; height: 100% !important; display: block; }
.route .daytype { font-size: 0.85rem; color: var(--faint); white-space: nowrap; }
