@charset "UTF-8";
/* ============================================================
   森の発信ごよみ — スタイル
   ・生成り／淡い緑／落ち着いた茶を基調にした「紙の手帳」の雰囲気
   ・スマートフォン最優先。PCでは中央に読みやすい幅で表示
   ・タップ領域は最低 44px を確保
   目次：
     1. 変数・土台
     2. 部品（ボタン・チップ・フォーム）
     3. ヘッダー／下部ナビ／追加ボタン
     4. 2週間ホーム
     5. 月間カレンダー
     6. 記録一覧
     7. 設定
     8. モーダル・トースト・更新のお知らせ
   ============================================================ */

/* ---------- 1. 変数・土台 ---------- */
:root {
  --bg:          #F7F4EC;  /* 生成り */
  --surface:     #FFFDF7;  /* 紙 */
  --surface-2:   #F1ECE0;  /* 少し沈んだ紙 */
  --ink:         #38332B;  /* 本文 */
  --ink-soft:    #665F53;  /* 補助文字 */
  --ink-faint:   #8C8478;  /* さらに控えめ */
  --line:        #DED5C4;  /* 罫線 */
  --line-strong: #C9BEA8;
  --green:       #4E7C59;  /* 森の緑 */
  --green-deep:  #3B6045;
  --green-pale:  #E6EFE4;
  --brown:       #7E6A4E;
  --today:       #FBF0CE;  /* 今日の背景 */
  --today-line:  #C9A227;
  --sat:         #3F6E86;  /* 土曜 */
  --sun:         #A0574F;  /* 日曜 */
  --danger:      #A33F35;
  --shadow:      0 1px 2px rgba(70,58,40,.08), 0 4px 12px rgba(70,58,40,.06);
  --radius:      12px;
  --tap:         44px;     /* 最小タップ領域 */
  --maxw:        720px;
}

* { box-sizing: border-box; }

/* hidden属性を必ず効かせる（.fab などの display 指定に負けないように） */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  /* 下部ナビと追加ボタンのぶんの余白（セーフエリア込み） */
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  overflow-x: hidden;          /* 横にはみ出さない */
  overscroll-behavior-y: none;
}

h1, h2, h3 { line-height: 1.4; margin: 0; font-weight: 700; }

button { font-family: inherit; font-size: inherit; color: inherit; }

a { color: var(--green-deep); }

/* キーボード操作のフォーカスを必ず見えるようにする */
:focus-visible {
  outline: 3px solid var(--today-line);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 動きを減らす設定に配慮 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

.screen {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 14px 8px;
  outline: none;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 2. 部品 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); min-width: var(--tap);
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-deep); }
.btn--danger { color: var(--danger); border-color: #D8B6B0; }
.btn--danger:hover { background: #F7EAE8; }
.btn--small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn--light { background: #fff; }
.btn--block { width: 100%; }

/* 丸い矢印ボタンなど */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap);
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: var(--surface); cursor: pointer; font-size: 1.1rem;
}
.iconbtn:hover { background: var(--surface-2); }

.field { margin-bottom: 16px; }
.field__label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 6px; }
.field__note { font-size: .85rem; color: var(--ink-soft); margin-top: 4px; }
.field__req {
  font-size: .75rem; color: var(--green-deep); background: var(--green-pale);
  border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}

input[type="text"], input[type="url"], input[type="date"], input[type="time"],
input[type="search"], input[type="month"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;     /* iOSで自動ズームしない大きさ */
  line-height: 1.6;
}
textarea { min-height: 100px; resize: vertical; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }

/* 投稿先・状態を選ぶチップ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--tap); padding: 6px 14px;
  border: 1.5px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: .95rem;
}
.chip[aria-pressed="true"] {
  border-color: var(--green); background: var(--green-pale); font-weight: 700;
}
.chip__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* チェック項目 */
.checklist { display: grid; gap: 4px; }
.checkitem {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--tap); padding: 4px 8px; border-radius: 8px; cursor: pointer;
}
.checkitem:hover { background: var(--surface-2); }
.checkitem input { width: 22px; height: 22px; accent-color: var(--green); flex: none; }

.empty {
  text-align: center; color: var(--ink-faint);
  padding: 40px 16px; line-height: 2;
}

/* ---------- 3. ヘッダー／下部ナビ／追加ボタン ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247,244,236,.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 8px 14px calc(8px + env(safe-area-inset-top)) ;
  padding-top: calc(8px + env(safe-area-inset-top));
  padding-bottom: 8px;
}
.app-header__title {
  max-width: var(--maxw); margin: 0 auto;
  font-size: 1.05rem; letter-spacing: .04em; color: var(--green-deep);
}
.app-header__extra { max-width: var(--maxw); margin: 4px auto 0; }

.periodbar { display: flex; align-items: center; gap: 8px; }
.periodbar__label { flex: 1; font-weight: 700; font-size: 1rem; }
.periodbar__label small { display: block; font-weight: 400; font-size: .8rem; color: var(--ink-soft); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  max-width: var(--maxw); margin: 0 auto;   /* PCでは中央に寄せる */
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 760px) {
  .tabbar { border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
}
.tabbar__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 58px; padding: 6px 2px;
  border: 0; background: none; cursor: pointer; color: var(--ink-soft);
}
.tabbar__icon { font-size: 1.25rem; line-height: 1; }
.tabbar__label { font-size: .78rem; font-weight: 700; }
.tabbar__btn.is-current { color: var(--green-deep); }
.tabbar__btn.is-current .tabbar__label { text-decoration: underline; text-underline-offset: 3px; }

.fab {
  position: fixed; z-index: 31;
  /* PCでも本文の右端にそろえる */
  right: max(16px, calc(50% - var(--maxw) / 2 + 16px));
  bottom: calc(70px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 999px;
  background: var(--green); color: #fff; font-weight: 700; font-size: 1rem;
  box-shadow: 0 3px 10px rgba(60,80,60,.28); cursor: pointer;
}
.fab:hover { background: var(--green-deep); }
.fab__plus { font-size: 1.15rem; }

/* ---------- 4. 2週間ホーム ---------- */
.weekblock { margin-bottom: 22px; }
.weekblock__head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 2px 8px;
  font-size: .95rem; font-weight: 700; color: var(--green-deep);
}
.weekblock__head span { font-weight: 400; font-size: .82rem; color: var(--ink-soft); }
.weekblock__head::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.day {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;
  padding: 8px 8px 8px 6px;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line);
}
.day:last-child { border-bottom: 0; }
.day.is-today { background: var(--today); box-shadow: inset 0 0 0 2px var(--today-line); }
.day.is-empty .day__list { min-height: 8px; }

.day__date { text-align: center; padding-top: 2px; }
.day__md { font-size: 1.05rem; font-weight: 700; letter-spacing: .02em; }
.day__wd { font-size: .78rem; color: var(--ink-soft); }
.day.is-sat .day__wd { color: var(--sat); }
.day.is-sun .day__wd { color: var(--sun); }
.day__todaymark {
  display: inline-block; margin-top: 2px; font-size: .7rem; font-weight: 700;
  color: #7A5B00; background: #fff; border: 1px solid var(--today-line);
  border-radius: 999px; padding: 0 6px;
}
/* 何もない日は「余白」に見えるよう、枠を出さず控えめにする。
   それでもタップ領域は44px確保する */
.day__add {
  display: block; width: 100%;
  min-height: var(--tap); border: 1px dashed transparent; border-radius: 8px;
  background: none; color: var(--ink-faint); font-size: .85rem; cursor: pointer;
  opacity: .55; transition: opacity .15s ease;
}
.day__add:hover, .day__add:focus-visible { opacity: 1; border-color: var(--line-strong); background: var(--surface-2); }
.day.is-today .day__add { opacity: .8; }
.day__list { display: grid; gap: 8px; align-content: start; }

/* 投稿カード */
.card {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--line); border-left: 5px solid var(--line-strong);
  border-radius: 10px; background: var(--surface);
  padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow);
}
.card:hover { background: #FFFAEF; }
.card__top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-soft); }
.card__ch { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.card__time { margin-left: auto; font-variant-numeric: tabular-nums; }
.card__title { font-size: 1rem; font-weight: 700; margin: 3px 0 5px; overflow-wrap: anywhere; }
.card__bottom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .78rem; font-weight: 700;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 10px;
  background: var(--surface-2); color: var(--ink-soft);
}
.status.is-published { background: var(--green-pale); border-color: #A9C4A5; color: var(--green-deep); }
.status.is-ready     { background: #FDF3D4; border-color: #DFC77A; color: #7A5B00; }
.status.is-cancelled,
.status.is-postponed { color: var(--ink-faint); }
.card.is-published { border-left-color: var(--green); }
.card__ready { font-size: .78rem; color: var(--green-deep); }
.card__leftover {
  font-size: .75rem; color: #8A5A1E; background: #FBEFDC;
  border-radius: 999px; padding: 1px 8px;
}

/* ---------- 5. 月間カレンダー ---------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th {
  font-size: .78rem; font-weight: 700; color: var(--ink-soft);
  padding: 4px 0; border-bottom: 1px solid var(--line);
}
.cal th.is-sat { color: var(--sat); } .cal th.is-sun { color: var(--sun); }
.cal td { border: 1px solid var(--line); padding: 0; vertical-align: top; height: 74px; }
.cell {
  display: block; width: 100%; height: 100%; min-height: 74px;
  border: 0; background: none; padding: 3px 3px 4px; cursor: pointer;
  text-align: left; font: inherit;
}
.cell:hover { background: var(--surface-2); }
.cell__d { font-size: .85rem; font-weight: 700; }
.cell.is-out { background: #F2EFE7; }
.cell.is-out .cell__d { color: var(--ink-faint); font-weight: 400; }
.cell.is-today { background: var(--today); box-shadow: inset 0 0 0 2px var(--today-line); }
.cell.is-sat .cell__d { color: var(--sat); } .cell.is-sun .cell__d { color: var(--sun); }
.cell__items { display: grid; gap: 2px; margin-top: 2px; }
.cell__item {
  display: flex; align-items: center; gap: 3px;
  font-size: .72rem; line-height: 1.3;
  border-left: 3px solid var(--line-strong); padding-left: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell__item.is-published { opacity: .95; }
.cell__more { font-size: .66rem; color: var(--ink-soft); }

.summary {
  margin-top: 16px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.summary__title { font-size: .9rem; font-weight: 700; color: var(--green-deep); margin-bottom: 6px; }
.summary__list { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; color: var(--ink-soft); }
.summary__list b { color: var(--ink); }

.filterbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* ---------- 6. 記録一覧 ---------- */
.searchbar { display: grid; gap: 8px; margin-bottom: 14px; }
.monthhead {
  position: sticky; top: 0; z-index: 1;
  margin: 18px 0 8px; padding: 4px 2px;
  font-size: .95rem; font-weight: 700; color: var(--green-deep);
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.rec {
  border: 1px solid var(--line); border-left: 5px solid var(--line-strong);
  border-radius: 10px; background: var(--surface);
  padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.rec__head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--ink-soft); }
.rec__title { font-size: 1rem; font-weight: 700; margin: 3px 0; overflow-wrap: anywhere; }
.rec__memo { font-size: .88rem; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.rec__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- 7. 設定 ---------- */
.section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.section__title { font-size: 1rem; color: var(--green-deep); margin-bottom: 10px; }
.section p { margin: 0 0 10px; font-size: .9rem; color: var(--ink-soft); }

.chlist { display: grid; gap: 8px; }
.chrow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.chrow__icon { font-size: 1.2rem; width: 28px; text-align: center; flex: none; }
.chrow__name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.chrow__bar { width: 6px; height: 28px; border-radius: 3px; flex: none; }
.chrow__off { font-size: .75rem; color: var(--ink-faint); }
.chrow__btns { display: flex; gap: 4px; flex: none; }
.chrow__btns .iconbtn { width: 36px; height: 36px; font-size: .95rem; }

.about { font-size: .88rem; color: var(--ink-soft); }
.about strong { color: var(--danger); }

/* ---------- 8. モーダル・トースト・お知らせ ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(56,51,43,.42);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal {
  width: 100%; max-width: var(--maxw);
  max-height: 92dvh; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -6px 24px rgba(60,50,35,.25);
  animation: slideup .18s ease-out;
}
@keyframes slideup { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; max-height: 88vh; }
}
.modal__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface); border-radius: 18px 18px 0 0;
}
.modal__title { flex: 1; font-size: 1.05rem; color: var(--green-deep); }
.modal__body { padding: 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal__foot {
  display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.modal__foot .btn { flex: 1; }
.modal--narrow { max-width: 440px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(130px + env(safe-area-inset-bottom)); z-index: 200;
  background: #3E4A3C; color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: .92rem; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}

/* お知らせ帯は画面の一番上に置き、ヘッダーを覆わないよう流れの中に入れる */
.update-banner {
  position: relative; z-index: 300;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: var(--green-deep); color: #fff; font-size: .9rem; font-weight: 700;
}

/* 印刷はしないが、大きな文字設定への配慮として最低限の折り返しを保証 */
.nowrap-safe { overflow-wrap: anywhere; }
