/* Meeow shell v1 (@layer shell, ADR-0023)
   The app frame on top of the page styles: glass header with «از میو بپرس»,
   the bell and the theme switch; the five-slot bottom bar with the raised ask
   orb; the «میو» bar as a side rail on wide screens; the command bar; the
   inbox; page entrance. Tokens only, so dark mode follows ds-v1.css. */

/* ---------- Header ---------- */
.site-header {
  background: var(--ds-surface-glass);
  border-bottom: 1px solid var(--ds-line);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.brand, .brand strong { color: var(--ds-ink-1); }
.brand small { color: var(--ds-ink-3); }
.nav-link { color: var(--ds-ink-2); }
.nav-link:hover { color: var(--ds-ink-1); background: var(--ds-surface-2); }
.nav-link.is-active { color: var(--ds-ink-1); }
.nav-link::after { background: var(--ds-action); }
.nav-more__toggle[aria-expanded="true"] { color: var(--ds-ink-1); background: var(--ds-surface-2); }
.nav-more__menu, .hv3-search__panel {
  color: var(--ds-ink-1);
  background: var(--ds-surface-1);
  border-color: var(--ds-line);
  box-shadow: var(--ds-elev-4);
}
.nav-more__menu > button, .nav-more__menu > a { color: var(--ds-ink-1); }
.nav-more__menu > button:hover, .nav-more__menu > a:hover, .nav-more__menu > .is-active { background: var(--ds-surface-2); }
.nav-more__menu small { color: var(--ds-ink-3); }
.nav-more__sep { background: var(--ds-line); }
.hv3-search__field { background: var(--ds-surface-2); border-color: var(--ds-line); }
.hv3-search__field input { color: var(--ds-ink-1); }
.hv3-search__chips span { color: var(--ds-ink-3); }
.hv3-search__chips button { color: var(--ds-ink-2); background: var(--ds-surface-2); border-color: var(--ds-line); }

.header-actions { gap: var(--ds-space-2); }
.header-actions .icon-button {
  color: var(--ds-ink-1);
  background: transparent;
  border: 1px solid transparent;
}
.header-actions .icon-button:hover { background: var(--ds-surface-2); border-color: var(--ds-line); box-shadow: none; }
.header-actions .icon-button svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.header-actions .icon-button:focus-visible, .header-actions .login-button:focus-visible, .ds-askbtn:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; box-shadow: var(--ds-focus-ring); }
.site-header.is-searching .hv3-search__toggle { color: var(--ds-ai); background: var(--ds-ai-soft); border-color: var(--ds-ai-line); }
.header-actions .login-button, .is-signed-in .header-actions .login-button {
  color: var(--ds-on-action);
  background: var(--ds-action);
  border-radius: var(--ds-radius-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 8px 20px -10px rgba(210, 64, 47, .42);
}
.header-actions .login-button:hover { color: var(--ds-on-action); background: var(--ds-action-hover); }
.header-actions .login-button svg { color: currentColor; stroke: currentColor; }
.header-actions .login-button .login-mio {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 30%;
  background: #14141c;
}
.header-actions .cart-count, .ds-inbox-badge {
  position: absolute; top: -3px; left: -3px; z-index: 2;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ds-on-action); background: var(--ds-action);
  border: 2px solid var(--ds-bg); border-radius: var(--ds-radius-pill);
  font: var(--ds-weight-bold) .68rem/1 var(--ds-font-sans);
}
.ds-inbox-badge[hidden], .header-actions .cart-count[data-empty] { display: none; }
.ds-inbox-btn { position: relative; }

.ds-askbtn {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px 0 12px;
  color: var(--ds-ai);
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  font: var(--ds-weight-bold) 13px / 1 var(--ds-font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--ds-dur-2) var(--ds-ease-out), background-color var(--ds-dur-2) var(--ds-ease-out), transform var(--ds-dur-1) var(--ds-ease-out);
}
.ds-askbtn:hover { border-color: var(--ds-ai-line); background: var(--ds-ai-soft); }
.ds-askbtn:active { transform: scale(.97); }
.ds-askbtn .ds-kbd { min-width: 0; padding: 0 5px; font-size: 10px; border-bottom-width: 1px; opacity: .75; }
.ds-askbtn__spark {
  width: 18px; height: 18px; flex: none;
  background: var(--ds-ai-grad);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c.6 4.8 2.8 7.1 7.6 7.8v.4C14.8 11 12.6 13.2 12 18h-.4c-.6-4.8-2.8-7-7.6-7.8v-.4c4.8-.7 7-3 7.6-7.8Zm6.5 12.5c.3 2.3 1.3 3.3 3.5 3.6v.3c-2.2.3-3.2 1.3-3.5 3.6h-.3c-.3-2.3-1.3-3.3-3.5-3.6v-.3c2.2-.3 3.2-1.3 3.5-3.6Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c.6 4.8 2.8 7.1 7.6 7.8v.4C14.8 11 12.6 13.2 12 18h-.4c-.6-4.8-2.8-7-7.6-7.8v-.4c4.8-.7 7-3 7.6-7.8Zm6.5 12.5c.3 2.3 1.3 3.3 3.5 3.6v.3c-2.2.3-3.2 1.3-3.5 3.6h-.3c-.3-2.3-1.3-3.3-3.5-3.6v-.3c2.2-.3 3.2-1.3 3.5-3.6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ds-askbtn .ds-kbd { margin-inline-start: var(--ds-space-1); }
.ds-theme-btn__moon { display: none; }
:root[data-theme="dark"] .ds-theme-btn__sun { display: none; }
:root[data-theme="dark"] .ds-theme-btn__moon { display: block; }
.ds-lang-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  min-width: 42px;
}
.ds-lang-btn [data-lang-label] { pointer-events: none; }

@media (min-width: 1121px) {
  .header-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .desktop-nav { justify-self: center; }
}
@media (max-width: 1279px) {
  .ds-askbtn .ds-kbd { display: none; }
}
@media (max-width: 1180px) {
  .ds-askbtn { width: 42px; padding: 0; justify-content: center; }
  .ds-askbtn__txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 960px) {
  .ds-theme-btn { display: none; }
}
@media (max-width: 760px) {
  .header-actions { gap: 2px; }
  .ds-askbtn { display: none; }
}

/* ---------- Bottom bar (≤760px): خانه · میوو‌پزشک · از میو بپرس · میوو‌شاپ · بیشتر ---------- */
@media (max-width: 760px) {
  .mobile-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    min-height: 68px; padding: 6px;
    background: var(--ds-surface-glass);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-elev-3);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
  }
  .mobile-nav button {
    min-width: 44px; min-height: 54px; gap: 3px;
    color: var(--ds-ink-3);
    font: var(--ds-weight-semibold) .66rem/1.3 var(--ds-font-sans);
  }
  .mobile-nav button > span:not(.mobile-nav__orb) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .66rem; line-height: 1.3; }
  .mobile-nav button[data-route="shop"] > span { font-size: .62rem; }
  .mobile-nav button svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-nav button.is-active { color: var(--ds-action-ink); background: var(--ds-action-soft); }
  .mobile-nav button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
  .mobile-nav .mobile-nav__ask { position: relative; color: var(--ds-ai); background: transparent; font-weight: var(--ds-weight-bold); }
  .mobile-nav .mobile-nav__ask.is-active, .mobile-nav .mobile-nav__ask:hover { background: transparent; }
  .mobile-nav__orb {
    width: 54px; height: 54px; margin-top: -26px;
    display: grid; place-items: center;
    overflow: hidden;
    background: #14141c;
    border: 3px solid var(--ds-bg);
    border-radius: 50%;
    box-shadow: 0 10px 22px -10px rgba(18, 35, 59, .42);
    transform: rotate(-7deg);
    transition: transform var(--ds-dur-2) var(--ds-spring);
  }
  .mobile-nav__orb svg,
  .mobile-nav__orb::before { display: none; content: none; }
  .mobile-nav__face {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 28%;
    transform: scale(1.12);
  }
  .mobile-nav__ask:active .mobile-nav__orb { transform: rotate(-7deg) scale(.93); }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-nav__orb,
  .mobile-nav__ask:active .mobile-nav__orb { transform: none; transition: none; }
}

/* ---------- «بیشتر» sheet ---------- */
.more-sheet { color: var(--ds-ink-1); background: var(--ds-bg); }
.more-sheet::backdrop { background: var(--ds-scrim); }
.more-sheet__head::before { background: var(--ds-line-2); }
.more-sheet__close { color: var(--ds-ink-1); background: var(--ds-surface-2); }
.more-sheet__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.more-sheet__list button { min-height: 104px; padding: 10px 4px; color: var(--ds-ink-1); background: var(--ds-surface-1); border-color: var(--ds-line); }
.more-sheet__list button.is-active { border-color: var(--ds-action); background: var(--ds-action-soft); }
.more-sheet__list img { width: 40px; height: 40px; }
.more-sheet__list strong { font-size: .8rem; }
.more-sheet__list small { color: var(--ds-ink-3); font-size: .64rem; }
.more-sheet__theme {
  margin-top: 12px; padding: 8px 8px 8px 8px; padding-inline-start: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-line);
  border-radius: 20px;
  font-weight: var(--ds-weight-bold); font-size: .88rem;
}
.more-sheet__links { background: var(--ds-surface-1); border-color: var(--ds-line); }
.more-sheet__links a { color: var(--ds-ink-1); }
.more-sheet__links a + a { border-top-color: var(--ds-line); }
.more-sheet__links svg { color: var(--ds-ink-3); }
.more-sheet__links a span { color: var(--ds-ink-3); }

/* ---------- «میو» bar → side rail (≥1100px) ---------- */
body.is-mio-app {
  background-color: #ffeede;
  background-image:
    radial-gradient(circle at 92% 4%, color-mix(in srgb, #ffc94d 55%, transparent), transparent 26rem),
    radial-gradient(circle at 6% 88%, color-mix(in srgb, #ff6b5e 34%, transparent), transparent 24rem),
    radial-gradient(circle at 50% 40%, color-mix(in srgb, #20c9b5 16%, transparent), transparent 32rem),
    linear-gradient(180deg, #fff6e8 0%, #ffe4cc 45%, #fff0e2 100%);
}
body.is-mio-app .site-header,
body.is-mio-app .site-footer,
body.is-mio-app > .mobile-nav { display: none; }
body.is-mio-app main { padding-block: 0; }
body.is-mio-app .page.is-active { min-height: 100dvh; animation: none; transform: none; }
body.is-mio-app .mio-nav { --mio-nav-top: 0px; }
.mio-nav__brand { display: flex; align-items: center; gap: var(--ds-space-2); padding: 3px; min-width: 0; }
.mio-nav__conn {
  flex: none; display: inline-grid; place-items: center;
  width: 22px; height: 22px; margin-inline-start: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, #14b39f 12%, transparent);
}
.mio-nav__conn i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #14b39f;
  box-shadow: 0 0 0 0 color-mix(in srgb, #14b39f 40%, transparent);
  animation: mio-conn-pulse 2.4s ease-out infinite;
}
.mio-nav__conn[data-state="offline"],
.mio-nav__conn.is-offline {
  background: color-mix(in srgb, #e8a317 16%, transparent);
}
.mio-nav__conn[data-state="offline"] i,
.mio-nav__conn.is-offline i {
  background: #e8a317;
  animation: none;
  box-shadow: none;
}
@keyframes mio-conn-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, #14b39f 40%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .mio-nav__conn i { animation: none; }
}
.mio-nav__brand-mark {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  overflow: hidden; background: var(--ds-ai-soft);
  border: 1px solid color-mix(in srgb, var(--ds-ai) 24%, transparent);
  border-radius: 15px;
}
.mio-nav__brand-mark img { width: 40px; height: 40px; object-fit: cover; }
.mio-nav__av--sm { width: 34px; height: 34px; }
.mio-nav__ic--pet {
  overflow: hidden; padding: 2px;
  background: var(--ds-surface-1);
  border: 2px solid color-mix(in srgb, var(--ds-ai) 60%, var(--ds-surface-1));
  border-radius: 50%;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ds-ai) 18%, transparent);
}
.mio-nav__ic--pet img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%; filter: none;
}
.mio-nav__ic--pet img.is-pet-art,
.mio-nav__ic--pet img.is-placeholder { background: var(--ds-ai-soft); object-fit: contain; }
.mio-nav__item--today:hover .mio-nav__ic--pet img,
.mio-nav__item--today[aria-current] .mio-nav__ic--pet img { transform: scale(1.04); }
.mio-nav__item[data-tone="coral"] { --tone: var(--ds-action-soft); --tone-ink: var(--ds-action); }

/* ---------- «بیشتر» professional bottom sheet ---------- */
.mio-more {
  width: min(560px, calc(100% - 16px)); max-width: none; max-height: min(86dvh, 760px);
  margin: auto auto 10px; padding: 0 0 12px;
  display: none; flex-direction: column;
  color: var(--ds-ink-1);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--ds-ai-soft) 55%, var(--ds-surface-1)) 0%, var(--ds-surface-1) 88px),
    var(--ds-surface-1);
  border: 1px solid var(--ds-line);
  border-radius: 28px 28px 22px 22px;
  box-shadow: 0 28px 60px -28px rgba(23, 40, 64, .55);
  overflow: hidden;
}
.mio-more[open] { display: flex; animation: mio-more-up 340ms var(--ds-ease-out) both; }
.mio-more.is-closing { animation: mio-more-down 260ms cubic-bezier(.4, 0, 1, 1) both; }
.mio-more::backdrop { background: color-mix(in srgb, #102038 42%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.mio-more[open]::backdrop { animation: ask-fade-in 320ms var(--ds-ease-out) both; }
.mio-more.is-closing::backdrop { animation: ask-fade-out 240ms ease-in both; }
@keyframes mio-more-up { from { transform: translateY(calc(100% + 28px)); opacity: .72; } to { transform: none; opacity: 1; } }
@keyframes mio-more-down { from { transform: none; opacity: 1; } to { transform: translateY(calc(100% + 28px)); opacity: .6; } }
.mio-more__grab { width: 40px; height: 4px; margin: 10px auto 0; background: var(--ds-line-2); border-radius: 99px; }
.mio-more__head { display: flex; align-items: center; gap: 12px; padding: 10px 14px 8px; }
.mio-more__who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.mio-more__av {
  width: 44px; height: 44px; flex: none; overflow: hidden; display: grid; place-items: center;
  background: var(--ds-ai-soft); border: 2px solid color-mix(in srgb, var(--ds-ai) 40%, var(--ds-surface-1)); border-radius: 50%;
}
.mio-more__av img { width: 100%; height: 100%; object-fit: cover; }
.mio-more__who p { display: grid; margin: 0; min-width: 0; }
.mio-more__who b { font-size: 1rem; line-height: 1.35; }
.mio-more__who small { color: var(--ds-ink-3); font-size: .72rem; direction: ltr; text-align: right; }
.mio-more__close {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  color: var(--ds-ink-1); background: var(--ds-surface-2); border: 0; border-radius: 50%; cursor: pointer;
}
.mio-more__close svg { width: 18px; height: 18px; }
.mio-more__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 12px 8px; overscroll-behavior: contain; }
.mio-more__group { margin: 0 0 14px; }
.mio-more__group h3 { margin: 0 4px 8px; color: var(--ds-ink-3); font: 800 .72rem/1.4 var(--ds-font-sans); }
.mio-more__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mio-more__grid--list { grid-template-columns: 1fr; }
.mio-more__tile {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 76px; padding: 10px 12px; text-align: start;
  color: var(--ds-ink-1); background: var(--ds-surface-1);
  border: 1px solid var(--ds-line); border-radius: 18px; cursor: pointer;
  box-shadow: 0 8px 18px -16px rgba(23, 40, 64, .45);
  transition: transform 160ms var(--ds-ease-out), border-color 160ms ease, box-shadow 160ms ease;
}
.mio-more__tile:hover { border-color: color-mix(in srgb, var(--ds-ai) 35%, var(--ds-line)); box-shadow: var(--ds-elev-2); transform: translateY(-1px); }
.mio-more__tile:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.mio-more__tile img {
  width: 52px; height: 52px; flex: none; object-fit: cover;
  background: color-mix(in srgb, var(--ds-surface-2) 70%, white);
  border-radius: 16px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ds-line) 70%, transparent);
}
.mio-more__tile span { display: grid; gap: 2px; min-width: 0; }
.mio-more__tile strong { font-size: .9rem; line-height: 1.35; }
.mio-more__tile small { color: var(--ds-ink-3); font-size: .7rem; line-height: 1.45; }
.mio-more__tile em {
  position: absolute; top: 10px; inset-inline-start: 10px;
  min-width: 20px; padding: 2px 6px; color: var(--ds-on-action); background: var(--ds-action);
  border-radius: 99px; font: 800 .65rem/1.3 var(--ds-font-sans); font-style: normal; text-align: center;
}
.mio-more__tile--danger { border-color: color-mix(in srgb, #d94848 22%, var(--ds-line)); }
.mio-more__tile--danger strong { color: #b42318; }
@media (max-width: 420px) {
  .mio-more { width: calc(100% - 10px); margin-bottom: 6px; border-radius: 24px 24px 18px 18px; }
  .mio-more__grid { grid-template-columns: 1fr; }
  .mio-more__tile { min-height: 70px; }
}

@media (min-width: 1100px) {
  .pet-home-shell:has(> .mio-nav:not([hidden])),
  .mm-page > .container:has(> .mio-nav:not([hidden])) {
    --mio-nav-h: 0px;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    column-gap: clamp(18px, 2.2vw, 34px);
    align-items: start;
  }
  .pet-home-shell:has(> .mio-nav:not([hidden])) > :not(.mio-nav),
  .mm-page > .container:has(> .mio-nav:not([hidden])) > :not(.mio-nav) { grid-column: 2; min-width: 0; }
  .mio-nav:not([hidden]) {
    grid-column: 1; grid-row: 1 / span 20;
    top: 18px;
    margin: 18px 0 0;
  }
  .mio-nav__bar {
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 9px;
    background: var(--ds-surface-glass);
    border-color: var(--ds-line);
    border-radius: 28px;
    box-shadow: 0 18px 44px -28px rgba(23, 40, 64, .46), var(--ds-elev-1);
  }
  .mio-nav__brand { justify-content: center; padding: 4px 0 6px; border-radius: var(--ds-radius-lg); }
  .mio-nav__who { display: none; }
  .mio-nav__items { flex-direction: column; gap: 5px; padding: 0; background: transparent; border-radius: 0; box-shadow: none; }
  .mio-nav__items > li { width: 100%; }
  .mio-nav__item {
    flex-direction: column; justify-content: center; gap: 5px;
    width: 100%; min-height: 72px; padding: 7px 3px;
    color: var(--ds-ink-2);
    border-radius: 18px;
    text-align: center; white-space: normal;
  }
  .mio-nav__item:hover { color: var(--ds-ink-1); background: var(--ds-surface-1); }
  .mio-nav__item[aria-current] { color: var(--ds-ink-1); background: var(--ds-surface-1); box-shadow: 0 8px 18px -14px rgba(23, 40, 64, .48); }
  .mio-nav__item[aria-current]::before {
    content: ""; position: absolute; inset-block: 18px; inset-inline-start: -4px;
    width: 3px; background: var(--tone-ink); border-radius: 99px;
  }
  .mio-nav__ic { width: 42px; height: 42px; border-radius: 14px; }
  .mio-nav__ic img { width: 36px; height: 36px; }
  .mio-nav__ic--pet { width: 44px; height: 44px; border-radius: 50%; }
  .mio-nav__ic--pet img { width: 100%; height: 100%; }
  .mio-nav__label { max-width: 88px; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; white-space: nowrap; }
  .mio-nav__hint { display: none; }
  .mio-nav__end { flex-direction: column; align-items: stretch; margin: 0; padding-top: 9px; border-top: 1px solid var(--ds-line); }
  .mio-nav__talk { justify-content: center; padding: 0; min-height: 48px; color: var(--ds-ai); background: var(--ds-ai-soft); border-radius: var(--ds-radius-md); }
  .mio-nav__talk:hover { background: var(--ds-ai-soft); box-shadow: var(--ds-ai-glow); }
  .mio-nav__talk span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .mio-nav__more { display: flex; justify-content: center; width: 100%; }
  .mio-nav__icon { width: 100%; color: var(--ds-ink-2); }
  .mio-nav__icon:hover, .mio-nav__icon[aria-expanded="true"] { color: var(--ds-ink-1); background: var(--ds-surface-2); }
  .mio-more { width: min(420px, calc(100% - 24px)); margin: auto 18px 18px auto; }
}
.mio-nav { color: var(--ds-ink-1); }
.mio-nav__bar { background: var(--ds-surface-glass); border-color: var(--ds-line); }
.mio-nav__items { background: var(--ds-surface-2); }
.mio-nav__item { color: var(--ds-ink-2); }
.mio-nav__item:hover, .mio-nav__item[aria-current] { color: var(--ds-ink-1); background: var(--ds-surface-1); }
.mio-nav__who small, .mio-nav__hint { color: var(--ds-ink-3); }
.mio-nav__av { border-color: var(--ds-surface-1); }
.mio-nav__badge { color: var(--ds-on-action); background: var(--ds-action); border-color: var(--ds-surface-1); }
.mio-nav button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }

@media (max-width: 1099px) {
  body.is-mio-app .page.is-active { padding-bottom: calc(102px + env(safe-area-inset-bottom)); }
  body.is-mio-app .mio-nav {
    position: fixed; inset: auto auto calc(8px + env(safe-area-inset-bottom)) 50%; z-index: 90;
    width: min(720px, calc(100% - 16px)); margin: 0;
    transform: translateX(-50%);
  }
  body.is-mio-app .mio-nav__bar {
    padding: 5px;
    background: linear-gradient(135deg, rgba(255, 250, 244, .96), rgba(255, 232, 214, .94));
    border: 1px solid color-mix(in srgb, #ff6b5e 18%, rgba(140, 72, 40, .12));
    border-radius: 24px;
    box-shadow: 0 18px 44px -20px rgba(255, 107, 94, .48);
    backdrop-filter: blur(18px) saturate(1.18);
  }
  body.is-mio-app .mio-nav__brand,
  body.is-mio-app .mio-nav__end { display: none; }
  body.is-mio-app .mio-nav__items { width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; padding: 0; background: transparent; box-shadow: none; }
  body.is-mio-app .mio-nav__items > li { display: flex; min-width: 0; }
  body.is-mio-app .mio-nav__item {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px;
    min-width: 0; min-height: 72px; padding: 6px 2px 5px;
    border-radius: 18px;
    text-align: center;
  }
  body.is-mio-app .mio-nav__item[aria-current] {
    background: linear-gradient(180deg, #fff6ec, #ffe8d6);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #ff6b5e 22%, var(--ds-line));
  }
  body.is-mio-app .mio-nav__ic { width: 40px; height: 40px; }
  body.is-mio-app .mio-nav__ic img { width: 34px; height: 34px; }
  body.is-mio-app .mio-nav__ic--pet { width: 42px; height: 42px; }
  body.is-mio-app .mio-nav__ic--pet img { width: 100%; height: 100%; }
  body.is-mio-app .mio-nav__label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .69rem; }
  body.is-mio-app .mio-nav__hint { display: none; }
  body.is-mio-app .mio-nav__item--discover .mio-nav__ic { transform: translateY(-7px) scale(1.12); box-shadow: 0 8px 18px color-mix(in srgb, var(--ds-action) 25%, transparent); }
  body.is-mio-app .mio-nav__more { position: relative; }
}

@media (max-width: 390px) {
  body.is-mio-app .mio-nav { width: calc(100% - 10px); bottom: calc(5px + env(safe-area-inset-bottom)); }
  body.is-mio-app .mio-nav__bar { padding: 4px; border-radius: 21px; }
  body.is-mio-app .mio-nav__items { gap: 1px; }
  body.is-mio-app .mio-nav__item { min-height: 68px; border-radius: 16px; }
  body.is-mio-app .mio-nav__label { font-size: .64rem; }
  body.is-mio-app .mio-nav__ic { width: 37px; height: 37px; }
  body.is-mio-app .mio-nav__ic img { width: 31px; height: 31px; }
  body.is-mio-app .mio-nav__ic--pet { width: 40px; height: 40px; }
  body.is-mio-app .mio-nav__ic--pet img { width: 100%; height: 100%; }
}

/* ---------- Command bar «از میو بپرس» ----------
   A short bottom sheet: slides up on open, back down on close. */
.ask {
  width: min(620px, calc(100% - 24px)); max-width: none; max-height: min(62vh, 520px);
  margin: auto auto 16px; padding: 0;
  display: none; flex-direction: column;
  color: var(--ds-ink-1);
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-xl);
  box-shadow: var(--ds-elev-4);
  overflow: hidden;
}
.ask[open] { display: flex; animation: ask-up 320ms var(--ds-ease-out) both; }
.ask.is-closing { animation: ask-down 240ms cubic-bezier(.4, 0, 1, 1) both; }
.ask::backdrop { background: var(--ds-scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ask[open]::backdrop { animation: ask-fade-in 320ms var(--ds-ease-out) both; }
.ask.is-closing::backdrop { animation: ask-fade-out 240ms ease-in both; }
@keyframes ask-up { from { transform: translateY(calc(100% + 24px)); } to { transform: none; } }
@keyframes ask-down { from { transform: none; } to { transform: translateY(calc(100% + 24px)); } }
@keyframes ask-fade-in { from { opacity: 0; } }
@keyframes ask-fade-out { to { opacity: 0; } }

.ask__grab { display: block; flex: none; width: 36px; height: 4px; margin: 8px auto 0; background: var(--ds-line-2); border-radius: 99px; }

.ask__bar { display: flex; align-items: center; gap: var(--ds-space-2); padding: var(--ds-space-2) var(--ds-space-3) var(--ds-space-2); }
.ask__mio { width: 36px; height: 36px; flex: none; object-fit: cover; background: var(--ds-ai-soft); border-radius: 50%; }
.ask__field {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: var(--ds-space-1);
  padding-inline: var(--ds-space-3) 6px;
  background: var(--ds-surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--ds-radius-md);
  transition: border-color var(--ds-dur-2) var(--ds-ease-out), background-color var(--ds-dur-2) var(--ds-ease-out);
}
.ask__field:focus-within { background: var(--ds-surface-1); border-color: var(--ds-ai); }
.ask__input {
  flex: 1 1 auto; min-width: 0; height: 46px;
  color: var(--ds-ink-1); background: transparent;
  border: 0; outline: 0;
  font: var(--ds-weight-medium) var(--ds-text-md) / 1.4 var(--ds-font-sans);
}
.ask__input::placeholder { color: var(--ds-ink-3); font-weight: var(--ds-weight-regular); }
.ask__input::-webkit-search-cancel-button { display: none; }
.ask__input:focus-visible { outline: 0; }
.ask__clear {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; padding: 0;
  color: var(--ds-ink-2); background: var(--ds-surface-3); border: 0; border-radius: 50%; cursor: pointer;
}
.ask__clear[hidden] { display: none; }
.ask__clear svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.ask__clear:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.ask__close { flex: none; width: 44px; height: 44px; }

.ask__alert {
  margin: var(--ds-space-1) var(--ds-space-3) 0;
  padding: var(--ds-space-2) var(--ds-space-3);
  display: flex; gap: var(--ds-space-2); align-items: flex-start;
  color: var(--ds-danger);
  background: var(--ds-danger-soft);
  border-radius: var(--ds-radius-md);
  font-size: var(--ds-text-sm); line-height: 1.7;
}
.ask__alert[hidden] { display: none; }
.ask__alert svg { width: 20px; height: 20px; flex: none; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask__alert strong { display: block; }

.ask__body { flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 0 var(--ds-space-2) var(--ds-space-2); scrollbar-width: thin; scrollbar-color: var(--ds-line-2) transparent; }
.ask__list { margin: 0; padding: 0; list-style: none; }
.ask__group { margin-top: var(--ds-space-2); }
.ask__glabel { margin: 0; padding: var(--ds-space-1) var(--ds-space-2); color: var(--ds-ink-3); font: var(--ds-weight-bold) var(--ds-text-xs) / 1.4 var(--ds-font-sans); }
.ask__group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }

.ask__opt {
  display: flex; align-items: center; gap: var(--ds-space-3);
  min-height: 48px; padding: 6px var(--ds-space-2);
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
  scroll-margin: 8px;
}
.ask__opt:hover { background: var(--ds-surface-2); }
.ask__opt[aria-selected="true"] { background: var(--ds-ai-soft); }
.ask__ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; color: var(--ds-ink-2); background: var(--ds-surface-2); border-radius: 10px; }
.ask__opt[aria-selected="true"] .ask__ic { color: var(--ds-ai); background: var(--ds-surface-1); }
.ask__ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ask__txt { display: grid; min-width: 0; flex: 1 1 auto; line-height: 1.45; }
.ask__txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--ds-weight-bold); font-size: var(--ds-text-sm); }
.ask__txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-ink-3); font-size: var(--ds-text-xs); }
.ask__go { flex: none; display: inline-flex; color: var(--ds-ink-3); opacity: 0; }
.ask__go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); }
.ask__opt:hover .ask__go, .ask__opt[aria-selected="true"] .ask__go { opacity: 1; }
.ask__opt--danger .ask__ic, .ask__opt--danger[aria-selected="true"] .ask__ic { color: var(--ds-danger); background: var(--ds-danger-soft); }
.ask__opt--danger b { color: var(--ds-danger); }
.ask__opt--danger[aria-selected="true"] { background: var(--ds-danger-soft); }
.ask__opt--mio .ask__ic, .ask__opt--mio[aria-selected="true"] .ask__ic { color: var(--ds-ink-inverse); background: var(--ds-ai-grad); }
.ask__opt--due .ask__ic { color: var(--ds-warning); background: var(--ds-warning-soft); }

/* Quick actions: one scrollable row of pastel chips. */
.ask__group--chips .ask__glabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ask__group--chips ul { display: flex; gap: var(--ds-space-2); overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.ask__group--chips ul::-webkit-scrollbar { display: none; }
.ask__chip {
  --chip: var(--ds-joy-mint, var(--ds-success-soft));
  flex: none; display: inline-flex; align-items: center; gap: var(--ds-space-2);
  min-height: 44px; padding: 0 var(--ds-space-3) 0 5px;
  background: var(--chip);
  border: 1.5px solid transparent;
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
}
.ask__chip:nth-child(4n + 2) { --chip: var(--ds-joy-sky, var(--ds-info-soft)); }
.ask__chip:nth-child(4n + 3) { --chip: var(--ds-joy-sun, var(--ds-warning-soft)); }
.ask__chip:nth-child(4n) { --chip: var(--ds-joy-peach, var(--ds-pet-soft)); }
.ask__chip .ask__ic { width: 30px; height: 30px; color: var(--ds-ink-1); background: var(--ds-surface-1); border-radius: 50%; }
.ask__chip .ask__ic svg { width: 16px; height: 16px; }
.ask__chip .ask__txt b { font-size: var(--ds-text-sm); }
.ask__chip:hover { border-color: var(--ds-line-2); }
.ask__chip[aria-selected="true"] { border-color: var(--ds-ai); }

.ask__empty { margin: var(--ds-space-2) var(--ds-space-2) 0; color: var(--ds-ink-2); font-size: var(--ds-text-sm); line-height: 1.8; }
.ask__empty[hidden] { display: none; }
.ask__empty p { margin: 0 0 var(--ds-space-2); }
.ask__try { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.ask__try .ds-chip { min-height: 44px; padding-inline: var(--ds-space-3); color: var(--ds-ink-1); background: var(--ds-surface-2); border: 1px solid var(--ds-line); cursor: pointer; font-size: var(--ds-text-sm); }
.ask__try .ds-chip:hover { background: var(--ds-ai-soft); }
.ask__try .ds-chip:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }

.ask__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-2) var(--ds-space-3); flex-wrap: wrap;
  padding: var(--ds-space-2) var(--ds-space-4);
  color: var(--ds-ink-3);
  border-top: 1px solid var(--ds-line);
  font-size: var(--ds-text-xs);
}
.ask__foot svg { width: 13px; height: 13px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask__sos { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 var(--ds-space-3); color: var(--ds-danger); background: var(--ds-danger-soft); border-radius: var(--ds-radius-pill); font-weight: var(--ds-weight-bold); text-decoration: none; }
.ask__sos b { direction: ltr; unicode-bidi: isolate; }
.ask__sos:hover { text-decoration: underline; }
.ask__sos:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }

@media (max-width: 640px) {
  .ask {
    width: 100%; max-height: 72dvh;
    margin: auto 0 0;
    border-width: 1px 0 0; border-radius: var(--ds-radius-xl) var(--ds-radius-xl) 0 0;
  }
  .ask__input { font-size: 16px; }
  .ask__foot { padding-bottom: calc(var(--ds-space-2) + env(safe-area-inset-bottom)); }
}

/* ---------- Inbox ---------- */
.inbox .ds-sheet__body { padding-top: var(--ds-space-2); }
.inbox__list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--ds-space-2); }
.inbox__row { position: relative; min-width: 0; }
.inbox__item {
  display: flex; align-items: center; gap: var(--ds-space-3);
  width: 100%; min-height: 60px; padding: var(--ds-space-3);
  color: var(--ds-ink-1); background: var(--ds-surface-1);
  border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md);
  text-align: start; font: inherit; cursor: pointer;
}
.inbox__item:hover { background: var(--ds-surface-2); }
.inbox__item.is-new { border-color: var(--ds-ai-line); box-shadow: inset 3px 0 0 var(--ds-ai); }
.inbox__item .ask__ic { flex: none; }
.inbox__item--due .ask__ic { color: var(--ds-warning); background: var(--ds-warning-soft); }
.inbox__item--care .ask__ic { color: var(--ds-success); background: var(--ds-success-soft); }
.inbox__item--ai .ask__ic { color: var(--ds-ai); background: var(--ds-ai-soft); }
.inbox__item em { margin-top: 3px; color: var(--ds-ai); font: normal var(--ds-weight-bold) 11px / 1.4 var(--ds-font-sans); }
.inbox__row:has(.inbox__dismiss) .inbox__item { padding-inline-end: 52px; }
.inbox__dismiss {
  position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--ds-ink-3); background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.inbox__dismiss:hover { color: var(--ds-ink-1); background: var(--ds-surface-3); }
.inbox__dismiss:focus-visible, .inbox__permission:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.inbox__dismiss svg, .inbox__permission > svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.inbox__permission {
  width: 100%; margin-top: var(--ds-space-4); padding: var(--ds-space-3);
  display: flex; align-items: center; gap: var(--ds-space-3);
  color: var(--ds-ink-2); background: var(--ds-surface-2);
  border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); text-align: start;
}
.inbox__permission--button { min-height: 64px; font: inherit; cursor: pointer; }
.inbox__permission--button:hover { border-color: var(--ds-ai-line); background: var(--ds-ai-soft); }
.inbox__permission.is-on { color: var(--ds-success); background: var(--ds-success-soft); border-color: transparent; }
.inbox__permission > svg { width: 22px; height: 22px; flex: none; }
.inbox__permission span { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.inbox__permission b { color: var(--ds-ink-1); font-size: var(--ds-text-sm); }
.inbox__permission small { color: var(--ds-ink-3); font-size: var(--ds-text-xs); line-height: 1.6; }
.inbox__permission-off {
  flex: none; min-height: 34px; padding: 0 12px;
  color: var(--ds-ink-2); background: color-mix(in srgb, #fff 70%, transparent);
  border: 1px solid var(--ds-line, rgba(19,34,56,.12)); border-radius: 999px;
  font: 700 .72rem/1 var(--ds-font, inherit); cursor: pointer;
}
.inbox__permission-off:hover { border-color: var(--ds-danger, #c44); color: var(--ds-danger, #c44); }
.inbox__permission-off:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.inbox__loading { display: grid; gap: var(--ds-space-3); padding: var(--ds-space-6) 0; }
.inbox__loading .ds-skeleton:first-child { height: 64px; border-radius: var(--ds-radius-md); }
.inbox__note { margin: var(--ds-space-4) 0 0; color: var(--ds-ink-3); font-size: var(--ds-text-xs); line-height: 1.7; }

/* ---------- Contextual «از میو بپرس» — slim chip row, not a banner ---------- */
.ds-ask-inline {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px 8px;
  margin: 10px 0 4px;
  padding: 4px 4px 4px 8px;
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  box-shadow: none;
}
.ds-ask-inline__lead {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--ds-ink-2);
  font: var(--ds-weight-bold) 12px / 1.2 var(--ds-font-sans);
  white-space: nowrap;
  text-decoration: none;
}
.ds-ask-inline__lead .ds-askbtn__spark { width: 12px; height: 12px; }
.ds-ask-inline__face {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 28%;
  background: #14141c;
}
.ds-ask-inline__chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ds-ask-inline__chips::-webkit-scrollbar { display: none; }
.ds-ask-inline button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  color: var(--ds-ink-2);
  background: var(--ds-surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 12px / 1 var(--ds-font-sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--ds-dur-2) var(--ds-ease-out), background-color var(--ds-dur-2) var(--ds-ease-out), border-color var(--ds-dur-2) var(--ds-ease-out);
}
.ds-ask-inline button:hover { color: var(--ds-ink-1); background: var(--ds-surface-1); border-color: var(--ds-line-2); }
.ds-ask-inline button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }

.ds-flash { outline: 3px solid var(--ds-ai); outline-offset: 4px; border-radius: var(--ds-radius-lg); transition: outline-color var(--ds-dur-4) var(--ds-ease-out); }

/* ---------- Page entrance ---------- */
@media (prefers-reduced-motion: no-preference) {
  body:not(.is-landing) .page.is-active { animation: ds-page-in var(--ds-dur-3) var(--ds-ease-out) both; }
  body.is-mio-app .page.is-active { animation: none; transform: none; }
}

/* ---------- Mio page playfield (live 3D walks on the page) ---------- */
.mio-playfield {
  position: fixed; inset: auto 0 0 0; z-index: 155;
  width: 100%; height: min(36vh, 280px);
  pointer-events: none;
  background: transparent;
  transition: height 320ms var(--ds-ease-out), bottom 320ms var(--ds-ease-out);
}
.mio-playfield[hidden] { display: none; }
.mio-playfield .mio-stage {
  pointer-events: auto;
  width: 100%; height: 100%;
  filter: drop-shadow(0 14px 18px rgba(23, 40, 64, .18));
  transition: transform 280ms cubic-bezier(.22, 1.2, .36, 1);
}
.mio-playfield .mio-stage > canvas { background: transparent; }
.mio-playfield .mio-bubble { z-index: 2; max-width: min(260px, 68vw); }
/* Quiet companion: compact strip so the page stays readable. */
.mio-playfield.is-companion {
  height: min(20vh, 156px);
  bottom: calc(8px + env(safe-area-inset-bottom));
}
.mio-playfield.is-companion .mio-stage {
  cursor: pointer;
  transform: scale(.92);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 10px 14px rgba(23, 40, 64, .16));
  transition: transform 220ms cubic-bezier(.22, 1.2, .36, 1), filter 220ms ease;
}
.mio-playfield.is-companion .mio-stage:focus-visible {
  outline: 3px solid var(--b-mint, #20c9b5);
  outline-offset: 4px;
  border-radius: 28px;
}
.mio-playfield.is-companion .mio-bubble {
  max-width: min(240px, 70vw);
  padding: 8px 12px 9px;
  background: color-mix(in srgb, #fffdf8 96%, var(--b-mint, #20c9b5));
  border: 1px solid color-mix(in srgb, var(--b-mint, #20c9b5) 22%, rgba(34, 48, 74, .1));
  border-radius: 16px 16px 5px 16px;
  box-shadow: 0 10px 22px -14px rgba(34, 48, 74, .35);
  font: 700 .8rem/1.65 var(--ds-font-sans, var(--font));
}
.mio-playfield.is-companion.is-walking-down .mio-stage { transform: scale(.92) translateX(-6px) rotate(-1.5deg); }
.mio-playfield.is-companion.is-walking-up .mio-stage { transform: scale(.92) translateX(6px) rotate(1.5deg); }
.mio-playfield.is-companion.is-pressed .mio-stage { transform: scale(.88); }
.mio-playfield.is-companion.is-petted .mio-stage {
  animation: mio-petted 420ms cubic-bezier(.22, 1.2, .36, 1) both;
}
.mio-playfield:not(.is-companion).is-walking-down .mio-stage { transform: translateX(-8px) rotate(-2deg); }
.mio-playfield:not(.is-companion).is-walking-up .mio-stage { transform: translateX(8px) rotate(2deg); }
.mio-playfield:not(.is-companion).is-pressed .mio-stage { transform: scale(.94); }
.mio-playfield.is-emerging .mio-stage {
  animation: mio-emerge-happy 900ms cubic-bezier(.18, 1.35, .32, 1) both;
}
.mio-playfield.is-companion.is-emerging .mio-stage {
  animation: mio-emerge-happy-soft 900ms cubic-bezier(.18, 1.35, .32, 1) both;
}
.mio-playfield.is-tumbling .mio-stage {
  animation: mio-tumble 700ms cubic-bezier(.4, 0, .2, 1) both;
}
.mio-playfield.is-companion.is-tumbling .mio-stage {
  animation: mio-tumble-soft 700ms cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes mio-emerge-happy {
  0% { transform: translate(0, 18px) scale(.72) rotate(-6deg); opacity: .85; }
  38% { transform: translate(-10px, -14px) scale(1.08) rotate(4deg); }
  62% { transform: translate(8px, 6px) scale(.96) rotate(-2deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0); opacity: 1; }
}
@keyframes mio-emerge-happy-soft {
  0% { transform: translate(0, 10px) scale(.78) rotate(-4deg); }
  40% { transform: translate(-6px, -8px) scale(.98) rotate(3deg); }
  100% { transform: translate(0, 0) scale(.92) rotate(0); }
}
@keyframes mio-petted {
  0% { transform: scale(.92); }
  35% { transform: scale(.84) translateY(4px) rotate(-2deg); }
  70% { transform: scale(.96) translateY(-3px) rotate(2deg); }
  100% { transform: scale(.92); }
}
@keyframes mio-tumble {
  0% { transform: translate(0, 0) rotate(0) scale(1); }
  28% { transform: translate(-18px, 22px) rotate(-18deg) scale(1.04); }
  55% { transform: translate(14px, 38px) rotate(22deg) scale(.96); }
  78% { transform: translate(-8px, 18px) rotate(-8deg) scale(1.02); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes mio-tumble-soft {
  0% { transform: translate(0, 0) rotate(0) scale(.92); }
  30% { transform: translate(-10px, 12px) rotate(-10deg) scale(.94); }
  58% { transform: translate(8px, 20px) rotate(12deg) scale(.9); }
  100% { transform: translate(0, 0) rotate(0) scale(.92); }
}
.mio-playfield__hide {
  position: absolute; top: 6px; inset-inline-end: 10px; z-index: 5;
  display: grid; place-items: center;
  width: 32px; height: 32px; margin: 0; padding: 0;
  color: color-mix(in srgb, #7a5a52 70%, #6a7a90);
  background: linear-gradient(165deg, #fffdf9 0%, #ffe8dc 100%);
  border: 1px solid color-mix(in srgb, #f0c4b0 55%, rgba(34, 48, 74, .08));
  border-radius: 50%;
  box-shadow: 0 6px 14px -10px rgba(184, 87, 62, .35);
  font: 700 1rem/1 var(--ds-font-sans, sans-serif);
  cursor: pointer;
  pointer-events: auto;
  opacity: .78;
  transition: opacity .18s ease, transform .18s ease, color .18s ease;
}
.mio-playfield__hide:hover { opacity: 1; color: var(--b-peach-ink, #b8392d); transform: scale(1.06); }
.mio-playfield__hide:focus-visible { outline: 3px solid var(--b-mint, #20c9b5); outline-offset: 2px; opacity: 1; }
.mio-playfield:not(.is-companion) .mio-playfield__hide { display: none; }
.mio-playfield__ask {
  position: absolute;
  z-index: 6;
  inset-inline-start: max(10px, env(safe-area-inset-left));
  bottom: calc(100% - 8px);
  width: min(268px, calc(100vw - 28px));
  display: grid;
  gap: 8px;
  padding: 10px 12px 11px;
  color: var(--ds-ink-1, #22304a);
  background: linear-gradient(165deg, #fffdf9 0%, #eefaf4 55%, #fff6ea 100%);
  border: 1px solid color-mix(in srgb, #b8e8d8 45%, rgba(34, 48, 74, .08));
  border-radius: 22px;
  box-shadow: 0 14px 28px -18px rgba(34, 48, 74, .35);
  pointer-events: auto;
  animation: mio-ask-in 280ms cubic-bezier(.22, 1.2, .36, 1) both;
}
.mio-playfield__ask[hidden] { display: none; }
.mio-playfield__ask-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.mio-playfield__ask-title {
  margin: 0;
  font: 800 .78rem/1.4 var(--ds-font-sans, sans-serif);
  color: color-mix(in srgb, var(--ds-ink-1, #22304a) 88%, var(--b-mint, #20c9b5));
}
.mio-playfield__ask-x {
  display: grid; place-items: center;
  width: 28px; height: 28px; margin: 0; padding: 0;
  color: var(--ds-ink-3, #6a7a90);
  background: color-mix(in srgb, #fff 70%, transparent);
  border: 1px solid color-mix(in srgb, rgba(34, 48, 74, .08), transparent);
  border-radius: 50%;
  font: 700 .9rem/1 var(--ds-font-sans, sans-serif);
  cursor: pointer;
}
.mio-playfield__ask-x:hover { color: var(--b-peach-ink, #b8392d); }
.mio-playfield__ask-x:focus-visible { outline: 3px solid var(--b-mint, #20c9b5); outline-offset: 2px; }
.mio-playfield__ask-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: end; }
.mio-playfield__ask-input {
  width: 100%; min-height: 44px; max-height: 88px; margin: 0; padding: 8px 10px;
  resize: none; box-sizing: border-box;
  color: inherit;
  background: color-mix(in srgb, #fff 88%, #e8faf6);
  border: 1px solid color-mix(in srgb, #c9e8de 50%, rgba(34, 48, 74, .1));
  border-radius: 14px;
  font: 600 .8rem/1.55 var(--ds-font-sans, sans-serif);
}
.mio-playfield__ask-input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--b-mint, #20c9b5) 70%, white);
  outline-offset: 1px;
}
.mio-playfield__ask-send {
  min-height: 44px; min-width: 52px; padding: 0 12px; margin: 0;
  color: #fff;
  background: linear-gradient(165deg, #35d6c2, #1db9a7);
  border: 0; border-radius: 14px;
  font: 800 .75rem/1 var(--ds-font-sans, sans-serif);
  cursor: pointer;
}
.mio-playfield__ask-send:hover { filter: brightness(1.04); }
.mio-playfield__ask-send:focus-visible { outline: 3px solid var(--b-mint, #20c9b5); outline-offset: 2px; }
.mio-playfield__ask-reply {
  margin: 0; padding: 8px 10px;
  background: color-mix(in srgb, #fff 92%, #ffe8dc);
  border: 1px solid color-mix(in srgb, #f0c4b0 35%, rgba(34, 48, 74, .06));
  border-radius: 14px 14px 6px 14px;
  font: 600 .76rem/1.6 var(--ds-font-sans, sans-serif);
  max-height: 7.5rem; overflow: auto;
}
.mio-playfield__ask-reply[data-safety="emergency"] {
  background: #fff1f2;
  border-color: color-mix(in srgb, #d93a4a 22%, transparent);
}
.mio-playfield__ask-hint {
  margin: 0;
  color: var(--ds-ink-3, #6a7a90);
  font: 600 .68rem/1.45 var(--ds-font-sans, sans-serif);
}
@keyframes mio-ask-in {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.mio-playfield.is-asking { height: min(28vh, 200px); }
.mio-playfield__bursts {
  position: absolute; top: 42%; left: 50%; z-index: 4;
  width: 0; height: 0; pointer-events: none;
}
.mio-playfield__burst {
  position: absolute; font-size: .85rem; line-height: 1;
  color: color-mix(in srgb, var(--b-mint, #20c9b5) 55%, #ffbe4f);
  animation: mio-burst .9s cubic-bezier(.22, 1, .36, 1) forwards;
}
@keyframes mio-burst {
  0% { opacity: 0; transform: translate(0, 0) scale(.4) rotate(0); }
  18% { opacity: .85; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.05) rotate(var(--rot)); }
}
.mio-companion-recall {
  position: fixed;
  inset-inline-end: max(10px, env(safe-area-inset-right));
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 160;
  display: grid; place-items: center;
  width: 52px; height: 52px; padding: 0;
  background: linear-gradient(160deg, #fffdf8, #e8faf6);
  border: 2px solid color-mix(in srgb, var(--b-mint, #20c9b5) 48%, white);
  border-radius: 50%;
  box-shadow: 0 8px 20px -12px rgba(10, 113, 102, .45);
  cursor: pointer;
  animation: mio-recall-in 420ms cubic-bezier(.22, 1.2, .36, 1) both;
}
.mio-companion-recall[hidden] { display: none; }
.mio-companion-recall img {
  width: 38px; height: 38px; object-fit: contain;
  border-radius: 50%;
  animation: mio-recall-bob 2.8s ease-in-out infinite;
}
.mio-companion-recall:hover { transform: translateY(-2px); }
.mio-companion-recall:focus-visible { outline: 3px solid var(--b-mint, #20c9b5); outline-offset: 3px; }
@keyframes mio-recall-in { from { opacity: 0; transform: scale(.7) translateY(12px); } }
@keyframes mio-recall-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
body.is-mio-roaming .pn-stage.mio-slot { opacity: .48; filter: grayscale(.08); }
body.is-mio-roaming .pn-stage.mio-slot > .pn-scene { opacity: .6; }
body.is-mio-roaming .mio-dock { display: none; }
body.is-mio-roaming .mio-nav { z-index: 156; }
body.is-mio-companion .pn-stage.mio-slot { opacity: .62; }
body.is-mio-companion .pn-mio-tour { opacity: .92; }
body.is-mio-companion-tucked .pn-mio-tour { opacity: .78; }

/* ---------- Mio panel tour card (spotlight + copy; Mio himself is on the playfield) ---------- */
.mio-tour {
  position: fixed; inset: 0; z-index: 158;
  display: grid; place-items: end center;
  padding: 16px 16px calc(min(36vh, 280px) + 10px);
  background: transparent;
  pointer-events: none;
}
.mio-tour[hidden] { display: none; }
.mio-tour__spot {
  position: fixed; z-index: 1; border-radius: 20px;
  box-shadow: 0 0 0 9999px color-mix(in srgb, #102038 28%, transparent);
  outline: 2px solid color-mix(in srgb, #1db9a7 65%, white);
  transition: top .28s ease, left .28s ease, width .28s ease, height .28s ease, opacity .2s ease;
  pointer-events: none;
}
.mio-tour__card {
  position: relative; z-index: 2; width: min(400px, 100%);
  display: grid; gap: 10px;
  padding: 14px 16px; color: var(--ds-ink-1); background: color-mix(in srgb, var(--ds-surface-1) 96%, transparent);
  border: 1px solid var(--ds-line); border-radius: 20px;
  box-shadow: var(--ds-elev-4);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  animation: mio-more-up 280ms var(--ds-ease-out) both;
}
.mio-tour__text { margin: 0; font: 700 .88rem/1.7 var(--ds-font-sans); }
.mio-tour__actions { display: flex; gap: 8px; justify-content: flex-end; }
.mio-tour__actions button {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ds-line);
  font: 800 .8rem/1 var(--ds-font-sans); cursor: pointer;
}
.mio-tour__skip { color: var(--ds-ink-2); background: var(--ds-surface-2); }
.mio-tour__next { color: var(--ds-on-action); background: var(--ds-action); border-color: transparent; }
.mio-tour__dots { display: flex; justify-content: center; gap: 6px; }
.mio-tour__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ds-line-2); }
.mio-tour__dots i.is-on { background: var(--ds-ai); width: 18px; border-radius: 99px; }
.is-tour-focus { position: relative; z-index: 157; border-radius: 20px; }
@media (max-width: 760px) {
  .mio-playfield { height: min(32vh, 220px); bottom: calc(78px + env(safe-area-inset-bottom)); }
  .mio-playfield.is-companion { height: min(17vh, 128px); bottom: calc(82px + env(safe-area-inset-bottom)); }
  .mio-playfield.is-asking { height: min(24vh, 168px); }
  .mio-playfield__ask {
    width: min(240px, calc(100vw - 24px));
    inset-inline-start: 8px;
    bottom: calc(100% - 4px);
    padding: 9px 10px 10px;
  }
  .mio-companion-recall { bottom: calc(96px + env(safe-area-inset-bottom)); width: 48px; height: 48px; }
  .mio-companion-recall img { width: 34px; height: 34px; }
  .mio-tour { padding-bottom: calc(min(32vh, 220px) + 86px + env(safe-area-inset-bottom)); }
  .mio-playfield.is-companion .mio-bubble { max-width: min(220px, 78vw); font-size: .76rem; }
}
@media (prefers-reduced-motion: reduce) {
  .mio-tour__card, .mio-playfield .mio-stage, .mio-playfield.is-tumbling .mio-stage,
  .mio-playfield.is-emerging .mio-stage, .mio-playfield.is-companion.is-petted .mio-stage,
  .mio-playfield__burst, .mio-playfield__ask, .mio-playfield__hide,
  .mio-companion-recall, .mio-companion-recall img {
    animation: none; transition: none; transform: none;
  }
  .mio-playfield.is-companion .mio-stage { transform: scale(.92); }
  .mio-playfield__hide:hover { transform: none; }
}
@keyframes ds-page-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .ds-askbtn, .mobile-nav__orb { transition: none; }
  .ask[open], .page { animation: none; }
  .ask.is-closing, .ask[open]::backdrop, .ask.is-closing::backdrop { animation: none; }
  .ask__field { transition: none; }
}

/* ---------- Dark mode touches for the frame ---------- */
:root[data-theme="dark"] .site-footer { background: var(--ds-surface-1); color: var(--ds-ink-2); border-top-color: var(--ds-line); }
:root[data-theme="dark"] .toast { color: var(--ds-bg); background: var(--ds-ink-1); }
:root[data-theme="dark"] .cart-drawer { color: var(--ds-ink-1); background: var(--ds-bg); }
