:root {
  color-scheme: light;
  --font-body: "Kosugi Maru", -apple-system, BlinkMacSystemFont, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-display: "Cherry Bomb One", "Kosugi Maru", sans-serif;
  --bg: #f4ebdb;
  --bg-blush: #f8dcd3;
  --bg-lavender: #ece4f5;
  --bg-mint: #eaf1e6;
  --surface: rgba(253, 247, 238, 0.9);
  --surface-strong: #fdf6ea;
  --surface-warm: #f7ead6;
  --text: #4b3a37;
  --muted: #8a7169;
  --soft-muted: #b39a92;
  --accent: #d98a80;
  --accent-strong: #b96f66;
  --accent-soft: #f4d5cd;
  --lavender: #d7c9ea;
  --mint: #d6e5c9;
  --sky: #d9e7ec;
  --milk-tea: #ecd6b7;
  --line: rgba(164, 128, 118, 0.22);
  --danger: #c07168;
  --danger-soft: #f4d8d1;
  --focus: rgba(217, 138, 128, 0.3);
  --shadow: 0 18px 44px rgba(148, 100, 90, 0.12);
  --shadow-soft: 0 10px 26px rgba(148, 100, 90, 0.08);
  --radius-lg: 30px;
  --radius-md: 24px;
  --radius-sm: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  scroll-behavior: smooth;
  /* v1.6: iOS のラバーバンド（引っ張り）時も世界観の色が見えるように */
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
  /* タップ時の灰色フラッシュを消す（フォーカスリングは別途あり） */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background:
    radial-gradient(120% 70% at 12% 0%, rgba(248, 220, 211, 0.7), transparent 54%),
    radial-gradient(95% 70% at 100% 12%, rgba(236, 228, 245, 0.55), transparent 58%),
    linear-gradient(150deg, var(--bg), #f7ecd8 40%, #f5e9d3 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 253, 246, 0.22) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 253, 246, 0.2) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 66%);
}

button,
input,
textarea,
summary {
  font: inherit;
  /* v1.6: ダブルタップズームを無効化してタップ反応を速くする */
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  width: min(100%, 1120px);
  max-width: 100%;
  overflow-x: hidden;
  touch-action: pan-y;
  min-height: 100vh;
  /* v1.6: iOS の 100vh 問題対策（未対応ブラウザは上の 100vh にフォールバック） */
  min-height: 100dvh;
  margin: 0 auto;
  /* v1.6: viewport-fit=cover 前提で safe-area（Dynamic Island / ホームインジケータ）分を確保 */
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(106px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px 2px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(148, 100, 90, 0.16));
}

.eyebrow,
.hero-kicker {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 3px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.58rem;
  line-height: 1.18;
  letter-spacing: 0.02em;
}

.mode-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(217, 138, 128, 0.24);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(253, 247, 238, 0.7);
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.auth-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  min-height: 32px;
}

.primary-button--slim,
.quiet-button--slim {
  /* v1.6: タップしやすい高さに（ヘッダー内に収まる範囲で 44px に寄せる） */
  min-height: 42px;
  padding: 0 15px;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 999px;
}

/* v1.7.2: 未ログインの読み返すタブに出す案内（保存先づくりへ） */
.lookback-signedout {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 24px 20px;
}

.lookback-signedout .hero-kicker {
  margin: 0;
}

.lookback-signedout-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.16rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.55;
}

.lookback-signedout-copy {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* v1.7.1: ログイン直後の移行案内 / v1.7.2: 保存先づくりの案内。
   どちらも onboarding と同型の静かなモーダル */
.save-home-dialog,
.account-delete-dialog,
.migrate-dialog,
.plus-dialog {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(75, 58, 55, 0.34);
  backdrop-filter: blur(8px);
}

.save-home-dialog[hidden],
.account-delete-dialog[hidden],
.migrate-dialog[hidden],
.plus-dialog[hidden] {
  display: none;
}

.save-home-card,
.account-delete-dialog-card,
.migrate-dialog-card,
.plus-dialog-card {
  width: min(100%, 460px);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(253, 247, 238, 0.96), rgba(234, 241, 230, 0.6)),
    var(--surface-strong);
  padding: 24px;
  text-align: center;
  box-shadow: 0 28px 60px rgba(148, 100, 90, 0.28);
}

.save-home-card .hero-kicker,
.account-delete-dialog-card .hero-kicker,
.migrate-dialog-card .hero-kicker,
.plus-dialog-card .hero-kicker {
  margin: 0 0 4px;
}

.save-home-card h2,
.account-delete-dialog-card h2,
.migrate-dialog-card h2,
.plus-dialog-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1.5;
  color: var(--text);
}

.migrate-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.92rem;
  line-height: 1.8;
}

.account-delete-copy {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.8;
}

.account-delete-field {
  margin: 14px 0 12px;
  text-align: left;
}

.migrate-copy:empty {
  display: none;
}

.save-home-actions,
.account-delete-actions,
.migrate-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.save-home-actions .primary-button,
.save-home-actions .quiet-button,
.account-delete-actions .danger-button,
.account-delete-actions .quiet-button,
.migrate-actions .primary-button,
.migrate-actions .quiet-button {
  width: 100%;
}

/* v1.7.2: 保存先を作る理由を、押しつけずに並べる */
.save-home-points {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  text-align: left;
}

.save-home-points li {
  position: relative;
  padding-left: 28px;
  color: var(--muted);
  font-weight: 750;
  font-size: 0.92rem;
  line-height: 1.7;
}

.save-home-points li::before {
  content: "✓";
  position: absolute;
  left: 6px;
  color: var(--accent-strong);
  font-weight: 900;
}

.account-delete-dialog .status-line,
.migrate-dialog .status-line {
  margin: 0 0 10px;
}

.save-home-note,
.migrate-note {
  margin: 0;
  color: var(--soft-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.7;
}

/* v2.0: アプリ内の認証ダイアログ。save-home-card の静かなトーンを踏襲する。 */
.auth-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.92rem;
  line-height: 1.8;
}

.auth-copy[hidden] {
  display: none;
}

.auth-form {
  display: grid;
  gap: 4px;
  text-align: left;
}

.auth-field {
  margin-bottom: 12px;
}

.auth-field-label {
  font-size: 0.82rem;
  font-weight: 850;
  color: var(--muted);
}

.auth-form .primary-button {
  width: 100%;
  margin-top: 4px;
}

.auth-hint {
  margin: -6px 0 12px;
  color: var(--soft-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.7;
}

.auth-status {
  margin: 6px 0 4px;
  min-height: 1.2em;
}

.auth-status:empty {
  margin: 0;
  min-height: 0;
}

.auth-links {
  display: grid;
  gap: 6px;
  margin: 10px 0 4px;
}

.auth-link {
  border: none;
  background: none;
  padding: 4px;
  color: var(--accent-strong);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:active {
  transform: scale(0.99);
}

.auth-card .auth-note {
  margin-top: 8px;
}

.auth-note[hidden] {
  display: none;
}

/* v1.7.1: 読み返す先頭の常設案内（「あとで」を選んでも消えない） */
.pending-local-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
}

.pending-local-copy {
  margin: 0;
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
  line-height: 1.7;
}

.settings-migrate {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.app-main {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.view {
  display: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.view.is-active {
  display: block;
}

.hero-panel,
.section-heading {
  border: 1px solid rgba(253, 247, 238, 0.72);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(253, 247, 238, 0.94), rgba(248, 220, 211, 0.42)),
    linear-gradient(160deg, rgba(215, 201, 234, 0.22), transparent);
  box-shadow: var(--shadow);
  padding: 26px 22px;
  margin-bottom: 16px;
  backdrop-filter: blur(18px);
}

.hero-panel--soft {
  background:
    linear-gradient(135deg, rgba(253, 247, 238, 0.94), rgba(244, 213, 205, 0.38)),
    linear-gradient(160deg, rgba(215, 201, 234, 0.18), transparent);
}

.section-heading {
  background:
    linear-gradient(135deg, rgba(253, 247, 238, 0.94), rgba(234, 241, 230, 0.5)),
    linear-gradient(160deg, rgba(217, 231, 236, 0.32), transparent);
}

.hero-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
}

.hero-panel h2,
.section-heading h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.hero-panel h2 {
  font-family: var(--font-body);
  line-height: 1.42;
  font-weight: 900;
}

.section-heading h2 {
  font-family: var(--font-display);
  font-weight: 400;
}

.hero-copy,
.section-heading p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
  font-weight: 650;
}

.panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.entry-form,
.search-panel,
.detail-panel,
.report-panel {
  padding: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.88);
  color: var(--text);
  padding: 13px 15px;
  font-size: 16px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.field input::placeholder,
.field textarea::placeholder,
.field select::placeholder {
  color: var(--soft-muted);
}

.field textarea {
  min-height: 238px;
  resize: vertical;
  line-height: 1.85;
}

.field--body {
  margin-bottom: 12px;
}

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

.field--body textarea {
  min-height: 300px;
  padding: 22px 22px;
  border-radius: 26px;
  font-size: 1.05rem;
  line-height: 2;
  background: linear-gradient(160deg, rgba(253, 247, 238, 0.96), rgba(247, 234, 214, 0.72));
  border-color: rgba(217, 138, 128, 0.24);
}

.field--body textarea:focus {
  border-color: rgba(217, 138, 128, 0.55);
  background: rgba(253, 247, 238, 0.98);
}

.entry-form--body-first {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.form-actions--primary {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  margin-top: 0;
}

.entry-form--body-first .form-actions--primary .primary-button,
.entry-form--body-first .form-actions--primary .quiet-button {
  width: 100%;
}

.primary-button--wide {
  width: 100%;
  padding: 0 28px;
  font-size: 1rem;
}

.optional-details {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 14px;
  border: 1px dashed rgba(164, 140, 132, 0.34);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.55);
  padding: 4px 14px;
}

.optional-details[open] {
  padding-bottom: 12px;
}

.optional-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.optional-details > summary::-webkit-details-marker {
  display: none;
}

.optional-details > summary::after {
  content: "＋ 開く";
  position: absolute;
  right: 20px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
}

.optional-details[open] > summary::after {
  content: "− 閉じる";
}

.optional-details > summary {
  position: relative;
  padding-right: 74px;
}

.optional-details-title {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 900;
}

.optional-details-hint {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.optional-details-body {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.field--date {
  margin-top: 12px;
}

.field--date input {
  max-width: 220px;
}

.post-save-panel {
  margin-top: 14px;
  padding: 20px;
  display: grid;
  gap: 10px;
  background:
    linear-gradient(140deg, rgba(253, 247, 238, 0.96), rgba(234, 241, 230, 0.55));
}

.post-save-panel[hidden] {
  display: none;
}

.post-save-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.6;
}

.post-save-copy {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.75;
  font-size: 0.9rem;
}

.post-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(245, 143, 146, 0.68);
}

.form-actions,
.search-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.primary-button,
.quiet-button,
.danger-button {
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

/* v1.6: 押した感触だけ、静かに返す */
.primary-button:active,
.quiet-button:active,
.danger-button:active {
  transform: scale(0.98);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fdf6ea;
  letter-spacing: 0.02em;
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.quiet-button {
  background: rgba(255, 253, 249, 0.78);
  color: var(--text);
  border-color: var(--line);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(198, 109, 101, 0.22);
}

.primary-button:disabled,
.quiet-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
  box-shadow: none;
}

.status-line {
  min-height: 1.25em;
  margin: 13px 0 0;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 850;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-width: 0;
}

.search-form .field {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  overflow: hidden;
}

.search-form .field input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.search-form input[type="date"] {
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  -webkit-appearance: none;
  appearance: none;
}

.search-form input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.search-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
}

.search-actions .primary-button,
.search-actions .quiet-button {
  width: 100%;
  min-width: 0;
  padding-right: 12px;
  padding-left: 12px;
}

.lookback-browse,
.lookback-mode {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 0;
  padding: 6px;
  border: 1px solid rgba(253, 247, 238, 0.78);
  border-radius: 999px;
  background: rgba(253, 247, 238, 0.72);
  box-shadow: var(--shadow-soft);
}

.mode-toggle-button {
  min-width: 0;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.mode-toggle-button.is-active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(234, 241, 230, 0.78));
  color: #6a3d38;
  box-shadow: var(--shadow-soft);
}

.entry-list {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.entry-card {
  display: grid;
  gap: 9px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 112px;
  border: 1px solid rgba(253, 247, 238, 0.82);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(253, 247, 238, 0.96), rgba(247, 234, 214, 0.72)),
    var(--surface-strong);
  color: var(--text);
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.entry-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* v1.5.1: カードは本文プレビューが主役（タイトル欄は廃止） */
.entry-card-body {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: auto;
}

.entry-card-meta,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.tag {
  border: 1px solid rgba(217, 138, 128, 0.2);
  border-radius: 999px;
  background: rgba(244, 213, 205, 0.55);
  color: #7d4b45;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 850;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.mood-chip,
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.date-chip {
  background: rgba(255, 253, 249, 0.75);
  color: var(--muted);
  border: 1px solid var(--line);
}

.mood-low {
  background: #f8dcd3;
  color: #965a52;
}

.mood-mid {
  background: #ecd6b7;
  color: #7c5a3a;
}

.mood-high {
  background: #d6e5c9;
  color: #4d6e4c;
}

.detail-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  min-height: 232px;
}

.detail-return-button {
  justify-self: start;
  margin-bottom: 2px;
}

/* v1.5.1: 詳細も本文が主役。既存日記の title は控えめな一行として添えるだけ */
.detail-legacy-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.detail-body {
  min-width: 0;
  max-width: 100%;
  margin: 4px 0 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: auto;
  font-size: 1.02rem;
  line-height: 1.9;
  color: #533f3b;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 200px;
  border: 1px dashed rgba(164, 128, 118, 0.28);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(253, 247, 238, 0.58);
  padding: 26px 22px;
  text-align: center;
  font-weight: 700;
  line-height: 1.8;
}

.empty-state-mark {
  width: 52px;
  height: 74px;
  object-fit: contain;
  opacity: 0.75;
  filter: saturate(0.9) drop-shadow(0 6px 10px rgba(148, 100, 90, 0.1));
}

.empty-state-title {
  margin: 4px 0 0;
  color: var(--text);
  font-weight: 900;
  font-size: 0.98rem;
}

.empty-state-copy {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.88rem;
  line-height: 1.75;
  max-width: 28em;
}

.calendar-panel {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: 18px 16px 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 12px;
}

.calendar-month-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1.08rem;
  color: var(--text);
}

.calendar-nav-button {
  /* v1.6: 44px 基準（誤タップ防止） */
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(253, 247, 238, 0.86);
  color: var(--accent-strong);
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.calendar-nav-button:hover {
  border-color: rgba(217, 138, 128, 0.42);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.06em;
}

.calendar-weekdays span:first-child { color: #b96f66; }
.calendar-weekdays span:last-child  { color: #5f6f83; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.calendar-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 56px;
  padding: 6px 6px 4px;
  border: 1px solid rgba(253, 247, 238, 0.7);
  border-radius: 14px;
  background: rgba(253, 247, 238, 0.62);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.calendar-cell:hover {
  border-color: rgba(217, 138, 128, 0.38);
  background: rgba(253, 247, 238, 0.9);
}

.calendar-cell--empty {
  visibility: hidden;
  cursor: default;
  min-height: 56px;
}

.calendar-day-number {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--muted);
}

.calendar-cell.is-today {
  border-color: rgba(217, 138, 128, 0.52);
  background: linear-gradient(140deg, rgba(244, 213, 205, 0.55), rgba(253, 247, 238, 0.92));
}

.calendar-cell.is-today .calendar-day-number {
  color: var(--accent-strong);
}

.calendar-cell.has-entries {
  background: linear-gradient(160deg, rgba(253, 247, 238, 0.94), rgba(247, 234, 214, 0.7));
}

.calendar-cell.is-selected {
  border-color: rgba(217, 138, 128, 0.62);
  outline: 3px solid rgba(217, 138, 128, 0.16);
}

.calendar-count-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fdf6ea;
  font-size: 0.68rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 8px rgba(148, 100, 90, 0.18);
}

.calendar-selected {
  margin-top: 14px;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.calendar-selected-date {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 900;
  font-size: 0.98rem;
}

.calendar-empty-note {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.75;
}

.search-details {
  margin-bottom: 14px;
}

.bottom-nav {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 5;
  /* v1.5.1: タブは「書く / 読み返す」の 2 つ。均等 2 列で中央に置く */
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: min(calc(100% - 28px), 400px);
  max-width: calc(100% - 28px);
  min-width: 0;
  overflow-x: hidden;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgba(253, 247, 238, 0.85);
  border-radius: 999px;
  background: rgba(253, 247, 238, 0.9);
  box-shadow: 0 18px 40px rgba(148, 100, 90, 0.16);
  backdrop-filter: blur(18px);
  transition: transform 220ms ease, opacity 220ms ease;
}

/* v1.6: 本文を書いている間は、キーボードと重ならないようナビをそっと引っ込める
   （iOS 15.4+ / :has 未対応ブラウザでは今までどおり表示されるだけ） */
body:has(#body:focus) .bottom-nav {
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.tab:disabled,
.tab.is-disabled {
  color: var(--soft-muted);
  opacity: 0.54;
  cursor: default;
}

.tab:disabled:active,
.tab.is-disabled:active {
  transform: none;
}

.tab.is-active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(215, 201, 234, 0.6));
  color: #6a3d38;
  box-shadow: var(--shadow-soft);
}

.settings-return-button {
  margin-bottom: 12px;
}

.settings-panel {
  padding: 18px;
  margin-top: 14px;
}

.settings-subhead {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 900;
  color: var(--accent-strong);
}

.settings-copy {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.78;
}

.settings-points {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.78;
}

.settings-points li {
  margin-bottom: 6px;
}

/* v2.3: 設定内の法務・サポートリンク */
.settings-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.settings-links a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

.settings-links a:hover,
.settings-links a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-plan-current {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--text);
}

/* v2.2: Plus 説明モーダルの中身。カード自体は共通ダイアログ様式を再利用する。 */
.plus-copy {
  margin: 6px 0 8px;
  font-weight: 800;
  color: var(--text);
}

.plus-points {
  margin: 0 auto 18px;
  max-width: 20em;
  text-align: left;
}

.plus-dialog-card .primary-button--wide {
  margin-bottom: 10px;
}

.plus-note {
  margin: 14px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 650;
}

.settings-account {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.settings-account-email {
  margin: 0;
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}

.settings-account-delete {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.settings-account-delete-copy {
  margin-bottom: 0;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(75, 58, 55, 0.34);
  backdrop-filter: blur(8px);
}

.onboarding[hidden] {
  display: none;
}

.onboarding-card {
  width: min(100%, 460px);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(255, 253, 249, 0.96), rgba(255, 232, 234, 0.7)),
    var(--surface-strong);
  padding: 24px;
  box-shadow: 0 28px 60px rgba(144, 91, 83, 0.28);
}

.onboarding-mark {
  display: block;
  width: 68px;
  height: 96px;
  margin: 0 auto 14px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(148, 100, 90, 0.14));
}

.onboarding-card .hero-kicker {
  margin: 0 0 4px;
  text-align: center;
}

.onboarding-card h2 {
  text-align: center;
}

.onboarding-card h2 {
  margin: 0 0 16px;
  font-size: 1.32rem;
  line-height: 1.4;
}

.onboarding-steps {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.onboarding-steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.78);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.onboarding-steps li > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(217, 204, 255, 0.7));
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.onboarding-step-title {
  margin: 0 0 4px;
  font-weight: 900;
  color: var(--text);
  font-size: 0.98rem;
}

.onboarding-step-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.68;
}

.onboarding-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.onboarding-actions .primary-button {
  width: 100%;
}

.onboarding-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
}

/* v1.6: 静かな画面遷移。動きが苦手な人には下の prefers-reduced-motion で全停止する */
@keyframes gentle-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view.is-active {
  animation: gentle-in 240ms ease-out;
}

.post-save-panel {
  animation: gentle-in 320ms ease-out;
}

.detail-panel {
  animation: gentle-in 240ms ease-out;
}

.entry-card:active {
  transform: scale(0.99);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: calc(28px + env(safe-area-inset-top, 0px));
    padding-right: calc(22px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(22px + env(safe-area-inset-left, 0px));
  }

  .hero-panel,
  .section-heading {
    padding: 28px;
  }

  .entry-form,
  .search-panel,
  .detail-panel,
  .report-panel {
    padding: 22px;
  }

  .entry-form--body-first {
    padding: 22px;
  }

  .field-grid,
  .search-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-actions {
    align-self: end;
    margin-bottom: 15px;
  }

}

@media (min-width: 980px) {
  .hero-panel,
  .entry-form,
  .section-heading,
  .report-panel {
    width: min(100%, 780px);
    margin-left: auto;
    margin-right: auto;
  }

  .section-heading {
    margin-bottom: 16px;
  }

  .bottom-nav {
    width: 400px;
  }
}

button.calendar-entry-card {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

button.calendar-entry-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
