/* 心の編集室 — スタイル */
:root {
  --bg: #FBF7F0;
  --paper: #FFFFFF;
  --ink: #2B2926;
  --ink-2: #5C574F;
  --line: #E7DFD2;
  --rule: #EDE5D8;
  --accent: #BF4E37;
  --accent-dark: #A23F2B;
  --accent-soft: #FBE7E0;
  --green: #2F6F60;
  --green-soft: #E2EFEA;
  --gold: #E8B04A;
  --gold-soft: #FBF1DC;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 18px rgba(60, 40, 20, .06);
  color-scheme: light;
}

html { font-size: 20px; }
html[data-size="m"] { font-size: 18px; }
html[data-size="xl"] { font-size: 23px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-weight: 500;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--green); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- ヘッダー ---------- */
.top {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px 4px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem;
}
.brand { display: inline-flex; flex-direction: column; min-width: 0; text-decoration: none; color: var(--ink); }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex: none; }
.app-name {
  display: inline-flex; align-items: center; gap: .3em;
  font-size: .8rem; font-weight: 700; color: var(--accent-dark); white-space: nowrap;
}
.app-name img { width: 1.2rem; height: 1.2rem; border-radius: 5px; }
.music-btn {
  min-height: 2.4rem; padding: 0 .9em; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 2px solid var(--line); background: var(--paper); font-size: .75rem; font-weight: 700; color: var(--ink-2);
}
.music-btn[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.brand-over { font-size: .7rem; color: var(--ink-2); letter-spacing: .04em; line-height: 1.5; }
.brand-over span { white-space: nowrap; }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: .08em; line-height: 1.4; }
.brand-name::after {
  content: ""; display: block; width: 2.4em; height: 4px; margin-top: 4px;
  border-radius: 4px; background: var(--accent);
}

/* ---------- 画面 ---------- */
.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px calc(110px + env(safe-area-inset-bottom));
  outline: none;
}
.view h1 { font-size: 1.25rem; margin: .8rem 0 .6rem; line-height: 1.5; }
.view h2 { font-size: 1.05rem; margin: 0 0 .4rem; line-height: 1.5; }
.lead { color: var(--ink-2); margin: 0 0 1rem; }
.small { font-size: .8rem; color: var(--ink-2); }

.greet { margin: .6rem 0 1rem; }
.greet strong { display: block; font-size: 1.15rem; }
.greet span { color: var(--ink-2); font-size: .85rem; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 1.2rem;
  margin: 0 0 1rem;
}
.label {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .06em;
  color: var(--green); background: var(--green-soft); border-radius: 999px; padding: .1em .8em; margin-bottom: .5rem;
}
.label.warm { color: var(--accent-dark); background: var(--accent-soft); }

/* 今日のことば */
.kotoba { border-top: 6px solid var(--gold); }
.kotoba p { font-size: 1.15rem; line-height: 1.9; margin: .2rem 0 .9rem; }

/* 使い方ガイド */
.guide-card { border-top: 6px solid var(--accent); }
.guide-link {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  min-height: 3rem; padding: .6rem 1.1rem; margin: 0 0 1rem;
  border-radius: var(--radius); background: var(--green-soft); color: var(--green);
  font-weight: 700; text-decoration: none;
}
.guide-link span:last-child { font-size: 1.4rem; line-height: 1; }
.guide-again { margin-top: 1rem; }
.scene { font-size: 3.4rem; line-height: 1.3; text-align: center; margin: .2rem 0 .2rem; }
.guide-page h1 { text-align: center; }
.guide-list { padding-left: 1.2em; margin: .8rem 0; }
.guide-list li { margin: .5rem 0; }
.situations { list-style: none; padding: 0; margin: .6rem 0; }
.situations li { padding: .6rem 0; border-top: 1px dashed var(--line); }
.situations li:first-child { border-top: 0; }
.situations .when { display: block; }
.situations .to { display: block; color: var(--green); font-weight: 700; }
.tip { margin: 1rem 0 0; padding: .7rem .9rem; border-radius: 12px; background: var(--gold-soft); font-size: .9rem; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 3rem; padding: .5em 1.3em;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--paper); color: var(--ink);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-dark); }
.btn-ghost { border-color: var(--line); background: var(--paper); }
.btn-green { background: var(--green); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: .7rem; margin-top: 1.2rem; }
.btn-row .btn { flex: 1; }
.btn-col { display: grid; gap: .7rem; margin-top: 1.2rem; }
.back {
  display: inline-flex; align-items: center; gap: .3em; min-height: 2.6rem;
  padding: 0 .2em; border: 0; background: none; color: var(--ink-2); font-size: .9rem; cursor: pointer;
}

/* ---------- 心の天気 ---------- */
.weather { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-top: .4rem; }
.weather button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 4.4rem; padding: .3rem 0; border-radius: 14px;
  border: 2px solid var(--line); background: var(--paper); cursor: pointer;
}
.weather .emo { font-size: 1.7rem; line-height: 1.2; }
.weather .wl { font-size: .72rem; color: var(--ink-2); }
.weather button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.weather button[aria-pressed="true"] .wl { color: var(--accent-dark); font-weight: 700; }
.saved-note { margin: .6rem 0 0; font-size: .85rem; color: var(--green); }

/* ---------- ワーク一覧 ---------- */
.work-list { display: grid; gap: .8rem; }
.work-list + .btn { margin-top: .8rem; }
.work-item {
  display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: .8rem;
  padding: .9rem 1rem; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.work-icon {
  width: 3rem; height: 3rem; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.5rem; background: var(--gold-soft);
}
.work-title { display: block; font-weight: 700; line-height: 1.5; }
.work-basis { display: block; font-size: .75rem; color: var(--ink-2); line-height: 1.5; }
.work-min { font-size: .75rem; color: var(--green); white-space: nowrap; }

/* ---------- ワークの進行 ---------- */
.progress-wrap { display: flex; align-items: center; gap: .7rem; margin: .4rem 0 1rem; }
.progress-wrap span { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
progress {
  flex: 1; height: 10px; appearance: none; -webkit-appearance: none; border: 0;
  border-radius: 999px; background: var(--rule); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--rule); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 999px; }

.step-head { font-size: .8rem; color: var(--ink-2); margin: 0; }
.phrase {
  font-size: 1.3rem; font-weight: 700; line-height: 1.7; margin: .8rem 0;
  padding: 1rem 1.1rem; border-left: 5px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 14px 14px 0; white-space: pre-line;
}
.note { font-size: .85rem; color: var(--accent-dark); background: var(--gold-soft); border-radius: 12px; padding: .6rem .9rem; }
.hints { padding-left: 1.2em; margin: .6rem 0; }
.hints li { margin: .4rem 0; }

.field { display: block; margin: 1rem 0 0; }
.field-label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: .3rem; }
textarea, input[type="text"] {
  width: 100%; font: inherit; color: var(--ink);
  border: 2px solid var(--line); border-radius: 14px; padding: .55rem .8rem;
  background-color: var(--paper);
}
textarea {
  line-height: 1.9rem; resize: vertical;
  background-image: repeating-linear-gradient(transparent 0 calc(1.9rem - 1px), var(--rule) calc(1.9rem - 1px) 1.9rem);
  background-attachment: local; background-position: 0 .55rem;
}
textarea:focus, input[type="text"]:focus { border-color: var(--green); outline: none; }
::placeholder { color: #A39C91; }

.chips { display: grid; gap: .55rem; margin-top: .8rem; }
.chip {
  display: flex; align-items: center; gap: .6rem; text-align: left;
  min-height: 3rem; padding: .5rem 1rem; border-radius: 14px;
  border: 2px solid var(--line); background: var(--paper); cursor: pointer; line-height: 1.5;
}
.chip::before {
  content: ""; flex: none; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 2px solid #BDB4A6; background: var(--paper);
}
.chip.multi::before { border-radius: 5px; }
.chip[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.chip[aria-pressed="true"]::before { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px var(--paper); }

/* タイマー・呼吸 */
.timer {
  width: 9rem; height: 9rem; margin: 1.2rem auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 2.4rem; font-weight: 700;
  background: var(--gold-soft); color: var(--accent-dark); border: 4px solid var(--gold);
}
.center { text-align: center; }
.breath-stage { display: grid; place-items: center; height: 14rem; margin: .6rem 0; }
.breath {
  width: 13rem; height: 13rem; border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #FFFFFF 0, var(--green-soft) 55%, #BFDCD2 100%);
  box-shadow: 0 0 0 10px rgba(47, 111, 96, .06);
  transform: scale(.5); transition: transform 1s ease-in-out;
}
.breath.in { transform: scale(1); transition-duration: 4s; }
.breath.out { transform: scale(.5); transition-duration: 6s; }
.breath-text { font-size: 1.3rem; font-weight: 700; color: var(--green); min-height: 2.2rem; margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .breath, .breath.in, .breath.out { transition: none; transform: scale(.85); }
}

/* 完了 */
.done { text-align: center; padding: 1.5rem 0 .5rem; }
.done .big { font-size: 3.2rem; line-height: 1.2; }
.done p { font-size: 1.1rem; }

/* ---------- 小さな一歩 ---------- */
.step-today { display: grid; gap: .7rem; }
.step-today p { margin: 0; font-size: 1.1rem; font-weight: 700; }
.step-done { color: var(--green); font-weight: 700; }

/* ---------- きろく ---------- */
.mood-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; text-align: center; }
.mood-cell { border-radius: 12px; padding: .3rem 0; background: var(--bg); }
.mood-cell.today { outline: 2px solid var(--gold); }
.mood-cell .d { display: block; font-size: .62rem; color: var(--ink-2); line-height: 1.4; }
.mood-cell .e { display: block; font-size: 1.3rem; line-height: 1.5; }
.mood-cell .e.empty { color: #CFC6B8; }

.entry h2 { display: flex; align-items: center; gap: .4rem; }
.entry dl { margin: .4rem 0 0; }
.entry dt { font-size: .75rem; color: var(--ink-2); margin-top: .5rem; }
.entry dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .6rem; }
.link-btn { border: 0; background: none; color: var(--ink-2); text-decoration: underline; font-size: .8rem; min-height: 2.6rem; cursor: pointer; }
.empty-state { text-align: center; color: var(--ink-2); padding: 1rem 0; }

/* ---------- このアプリについて ---------- */
.teacher { display: flex; gap: .9rem; align-items: center; margin-bottom: .6rem; }
.teacher-mark {
  flex: none; width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.2rem;
}
.teacher-name { font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.teacher-en { font-size: .75rem; color: var(--ink-2); }
.message { white-space: pre-line; margin: .4rem 0 0; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .5rem; }
.seg button { min-height: 3rem; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; }
.seg button[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.seg .s-m { font-size: 18px; } .seg .s-l { font-size: 20px; } .seg .s-xl { font-size: 23px; }

details { border-top: 1px solid var(--line); }
details:first-of-type { border-top: 0; }
summary { cursor: pointer; padding: .7rem 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: .5rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "＋"; color: var(--green); }
details[open] summary::after { content: "－"; }
details p { margin: 0 0 .8rem; }

.tel {
  display: flex; flex-direction: column; padding: .7rem 1rem; margin-top: .6rem;
  border-radius: 14px; background: var(--bg); text-decoration: none; color: var(--ink);
}
.tel strong { font-size: .9rem; }
.tel .num { font-size: 1.2rem; font-weight: 700; color: var(--green); }
.tel .tnote { font-size: .75rem; color: var(--ink-2); }
.refs { font-size: .72rem; color: var(--ink-2); padding-left: 1.2em; line-height: 1.6; }
.refs li { margin-bottom: .4rem; }
ol.howto { padding-left: 1.3em; margin: .3rem 0; }

/* ---------- 下のメニュー ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 4rem; text-decoration: none; color: var(--ink-2); font-size: .7rem; position: relative;
}
.tabs svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tabs a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 4px; border-radius: 0 0 4px 4px; background: var(--accent);
}
@media (min-width: 680px) {
  .tabs { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}
