.ec-book-exchange {
  display: grid;
  grid-template-columns: 1fr 1.65fr 1fr;
  align-items: center;
  gap: clamp(.4rem, 2vw, 1.4rem);
  margin: .5rem 0 1rem;
}
.ec-book-role { display: grid; justify-items: center; text-align: center; }
.ec-book-role img { width: min(100%, 148px); height: auto; display: block; }
.ec-book-role span { font-size: .9em; }
.ec-book-lanes { display: grid; gap: 1.05rem; text-align: center; color: #164f54; }
.ec-book-lanes b { display: block; margin-bottom: .35rem; }
.ec-book-lanes i { display: block; position: relative; width: 100%; height: .95rem; }
.ec-book-lanes i::before { position: absolute; inset: 0 0 0 auto; width: 1.12rem; height: 100%; clip-path: var(--diagram-arrowhead); }
.ec-book-lanes i::after {
  content: "";
  position: absolute;
  inset: calc(50% - 2px) .65rem auto 0;
  height: 4px;
  border-radius: 4px;
  background: currentColor;
}
.ec-book-lanes i[data-diagram-arrow="left"]::before { inset-inline: 0 auto; }
.ec-book-lanes i[data-diagram-arrow="left"]::after { inset-inline: .65rem 0; }
.ec-book-lanes > div:last-child { color: #8b314b; }
.ec-cost-rows { display: grid; gap: .6rem; margin: 1rem 0; }
.ec-cost-row, .ec-cost-axis {
  display: grid;
  grid-template-columns: minmax(7rem, .9fr) 3.15fr minmax(5.2rem, .65fr);
  gap: .9rem;
  align-items: center;
}
.ec-cost-row {
  border-bottom: 1px solid #b9b097;
  padding: .25rem 0 .7rem;
}
.ec-cost-row .ec-book-role img { width: min(100%, 94px); }
.ec-cost-row > strong { font-size: 1.35em; text-align: end; white-space: nowrap; }
.ec-cost-rate p { display: flex; flex-wrap: wrap; gap: .1rem .8rem; margin: 0 0 .45rem; }
.ec-cost-rate { --first-cost: #ffdf53; --next-cost: #f7b1cb; }
.ec-cost-row + .ec-cost-row .ec-cost-rate { --first-cost: #a3ded0; --next-cost: #a9ddef; }
.ec-cost-rate p span { display: inline-flex; align-items: center; gap: .27rem; white-space: nowrap; }
.ec-cost-rate p span::before {
  content: "";
  display: inline-block;
  width: .62rem;
  height: .62rem;
  border: 1px solid #292722;
  border-radius: .12rem;
  background: var(--first-cost);
}
.ec-cost-rate p span + span::before { background: var(--next-cost); }
.ec-cost-track { display: flex; height: 1.45rem; background: #efece0; border-radius: .25rem; }
.ec-cost-track i { width: var(--amount); display: block; background: var(--first-cost); border: 2px solid #292722; }
.ec-cost-track i + i { border-left: 0; background: var(--next-cost); }
.ec-cost-axis p { grid-column: 2; position: relative; margin: 0; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.ec-cost-axis b { text-align: end; }
.ec-cost-axis span:nth-child(2) { position: absolute; left: 50%; translate: -50% 0; }
.ec-tail-y { padding-bottom: .65rem; font-weight: 700; }
.ec-tail-chart { margin: .55rem 0 1rem; padding: .85rem; border: 1px solid #b9b097; background: #fffaf0; }
.ec-tail-plot { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); }
.ec-tail-ticks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: end;
  padding-right: .35rem;
  margin-block: -.73em;
  font-variant-numeric: tabular-nums;
}
.ec-tail-bars {
  height: 156px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  padding-inline: .29rem;
  gap: clamp(2px, .9vw, 12px);
  border-left: 2px solid #292722;
  border-bottom: 2px solid #292722;
  background: repeating-linear-gradient(to bottom, #c7c0ac 0 1px, transparent 1px 50%);
}
.ec-tail-bars i {
  position: relative;
  height: calc(var(--sold) * 10%);
  border: 2px solid #292722;
  border-radius: .22rem .22rem 0 0;
  border-bottom: 0;
  background: #a3ded0;
  font-style: normal;
}
.ec-tail-bars i:nth-child(-n+2) { background: #ffdf53; }
.ec-tail-bars b { display: grid; place-items: center; height: 100%; font-size: .88em; }
.ec-tail-bars i:nth-child(n+11) b { position: absolute; bottom: 100%; width: 100%; height: auto; }
.ec-tail-axis { display: flex; justify-content: space-between; gap: .35rem; margin: .23rem 0 .45rem 2.4rem; text-align: center; }
.ec-tail-groups { display: grid; grid-template-columns: minmax(7.6rem, 2fr) 10fr; gap: .22rem; margin-left: 2.4rem; }
.ec-tail-groups p { margin: 0; padding: .33rem .35rem; border-top: 3px solid #d09517; background: #fff1be; }
.ec-tail-groups p:last-child { border-color: #258570; background: #def1e5; }
.ec-tail-groups span { display: block; white-space: nowrap; }

@media (max-width: 560px) {
  .ec-cost-row, .ec-cost-axis { grid-template-columns: 1fr auto; gap: .32rem; }
  .ec-cost-axis p { grid-column: 1; }
  .ec-cost-row .ec-book-role { grid-column: 1 / -1; grid-template-columns: 3rem 1fr; align-items: center; justify-items: start; }
  .ec-tail-chart { padding: .6rem .45rem; }
  .ec-tail-plot { grid-template-columns: 1.55rem minmax(0, 1fr); }
  .ec-tail-axis, .ec-tail-groups { margin-left: 1.55rem; }
  .ec-tail-groups { grid-template-columns: 1fr 1.6fr; }
}
