/*
 * Mobile browser training shell. It deliberately reuses the desktop page's
 * training and browser-audio runtime, while changing only the presentation
 * when a caller enters with ?surface=mobile (for example WeCom workbench).
 */

html.mobile-training-surface,
body.mobile-training-surface {
  min-height: 100%;
  background: var(--fd-page);
}

body.mobile-training-surface {
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}

.mobile-training-surface .shell {
  display: block;
  min-height: 100dvh;
  padding: 0;
}

.mobile-training-surface .call {
  width: 100%;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background: var(--fd-page);
  overflow: visible;
}

/* Navigation views are sibling panels following .call. Once the training
 * workspace is hidden, retaining the full-screen call shell leaves an empty
 * viewport above tasks, records, and the personal center in WeCom WebView. */
.mobile-training-surface .call.is-navigation-view {
  min-height: 0;
  margin-bottom: 0;
}

.mobile-training-surface .management-panel {
  width: 100%;
  min-height: calc(100dvh - 58px - env(safe-area-inset-top));
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.mobile-training-surface .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 58px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--fd-surface);
  backdrop-filter: blur(12px);
}

.mobile-training-surface .workspace-brand {
  min-width: 0;
}

.mobile-training-surface .workspace-brand .product-heading {
  gap: 8px;
}

.mobile-training-surface .workspace-brand .product-heading > div {
  min-height: 0;
}

.mobile-training-surface .workspace-brand .brand-mark {
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.mobile-training-surface .workspace-brand h1 {
  font-size: 17px;
  line-height: 1.2;
}

.mobile-training-surface .workspace-brand .product-heading p,
.mobile-training-surface .workspace-brand .product-version,
.mobile-training-surface .workspace-mode,
.mobile-training-surface #status,
.mobile-training-surface .workspace-tools,
.mobile-training-surface .meter {
  display: none;
}

.mobile-training-surface .topbar-utility {
  margin-left: auto;
}

.mobile-training-surface .account-button {
  max-width: 104px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  background: var(--fd-brand-soft);
  color: var(--fd-brand-strong);
  font-size: 12px;
}

.mobile-training-surface .workspace-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  min-height: calc(58px + env(safe-area-inset-bottom));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--fd-line);
  background: var(--fd-surface);
  box-shadow: 0 -8px 24px rgba(27, 31, 38, 0.05);
}

.mobile-training-surface .workspace-nav button {
  min-width: 0;
  height: 42px;
  padding: 0 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fd-ink-soft);
  font-size: 12px;
}

.mobile-training-surface .workspace-nav button.is-active {
  background: var(--fd-brand-soft);
  color: var(--fd-brand-strong);
  font-weight: 600;
}

.mobile-training-surface .scenario-catalog-view,
.mobile-training-surface .scenario-setup-panel,
.mobile-training-surface .training-workspace,
.mobile-training-surface #myTasksView,
.mobile-training-surface #historyView,
.mobile-training-surface #personalView,
.mobile-training-surface #feedbackView {
  padding-right: 16px;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  padding-left: 16px;
}

.mobile-training-surface .visitor-preview-banner {
  display: none !important;
}

.mobile-training-surface .scenario-catalog-view {
  padding-top: 22px;
}

.mobile-training-surface .scenario-catalog-heading {
  margin-bottom: 16px;
}

.mobile-training-surface .scenario-catalog-heading h2 {
  font-size: 24px;
  line-height: 1.28;
}

.mobile-training-surface .scenario-catalog-heading p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.mobile-training-surface .scenario-catalog-filters {
  flex-wrap: nowrap;
  margin-top: 16px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mobile-training-surface .scenario-catalog-filters::-webkit-scrollbar {
  display: none;
}

.mobile-training-surface .scenario-catalog-filters button {
  flex: 0 0 auto;
}

.mobile-training-surface .scenario-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* The H5 catalog uses .scenario-catalog-card, not the old .scenario-card
 * selector. Give the WeCom surface the same image-first, two-column catalog
 * hierarchy as the App rather than inheriting the desktop list layout. */
.mobile-training-surface .scenario-catalog-card {
  --scenario-card-cover-width: 100%;
  height: 164px;
  min-height: 0;
  border: 0;
  border-radius: 12px;
  background: #263442;
  color: #fff;
  box-shadow: none;
}

.mobile-training-surface .scenario-catalog-card::before {
  inset: 0;
  width: auto;
  background: linear-gradient(180deg, rgb(13 23 33 / 8%) 20%, rgb(13 23 33 / 78%) 100%);
}

.mobile-training-surface .scenario-card-cover {
  inset: 0;
  width: 100%;
  height: 100%;
  filter: saturate(.84) brightness(.84);
}

.mobile-training-surface .scenario-card-content {
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
}

.mobile-training-surface .scenario-card-category {
  position: static;
  align-self: flex-start;
  max-width: 100%;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  background: rgb(22 32 42 / 42%);
  color: rgb(255 255 255 / 88%);
  font-size: 10px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-training-surface .scenario-card-category::before,
.mobile-training-surface .scenario-card-description,
.mobile-training-surface .scenario-card-arrow {
  display: none;
}

.mobile-training-surface .scenario-card-content strong {
  position: static;
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mobile-training-surface .scenario-setup-panel {
  padding-top: 16px;
}

.mobile-training-surface .scenario-setup-summary {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
}

.mobile-training-surface .scenario-setup-cover {
  width: 88px;
  height: 112px;
  border-radius: 8px;
}

.mobile-training-surface .scenario-setup-copy h2 {
  font-size: 19px;
  line-height: 1.35;
}

.mobile-training-surface .scenario-setup-background,
.mobile-training-surface .scenario-setup-objective {
  font-size: 13px;
  line-height: 1.55;
}

.mobile-training-surface .training-workspace {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.mobile-training-surface .customer,
.mobile-training-surface .harness,
.mobile-training-surface .actions,
.mobile-training-surface .transcript,
.mobile-training-surface .scenario-guide {
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-card);
  background: var(--fd-surface);
}

.mobile-training-surface .customer {
  padding: 16px;
}

.mobile-training-surface .customer .avatar {
  width: 44px;
  height: 44px;
  font-size: 19px;
}

.mobile-training-surface .customer h2 {
  font-size: 17px;
}

.mobile-training-surface .customer p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mobile-training-surface .harness {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px 8px;
}

.mobile-training-surface .harness div {
  min-width: 0;
  padding: 0 8px;
}

.mobile-training-surface .harness span,
.mobile-training-surface .harness strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-training-surface .harness strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.mobile-training-surface .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.mobile-training-surface .difficulty-control {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--fd-line);
  border-radius: 12px;
  background: var(--fd-surface);
  color: var(--fd-ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.mobile-training-surface .difficulty-control select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border-color: var(--fd-line);
  border-radius: 8px;
  background: var(--fd-surface-soft);
  color: var(--fd-ink);
  font-size: 14px;
}

.mobile-training-surface .persona-control,
.mobile-training-surface .voice-control {
  grid-column: 1 / -1;
}

.mobile-training-surface .difficulty-experiment-panel {
  display: none !important;
}

.mobile-training-surface .call-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.mobile-training-surface .call-actions button {
  min-height: 46px;
  border-radius: 10px;
}

.mobile-training-surface .call-actions #stopBtn:disabled {
  display: none;
}

.mobile-training-surface .transcript {
  min-height: 170px;
  max-height: 42dvh;
  padding: 14px;
}

.mobile-training-surface .scenario-guide {
  padding: 14px;
}

.mobile-training-surface .live-session-stage {
  min-height: 100dvh;
}

@media (min-width: 720px) {
  .mobile-training-surface .shell {
    width: min(430px, 100%);
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(26, 26, 28, 0.05), 0 18px 48px rgba(26, 26, 28, 0.1);
  }

  .mobile-training-surface .workspace-nav {
    width: min(430px, 100%);
    margin: 0 auto;
  }
}
