/* Petal & Paw — gentle cottage-core styling */
:root {
  --cream: #fdf6ee;
  --paper: #fffaf5;
  --blush: #f8dce2;
  --rose: #e48fa6;
  --rose-deep: #c9708a;
  --sage: #c6dab7;
  --sage-deep: #7f9f72;
  --lavender: #dccfee;
  --lavender-deep: #9a86c4;
  --butter: #fbe7a6;
  --brown: #8b6b5a;
  --ink: #5e4552;
  --ink-soft: #8d7380;
  --line: #f0d3da;
  --radius: 24px;
  --shadow: 0 5px 0 rgba(201, 112, 138, 0.12), 0 16px 32px rgba(94, 69, 82, 0.1);
  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--cream);
  /* soft gingham */
  background-image:
    repeating-linear-gradient(0deg, rgba(248, 210, 220, 0.32) 0 16px, transparent 16px 32px),
    repeating-linear-gradient(90deg, rgba(248, 210, 220, 0.32) 0 16px, transparent 16px 32px);
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--lavender-deep); outline-offset: 2px; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 1320px; margin: 0 auto; padding: 14px 24px 10px;
  position: sticky; top: 0; z-index: 30;
  background: rgba(253, 246, 238, 0.9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 0 0 24px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-bunny { width: 48px; height: 60px; filter: drop-shadow(0 3px 0 rgba(201, 112, 138, 0.18)); }
.brand h1 { font-size: 30px; letter-spacing: -0.5px; line-height: 1; }
.brand h1 em { color: var(--rose); font-style: italic; font-weight: 500; }
.brand p { margin: 4px 0 0; font-family: var(--font-head); font-style: italic; color: var(--ink-soft); font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.coins {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper); border: 2px solid var(--line); border-radius: 999px;
  padding: 7px 16px 7px 10px; font-weight: 800; font-size: 18px; box-shadow: var(--shadow);
}
.coins.bump, .food.bump { animation: bump 0.5s ease; }

.food {
  display: inline-flex; align-items: center; gap: 6px; cursor: grab;
  background: var(--paper); border: 2px solid var(--line); border-radius: 999px;
  padding: 5px 16px 5px 8px; font-weight: 800; font-size: 18px; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.food:hover { border-color: #f6b27a; background: #fff5ea; }
.food:active { cursor: grabbing; }
.food.empty { cursor: not-allowed; opacity: 0.6; }
.feeding-armed .food { border-color: #f6a25e; background: #fff1e2; animation: wiggle 0.9s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.food-ico { display: inline-block; width: 26px; height: 26px; flex: none; vertical-align: middle; }
.food-ico svg { width: 100%; height: 100%; display: block; }
.food-ico.sm { width: 17px; height: 17px; vertical-align: -3px; margin-left: 6px; }

.food-ghost {
  position: fixed; left: 0; top: 0; z-index: 90; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  pointer-events: none; opacity: 0; filter: drop-shadow(0 6px 6px rgba(94, 69, 82, 0.25));
}
.food-ghost svg { width: 100%; height: 100%; transform: rotate(-12deg) scale(1.1); }
.dragging-food .food-ghost { opacity: 1; }
.dragging-food, .dragging-food * { cursor: grabbing !important; }
.feeding-armed #scene .animal { cursor: pointer; }
#scene .animal.feed-hover, .feeding-armed #scene .animal:hover {
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 6px #f6a25e);
}
.dragging-food #scene .animal { filter: drop-shadow(0 0 2px #fff); }
.dragging-food #scene .animal.feed-hover { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 7px #f6a25e); }
@keyframes bump { 40% { transform: scale(1.12) rotate(-2deg); } }

.coin-ico {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 32%, #fff6cf 0 18%, #f6d06a 45%, #e0ad44 100%);
  box-shadow: inset 0 0 0 2px #d9a03d;
  position: relative; vertical-align: -4px;
}
.coin-ico::after { content: '♥'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: #c98a2c; line-height: 1; }
.coin-ico.sm { width: 16px; height: 16px; vertical-align: -3px; }
.coin-ico.sm::after { font-size: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px;
  font-weight: 800; font-size: 15px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(94, 69, 82, 0.14);
  transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(94, 69, 82, 0.14); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-rose { background: var(--rose); color: #fff; }
.btn-rose:hover:not(:disabled) { background: var(--rose-deep); }
.btn-sage { background: var(--sage-deep); color: #fff; }
.btn-sage:hover { background: #6d8c61; }
.btn-ghost { background: var(--paper); color: var(--ink-soft); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:hover { color: var(--ink); }
.btn-ghost.armed { background: #fde9ee; color: var(--rose-deep); box-shadow: inset 0 0 0 2px var(--rose); }
.btn-big { width: 100%; padding: 14px 20px; font-size: 16px; }
.btn-small { padding: 9px 14px; font-size: 14px; }
.btn .ico { width: 18px; height: 18px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blush); font-size: 22px; line-height: 1; color: var(--ink);
}
.icon-btn:hover { background: var(--line); }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--ink-soft); text-decoration: underline dotted; text-underline-offset: 3px; font-size: 14px;
}
.link-btn:hover { color: var(--rose-deep); }

/* ---------- layout & cards ---------- */
.layout {
  display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start;
  max-width: 1320px; margin: 0 auto; padding: 8px 24px 40px;
}
.sidebar { display: grid; gap: 24px; }

.card {
  position: relative; background: var(--paper); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card::before { /* stitched edge */
  content: ''; position: absolute; inset: 7px; pointer-events: none;
  border: 2px dashed var(--line); border-radius: calc(var(--radius) - 6px);
}
.card > * { position: relative; }
.card-title { font-size: 22px; text-align: center; }
.card-title::after { content: ' ✿'; color: var(--rose); font-size: 0.8em; }
.card-head { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.todo-count { font-weight: 700; color: var(--ink-soft); font-size: 14px; }

/* ---------- timer ---------- */
.ring-wrap { position: relative; width: 210px; height: 210px; margin: 14px auto 18px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: var(--blush); }
.ring-progress { stroke: var(--rose); stroke-linecap: round; transition: stroke-dashoffset 0.5s linear, stroke 0.4s ease; }
.timer-card[data-mode='break'] .ring-progress, .timer-card[data-mode='offer'] .ring-progress { stroke: var(--sage-deep); }
.timer-card[data-mode='break'] .ring-track { stroke: #e3eedb; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.time { font-family: var(--font-head); font-size: 46px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.time-sub { color: var(--ink-soft); font-size: 14px; font-style: italic; font-family: var(--font-head); }

.controls { display: grid; gap: 12px; }
.picker { display: flex; align-items: center; gap: 10px; }
.picker input[type='range'] {
  flex: 1; min-width: 0; height: 22px; margin: 0; cursor: pointer; background: transparent;
  -webkit-appearance: none; appearance: none;
  --pct: 30%;
}
.picker input[type='range']::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--rose) var(--pct), var(--blush) var(--pct));
}
.picker input[type='range']::-moz-range-track { height: 8px; border-radius: 999px; background: var(--blush); }
.picker input[type='range']::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--rose); }
.picker input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 3px solid var(--rose); box-shadow: 0 2px 0 rgba(94, 69, 82, 0.15);
}
.picker input[type='range']::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--rose);
}
.step {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: #fff;
  font-size: 18px; font-weight: 800; cursor: pointer; color: var(--rose-deep); flex: none;
}
.step:disabled { opacity: 0.4; cursor: not-allowed; }
.presets { display: flex; gap: 8px; justify-content: center; }
.chip {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px;
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--ink-soft);
}
.chip:hover { border-color: var(--rose); color: var(--rose-deep); }
.picker-meta { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-soft); }
.reward b { color: var(--ink); font-size: 15px; }
.hint { margin: 0; text-align: center; color: var(--ink-soft); line-height: 1.5; }

.session-name input {
  width: 100%; border: 2px solid var(--line); border-radius: 999px; padding: 10px 16px;
  font: inherit; background: #fff; color: var(--ink); text-align: center;
}
.session-name input:focus { outline: none; border-color: var(--rose); }
#statsBtn[aria-pressed='true'] { color: var(--rose-deep); box-shadow: inset 0 0 0 2px var(--rose); }

/* ---------- todos ---------- */
.todo-form { display: flex; gap: 8px; margin: 16px 0 12px; }
.todo-form input {
  flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 999px; padding: 10px 16px;
  font: inherit; background: #fff; color: var(--ink);
}
.todo-form input:focus { outline: none; border-color: var(--rose); }
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 320px; overflow-y: auto; }
.todo {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } }
.check {
  width: 24px; height: 24px; flex: none; border-radius: 8px; border: 2px solid var(--rose);
  background: #fff; cursor: pointer; display: grid; place-items: center; padding: 0;
  font-size: 13px; color: #fff; transition: background-color 0.2s;
}
.todo.done .check { background: var(--rose); }
.todo.done .check::after { content: '♥'; }
.todo-text { flex: 1; overflow-wrap: anywhere; line-height: 1.35; }
.todo.done .todo-text { text-decoration: line-through; text-decoration-color: var(--rose); color: var(--ink-soft); }
.del {
  border: 0; background: none; cursor: pointer; font-size: 20px; line-height: 1; color: var(--ink-soft);
  opacity: 0.35; padding: 0 4px; transition: opacity 0.15s;
}
.todo:hover .del, .del:focus-visible { opacity: 1; }
.del:hover { color: var(--rose-deep); }
.todo-empty { margin: 4px 0 0; text-align: center; color: var(--ink-soft); font-size: 14px; font-style: italic; }
#clearDone { display: block; margin: 12px auto 0; }

/* ---------- farm ---------- */
.farm-card { padding: 14px; }
.scene { display: block; width: 100%; height: auto; border-radius: 16px; background: #fdf1e6; }
.mood { padding: 14px 10px 6px; }
.mood-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; font-weight: 600; }
.mood-pct { color: var(--rose-deep); font-weight: 800; white-space: nowrap; }
.mood-bar { height: 14px; background: var(--blush); border-radius: 999px; overflow: hidden; box-shadow: inset 0 2px 0 rgba(94, 69, 82, 0.08); }
.mood-fill { height: 100%; border-radius: 999px; transition: width 0.8s ease, background 0.6s ease; background: linear-gradient(90deg, #f3b2c2, var(--rose)); }
.mood-fill[data-level='content'] { background: linear-gradient(90deg, #fbe7a6, #f3c58a); }
.mood-fill[data-level='sad'] { background: linear-gradient(90deg, #d9cfee, var(--lavender-deep)); }
.footnote { text-align: center; color: var(--ink-soft); font-size: 14px; margin: 14px 0 0; }
.sep { margin: 0 6px; }

/* scene items */
.scene .item { cursor: default; }
.scene .bob, .scene .wander, .scene .pop { transform-box: fill-box; transform-origin: 50% 100%; }

.mood-happy .animal .bob { animation: hop 2.8s ease-in-out infinite; }
.mood-content .animal .bob { animation: breathe 3.4s ease-in-out infinite; }
.mood-sad .animal .bob { animation: droop 5s ease-in-out infinite; }
.is-sleeping .animal .bob { animation: breathe 4.5s ease-in-out infinite; }
.animal.is-disappointed .bob { animation: droop 2s ease-in-out infinite !important; }
.animal.is-fed .bob { animation: munch 0.3s ease-in-out infinite alternate !important; }
@keyframes munch { to { transform: scale(1.05, 0.94); } }
.hearts text {
  font-size: 18px; fill: #ec7f9c; stroke: #fff; stroke-width: 3px; paint-order: stroke;
  transform-box: fill-box; transform-origin: center; animation: heartUp 1.4s ease-out infinite;
}
.hearts .h2 { font-size: 13px; animation-delay: -0.45s; }
.hearts .h3 { font-size: 15px; animation-delay: -0.9s; }
@keyframes heartUp {
  0% { opacity: 0; transform: translateY(6px) scale(0.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-24px) scale(1.1); }
}

.animal .wander { animation: wander 12s ease-in-out infinite alternate; }
.mood-sad .animal .wander, .is-sleeping .animal .wander { animation-play-state: paused; }
.decor .bob { animation: sway 6s ease-in-out infinite; }
.pop { animation: pop 0.8s cubic-bezier(0.2, 1.6, 0.4, 1); }

@keyframes hop {
  0%, 55%, 100% { transform: translateY(0) scale(1, 1); }
  65% { transform: translateY(0) scale(1.06, 0.93); }
  77% { transform: translateY(-12px) scale(0.97, 1.04); }
  89% { transform: translateY(0) scale(1.05, 0.95); }
}
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, 0.975); } }
@keyframes droop { 0%, 100% { transform: scale(1, 0.97); } 50% { transform: scale(1.015, 0.93); } }
@keyframes wander { from { transform: translateX(-14px); } to { transform: translateX(14px); } }
@keyframes sway { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
@keyframes pop { 0% { transform: scale(0.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1); } }

.zzz text {
  font-family: var(--font-head); font-weight: 700; font-size: 22px; fill: #7a62b0;
  stroke: #fff; stroke-width: 4px; paint-order: stroke; stroke-linejoin: round;
  animation: zfloat 2.6s ease-in-out infinite;
}
.zzz .z2 { font-size: 16px; animation-delay: -1.3s; }
@keyframes zfloat { 0% { opacity: 0; transform: translate(0, 4px); } 30%, 70% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -8px); } }

.nametag rect { fill: var(--paper); stroke: var(--rose); stroke-width: 2; }
.nametag text { font-family: var(--font-head); font-weight: 700; font-size: 13px; fill: var(--ink); text-anchor: middle; }

.glow { animation: glow 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes glow { 0%, 100% { opacity: 0.35; transform: scale(0.92); } 50% { opacity: 0.7; transform: scale(1.06); } }
.is-sleeping .glow { animation-duration: 2s; }

.cloud { animation: drift 38s ease-in-out infinite alternate; }
.cloud.c2 { animation-duration: 52s; animation-delay: -20s; }
.cloud.c3 { animation-duration: 44s; animation-delay: -8s; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(40px); } }

.smoke circle { opacity: 0.6; transform-box: fill-box; transform-origin: center; animation: smoke 4s ease-in-out infinite; }
.smoke circle:nth-child(2) { animation-delay: -1.3s; }
.smoke circle:nth-child(3) { animation-delay: -2.6s; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(10px) scale(0.6); } 40% { opacity: 0.7; } 100% { opacity: 0; transform: translateY(-14px) scale(1.2); } }

.butterfly { opacity: 0; transition: opacity 1s; }
.mood-happy:not(.is-sleeping) .butterfly { opacity: 1; }
.butterfly.b1 { animation: flyA 16s ease-in-out infinite; }
.butterfly.b2 { animation: flyB 21s ease-in-out infinite; }
.flap { transform-box: fill-box; transform-origin: center; animation: flap 0.35s ease-in-out infinite alternate; }
@keyframes flap { to { transform: scaleX(0.35); } }
@keyframes flyA {
  0% { transform: translate(240px, 170px); } 25% { transform: translate(330px, 130px); }
  50% { transform: translate(420px, 190px); } 75% { transform: translate(310px, 220px); } 100% { transform: translate(240px, 170px); }
}
@keyframes flyB {
  0% { transform: translate(560px, 300px); } 30% { transform: translate(470px, 250px); }
  60% { transform: translate(620px, 220px); } 100% { transform: translate(560px, 300px); }
}

.gloom, .dusk, .stars { opacity: 0; transition: opacity 1.5s ease; }
.mood-sad:not(.is-sleeping) .gloom { opacity: 0.22; }
.is-sleeping .dusk { opacity: 0.26; }
.is-sleeping .stars { opacity: 1; }
.star { transform-box: fill-box; transform-origin: center; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(0.5); opacity: 0.5; } }

/* ---------- stats page ---------- */
.stats-view { max-width: 1100px; margin: 0 auto; padding: 8px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.stats-view > *, #statsBody > * { min-width: 0; }
.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stats-head h2 { font-size: 28px; flex: 1; text-align: center; }
.ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.chip[aria-pressed='true'] { background: var(--rose); border-color: var(--rose); color: #fff; }
#statsBody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.stats-empty { margin: 0; text-align: center; color: var(--ink-soft); font-style: italic; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat-tile {
  background: var(--paper); border: 2px solid var(--line); border-radius: 20px; padding: 14px 18px;
  display: grid; gap: 2px; box-shadow: var(--shadow); min-width: 0;
}
.stat-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.stat-value { font-family: var(--font-head); font-size: 26px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 13px; color: var(--ink-soft); }
.stats-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.card-sub { margin: 6px 0 16px; text-align: center; color: var(--ink-soft); font-size: 13px; }

.bar-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.bar-row { position: relative; padding: 6px 8px; border-radius: 12px; outline-offset: 0; }
.bar-row:hover, .bar-row:focus-visible { background: #fdf0f2; }
.bar-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: 14px; }
.bar-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bar-value { color: var(--ink-soft); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 12px; }
.bar-fill { height: 100%; border-radius: 2px 4px 4px 2px; background: var(--rose-deep); transition: width 0.5s ease; }
.is-other .bar-fill { background: var(--ink-soft); }
.bar-tip {
  position: absolute; z-index: 5; right: 8px; bottom: calc(100% - 4px); width: max-content; max-width: min(260px, 90%);
  display: grid; gap: 2px; padding: 9px 12px; border-radius: 12px; font-size: 13px;
  background: var(--ink); color: #fff; box-shadow: 0 8px 20px rgba(94, 69, 82, 0.25);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.bar-tip b { overflow-wrap: anywhere; }
.bar-row:hover .bar-tip, .bar-row:focus-visible .bar-tip { opacity: 1; transform: none; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
.recent { width: 100%; border-collapse: collapse; font-size: 14px; }
.recent th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.recent td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.recent tr:last-child td { border-bottom: 0; }
.recent .t-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent .t-name { overflow-wrap: anywhere; font-weight: 700; }
.recent td:first-child { white-space: nowrap; }
.t-sub { display: block; font-size: 12px; color: var(--ink-soft); }
.status { white-space: nowrap; font-weight: 700; font-size: 13px; }
.status.ok { color: var(--sage-deep); }
.status.off { color: var(--ink-soft); }

/* ---------- shop drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(94, 69, 82, 0.28); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(440px, 100%);
  background: var(--paper); box-shadow: -10px 0 40px rgba(94, 69, 82, 0.18);
  transform: translateX(105%); transition: transform 0.35s cubic-bezier(0.3, 0.9, 0.3, 1);
  display: flex; flex-direction: column; border-radius: 28px 0 0 28px; visibility: hidden;
}
.shop-open .drawer-overlay { opacity: 1; pointer-events: auto; }
.shop-open .drawer { transform: none; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 22px 10px; }
.drawer-head h2 { font-size: 26px; }
.tabs { display: flex; gap: 6px; padding: 6px 22px 14px; }
.tab {
  flex: 1; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 6px;
  font-weight: 800; font-size: 14px; cursor: pointer; color: var(--ink-soft);
}
.tab[aria-selected='true'] { background: var(--rose); border-color: var(--rose); color: #fff; }
.shop-grid {
  flex: 1; overflow-y: auto; padding: 4px 22px 28px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start;
}
.count-badge {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  background: var(--sage-deep); color: #fff; font-weight: 800; font-size: 12px;
  padding: 3px 9px; border-radius: 999px;
}
.feed-hint { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); text-align: center; }
.feed-hint .food-ico.sm { margin: 0 2px; }
.shop-item {
  position: relative;
  background: #fff; border: 1.5px solid var(--line); border-radius: 20px; padding: 14px 12px;
  text-align: center; display: flex; flex-direction: column; gap: 6px;
}
.shop-item.is-owned { background: #fbf7f0; }
.shop-preview {
  height: 100px; display: grid; place-items: center; border-radius: 14px;
  background: radial-gradient(ellipse at 50% 85%, #e4eed8 0 45%, transparent 46%), #fdf3ec;
}
.shop-preview svg { max-width: 90%; max-height: 88px; }
.shop-item h3 { font-size: 17px; margin-top: 4px; }
.shop-item p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.4; flex: 1; }
.buy-btn { width: 100%; margin-top: 6px; padding: 9px 12px; }
.need { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.owned-badge { margin-top: 6px; padding: 9px; font-weight: 800; color: var(--sage-deep); font-size: 14px; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(94, 69, 82, 0.3); backdrop-filter: blur(3px);
}
.modal { width: min(420px, 100%); text-align: center; display: grid; gap: 12px; padding: 30px 28px; animation: pop 0.5s ease; }
.modal-bunny { width: 120px; height: 120px; margin: 0 auto -4px; animation: hop 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
.modal h2 { font-size: 24px; }
.modal p { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.modal label { font-weight: 700; margin-top: 4px; }
.modal input {
  border: 2px solid var(--line); border-radius: 999px; padding: 12px 18px; font: inherit;
  font-family: var(--font-head); font-size: 20px; text-align: center; color: var(--ink); background: #fff;
}
.modal input:focus { outline: none; border-color: var(--rose); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70;
  display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px);
}
.toast {
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(94, 69, 82, 0.25); animation: toastIn 0.35s ease; transition: opacity 0.4s, transform 0.4s;
  text-align: center;
}
.toast.soft { background: var(--lavender-deep); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 8px 16px 32px; }
  .sidebar, .farm-col { min-width: 0; }
  .topbar { padding: 14px 16px 8px; }
  .stats-view { padding: 8px 16px 32px; }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .brand h1 { font-size: 24px; }
  .brand p { display: none; }
  .topbar { gap: 10px; }
  .top-actions { gap: 8px; flex-wrap: wrap; }
  .coins, .food { padding-right: 12px; }
  .coins, .food { font-size: 16px; }
  .brand-bunny { width: 38px; height: 48px; }
  .muted-label, #muteBtn .label, #statsBtn .label { display: none; }
  .stats-head h2 { order: -1; flex-basis: 100%; }
  .stat-tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat-tile { padding: 12px 14px; }
  .stat-value { font-size: 21px; }
  .btn-rose#shopBtn { padding: 10px 14px; }
  .shop-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 14px 24px; }
  .card { padding: 20px 16px; }
  .drawer { border-radius: 0; }
}

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