.tour-launch, .tour-actions > *, .tour-card > a, .tour-stations > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: .45rem .75rem;
  border: 1px solid #b6ccd0;
  border-radius: 8px;
  background: #fff;
  color: #18505a;
  font: 600 .9rem/1.4 system-ui, "Microsoft YaHei", sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.tour-launch { flex: none; }
.tour-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tour-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tour-actions > .tour-primary { background: #095a62; border-color: #095a62; color: white; }
.tour-actions > :disabled { opacity: .45; cursor: default; }
.tour-actions > :enabled:hover, .tour-launch:hover, .tour-actions a:hover { border-color: #23787d; }
.tour-actions > :focus-visible, .tour-launch:focus-visible, .tour-card > a:focus-visible, .tour-stations a:focus-visible {
  outline: 3px solid #338da5; outline-offset: 2px;
}

/* 欢迎条占独立的一行，业务区仍可滚动，手机底栏和打印条留在下方。 */
body:has(> .tour-welcome) {
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh; height: 100dvh; overflow: hidden;
}
body:has(> .tour-welcome):has(> .app-shell) { grid-template-rows: minmax(0, 1fr) auto; }
body:has(> .tour-welcome) > :is(.app-shell, main) { min-width: 0; min-height: 0; overflow: auto; }
body:has(> .tour-welcome) > main { margin-block: 0; }
body:has(> .tour-welcome) > main:not(.wrap) { width: 100%; }
@media (min-width: 801px) {
  body:has(> .tour-welcome) .sidebar { height: 100%; align-self: start; }
}
.tour-welcome {
  justify-self: end; max-width: 100%; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: flex-end; gap: 4px 18px; padding: 7px 14px;
  border: 1px solid #b1ced0; border-radius: 12px 0 0 0;
  background: #f7fcfb; color: #173f47;
}
.tour-welcome strong { font: 650 .95rem/1.5 system-ui, "Microsoft YaHei", sans-serif; }
.tour-actions > .tour-quiet {
  border-color: transparent; background: transparent; color: #465f67;
}
.tour-welcome .tour-actions a { text-decoration: underline; text-underline-offset: .2em; }

.tour-completion {
  position: fixed; z-index: 11; inset: auto 12px calc(var(--nav-space, 0px) + 12px) auto;
  max-width: calc(100% - 24px); padding: 10px 14px; border: 1px solid #b1ced0; border-radius: 8px;
  background: #f7fcfb; color: #173f47; box-shadow: 0 4px 20px #142c3726;
  font: 600 .9rem/1.5 system-ui, "Microsoft YaHei", sans-serif; pointer-events: none;
}

body > #onboarding-tour[open] {
  position: fixed; inset: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; overflow: hidden;
  box-shadow: none; color: #183b42; font: 1rem/1.55 system-ui, "Microsoft YaHei", sans-serif;
}
#onboarding-tour::backdrop { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
#onboarding-tour:has(.tour-ring[hidden]) { background: #10283166; }
.tour-ring {
  position: absolute; pointer-events: none; box-sizing: border-box;
  border: 2px solid #80ece5; border-radius: 9px;
  box-shadow: 0 0 0 2px #125866, 0 0 14px 3px #66d9d570, 0 0 0 200vmax #10283173;
}
.tour-card {
  position: absolute; width: min(27rem, calc(100% - 24px)); max-height: calc(100% - 24px);
  overflow: auto; overscroll-behavior: contain; padding: 19px; box-sizing: border-box;
  background: #fff; border: 1px solid #bfd6d6; border-top: 4px solid #237b7d;
  border-radius: 12px; box-shadow: 0 8px 36px #142c3738; text-align: left;
}
.tour-stations {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  margin-bottom: .7rem;
}
.tour-stations > * {
  padding: 3px; border-radius: 22px; font-size: .77rem; line-height: 1.25;
  text-align: center; overflow-wrap: anywhere;
}
.tour-stations > a:hover { background: #f0f8f7; border-color: #23787d; }
.tour-stations > [aria-current="step"] { background: #dcefeb; border-color: #689a96; color: #114b49; cursor: default; }
.tour-card .tour-progress {
  margin: 0 0 .3rem; color: #276971;
  font: 700 .85rem/1.4 system-ui, sans-serif; font-variant-numeric: tabular-nums;
}
.tour-card h2 { margin: 0; font: 700 1.23rem/1.4 system-ui, "Microsoft YaHei", sans-serif; color: #173b43; }
.tour-card .tour-copy { margin: .5rem 0 .75rem; color: #35525d; line-height: 1.6; }
.tour-card .tour-hint { margin: -.3rem 0 .75rem; color: #465f67; font-size: .86rem; }
.tour-card .tour-actions > :first-child { margin-inline-end: auto; }
.tour-card > a { margin-bottom: .6rem; }
.tour-card > a[hidden], .tour-ring[hidden], .tour-hint[hidden], .tour-completion:empty { display: none; }

.guide-sheet .guide-tours {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 1.2rem 0;
}
.guide-tours a {
  display: block; padding: .8rem 1rem; border: 1px solid #bfdbd9; border-radius: 8px;
  background: #f2f8f7; text-decoration: underline; text-underline-offset: .22em;
}
/* 步数由当前教学目录显示，隐藏静态指南里的旧步数。 */
.guide-tours span { display: none; }
.guide-sheet .guide-table thead th:first-child { width: 29%; }
.guide-sheet details { margin: .35rem 0; border-bottom: 1px solid #dbe5ec; }
.guide-sheet summary { padding: .65rem 0; min-height: 44px; cursor: pointer; font-weight: 650; }
.guide-sheet details p { margin: 0 0 .8rem; }
@media (max-width: 640px) {
  body:has(> .tour-welcome):has(#mobile-print-bar:not([hidden])) { padding-bottom: calc(var(--nav-space) + 66px); }
  body:has(#mobile-print-bar:not([hidden])) > .tour-completion { bottom: calc(var(--nav-space) + 78px); }
  .topbar:has(.tour-launch) { flex-wrap: wrap; }
  .topbar:has(.tour-launch) .crumb { flex: 1 0 100%; min-width: 0; }
  body:has(> .tour-welcome) .topbar:has(.tour-launch) { flex-wrap: nowrap; }
  body:has(> .tour-welcome) .topbar:has(.tour-launch) .crumb { flex: 1 1 0; min-width: 0; }
  /* 首访时把层名和冰箱选择器排在同一行，为首孔和欢迎条同时留出空间。 */
  body:has(> .tour-welcome) .page-heading:has(+ .recent-boxes[hidden], + .freezer-controls) {
    float: left; max-width: 35%; min-height: 44px; align-items: center; margin-right: 8px;
  }
  body:has(> .tour-welcome) .freezer-controls { margin-top: 0; }
  body:has(> .tour-welcome) .stats { clear: both; margin-block: 3px; }
  body:has(> .tour-welcome) .racks { margin-block: 2px 3px; }
  body:has(> .tour-welcome) .work-grid { row-gap: 6px; }
  body:has(> .tour-welcome) .panel-head { margin-bottom: 3px; }
  .tour-welcome { width: 100%; justify-content: center; padding: 6px 4px; border-radius: 0; }
  .tour-welcome .tour-actions { gap: 2px; justify-content: center; }
  .tour-welcome .tour-actions > * { font-size: .82rem; padding-inline: 6px; }
  .tour-card { padding: 12px 14px; }
  .tour-stations { margin-bottom: .45rem; }
  .tour-card h2 { font-size: 1.08rem; }
  .tour-card .tour-copy { font-size: .9rem; line-height: 1.48; margin: .35rem 0 .55rem; }
  .tour-card .tour-actions > * { padding-inline: .6rem; }
  .tour-card[data-last] .tour-primary { flex-basis: 100%; }
  .guide-tours a { padding: .6rem; }
}
@media print {
  #onboarding-tour, .tour-launch, .tour-welcome, .tour-completion, .guide-tours { display: none !important; }
  body:has(> .tour-welcome) { display: block; height: auto; overflow: visible; }
  body:has(> .tour-welcome) > :is(.app-shell, main) { overflow: visible; }
}
