:root {
  --topbar-height: 72px;
  --gap: 8px;
}

/* ページ全体の背景 */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  background-color: #f5f7fb;
  background-image: url('DC.png'); /*背景画像はCSSと同フォルダに配置するように*/
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  box-sizing: border-box;
}

/* 上部固定のタイトル＋ボタン */
.topbar {
  /*
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  */
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(173, 216, 230, 0.85);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  z-index: 1000; /* 高めにして重なりを防ぐ */
  box-sizing: border-box;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* タイトル */
.topbar .title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0b3b4a;
}

/* 接続ボタン */
.topbar button {
  margin-left: 8px;
  padding: 8px 12px;
  background: #ffffffcc;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
}

/* メイン領域：トップバー下を2x2グリッドで常に埋める */
.grid {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
  height: calc(100vh - var(--topbar-height));
  margin-top: var(--topbar-height);
  width: 100%;
}

/* 各ボックス（セル） */
.box {
  border: 1px solid rgba(255,255,255,0.25);
  padding: 10px;
  overflow: auto;
  background: rgba(255,255,255,0.97); /* 読みやすさ優先でやや不透明に */
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  min-width: 0; /* 子要素のオーバーフローを正しく扱うために必須 */
  min-height: 0; /* 同上 */
}

/* 見出し */
.box h3 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

/* テーブル崩れ対策 */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* 固定レイアウトで列幅を安定させる */
  word-break: break-word; /* 長い文字列を折り返す */
  background: transparent;
}

/* セルの見た目 */
td, th {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.9rem;
  white-space: nowrap; /* 日時などは改行させたくない場合は nowrap に */
}

/* 日時列など改行を許可したい列がある場合は個別に指定（例） */
/* #pressTable td { white-space: normal; } */

/* Chart.js キャンバスをボックス内で伸縮させる */
#tempChart {
  width: 100% !important;
  height: 100% !important;
  max-height: calc(100% - 36px);
  align-self: stretch;
  display: block;
}

/* ボタン共通 */
button {
  margin: 5px;
  padding: 10px;
}

/* レスポンシブ：縦長画面では縦積みに */
@media (max-aspect-ratio: 3/4) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, 1fr);
  }
}