/*
 * TapShine — 見た目。
 *
 * 方針は「大きいまま、洗練させる」。決定18
 * 細い字・薄いグレー・小さい要素という流行りのモダンは採らない。読めなければ意味がない。
 */

:root {
  /* 温かみのあるオフホワイト。純白＋ターコイズは医療機器の配色に寄るため */
  --bg: #FBFAF8;
  --ink: #1C1B19;
  --ink-soft: #6E6960;
  --ink-faint: #8F8A81;
  --line: #E2DED6;

  /*
   * ブランドはターコイズブルー。決定42
   *
   * 明るくしたいが、明るくするほど白文字が読めなくなる。
   * 測った結果、#00808F が「白文字のまま明るくできる限界」だった。
   *
   *   #007083（御納戸色）  白文字 5.76:1 … 落ち着くが暗い
   *   #00808F             白文字 4.68:1 … 本文基準を満たす最も明るい値 ← これ
   *   #008C9E             白文字 4.00:1 … 大きな文字しか通らない
   *   #5AC2D9（新橋色）    白文字 2.07:1 … 白文字では読めない
   *
   * ロゴとトップの主ボタンだけに使い、機能色とは役割を分ける。
   */
  --brand: #00808F;
  --brand-dark: #00606B;
  --brand-tint: #E1EFF2;

  /* 機能色。青は藍寄りにして、ブランドのターコイズと紛れないようにしてある */
  --red: #B3261E;
  --orange: #E8871E;
  --indigo: #2B4C8C;
  --green: #3A9E63;
  --gray: #5A5754;

  /* 文字色の違いも、色以外の手がかりになる。決定11 */
  --on-red: #FFFFFF;
  --on-orange: #3D2402;
  --on-indigo: #FFFFFF;
  --on-green: #10331F;
  --on-gray: #FFFFFF;

  --radius: 16px;
  --pad: clamp(16px, 4.5vw, 24px);

  /*
   * 表示の大きさ。決定40
   * 難聴と弱視が重なる方がいる。文字とボタンをまとめて大きくできるようにする。
   * 主要な文字とボタンの寸法に掛ける倍率。
   */
  --f: 1;
}

body[data-size="large"]  { --f: 1.15; }
body[data-size="xlarge"] { --f: 1.32; }

* { box-sizing: border-box; }

/* display を指定した要素にも hidden を効かせる */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: calc(var(--f) * 18px);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: max(var(--pad), env(safe-area-inset-top)) var(--pad)
           max(var(--pad), env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen[hidden] { display: none; }

h1 { font-size: 20px; font-weight: 700; margin: 0; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--ink-soft); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.focus-target:focus { outline: none; }

/* ---------------------------------------------------------------
 * 下の固定バー。決定26
 *
 * 片手で持つと親指は画面下にしか届かない。戻る導線をそこに置く。
 * 上の「トップ」だけでは、毎回持ち替えることになる。
 * ------------------------------------------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  border: none;
  background: #FFFDFB;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
}

.tabbar button:active { background: #F1EEE9; }
.tab-label { font-size: 14px; font-weight: 700; }

/* トップと全画面表示では出さない。行き先がない、あるいは邪魔になる */
body[data-screen="top"] .tabbar,
body[data-screen="alert"] .tabbar,
body[data-screen="cancel"] .tabbar { display: none; }

/* バーに隠れないよう、下に場所を空ける */
body:not([data-screen="top"]):not([data-screen="alert"]):not([data-screen="cancel"]) .screen {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------
 * トップ画面
 * ------------------------------------------------------------- */

/*
 * 並び順は「アプリ名 → 用件」。決定31
 * まずアプリが名乗り、その下に用件が来る方が読み手の順番に合う。
 * 用件は大きいままにして、美容師に見せたときの伝わり方は変えない。
 */
.hello {
  font-size: clamp(24px, 6.6vw, 32px);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.01em;
  margin: 18px 0 0;
}

/*
 * 詳しい説明への入口。主要な4ボタンとは競わせない大きさにする。
 * 「押すと何が起きるか」を1行目に、内容を2行目に置く。
 */
.hello-more {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 13px 18px;
  background: none;
  border: none;
  box-shadow: inset 0 0 0 1.5px var(--brand);
  border-radius: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.hello-more-main { display: block; font-size: 17px; font-weight: 700; color: var(--brand); }
.hello-more-sub { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-soft); }

.brand {
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

/* 前の内容が残っていることを知らせる。決定29 */
.leftover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 18px 0 0;
  padding: 12px 8px 12px 16px;
  background: #FAEEDA;
  border-radius: 14px;
  font-size: 16px;
  color: #6B4A12;
}

.leftover .link { color: #6B4A12; }

.brand-name { color: var(--brand); font-weight: 700; font-size: 20px; letter-spacing: 0.02em; }
.brand-tag { color: var(--ink-faint); font-size: 15px; }

/* 残った空きの中央に置く。上に文章、下に注記が来て落ち着く */
.top-nav { display: grid; gap: 12px; margin: auto 0; padding: 28px 0; }

/*
 * 4つ並ぶと、どれも同じ重さに見えて選べない。
 * 一番急ぐ「施術中に伝える」を大きくして、目が先にそこへ行くようにする。
 */
.top-nav .primary { min-height: 120px; font-size: clamp(23px, 6.2vw, 28px); }
.top-nav .outline { min-height: 80px; }

.big {
  width: 100%;
  min-height: calc(var(--f) * 92px);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: calc(var(--f) * clamp(21px, 5.8vw, 26px));
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.big:active { transform: scale(0.985); }

/*
 * アイコン付きのボタン。決定46
 * 左にアイコン、右に文字。文字を読む前に、絵で見当がつく。
 * アイコンのない .big（えらび直す など）は中央ぞろえのまま。
 */
.big.with-icon {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(18px, 5vw, 26px);
  text-align: left;
}

.nav-icon { flex: none; display: inline-flex; }
.nav-icon .icon { width: calc(var(--f) * 34px); height: auto; }

.primary { background: var(--brand); color: #fff; }
.primary:disabled { background: var(--line); color: var(--ink-faint); cursor: default; }
.outline { background: #fff; color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }

.top-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 15px;
}

/* ---------------------------------------------------------------
 * 共通の小さなボタン
 * ------------------------------------------------------------- */

.ghost, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 10px 12px;
  margin: -10px -12px;
  border-radius: 10px;
}

.ghost .i { display: inline-flex; }

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

/* 「トップ」は縮めない。見出しが長くても押せる幅を保つ */
.bar .ghost { flex: none; white-space: nowrap; }

.hint { color: var(--ink-soft); font-size: 16px; margin: 0 0 20px; }

/* ---------------------------------------------------------------
 * 施術中モード — 押しやすさがすべて
 * ------------------------------------------------------------- */

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

.tile {
  min-height: calc(var(--f) * clamp(108px, 17.5vh, 168px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 8px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: calc(var(--f) * clamp(24px, 6.5vw, 34px));
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.08);
  transition: transform 0.08s ease;
}

.tile:active { transform: scale(0.97); }

/* 行の長さをそろえる。「少し待ってください」が1文字だけ折り返すのを防ぐ */
.tile-label { text-align: center; text-wrap: balance; }

/*
 * 「とても大きい」では1列にする。決定40
 *
 * スマホの幅では、2列のまま文字だけ大きくしても折り返すだけで読みやすくならない。
 * 1列にしてアイコンを横に並べれば、長い文でも1行に収まり高さも抑えられる。
 * 画面に収まる数は減るが、大きな文字が要る人にはそちらが優先される。
 */
body[data-size="xlarge"] .grid { grid-template-columns: 1fr; }

body[data-size="xlarge"] .tile {
  flex-direction: row;
  justify-content: flex-start;
  gap: 18px;
  min-height: calc(var(--f) * 84px);
  padding: 16px 22px;
}

body[data-size="xlarge"] .tile-label { text-align: left; }

/* アイコンも文字に合わせて大きくする。小さいと文字だけが浮いて見える */
.tile .icon { width: calc(var(--f) * clamp(38px, 10vw, 54px)); height: auto; }

.tile[data-color="red"]    { background: var(--red);    color: var(--on-red); }
.tile[data-color="orange"] { background: var(--orange); color: var(--on-orange); }
.tile[data-color="indigo"] { background: var(--indigo); color: var(--on-indigo); }
.tile[data-color="green"]  { background: var(--green);  color: var(--on-green); }
.tile[data-color="gray"]   { background: var(--gray);   color: var(--on-gray); }

/* 空きがあるぶんだけタイルを大きくする。押しやすさがこの画面のすべて */
#during-grid { flex: 1; grid-auto-rows: 1fr; }

/* その他 — 6つの大ボタンの視認性を落とさないよう控えめに */
.more { padding-top: 20px; }
.more-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* 控えめにしすぎると見つけてもらえない。押せるものだと分かる大きさは保つ */
.pill {
  margin: 0;
  min-height: 56px;
  padding: 12px 30px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.more-grid { margin-top: 12px; text-align: left; }
.more-grid .tile { min-height: 104px; font-size: clamp(19px, 5vw, 24px); }
.more-grid .tile .icon { width: clamp(30px, 7vw, 38px); }

/* ---------------------------------------------------------------
 * 声で聞く。決定35・36
 * ------------------------------------------------------------- */

/*
 * マイクが主役。決定43
 * 施術中、美容師は探さない・指ささない・触らない。話しかけるだけで済ませる。
 * 一覧は予備なので、それより明らかに大きくする。
 */
.mic-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: calc(var(--f) * 150px);
  margin-bottom: 12px;
  background: var(--brand);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: calc(var(--f) * 23px);
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.mic-btn .icon { width: calc(var(--f) * 56px); height: auto; }

/* 答えの画面に置く方は控えめに。主役は答えのボタンなので競わせない。決定45 */
.mic-btn.compact {
  flex-direction: row;
  gap: 14px;
  min-height: calc(var(--f) * 84px);
  font-size: calc(var(--f) * 19px);
}

.mic-btn.compact .icon { width: calc(var(--f) * 32px); }

/* 一覧が予備であることを、見出しで言っておく */
.ask-fallback {
  margin: 26px 0 4px;
  font-size: 15px;
  color: var(--ink-faint);
}

/* 聞いている最中だとひと目で分かるように。1秒に1回以下。決定10の範囲 */
.mic-btn.is-listening { background: var(--red); animation: mic-pulse 2s ease-in-out infinite; }

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, 0.35); }
  50%      { box-shadow: 0 0 0 12px rgba(179, 38, 30, 0); }
}

/* 聞き取った言葉。読ませるものなので大きく */
.voice-heard {
  font-size: calc(var(--f) * clamp(21px, 5.4vw, 27px));
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 18px;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

/* 話している途中はまだ確定していないと分かるようにする */
.voice-heard.is-partial { color: var(--ink-soft); font-weight: 500; }

.reply-head { font-size: 15px; margin: 20px 0 10px; }
.reply-grid .tile { min-height: 92px; font-size: clamp(16px, 4.2vw, 20px); }
.reply-grid .tile .icon { width: 26px; height: 26px; }

.voice-privacy { margin: 0 0 20px; }

/* ---------------------------------------------------------------
 * 美容師さんからの質問
 * ------------------------------------------------------------- */

/* 客ではなく美容師に向けた文。誰宛かが分かるよう、地の文と見た目を変える */
.staff-note {
  background: var(--brand-tint);
  color: var(--brand-dark);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.55;
}

.staff-note strong { font-weight: 700; }

/* 美容師さんへのお願い。決定30 — 読ませる画面なので、文字を大きく行間を広く */
.staff-list {
  list-style: none;
  counter-reset: staff;
  margin: 0;
  padding: 0;
}

.staff-list li {
  counter-increment: staff;
  position: relative;
  padding: 0 0 22px 46px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.staff-list li:last-child { border-bottom: none; margin-bottom: 8px; }

.staff-list li::before {
  content: counter(staff);
  position: absolute;
  left: 0;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.staff-title {
  display: block;
  font-size: calc(var(--f) * clamp(19px, 5vw, 24px));
  font-weight: 700;
  line-height: 1.4;
  text-wrap: balance;
}

.staff-sub {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.staff-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.staff-actions .big { min-height: 76px; font-size: clamp(17px, 4.6vw, 21px); }

.ask-list { display: grid; gap: 12px; }
.ask-items { display: grid; gap: 10px; margin-top: 10px; }

/*
 * 見出しそのものを開閉ボタンにする。畳まれていても中身があると分かるよう数を出す。
 * 質問一覧も18問あるので、選択肢の見出し（決定41）と同じくスクロール中も上に残す。
 */
.ask-toggle {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: calc(var(--f) * 68px);
  padding: 10px 2px;
  background: var(--bg);
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: calc(var(--f) * 19px);
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.ask-toggle:active { background: #F1EEE9; }

.ask-count {
  margin-right: auto;
  padding: 3px 12px;
  background: #EFECE6;
  border-radius: 999px;
  font-size: calc(var(--f) * 15px);
  font-weight: 700;
  color: var(--ink-soft);
}

.ask-toggle .icon { transition: transform 0.15s ease; }
.ask-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }

.ask {
  width: 100%;
  min-height: calc(var(--f) * 84px);
  padding: 16px 20px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1.5px var(--line);
  border-radius: 14px;
  font-family: inherit;
  font-size: calc(var(--f) * clamp(19px, 5vw, 24px));
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  text-align: left;
  text-wrap: balance;
  cursor: pointer;
}

.ask-question {
  font-size: clamp(21px, 5.4vw, 27px);
  font-weight: 700;
  line-height: 1.4;
  text-wrap: balance;
  margin: 0 0 20px;
}

/*
 * 答えは1列。長い文でも読みやすくする。
 *
 * 高さを画面いっぱいに伸ばさない。決定44
 * 答えが3つのときは巨大になり、6つになると画面からあふれる。
 * 一定の高さにしておけば、いくつ出ても収まりが変わらない。
 */
.answer-grid { grid-template-columns: 1fr; }

.answer-grid .tile {
  min-height: calc(var(--f) * 84px);
  flex-direction: row;
  justify-content: flex-start;
  gap: 16px;
  padding: 14px 20px;
  font-size: calc(var(--f) * clamp(19px, 5vw, 24px));
}

.answer-grid .tile .icon { width: calc(var(--f) * 30px); }
.answer-grid .tile-label { text-align: left; }

/* 5つ以上あるときは2列。長さの選択肢のように数が多い場合に使う */
.answer-grid.two-col { grid-template-columns: 1fr 1fr; }

.answer-grid.two-col .tile {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  min-height: calc(var(--f) * 100px);
  font-size: calc(var(--f) * clamp(17px, 4.4vw, 21px));
}

.answer-grid.two-col .tile .icon { width: calc(var(--f) * 26px); }
.answer-grid.two-col .tile-label { text-align: center; }

/* ---------------------------------------------------------------
 * 全画面表示
 * ------------------------------------------------------------- */

.alert, .cancel {
  position: fixed;
  inset: 0;
  max-width: none;
  z-index: 10;
  justify-content: space-between;
}

/*
 * 全画面表示には点滅を入れない。決定25
 *
 * 画面全体が一色に変わること自体が、すでに一番強い合図になっている。
 * その上に明滅を重ねても伝わる情報は増えず、うるさくなるだけ。
 * 気づいてもらう役目は、音とバイブと「もう一度知らせる」が受け持つ。
 */
.alert-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.alert[data-color="red"]    { background: var(--red);    color: var(--on-red); }
.alert[data-color="orange"] { background: var(--orange); color: var(--on-orange); }
.alert[data-color="indigo"] { background: var(--indigo); color: var(--on-indigo); }
.alert[data-color="green"]  { background: var(--green);  color: var(--on-green); }
.alert[data-color="gray"]   { background: var(--gray);   color: var(--on-gray); }

.cancel { background: #EFECE6; color: var(--ink); }
.cancel-sub { font-size: 19px; margin: 12px 0 0; color: var(--ink-soft); }

.alert-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.alert-label {
  font-size: calc(var(--f) * clamp(38px, 12.5vw, 76px));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin: 14px 0 0;
  text-wrap: balance;
}

/* 音が出ていることを目で見えるようにする */
/*
 * 動き続けるバー。決定25・51
 *
 * サロンではドライヤーで音が消える。そのとき頼れるのは、画面を見せることだけ。
 * 静止した画面は視界のはしでは気づかれない。動きは気づかれる。
 * 端末を差し出したとき、離れた位置からでも「何か出ている」と分かる大きさにする。
 *
 * 点滅ではなく、なめらかに伸び縮みさせる。1秒で1往復＝1Hz。
 * 光過敏の発作を避ける上限（毎秒3回）を大きく下回る。決定13
 */
.bars {
  display: flex;
  align-items: flex-end;
  gap: clamp(7px, 1.8vw, 10px);
  height: clamp(48px, 9vw, 64px);
  margin-top: 26px;
}

.bars span {
  width: clamp(8px, 2vw, 11px);
  height: 14px;
  border-radius: 4px;
  background: currentColor;
  opacity: 0.55;
}

.bars.playing span { animation: wave 1s ease-in-out infinite; }
.bars.playing span:nth-child(2) { animation-delay: 0.12s; }
.bars.playing span:nth-child(3) { animation-delay: 0.24s; }
.bars.playing span:nth-child(4) { animation-delay: 0.36s; }
.bars.playing span:nth-child(5) { animation-delay: 0.48s; }

@keyframes wave {
  0%, 100% { height: 14px; opacity: 0.45; }
  50%      { height: 100%; opacity: 1; }
}

.alert-actions { display: grid; gap: 12px; }
.alert-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert-btn {
  min-height: clamp(72px, 10vh, 96px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(20px, 4.8vw, 26px);
  font-weight: 700;
  cursor: pointer;
}

.alert-btn.wide { min-height: clamp(78px, 11vh, 104px); }

/*
 * 「間違えました」は控えめにしたいが、読めなくなっては困る。
 * 塗りを薄くすると背景色に埋もれるので、枠線と文字を地の文字色に合わせる。
 */
.alert-btn.quiet {
  background: transparent;
  color: inherit;
  box-shadow: inset 0 0 0 2px currentColor;
}

/* ---------------------------------------------------------------
 * シャンプー前に伝えておくこと
 * ------------------------------------------------------------- */

.check-group { margin-bottom: 26px; }

/*
 * グループの見出し。決定41
 *
 * 37項目を上から順に見ていくと、今どのグループにいるか分からなくなる。
 * スクロールしても上に残るようにして、現在地が常に見えるようにする。
 * 開閉式にはしない。開くと下の位置が動き、決定39（位置を動かさない）に反するうえ、
 * 畳むと「今日はカラーもできる」と気づく機会が消える。
 */
.group-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 2px;
  background: var(--bg);
  font-size: calc(var(--f) * 19px);
  font-weight: 700;
  color: var(--ink);
}

.group-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--f) * 40px);
  height: calc(var(--f) * 40px);
  border-radius: 12px;
  background: var(--brand-tint);
  color: var(--brand);
}

.check {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: calc(var(--f) * 68px);
  padding: 12px 16px;
  margin-bottom: 8px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 14px;
  font-family: inherit;
  font-size: calc(var(--f) * 19px);
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.check-box {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 2px var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}

.check[aria-pressed="true"] {
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 2px var(--brand);
  font-weight: 700;
}

.check[aria-pressed="true"] .check-box {
  background: var(--brand);
  box-shadow: none;
  color: #fff;
}

.foot-action {
  position: sticky;
  /*
   * 下の固定バーの上に、指1本ぶんの隙間を空けて置く。
   * 近すぎると「もどる」と押し間違える。このアプリでの誤タップは
   * 「伝えるつもりのないことが伝わる」ことに直結する。
   */
  bottom: calc(73px + env(safe-area-inset-bottom));
  padding: 30px 0 20px;
  /* 下の項目が半端に切れて見えないよう、広めにぼかす */
  background: linear-gradient(to top, var(--bg) 62%, rgba(251, 250, 248, 0));
  margin-top: auto;
}

/* 見せる画面から、えらび直すとトップの両方へ行けるようにする */
.foot-pair { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }

/*
 * 選択肢は「よくあること」だけに絞る。決定23
 * 足りないときの逃げ道を、足りないと気づくその場所に置く。
 */
.escape {
  text-align: center;
  font-size: 16px;
  color: var(--ink-soft);
  margin: 4px 0 8px;
}

.link {
  background: none;
  border: none;
  padding: 12px 6px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* ---------------------------------------------------------------
 * 見せる画面 — 一瞬で読めることがすべて
 * ------------------------------------------------------------- */

.show-lead { font-size: 16px; color: var(--ink-soft); margin: 0 0 20px; }

/*
 * 見せる画面は、客がスマホを美容師に差し出して使う。決定24
 *
 * 差し出されたことに気づいてもらうため、ゆっくり明滅させる。
 * ただし背景ごと光らせると、複数行の文字が読みにくくなる。
 * 全画面表示（一言だけ）とは事情が違うので、ここは枠だけを明滅させる。
 */
#show-list {
  list-style: none;
  margin: 0;
  padding: 6px 16px;
  border-radius: var(--radius);
  animation: attention 2s ease-in-out infinite;
}

/* 0.5回/秒。決定10（1秒に2回以下）の範囲に収めてある */
@keyframes attention {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0, 128, 143, 0.12); }
  50%      { box-shadow: 0 0 0 3px rgba(0, 128, 143, 0.55); }
}

#show-list li {
  font-size: calc(var(--f) * clamp(24px, 6.4vw, 31px));
  font-weight: 700;
  line-height: 1.4;
  padding: 22px 0 22px 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

#show-list li:last-child { border-bottom: none; }

#show-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 30px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
}

/* ---------------------------------------------------------------
 * 文字・手書き。決定27
 * ------------------------------------------------------------- */

.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 14px;
  background: #EFECE6;
  border-radius: 14px;
}

.mode {
  min-height: 52px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}

.mode.is-on { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(28, 27, 25, 0.1); }

.mode-panel { display: flex; flex-direction: column; flex: 1; }

#free-text {
  flex: 1;
  width: 100%;
  min-height: 200px;
  padding: 16px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: calc(var(--f) * 20px);
  line-height: 1.6;
  color: var(--ink);
  resize: none;
}

#free-text::placeholder { color: var(--ink-faint); }

/*
 * キーボードが出ている間。決定27
 * 固定バーを隠し、入力欄を縮めて、操作ボタンを画面内に残す。
 */
body.typing .tabbar { display: none; }

body.typing .screen { padding-bottom: max(var(--pad), env(safe-area-inset-bottom)); }

body.typing #free-text {
  flex: none;
  height: 34dvh;
  min-height: 120px;
}

.draw-btn.strong { background: var(--brand); color: #fff; box-shadow: none; }
.draw-btn.strong:disabled { background: var(--line); color: var(--ink-faint); }

/* 打った文章を、キーボードなしで大きく出す */
#show-free {
  font-size: clamp(26px, 6.8vw, 34px);
  font-weight: 700;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 20px 18px;
  border-radius: var(--radius);
  animation: attention 2s ease-in-out infinite;
}

/* ---------------------------------------------------------------
 * 手書き
 * ------------------------------------------------------------- */

#draw-canvas {
  flex: 1;
  width: 100%;
  min-height: 240px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
  /* 書いている間に画面が動かないようにする */
  touch-action: none;
  cursor: crosshair;
}

.draw-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 0 max(4px, env(safe-area-inset-bottom));
}

.draw-btn {
  min-height: 68px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 14px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.draw-btn:disabled { color: var(--ink-faint); cursor: default; }

/* ---------------------------------------------------------------
 * 設定
 * ------------------------------------------------------------- */

.set-group {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 18px;
  margin-bottom: 16px;
}

.row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  font-size: 19px;
  font-weight: 500;
  cursor: pointer;
}

.row-toggle input { width: 28px; height: 28px; accent-color: var(--brand); cursor: pointer; }

.note { font-size: 15px; color: var(--ink-faint); margin: 2px 0 12px; line-height: 1.55; }
.note.done { color: var(--brand); font-weight: 700; }

.choices { border: none; margin: 6px 0 12px; padding: 0; }
.choices legend { font-size: 15px; color: var(--ink-faint); padding: 0 0 8px; }

.choices label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 48px;
  margin-right: 18px;
  font-size: 18px;
  cursor: pointer;
}

.choices input { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; }

.field-label { display: block; margin: 14px 0 8px; font-size: 16px; font-weight: 700; }

.field {
  width: 100%;
  padding: 14px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
}

.field::placeholder { color: var(--ink-faint); }

/* お願いの一覧。直す・消す・足すをひとつの場所でやる。決定32 */
.edit-list { list-style: none; margin: 10px 0 0; padding: 0; }

.edit-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.edit-list li:last-child { border-bottom: none; }
.edit-list li.is-editing { background: var(--brand-tint); border-radius: 12px; padding: 12px; border-bottom: none; }
.edit-list li.is-editing .field { margin-bottom: 8px; font-size: 16px; }

.edit-text { margin-bottom: 10px; }
.edit-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.5; }
.edit-note { display: block; margin-top: 2px; font-size: 15px; line-height: 1.5; color: var(--ink-soft); }

.edit-actions { display: flex; gap: 8px; }

.small-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 8px 18px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.small-btn.danger { color: var(--red); }
.small-btn.strong-btn { background: var(--brand); color: #fff; box-shadow: none; }

.restore-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  background: none;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}

/* 入力してから「追加」を押す、という順が見えるように横に並べる */
.add-row { display: flex; gap: 8px; align-items: stretch; }
.add-row .field { flex: 1; min-width: 0; }

.add-btn {
  flex: none;
  min-width: 76px;
  padding: 0 18px;
  background: var(--brand);
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.add-btn:disabled { background: var(--line); color: var(--ink-faint); cursor: default; }

/* 追加したもの。消すボタンを文字つきで置き、押せることを分かるようにする */
.added-list { list-style: none; margin: 14px 0 0; padding: 0; }

.added-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  margin-bottom: 8px;
  background: var(--brand-tint);
  border-radius: 12px;
}

.added-text { flex: 1; font-size: 17px; line-height: 1.5; }

.del-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 8px 14px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--red);
  cursor: pointer;
}

/*
 * 消すボタン。前はグレーの文字で、押せないボタンに見えていた。
 * 「消す」に使う赤とごみ箱を、追加項目の削除と揃える。決定33
 */
.quiet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 60px;
  padding: 14px 20px;
  background: #fff;
  border: none;
  box-shadow: inset 0 0 0 1.5px var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--red);
  cursor: pointer;
}

.quiet-btn:active { background: #FBF1F0; }

.privacy { font-size: 15px; color: var(--ink-faint); line-height: 1.7; margin: 4px 0 0; }

/* ---------------------------------------------------------------
 * 横向き — 専用レイアウトは作らず、崩れないことだけを守る。決定15
 * ------------------------------------------------------------- */

@media (orientation: landscape) and (max-height: 560px) {
  .screen { min-height: auto; }
  .tile { min-height: 84px; font-size: 19px; gap: 4px; }
  .tile .icon { width: 26px; height: 26px; }
  .alert-label { font-size: clamp(32px, 7vw, 56px); }
  .alert-body { padding: 12px 0; }
  .bars { height: 26px; margin-top: 14px; }
  .alert-btn, .alert-btn.wide { min-height: 56px; font-size: 19px; }
  .big { min-height: 72px; }
}

/* 動きが苦手な方には止める */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------
   やりとりの記録。決定50

   Ava のように、誰の発言かを見た目で分ける。
   ただし色だけに頼らない。左右の位置と「美容師さん / わたし」の文字も添える。決定11
   --------------------------------------------------------------- */

.log-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0 var(--pad);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-row { display: flex; align-items: center; gap: 8px; }
.log-row.staff { justify-content: flex-start; }
.log-row.guest { justify-content: flex-end; }

/* 押し間違いを消す。決定54
   吹き出しの外に置く。同じ面に重ねると、見返すつもりで消してしまう */
.log-del {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}

.log-del:active { color: var(--red); }

/* 自分の発言は右寄せなので、消すボタンは吹き出しの左に回す */
.log-row.guest .log-del { order: -1; }

.log-bubble {
  max-width: calc(100% - 56px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: #FFFFFF;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

/* 自分の発言はブランド色寄り。相手の発言は白のまま */
.log-row.guest .log-bubble {
  background: var(--brand-tint);
  border-color: var(--brand);
}

.log-who {
  font-size: calc(13px * var(--f));
  font-weight: 700;
  color: var(--ink-soft);
}

.log-row.guest .log-who { color: var(--brand-dark); }

.log-text {
  font-size: calc(19px * var(--f));
  line-height: 1.45;
  font-weight: 600;
}

.log-bubble:active { transform: scale(0.985); }

/* ---------------------------------------------------------------
   見せる画面の読み上げ。決定53
   バーが動くことで、声が出ていることが本人にも分かる。
   聞こえない人は、鳴ったかどうかを音では確かめられない。
   --------------------------------------------------------------- */

.show-speak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 22px var(--pad) 0;
  color: var(--ink-soft);
}

.show-speak .bars { margin-top: 0; height: 34px; }
.show-speak .bars span { width: 7px; }

/* ---------------------------------------------------------------
   伝える欄。決定55

   押した内容がいったんここに溜まる。送って初めて声になる。
   画面の上のほうに置き、選んでいる間ずっと見えるようにする。
   --------------------------------------------------------------- */

.say-box {
  margin: 0 var(--pad) 20px;
  padding: 14px;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand-tint);
}

.say-empty {
  margin: 0;
  padding: 10px 4px;
  color: var(--ink-soft);
  font-size: calc(16px * var(--f));
}

.say-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.say-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-radius: 12px;
  background: #FFFFFF;
  font-size: calc(19px * var(--f));
  font-weight: 700;
  line-height: 1.4;
}

.say-item span { flex: 1 1 auto; }

.say-del {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}

.say-del:active { color: var(--red); }

.say-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.say-actions .big { margin: 0; }
.say-actions .big:disabled { opacity: 0.45; }
.say-actions .ghost:disabled { opacity: 0.4; }
