/* 手機互動頁：觀察手帳風格（米色紙、粗黑框、手寫感標題） */
:root {
  --paper: #fff8ec; --dots: #ecdcc2; --card: #ffffff; --ink: #2b2118; --muted: #5e5142;
  --peach: #ffe8cc; --orange: #f76707; --orange-soft: #ffc078; --green: #37b24d; --floor: #fdf3e1;
  --hand: "LXGW WenKai TC", "Kaiti TC", serif;
  --sans: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; color: var(--ink); font-family: var(--sans);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 18px 18px;
}
header { max-width: 560px; margin: 0 auto; padding: 14px 16px 4px; display: flex; align-items: center; gap: 10px; }
h1 { font-family: var(--hand); font-size: 26px; margin: 0; flex: 1; }
h2 { font-family: var(--hand); font-size: 20px; margin: 0; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #adb5bd; border: 1.5px solid var(--ink); }
.dot.on { background: var(--green); }

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; display: grid; gap: 16px; }
.card { background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
  padding: 14px; display: grid; gap: 10px; min-width: 0; }
.card.now { background: var(--peach); }
.head { display: flex; justify-content: space-between; align-items: baseline; }
.head span { font-size: 14px; }
.hint { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }

button { font: inherit; color: var(--ink); cursor: pointer; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tool { min-height: 46px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); font-weight: 700; font-size: 15px; }
.tool.on { background: var(--ink); color: #ffffff; }
#map { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 12px; border: 2px solid var(--ink);
  touch-action: none; background: var(--floor); }
.plain { min-height: 46px; border: 2px solid var(--ink); border-radius: 14px; background: var(--card); font-weight: 700; font-size: 15px; }
.plain:active, .big:active, .tool:active { transform: translate(2px, 2px); }

.behavior { font-family: var(--hand); font-size: 30px; font-weight: 700; line-height: 1.3; }
.gauges { display: grid; grid-template-columns: 4em minmax(0, 1fr) 3em; gap: 8px; align-items: center; font-size: 15px; }
.gauges output { text-align: right; }
.bar { display: block; height: 14px; border: 2px solid var(--ink); border-radius: 999px; background: #ffffff; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; }
.bar .orange { background: var(--orange); }
.bar .green { background: var(--green); }
.score { margin: 0; font-size: 15px; }
.score b { font-family: var(--hand); font-size: 20px; }

.poke-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.big { min-height: 64px; border: 2px solid var(--ink); border-radius: 16px; background: var(--orange-soft);
  font-family: var(--hand); font-size: 21px; font-weight: 700; box-shadow: 3px 3px 0 var(--ink); }

.circuits { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.circuits li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 0; border-top: 1.5px dashed var(--dots); }
.circuits li:first-child { border-top: 0; }
.circuits .name { font-weight: 700; font-size: 16px; }
.circuits .q { grid-column: 1 / 2; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.circuits li.off .name { text-decoration: line-through; color: var(--muted); }

/* 開關（其實是 checkbox，鍵盤和報讀軟體都能用） */
.switch { grid-row: 1 / 3; grid-column: 2; position: relative; width: 62px; height: 36px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border: 2px solid var(--ink); border-radius: 999px; background: #dee2e6; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #ffffff; border: 2px solid var(--ink); box-sizing: border-box; transition: left .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 29px; }
.switch input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }

.foot { text-align: center; margin: 4px 0 0; }
.foot a { color: var(--ink); font-weight: 700; padding: 12px 8px; display: inline-block; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: #ffffff; padding: 10px 18px; border-radius: 999px; font-size: 15px;
  opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: .95; }
.toast.bad { background: #c92a2a; }

@media (min-width: 1000px) {
  header, main { max-width: 1080px; }
  main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .where { grid-row: span 2; }
  .brain { grid-column: 2; }
  .foot { grid-column: 1 / -1; }
}
