/* =========================================================
   鸚鵡學語記 — CET-4 闖關版
   零外部資源：顏色、圖形、動效全部 CSS / inline SVG
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0a0e1a;
  --bg2: #111a30;
  --panel: #16203a;
  --panel2: #1c2947;
  --line: #2a3a5e;
  --ink: #eef3ff;
  --ink-dim: #9fb0d0;
  --ink-faint: #6b7d9e;
  --accent: #7c5cff;
  --accent2: #22d3ee;
  --good: #34d399;
  --bad: #f87171;
  --gold: #fbbf24;
  --hue: 265;
  --r: 16px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .75);
}

body.light {
  --bg: #eef2fb;
  --bg2: #e3eaf8;
  --panel: #ffffff;
  --panel2: #f4f7fe;
  --line: #cfd9ee;
  --ink: #16203a;
  --ink-dim: #4c5c7a;
  --ink-faint: #7d8ca8;
  --shadow: 0 18px 40px -22px rgba(30, 50, 100, .35);
}

html, body { height: 100%; }
html { background: #0a0e1a; }
body.light, html:has(body.light) { background: #eef2fb; }

body {
  margin: 0;
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 78% -8%, hsl(var(--hue) 72% 26% / .55), transparent 62%),
    radial-gradient(900px 520px at 8% 4%, #0e3a4d 0%, transparent 58%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  transition: background-color .4s ease;
}

button { font: inherit; color: inherit; cursor: pointer; }

#app { max-width: 960px; margin: 0 auto; padding: 0 14px 40px; }

/* ---------------- 頂欄 ---------------- */
#hud {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, hsl(var(--hue) 40% 8% / .82), hsl(var(--hue) 40% 8% / .45));
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
body.light #hud { background: #ffffffd9; }

#hud-mid { flex: 1; min-width: 0; line-height: 1.15; }
#hud-title { font-size: 15px; letter-spacing: .04em; display: block; }
#hud-sub { font-size: 10.5px; color: var(--ink-faint); letter-spacing: .12em; }

#hud-right { display: flex; align-items: center; gap: 6px; }

.hud-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 10px; font-size: 13px;
  transition: transform .12s ease, border-color .2s ease, background .2s ease;
}
.hud-btn span { font-size: 12px; }
.hud-btn:hover { border-color: var(--accent); }
.hud-btn:active { transform: scale(.94); }

#hud-feather {
  font-size: 12.5px; color: var(--ink-dim);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 10px; white-space: nowrap;
}
#hud-feather b { color: var(--gold); font-size: 13.5px; }

/* ---------------- 畫面切換 ---------------- */
.screen { animation: fadeUp .3s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- Hero：鸚鵡 + 對話 ---------------- */
#hero {
  display: grid; grid-template-columns: 132px 1fr; gap: 6px;
  align-items: center; margin: 8px 0 22px;
}
#hero-parrot { width: 132px; height: 132px; display: grid; place-items: center; }

#hero-bubble {
  position: relative; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
#hero-bubble::before {
  content: ""; position: absolute; left: -8px; top: 34px;
  width: 14px; height: 14px; background: var(--panel);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg); border-radius: 0 0 0 4px;
}
#hero-name { font-size: 12px; letter-spacing: .16em; color: var(--accent2); }
#hero-say { margin: 4px 0 8px; font-size: 14px; line-height: 1.55; min-height: 44px; }
#hero-meta { display: flex; gap: 10px; font-size: 11.5px; color: var(--ink-faint); }
#hero-meta span { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
#hero-star { color: var(--gold); }

/* ---------------- 鸚鵡本體（inline SVG 的外層容器） ---------------- */
.parrot-box { display: grid; place-items: center; }
.parrot-box svg { width: 100%; height: 100%; overflow: visible; }
.p-body-anim { animation: bob 3s ease-in-out infinite; transform-origin: 60px 96px; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-4px) rotate(-1.2deg); } }

.p-eye { animation: blink 5.4s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

.p-wing { transform-origin: 74px 78px; }
.parrot-box.happy .p-wing { animation: flap .5s ease 2; }
@keyframes flap { 0%, 100% { transform: rotate(0deg); } 45% { transform: rotate(-16deg); } }

.parrot-box.happy .p-body-anim { animation: hop .5s ease 2; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px) scale(1.04); } }

.parrot-box.sad .p-body-anim { animation: droop .6s ease 1; }
@keyframes droop { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(5px) rotate(3deg); } }

.p-spark { opacity: 0; }
.parrot-box.happy .p-spark { animation: sparkle .9s ease forwards; }
@keyframes sparkle { 0% { opacity: 0; transform: scale(.4); } 40% { opacity: 1; transform: scale(1.15); } 100% { opacity: 0; transform: scale(.8); } }

/* ---------------- 地圖 ---------------- */
#map-head h1 { font-size: 19px; margin: 0 0 4px; letter-spacing: .02em; }
#map-head p { margin: 0 0 16px; font-size: 12.5px; color: var(--ink-faint); }
#map-head .dots { color: var(--accent); }

#region-list { display: grid; gap: 12px; }

.region {
  background: linear-gradient(150deg, hsl(var(--rh) 45% 16% / .92), var(--panel) 62%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 13px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .18s ease, border-color .2s ease;
}
.region::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(320px 120px at 88% 0%, hsl(var(--rh) 80% 55% / .22), transparent 70%);
}
.region.locked { opacity: .55; filter: saturate(.5); }
body.light .region {
  background: linear-gradient(150deg, hsl(var(--rh) 72% 95%), #ffffff 62%);
  border-color: hsl(var(--rh) 45% 78%);
}
body.light .region-titles b { color: #16203a; }
body.light .region-titles small { color: #5a6b8c; }
body.light .node { background: #ffffff; border-color: #d6e0f2; }
body.light .node.boss { background: linear-gradient(160deg, #4a1038, #2a1030); }
body.light .node.boss .n-name { color: #ffb3e2; }
body.light .node .n-idx, body.light .node .n-best { color: #6b7d9e; }
body.light .node .n-stars { color: #b45309; }
body.light #hero-bubble { box-shadow: 0 12px 28px -18px rgba(40, 60, 110, .45); }
body.light .opt { background: #f7faff; }
body.light .opt .k { background: #eaf0fb; }
body.light .hud-btn, body.light #hud-feather { background: #ffffff; }
body.light .modal::before { background: #0b1221b8; }
body.light .modal-panel { background: #ffffff; }
body.light #q-card { background: #ffffff; }
body.light #q-explain-body .model { background: #f5f8ff; }

.region.done { border-color: hsl(var(--rh) 70% 55% / .6); }

.region-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.region-icon {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 19px;
  background: hsl(var(--rh) 70% 50% / .16);
  border: 1px solid hsl(var(--rh) 70% 60% / .35);
}
.region-titles { flex: 1; min-width: 0; }
.region-titles b { display: block; font-size: 14.5px; }
.region-titles small { color: var(--ink-faint); font-size: 11.5px; }
.region-stars { font-size: 12px; color: var(--gold); white-space: nowrap; }

.nodes { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.node {
  flex: 1 1 0; min-width: 68px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 13px; padding: 8px 6px; text-align: center;
  transition: transform .14s ease, border-color .2s ease, background .2s ease;
  position: relative;
}
.node:hover:not(.locked) { transform: translateY(-2px); border-color: hsl(var(--rh) 80% 62%); }
.node:active:not(.locked) { transform: scale(.97); }
.node .n-idx { font-size: 10px; color: var(--ink-faint); letter-spacing: .1em; }
.node .n-name { font-size: 12.5px; font-weight: 700; margin: 2px 0 4px; }
.node .n-stars { font-size: 10.5px; color: var(--gold); letter-spacing: 1px; min-height: 14px; }
.node.boss { background: linear-gradient(160deg, #3a1030, #2a1030); border-color: #7a2a66; }
.node.boss .n-name { color: #ff9ad5; }
.node.locked { opacity: .45; cursor: not-allowed; }
.node.locked::after { content: "🔒"; position: absolute; top: 4px; right: 6px; font-size: 10px; }
.node .n-best { font-size: 10px; color: var(--ink-faint); }

#map-foot { margin-top: 18px; font-size: 11px; color: var(--ink-faint); }

/* ---------------- 章節開場 ---------------- */
.intro-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 16px; box-shadow: var(--shadow);
  margin-top: 18px;
}
.intro-top { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; }
#intro-parrot { width: 110px; height: 110px; }
.intro-lines h2 { margin: 0 0 6px; font-size: 18px; }
.intro-lines p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-dim); }

.rules {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0;
  font-size: 12px; color: var(--ink-dim);
}
.rules span {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px;
}
.intro-actions, .res-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-primary, .btn-ghost {
  border-radius: 999px; padding: 10px 18px; font-size: 13.5px;
  border: 1px solid transparent; transition: transform .12s ease, filter .2s ease, border-color .2s ease;
}
.btn-primary {
  background: linear-gradient(140deg, var(--accent), #4f46e5);
  color: #fff; font-weight: 700; box-shadow: 0 10px 24px -12px var(--accent);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active, .btn-ghost:active { transform: scale(.96); }
.btn-ghost { background: var(--panel2); border-color: var(--line); color: var(--ink-dim); }
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); }

/* ---------------- 作答 ---------------- */
#play-hud {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  margin: 4px 0 10px;
}
.ph-left { display: flex; align-items: center; gap: 8px; }
#p-hearts { display: flex; gap: 2px; font-size: 15px; line-height: 1; }
#p-hearts .lost { filter: grayscale(1); opacity: .3; }
#p-round { font-size: 11.5px; color: var(--ink-faint); }

.ph-mid { min-width: 60px; }
#p-timer {
  height: 7px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
#p-timer-fill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transition: width .12s linear, background .3s ease;
}
#p-timer-fill.warn { background: linear-gradient(90deg, #fb7185, var(--bad)); }

.ph-right { text-align: right; }
#p-score { font-size: 17px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
#p-combo {
  font-size: 11px; color: var(--gold); letter-spacing: .06em;
  transition: opacity .2s ease, transform .2s ease;
}
#p-combo.off { opacity: 0; transform: translateY(-3px); }
#p-combo.hot { animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Boss */
#boss-wrap { margin: 6px 0 12px; }
#boss-stage { display: grid; place-items: center; height: 84px; }
#boss-art { width: 84px; height: 84px; }
#boss-hp { position: relative; height: 22px; background: var(--panel2); border: 1px solid #7a2a66; border-radius: 999px; overflow: hidden; }
#boss-hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #f472b6, #a21caf); transition: width .4s ease; }
#boss-hp span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10.5px; letter-spacing: .18em; color: #ffe6f8;
  text-shadow: 0 1px 3px #000, 0 0 8px #7a1f5c;
}
#boss-wrap.hit #boss-art { animation: bosshit .35s ease; }
@keyframes bosshit { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-7px) rotate(-4deg); } 65% { transform: translateX(6px) rotate(3deg); } }

/* 題卡 */
#q-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 15px; box-shadow: var(--shadow);
}
#q-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
#q-tags span {
  font-size: 10.5px; letter-spacing: .06em; color: var(--accent2);
  background: hsl(var(--hue) 80% 60% / .12); border: 1px solid hsl(var(--hue) 80% 60% / .3);
  border-radius: 999px; padding: 3px 9px;
}

#btn-context {
  background: none; border: none; padding: 0; margin-bottom: 6px;
  color: var(--accent2); font-size: 12px; text-decoration: underline dotted;
}
#q-context {
  display: none; margin-bottom: 10px; padding: 10px 11px;
  background: var(--panel2); border-left: 3px solid var(--accent);
  border-radius: 10px; font-size: 13px; line-height: 1.72;
  max-height: 220px; overflow: auto; color: var(--ink-dim);
  white-space: pre-wrap;
}
#q-context.open { display: block; }

#q-stem { font-size: 15.5px; line-height: 1.68; margin-bottom: 12px; font-weight: 600; }
#q-stem .blk { color: var(--accent2); border-bottom: 2px solid var(--accent2); padding: 0 3px; }
#q-sub { font-size: 12.5px; color: var(--ink-faint); margin: -6px 0 12px; }

#q-options { display: grid; gap: 8px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 13px; padding: 10px 12px; font-size: 13.5px; line-height: 1.55;
  transition: transform .12s ease, border-color .18s ease, background .18s ease;
}
.opt:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); }
.opt:disabled { cursor: default; }
.opt .k {
  flex: 0 0 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--panel); border: 1px solid var(--line);
  color: var(--ink-dim);
}
.opt.right { border-color: var(--good); background: hsl(160 70% 40% / .16); }
.opt.right .k { background: var(--good); color: #04140d; border-color: var(--good); }
.opt.wrong { border-color: var(--bad); background: hsl(0 70% 55% / .14); }
.opt.wrong .k { background: var(--bad); color: #2a0505; border-color: var(--bad); }
.opt.dim { opacity: .5; }

/* 寫作／翻譯任務 */
#q-task textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 13.5px; line-height: 1.7; resize: vertical;
}
#q-task textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#task-hint { font-size: 12.5px; color: var(--ink-dim); margin: 0 0 8px; }
#task-count { text-align: right; font-size: 11px; color: var(--ink-faint); margin: 4px 0 10px; }
#task-check { display: grid; gap: 7px; }
#task-check label {
  display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--ink-dim);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px;
  cursor: pointer;
}
#task-check input { margin-top: 3px; accent-color: var(--accent); }

/* 解析 */
#q-explain { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 11px; }
.ex-head { font-size: 11px; letter-spacing: .2em; color: var(--accent2); margin-bottom: 6px; }
#q-explain-body { font-size: 13px; line-height: 1.78; color: var(--ink-dim); }
#q-explain-body b { color: var(--ink); }
#q-explain-body .zh { display: block; margin-top: 6px; color: var(--ink-faint); }
#q-explain-body .mini, #q-task .mini {
  font-size: 10.5px; letter-spacing: .18em; color: var(--accent2);
  margin: 12px 0 5px;
}
#q-explain-body .model {
  white-space: pre-wrap; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 11px; font-size: 12.5px; line-height: 1.78;
  max-height: 260px; overflow: auto;
}
#q-explain-body .mini-list { margin: 0; padding-left: 18px; }
#q-explain-body .mini-list li { margin-bottom: 7px; font-size: 12.5px; line-height: 1.66; }
#q-explain-body .mini-list b { color: var(--ink); }
#q-explain-body .mini-list i { color: var(--ink-faint); font-style: normal; font-size: 12px; }

/* 底部 */
#play-foot {
  position: sticky; bottom: 0; margin-top: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--bg) 55%, transparent);
}
#parrot-mini { width: 56px; height: 56px; flex: 0 0 56px; }
.mini-bubble { flex: 1; font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
#btn-next { padding: 9px 16px; }
#btn-quit { padding: 9px 14px; font-size: 12px; }

/* ---------------- 結算 ---------------- */
#result-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; padding: 20px 16px; box-shadow: var(--shadow);
  text-align: center; margin-top: 14px;
}
#res-kicker { margin: 0; font-size: 11px; letter-spacing: .24em; color: var(--ink-faint); }
#res-title { margin: 6px 0 2px; font-size: 24px; }
#res-stars { font-size: 34px; letter-spacing: 8px; color: #3d4a66; margin: 6px 0; }
#res-stars .off { color: #3d4a66; opacity: .8; }
body.light #res-stars .off { color: #c3cee3; }
#res-stars .on { color: var(--gold); text-shadow: 0 0 18px hsl(43 96% 56% / .55); animation: starIn .45s ease both; }
#res-stars .on:nth-child(2) { animation-delay: .14s; }
#res-stars .on:nth-child(3) { animation-delay: .28s; }
@keyframes starIn { from { opacity: 0; transform: scale(.3) rotate(-30deg); } to { opacity: 1; transform: none; } }

#res-parrot { width: 120px; height: 120px; margin: 4px auto 8px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px; margin: 12px 0;
}
.stat-grid div {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 8px;
}
.stat-grid b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat-grid small { font-size: 10.5px; color: var(--ink-faint); }

#res-say { font-size: 13px; color: var(--ink-dim); line-height: 1.6; margin: 6px 0 14px; min-height: 40px; }
.res-actions { justify-content: center; }

/* ---------------- 巢穴 ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal::before { content: ""; position: absolute; inset: 0; background: #04060cf2; backdrop-filter: blur(4px); }
.modal-panel {
  position: relative; width: min(460px, 100%); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px 16px; box-shadow: var(--shadow);
  text-align: center;
}
.modal-panel h2 { margin: 0 0 6px; font-size: 17px; }
.modal-x {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 16px; color: var(--ink-faint);
}
#roost-parrot { width: 150px; height: 150px; margin: 0 auto; }
.bubble {
  font-size: 13px; color: var(--ink-dim); line-height: 1.6;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; margin: 8px 0 12px;
}
#roost-progress { font-size: 12px; color: var(--ink-dim); margin-bottom: 10px; }
#roost-progress .bar { height: 9px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
#roost-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #f97316); }
#roost-list { display: grid; gap: 7px; text-align: left; margin-bottom: 14px; }
#roost-list div {
  display: flex; gap: 8px; align-items: center; font-size: 12.5px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px;
  color: var(--ink-dim);
}
#roost-list div.locked { opacity: .45; }
#roost-list span.i { font-size: 15px; }

/* ---------------- 特效 / Toast ---------------- */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--accent);
  color: var(--ink); border-radius: 999px; padding: 9px 18px;
  font-size: 12.5px; z-index: 70; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: var(--shadow); white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* 浮動分數 */
.float-score {
  position: fixed; z-index: 55; pointer-events: none;
  font-weight: 800; font-size: 24px; color: var(--gold);
  text-shadow: 0 2px 12px #000a;
  animation: floatUp 1s ease forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(6px) scale(.7); }
  25% { opacity: 1; transform: translateY(-8px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-52px) scale(1); }
}

/* ---------------- 手機 ---------------- */

/* ---------- 時段配色（跟 html[data-phase]，今次手動按鈕仍可覆蓋明暗） ---------- */
html[data-phase="day"]   { --accent: #5b6cf0; --accent2: #0e9f8f; }
html[data-phase="dawn"]  { --accent: #d98cbb; --accent2: #ffcf9e; }
html[data-phase="dusk"]  { --accent: #e2804f; --accent2: #ffd166; }
html[data-phase="night"] { --accent: #7c8cff; --accent2: #64e0ff; }

@media (max-width: 620px) {
  #app { padding: 0 10px 30px; }
  /* hud 窄屏收窄 */
  #hud { gap: 6px; padding: 8px 2px; }
  #hud-title { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-btn { padding: 6px 8px; font-size: 12px; }
  #hud-feather { padding: 6px 8px; font-size: 11.5px; }
  #hero-name { font-size: 11px; }

  #hero { grid-template-columns: 96px 1fr; }
  #hero-parrot { width: 96px; height: 96px; }
  #hero-say { font-size: 13px; min-height: 40px; }
  .nodes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .node { min-width: 0; padding: 8px 6px; }
  .node .n-name { font-size: 12px; line-height: 1.3; }
  .node.boss .n-name { font-size: 11.5px; }
  .region-stars { font-size: 11px; }
  #q-stem { font-size: 14.5px; }
  .opt { font-size: 13px; }
  .hud-btn span { display: none; }
  #hud-sub { display: none; }
  .intro-top { grid-template-columns: 80px 1fr; }
  #intro-parrot { width: 80px; height: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
