@media (max-width: 980px) {
  .ex-console-head,
  .ex-head-main,
  .ex-workbench {
    grid-template-columns: 1fr;
  }
  .ex-setup-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 560px) {
  .ex-panel .panel-back-btn {
    width: fit-content;
  }
  .ex-console-head,
  .ex-pane {
    padding: 18px 14px;
  }
  .ex-head-main {
    gap: 12px;
  }
  .ex-title-block h3 {
    font-size: 22px;
  }
  .ex-stepper {
    overflow-x: auto;
  }
  .ex-stepper span {
    min-width: 118px;
  }
  .ex-uploader {
    grid-template-columns: 1fr;
  }
  .ex-uploader .actions {
    width: 100%;
  }
  .ex-file-workbench {
    min-height: 360px;
    padding: 16px;
    border-radius: 14px;
  }
  .ex-file-workbench-head {
    align-items: stretch;
    flex-direction: column;
  }
  .ex-file-workbench-head strong {
    font-size: 20px;
  }
  .ex-file-workbench-head .btn {
    width: 100%;
  }
  .ex-file-stack {
    min-height: 220px;
  }
  .ex-file-stack-item {
    width: min(68%, 240px);
    max-height: 230px;
    transform: translateX(calc(var(--ex-offset) * 44px)) rotate(calc(var(--ex-offset) * 6deg)) scale(calc(1 - (var(--ex-distance) * .05)));
  }
  .ex-file-current-meta {
    width: 100%;
    justify-content: center;
  }
  .ex-file-current-actions {
    width: 100%;
    justify-content: center;
  }
  .ex-main-actions {
    margin: 18px -14px -18px;
    padding: 12px 14px;
  }
  .ex-task-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ex-chat-row {
    grid-template-columns: 1fr;
  }
  .ex-chat-content {
    grid-column: 1 / -1;
  }
  .ex-chat-edit {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ex-upload-card {
    width: calc(100% + 28px);
    box-sizing: border-box;
    margin-left: -14px;
    margin-right: -14px;
    padding: 12px;
  }
  .ex-upload-card .ex-section-title {
    margin-bottom: 8px;
  }
  .ex-file-grid {
    width: 100%;
  }
  .ex-file-workbench {
    width: 100%;
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 14px;
    border-radius: 16px;
  }
  .ex-file-workbench-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
  }
  .ex-file-workbench-head strong {
    font-size: 20px;
    white-space: nowrap;
  }
  .ex-file-workbench-head span {
    grid-column: 1 / -1;
    margin-top: -4px;
    font-size: 12px;
  }
  .ex-file-workbench-head .btn {
    width: auto;
    min-width: 92px;
    min-height: 38px;
    padding: 8px 13px;
    font-size: 13px;
  }
  .ex-file-stack {
    min-height: 250px;
    height: auto;
    display: grid;
    place-items: center;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
    background: #f8fafc;
  }
  .ex-file-stack-item {
    display: block;
    position: absolute;
    width: min(76vw, 268px);
    max-height: 268px;
    aspect-ratio: 9 / 16;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
    opacity: .72;
    transform: translateX(calc(var(--ex-offset) * 42px)) rotate(calc(var(--ex-offset) * 5deg)) scale(calc(1 - (var(--ex-distance) * .045)));
  }
  .ex-file-stack-item.active {
    display: block;
    opacity: 1;
    box-shadow: none;
  }
  .ex-file-stack-item img {
    border-radius: inherit;
    object-fit: cover;
    background: transparent;
  }
  .ex-file-current {
    gap: 8px;
  }
  .ex-file-current-meta {
    padding: 9px 13px;
  }
  .ex-file-current-meta strong {
    font-size: 15px;
  }
  .ex-file-current-actions {
    justify-content: center;
  }
  .ex-file-current-actions .icon-btn {
    width: 36px;
    height: 36px;
  }
  .ex-file-current-actions .btn.danger {
    min-height: 36px;
    padding: 8px 14px;
  }
  .ex-empty-upload {
    min-height: 220px;
    padding: 22px;
  }
  .ex-empty-upload-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .ex-file-dots {
    max-height: 20px;
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  .ex-panel {
    width: calc(100vw - 16px);
    margin: 0 calc(50% - 50vw + 8px);
    border-radius: 0;
    background: #f7f7fa;
  }
  .ex-console-head {
    position: relative;
    top: auto;
    padding: 18px 16px 12px;
    background: #f7f7fa;
  }
  .ex-head-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ex-panel .panel-back-btn {
    min-height: 38px;
    padding: 8px 15px;
    border-radius: 999px;
    font-size: 14px;
  }
  .ex-title-block h3 {
    font-size: 34px;
    line-height: 1.1;
  }
  .ex-title-block .sub {
    display: block;
    max-width: none;
    margin-top: 10px;
    color: #5f6470;
    font-size: 16px;
    line-height: 1.62;
  }
  .ex-quota-card {
    width: 100%;
    border-radius: 999px;
  }
  .ex-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
    overflow: visible;
  }
  .ex-stepper span {
    min-width: 0;
    min-height: 48px;
    display: grid;
    grid-template-rows: 7px auto;
    justify-items: start;
    gap: 9px;
    font-size: 12px;
    white-space: nowrap;
  }
  .ex-stepper span::before {
    height: 7px;
  }
  .ex-stepper span b {
    width: auto;
    height: auto;
    display: inline;
    background: transparent;
    color: inherit;
    font-size: inherit;
  }
  .ex-wizard {
    padding: 16px 8px 0;
  }
  .ex-upload-card,
  .ex-setup-card,
  .ex-progress-card,
  .ex-generate-preview {
    width: calc(100% + 16px);
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 24px;
  }
  .ex-upload-card {
    min-height: 430px;
    padding: 0;
  }
  .ex-empty-upload {
    min-height: 430px;
    padding: 34px 20px;
    gap: 15px;
  }
  .ex-upload-icon {
    width: 74px;
    height: 74px;
    border-radius: 24px;
    font-size: 36px;
  }
  .ex-empty-upload strong {
    font-size: 26px;
  }
  .ex-empty-upload span {
    font-size: 15px;
  }
  .ex-empty-upload-actions {
    width: min(220px, 100%);
    grid-template-columns: 1fr;
  }
  .ex-empty-upload-actions .btn {
    min-height: 52px;
    font-size: 16px;
  }
  .ex-main-actions,
  .ex-stage-actions {
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 22px 22px 0 0;
  }
}

/* Final ex skill mobile fixes */
.ex-file-workbench-head .btn.dark {
  background: linear-gradient(135deg, #8f526b 0%, #bb7890 100%);
  color: #fff;
}
.ex-file-current-meta {
  min-width: 0;
  max-width: 220px;
}
@media (max-width: 640px) {
  .ex-console-head {
    gap: 8px;
    padding-bottom: 4px;
  }
  .ex-quota-card {
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 12px 16px;
    border-radius: 24px;
  }
  .ex-quota-card strong {
    font-size: 15px;
    line-height: 1.3;
  }
  .ex-quota-card p {
    font-size: 13px;
    line-height: 1.45;
  }
  .ex-quota-card .btn {
    width: 100%;
    max-width: none;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 15px;
  }
  .ex-stepper {
    gap: 8px;
    margin-top: 0;
  }
  .ex-stepper span {
    min-height: 38px;
    grid-template-rows: 6px auto;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    justify-items: start;
    gap: 7px;
    font-size: 11px;
  }
  .ex-stepper span::before {
    grid-column: 1 / -1;
  }
  .ex-stepper span b {
    margin-right: 2px;
  }
  .ex-stepper span b::after {
    content: ".";
  }
  .ex-wizard {
    padding-top: 4px;
  }
  .ex-step-panel {
    padding-bottom: 60px;
  }
  .ex-upload-card,
  .ex-setup-card,
  .ex-progress-card,
  .ex-generate-preview {
    margin-top: 0;
  }
  .ex-file-workbench {
    gap: 8px;
    margin-top: 0;
    padding: 12px;
  }
  .ex-file-workbench-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .ex-file-workbench-head .btn.dark {
    min-width: 86px;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    background: linear-gradient(135deg, #8f526b 0%, #bb7890 100%);
  }
  .ex-file-current-meta {
    width: auto;
    max-width: 50%;
    padding: 8px 18px;
  }
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generate-summary,
  .ex-step-panel[data-ex-step-panel="generate"] .ex-draft-preview-grid,
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-grid {
    grid-template-columns: 1fr;
  }
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-editor-head,
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-field-head {
    align-items: center;
    flex-direction: row;
  }
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-field-head .btn {
    width: auto;
    min-width: 78px;
  }
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-field {
    padding: 12px;
  }
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-input {
    min-height: 44px;
  }
  .ex-step-panel[data-ex-step-panel="generate"] .ex-generated-field textarea.ex-generated-input {
    min-height: 124px;
  }
  .ex-step-panel[data-ex-step-panel="review"] .ex-stage-actions,
  .ex-step-panel[data-ex-step-panel="generate"] .ex-stage-actions {
    justify-content: stretch;
  }
  .ex-step-panel[data-ex-step-panel="review"] .ex-stage-actions .btn,
  .ex-step-panel[data-ex-step-panel="generate"] .ex-stage-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Ex skill progress labels */
.ex-stepper {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.ex-stepper span {
  min-height: 38px;
  display: grid;
  grid-template-rows: 8px auto;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  justify-items: start;
  gap: 8px 4px;
  overflow: hidden;
  color: #7a7f8a;
  font-size: 13px;
  line-height: 1.2;
}
.ex-stepper span::before {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  height: 8px;
}
.ex-stepper span b {
  display: inline;
  color: #7a7f8a !important;
  font-size: inherit;
}
.ex-stepper span.active b,
.ex-stepper span.done b {
  color: #7a7f8a !important;
}

@media (max-width: 640px) {
  .ex-stepper {
    gap: 8px;
  }
  .ex-stepper span {
    min-height: 36px;
    display: grid;
    grid-template-rows: 7px auto;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px 3px;
    font-size: 11px;
    line-height: 1.2;
  }
  .ex-stepper span::before {
    grid-column: 1 / -1;
    height: 7px;
  }
  .ex-stepper span b {
    display: inline;
  }
}

/* Ex skill final spacing and flat upload fill */
.ex-step-panel .ex-pane-head {
  margin-bottom: 0;
}
.ex-wizard {
  padding-top: 0;
}
.ex-stepper {
  margin-bottom: 0;
}
.ex-step-panel {
  padding-bottom: 0;
}
.ex-upload-card {
  margin-top: 0;
  padding: 10px;
  background: #f6f4fb;
}
.ex-empty-upload {
  min-height: 480px;
  box-sizing: border-box;
  border: 0;
  border-radius: 22px;
  background: #f6f4fb;
}

@media (max-width: 640px) {
  .ex-console-head {
    padding-bottom: 0;
  }
  .ex-stepper {
    margin-bottom: 0;
  }
  .ex-step-panel .ex-pane-head {
    margin-bottom: 0;
  }
  .ex-wizard {
    padding-top: 0;
  }
  .ex-step-panel {
    padding-bottom: 0;
  }
  .ex-upload-card {
    margin-top: 0;
    padding: 10px;
    background: #f6f4fb;
  }
  .ex-empty-upload {
    min-height: 410px;
    padding: 28px 18px;
    border: 0;
    border-radius: 20px;
    background: #f6f4fb;
  }
}

/* Ex skill final spacing and neutral step numbers */
.ex-step-panel .ex-pane-head,
.ex-step-panel[data-ex-step-panel="upload"] .ex-pane-head,
.ex-step-panel[data-ex-step-panel="basic"] .ex-pane-head,
.ex-step-panel[data-ex-step-panel="review"] .ex-pane-head,
.ex-step-panel[data-ex-step-panel="generate"] .ex-pane-head {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: 0 !important;
}

.ex-wizard {
  padding-top: 0 !important;
}

.ex-stepper {
  margin-bottom: 0 !important;
}

.ex-step-panel {
  padding-bottom: 0 !important;
}

.ex-upload-card,
.ex-setup-card,
.ex-progress-card,
.ex-generate-preview {
  margin-top: 0 !important;
}

.ex-stepper span b,
.ex-stepper span.active b,
.ex-stepper span.done b {
  background: transparent !important;
  color: inherit !important;
  box-shadow: none !important;
}
