@charset "UTF-8";
/* =========================================================
 * 捨てチャレンジ — スタイル
 * 役割トークンは AI-kouza/DESIGN.md 4章と同値
 * (値の正本 = ../../DESIGN.md。ここは同値を複製しているだけ)。
 * --danger のみ、このアプリ固有の実用色(DESIGN.mdに無い破壊的操作用。
 * 同リポ apps/lifeplan の --danger と同じ考え方でローカル追加)。
 * ========================================================= */

:root {
  /* ---- AI-kouza 役割トークン(DESIGN.md 4章と同値) ---- */
  --bg: #fbf7ee;
  --surface: #fcfbf8;
  --surface-rgb: 252, 251, 248;
  --ink: #2d3554;
  --ink-rgb: 45, 53, 84;
  --on-ink: #faf6ec;
  --gold-deco: #e5b962;
  --gold-deco-rgb: 229, 185, 98;
  --gold-text: #a8721f;
  --stone: #4a5568;
  --dawn-1: #c9d4e8;
  --dawn-2: #e9dcc9;
  --dawn-3: #f6d8b9;
  --font-serif: "Shippori Mincho", serif;
  --font-sans: "Noto Sans JP", sans-serif;

  /* ---- このアプリ固有のユーティリティ(DESIGN.mdには無い実用値) ---- */
  --danger: #b3483d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 28px rgba(45, 53, 84, 0.14);
  --shadow-sm: 0 4px 14px rgba(45, 53, 84, 0.1);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.35s;
}

/* ---------- リセット・ベース ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100svh;
}
img, svg, canvas { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: var(--ink); }
h1, h2 { font-family: var(--font-serif); font-weight: 700; line-height: 1.4; }
:focus-visible { outline: 3px solid var(--gold-deco); outline-offset: 2px; border-radius: 4px; }
body.no-scroll { overflow: hidden; }

.screen { max-width: 480px; margin: 0 auto; padding: 28px 20px calc(56px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }

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

/* ---------- ボタン共通 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; padding: 13px 22px; font-weight: 700; font-size: 15px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn--primary { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-sm); }
@media (hover: hover) {
  .btn--primary:hover { transform: translateY(-1px); }
}
.btn--ghost { background: var(--surface); color: var(--ink); border: 1.5px solid rgba(var(--ink-rgb), 0.18); }
.btn--danger { background: var(--danger); color: var(--on-ink); box-shadow: var(--shadow-sm); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); box-shadow: var(--shadow-sm); font-size: 18px;
}

.divider { border: none; border-top: 1px solid rgba(var(--ink-rgb), 0.12); margin: 26px 0 20px; }

/* ---------- フォーム部品共通 ---------- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 8px; }
.field__row { display: flex; align-items: center; gap: 8px; }
.field__row input[type="number"] {
  flex: 1; min-width: 0; padding: 12px 14px; border: 1.5px solid rgba(var(--ink-rgb), 0.16);
  border-radius: var(--radius-sm); background: #fff; font-size: 16px; font-family: var(--font-sans);
}
.field__unit { font-size: 14px; color: var(--stone); white-space: nowrap; }
.field__note { font-size: 12px; color: var(--stone); margin-top: 6px; }

/* ---------- 開閉(ホーム画面追加の手順) ---------- */
.howto { margin-top: 4px; }
.howto summary {
  cursor: pointer; font-size: 13px; color: var(--ink); font-weight: 700;
  text-decoration: underline; list-style: none;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: "▸ "; text-decoration: none; }
.howto[open] summary::before { content: "▾ "; }
.howto__list { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--stone); display: grid; gap: 8px; line-height: 1.6; }
.howto__list b { color: var(--ink); font-weight: 700; }
.howto__after { margin-top: 10px; font-size: 13px; color: var(--stone); }
/* ホーム画面から開いているときは、追加の案内を出さない */
html.is-standalone .a2hs { display: none; }

.ios-note { font-size: 13px; color: var(--stone); }
.ios-note__heading { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.ios-note__body { margin-bottom: 10px; }

/* ---------- 初回画面 ---------- */
.screen--onboarding { display: flex; align-items: center; min-height: 100svh; padding-top: 40px; padding-bottom: 40px; }
.onboarding-card { width: 100%; }
.onboarding-card__title {
  font-size: clamp(1.35rem, 6vw, 1.7rem); text-align: center; margin-bottom: 26px;
}
.onboarding-card__start { width: 100%; margin-top: 6px; padding: 15px; font-size: 16px; }

/* ---------- ヘッダ(メイン・設定共通) ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.app-header h1 { font-size: 20px; }
.app-header--settings h1 { flex: 1; text-align: center; font-size: 17px; }
.app-header__spacer { width: 40px; display: inline-block; }

/* ---------- 進捗(数字) ---------- */
.progress__numbers { text-align: center; font-family: var(--font-sans); }
.progress__total { font-size: clamp(2.6rem, 13vw, 3.4rem); font-weight: 700; color: var(--gold-text); }
.progress__slash { font-size: 1.4rem; color: var(--stone); margin: 0 2px; }
.progress__goal { font-size: 1.4rem; color: var(--stone); font-weight: 700; }
.progress__remaining { text-align: center; font-size: 14px; color: var(--stone); margin-top: 4px; }
.progress__remaining.is-achieved {
  color: var(--ink); font-weight: 700;
  text-decoration: underline; text-decoration-color: var(--gold-deco);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}

/* ---------- 山(進捗のビジュアル) ---------- */
.mountain { margin: 18px 0 6px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.mountain__svg { width: 100%; height: auto; display: block; }
.mountain__range-far { fill: rgba(var(--ink-rgb), 0.16); }
.mountain__body { fill: var(--ink); }
.mountain__trail-halo {
  fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
}
.mountain__trail-base {
  fill: none; stroke: rgba(var(--ink-rgb), 0.55); stroke-width: 3; stroke-dasharray: 1 7;
  stroke-linecap: round; stroke-linejoin: round;
}
.mountain__trail-walked {
  fill: none; stroke: var(--gold-deco); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke-dashoffset 0.7s var(--ease);
}
.mountain__flag line { stroke: var(--on-ink); stroke-width: 3; stroke-linecap: round; }
.mountain__flag polygon { fill: var(--gold-deco); }
.mountain__marker {
  fill: var(--ink); stroke: var(--gold-deco); stroke-width: 2.5;
  transition: cx 0.7s var(--ease), cy 0.7s var(--ease);
}

/* ---------- 定型文 ---------- */
.tagline {
  font-size: 14px; color: var(--stone); text-align: left; margin: 4px 0 20px;
  padding: 4px 0 4px 14px; border-left: 3px solid var(--gold-deco); line-height: 1.7;
}

/* ---------- 記録フォーム ---------- */
.record-card { margin-bottom: 8px; }
.record-card__row { display: flex; align-items: center; gap: 10px; }
.record-card__row--stepper { justify-content: center; margin-bottom: 14px; }
.record-card__label { font-size: 13px; font-weight: 700; color: var(--stone); margin-right: 2px; }
.stepper-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  font-size: 20px; line-height: 1; flex: none; display: inline-flex; align-items: center; justify-content: center;
}
.count-input {
  width: 84px; text-align: center; font-size: 22px; font-weight: 700; padding: 8px 4px;
  border: 1.5px solid rgba(var(--ink-rgb), 0.18); border-radius: var(--radius-sm); background: #fff;
  -moz-appearance: textfield;
}
.count-input::-webkit-outer-spin-button, .count-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.record-card__unit { font-size: 14px; color: var(--stone); }
.field-hint {
  color: var(--danger); font-size: 12.5px; text-align: center; margin: -6px 0 14px;
}

.record-card__row--extra { margin-bottom: 12px; flex-wrap: wrap; }
.photo-btn { padding: 13px 18px; font-size: 13.5px; flex: none; min-height: 44px; }
.name-input {
  flex: 1; min-width: 120px; padding: 10px 12px; border: 1.5px solid rgba(var(--ink-rgb), 0.16);
  border-radius: var(--radius-sm); background: #fff; font-size: 15px;
}

.photo-preview {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px;
}
.photo-preview img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }
.photo-preview__remove {
  margin-left: auto; width: 44px; height: 44px; border-radius: 50%; background: var(--surface);
  box-shadow: var(--shadow-sm); font-size: 17px; color: var(--stone); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}

.record-card__submit { width: 100%; padding: 15px; font-size: 16px; margin-top: 2px; }
.btn[disabled] { opacity: 0.55; cursor: default; pointer-events: none; }

/* ---------- 履歴 ---------- */
.history { margin-top: 26px; }
.history__day { margin-bottom: 18px; }
.history__day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--stone); letter-spacing: 0.03em; margin-bottom: 8px; font-weight: 700;
}
.history__list { list-style: none; display: grid; gap: 8px; }
.history__item {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-sm);
  width: 100%; text-align: left; font: inherit; cursor: pointer; min-height: 44px;
}
.history__thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; }
.history__label { flex: 1; font-size: 14px; }
.history__count { font-weight: 700; color: var(--ink); font-size: 14px; white-space: nowrap; }
.history__empty { text-align: center; color: var(--stone); font-size: 13px; margin-top: 20px; }

/* ---------- 設定画面 ---------- */
.settings-block { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 16px; }
.settings-block__label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 8px; }
.settings-block__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.settings-block__row input[type="number"] {
  width: 100px; padding: 10px 12px; border: 1.5px solid rgba(var(--ink-rgb), 0.16);
  border-radius: var(--radius-sm); background: #fff; font-size: 16px;
}
.settings-block__heading { font-size: 15px; margin-bottom: 12px; }
.settings-block__btn { display: block; width: 100%; margin-bottom: 8px; }
.settings-block__note { font-size: 12px; color: var(--stone); margin-bottom: 4px; }
.settings-block__meta { font-size: 12px; color: var(--stone); margin-bottom: 16px; }
.settings-block .howto { margin: 14px 0; }
.settings-block .howto--where { margin: 6px 0 10px; }
.saved-flash {
  font-size: 12.5px; color: var(--ink); font-weight: 700; opacity: 0; transition: opacity var(--dur) var(--ease);
}
.saved-flash.is-on { opacity: 1; }

/* 「捨てた!」直後のひとこと(ボタンの下・数秒で消える。金の点=ご褒美) */
.submit-toast {
  margin: 12px 0 0; min-height: 1.5em; text-align: center; font-size: 14px; line-height: 1.5;
  color: var(--ink); font-weight: 500; opacity: 0; transition: opacity var(--dur) var(--ease);
}
.submit-toast.is-on { opacity: 1; }
.submit-toast.is-on::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-deco); margin-right: 7px; vertical-align: 1px;
}

/* ---------- モーダル(記録詳細・確認) ---------- */
.modal { position: fixed; inset: 0; z-index: 500; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(45, 53, 84, 0.5); }
.modal__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88svh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto; box-shadow: 0 -12px 32px rgba(45, 53, 84, 0.25);
}
.modal__panel:focus { outline: none; }
.modal__panel--confirm { border-radius: var(--radius); position: relative; margin: 40svh auto 0; }
.modal__close {
  position: absolute; top: 10px; right: 12px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--stone); line-height: 1;
}
.detail__date { font-size: 13px; color: var(--stone); margin-top: 6px; }
.detail__count { font-family: var(--font-sans); font-size: 1.8rem; font-weight: 700; color: var(--gold-text); margin-top: 4px; }
.detail__photo-wrap { margin: 16px 0; }
.detail__photo-wrap img { width: 100%; border-radius: var(--radius-sm); }
.detail__name { font-size: 15px; margin-top: 4px; }
.modal__actions { display: grid; gap: 10px; margin-top: 22px; }
.confirm__message { font-size: 15px; line-height: 1.8; padding-right: 6px; }

/* ---------- お祝い ---------- */
.celebration { position: fixed; inset: 0; z-index: 700; display: flex; align-items: center; justify-content: center; }
.celebration::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(45,53,84,0.72), rgba(45,53,84,0.55));
}
.celebration__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.celebration__panel {
  position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px 26px; max-width: 340px; width: calc(100% - 40px); text-align: center;
}
.celebration__title { font-family: var(--font-sans); font-size: 1.7rem; font-weight: 700; color: var(--gold-text); }
.celebration__message { font-size: 14px; color: var(--stone); margin: 12px 0 22px; line-height: 1.8; }

/* ---------- 保存不可画面 ---------- */
.screen--error { display: flex; align-items: center; min-height: 100svh; }
.error-card { text-align: center; }
.error-card h1 { font-size: 20px; margin-bottom: 16px; }
.error-card__lead { font-weight: 700; margin-bottom: 10px; }
.error-card p { font-size: 13.5px; color: var(--stone); margin-top: 8px; line-height: 1.8; }

/* ---------- モーション低減 ---------- */
@media (prefers-reduced-motion: reduce) {
  .mountain__trail-walked, .mountain__marker, .btn, .saved-flash, .submit-toast { transition: none !important; }
}

/* ---------- レスポンシブ(タブレット以上でも中央寄せ) ---------- */
@media (min-width: 600px) {
  .screen { max-width: 520px; }
  .modal__panel { max-width: 480px; }
}
