.workflow-action-card {
  position: relative;
  container-type: size;
  display: flex;
  min-height: 0;
  padding: 12px 14px;
  flex-direction: column;
  color: var(--cream);
  background: #757f4a;
}

.workflow-action-card [hidden] { display: none; }

.workflow-action-file-picker { display: contents; }

/* 上传与渲染只允许一套状态占用同一位置，避免初始化刷新打印状态时串台。 */
.workflow-action-card[data-stage="render"] #gpxMeta,
.workflow-action-card[data-stage="upload"] .workflow-action-feedback,
.workflow-action-card:has(.export-build-progress:not([hidden])) .workflow-action-feedback,
.workflow-action-card[data-stage="upload"] :is(#exportStageStatus, .export-build-progress) {
  display: none;
}

.workflow-action-kicker,
.workflow-action-title,
.workflow-action-status {
  margin: 0;
}

.workflow-action-card .export-build-progress {
  position: absolute;
  top: calc(50% + 31px);
  right: 20px;
  left: 20px;
  min-width: 0;
  padding-top: 8px;
}

.workflow-action-card .export-build-progress[hidden] { display: none; }

.workflow-action-card .export-build-progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--cream);
}

.workflow-action-card .export-build-progress-copy > span {
  min-width: 0;
  font-size: var(--type-t3-size);
  font-weight: var(--type-t3-weight);
  line-height: var(--type-t3-line-height);
  letter-spacing: var(--type-t3-letter-spacing);
}

#exportBuildProgressLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#exportBuildProgressMeta { flex: 0 0 auto; }

.workflow-action-card .export-build-progress-track {
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid rgb(252 252 251 / 70%);
  border-radius: 999px;
  background: rgb(0 0 0 / 24%);
}

.workflow-action-card .export-build-progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--cream);
  transition: width .35s ease;
}

.workflow-action-kicker {
  padding-left: 6px;
  font-size: var(--type-t3-size);
  font-weight: var(--type-t3-weight);
  line-height: var(--type-t3-line-height);
  letter-spacing: var(--type-t3-letter-spacing);
}

.workflow-action-title {
  margin-top: 9px;
  padding-left: 6px;
  font-size: var(--type-t1-size);
  font-weight: var(--type-t1-weight);
  line-height: var(--type-t1-line-height);
  letter-spacing: var(--type-t1-letter-spacing);
}

.workflow-action-button {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 40px);
  min-height: 42px;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: var(--container-radius);
  color: var(--cream);
  background: var(--ink);
  font-size: var(--type-t2-size);
  font-weight: var(--type-t2-weight);
  line-height: var(--type-t2-line-height);
  letter-spacing: var(--type-t2-letter-spacing);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.workflow-action-button:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.workflow-action-file-picker:has(.gpx-upload-input:focus-visible) .workflow-action-button {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.workflow-action-button:focus-visible,
.workflow-action-button:active {
  color: var(--ink);
  background: var(--acid);
}

@media (hover: hover) and (pointer: fine) {
  .workflow-action-button:hover {
    color: var(--ink);
    background: var(--acid);
  }
}

.workflow-action-status {
  position: absolute;
  top: calc(50% + 31px);
  right: 20px;
  left: 20px;
  color: rgb(252 252 251 / 82%);
  font-size: var(--type-t3-size);
  font-weight: var(--type-t3-weight);
  line-height: var(--type-t3-line-height);
  letter-spacing: var(--type-t3-letter-spacing);
}

.workflow-action-feedback {
  /* 与底部两行坐标留出间距；长提示在原提示区内换行、滚动。 */
  display: flex;
  flex-direction: column;
  bottom: calc(12px + 2 * var(--type-t3-size) * var(--type-t3-line-height));
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}

.workflow-action-feedback > p {
  flex: 0 0 auto;
  order: 1;
  margin: 0;
}

.workflow-action-feedback .height-limit-notice {
  display: contents;
}

.workflow-action-feedback .height-limit-notice[hidden] { display: none; }

.workflow-action-feedback #heightLimitNoticeTitle {
  flex: 0 0 auto;
  order: 0;
  font-weight: inherit;
}

.workflow-action-feedback #heightLimitNoticeText {
  flex: 0 0 auto;
  order: 2;
  margin-top: 6px;
}

.workflow-action-feedback #restoreTerrainScale {
  flex: 0 0 auto;
  order: 3;
  align-self: flex-start;
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--container-radius);
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.workflow-action-feedback:focus-visible,
.workflow-action-feedback #restoreTerrainScale:focus-visible {
  outline: 1px solid var(--cream);
  outline-offset: -1px;
}

.workflow-action-location {
  display: grid;
  gap: 0;
  margin-top: auto;
  padding: 0 6px;
  font-size: var(--type-t3-size);
  font-weight: var(--type-t3-weight);
  line-height: var(--type-t3-line-height);
  letter-spacing: var(--type-t3-letter-spacing);
}

.workflow-action-location strong {
  font-weight: var(--type-t3-weight);
}

.workflow-action-location > :is(strong, span) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-action-location span {
  color: rgb(252 252 251 / 82%);
}

.workflow-action-card[data-stage="render"] .workflow-action-button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% - 40px);
  margin: 0;
  transform: translate(-50%, -50%);
}

.workflow-action-card[data-stage="render"] .workflow-action-status,
.workflow-action-card[data-stage="render"] .export-build-progress {
  position: absolute;
  top: calc(50% + 31px);
  right: 20px;
  left: 20px;
  width: auto;
  margin: 0;
}

.workflow-action-card[data-stage="render"] .workflow-action-location {
  position: absolute;
  right: 20px;
  bottom: 8px;
  left: 20px;
  margin: 0;
}

.workflow-action-card[data-stage="render"]:has(.export-build-progress:not([hidden])) .workflow-action-button {
  margin: 0;
}

.workflow-action-card[data-stage="render"]:has(.export-build-progress:not([hidden])) {
  cursor: progress;
  user-select: none;
}

.workflow-action-card[data-stage="render"]:has(.export-build-progress:not([hidden])) .export-build-progress {
  top: calc(50% + 21px);
  margin: 0;
  padding-top: 0;
}

.workflow-action-card[data-stage="render"]:has(.export-build-progress:not([hidden])) .export-build-progress-track {
  margin-top: 3px;
}

/* 矮卡片出现高度警告时，优先给两行提示留位置。 */
@container (max-height: 250px) {
  .workflow-action-card[data-stage="render"]:has(#heightLimitNotice:not([hidden])):has(.export-build-progress[hidden]) .workflow-action-kicker {
    display: none;
  }

  .workflow-action-card[data-stage="render"]:has(#heightLimitNotice:not([hidden])):has(.export-build-progress[hidden]) .workflow-action-title {
    margin-top: 0;
  }

  .workflow-action-card[data-stage="render"]:has(#heightLimitNotice:not([hidden])):has(.export-build-progress[hidden]) .workflow-action-button {
    top: calc(100% - 45px - 4 * var(--type-t3-size) * var(--type-t3-line-height));
  }

  .workflow-action-card[data-stage="render"]:has(#heightLimitNotice:not([hidden])):has(.export-build-progress[hidden]) .workflow-action-feedback {
    top: auto;
    height: calc(2px + 2 * var(--type-t3-size) * var(--type-t3-line-height));
  }
}

@media (min-width: 1280px) {
  .workflow-action-card[data-stage="render"]:has(.workflow-action-button[hidden]) .export-build-progress:not([hidden]) {
    top: 50%;
    transform: translateY(-50%);
  }
}

@media (max-width: 1279px) {
  .workflow-action-button,
  .workflow-action-status,
  .workflow-action-card .export-build-progress {
    position: static;
    width: 100%;
    transform: none;
  }

  .workflow-action-button {
    margin-top: 18px;
  }

  .workflow-action-status {
    margin-top: 8px;
  }

  .workflow-action-card .export-build-progress { margin-top: 8px; }

  .workflow-action-location {
    margin-top: auto;
    padding-top: 8px;
  }
}

@media (max-width: 743px) {
  .workflow-action-card {
    container-type: inline-size;
    height: 224px;
    min-height: 224px;
    max-height: 224px;
  }
  .workflow-action-card :is(.workflow-action-button, .workflow-action-status, .export-build-progress) {
    position: absolute;
    right: 20px;
    left: 20px;
    width: auto;
  }
  .workflow-action-card .workflow-action-button,
  .workflow-action-card[data-stage="render"] .workflow-action-button {
    top: 50%;
    right: auto;
    left: 50%;
    width: calc(100% - 40px);
    margin: 0;
    transform: translate(-50%, -50%);
  }
  .workflow-action-card .workflow-action-status,
  .workflow-action-card .export-build-progress,
  .workflow-action-card[data-stage="render"] :is(.workflow-action-status, .export-build-progress) {
    top: calc(50% + 31px);
    margin: 0;
  }
  .workflow-action-card .workflow-action-location,
  .workflow-action-card[data-stage="render"] .workflow-action-location {
    position: absolute;
    right: 20px;
    bottom: 8px;
    left: 20px;
    margin: 0;
    padding: 0 6px;
  }
  .workflow-action-card[data-stage="render"]:has(.export-build-progress:not([hidden])) .export-build-progress {
    top: calc(50% + 31px);
    padding-top: 8px;
  }
  .workflow-action-card[data-stage="render"]:has(.export-build-progress:not([hidden])) .export-build-progress-track {
    margin-top: 6px;
  }
  .workflow-action-card[data-stage="render"]:has(.workflow-action-button[hidden]) .export-build-progress:not([hidden]) {
    top: 50%;
    padding-top: 0;
    transform: translateY(-50%);
  }
  .workflow-action-button { min-height: 44px; }
}
.gpx-upload-input {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  clip-path: inset(50%);
  pointer-events: none;
}

@media (max-width: 743px), (pointer: coarse), (max-width: 1024px) and (max-height: 743px) {
  .workflow-action-file-picker {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: calc(100% - 40px);
    margin: 0;
    transform: translate(-50%, -50%);
  }

  .workflow-action-file-picker .workflow-action-button {
    position: static;
    width: 100%;
    min-height: 44px;
    margin: 0;
    transform: none;
  }

  .top-split-container > .workflow-action-card .workflow-action-file-picker .workflow-action-button {
    width: 100%;
    min-height: 44px;
  }

  .workflow-action-file-picker .gpx-upload-input {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    clip-path: none;
    pointer-events: auto;
    cursor: pointer;
  }

  body.has-uploaded-track .workflow-action-file-picker .gpx-upload-input {
    visibility: hidden;
    pointer-events: none;
  }
}
