/* 老友記幫手 — 長者設計硬規則：正文≥22px、按鈕≥24px、高對比、少層級 */

:root {
  --font-size: 24px;            /* 全局可調（設定頁改） */
  --bg: #FFF8E7;
  --ink: #1A1A1A;
  --green: #2E7D32;
  --red: #C62828;
  --blue: #1565C0;
  --orange: #E65100;
  --radius: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: var(--font-size); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang HK", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  /* 防止 iOS 雙擊縮放誤觸 */
  touch-action: manipulation;
}

#app { max-width: 560px; margin: 0 auto; padding: 16px; }

/* ===== 首頁六大功能塊 ===== */
.home-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 12px 0 20px;
}

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

.block {
  min-height: 9rem;
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
  transition: transform .05s;
}
.block:active { transform: translateY(3px); box-shadow: none; }
.block .icon { font-size: 2.2rem; }
.block .sub { font-size: .85rem; font-weight: 400; opacity: .95; }

.b-green  { background: var(--green); grid-column: 1 / -1; min-height: 7rem; }
.b-blue   { background: var(--blue); }
.b-orange { background: var(--orange); }
.b-teal   { background: #00695C; }
.b-purple { background: #6A1B9A; }
.b-red    { background: var(--red); grid-column: 1 / -1; min-height: 7rem; font-size: 1.5rem; }

/* ===== 通用大按鈕 ===== */
.btn {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  margin: 12px 0;
  border: none;
  border-radius: var(--radius);
  font-size: 1.2rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
.btn:active { transform: translateY(3px); box-shadow: none; }
.btn.secondary { background: #616161; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .55; box-shadow: none; cursor: default; }

/* ===== 預設時間大按鈕 ===== */
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn.preset { min-height: 4.2rem; font-size: 1.1rem; margin: 0; background: #6A1B9A; }
.btn.preset.selected { background: var(--orange); outline: 4px solid #FFB74D; }

/* ===== 打電話（撥號 + 複製號碼） ===== */
.call-row { display: flex; gap: 8px; align-items: center; }
.call-row .btn { flex: 1; }
.call-row .copy-tel { flex: none; width: auto; margin: 12px 0; }

/* ===== 頂欄 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.topbar .back {
  border: none;
  background: #E0E0E0;
  border-radius: 14px;
  font-size: 1.3rem;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 700;
}
.topbar h2 { margin: 0; font-size: 1.3rem; }

/* ===== 確認卡（語音/提醒復讀） ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  border: 3px solid var(--green);
}
.card p.big { font-size: 1.35rem; font-weight: 700; margin: 8px 0; }

/* ===== 全屏提醒 / SOS ===== */
#overlay:empty { display: none; }
#overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#overlay .panel { width: 100%; max-width: 520px; text-align: center; }
#overlay.sos { background: var(--red); color: #fff; }

.pulse { animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ===== 語音大掣 ===== */
.mic-btn {
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  border: none;
  background: var(--purple, #6A1B9A);
  background: #6A1B9A;
  color: #fff;
  font-size: 3rem;
  margin: 32px auto;
  display: block;
  box-shadow: 0 6px 0 rgba(0,0,0,.3);
}
.mic-btn:active { transform: translateY(4px); box-shadow: none; }
.mic-btn.listening { background: var(--red); animation: pulse 1s infinite; }

.hint { text-align: center; color: #555; font-size: .95rem; padding: 0 12px; }

/* ===== 設定（子女端） ===== */
input[type="text"], input[type="password"], input[type="time"] {
  width: 100%;
  min-height: 3.5rem;
  font-size: 1.1rem;
  font-family: inherit;
  padding: 8px 16px;
  border: 3px solid #9E9E9E;
  border-radius: 14px;
  background: #fff;
}

label { display: block; font-weight: 700; margin: 16px 0 6px; }
