/* ============================================================
   返事帳（スマホの画面）
   ★文字の倍率は --fs 1か所。ほかは rem だけで書く（px を直に書かない）
     既定は「大」＝1.375（本文 22px）。いちばん小さい字は .82rem（大で18px）。これより下げない
   ★レイアウト：1列のカードを古い順に積む。上に「今日の5173」、下に一覧
   このファイル: henji/public/app.css
   ============================================================ */
:root {
  --fs: 1.375;
  --ink: #1f1d29;
  --sub: #555067;
  --line: #dedae9;
  --bg: #f5f4f9;
  --card: #ffffff;
  --accent: #5b4a8b;          /* 桔梗色 */
  --accent-ink: #ffffff;
  --accent-soft: #eeeaf8;
  --decide: #a3352a;
  --decide-soft: #fbeceA;
  --check: #8a5a12;
  --check-soft: #f8efdd;
  --ok: #2c6a44;
  --ok-soft: #e6f3ea;
  --warn-bg: #fff4e5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ecebf3; --sub: #b0abc3; --line: #3a3550; --bg: #16141d; --card: #1f1c29;
    --accent: #b9aaf6; --accent-ink: #1a1724; --accent-soft: #2c2640;
    --decide: #f2a497; --decide-soft: #3b2420; --check: #e9c27f; --check-soft: #3a2f1c;
    --ok: #8fd3a8; --ok-soft: #1f3328; --warn-bg: #3a2f1c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #ecebf3; --sub: #b0abc3; --line: #3a3550; --bg: #16141d; --card: #1f1c29;
  --accent: #b9aaf6; --accent-ink: #1a1724; --accent-soft: #2c2640;
  --decide: #f2a497; --decide-soft: #3b2420; --check: #e9c27f; --check-soft: #3a2f1c;
  --ok: #8fd3a8; --ok-soft: #1f3328; --warn-bg: #3a2f1c;
  color-scheme: dark;
}

html { font-size: calc(16px * var(--fs)); -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---- 上の帯 ---- */
.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: var(--accent);
  color: var(--accent-ink);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--accent); }
.bar__in {
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem max(16px, env(safe-area-inset-right, 0px)) .45rem max(16px, env(safe-area-inset-left, 0px));
}
.bar__title { margin: 0; font-size: 1.3rem; letter-spacing: .06em; }
.bar__count { font-size: .9rem; font-weight: 700; opacity: .92; }
.bar__sp { flex: 1 1 auto; }
.bar button {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: .1rem .8rem;
  font-size: .9rem;
  font-weight: 700;
  min-height: 2.2rem;
  cursor: pointer;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding-block: .8rem 4rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

/* ---- 汎用 ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .45rem; }
.sub { color: var(--sub); font-size: .88rem; }
.small { font-size: .82rem; color: var(--sub); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: .25rem 1.1rem; min-height: 2.6rem; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn--ghost { background: var(--card); color: var(--accent); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: var(--card); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .tabs button:focus-visible, .item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 0 .65rem; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.tag--decide { background: var(--decide-soft); color: var(--decide); }
.tag--check { background: var(--check-soft); color: var(--check); }
.tag--request { background: var(--accent-soft); color: var(--accent); }
.tag--info { background: transparent; color: var(--sub); border: 1px solid var(--line); }
.tag--daily { background: var(--decide); color: var(--card); }
.tag--state { background: var(--accent-soft); color: var(--accent); }
.msg { margin: 0; border-radius: .7rem; padding: .5rem .8rem; background: var(--warn-bg); font-weight: 700; font-size: .92rem; }

/* ---- 通知の案内 ---- */
.notice { border-color: var(--accent); background: var(--accent-soft); }
.notice b { font-size: 1.05rem; }

/* ---- 今日の5173 ---- */
.daily.is-seen { border-color: var(--ok); }
.daily.is-seen .daily__state { color: var(--ok); }
.daily__title { font-weight: 700; font-size: 1.05rem; }

/* ---- 切り替え ---- */
.tabs { display: flex; flex-wrap: wrap; gap: .2rem; border-bottom: 2px solid var(--line); }
.tabs button { border: 0; background: none; padding: .35rem .8rem; font-weight: 700; color: var(--sub); cursor: pointer; border-bottom: .2rem solid transparent; margin-bottom: -2px; white-space: nowrap; min-height: 2.6rem; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- 一覧 ---- */
.list { display: flex; flex-direction: column; gap: .6rem; }
.item { text-align: left; width: 100%; cursor: pointer; }
.item:hover { border-color: var(--accent); }
.item__title { font-weight: 700; font-size: 1.05rem; line-height: 1.5; }
.item.is-thinking { border-left: .3rem solid var(--check); }
.empty { color: var(--sub); text-align: center; padding: 1.5rem 0; margin: 0; }

/* ---- 1件 ---- */
.detail { display: flex; flex-direction: column; gap: .8rem; }
.detail h2 { margin: 0; font-size: 1.35rem; line-height: 1.45; }
.detail__summary { margin: 0; white-space: pre-wrap; }
.q { border: 1px solid var(--line); border-radius: .8rem; padding: .65rem .8rem; display: flex; flex-direction: column; gap: .45rem; background: var(--card); }
.q__no { font-size: .82rem; font-weight: 700; color: var(--sub); }
.q__text { font-weight: 700; }
.q__rec { background: var(--check-soft); border-radius: .6rem; padding: .35rem .65rem; color: var(--ink); }
.q__rec b { color: var(--check); }
.q.is-ok { border-color: var(--ok); }
textarea { width: 100%; border: 1px solid var(--line); border-radius: .6rem; padding: .4rem .6rem; background: var(--card); min-height: 3rem; resize: vertical; line-height: 1.55; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.save { font-size: .82rem; color: var(--sub); min-height: 1.4em; }
.states { display: flex; flex-wrap: wrap; gap: .5rem; }
.states .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---- 設定 ---- */
.menu h3 { margin: .2rem 0; font-size: 1.05rem; }
.fs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.fs button { border: 0; background: none; padding: .2rem .8rem; min-height: 2.4rem; font-weight: 700; color: var(--sub); cursor: pointer; font-size: .9rem; }
.fs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---- ログイン ---- */
.login { max-width: 26rem; margin: 3rem auto; }
.login input { width: 100%; border: 1px solid var(--line); border-radius: .6rem; padding: .5rem .7rem; background: var(--card); font-size: 1.1rem; }

@media (prefers-reduced-motion: no-preference) {
  .card, .btn { transition: border-color .15s ease, background-color .15s ease; }
}
