/* =====================================================================
   ライフダッシュボード 見た目
   - 端末の設定に合わせて明暗を自動で切り替える
   - 差し色は落ち着いた青
   - 文字は標準の大きさで、情報をある程度詰める
   - Apple 純正アプリ風のカード。広い画面では横並び、iPhone では縦積み
   ===================================================================== */

:root {
  color-scheme: light dark;

  /* 明るい配色（昼） */
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --line: rgba(60, 60, 67, 0.12);
  --accent: #2f6db3;          /* 落ち着いた青 */
  --accent-soft: rgba(47, 109, 179, 0.12);
  --now: #d9480f;             /* 現在時刻の線 */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* 暗い配色（夜） */
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --text-2: #a1a1a6;
    --text-3: #636366;
    --line: rgba(84, 84, 88, 0.55);
    --accent: #6ea3e3;
    --accent-soft: rgba(110, 163, 227, 0.18);
    --now: #ff8a5b;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic UI", "Segoe UI", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

/* --- 上部：日付 ------------------------------------------------------ */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 12px;
}
.header__date {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.header__sub {
  color: var(--text-2);
  font-size: 14px;
  margin-top: 2px;
}
.header__status {
  color: var(--text-3);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

/* --- カードの並び ---------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* 広い画面（iPad 横・PC）：カードを横に並べる */
@media (min-width: 820px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "today   buttons"
      "today   week"
      "month   week";
    align-items: start;
  }
  .card--today   { grid-area: today; }
  .card--buttons { grid-area: buttons; }
  .card--week    { grid-area: week; }
  .card--month   { grid-area: month; }
}

.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__hint {
  font-weight: 400;
  color: var(--text-3);
}

/* --- 予定の一覧 ------------------------------------------------------ */
.events {
  list-style: none;
  margin: 0;
  padding: 0;
}
.event {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.event:first-child { border-top: none; }
.event__time {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.event__time--allday {
  color: var(--text-2);
  font-weight: 500;
}
.event__title { font-weight: 500; }
.event__meta {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 1px;
}

/* 終わった予定は薄く */
.event--past { opacity: 0.42; }
.event--past .event__time { color: var(--text-2); }

/* 進行中の予定は差し色で強調 */
.event--now {
  background: var(--accent-soft);
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-top-color: transparent;
}
.event--now + .event { border-top-color: transparent; }

.empty {
  color: var(--text-3);
  padding: 8px 0;
}

/* 曜日ごとの見出し（今週・今月） */
.day {
  padding-top: 8px;
}
.day + .day {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}
.day__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 2px;
}
.day__head strong {
  color: var(--text);
  font-weight: 600;
}
.day__head .is-weekend { color: var(--now); }
.day .event { grid-template-columns: 76px 1fr; padding: 5px 0; border-top: none; }

/* --- ボタン4つ ------------------------------------------------------ */
.card--buttons { padding: 10px 12px; }
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 60px;
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { filter: brightness(0.9); }

/* 狭い画面（iPhone 縦）：5文字のボタン名が折れないよう文字を少し小さく */
@media (max-width: 420px) {
  .btn { font-size: 12.5px; padding: 8px 2px; letter-spacing: -0.02em; }
  .buttons { gap: 6px; }
}
.btn__note {
  font-weight: 400;
  font-size: 10px;
  opacity: 0.85;
}
.btn--unset {
  background: var(--accent-soft);
  color: var(--accent);
  cursor: default;
}

/* --- 今月（折りたたみ） --------------------------------------------- */
details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; }
.card__title--summary { justify-content: flex-start; }
.card__toggle {
  margin-left: auto;
  color: var(--accent);
  font-weight: 500;
}
.card__toggle::before { content: "開く"; }
details[open] .card__toggle::before { content: "閉じる"; }

/* --- 下部 ------------------------------------------------------------ */
.footer {
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
  padding: 18px 0 0;
}
