/* 寵物緊急卡（/tools/pet-card，2026-12-02）。共用的元件在 /styles.css，這裡只放這一頁自己的。
 * 卡片裡的字都用 em：手機預覽、列印（A4 上一張約 A6 大）共用同一份排法，只換底下的字級。 */

/* ---------- 幾隻寵物 ---------- */
.pc-pets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pc-pet {
  min-height: 44px; max-width: 100%; padding: 8px 16px;
  border: 1px solid #d8cdbf; border-radius: 999px; background: #fff; color: var(--ink);
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
.pc-pet[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.pc-pet.add { border-style: dashed; color: var(--primary); background: transparent; }
.pc-pet:active { filter: brightness(.92); }
@media (hover: hover) {
  .pc-pet:hover { border-color: var(--primary); }
}

/* ---------- 表單分組 ---------- */
.pc-group { margin: 0 0 6px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.pc-group > legend { float: left; width: 100%; margin: 0 0 12px; font-size: 1rem; color: var(--primary); }
.pc-group > legend + * { clear: both; }
.pc-group .two-up .field { margin-bottom: 14px; }
.pc-group textarea { min-height: 64px; }
/* 寶貝的照片 */
.pc-photo { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.pc-photo img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.pc-photo .btn { margin: 0; }
#pc-photo:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
/* 體重：只打數字，kg 已經寫在欄位裡 */
.pc-unit { position: relative; }
.pc-unit input { padding-right: 3em; }
.pc-unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#pc-clear { margin-top: 4px; padding-left: 0; }

/* ---------- 卡片（預覽和列印共用） ---------- */
.pc-side { margin: 4px 0 16px; }
.pc-side > h2 { margin: 0 0 10px; }
.pc-card {
  font-size: 1rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-top: 6px solid var(--primary); border-radius: 20px;
  padding: 1.1em 1.15em .9em; box-shadow: var(--shadow);
}
.pc-label { margin: 0; color: var(--primary); font-weight: 700; font-size: .82em; letter-spacing: .08em; }
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8em; }
.pc-head > div { min-width: 0; }
.pc-avatar { flex: none; width: 4.6em; height: 4.6em; border-radius: 50%; object-fit: cover; margin-bottom: .5em; }
.pc-name { margin: .1em 0 .35em; font-size: 1.9em; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.pc-name.empty { color: #b3a89c; }
.pc-chips { display: flex; flex-wrap: wrap; gap: .4em; margin: 0 0 .9em; padding: 0; list-style: none; }
.pc-chips li { padding: .2em .75em; border-radius: 999px; background: var(--primary-soft); color: #5e2b37; font-size: .88em; font-weight: 600; overflow-wrap: anywhere; }
.pc-rows {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5em .9em; align-content: start;
  margin: 0 0 1em; padding-top: .8em; border-top: 1px solid var(--line);
}
.pc-rows dt { color: var(--primary); font-weight: 700; font-size: .82em; line-height: 1.9; white-space: nowrap; }
.pc-rows dd { margin: 0; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.pc-nw { white-space: nowrap; }
.pc-none { margin: 0 0 1em; padding-top: .8em; border-top: 1px solid var(--line); color: var(--muted); font-size: .88em; }
.pc-call { margin: 0 0 .8em; padding: .7em .9em; border-radius: .8em; background: var(--forest); color: #fff; }
.pc-call strong { display: block; font-size: 1.15em; line-height: 1.35; }
.pc-call span { display: block; color: #cfe6dd; font-size: .8em; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: .6em; color: var(--muted); font-size: .78em; }
.pc-foot img { display: block; height: 2.4em; width: auto; }

/* ---------- 存起來 ---------- */
.pc-more { margin-top: 8px; }
#pc-msg { margin: 10px 0 0; min-height: 1.4em; }
.pc-shot { margin: 12px 0 4px; text-align: center; }
.pc-shot img {
  display: block; width: 100%; height: auto;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  -webkit-touch-callout: default;
}
.pc-shot figcaption { margin-top: 6px; }
/* 鎖定畫面的預覽疊一個假的時間（只在畫面上，存下來的圖沒有），看得出上面為什麼要空著 */
.pc-shot-frame { position: relative; margin: 0 auto; width: min(100%, 72vh); container-type: inline-size; }
.pc-shot.wall .pc-shot-frame { width: min(100%, calc(72vh * 1179 / 2556)); }
.pc-clock {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  padding-top: 9cqw; color: rgba(255, 255, 255, .94); pointer-events: none; text-shadow: 0 1px 8px rgba(0, 0, 0, .18);
}
.pc-shot:not(.wall) .pc-clock { display: none; }
.pc-clock-date { font-size: 14px; font-size: 4.6cqw; font-weight: 600; }
.pc-clock-time { font-size: 64px; font-size: 23cqw; font-weight: 700; line-height: 1; letter-spacing: -.02em; }

/* 調整照片位置：鎖定畫面的上半截 */
.pc-adjust { margin-top: 12px; }
.pc-adjust .hint { text-align: center; margin-top: 2px; }
.pc-zoom { display: flex; align-items: center; gap: 10px; width: min(260px, 80%); margin: 10px auto 0; font-size: .9rem; color: var(--muted); }
.pc-zoom input { flex: 1; min-height: 44px; accent-color: var(--primary); }
.pc-adjust-phone {
  position: relative; width: min(260px, 80%); margin: 0 auto; overflow: hidden;
  border-radius: 28px 28px 0 0; background: #3a1a26; container-type: inline-size;
  touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none;
  -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent);
}
.pc-adjust-phone.dragging { cursor: grabbing; }
.pc-adjust-phone:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.pc-adjust-bg { position: absolute; left: -10%; top: -10%; width: 120%; height: 120%; max-width: none; object-fit: cover; filter: blur(14px) brightness(.66); }
.pc-adjust-photo {
  position: absolute; left: 0; top: 0; width: 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 var(--fade, 70%), transparent); mask-image: linear-gradient(#000 var(--fade, 70%), transparent);
}
.pc-adjust-photo img { position: absolute; max-width: none; pointer-events: none; }
.pc-adjust-phone .pc-clock { background: linear-gradient(rgba(0, 0, 0, .2), transparent 45%); }
.pc-adjust-card {
  position: absolute; height: 60%; padding: 4cqw 5cqw; border-radius: 4cqw;
  background: var(--surface); box-shadow: 0 2px 14px rgba(20, 8, 14, .3); pointer-events: none;
}
.pc-adjust-card span { display: block; color: var(--primary); font-size: 2.8cqw; font-weight: 700; }
.pc-adjust-card b { display: block; color: var(--ink); font-size: 7.5cqw; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.pc-help { margin-top: 10px; border-top: 1px solid var(--line); }
.pc-help summary { display: flex; align-items: center; min-height: 44px; font-weight: 700; cursor: pointer; }
.pc-help p { margin: 0 0 8px; }
#pc-text { width: 100%; background: var(--teal-soft); margin-bottom: 4px; }

/* ---------- 桌機：左邊標題下面放卡片預覽（停住），右邊填表 ---------- */
@media (min-width: 960px) {
  body.pc-page #main > .page-head { grid-row: 1; position: static; }
  body.pc-page #main > .pc-side { grid-column: 1; grid-row: 2 / span 40; max-width: 460px; margin-top: 12px; }
  body.pc-page .pc-side .pc-card { font-size: 1.05rem; }
}
/* 螢幕夠高才讓預覽停住，不然卡片下半截會一直看不到 */
@media (min-width: 960px) and (min-height: 940px) {
  body.pc-page #main > .pc-side { position: sticky; top: 100px; }
}

/* ---------- 列印：A4 上 2×2，每張 92×130 mm（約 A6），虛線剪下 ---------- */
.pc-print { display: none; }
.pc-print.measure { display: grid; grid-template-columns: repeat(2, 92mm); grid-auto-rows: 130mm; gap: 6mm; position: absolute; left: -10000px; top: 0; visibility: hidden; }
.pc-print .pc-card {
  --s: 1;
  display: flex; flex-direction: column;
  width: 92mm; height: 130mm; overflow: hidden;
  font-size: calc(9.5pt * var(--s));
  padding: 5mm 5.5mm 4mm; border: 1px dashed #8a8079; border-top: 3mm solid var(--primary); border-radius: 3mm;
  box-shadow: none; break-inside: avoid; page-break-inside: avoid;
}
.pc-print .pc-name { font-size: 2.2em; }
.pc-print .pc-card > * { flex: none; }
.pc-print .pc-call { margin-top: auto; } /* 「出發前先打給醫院」固定在卡片下面 */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pc-page .shell, body.pc-page .skip-link { display: none !important; }
  .pc-print { display: grid !important; grid-template-columns: repeat(2, 92mm); grid-auto-rows: 130mm; gap: 6mm; }
}
