/* ==========================================================================
   PURRFECT PLATES — 8-bit theme
   ========================================================================== */

/* ---------- 1. Palette & tokens ---------- */
:root {
  --bg: #2b1b3d;
  --bg-dark: #1c1129;
  --bg-panel: #3d2856;
  --pink: #ff6fa5;
  --pink-dark: #c9407a;
  --cream: #fff4d6;
  --cream-dark: #e8d6a8;
  --teal: #3ee0c5;
  --teal-dark: #1fa892;
  --yellow: #ffd23f;
  --yellow-dark: #d9a800;
  --red: #ff4d4d;
  --black: #000;
  --ink: #1a1020;

  --font: 'Press Start 2P', monospace;
  --border: 4px solid var(--black);
  --shadow: 4px 4px 0 var(--black);
  --shadow-lg: 8px 8px 0 var(--black);
  --px: 4px;
}

/* ---------- 2. Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html { font-size: 12px; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 2px, transparent 2px);
  background-size: 32px 32px;
  color: var(--cream);
  font-family: var(--font);
  line-height: 1.6;
  overflow-x: hidden;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  animation: flicker 6s steps(1) infinite;
}

img, svg {
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

button, input, select { font-family: var(--font); }

.hidden { display: none !important; }

/* CRT scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.18) 3px,
      rgba(0, 0, 0, 0) 4px
    ),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
}

/* ---------- 3. Floating decorations (pixel paws & fish via box-shadow) ---------- */
.floaties {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floaty {
  position: absolute;
  width: 6px;
  height: 6px;
  background: transparent;
  opacity: 0.22;
  animation: drift 24s steps(48) infinite;
}

/* paw: 5x5 grid, u = 6px */
.floaty-paw {
  color: var(--pink);
  box-shadow:
    6px 0, 18px 0,
    0 6px, 24px 6px,
    6px 12px, 12px 12px, 18px 12px,
    0 18px, 6px 18px, 12px 18px, 18px 18px, 24px 18px,
    6px 24px, 12px 24px, 18px 24px;
}

/* fish: 7x4 grid, u = 6px */
.floaty-fish {
  color: var(--teal);
  box-shadow:
    6px 0, 12px 0, 18px 0, 36px 0,
    0 6px, 12px 6px, 18px 6px, 24px 6px, 30px 6px,
    0 12px, 6px 12px, 12px 12px, 18px 12px, 24px 12px, 30px 12px,
    6px 18px, 12px 18px, 18px 18px, 36px 18px;
}

.f1 { top: 12%; left: 6%;  animation-duration: 22s; }
.f2 { top: 30%; left: 88%; animation-duration: 28s; animation-delay: -6s; }
.f3 { top: 62%; left: 12%; animation-duration: 26s; animation-delay: -12s; color: var(--yellow); }
.f4 { top: 78%; left: 70%; animation-duration: 30s; animation-delay: -3s; color: var(--pink); }
.f5 { top: 45%; left: 48%; animation-duration: 34s; animation-delay: -18s; color: var(--teal); }
.f6 { top: 8%;  left: 60%; animation-duration: 25s; animation-delay: -9s; color: var(--yellow); }

/* ---------- 4. Layout ---------- */
.site-header,
.container,
.site-footer {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: var(--bg-panel);
  border: var(--border);
  box-shadow: var(--shadow-lg), inset -4px -4px 0 rgba(0, 0, 0, 0.25), inset 4px 4px 0 rgba(255, 255, 255, 0.08);
  padding: 20px;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--black);
}

/* ---------- 5. Header ---------- */
.site-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.title {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  line-height: 1.2;
  color: var(--pink);
  text-shadow: 4px 4px 0 var(--black), -2px -2px 0 var(--cream);
  letter-spacing: 2px;
  display: flex;
  flex-wrap: wrap;
}

.title span {
  display: inline-block;
  animation: bob 1.2s steps(2) infinite, rainbow 4.8s steps(1) infinite;
}
.title .title-gap { width: 0.6em; animation: none; }
.title span:nth-child(1)  { animation-delay: 0s,    0s; }
.title span:nth-child(2)  { animation-delay: .1s,   .3s; }
.title span:nth-child(3)  { animation-delay: .2s,   .6s; }
.title span:nth-child(4)  { animation-delay: .3s,   .9s; }
.title span:nth-child(5)  { animation-delay: .4s,  1.2s; }
.title span:nth-child(6)  { animation-delay: .5s,  1.5s; }
.title span:nth-child(7)  { animation-delay: .6s,  1.8s; }
.title span:nth-child(8)  { animation-delay: .7s,  2.1s; }
.title span:nth-child(10) { animation-delay: .9s,  2.7s; }
.title span:nth-child(11) { animation-delay: 1.0s, 3.0s; }
.title span:nth-child(12) { animation-delay: 1.1s, 3.3s; }
.title span:nth-child(13) { animation-delay: 1.2s, 3.6s; }
.title span:nth-child(14) { animation-delay: 1.3s, 3.9s; }
.title span:nth-child(15) { animation-delay: 1.4s, 4.2s; }

.subtitle {
  margin: 12px 0 0;
  font-size: 0.7rem;
  color: var(--teal);
  text-transform: uppercase;
}

.cursor { animation: blink 1s steps(1) infinite; }

.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score {
  background: var(--ink);
  color: var(--yellow);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: 0.85rem;
  text-shadow: 2px 2px 0 var(--black);
}

/* ---------- 6. Buttons & inputs ---------- */
.btn,
.paw-btn,
.view-btn,
.remove-btn,
.modal-close {
  font-size: 0.8rem;
  padding: 12px 16px;
  border: var(--border);
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow), inset -3px -3px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
  text-transform: uppercase;
  transition: none;
  position: relative;
  user-select: none;
}

.btn:hover,
.paw-btn:hover,
.view-btn:hover,
.modal-close:hover {
  animation: wiggle 0.4s steps(4) infinite;
  filter: brightness(1.1);
}

.btn:active,
.paw-btn:active,
.view-btn:active,
.remove-btn:active,
.modal-close:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--black), inset 3px 3px 0 rgba(0, 0, 0, 0.2);
  animation: none;
}

.btn:focus-visible,
.paw-btn:focus-visible,
.view-btn:focus-visible,
.remove-btn:focus-visible,
.modal-close:focus-visible,
.pixel-input:focus-visible {
  outline: 4px dashed var(--yellow);
  outline-offset: 3px;
}

.btn:disabled,
.paw-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  animation: none;
  filter: grayscale(0.6);
}

.btn-primary   { background: var(--pink);   color: var(--cream); text-shadow: 2px 2px 0 var(--black); }
.btn-secondary { background: var(--teal);   color: var(--ink); }
.btn-danger    { background: var(--yellow); color: var(--ink); }
.btn-small     { padding: 8px 10px; font-size: 0.7rem; }

.pixel-input {
  width: 100%;
  font-size: 0.8rem;
  padding: 11px 12px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.15);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

select.pixel-input {
  padding-right: 32px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(-45deg, transparent 50%, var(--ink) 50%);
  background-size: 6px 6px, 6px 6px;
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-repeat: no-repeat;
}

.pixel-input::placeholder { color: #9a8a74; }

/* ---------- 7. Hero / mascot / speech ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 28px;
  background:
    linear-gradient(var(--bg-panel), var(--bg-panel)) padding-box,
    var(--bg-panel);
}

.chef-cat {
  flex: 0 0 auto;
  min-width: 128px;
  min-height: 128px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  filter: drop-shadow(4px 4px 0 var(--black));
}
.chef-cat svg { display: block; }

.speech-bubble {
  position: relative;
  flex: 1 1 auto;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-height: 84px;
}

/* stepped pixel tail pointing at the cat */
.speech-bubble::before,
.speech-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
}
.speech-bubble::before {
  left: -16px;
  width: 16px;
  height: 8px;
  margin-top: -4px;
  background: var(--cream);
  box-shadow:
    0 -4px 0 0 var(--black),
    0 4px 0 0 var(--black),
    -4px 0 0 0 var(--black);
}
.speech-bubble::after {
  left: -24px;
  width: 8px;
  height: 4px;
  margin-top: 0;
  background: var(--black);
}

.speech {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.9;
  min-height: 1.9em;
}
.speech .cursor {
  margin-left: 4px;
  color: var(--pink);
}

/* ---------- 8. Controls ---------- */
.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 0.65rem; color: var(--teal); }

/* ---------- 9. Loading ---------- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.loading-cat {
  min-height: 64px;
  animation: run-across 1.6s steps(8) infinite alternate;
}

.loading-text {
  margin: 0;
  color: var(--yellow);
  font-size: 0.9rem;
  text-shadow: 2px 2px 0 var(--black);
}

.blink { animation: blink 0.8s steps(1) infinite; }

/* ---------- 10. Results / meal cards ---------- */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}
.results:empty { display: none; }

.meal-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  min-height: 360px;
  cursor: grab;
  position: relative;
}
.meal-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 var(--black);
}
.meal-card[draggable="true"]:active { cursor: grabbing; }

.meal-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: var(--border);
  outline: 4px solid var(--pink);
  outline-offset: -8px;
  box-shadow: 4px 4px 0 var(--pink-dark);
  background: var(--bg-dark);
  cursor: pointer;
  image-rendering: auto;
}

.meal-name {
  font-size: 0.75rem;
  line-height: 1.6;
  margin: 0;
  min-height: 3.2em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
}

.tag {
  display: inline-block;
  font-size: 0.5rem;
  line-height: 1;
  padding: 5px 6px;
  background: var(--teal);
  color: var(--ink);
  border: 2px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  text-transform: uppercase;
}
.tag:nth-child(3n+2) { background: var(--yellow); }
.tag:nth-child(3n+3) { background: var(--pink); color: var(--cream); }

.card-actions,
.meal-card .paw-btn,
.meal-card .view-btn { margin-top: auto; }

.meal-card .paw-btn,
.meal-card .view-btn {
  font-size: 0.65rem;
  padding: 10px 8px;
}
.paw-btn { background: var(--pink); color: var(--cream); text-shadow: 2px 2px 0 var(--black); }
.view-btn { background: var(--teal); color: var(--ink); }

/* If app.js wraps buttons in a row, or they're siblings, keep them neat */
.card-actions { display: flex; gap: 8px; }
.card-actions > button { flex: 1; }
.meal-card > .paw-btn + .view-btn { margin-top: 0; }

.meal-card.pop-in {
  animation: pop-in 0.45s steps(5) backwards;
}

/* ---------- 11. Planner (cat bowls / inventory slots) ---------- */
.planner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.planner-head .panel-title { margin: 0; }
.planner-actions { display: flex; gap: 12px; }

.planner {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
}

.day-slot {
  display: flex;
  flex-direction: column;
  min-height: 170px;
  background: var(--bg-dark);
  border: var(--border);
  box-shadow: var(--shadow), inset 0 0 0 4px var(--bg-panel), inset 0 0 0 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.day-label {
  font-size: 0.65rem;
  text-align: center;
  padding: 6px 0;
  background: var(--yellow);
  color: var(--ink);
  border-bottom: var(--border);
}

.day-meal {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 8px 0;
  position: relative;
  text-align: center;
}

.day-slot:not(.filled) .day-meal,
.empty-text {
  font-size: 0.5rem;
  color: rgba(255, 244, 214, 0.45);
  margin-bottom: 6px;
}

/* the "bowl" at the bottom of every slot */
.day-slot::after {
  content: "";
  display: block;
  height: 20px;
  margin: 6px 10px 10px;
  background: var(--pink);
  border: var(--border);
  border-top-width: 6px;
  box-shadow: inset 0 -6px 0 var(--pink-dark);
  clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%);
}

.day-slot:nth-child(even)::after {
  background: var(--teal);
  box-shadow: inset 0 -6px 0 var(--teal-dark);
}

.day-slot.filled { background: #24163a; }
.day-slot.filled::after {
  background: var(--yellow);
  box-shadow: inset 0 -6px 0 var(--yellow-dark);
}

.mini-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 3px solid var(--black);
  box-shadow: 3px 3px 0 var(--black);
  image-rendering: auto;
  cursor: pointer;
}

.mini-name {
  font-size: 0.5rem;
  line-height: 1.5;
  color: var(--cream);
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.5rem;
  padding: 4px 5px;
  background: var(--red);
  color: var(--cream);
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--black);
  line-height: 1;
}
.remove-btn:active { transform: translate(2px, 2px); }

.day-slot.drag-over {
  background: #3a2a1a;
  outline: 4px dashed var(--yellow);
  outline-offset: 2px;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--black), inset 0 0 0 4px var(--yellow);
}

.day-slot.drop-flash { animation: drop-flash 0.6s steps(6); }

/* ---------- 12. Modal (RPG dialog) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.55) 0 4px, rgba(0, 0, 0, 0.7) 4px 8px);
}

.modal-panel {
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  border: var(--border);
  box-shadow:
    0 0 0 4px var(--cream),
    0 0 0 8px var(--black),
    12px 12px 0 8px var(--black);
  animation: pop-in 0.3s steps(4) both;
}

.modal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  background: var(--pink);
  border-bottom: var(--border);
  color: var(--cream);
  font-size: 0.7rem;
  text-shadow: 2px 2px 0 var(--black);
}

.modal-close {
  padding: 6px 9px;
  font-size: 0.7rem;
  background: var(--yellow);
  line-height: 1;
}

.modal-body {
  overflow-y: auto;
  padding: 20px;
  color: var(--cream);
  scrollbar-color: var(--pink) var(--bg-dark);
}
.modal-body::-webkit-scrollbar { width: 12px; }
.modal-body::-webkit-scrollbar-track { background: var(--bg-dark); border-left: var(--border); }
.modal-body::-webkit-scrollbar-thumb { background: var(--pink); border: 2px solid var(--black); }

.modal-title {
  margin: 0 0 16px;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--black);
}

.modal-img {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 20px;
  border: var(--border);
  box-shadow: 0 0 0 4px var(--teal), 8px 8px 0 4px var(--black);
}

.modal-body h3,
.modal-body h4 {
  font-size: 0.8rem;
  color: var(--teal);
  margin: 20px 0 10px;
}

.modal-ingredients {
  list-style: none;
  margin: 0 0 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid var(--black);
  font-size: 0.6rem;
  line-height: 1.6;
}
.modal-ingredients li::before {
  content: "▸ ";
  color: var(--pink);
}

.modal-instructions {
  font-size: 0.6rem;
  line-height: 2;
  margin: 0 0 12px;
  white-space: pre-line;
  color: var(--cream-dark);
}

.yt-link {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--red);
  color: var(--cream);
  font-size: 0.7rem;
  text-decoration: none;
  border: var(--border);
  box-shadow: var(--shadow);
  text-shadow: 2px 2px 0 var(--black);
}
.yt-link:hover { animation: wiggle 0.4s steps(4) infinite; }
.yt-link:active { transform: translate(4px, 4px); box-shadow: none; }

/* ---------- 13. Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1100;
  max-width: calc(100vw - 32px);
  padding: 14px 18px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.7rem;
  text-align: center;
  transform: translate(-50%, 200%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
  animation: toast-in 0.35s steps(4) both;
}

/* ---------- 14. Footer ---------- */
.site-footer {
  text-align: center;
  padding: 24px 16px 40px;
  font-size: 0.6rem;
  color: rgba(255, 244, 214, 0.6);
}

/* ---------- 15. Utility animation classes ---------- */
.shake  { animation: shake 0.5s steps(6) both; }
.bounce { animation: bounce 0.6s steps(6) both; }

/* ---------- 16. Keyframes ---------- */
@keyframes pop-in {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1);    opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-20px); }
  50% { transform: translateY(0); }
  70% { transform: translateY(-8px); }
}

@keyframes drop-flash {
  0%   { background: var(--cream); box-shadow: 0 0 0 4px var(--yellow), var(--shadow); }
  33%  { background: var(--bg-dark); }
  66%  { background: var(--yellow); }
  100% { background: inherit; }
}

@keyframes toast-in {
  0%   { transform: translate(-50%, 200%); }
  70%  { transform: translate(-50%, -10px); }
  100% { transform: translate(-50%, 0); }
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

@keyframes rainbow {
  0%   { color: var(--pink); }
  25%  { color: var(--yellow); }
  50%  { color: var(--teal); }
  75%  { color: var(--cream); }
  100% { color: var(--pink); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

@keyframes drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(40px, -60px); }
  50%  { transform: translate(-20px, -120px); }
  75%  { transform: translate(-50px, -50px); }
  100% { transform: translate(0, 0); }
}

@keyframes run-across {
  from { transform: translateX(-60px); }
  to   { transform: translateX(60px); }
}

@keyframes flicker {
  0%, 100% { filter: none; }
  97%      { filter: brightness(1.04); }
  98%      { filter: brightness(0.96); }
}

/* ---------- 17. Responsive ---------- */
@media (max-width: 960px) {
  .planner { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  html { font-size: 11px; }
  .controls-row { grid-template-columns: 1fr; }
  #roll-btn { width: 100%; }
  .planner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { flex-direction: column; gap: 32px; }
  .speech-bubble { width: 100%; }
  /* tail points up toward the cat when stacked */
  .speech-bubble::before {
    top: -16px; left: 50%;
    width: 8px; height: 16px;
    margin: 0 0 0 -4px;
    box-shadow: -4px 0 0 0 var(--black), 4px 0 0 0 var(--black), 0 -4px 0 0 var(--black);
  }
  .speech-bubble::after {
    top: -24px; left: 50%;
    width: 4px; height: 8px;
    margin-left: 0;
  }
}

@media (max-width: 440px) {
  .planner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header { flex-direction: column; align-items: flex-start; }
  .planner-actions { width: 100%; }
  .planner-actions .btn { flex: 1; }
}

/* ---------- 18. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body { animation: none; }
  .floaty, .title span, .loading-cat { animation: none !important; }
  .blink, .cursor, .speech::after { animation: none !important; opacity: 1; }
  .btn:hover, .paw-btn:hover, .view-btn:hover, .modal-close:hover, .yt-link:hover { animation: none; }
}
