body {
  background: #f5f7f8;
}

body::before {
  display: none;
}

.site-header {
  border-top: 3px solid #153e5c;
  border-bottom-color: #d6e0e6;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.header-inner {
  min-height: 64px;
}

.brand {
  color: #153e5c;
}

.brand-mark,
.header-action {
  border-color: #b9cbd7;
  border-radius: 4px;
  box-shadow: none;
}

.nav a,
.header-action {
  color: #465964;
  font-weight: 400;
}

.detail-hero .shell,
.detail-section > .shell {
  width: min(calc(100% - 72px), 1368px);
}

.detail-hero {
  padding: 22px 0 2px;
  background: #fff;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 400;
}

.breadcrumb a {
  color: #60717b;
}

.breadcrumb > span[aria-hidden="true"] {
  color: #a9b5bc;
  font-size: 0.92em;
}

.breadcrumb > span:last-child {
  min-width: 0;
  overflow: hidden;
  color: #7a8991;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-titlebar {
  display: block;
}

.detail-heading {
  min-width: 0;
}

.detail-title {
  margin: 5px 0 0;
  max-width: 1100px;
  font-size: clamp(1.55rem, 2vw, 1.9rem);
  line-height: 1.26;
  letter-spacing: 0;
  font-weight: 500;
  text-wrap: balance;
}

.detail-title-code {
  display: inline-block;
  color: var(--accent);
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 500;
}

.detail-code-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 3px 8px 2px 0;
}

.purchase-button {
  width: calc(100% - 28px);
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 14px;
  padding: 0 12px;
  border: 1px solid #ad5a1d;
  border-radius: 4px;
  background: #bd641f;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: none;
}

.purchase-button::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background-color: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='21' r='1'/%3E%3Ccircle cx='19' cy='21' r='1'/%3E%3Cpath d='M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h8.8a2 2 0 0 0 2-1.58l1.6-7.42H5.12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.purchase-button:hover {
  border-color: #944815;
  background: #a95318;
  transform: translateY(-1px);
}

.purchase-button:active {
  transform: translateY(0);
}

.download-button {
  width: calc(100% - 28px);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 14px 8px;
  border: 1px solid #197554;
  border-radius: 4px;
  background: #21835f;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
}

.download-button[hidden] { display: none; }
.download-button:hover { background: #176e4e; color: #fff; }

.download-dialog { width:min(430px,calc(100% - 30px)); padding:0; border:1px solid #d4dfdc; border-radius:6px; background:#fff; color:#273a3e; box-shadow:0 24px 70px rgba(18,52,61,.2); }
.download-dialog::backdrop { background:rgba(18,39,45,.42); }
.download-dialog-head { min-height:48px; display:flex; align-items:center; justify-content:space-between; padding:0 14px 0 17px; border-bottom:1px solid #dbe4e2; background:#f8faf9; }
.download-dialog-head span { font-size:.84rem; font-weight:600; }
.download-dialog-head button { width:30px; height:30px; padding:0; border:0; background:transparent; color:#748286; font-size:1.3rem; cursor:pointer; }
.download-dialog-body { padding:22px 20px 18px; }
.download-dialog-body h2 { margin:0 0 9px; font-size:1.08rem; font-weight:600; }
.download-dialog-body > p { margin:0; color:#6e7d81; font-size:.84rem; line-height:1.7; }
.download-dialog-body dl { display:grid; grid-template-columns:repeat(2,1fr); margin:18px 0 0; border-top:1px solid #e3e9e7; border-left:1px solid #e3e9e7; }
.download-dialog-body dl > div { display:grid; gap:4px; padding:10px 11px; border-right:1px solid #e3e9e7; border-bottom:1px solid #e3e9e7; }
.download-dialog-body dt { color:#7c898d; font-size:.72rem; }
.download-dialog-body dd { margin:0; color:#30474b; font-size:.84rem; font-weight:500; }
.download-dialog-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; padding:12px 16px; border-top:1px solid #dbe4e2; background:#f8faf9; }
.download-dialog-actions a,.download-dialog-actions button { min-height:34px; display:inline-flex; align-items:center; justify-content:center; padding:0 12px; border-radius:4px; font-size:.78rem; }
.download-dialog-actions a { border:1px solid #cbd8d5; background:#fff; color:#536a6e; }
.download-dialog-actions button { border:1px solid #17686c; background:#176f73; color:#fff; cursor:pointer; }

.detail-section {
  padding-top: 14px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  align-items: start;
}

.detail-panel,
.meta-panel,
.relation-panel,
.related-panel {
  border: 1px solid #d6e0e6;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}

.detail-panel {
  padding: 0;
  overflow: hidden;
}

.detail-panel h2,
.meta-panel h2,
.relation-panel h2,
.related-panel h2 {
  margin: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #c9d9e3;
  background: #e8f0f5;
  color: #153e5c;
  font-size: 1rem;
  font-weight: 500;
}

.relation-panel h2,
.related-panel h2 {
  min-height: 44px;
  background: #f1f5f7;
  color: #294b60;
  font-size: 0.92rem;
}

.description {
  color: var(--text);
  line-height: 1.9;
  font-size: 0.94rem;
  overflow: hidden;
  padding: 20px 22px 0;
  text-wrap: pretty;
}

.description.is-collapsed {
  max-height: 11.1em;
}

.text-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 10px 22px 0;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
}

.text-toggle:hover {
  color: #0f4f83;
}

.text-toggle::after {
  content: "⌄";
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-1px);
}

.text-toggle[aria-expanded="true"]::after {
  content: "⌃";
  transform: translateY(2px);
}

.english-title {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  margin: 18px 22px 0;
  padding: 15px 0 18px;
  border-top: 1px solid #dfe6ea;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.62;
}

.english-label {
  color: #60727d;
  font-size: 0.8rem;
}

.english-value {
  min-width: 0;
  color: #71818a;
  text-wrap: pretty;
}

.meta-panel {
  padding: 14px 0 0;
  border-radius: 4px;
}

@media (min-width: 901px) {
  .meta-panel {
    position: sticky;
    top: 92px;
  }
}

.meta-list {
  display: grid;
  gap: 0;
  margin-top: 0;
  border-top: 0;
}

.meta-panel h2 {
  margin-top: 14px;
}

.meta-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid #dfe6ea;
}

.meta-item span {
  color: #637680;
  font-size: 0.84rem;
  font-weight: 400;
}

.meta-item strong,
.meta-item a {
  min-width: 0;
  line-height: 1.45;
  font-size: 0.88rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.meta-item a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.meta-link {
  font-weight: 500;
}

.meta-toggle {
  display: none;
}

.relation-panel,
.related-panel {
  margin-top: 20px;
  overflow: hidden;
}

.relation-list,
.related-list {
  display: grid;
  gap: 0;
}

.relation-row {
  display: grid;
  grid-template-columns: 88px 190px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #dfe6ea;
  background: #fff;
}

.relation-label {
  width: auto;
  min-height: 0;
  display: block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
}

.relation-code {
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-code a {
  color: var(--accent);
}

.relation-row strong,
.relation-code {
  font-size: 0.86rem;
}

.relation-title,
.relation-row span {
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.related-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid #dfe6ea;
  background: #fff;
  font-size: 0.86rem;
  transition: background-color 160ms ease, color 160ms ease;
}

.related-row:hover {
  background: #f1f6f9;
}

.related-row strong {
  flex: 0 0 210px;
  color: #174f73;
  font-weight: 500;
}

.related-row span {
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-row::after {
  content: "›";
  margin-left: auto;
  color: #9aa8b0;
  font-size: 1.05rem;
  transition: transform 160ms ease, color 160ms ease;
}

.related-row:hover::after {
  color: #3c6f8f;
  transform: translateX(2px);
}

.relation-list > .empty-state,
.related-list > .empty-state {
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.purchase-button,
.text-toggle,
.meta-toggle,
.related-row,
.breadcrumb a {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.purchase-button:focus-visible,
.text-toggle:focus-visible,
.meta-toggle:focus-visible,
.related-row:focus-visible,
.breadcrumb a:focus-visible {
  outline: 2px solid rgba(21, 95, 155, 0.45);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .detail-hero .shell,
  .detail-section > .shell {
    width: min(calc(100% - 28px), var(--shell));
  }

  .detail-titlebar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .detail-actions {
    padding-top: 0;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .meta-panel {
    order: -1;
  }

}

@media (max-width: 560px) {
  .site-header {
    border-top-width: 2px;
  }

  .header-inner {
    min-height: 54px;
  }

  .detail-hero {
    padding-top: 18px;
  }

  .breadcrumb {
    margin-bottom: 10px;
    font-size: 0.74rem;
    gap: 5px;
  }

  .breadcrumb a:nth-of-type(2),
  .breadcrumb a:nth-of-type(2) + span[aria-hidden="true"] {
    display: none;
  }

  .detail-title {
    font-size: clamp(1.22rem, 5.2vw, 1.55rem);
  }

  .detail-code-line strong {
    font-size: 0.92rem;
  }

  .detail-panel h2,
  .meta-panel h2,
  .relation-panel h2,
  .related-panel h2 {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .description {
    padding: 12px 12px 0;
    font-size: 0.86rem;
    line-height: 1.66;
  }

  .meta-panel {
    padding-top: 12px;
  }

  .purchase-button {
    min-height: 42px;
  }

  .meta-panel h2 {
    margin-top: 12px;
  }

  .text-toggle {
    margin-left: 12px;
    margin-right: 12px;
  }

  .english-title {
    grid-template-columns: 1fr;
    gap: 3px;
    margin-left: 12px;
    margin-right: 12px;
    padding-top: 12px;
    padding-bottom: 14px;
  }

  .meta-item {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 12px;
  }

  .meta-item.is-secondary {
    display: none;
  }

  .meta-list.is-expanded .meta-item.is-secondary {
    display: grid;
  }

  .meta-toggle {
    width: 100%;
    min-height: 38px;
    display: block;
    border: 0;
    border-top: 1px solid #dfe6ea;
    background: #f8fafb;
    color: #55707f;
    font-size: 0.78rem;
  }

  .relation-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 9px 10px;
  }

  .related-row {
    align-items: flex-start;
    min-height: 42px;
    padding: 7px 10px;
    gap: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .related-row strong {
    max-width: 43%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .related-row::after {
    display: none;
  }

  .related-row span {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}
