/* 喵皇奴品牌色：米白、深棕、大地色（沿用 naughty-cat） */
:root {
  --bg: #F5F1ED;
  --card: #FFFAF3;
  --line: #E8D9C5;
  --tan: #D4A574;
  --brown: #5C4033;
  --ink: #3A2A20;
  --muted: #7A6656;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brown); }

/* 每個畫面撐滿 main 的高度，按鈕才會落在下半部 */
.screen { flex: 1; display: flex; flex-direction: column; }

main {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 16px;
  display: flex;
  flex-direction: column;
}

.loading, .muted { color: var(--muted); }
.small { font-size: 14px; }

h1 { font-size: 28px; line-height: 1.35; margin: 24px 0 8px; }
h2 { font-size: 21px; line-height: 1.4; margin: 0 0 12px; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--brown);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 14px 22px;
  min-height: 52px;
  width: 100%;
  cursor: pointer;
}
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brown); box-shadow: inset 0 0 0 2px var(--line); }
.btn + .btn { margin-top: 10px; }
.btn:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--tan); outline-offset: 2px; }

.stack-bottom { margin-top: auto; padding-top: 24px; }

/* 首頁 */
.home-lead { font-size: 18px; }
.pool-note { font-size: 15px; color: var(--muted); }

/* 抽籤 */
.draw { flex: 1; display: grid; place-items: center; text-align: center; }
.draw .roll { font-size: 30px; font-weight: 700; color: var(--brown); min-height: 1.5em; }

/* 一生 */
.life { flex: 1; display: flex; flex-direction: column; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.life.is-choice { cursor: default; }
.life .species-tag { font-size: 14px; color: var(--muted); letter-spacing: 0.05em; }
.life .lines { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px 0; }
.life .lines p { font-size: 20px; line-height: 1.75; margin: 0 0 14px; }
.life .hint { text-align: center; color: var(--muted); font-size: 14px; }
.life-tools { display: flex; justify-content: flex-end; }
.link-btn { appearance: none; background: none; border: 0; padding: 8px 0; font: inherit; font-size: 14px; color: var(--muted); text-decoration: underline; cursor: pointer; }

.choices { display: flex; flex-direction: column; gap: 10px; }

/* 結局 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.summary .outcome { font-size: 20px; font-weight: 600; }

/* 認養 */
.county { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; }
.county select { flex: 1; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 48px; }
.animals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.animal { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; line-height: 1.5; }
.animal img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--line); }
.animal .meta { padding: 8px 10px 10px; }
.animal .shelter { color: var(--muted); }
.animal.single { max-width: 260px; margin: 12px auto 0; cursor: default; }
.shelters { font-size: 14px; padding-left: 1.2em; }
.shelters li { margin-bottom: 6px; }

/* 分享 */
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.share-row .btn { font-size: 15px; min-height: 48px; padding: 10px; }
.share-row .btn + .btn { margin-top: 0; }

/* 關於 */
.about h2 { margin-top: 28px; }
.about table { width: 100%; border-collapse: collapse; font-size: 14px; }
.about th, .about td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.about td.num, .about th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.about td.name { white-space: nowrap; }
.about details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.about summary { cursor: pointer; font-weight: 600; }
.about ul { padding-left: 1.2em; }
.table-wrap { overflow-x: auto; }

/* 頁尾 */
.site-footer { text-align: center; font-size: 13px; color: var(--muted); padding: 16px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }

/* 回報錯誤 */
dialog { border: 0; border-radius: var(--radius); padding: 20px 16px; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(58, 42, 32, 0.45); }
dialog textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.dialog-actions { display: flex; gap: 10px; margin-top: 12px; }
.dialog-actions .btn + .btn { margin-top: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fade 0.35s ease-out both; }
  @keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
