:root {
  --bg-cream: #FBF8F1;
  --bg-paper: #FFFDF9;
  --water-blue: #DDF0F9;
  --water-deep: #5BA8D6;
  --feed-ring-blue: #3A8FD6;
  --leaf-green: #88B87A;
  --leaf-dark: #4E7A44;
  --throat-gold: #F5C249;
  --throat-amber: #D99B26;
  --text-ink: #4A3F35;
  --text-soft: #6E6052;
  --card-border: #E8DEC8;
  --shadow-soft: 0 10px 25px -5px rgba(74, 63, 53, 0.10), 0 4px 10px -2px rgba(74, 63, 53, 0.05);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --tap: 44px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Zen Maru Gothic', 'Fredoka', -apple-system, BlinkMacSystemFont, 'PingFang HK', 'PingFang TC', sans-serif;
  background-color: var(--bg-cream);
  background-image:
    radial-gradient(circle at 12% 15%, rgba(221, 240, 249, 0.7) 0%, transparent 42%),
    radial-gradient(circle at 88% 20%, rgba(245, 194, 73, 0.16) 0%, transparent 38%),
    radial-gradient(circle at 80% 85%, rgba(136, 184, 122, 0.18) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-ink);
  min-height: 100dvh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, select, input { font-family: inherit; touch-action: manipulation; }
button, a, summary, .hotspot, .growth-target { touch-action: manipulation; }
button:focus-visible, select:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid var(--water-deep); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(251, 248, 241, 0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 2px dashed var(--card-border);
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
}
.header-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-badge { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mini-avatar { width: 48px; height: 48px; border-radius: 50%; border: 2.5px solid var(--throat-gold); overflow: hidden; flex-shrink: 0; box-shadow: 0 3px 8px rgba(217,155,38,.2); }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.brand-title { margin: 0; font-size: 1.3rem; font-weight: 900; color: var(--throat-amber); }
.brand-subtitle { font-size: .82rem; color: var(--text-soft); font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-pill, .lang-select {
  min-height: var(--tap); min-width: var(--tap); justify-content: center;
  border: 2px solid var(--card-border); background: var(--bg-paper); color: var(--text-ink);
  font-weight: 700; font-size: .92rem; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 3px 0 var(--card-border);
}
.lang-select { appearance: none; -webkit-appearance: none; padding-right: 14px; }
.btn-pill:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--card-border); }
.btn-pill.tts-active { background: #FFF3D1; border-color: var(--throat-gold); color: #8C5A00; }
.feed-header-btn { background: #F4F9F1; border-color: var(--leaf-green); color: var(--leaf-dark); }
.feed-popover {
  max-width: 1080px; margin: 10px auto 0; background: var(--bg-paper);
  border: 2.5px solid var(--card-border); border-radius: var(--radius-lg);
  padding: 12px 16px; box-shadow: var(--shadow-soft); animation: fadeSlideUp .25s ease-out;
}
.feed-pop-title { margin: 0 0 8px; font-weight: 900; font-size: 1rem; }
.feed-popover .log-row { display: flex; flex-wrap: wrap; gap: 8px; }
.feed-popover .stamp-btn { min-width: 0; min-height: 44px; padding: 6px 12px; font-size: 1rem; }
.feed-popover .log-date { margin: 8px 0 0; font-size: 1rem; }

/* ---------- Stage ---------- */
.main-stage { max-width: 1080px; margin: 0 auto; padding: 16px 18px calc(120px + env(safe-area-inset-bottom)); min-height: calc(100dvh - 160px); }
.chapter-view { display: none; animation: fadeSlideUp .32s cubic-bezier(.22,1,.36,1); }
.chapter-view.active { display: block; }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.chapter-title { font-size: 1.45rem; font-weight: 900; margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; }
.chapter-title .num { background: var(--throat-gold); color: #fff; border-radius: 12px; padding: 2px 10px; font-size: 1rem; }

/* ---------- Hero ---------- */
.hero-card {
  background: linear-gradient(135deg, #FFFDF9 0%, #EFF8FC 65%, #F4F9F1 100%);
  border: 3px solid var(--card-border); border-radius: var(--radius-xl);
  padding: 18px; box-shadow: var(--shadow-soft);
  display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 16px;
  margin-bottom: 18px; position: relative; overflow: hidden;
}
.hero-card::before { content: ""; position: absolute; inset: 8px; border: 1.5px dashed rgba(217,155,38,.35); border-radius: 22px; pointer-events: none; }
.hero-tag { display: inline-block; background: #FFF3D1; color: #8C5A00; border: 1.5px solid var(--throat-gold); padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; margin-bottom: 8px; }
.hero-heading { font-size: 1.9rem; font-weight: 900; margin: 0 0 10px; line-height: 1.3; }
.hero-heading span { color: var(--throat-amber); }
.speech {
  background: #fff; border: 2px solid var(--water-blue); border-radius: 18px;
  padding: 10px 14px; font-size: 1rem; line-height: 1.6; box-shadow: 0 4px 12px rgba(91,168,214,.12);
}
.hero-art { position: relative; aspect-ratio: 1; max-width: 300px; justify-self: center; width: 100%; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow-soft); animation: bob 3.6s ease-in-out infinite; }
.bubble { position: absolute; border: 2px solid rgba(91,168,214,.7); border-radius: 50%; background: rgba(255,255,255,.35); animation: rise 6s linear infinite; pointer-events: none; }
.bubble.b1 { width: 18px; height: 18px; left: 6%; bottom: 10%; animation-delay: 0s; }
.bubble.b2 { width: 12px; height: 12px; left: 86%; bottom: 20%; animation-delay: 1.8s; }
.bubble.b3 { width: 24px; height: 24px; left: 78%; bottom: 0; animation-delay: 3.4s; }
.bubble.b4 { width: 10px; height: 10px; left: 16%; bottom: 30%; animation-delay: 4.6s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1deg); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-260px); opacity: 0; } }

/* ---------- Cards & grids ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.story-card { background: var(--bg-paper); border: 2.5px solid var(--card-border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-soft); }
.story-card h3 { margin: 0 0 10px; font-size: 1.18rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.story-card p, .story-card li { font-size: 1rem; line-height: 1.65; color: var(--text-soft); margin: 0 0 8px; }
.story-card ul { padding-left: 20px; margin: 0; }
.mt { margin-top: 18px; }
.art-frame { border-radius: var(--radius-xl); overflow: hidden; border: 3px solid #fff; box-shadow: var(--shadow-soft); background: #fff; position: relative; }
.art-frame img { width: 100%; height: auto; }
.art-caption { font-size: 1rem; color: var(--text-soft); font-weight: 700; text-align: center; margin: 8px 0 0; }
.pose { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 24px; border: 3px solid #fff; box-shadow: var(--shadow-soft); background: var(--bg-cream); }

/* ---------- More knowledge accordion ---------- */
.more-knowledge { margin-top: 16px; background: var(--bg-paper); border: 2.5px solid var(--card-border); border-radius: var(--radius-lg); padding: 14px 18px; box-shadow: var(--shadow-soft); }
.more-title { margin: 0 0 10px; font-size: 1.1rem; font-weight: 900; }
.acc-item { border-top: 1.5px dashed var(--card-border); padding: 4px 0; }
.acc-item:first-of-type { border-top: none; }
.acc-item summary {
  min-height: 44px; display: flex; align-items: center; padding: 10px 4px;
  font-weight: 900; font-size: 1rem; color: var(--text-ink); cursor: pointer; list-style: none;
}
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary::after { content: "▾"; margin-left: auto; color: var(--throat-amber); font-size: 1.2rem; }
.acc-item[open] summary::after { content: "▴"; }
.acc-body { padding: 4px 4px 14px; }
.acc-body p, .acc-body li { font-size: 1rem; line-height: 1.65; color: var(--text-soft); margin: 0 0 8px; }
.acc-body ul { padding-left: 20px; margin: 0; }

/* Name chips (tap to hear) */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.name-chip {
  min-height: var(--tap); background: #F4F9F1; border: 1.5px solid var(--leaf-green); color: var(--leaf-dark);
  padding: 6px 14px; border-radius: 999px; font-size: 1rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; touch-action: manipulation;
}
.name-chip.gold { background: #FFF7E0; border-color: var(--throat-gold); color: #8C5A00; }
.name-chip.blue { background: #EBF6FC; border-color: var(--water-deep); color: #2A6F9B; }
.name-chip:active { transform: scale(.96); }

/* ---------- Feeding theatre ---------- */
.diet-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
.feed-scene { position: relative; }
.feed-scene img { max-height: 45dvh; object-fit: cover; width: 100%; }
.food-drop { position: absolute; width: 9%; left: 58%; top: -2%; opacity: 0; pointer-events: none; transform: translateX(-50%); z-index: 4; }
.food-drop.dropping { animation: drop .7s cubic-bezier(.34,1.4,.64,1) forwards; }
@keyframes drop { 0% { top: -4%; opacity: 0; } 25% { opacity: 1; } 100% { top: 40%; opacity: 1; } }
.ripple { position: absolute; left: 58%; top: 48%; width: 14%; aspect-ratio: 1; transform: translate(-50%,-50%) scale(.3); border: 3px solid rgba(255,255,255,.9); border-radius: 50%; opacity: 0; pointer-events: none; z-index: 3; }
.ripple.on { animation: ripple .9s ease-out; }
@keyframes ripple { 0% { opacity: .9; transform: translate(-50%,-50%) scale(.3); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.6); } }
.feed-bubble {
  position: absolute; left: 10px; top: 10px; max-width: 62%; z-index: 5;
  background: rgba(255,255,255,.96); border: 2.5px solid var(--water-deep);
  border-radius: 16px; padding: 10px 14px; margin: 0; min-height: 0;
  font-weight: 800; color: #2B668E; font-size: 1rem; line-height: 1.5; box-shadow: var(--shadow-soft);
}
.feed-bubble::after {
  content: ""; position: absolute; right: -11px; top: 60%;
  border-left: 9px solid var(--water-deep); border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.reaction-inset {
  position: absolute; right: 10px; bottom: 10px; width: 26%; max-width: 180px; z-index: 5;
  border-radius: 50%; overflow: visible;
}
.reaction-pose {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  border: 3px solid #fff; box-shadow: var(--shadow-soft); background: var(--bg-cream);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.reaction-pose.hop { transform: translateY(-8px) scale(1.05); }
.reaction-food { position: absolute; right: -4px; bottom: -4px; width: 34px; height: 34px; display: none; background: #fff; border-radius: 50%; border: 2px solid var(--card-border); padding: 4px; box-shadow: var(--shadow-soft); }
.reaction-food svg { width: 100%; height: 100%; }
.reaction-food.show { display: block; }
.feed-feedback { margin-top: 10px; font-weight: 800; color: #2B668E; min-height: 3.2em; font-size: 1rem; line-height: 1.5; }
.tummy { display: flex; justify-content: center; gap: 6px; }
.tummy span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--throat-gold); background: #fff; }
.tummy span.full { background: var(--throat-gold); }
.feed-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.btn-food {
  min-height: 64px; background: #fff; border: 2.5px solid var(--throat-gold); border-radius: 18px; padding: 8px 4px;
  font-size: 1rem; font-weight: 800; color: var(--text-ink); cursor: pointer; box-shadow: 0 4px 0 #E0B23B;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; touch-action: manipulation;
}
.btn-food svg { width: 32px; height: 32px; }
.btn-food:active { transform: translateY(3px); box-shadow: 0 1px 0 #E0B23B; }
.btn-food:disabled { opacity: .45; }
.feed-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.btn-reset { margin-top: 0; }

/* Real-life feeding log */
.log-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stamp-btn {
  min-height: 44px; min-width: 44px; border-radius: 18px; border: 2.5px dashed var(--leaf-green); background: #F4F9F1;
  font-weight: 800; font-size: 1rem; color: var(--leaf-dark); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; touch-action: manipulation;
}
.stamp-btn.done { border-style: solid; background: #DCF2D8; }
.stamp-btn .paw { font-size: 1.4rem; opacity: .25; transition: transform .3s; }
.stamp-btn.done .paw { opacity: 1; transform: rotate(-12deg) scale(1.15); }

.diet-badge { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: .82rem; font-weight: 900; margin-bottom: 8px; }
.diet-green { background: #DCF2D8; color: #2E6B27; }
.diet-yellow { background: #FFF2CC; color: #7A5200; }
.diet-red { background: #FFE0DC; color: #A62B1F; }
.diet-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.diet-seg button {
  min-height: 44px; border-radius: 16px; border: 2.5px solid var(--card-border); background: var(--bg-paper);
  font-weight: 800; font-size: 1.3rem; color: var(--text-soft); cursor: pointer; touch-action: manipulation;
}
.diet-seg button[aria-selected="true"] { background: #FFF4D6; border-color: var(--throat-gold); color: #8A5800; }
.diet-panel-body h3 { font-size: 1.1rem; }

/* ---------- Segmented control (Habits) ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.seg button {
  min-height: 52px; border-radius: 16px; border: 2.5px solid var(--card-border); background: var(--bg-paper);
  font-weight: 800; font-size: 1rem; color: var(--text-soft); cursor: pointer; touch-action: manipulation;
}
.seg button[aria-pressed="true"] { background: #FFF4D6; border-color: var(--throat-gold); color: #8A5800; }
.seg-overlay {
  position: absolute; left: 10px; right: 10px; bottom: 10px; margin: 0; z-index: 3;
  background: rgba(255,253,249,.92); border-radius: 16px; padding: 6px;
}
.seg-overlay button { min-height: 44px; font-size: .95rem; }
.habit-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
.habit-scene { aspect-ratio: 4 / 5; cursor: pointer; max-height: 45dvh; }
.habit-scene img { height: 100%; object-fit: cover; transition: opacity .3s; }
.habit-scene:active img { opacity: .92; }

/* ---------- Growth spotlight ---------- */
.growth-layout { display: block; }
.growth-scene { --x: 14%; --y: 57%; --r: 15%; }
.growth-scene img { max-height: 45dvh; object-fit: cover; }
.growth-scene::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(circle at var(--x) var(--y), transparent 0, transparent var(--r), rgba(251,248,241,.72) calc(var(--r) + 6%));
  transition: background .4s;
}
.growth-target {
  position: absolute; transform: translate(-50%,-50%); width: 64px; height: 64px; min-width: 64px; min-height: 64px;
  border-radius: 50%; border: 2px solid transparent; background: rgba(255,255,255,0.01); cursor: pointer; z-index: 4; touch-action: manipulation; padding: 0;
}
.growth-display { pointer-events: none; }
.growth-target:focus-visible { outline: 3px solid var(--water-deep); outline-offset: 2px; }
.growth-side { margin-top: 14px; }
.growth-display { margin-top: 10px; }
.slider-wrap { margin: 14px 0 6px; }
input[type="range"].storybook-slider { width: 100%; accent-color: var(--leaf-dark); height: 44px; cursor: pointer; touch-action: manipulation; }
.slider-labels { display: grid; grid-template-columns: repeat(3, 1fr); font-weight: 800; font-size: 1rem; color: var(--leaf-dark); }
.slider-labels span:nth-child(2) { text-align: center; }
.slider-labels span:nth-child(3) { text-align: right; }

/* ---------- Care hotspots ---------- */
.care-scene img { max-height: 45dvh; object-fit: cover; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%); width: 46px; height: 46px; min-width: 46px; min-height: 46px; border-radius: 50%;
  border: 3px solid #fff; background: var(--throat-gold); color: #fff; font-weight: 900; font-size: 1.1rem;
  cursor: pointer; box-shadow: 0 4px 12px rgba(74,63,53,.3); z-index: 2; touch-action: manipulation; padding: 0;
}
.hotspot::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--throat-gold); animation: pulse 2s ease-out infinite; pointer-events: none; }
.hotspot[aria-pressed="true"] { background: var(--water-deep); }
@keyframes pulse { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.spot-popover {
  position: absolute; width: min(300px, 78%); z-index: 6;
  background: var(--bg-paper); border: 3px solid var(--throat-gold); border-radius: 18px;
  padding: 12px 14px; box-shadow: 0 10px 25px rgba(74,63,53,.25); animation: fadeSlideUp .22s ease-out;
}
.spot-popover h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 900; }
.spot-popover p { margin: 0 0 10px; font-size: 1rem; line-height: 1.6; color: var(--text-soft); }
.pop-nav { display: flex; gap: 8px; justify-content: space-between; }
.pop-nav .btn-pill { min-height: 44px; font-size: 1rem; padding: 6px 12px; }
.habitat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.habitat-item { background: #fff; border: 2px solid var(--water-blue); border-radius: 16px; padding: 14px; }
.habitat-item strong { display: block; color: #296C96; font-size: 1.05rem; margin-bottom: 6px; }
.habitat-item p { margin: 0; font-size: 1rem; line-height: 1.65; color: var(--text-soft); }
.care-layout { display: block; }
.care-more { margin-top: 16px; }

/* ---------- Quiz ---------- */
.quiz-layout { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.quiz-intro { font-size: 1rem; color: var(--text-soft); margin: 0 0 8px; }
.quiz-progress { font-size: 1.3rem; letter-spacing: 6px; color: var(--throat-amber); margin-bottom: 10px; text-align: center; }
.quiz-progress span { color: var(--card-border); }
.quiz-progress span[data-dot="1"] { color: var(--throat-amber); }
.quiz-progress span.done { color: var(--leaf-dark); }
.quiz-q { font-weight: 900; color: var(--text-ink); margin: 0 0 8px; font-size: 1.05rem; }
.quiz-option {
  display: block; width: 100%; min-height: var(--tap); text-align: left; background: #FFFDF9; border: 2px solid var(--card-border);
  border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; font-size: 1rem; font-weight: 700; color: var(--text-ink); cursor: pointer; touch-action: manipulation;
}
.quiz-option.correct { background: #DCF2D8; border-color: #4E9A44; color: #21571B; }
.quiz-option.wrong { background: #FFE5E2; border-color: #D9534F; color: #8F2420; animation: shake .35s ease-in-out; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.quiz-next { margin-top: 6px; }
.certificate-box {
  display: none; margin-top: 12px; background: linear-gradient(135deg, #FFFDF5 0%, #FFF4D4 100%);
  border: 4px double var(--throat-amber); border-radius: 22px; padding: 18px; box-shadow: var(--shadow-soft);
  grid-template-columns: 200px 1fr; gap: 18px; align-items: center;
}
.certificate-box.show { display: grid; animation: pop .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.certificate-box h3 { color: #8C5A00; font-size: 1.4rem; margin: 0 0 8px; }
.quiz-card.cert-shown .quiz-intro, .quiz-card.cert-shown .quiz-progress, .quiz-card.cert-shown .quiz-blocks, .quiz-card.cert-shown .quiz-next { display: none; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: rgba(255,253,249,.96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 2.5px solid var(--card-border);
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
}
.nav-track { max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.nav-tab {
  min-height: 58px; min-width: 44px; background: transparent; border: 2px solid transparent; border-radius: 16px; padding: 4px;
  color: var(--text-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; touch-action: manipulation;
}
.nav-tab img { width: 30px; height: 30px; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 2px solid transparent; }
.nav-tab .tab-label { font-size: .8rem; font-weight: 800; white-space: nowrap; }
.nav-tab[aria-selected="true"] { background: #FFF4D6; border-color: var(--throat-gold); color: #8A5800; }
.nav-tab[aria-selected="true"] img { border-color: var(--throat-gold); }

.toast {
  position: fixed; left: 50%; bottom: calc(112px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text-ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 1rem;
  opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 60; max-width: 90vw; text-align: center;
}
.toast.show { opacity: .95; }
.footnote { text-align: center; font-size: 1rem; color: var(--text-soft); margin-top: 22px; }

/* ---------- WIDE: two-column picture left / panel right ---------- */
@media (min-aspect-ratio: 4/3), (min-width: 1000px) {
  .profile-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: start; }
  .profile-layout .hero-card { margin-bottom: 0; }
  .feed-scene img, .habit-scene img, .growth-scene img, .care-scene img { max-height: 52dvh; }
  .diet-layout { grid-template-columns: 1.25fr .75fr; align-items: start; }
  .habit-layout { grid-template-columns: .85fr 1.15fr; align-items: start; }
  .habit-scene { aspect-ratio: 4 / 5; max-height: 52dvh; }
  .growth-layout { display: grid; grid-template-columns: 1.3fr .9fr; gap: 18px; align-items: start; }
  .growth-side { margin-top: 0; }
  .care-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: start; }
  .care-more { margin-top: 0; }
  .quiz-layout { grid-template-columns: .55fr 1.45fr; }
}

/* ---------- Responsive / compact header ---------- */
@media (max-width: 820px) {
  .hero-card { grid-template-columns: 1fr; text-align: left; padding: 16px; }
  .hero-art { max-width: 220px; }
  .grid-3, .habitat-grid { grid-template-columns: 1fr; }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-layout > img { max-width: 200px; justify-self: center; }
  .certificate-box.show { grid-template-columns: 120px 1fr; text-align: left; padding: 12px; }
  .certificate-box img { max-width: 120px; margin: 0; }
  .brand-subtitle, #tts-text { display: none; }
  .header-inner { gap: 6px; }
  .header-actions { gap: 6px; }
  .mini-avatar { width: 38px; height: 38px; }
  .brand-title { font-size: 1rem; }
  .btn-pill, .lang-select { padding: 6px 10px; font-size: .85rem; }
  .feed-header-btn { padding: 6px 8px; }
  .lang-select { padding-right: 8px; }
  .feed-buttons { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .btn-food svg { width: 26px; height: 26px; }
  .btn-food { font-size: .9rem; padding: 6px 2px; }
  .feed-bubble { max-width: 68%; font-size: .95rem; padding: 8px 10px; }
  .reaction-inset { max-width: 130px; }
  .hotspot { width: 46px; height: 46px; }
  .chapter-title { font-size: 1.25rem; }
  .hero-heading { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  .nav-track { gap: 2px; }
  .nav-tab { padding: 2px; }
  .nav-tab .tab-label { font-size: .68rem; }
  .brand-title { font-size: .95rem; }
  .feed-buttons { gap: 6px; }
  .btn-food { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .food-drop.dropping { top: 40%; opacity: 1; }
  .feed-bubble, .spot-popover, .feed-popover { animation: none; }
}
