:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --border: #e1e5ea;
  --green: #2da44e;
  --yellow: #d4a72c;
  --orange: #e8710a;
  --red: #d1242f;
  --blue: #1f6feb;
  --gray: #c5cbd3;
  --blue-bg: #e8f1fe;
  --green-bg: #e6f6ea;
  --yellow-bg: #fff6d9;
  --orange-bg: #ffecd6;
  --red-bg: #fde8e8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419;
    --card: #1a2028;
    --text: #e6e9ee;
    --muted: #9aa5b1;
    --border: #2d3640;
    --green: #3fb950;
    --yellow: #d29922;
    --orange: #f0883e;
    --red: #f85149;
    --blue: #58a6ff;
    --gray: #3b4550;
    --blue-bg: #14263f;
    --green-bg: #12301c;
    --yellow-bg: #33290d;
    --orange-bg: #3a2410;
    --red-bg: #3b1518;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 16px; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 16px; }
.site-header h1 { font-size: 1.25rem; margin: 0; }
.rss { color: var(--muted); font-size: .85rem; text-decoration: none; border: 1px solid var(--border); padding: 2px 10px; border-radius: 999px; flex: none; }
.rss:hover { color: var(--text); }

.loading, .error { color: var(--muted); padding: 24px 0; }
.error { color: var(--red); }

/* 全体バナー */
.banner { border-radius: 8px; padding: 16px 20px; font-weight: 700; font-size: 1.1rem; color: #fff; margin-bottom: 20px; }
.banner.normal { background: var(--green); }
.banner.minor { background: var(--yellow); color: #1f2933; }
.banner.major { background: var(--orange); }
.banner.critical { background: var(--red); }
.banner.maintenance { background: var(--blue); }
.banner.limited { background: var(--blue); }

/* 各種カード */
.notice, .incident, .services, .history { background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 20px; }
.notice { background: var(--blue-bg); border-color: var(--blue); padding: 14px 16px; }
.notice h2, .incident h2 { font-size: 1rem; margin: 0 0 4px; }
.notice .label { display: inline-block; font-size: .75rem; font-weight: 700; color: #fff; background: var(--blue); border-radius: 4px; padding: 0 6px; margin-right: 6px; }
.notice .when { font-weight: 700; margin: 2px 0; }
.notice .body { margin: 4px 0 0; }
.incident { padding: 14px 16px; border-left: 6px solid var(--orange); }
.incident.minor { border-left-color: var(--yellow); }
.incident.major { border-left-color: var(--orange); }
.incident.critical { border-left-color: var(--red); }
.incident .meta { color: var(--muted); font-size: .85rem; margin: 0 0 8px; }

/* 更新タイムライン */
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--border); margin-left: 4px; }
.timeline .st { font-weight: 700; margin-right: 6px; }
.timeline time { color: var(--muted); font-size: .85rem; }
.timeline p { margin: 2px 0 0; }

/* サービス一覧 */
.services { padding: 0 16px; }
.svc { padding: 14px 0; border-bottom: 1px solid var(--border); }
.svc:last-of-type { border-bottom: 0; }
.svc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.svc-name { font-weight: 700; }
.svc-label { font-size: .9rem; font-weight: 700; white-space: nowrap; }
.svc-label.normal { color: var(--green); }
.svc-label.minor { color: var(--yellow); }
.svc-label.major { color: var(--orange); }
.svc-label.critical { color: var(--red); }
.svc-label.maintenance { color: var(--blue); }
.svc-label.limited { color: var(--blue); }
.svc-note { flex-basis: 100%; margin: 2px 0 0; font-size: 0.85em; color: var(--muted, #6b7280); }

.bars { display: flex; gap: 2px; height: 30px; }
.bar { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--gray); }
.bar.up { background: var(--green); }
.bar.degraded { background: var(--yellow); }
.bar.partial { background: var(--orange); }
.bar.down { background: var(--red); }
.bar.maintenance { background: var(--blue); }
.bar.nodata { background: var(--gray); }
.bar:hover { opacity: .7; }
.bar-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; margin-top: 4px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 0 14px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .up { background: var(--green); } .legend .degraded { background: var(--yellow); } .legend .partial { background: var(--orange); }
.legend .down { background: var(--red); } .legend .maintenance { background: var(--blue); }
.legend .nodata { background: var(--gray); }

/* 履歴 */
.history { padding: 4px 16px; }
.history-title { font-size: 1.05rem; margin: 28px 0 10px; }
.hist-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.hist-item:last-child { border-bottom: 0; }
.hist-item h3 { font-size: 1rem; margin: 0; }
.hist-item .date { color: var(--muted); font-size: .85rem; }
.hist-item:target, .incident:target, .notice:target { outline: 2px solid var(--blue); outline-offset: 2px; }
.empty { color: var(--muted); padding: 14px 0; margin: 0; }

.site-footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 16px 0 32px; }

@media (max-width: 480px) {
  .wrap { padding: 12px; }
  .site-header h1 { font-size: 1.1rem; }
  .bars { gap: 1px; height: 26px; }
  .banner { font-size: 1rem; padding: 14px; }
}
