/* =========================================================
   注音小恐龍 — 樣式
   溫暖、圓潤、像素風友善；全部用 CSS 畫背景，離線可用
   ========================================================= */

:root {
  --sky-top: #7cc8f0;
  --sky-bottom: #d4f1ff;
  --grass: #8fd16b;
  --grass-dark: #6bb64a;
  --hill: #a8de85;
  --ink: #4a3326;
  --ink-soft: #7a5b47;
  --card: #fffaf0;
  --card-edge: #f0cf9c;
  --card-shadow: #d69a5a;
  --accent: #ff9f43;
  --accent-dark: #e07b1a;
  --green: #4cc26a;
  --green-dark: #2f9a4c;
  --pink: #ff7aa2;
  --gold: #ffcf33;
  --gold-dark: #e8a700;
  --white: #ffffff;
  --gap: 12px;
  --font: "Arial Rounded MT Bold", "PingFang TC", "Hiragino Maru Gothic ProN",
          "Yuanti TC", "Noto Sans CJK TC", "Noto Sans TC", "Microsoft JhengHei",
          "Heiti TC", system-ui, sans-serif;
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--sky-bottom);
  color: var(--ink);
  font-family: var(--font);
  /* 防止雙擊縮放、選字、長按選單 */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }

/* ---------------- 背景 ---------------- */
.bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 62%);
}
.sun {
  position: absolute; top: 5%; right: 8%;
  width: 14vmin; height: 14vmin; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff6b0, #ffd94a 60%, #ffc21f);
  box-shadow: 0 0 0 2vmin rgba(255, 233, 120, .35), 0 0 0 4vmin rgba(255, 233, 120, .18);
}
.cloud {
  position: absolute; background: #fff; border-radius: 999px; opacity: .92;
  width: 22vmin; height: 7vmin;
  animation: drift 60s linear infinite;
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: #fff; border-radius: 50%;
}
.cloud::before { width: 9vmin; height: 9vmin; left: 3vmin; top: -4.5vmin; }
.cloud::after  { width: 11vmin; height: 11vmin; left: 9vmin; top: -6vmin; }
.cloud.c1 { top: 12%; left: 6%; }
.cloud.c2 { top: 26%; left: 58%; transform: scale(.7); animation-duration: 80s; animation-delay: -30s; }
.cloud.c3 { top: 6%; left: 34%; transform: scale(.55); animation-duration: 95s; animation-delay: -60s; }
@keyframes drift {
  0% { translate: -10vw 0; } 50% { translate: 10vw 0; } 100% { translate: -10vw 0; }
}
.hill { position: absolute; border-radius: 50%; background: var(--hill); }
.hill.h1 { width: 90vw; height: 40vh; left: -20vw; bottom: 14%; }
.hill.h2 { width: 80vw; height: 34vh; right: -25vw; bottom: 12%; background: #9bd879; }
.grass {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30%;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.08) 22px 44px),
    linear-gradient(180deg, var(--grass) 0%, var(--grass-dark) 100%);
  border-top: 6px solid #7cc55a;
}

/* ---------------- 畫面切換 ---------------- */
.screen {
  position: fixed; inset: 0; z-index: 1;
  height: 100vh; height: 100dvh;
  padding: calc(var(--sa-top) + 8px) calc(var(--sa-right) + 14px)
           calc(var(--sa-bottom) + 12px) calc(var(--sa-left) + 14px);
  display: none;
  flex-direction: column;
  align-items: stretch;
}
.screen.active { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- 恐龍（精靈圖或靜態圖） ---------------- */
.dino {
  width: 100%; height: 100%;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center bottom;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  transform-origin: 50% 95%;
}
.dino.sprite { background-size: auto 100%; }
/* 沒有動畫檔時的 CSS 動畫備案 */
.dino.css-anim.st-idle   { animation: bob 2.2s ease-in-out infinite; }
.dino.css-anim.st-hungry { animation: hungry 1.1s ease-in-out infinite; }
.dino.css-anim.st-eat    { animation: chomp .22s ease-in-out 4; }
.dino.css-anim.st-happy  { animation: jump .55s ease-in-out infinite; }
.dino.css-anim.st-super  { animation: superjump .7s ease-in-out infinite; }
.dino.css-anim.st-oops   { animation: shake .45s ease-in-out 2; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3%); } }
@keyframes hungry {
  0%,100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-2%) rotate(-2deg); }
  75% { transform: translateY(-2%) rotate(2deg); }
}
@keyframes chomp {
  0%,100% { transform: scale(1, 1); }
  50% { transform: scale(1.08, .9); }
}
@keyframes jump {
  0%,100% { transform: translateY(0) scale(1, 1); }
  15% { transform: translateY(0) scale(1.06, .94); }
  50% { transform: translateY(-12%) scale(.97, 1.04); }
}
@keyframes superjump {
  0%,100% { transform: translateY(0) rotate(0) scale(1); }
  30% { transform: translateY(-16%) rotate(-6deg) scale(1.05); }
  60% { transform: translateY(-8%) rotate(6deg) scale(1.05); }
}
@keyframes shake {
  0%,100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-5%) rotate(-5deg); }
  40% { transform: translateX(5%) rotate(5deg); }
  60% { transform: translateX(-4%) rotate(-3deg); }
  80% { transform: translateX(3%) rotate(2deg); }
}

/* ---------------- 大按鈕 ---------------- */
.btn-big {
  width: clamp(110px, 30vmin, 190px); height: clamp(110px, 30vmin, 190px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7fe08f, var(--green) 55%, var(--green-dark));
  box-shadow: 0 10px 0 #23773a, 0 16px 24px rgba(0,0,0,.18), inset 0 -6px 0 rgba(0,0,0,.08);
  border: 6px solid #fff;
  display: grid; place-items: center;
  transition: transform .08s;
}
.btn-big:active { transform: translateY(6px); box-shadow: 0 4px 0 #23773a, 0 6px 12px rgba(0,0,0,.18); }
.icon-play {
  width: 0; height: 0; margin-left: 12%;
  border-style: solid;
  border-width: clamp(26px, 7.5vmin, 46px) 0 clamp(26px, 7.5vmin, 46px) clamp(42px, 12vmin, 72px);
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.15));
}
.icon-again { color: #fff; font-size: clamp(64px, 18vmin, 110px); line-height: 1; font-weight: 900; text-shadow: 0 4px 0 rgba(0,0,0,.15); }
.btn-mid {
  width: clamp(64px, 16vmin, 96px); height: clamp(64px, 16vmin, 96px);
  border-radius: 50%; background: #fff; font-size: clamp(30px, 8vmin, 46px);
  box-shadow: 0 6px 0 #c9b9a6;
  display: grid; place-items: center;
}
.btn-mid:active { transform: translateY(4px); box-shadow: 0 2px 0 #c9b9a6; }

/* 長按按鈕（家長閘門） */
.hold-btn {
  position: relative; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.75);
  display: grid; place-items: center;
  font-size: 24px; line-height: 1;
  box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.hold-btn > span { position: relative; z-index: 1; }
.hold-ring {
  position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px);
  transform: rotate(-90deg); pointer-events: none;
}
.hold-ring circle {
  fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 119.4; stroke-dashoffset: 119.4;
}
.hold-btn.holding .hold-ring circle { transition: stroke-dashoffset var(--hold-ms, 2000ms) linear; stroke-dashoffset: 0; }
.gear-icon { color: var(--ink-soft); font-size: 26px; }

/* ---------------- 開始畫面 ---------------- */
#screen-start { align-items: center; justify-content: space-evenly; }
.start-title {
  margin: 0; display: flex; gap: .06em;
  font-size: clamp(34px, 9vmin, 72px); font-weight: 900; letter-spacing: .02em;
}
.start-title span {
  display: inline-block; color: #fff;
  -webkit-text-stroke: .08em var(--accent-dark); paint-order: stroke fill;
  text-shadow: 0 .08em 0 var(--accent-dark), 0 .14em 0 rgba(0,0,0,.12);
  animation: titleBob 2.4s ease-in-out infinite;
}
.start-title span:nth-child(2) { animation-delay: .15s; color: #fff3b0; }
.start-title span:nth-child(3) { animation-delay: .3s; }
.start-title span:nth-child(4) { animation-delay: .45s; color: #d4ffcf; }
.start-title span:nth-child(5) { animation-delay: .6s; }
@keyframes titleBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8%); } }
.start-dino-wrap, .end-dino-wrap {
  width: min(64vw, 40dvh, 420px); aspect-ratio: 1;
}
.gear-btn {
  position: absolute;
  right: calc(var(--sa-right) + 14px);
  top: calc(var(--sa-top) + 12px);
}
.gear-label {
  position: absolute;
  right: calc(var(--sa-right) + 4px);
  top: calc(var(--sa-top) + 64px);
  white-space: nowrap; text-align: center;
  font-size: 11px; line-height: 1; color: #2f4a5c;
  background: rgba(255,255,255,.75); border-radius: 999px; padding: 4px 8px;
  pointer-events: none;
}
.gear-label small { font-size: 10px; }
.gear-toast {
  position: absolute;
  right: calc(var(--sa-right) + 12px);
  top: calc(var(--sa-top) + 100px);
  background: #fff; color: #333; border-radius: 12px; padding: 8px 12px;
  font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 5;
}
.gear-toast[hidden] { display: none; }
.set-jump { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.set-jump a { text-decoration: none; }

/* ---------------- 遊戲畫面 ---------------- */
.topbar {
  flex: none; display: flex; align-items: center; gap: 8px;
  height: 56px;
}
.home-btn { width: 44px; height: 44px; font-size: 20px; flex: none; }
.eggs {
  flex: 1; display: flex; justify-content: center; align-items: center;
  gap: clamp(3px, 1.2vw, 10px);
}
.egg {
  --s: clamp(14px, 4.3vw, 34px);
  width: var(--s); height: calc(var(--s) * 1.25);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: rgba(255,255,255,.55);
  border: 3px solid rgba(255,255,255,.95);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.06);
  position: relative;
  transition: background .3s, transform .3s;
}
.egg.now { background: #fff; animation: eggPulse 1s ease-in-out infinite; border-color: var(--accent); }
.egg.ok  {
  background: radial-gradient(circle at 35% 30%, #fff7c2, var(--gold) 55%, var(--gold-dark));
  border-color: #fff; animation: eggPop .4s ease;
}
.egg.ok::after {
  content: ""; position: absolute; inset: 22% 18%;
  background: #fff;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.egg.meh { background: radial-gradient(circle at 35% 30%, #ffffff, #dfe9f2 70%); border-color: #fff; animation: eggPop .4s ease; }
@keyframes eggPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes eggPop { 0% { transform: scale(.6); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

.combo {
  flex: none; width: 64px; height: 42px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: rgba(255,255,255,.8); border-radius: 22px;
  font-weight: 900; font-size: 20px; color: #e8590c;
  box-shadow: 0 3px 0 rgba(0,0,0,.1);
  opacity: 0; transform: scale(.6);
  transition: opacity .25s, transform .25s;
}
.combo.show { opacity: 1; transform: scale(1); }
.combo.bump { animation: comboBump .45s ease; }
.combo .flame { font-size: 20px; }
@keyframes comboBump { 0% { transform: scale(1); } 40% { transform: scale(1.45) rotate(-6deg); } 100% { transform: scale(1); } }

.stage {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.dino-area {
  flex: 1 1 auto; min-height: 120px; position: relative;
  container-type: size;
  display: flex; align-items: center; justify-content: center;
  gap: 2cqw;
}
.dino-box {
  --d: min(92cqh, 56cqw);
  width: var(--d); height: var(--d); flex: none;
  cursor: pointer;
}
.bubble {
  --b: min(48cqh, 34cqw);
  flex: none; position: relative;
  width: var(--b); height: var(--b);
  align-self: flex-start; margin-top: 2cqh;
  background: #fff; border-radius: 34%;
  border: 5px solid var(--ink);
  box-shadow: 0 7px 0 rgba(74, 51, 38, .25);
  display: grid; place-items: center;
  animation: bubbleIn .4s cubic-bezier(.3,1.6,.6,1);
}
.bubble::before { /* 對話框尾巴，指向恐龍 */
  content: ""; position: absolute; left: -22px; bottom: 18%;
  width: 0; height: 0;
  border-top: 14px solid transparent; border-bottom: 14px solid transparent;
  border-right: 24px solid var(--ink);
}
.bubble::after {
  content: ""; position: absolute; left: -13px; bottom: calc(18% + 6px);
  width: 0; height: 0;
  border-top: 8px solid transparent; border-bottom: 8px solid transparent;
  border-right: 16px solid #fff;
}
.bubble-sym {
  font-size: calc(var(--b) * .62); line-height: 1; font-weight: 900; color: var(--ink);
  margin-top: -4%;
}
.bubble-speaker {
  position: absolute; right: 6%; bottom: 4%;
  font-size: calc(var(--b) * .16);
  opacity: .8;
}
.bubble.playing .bubble-speaker { animation: speak .5s ease-in-out infinite; }
.bubble.pulse { animation: bubblePulse .5s ease; }
/* 恐龍區域比較「高」的時候（手機直式）：對話框放在恐龍上面，兩個都變大 */
@container (max-aspect-ratio: 1/1) {
  .dino-box { --d: min(60cqh, 84cqw); }
  .bubble {
    --b: min(36cqh, 46cqw);
    position: absolute; top: 1cqh; right: 3cqw; margin: 0;
  }
  .dino-box { margin-top: auto; }
  .bubble::before {
    left: 16%; bottom: -24px;
    border-left: 14px solid transparent; border-right: 14px solid transparent;
    border-top: 24px solid var(--ink); border-bottom: 0;
  }
  .bubble::after {
    left: calc(16% + 6px); bottom: -13px;
    border-left: 8px solid transparent; border-right: 8px solid transparent;
    border-top: 16px solid #fff; border-bottom: 0;
  }
}
@keyframes speak { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }
@keyframes bubbleIn { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bubblePulse { 50% { transform: scale(1.1); } }
.bubble.hide { visibility: hidden; }

/* ---------------- 食物卡片 ---------------- */
.cards {
  flex: none;
  --per-row: 3;
  --card-hmax: 30dvh;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--gap);
  padding-bottom: 4px;
}
.cards.n5 { --card-hmax: 22dvh; }
.card {
  --w: min(calc((100% - (var(--per-row) - 1) * var(--gap)) / var(--per-row)), calc(var(--card-hmax) * .8), 230px);
  width: var(--w);
  aspect-ratio: 4 / 5;
  container-type: inline-size;
  position: relative;
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--card-shadow), 0 10px 14px rgba(0,0,0,.12);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 8px 6px;
  transition: transform .1s, opacity .3s, filter .3s;
  animation: cardIn .45s cubic-bezier(.3,1.5,.6,1) both;
}
.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .18s; }
.card:nth-child(5) { animation-delay: .24s; }
@keyframes cardIn { from { transform: translateY(40px) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.card:active:not(.wrong) { transform: translateY(5px); box-shadow: 0 2px 0 var(--card-shadow), 0 4px 8px rgba(0,0,0,.12); }
.card .pic {
  flex: 1 1 0; min-height: 0; width: 100%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 55%, #fff 0 55%, transparent 56%);
}
.card .pic img {
  width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}
.card .pic .fallback {
  font-size: 22cqw; font-weight: 900; color: var(--accent-dark); text-align: center; line-height: 1.1;
  word-break: keep-all;
}
.card .sym {
  flex: none; font-size: 34cqw; line-height: 1; font-weight: 900; color: var(--ink);
  margin-top: 1cqw;
}
.card .word {
  flex: none; font-size: 13cqw; line-height: 1.2; color: var(--ink-soft); font-weight: 700;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
/* 不顯示注音模式：圖更大、詞稍大 */
.cards.nosym .card .sym { display: none; }
.cards.nosym .card .word { font-size: 15cqw; margin-top: 2cqw; }
.card.noimg .pic { background: none; }
.card.noimg .word { display: none; }

.card.wrong {
  opacity: .45; filter: grayscale(.8);
  animation: wiggle .5s ease;
  pointer-events: none;
}
@keyframes wiggle {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); }
  60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); }
}
.card.hint { animation: glow 1.1s ease-in-out infinite; border-color: var(--gold); }
@keyframes glow {
  0%,100% { box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 0 rgba(255, 207, 51, .0); }
  50% { box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 10px rgba(255, 207, 51, .75), 0 0 30px 12px rgba(255, 230, 120, .8); }
}
.card.gone { visibility: hidden; }
.cards.locked .card { pointer-events: none; }
.card.fly {
  position: fixed; margin: 0; z-index: 50; pointer-events: none; animation: none;
}

/* ---------------- 特效 ---------------- */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.fx .p { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.fx .heart { font-size: 34px; }
.fx .star {
  width: 26px; height: 26px; background: var(--gold);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.fx .conf { width: 12px; height: 12px; }

/* ---------------- 結束畫面 ---------------- */
#screen-end { align-items: center; justify-content: space-evenly; }
.end-stars { display: flex; align-items: flex-end; gap: clamp(8px, 3vmin, 24px); }
.star-slot {
  --s: clamp(70px, 18vmin, 130px);
  width: var(--s); height: var(--s); position: relative;
  background: rgba(255,255,255,.55);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.star-slot.big { --s: clamp(90px, 23vmin, 170px); margin-bottom: 4%; }
.star-shape {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 40% 35%, #fff8c4, var(--gold) 50%, var(--gold-dark));
  clip-path: inherit;
  transform: scale(0);
}
.star-slot.on .star-shape { animation: starPop .55s cubic-bezier(.3,1.8,.5,1) forwards; }
@keyframes starPop { 0% { transform: scale(0) rotate(-90deg); } 100% { transform: scale(1) rotate(0); } }
.end-buttons { display: flex; align-items: center; gap: 28px; }

/* ---------------- 家長設定 ---------------- */
.settings {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 30, 20, .5);
  display: flex; justify-content: center; align-items: stretch;
  padding: calc(var(--sa-top) + 12px) calc(var(--sa-right) + 12px) calc(var(--sa-bottom) + 12px) calc(var(--sa-left) + 12px);
}
.settings[hidden] { display: none; }
.settings-panel {
  width: 100%; max-width: 680px;
  background: #fffdf7; border-radius: 22px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 18px 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  font-size: 16px;
}
.settings-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  background: #fffdf7; padding: 14px 0 10px; border-bottom: 2px solid #f1e4d0;
}
.settings h1 { margin: 0; font-size: 22px; }
.settings h2 { margin: 0 0 8px; font-size: 17px; }
.settings h2 small { font-weight: 400; color: var(--ink-soft); }
.btn-close { width: 44px; height: 44px; border-radius: 50%; background: #f3e7d6; font-size: 20px; }
.set-block { padding: 14px 0 6px; }
.set-block.row, .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-block.row h2 { margin: 0; }
.note { margin: 4px 0 6px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.5; }
.note.warn { color: #c0392b; }
.note.version { text-align: center; margin-top: 20px; opacity: .6; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 14px; border-radius: 22px;
  background: #f3ece2; border: 2px solid #e2d3bf; font-size: 20px; font-weight: 700;
}
.chip.on { background: #ffe6c7; border-color: var(--accent); color: #a24b00; }
.seg { display: inline-flex; border-radius: 22px; overflow: hidden; border: 2px solid #e2d3bf; }
.seg button { min-width: 84px; min-height: 44px; font-size: 17px; background: #f3ece2; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 700; }
.switch { position: relative; width: 62px; height: 36px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 18px; background: #d9cfc2; transition: background .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 2px 3px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(26px); }
input[type=range] { flex: 1; accent-color: var(--accent); height: 36px; }
.btn-small {
  min-height: 40px; padding: 6px 14px; border-radius: 20px;
  background: #f3e7d6; font-size: 15px; font-weight: 700; flex: none;
}
.btn-small.danger { background: #fde2df; color: #b03a2e; margin-top: 8px; }

.rec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px; }
.rec-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 14px; background: #f8f1e7;
}
.rec-row .rs { font-size: 26px; font-weight: 900; width: 36px; text-align: center; }
.rec-row .rw { flex: 1; font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-row .dot { width: 12px; height: 12px; border-radius: 50%; background: #d9cfc2; flex: none; }
.rec-row.has .dot { background: var(--green); }
.rec-row button { width: 42px; height: 40px; border-radius: 12px; background: #fff; font-size: 17px; flex: none; }
.rec-row button:disabled { opacity: .3; }
.rec-row .b-rec { color: #e03131; }
.rec-row.recording { background: #ffe3e3; }
.rec-row.recording .b-rec { background: #e03131; color: #fff; animation: speak .8s infinite; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.stat {
  border-radius: 12px; padding: 6px 4px; text-align: center; background: #f3f8ee; font-size: 13px;
}
.stat b { display: block; font-size: 24px; }
.stat.weak { background: #fde8e4; }
.stat.none { opacity: .5; background: #f3ece2; }

/* ---------------- 版面變化 ---------------- */
/* 寬螢幕（平板以上）：5 張卡片排成一排 */
@media (min-width: 600px) {
  :root { --gap: 16px; }
  .cards.n5 { --per-row: 5; --card-hmax: 30dvh; }
  .topbar { height: 64px; }
  .home-btn { width: 50px; height: 50px; }
  .combo { width: 92px; height: 50px; font-size: 26px; border-radius: 25px; }
  .combo .flame { font-size: 26px; }
}
/* 橫向：卡片高度用比較少的畫面 */
@media (orientation: landscape) {
  .cards { --card-hmax: 36dvh; }
  .cards.n5 { --per-row: 5; --card-hmax: 36dvh; }
  .start-dino-wrap, .end-dino-wrap { width: min(44dvh, 420px); }
}
/* 很矮的橫向手機 */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { height: 44px; }
  .cards, .cards.n5 { --card-hmax: 40dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .start-title span { animation: none; }
}
