/* 規約: 指で使う前提 (的 44px 以上) ・ 高コントラスト ・ 本文 16px 以上 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 18px;
  background: #f2f4f7;
  color: #17273b;
}

.view { min-height: 100vh; }

/* 上の帯 */
.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #17466b;
  color: #fff;
  padding: max(env(safe-area-inset-top), 10px) 12px 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.bar h1 { font-size: 20px; flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.btn-bar {
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 17px;
  border: 2px solid #fff;
  border-radius: 8px;
  background: transparent;
  color: #fff;
}
.btn-bar:active { background: rgba(255, 255, 255, 0.25); }

/* 門 */
.gate-box {
  max-width: 420px;
  margin: 18vh auto 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}
.gate-box h1 { color: #17466b; }
.gate-box input {
  font-size: 24px;
  padding: 12px;
  text-align: center;
  border: 2px solid #17466b;
  border-radius: 8px;
}
.btn-main {
  min-height: 52px;
  font-size: 20px;
  font-weight: bold;
  background: #17466b;
  color: #fff;
  border: none;
  border-radius: 8px;
}
.btn-main:active { background: #0e2f4a; }
.error { color: #b3261e; font-weight: bold; }

/* 予定の色分け。 夫 = 青 ・ 妻 = 橙 ・ 二人 = 緑 (白文字が読める濃さ) */
.who-a { background: #2563a8; }
.who-b { background: #c2571d; }
.who-ab { background: #1e7d4f; }

/* 曜日の行 */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  padding: 6px 2px 2px;
  color: #445;
}
.sun { color: #b3261e; }
.sat { color: #1a56b0; }

/* 月の升目 */
.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 2px;
}
.cell {
  min-height: 84px;
  background: #fff;
  border: 1px solid #dde2e9;
  border-radius: 6px;
  font: inherit;
  text-align: left;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  overflow: hidden;
}
.cell:active { background: #e8eef5; }
.cell.blank { background: transparent; border: none; }
.cell.today { border: 2px solid #17466b; background: #eaf2fa; }
.cell .d { font-size: 16px; font-weight: bold; }
.chip {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  border-radius: 4px;
  padding: 1px 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.more { font-size: 12px; color: #556; }

/* 下の帯: 色の凡例と同期の声 */
.foot { padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); }
.legend { display: flex; gap: 16px; margin-bottom: 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.status { font-size: 16px; color: #445; }

/* 日の詳細シート */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sheet-head { display: flex; align-items: center; }
.sheet-head h2 { flex: 1; font-size: 20px; color: #17466b; }
.btn-close {
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
  border: none;
  background: #eef1f5;
  border-radius: 8px;
  color: #17273b;
}
.day-list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: #667; padding: 8px 0; }
.day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 10px;
  font: inherit;
  text-align: left;
  background: #f6f8fa;
  border: 1px solid #dde2e9;
  border-radius: 8px;
}
.day-row:active { background: #e8eef5; }
.row-time { font-size: 16px; font-weight: bold; color: #445; min-width: 58px; }
.row-badge {
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}
.row-title { font-size: 18px; flex: 1; overflow-wrap: anywhere; }

/* 予定フォーム */
.ev-form { display: flex; flex-direction: column; gap: 12px; }
.f-label { font-size: 16px; font-weight: bold; color: #445; display: flex; flex-direction: column; gap: 6px; }
.ev-form input {
  font-size: 20px;
  padding: 10px;
  border: 2px solid #17466b;
  border-radius: 8px;
  font-weight: normal;
}
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1;
  min-height: 48px;
  font-size: 18px;
  font-weight: bold;
  border: 2px solid #99a4b2;
  border-radius: 8px;
  background: #fff;
  color: #17273b;
}
.seg button.sel { border-color: transparent; color: #fff; }
.seg button.sel[data-who="a"] { background: #2563a8; }
.seg button.sel[data-who="b"] { background: #c2571d; }
.seg button.sel[data-who="ab"] { background: #1e7d4f; }
.form-btns { display: flex; gap: 8px; }
.form-btns .btn-main { flex: 2; }
.btn-danger {
  flex: 1;
  min-height: 52px;
  font-size: 18px;
  font-weight: bold;
  background: #fff;
  color: #b3261e;
  border: 2px solid #b3261e;
  border-radius: 8px;
}
.btn-plain {
  flex: 1;
  min-height: 52px;
  font-size: 18px;
  background: #eef1f5;
  color: #17273b;
  border: none;
  border-radius: 8px;
}
