/* PalmCore 手機使用訪談（第二版：整場都是聊天）
   給長輩用：字大、按鈕大、一次一句、對比夠、不靠顏色分辨。配色跟 App 的日間配色同一套（霧青、墨色、暖金）。 */
:root {
  --bg1: #EAF1ED; --bg2: #D9E5DE; --card: #FCFDFB; --ink: #1D3136; --muted: #4A5E61; --faint: #6E8082; --line: #BFCEC6;
  --gold: #7A5A1E; --gold-soft: #F3EAD6; --blue: #23507C; --mine: #2F4A52; --soft: #EEF3EF; --warn: #8C3B2A;
  --fs: 20px; --tap: 58px; --r: 24px;
}
:root.big { --fs: 24px; --tap: 66px; }
* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%; min-height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(120% 60% at 80% -10%, #F6F1E2 0%, rgba(246, 241, 226, 0) 60%), linear-gradient(180deg, var(--bg1), var(--bg2));
  color: var(--ink); font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; line-height: 1.6;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ── 最上面：是誰、三顆工具、聊到哪 ── */
.top { position: relative; flex: none; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.45rem + env(safe-area-inset-top)) .8rem .55rem; background: rgba(250, 252, 249, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.id { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1; }
.id img { flex: none; width: 44px; height: 44px; }
.id > div { min-width: 0; }
.id b { display: block; font-size: .86rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id span { display: block; font-size: .68rem; color: var(--faint); line-height: 1.2; }
.tools { display: flex; gap: .3rem; flex: none; }
.tools button { min-width: 46px; min-height: 46px; padding: 0 .7rem; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: .72rem; font-weight: 600; color: var(--muted); }
.tools button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
#btn-more { font-size: 1.1rem; line-height: 1; padding: 0 .5rem; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(31, 51, 56, .08); }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 0 3px 3px 0; transition: width .6s ease; }
@media (max-width: 380px) { .id span { display: none; } .tools button { padding: 0 .55rem; } }

/* ── 對話 ── */
#log { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; padding: 1rem .8rem .6rem; display: flex; flex-direction: column; gap: .7rem;
  width: 100%; max-width: 680px; margin: 0 auto; }
.msg { max-width: 88%; padding: .72rem .95rem; border-radius: var(--r); font-size: 1rem; overflow-wrap: anywhere; white-space: pre-wrap; animation: rise .32s ease both; }
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid rgba(191, 206, 198, .7); border-top-left-radius: 8px; box-shadow: 0 8px 24px -20px rgba(29, 49, 54, .55); }
.msg.me { align-self: flex-end; background: var(--mine); color: #fff; border-bottom-right-radius: 8px; }
.msg.me.tap { background: #3B5961; }
.msg.err { background: #fff; border: 1.5px solid var(--warn); }
.note { align-self: stretch; background: var(--gold-soft); border-radius: 18px; padding: .75rem .95rem; font-size: .9rem; color: #4A3A14; animation: rise .32s ease both; }
.note b { display: block; font-size: .72rem; letter-spacing: .04em; color: var(--gold); margin-bottom: .15rem; }
.sys { align-self: center; font-size: .72rem; color: var(--faint); padding: .1rem .6rem; text-align: center; }
.dots { align-self: flex-start; display: flex; gap: .32rem; padding: .95rem 1rem; background: var(--card); border: 1px solid rgba(191, 206, 198, .7); border-radius: var(--r); border-top-left-radius: 8px; }
.dots i { width: .46rem; height: .46rem; border-radius: 50%; background: var(--gold); animation: blink 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .16s; } .dots i:nth-child(3) { animation-delay: .32s; }
@keyframes blink { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg, .note, .chip { animation: none !important; } .dots i { animation: none; opacity: .7; } #log { scroll-behavior: auto; } }

/* ── 底下：可以直接點的回答＋輸入 ── */
.compose { flex: none; width: 100%; max-width: 680px; margin: 0 auto; padding: .35rem .8rem calc(.6rem + env(safe-area-inset-bottom)); }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin-bottom: .5rem; }
.chips:empty { display: none; }
.chip { min-height: var(--tap); padding: .45rem .8rem; border-radius: 18px; border: 2px solid var(--ink); background: #fff; font-size: .95rem; font-weight: 600; line-height: 1.35; text-align: center;
  display: flex; align-items: center; justify-content: center; animation: rise .3s ease both; }
.chip:active { transform: scale(.975); background: var(--soft); }
.chip.wide { grid-column: 1 / -1; }
.chip.soft { border-color: var(--line); font-weight: 500; }
.chip.quiet { grid-column: 1 / -1; min-height: 46px; border: 0; background: none; font-weight: 500; font-size: .82rem; color: var(--muted); text-decoration: underline; text-underline-offset: .22em; }
.chip.main { background: var(--gold); border-color: var(--gold); color: #fff; }
.chips.one { grid-template-columns: 1fr; }
.box { display: flex; align-items: flex-end; gap: .45rem; background: #fff; border: 2px solid var(--ink); border-radius: 30px; padding: .32rem .35rem .32rem 1rem; box-shadow: 0 12px 30px -24px rgba(29, 49, 54, .7); }
.box textarea { overflow-y: auto; scrollbar-width: none; flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; padding: .55rem 0; max-height: 7.2rem; line-height: 1.5; font-size: 1rem; }
.box textarea::placeholder { color: var(--faint); }
.round { flex: none; width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #fff; }
.round svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.round.send { background: var(--ink); }
.round.on { background: var(--warn); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(140, 59, 42, .16); } }
.heard { margin: .4rem .3rem 0; font-size: .78rem; color: var(--muted); }
.compose.done .box, .compose.done .heard { display: none; }

/* 聊完之後 */
.end { align-self: stretch; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; gap: .6rem; animation: rise .4s ease both; }
.end h2 { margin: 0; font-size: 1.1rem; }
.end p { margin: 0; font-size: .88rem; color: var(--muted); }
.end input { width: 100%; min-height: var(--tap); border-radius: 16px; border: 2px solid var(--ink); padding: 0 .8rem; font-size: .95rem; background: #fff; }
.end .row { display: flex; gap: .45rem; flex-wrap: wrap; }
.end .row > * { flex: 1 1 8rem; }
.btn { min-height: var(--tap); padding: .4rem 1rem; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-weight: 600; font-size: .92rem; }
.btn.main { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.plain { border-color: var(--line); font-weight: 500; color: var(--muted); }
figure.meme { margin: 0; text-align: center; }
figure.meme img { max-width: 100%; height: auto; border-radius: 18px; }

/* 說明那一張 */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(29, 49, 54, .45); display: flex; align-items: flex-end; justify-content: center; }
.panel { width: 100%; max-width: 680px; max-height: 88dvh; overflow-y: auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 1.2rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); display: grid; gap: .7rem; animation: rise .28s ease both; }
.panel h2 { margin: 0; font-size: 1.15rem; }
.panel ul { margin: 0; padding-left: 1.15rem; display: grid; gap: .4rem; font-size: .9rem; }
.panel p { margin: 0; font-size: .9rem; }
.panel .btn { width: 100%; }
.noscript { max-width: 640px; margin: 2rem auto; padding: 1rem; }
