/* One fox, a quiet note, or an intentional conversation. */
body[data-companion] {
  --ec-paper: #f8eddf;
  --ec-ink: #302317;
  --ec-muted: #75634f;
  --ec-lime: #ddec75;
  --ec-line: #c6b39a;
  --ec-nav-height: 72px;
  --ec-content-clearance: 132px;
  --ec-dock-right: max(16px, calc((100vw - 560px) / 2 + 16px));
}
/* The body already reserves the tab bar. Add only the remaining character clearance. */
html:has(body[data-companion]) { scroll-padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
html body.apppage[data-v14][data-companion] #content {
  padding-bottom: max(12px, calc(var(--ec-content-clearance) + env(safe-area-inset-bottom) - var(--v14-tab-space,72px))) !important;
}
body[data-companion] #content :is(button,input,select,textarea,summary) {
  scroll-margin-bottom: calc(var(--ec-content-clearance) + env(safe-area-inset-bottom));
  scroll-margin-top: calc(var(--v14-header-height,64px) + 12px);
}
html body.apppage[data-v14][data-companion] > header nav { display: none !important; }
html body[data-companion] #status { pointer-events: none; bottom: calc(var(--ec-content-clearance) + 12px + env(safe-area-inset-bottom)); }
html body.apppage[data-v14][data-companion] > header .mast { display: flex !important; justify-content: space-between; transform: none !important; inset: auto !important; margin: 0 auto !important; }
html body.apppage[data-v14][data-companion] > header .mast-tools { display: none !important; }
html body.apppage[data-v14][data-companion] > header .mast .logo { position: static !important; transform: none !important; order: 0; margin-right: auto !important; }
html body.apppage[data-v14][data-companion] > header .v14-bag-open { order: 2; margin-left: auto !important; }
html body.apppage[data-v14][data-companion] nav.bottom > a::before,
html body.apppage[data-v14][data-companion] nav.bottom > a::after { display: none !important; content: none !important; }
html body.apppage[data-v14][data-companion] nav.bottom {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) 90px minmax(0,1fr) minmax(0,1fr) !important;
  height: calc(var(--ec-nav-height) + env(safe-area-inset-bottom)) !important;
  padding: 5px 8px calc(7px + env(safe-area-inset-bottom)) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none;
  overflow: visible;
  isolation: isolate;
  align-items: center;
}
html body.apppage[data-v14][data-companion] nav.bottom::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 16px 16px 0 0;
  background: var(--ec-paper);
  /* A fixed-width, tangent shoulder joins the flat bar to the fox's shallow well.
     Separate side/bottom masks keep this contour unchanged at every dock width. */
  --ec-dock-well: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='56' viewBox='0 0 160 56'%3E%3Cpath d='M0 0C18 0 19 12 29 25C40 40 57 46 80 46C103 46 120 40 131 25C141 12 142 0 160 0V56H0Z' fill='black'/%3E%3C/svg%3E");
  -webkit-mask: linear-gradient(#000 0 0) left top / calc(50% - 79px) 100% no-repeat,
                var(--ec-dock-well) center top / 160px 56px no-repeat,
                linear-gradient(#000 0 0) right top / calc(50% - 79px) 100% no-repeat,
                linear-gradient(#000 0 0) center bottom / 160px calc(100% - 55px) no-repeat;
  mask: linear-gradient(#000 0 0) left top / calc(50% - 79px) 100% no-repeat,
        var(--ec-dock-well) center top / 160px 56px no-repeat,
        linear-gradient(#000 0 0) right top / calc(50% - 79px) 100% no-repeat,
        linear-gradient(#000 0 0) center bottom / 160px calc(100% - 55px) no-repeat;
  filter: drop-shadow(0 -3px 9px #1c120e24);
  pointer-events: none;
}
html body.apppage[data-v14][data-companion] nav.bottom > a,
body[data-companion] .ec-panel-footer > a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: 54px;
  gap: 4px;
  padding: 4px 0;
  color: var(--ec-ink) !important;
  background: transparent !important;
  font: 400 12px/1.2 var(--v14-font, sans-serif) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-decoration: none;
  border: 0;
  border-radius: 12px;
}
html body.apppage[data-v14][data-companion] nav.bottom > a svg,
body[data-companion] .ec-panel-footer > a svg {
  display: block;
  width: 23px;
  height: 23px;
  color: var(--ec-ink);
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}
html body.apppage[data-v14][data-companion] nav.bottom > a.current,
body[data-companion] .ec-panel-footer > a.current {
  font-weight: 600 !important;
  text-decoration: underline;
  text-decoration-color: var(--ec-lime);
  text-decoration-thickness: 7px;
  text-underline-offset: -3px;
  text-decoration-skip-ink: none;
}
html body.apppage[data-v14][data-companion] nav.bottom > a.current svg,
body[data-companion] .ec-panel-footer > a.current svg {
  fill: var(--ec-lime) !important;
  stroke: var(--ec-ink) !important;
}
html body[data-companion] .ec-panel-footer > a::after {
  display: none !important;
  content: none !important;
}
html body.apppage[data-v14][data-companion] nav.bottom .v14-fox-entry {
  display: block !important;
  position: relative;
  width: 90px;
  height: 60px;
  min-height: 44px;
  margin: 0 auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body[data-companion] .ec-mascot {
  display: block;
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 126px;
  height: 112px;
  margin-left: -63px;
  overflow: hidden;
  border-radius: 0 0 48% 48%;
  pointer-events: none;
  transform-origin: center bottom;
}
html body.apppage[data-v14][data-companion] .ec-mascot .ec-mascot-image {
  display: block;
  position: absolute;
  inset: auto;
  top: -68px;
  left: -13px;
  width: 152px;
  height: 228px;
  min-width: 152px;
  max-width: none;
  margin: 0;
  padding: 0;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  filter: drop-shadow(0 0 3px #ff8c3338);
}
body[data-companion] .v14-fox-entry .ec-mascot { pointer-events: auto; cursor: pointer; }
body[data-companion] .v14-fox-entry:hover .ec-mascot { transform: translateY(-2px); }
body[data-companion].ec-suspended .v14-fox-entry .ec-mascot,
body[data-companion].ec-suspended #ec-advice { visibility: hidden; }
body[data-companion].ec-panel-open { overflow: hidden !important; }
body[data-companion] :is(.ec-panel, .ec-advice) *,
body[data-companion] :is(.ec-panel, .ec-advice) { box-sizing: border-box; }
body[data-companion] #ec-advice {
  position: fixed;
  z-index: 76;
  right: var(--ec-dock-right);
  bottom: calc(138px + env(safe-area-inset-bottom));
  width: min(300px, calc(100vw - 32px));
  margin: 0;
  padding: 17px 40px 17px 20px;
  color: var(--ec-ink);
  background: var(--ec-paper);
  border: 1px solid #fff7e9;
  border-radius: 23px;
  box-shadow: 0 8px 28px #190e0a26;
  animation: ec-note-in 180ms ease-out;
}
body[data-companion] #ec-advice::after {
  content: '';
  position: absolute;
  left: calc(100% - 50vw + var(--ec-dock-right));
  bottom: -9px;
  width: 17px;
  height: 19px;
  background: var(--ec-paper);
  border-radius: 0 0 4px 0;
  transform: translateX(-50%) skewY(-30deg) rotate(23deg);
}
body[data-companion] .ec-advice-text {
  margin: 0;
  padding: 0;
  font: 500 16px/1.5 var(--v14-font, sans-serif);
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ec-ink);
}
body[data-companion] :is(.ec-advice-close, .ec-panel-close) {
  position: absolute;
  top: 2px;
  right: 3px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ec-ink);
  background: transparent;
  box-shadow: none;
  font: 300 27px/1 var(--v14-font, sans-serif);
  cursor: pointer;
}
body[data-companion] #ec-panel {
  position: fixed;
  inset: auto 0 0;
  width: min(560px, 100%);
  max-width: 100%;
  height: auto;
  max-height: min(680px, calc(100dvh - 150px));
  margin: 0 auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 24px 24px 0 0;
  color: var(--ec-ink);
  background: var(--ec-paper);
  box-shadow: 0 -10px 50px #1b100b30;
  font-family: var(--v14-font, sans-serif);
}
body[data-companion] #ec-panel:not([open]) { display: none; }
body[data-companion] #ec-panel[open] { display: block; }
body[data-companion] #ec-panel::backdrop { background: #160f09a3; }
body[data-companion] .ec-panel-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: inherit;
  min-width: 0;
  border-radius: inherit;
}
body[data-companion] .ec-panel-perch {
  position: absolute;
  z-index: -1;
  bottom: calc(100% - 7px);
  left: 50%;
  width: 136px;
  height: 128px;
  transform: translateX(-50%);
  pointer-events: none;
}
body[data-companion] .ec-panel-perch .ec-mascot {
  bottom: 0;
  height: 128px;
  width: 136px;
  margin-left: -68px;
  border-radius: 0;
  overflow: visible;
}
html body.apppage[data-v14][data-companion] .ec-panel-perch .ec-mascot-image {
  top: -68px;
  left: -8px;
  clip-path: inset(0 0 32px 0);
}
body[data-companion] .ec-panel-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 23px 20px 22px;
  border-radius: 24px 24px 0 0;
  background: var(--ec-paper);
  scrollbar-width: thin;
}
body[data-companion] .ec-panel-close { top: 5px; right: 5px; }
body[data-companion] .ec-context {
  padding: 0 32px 0 0;
  margin: 0 0 12px;
  color: var(--ec-muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
body[data-companion] .ec-panel-title {
  margin: 0 25px 18px 0;
  color: var(--ec-ink);
  font: 500 23px/1.35 var(--v14-display, serif);
}
body[data-companion] .ec-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  min-width: 0;
}
body[data-companion] .ec-product > div { min-width: 0; }
body[data-companion] .ec-product-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1.1;
  overflow: hidden;
  border-radius: 16px;
  background: #e7d7c3;
}
body[data-companion] .ec-product-image :is(img,picture) {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  margin: 0;
}
body[data-companion] .ec-product-name {
  margin: 0 0 9px;
  color: var(--ec-ink);
  font: 600 18px/1.45 var(--v14-font, sans-serif);
  overflow-wrap: anywhere;
}
body[data-companion] .ec-product-price { margin: 0 0 12px; color: var(--ec-ink); font-size: 20px; line-height: 1.3; }
body[data-companion] .ec-product-tags { margin: 0 0 10px; color: var(--ec-ink); font-size: 13px; }
body[data-companion] .ec-product-tags .v12-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--ec-ink); }
body[data-companion] .ec-product-tags .v12-tags :is(span,b,i,em) { color: inherit; }
body[data-companion] .ec-product-tags :is(.v12-tag,.v12-chip) { border-color: var(--ec-line); }
body[data-companion] .ec-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
body[data-companion] .ec-swatches i { display: block; width: 25px; height: 25px; border-radius: 50%; border: 1px solid #8065431a; }
body[data-companion] .ec-product-reason { margin: 15px 0 17px; color: var(--ec-ink); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
body[data-companion] .ec-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-top: 16px; }
body[data-companion] :is(.ec-primary,.ec-secondary) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1 1 120px;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--ec-ink);
  border-radius: 13px;
  background: transparent;
  color: var(--ec-ink);
  font: 600 16px/1.4 var(--v14-font, sans-serif);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
body[data-companion] .ec-primary { border-color: var(--ec-lime); background: var(--ec-lime); }
body[data-companion] .ec-shortcuts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 18px 0 0; }
body[data-companion] .ec-shortcuts > * { display: flex; align-items: center; justify-content: center; min-height: 55px; margin: 0; padding: 12px; border: 1px solid var(--ec-line); border-radius: 13px; background: transparent; color: var(--ec-ink); text-decoration: none; font: 500 15px/1.45 var(--v14-font, sans-serif); text-align: center; }
body[data-companion] .ec-section { margin: 0 0 22px; }
body[data-companion] .ec-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; color: var(--ec-ink); font-size: 16px; line-height: 1.7; }
body[data-companion] .ec-wishes { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 0; margin: 0; border: 0; }
body[data-companion] .ec-wishes legend { margin: 0 0 10px; padding: 0; color: var(--ec-muted); font-size: 13px; }
body[data-companion] .ec-wishes label { position: relative; margin: 0; padding: 0; cursor: pointer; }
body[data-companion] .ec-wishes label > span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 12px; border: 1px solid var(--ec-line); border-radius: 13px; color: var(--ec-ink); font-size: 16px; }
body[data-companion] .ec-wishes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
body[data-companion] .ec-wishes input:checked + span { border-color: var(--ec-ink); background: var(--ec-lime); font-weight: 600; }
body[data-companion] .ec-wishes input:focus-visible + span { outline: 2px solid var(--ec-ink); outline-offset: 3px; }
body[data-companion] .ec-keep { display: flex; align-items: center; gap: 9px; margin-top: 17px; min-height: 44px; font-size: 15px; color: var(--ec-ink); }
body[data-companion] .ec-keep input { width: 18px; height: 18px; accent-color: var(--ec-ink); }
body[data-companion] .ec-panel-footer {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) 74px minmax(0,1fr) minmax(0,1fr);
  align-items: center;
  flex-shrink: 0;
  min-height: calc(var(--ec-nav-height) + env(safe-area-inset-bottom));
  padding: 5px 8px calc(7px + env(safe-area-inset-bottom));
  border: 0;
  border-top: 1px solid #c6b39a70;
  background: var(--ec-paper);
}
body[data-companion] .ec-panel-collapse { display: grid; place-items: center; width: 56px; height: 48px; min-height: 44px; padding: 0; margin: auto; border: 0; border-radius: 14px; color: var(--ec-ink); background: transparent; cursor: pointer; }
body[data-companion] .ec-panel-collapse svg { width: 23px; height: 23px; stroke: currentColor; stroke-width: 1.7; fill: none; }
body[data-companion] :is(.ec-panel,.ec-advice) :is(button,a):focus-visible { outline: 2px solid var(--ec-ink); outline-offset: 3px; }
@keyframes ec-note-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 350px) {
  html body.apppage[data-v14][data-companion] nav.bottom { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 82px minmax(0,1fr) minmax(0,1fr) !important; padding-left: 5px !important; padding-right: 5px !important; }
  html body.apppage[data-v14][data-companion] nav.bottom .v14-fox-entry { width: 82px; }
  body[data-companion] .ec-panel-content { padding: 22px 16px 18px; }
  body[data-companion] .ec-product { gap: 12px; }
  body[data-companion] .ec-product-name { font-size: 16px; }
  body[data-companion] .ec-panel-title { font-size: 21px; }
}
@media (min-width: 761px) {
  body[data-companion] { --ec-content-clearance: 148px; }
  html:has(body[data-companion]) { scroll-padding-bottom: 148px; }
  html body.apppage[data-v14][data-companion] nav.bottom { width: 560px !important; max-width: calc(100% - 48px) !important; left: 50% !important; right: auto !important; transform: translateX(-50%) !important; bottom: 16px !important; height: 72px !important; padding-bottom: 7px !important; }
  html body.apppage[data-v14][data-companion] nav.bottom::before { border-radius: 19px; }
  body[data-companion] #ec-advice { bottom: 154px; }
  body[data-companion] #ec-panel { bottom: 16px; border-radius: 24px; max-height: min(680px, calc(100dvh - 166px)); }
  body[data-companion] .ec-panel-footer { border-radius: 0 0 24px 24px; padding-bottom: 7px; min-height: 72px; }
  body[data-companion] .ec-panel-content { padding: 25px 25px 23px; }
  body[data-companion] .ec-product-image { aspect-ratio: 1.1; }
  body[data-companion] .ec-product-name { font-size: 20px; }
  body[data-companion] .ec-product { gap: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-companion] #ec-advice { animation: none; }
  body[data-companion] .v14-fox-entry:hover .ec-mascot { transform: none; }
}

/* Keep the companion's hierarchy intact beside the older Chinese type rules. */
html body[data-companion] :is(.ec-advice-close,.ec-panel-close) { font-size: 26px !important; line-height: 1 !important; font-weight: 300 !important; }
html body[data-companion] .ec-advice-text { font-size: 16px !important; line-height: 1.5 !important; font-weight: 500 !important; }
html body[data-companion] .ec-context { font-size: 13px !important; line-height: 1.5 !important; }
html body[data-companion] .ec-product-price { font-size: 20px !important; line-height: 1.3 !important; }
html body[data-companion] .ec-product-reason { font-size: 15px !important; line-height: 1.65 !important; }
html body[data-companion] :is(.ec-primary,.ec-secondary) { font-size: 16px !important; line-height: 1.4 !important; font-weight: 600 !important; }
html body[data-companion] .ec-message p { font-size: 16px !important; line-height: 1.7 !important; }
html body[data-companion] .ec-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* The dock owns the character on every tab; old hero layouts no longer reserve space for a second fox. */
html body.apppage[data-v14][data-companion] nav.bottom .v14-fox-entry {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
html body.apppage[data-v14][data-companion] .v14-gift-host > :is(img,picture),
html body.apppage[data-v14][data-companion] .v14-m-empty-home > .v14-m-welcome,
html body.apppage[data-v14][data-companion] .v14-m-profile-switch > :is(img,picture),
html body.apppage[data-v14][data-companion] .v14-m-order-empty > :is(img,picture),
html body.apppage[data-v14][data-companion] .v14-ready-fox,
html body.apppage[data-v14][data-companion] .v14-receive-host,
html body.apppage[data-v14][data-companion] .v14-note-tools button > :is(img,picture) {
  display: none !important;
}
html body.apppage[data-v14][data-companion] .v14-gift-welcome {
  display: block;
  max-width: 560px;
  min-height: 0;
}
html body.apppage[data-v14][data-companion] .v14-gift-welcome > h1 {
  position: static;
  margin: 0 0 14px;
}
html body.apppage[data-v14][data-companion] .v14-gift-host {
  display: block;
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  margin: 0 0 16px;
  background: none !important;
}
html body.apppage[data-v14][data-companion] .v14-gift-host::before { display: none; }
html body.apppage[data-v14][data-companion] .v14-gift-host > p {
  max-width: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  color: var(--ec-paper);
  background: none;
  font: 400 18px/1.5 var(--v14-font, sans-serif) !important;
}
html body.apppage[data-v14][data-companion] .v14-me .v14-m-profile-switch {
  min-height: 0;
  padding: 0;
  margin: 0 0 16px;
}
html body.apppage[data-v14][data-companion] .v14-me .v14-m-order-empty {
  grid-template-columns: minmax(0,1fr);
  min-height: 0;
  padding: 24px;
}
html body.apppage[data-v14][data-companion] .v12-wrap-step-5.v14-wrap-aligned .v14-wrap-head {
  min-height: 0;
  padding-left: 0;
  margin-bottom: 18px;
}
html body.apppage[data-v14][data-companion] .v14-present-aligned :is(.v10-unbox,.v10-locked) {
  min-height: 0;
  padding-top: 18px;
}
html body.apppage[data-v14][data-companion] .v14-present-aligned :is(.v10-unbox,.v10-locked) .v10-box {
  margin: 0 auto 26px;
}
html body.apppage[data-v14][data-companion] .v14-receive-bubble {
  position: static;
  grid-column: 1/-1;
  margin: 0 0 16px;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--ec-paper);
  text-align: center;
}
html body.apppage[data-v14][data-companion] .v14-receive-bubble::after { display: none; }
@media (min-width: 1000px) {
  html body.apppage[data-v14][data-companion] .v14-m-empty-home {
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-rows: auto auto auto;
    grid-template-areas: 'title title' 'profile quick' 'collection gifts';
  }
  html body.apppage[data-v14][data-companion] .v14-m-empty-home > :is(.v14-m-profile,.v14-m-quick) { align-self: start; }
}
/* Product detail keeps its gift action, without introducing a second companion. */
html body[data-companion] .v10-detail-fox > :is(img,picture) { display: none !important; }
