:root {
  --shell-mobilebar-offset: 0px;
}

body.shell-page {
  margin: 0;
  min-height: 100vh;
  background: var(--shell-bg-0);
  color: var(--shell-text);
  font-family: "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

body.shell-page::before {
  content: none;
}

body.shell-drawer-open {
  overflow: hidden;
}

.shell-layout,
.shell-sidebar,
.shell-sidebar *,
.shell-mobilebar,
.shell-mobilebar *,
.global-notice-dialog,
.global-notice-dialog * {
  box-sizing: border-box;
}

.shell-layout {
  position: relative;
  width: min(1560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 40px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.shell-main {
  min-width: 0;
}

.shell-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border: 1px solid var(--shell-line);
  border-radius: 14px;
  background: var(--shell-panel);
  color: var(--shell-text);
}

.shell-sidebar-head {
  flex-shrink: 0;
  display: grid;
  gap: 14px;
  padding: 18px 14px 12px;
  border-bottom: 1px solid var(--shell-line);
}

.shell-sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shell-brand,
.shell-mobilebar-brand {
  min-width: 0;
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-brand {
  flex: 1;
}

.shell-brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--shell-accent);
  background: var(--shell-accent-soft);
  font-size: 17px;
}

.shell-brand-copy,
.shell-mobilebar-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.shell-brand-copy strong,
.shell-mobilebar-copy strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-brand-copy small,
.shell-mobilebar-copy small {
  color: var(--shell-muted);
  font-size: 11px;
  line-height: 1.4;
}

.shell-sidebar-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 20px;
  padding: 12px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--shell-line-strong) transparent;
}

.shell-sidebar-group {
  display: grid;
  gap: 8px;
}

.shell-sidebar-group-foot {
  padding-top: 14px;
  border-top: 1px solid var(--shell-line);
}

.shell-sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
}

.shell-sidebar-kicker {
  color: var(--shell-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.shell-sidebar-badge {
  color: var(--shell-muted);
  font-size: 11px;
  line-height: 1.5;
}

.shell-sidebar-badge-muted {
  color: var(--shell-accent);
}

.shell-nav-list,
.shell-placeholder-list {
  display: grid;
  gap: 3px;
}

.shell-nav-item,
.shell-placeholder-card,
.shell-reference-link,
.shell-sidebar-utility-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-text);
  text-decoration: none;
}

.shell-nav-item:hover,
.shell-placeholder-card:hover,
.shell-reference-link:hover,
.shell-sidebar-utility-btn:hover {
  background: var(--shell-panel-strong);
}

.shell-nav-item.is-active,
.shell-placeholder-card.is-active {
  border-color: var(--shell-accent-border);
  background: var(--shell-accent-soft);
  color: var(--shell-accent);
}

.shell-nav-icon,
.shell-placeholder-icon,
.shell-reference-icon,
.shell-bell-button-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: var(--shell-muted);
  font-size: 14px;
}

.shell-nav-item.is-active .shell-nav-icon,
.shell-placeholder-card.is-active .shell-placeholder-icon {
  color: inherit;
}

.shell-nav-copy,
.shell-placeholder-copy,
.shell-reference-copy,
.shell-sidebar-utility-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.shell-nav-copy strong,
.shell-placeholder-copy strong,
.shell-reference-copy strong,
.shell-sidebar-utility-copy strong {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.shell-nav-copy small,
.shell-placeholder-copy small,
.shell-reference-copy small,
.shell-sidebar-utility-copy small {
  color: var(--shell-muted);
  font-size: 11px;
  line-height: 1.5;
}

.shell-nav-arrow {
  margin-left: auto;
  color: var(--shell-muted);
  font-size: 9px;
  opacity: 0.65;
}

.shell-nav-item.is-active .shell-nav-arrow {
  color: inherit;
  opacity: 1;
}

.shell-sidebar-utility-row {
  display: flex;
  gap: 4px;
}

.shell-sidebar-utility-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.shell-bell-button-icon-panel {
  color: var(--shell-muted);
}

.shell-sidebar-close,
.shell-mobilebar,
.shell-sidebar-backdrop {
  display: none;
}

.shell-sidebar[hidden],
.shell-sidebar-backdrop[hidden] {
  display: none !important;
}

.shell-sidebar :focus-visible,
.shell-mobilebar :focus-visible,
.global-notice-dialog :focus-visible {
  outline: 2px solid var(--shell-accent);
  outline-offset: 3px;
}

.global-notice-dialog {
  width: min(720px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--shell-line);
  padding: 0;
  border-radius: 16px;
  background: var(--shell-panel);
  color: var(--shell-text);
  box-shadow: var(--shell-shadow);
}

.global-notice-dialog::backdrop {
  background: var(--shell-backdrop);
}

.global-notice-shell {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.global-notice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.global-notice-eyebrow {
  margin: 0;
  color: var(--shell-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.global-notice-head h2 {
  margin: 6px 0 0;
  color: var(--shell-text);
  font-size: 23px;
  line-height: 1.4;
}

.global-notice-fineprint,
.update-log-contact {
  margin: 8px 0 0;
  color: var(--shell-muted);
  font-size: 13px;
  line-height: 1.7;
}

.global-notice-close {
  flex-shrink: 0;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--shell-line-strong);
  border-radius: 8px;
  background: var(--shell-panel-strong);
  color: var(--shell-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.global-notice-close:hover {
  border-color: var(--shell-accent);
}

.global-notice-support {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: var(--shell-panel-soft);
}

.global-notice-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--shell-muted);
  font-size: 13px;
  line-height: 1.7;
}

.global-notice-group-grid {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.global-notice-group-card {
  padding: 14px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: var(--shell-panel);
}

.global-notice-group-entry {
  display: grid;
  gap: 8px;
}

.global-notice-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--shell-muted);
  font-size: 11px;
  font-weight: 500;
}

.global-notice-group-text {
  margin: 0;
  color: var(--shell-text);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.global-notice-link {
  display: inline-flex;
  width: fit-content;
  color: var(--shell-accent);
  font-size: 13px;
  text-decoration: none;
}

.global-notice-link:hover {
  text-decoration: underline;
}

.global-notice-inline-link {
  color: var(--shell-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.global-notice-links {
  display: flex;
  justify-content: flex-end;
}

.update-log-dialog {
  width: min(720px, calc(100% - 32px));
}

.update-log-dialog {
  overflow: hidden;
}

.update-log-dialog .update-log-shell {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  max-height: inherit;
  padding: 0;
}

.update-log-shell > .global-notice-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--shell-line);
}

.update-log-shell .global-notice-head h2 {
  margin-top: 0;
}

.update-log-list {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 24px 24px;
}

.update-log-recent,
.update-log-history-list {
  display: grid;
  gap: 10px;
}

.update-log-history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 2px;
  border-top: 1px solid var(--shell-line);
  color: var(--shell-muted);
  font-size: 13px;
  list-style: none;
  cursor: pointer;
}

.update-log-history > summary::-webkit-details-marker {
  display: none;
}

.update-log-history > summary:hover {
  color: var(--shell-accent);
}

.update-log-history-count {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.update-log-history-count i {
  font-size: 10px;
}

.update-log-history[open] .update-log-history-count i {
  transform: rotate(180deg);
}

.update-log-history-hide,
.update-log-history[open] .update-log-history-show {
  display: none;
}

.update-log-history[open] .update-log-history-hide {
  display: inline;
}

.update-log-details.is-latest .update-log-entry,
.update-log-details.is-latest .update-log-details-content {
  background: var(--shell-panel-strong);
}

.update-log-details-content p + p {
  margin-top: 8px;
}

@media (max-width: 640px) {
  .update-log-shell > .global-notice-head {
    padding: 16px;
  }
  .update-log-list {
    padding: 12px 16px 16px;
  }
}

.update-log-entry {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: var(--shell-panel);
}

.update-log-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.update-log-date,
.update-log-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 1.5;
}

.update-log-date {
  color: var(--shell-muted);
  font-variant-numeric: tabular-nums;
}

.update-log-tag {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--shell-accent-soft);
  color: var(--shell-accent);
}

.update-log-entry h3 {
  margin: 0;
  color: var(--shell-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

.update-log-entry p,
.update-log-details-content {
  color: var(--shell-muted);
  font-size: 13px;
  line-height: 1.75;
}

.update-log-entry p,
.update-log-details-content p,
.update-log-contact {
  margin: 0;
}

.update-log-details {
  margin: 0;
}

.update-log-summary {
  display: block;
  position: relative;
  list-style: none;
  cursor: pointer;
}

.update-log-summary::-webkit-details-marker {
  display: none;
}

.update-log-summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--shell-muted);
  font-size: 18px;
}

.update-log-details[open] > .update-log-summary::after {
  content: "−";
}

.update-log-summary .update-log-entry {
  padding-right: 42px;
}

.update-log-summary:hover .update-log-entry {
  border-color: var(--shell-line-strong);
}

.update-log-details[open] > .update-log-summary .update-log-entry {
  border-radius: 10px 10px 0 0;
  border-bottom-color: transparent;
}

.update-log-details-content {
  margin: -1px 0 0;
  padding: 0 16px 16px;
  border: 1px solid var(--shell-line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--shell-panel);
}

@media (max-width: 1080px) {
  body.shell-page {
    --shell-mobilebar-offset: calc(72px + env(safe-area-inset-top, 0px));
  }

  .shell-layout {
    width: calc(100% - 32px);
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--shell-mobilebar-offset);
  }

  .shell-mobilebar {
    position: fixed;
    inset: calc(8px + env(safe-area-inset-top, 0px)) 12px auto;
    z-index: 38;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px;
    border: 1px solid var(--shell-line);
    border-radius: 10px;
    background: var(--shell-panel);
    color: var(--shell-text);
  }

  .shell-mobilebar-brand {
    flex: 1;
  }

  .shell-mobilebar-copy strong {
    font-size: 14px;
  }

  .shell-mobilebar-copy small {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shell-mobilebar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .shell-mobilebar-btn,
  .shell-mobilebar-link,
  .shell-sidebar-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--shell-text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
  }

  .shell-mobilebar-btn:hover,
  .shell-mobilebar-link:hover,
  .shell-sidebar-close:hover {
    background: var(--shell-panel-strong);
  }

  .shell-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 39;
    display: block;
    background: var(--shell-backdrop);
  }

  .shell-sidebar {
    display: none;
    position: fixed;
    inset: calc(8px + env(safe-area-inset-top, 0px)) auto calc(8px + env(safe-area-inset-bottom, 0px)) 8px;
    z-index: 41;
    width: min(288px, calc(100vw - 32px));
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .shell-sidebar.is-open {
    display: flex;
  }

  .shell-sidebar-head {
    padding-top: 12px;
  }

  .shell-nav-item,
  .shell-placeholder-card,
  .shell-reference-link {
    min-height: 44px;
  }
}

@media (max-width: 760px) {
  .global-notice-shell {
    padding: 18px;
    gap: 16px;
  }

  .global-notice-head h2 {
    font-size: 20px;
  }

  .global-notice-support {
    padding: 12px;
  }

  .update-log-entry {
    padding: 14px;
  }

  .update-log-entry h3 {
    font-size: 15px;
  }
}

/* Shared phone intro: keep the first screen available for the actual tool. */
@media (max-width: 640px) {
  .shell-page .shell-main .shell-page-intro {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
    padding: 2px 0 12px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--shell-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
  }
  .shell-page .shell-page-intro .shell-intro-eyebrow { display: none; }
  .shell-page .shell-page-intro .shell-intro-copy { flex: none; gap: 6px; max-width: 100%; }
  .shell-page .shell-page-intro h1 { margin: 0; font-size: 24px; line-height: 1.3; letter-spacing: 0; }
  .shell-page .shell-page-intro .shell-intro-description { margin: 0; font-size: 13px; line-height: 1.55; }
  .shell-page .shell-page-intro .shell-intro-actions { gap: 6px; margin: 0; justify-content: flex-start; }
  .shell-page .shell-page-intro .shell-intro-actions > :is(a, button) {
    min-height: 34px; padding: 7px 10px; font-size: 12px; border-radius: 8px;
  }
  .shell-page-intro a[data-intro-home] { display: none; }
  .shell-page-intro .shell-intro-actions:not(:has(> :not([data-intro-home]))) { display: none; }
}
